-#define ST(off) stack_base[ax + (off)]
+#define ST(off) PL_stack_base[ax + (off)]
#ifdef CAN_PROTOTYPE
#ifdef PERL_OBJECT
#define XS(name) void name(cv) CV* cv;
#endif
+#define na PL_na
+#define sv_undef PL_sv_undef
+#define sv_yes PL_sv_yes
+#define sv_no PL_sv_no
+
#define dXSARGS \
dSP; dMARK; \
- I32 ax = mark - stack_base + 1; \
+ I32 ax = mark - PL_stack_base + 1; \
I32 items = sp - mark
#define XSANY CvXSUBANY(cv)
#define XSRETURN(off) \
STMT_START { \
- stack_sp = stack_base + ax + ((off) - 1); \
+ PL_stack_sp = PL_stack_base + ax + ((off) - 1); \
return; \
} STMT_END
#define XST_mIV(i,v) (ST(i) = sv_2mortal(newSViv(v)) )
#define XST_mNV(i,v) (ST(i) = sv_2mortal(newSVnv(v)) )
#define XST_mPV(i,v) (ST(i) = sv_2mortal(newSVpv(v,0)))
-#define XST_mNO(i) (ST(i) = &sv_no )
-#define XST_mYES(i) (ST(i) = &sv_yes )
-#define XST_mUNDEF(i) (ST(i) = &sv_undef)
+#define XST_mNO(i) (ST(i) = &PL_sv_no )
+#define XST_mYES(i) (ST(i) = &PL_sv_yes )
+#define XST_mUNDEF(i) (ST(i) = &PL_sv_undef)
#define XSRETURN_IV(v) STMT_START { XST_mIV(0,v); XSRETURN(1); } STMT_END
#define XSRETURN_NV(v) STMT_START { XST_mNV(0,v); XSRETURN(1); } STMT_END
#ifdef XS_VERSION
# define XS_VERSION_BOOTCHECK \
STMT_START { \
+ SV *Sv; \
char *vn = Nullch, *module = SvPV(ST(0),na); \
if (items >= 2) /* version supplied as bootstrap arg */ \
Sv = ST(1); \
#endif
key = AvMAX(av) + 1;
while (key > AvFILLp(av) + 1)
- AvARRAY(av)[--key] = &sv_undef;
+ AvARRAY(av)[--key] = &PL_sv_undef;
while (key) {
sv = AvARRAY(av)[--key];
assert(sv);
- if (sv != &sv_undef) {
+ if (sv != &PL_sv_undef) {
dTHR;
(void)SvREFCNT_inc(sv);
}
}
key = AvARRAY(av) - AvALLOC(av);
while (key)
- AvALLOC(av)[--key] = &sv_undef;
+ AvALLOC(av)[--key] = &PL_sv_undef;
AvREAL_on(av);
}
SvPVX(av) = (char*)AvALLOC(av);
if (AvREAL(av)) {
while (tmp)
- ary[--tmp] = &sv_undef;
+ ary[--tmp] = &PL_sv_undef;
}
if (key > AvMAX(av) - 10) {
resized:
ary = AvALLOC(av) + AvMAX(av) + 1;
tmp = newmax - AvMAX(av);
- if (av == curstack) { /* Oops, grew stack (via av_store()?) */
- stack_sp = AvALLOC(av) + (stack_sp - stack_base);
- stack_base = AvALLOC(av);
- stack_max = stack_base + newmax;
+ if (av == PL_curstack) { /* Oops, grew stack (via av_store()?) */
+ PL_stack_sp = AvALLOC(av) + (PL_stack_sp - PL_stack_base);
+ PL_stack_base = AvALLOC(av);
+ PL_stack_max = PL_stack_base + newmax;
}
}
else {
New(2,AvALLOC(av), newmax+1, SV*);
ary = AvALLOC(av) + 1;
tmp = newmax;
- AvALLOC(av)[0] = &sv_undef; /* For the stacks */
+ AvALLOC(av)[0] = &PL_sv_undef; /* For the stacks */
}
if (AvREAL(av)) {
while (tmp)
- ary[--tmp] = &sv_undef;
+ ary[--tmp] = &PL_sv_undef;
}
SvPVX(av) = (char*)AvALLOC(av);
dTHR;
sv = sv_newmortal();
mg_copy((SV*)av, sv, 0, key);
- av_fetch_sv = sv;
- return &av_fetch_sv;
+ PL_av_fetch_sv = sv;
+ return &PL_av_fetch_sv;
}
}
sv = sv_newmortal();
return av_store(av,key,sv);
}
- if (AvARRAY(av)[key] == &sv_undef) {
+ if (AvARRAY(av)[key] == &PL_sv_undef) {
emptyness:
if (lval) {
sv = NEWSV(6,0);
else if (AvREIFY(av)
&& (!AvARRAY(av)[key] /* eg. @_ could have freed elts */
|| SvTYPE(AvARRAY(av)[key]) == SVTYPEMASK)) {
- AvARRAY(av)[key] = &sv_undef; /* 1/2 reify */
+ AvARRAY(av)[key] = &PL_sv_undef; /* 1/2 reify */
goto emptyness;
}
return &AvARRAY(av)[key];
if (!av)
return 0;
if (!val)
- val = &sv_undef;
+ val = &PL_sv_undef;
if (key < 0) {
key += AvFILL(av) + 1;
if (SvRMAGICAL(av)) {
if (mg_find((SV*)av,'P')) {
- if (val != &sv_undef) {
+ if (val != &PL_sv_undef) {
mg_copy((SV*)av, val, 0, key);
}
return 0;
if (AvFILLp(av) < key) {
if (!AvREAL(av)) {
dTHR;
- if (av == curstack && key > stack_sp - stack_base)
- stack_sp = stack_base + key; /* XPUSH in disguise */
+ if (av == PL_curstack && key > PL_stack_sp - PL_stack_base)
+ PL_stack_sp = PL_stack_base + key; /* XPUSH in disguise */
do
- ary[++AvFILLp(av)] = &sv_undef;
+ ary[++AvFILLp(av)] = &PL_sv_undef;
while (AvFILLp(av) < key);
}
AvFILLp(av) = key;
SvREFCNT_dec(ary[key]);
ary[key] = val;
if (SvSMAGICAL(av)) {
- if (val != &sv_undef) {
+ if (val != &PL_sv_undef) {
MAGIC* mg = SvMAGIC(av);
sv_magic(val, (SV*)av, toLOWER(mg->mg_type), 0, key);
}
key = AvFILLp(av) + 1;
while (key) {
SvREFCNT_dec(ary[--key]);
- ary[key] = &sv_undef;
+ ary[key] = &PL_sv_undef;
}
}
if (key = AvARRAY(av) - AvALLOC(av)) {
MAGIC* mg;
if (!av || AvFILL(av) < 0)
- return &sv_undef;
+ return &PL_sv_undef;
if (SvREADONLY(av))
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
PUTBACK;
ENTER;
if (perl_call_method("POP", G_SCALAR)) {
- retval = newSVsv(*stack_sp--);
+ retval = newSVsv(*PL_stack_sp--);
} else {
- retval = &sv_undef;
+ retval = &PL_sv_undef;
}
LEAVE;
POPSTACK;
return retval;
}
retval = AvARRAY(av)[AvFILLp(av)];
- AvARRAY(av)[AvFILLp(av)--] = &sv_undef;
+ AvARRAY(av)[AvFILLp(av)--] = &PL_sv_undef;
if (SvSMAGICAL(av))
mg_set((SV*)av);
return retval;
EXTEND(SP,1+num);
PUSHs(mg->mg_obj);
while (num-- > 0) {
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
}
PUTBACK;
ENTER;
ary = AvARRAY(av);
Move(ary, ary + num, i + 1, SV*);
do {
- ary[--num] = &sv_undef;
+ ary[--num] = &PL_sv_undef;
} while (num);
}
}
MAGIC* mg;
if (!av || AvFILL(av) < 0)
- return &sv_undef;
+ return &PL_sv_undef;
if (SvREADONLY(av))
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
PUTBACK;
ENTER;
if (perl_call_method("SHIFT", G_SCALAR)) {
- retval = newSVsv(*stack_sp--);
+ retval = newSVsv(*PL_stack_sp--);
} else {
- retval = &sv_undef;
+ retval = &PL_sv_undef;
}
LEAVE;
POPSTACK;
}
retval = *AvARRAY(av);
if (AvREAL(av))
- *AvARRAY(av) = &sv_undef;
+ *AvARRAY(av) = &PL_sv_undef;
SvPVX(av) = (char*)(AvARRAY(av) + 1);
AvMAX(av)--;
AvFILLp(av)--;
if (AvREAL(av)) {
while (key > fill) {
SvREFCNT_dec(ary[key]);
- ary[key--] = &sv_undef;
+ ary[key--] = &PL_sv_undef;
}
}
else {
while (key < fill)
- ary[++key] = &sv_undef;
+ ary[++key] = &PL_sv_undef;
}
AvFILLp(av) = fill;
mg_set((SV*)av);
}
else
- (void)av_store(av,fill,&sv_undef);
+ (void)av_store(av,fill,&PL_sv_undef);
}
#define BGET_pvcontents(arg) arg = pv.xpv_pv
#define BGET_strconst(arg) STMT_START { \
- for (arg = tokenbuf; (*arg = BGET_FGETC()); arg++) /* nothing */; \
- arg = tokenbuf; \
+ for (arg = PL_tokenbuf; (*arg = BGET_FGETC()); arg++) /* nothing */; \
+ arg = PL_tokenbuf; \
} STMT_END
#define BGET_double(arg) STMT_START { \
#define BGET_svindex(arg) BGET_objindex(arg, svindex)
#define BGET_opindex(arg) BGET_objindex(arg, opindex)
-#define BSET_ldspecsv(sv, arg) sv = specialsv_list[arg]
+#define BSET_ldspecsv(sv, arg) sv = PL_specialsv_list[arg]
#define BSET_sv_refcnt_add(svrefcnt, arg) svrefcnt += arg
#define BSET_gp_refcnt_add(gprefcnt, arg) gprefcnt += arg
{
opindex arg;
BGET_opindex(arg);
- main_start = arg;
+ PL_main_start = arg;
break;
}
case INSN_MAIN_ROOT: /* 117 */
{
opindex arg;
BGET_opindex(arg);
- main_root = arg;
+ PL_main_root = arg;
break;
}
case INSN_CURPAD: /* 118 */
{
svindex arg;
BGET_svindex(arg);
- BSET_curpad(curpad, arg);
+ BSET_curpad(PL_curpad, arg);
break;
}
default:
;
#define INIT_SPECIALSV_LIST STMT_START { \
- specialsv_list[0] = Nullsv; \
- specialsv_list[1] = &sv_undef; \
- specialsv_list[2] = &sv_yes; \
- specialsv_list[3] = &sv_no; \
+ PL_specialsv_list[0] = Nullsv; \
+ PL_specialsv_list[1] = &PL_sv_undef; \
+ PL_specialsv_list[2] = &PL_sv_yes; \
+ PL_specialsv_list[3] = &PL_sv_no; \
} STMT_END
cx->blk_sub.cv = cv; \
cx->blk_sub.gv = gv; \
cx->blk_sub.hasargs = 0; \
- cx->blk_sub.dfoutgv = defoutgv; \
+ cx->blk_sub.dfoutgv = PL_defoutgv; \
(void)SvREFCNT_inc(cx->blk_sub.dfoutgv)
#define POPSUB(cx) \
#else
#define POPSAVEARRAY() \
STMT_START { \
- SvREFCNT_dec(GvAV(defgv)); \
- GvAV(defgv) = cxsub.savearray; \
+ SvREFCNT_dec(GvAV(PL_defgv)); \
+ GvAV(PL_defgv) = cxsub.savearray; \
} STMT_END
#endif /* USE_THREADS */
};
#define PUSHEVAL(cx,n,fgv) \
- cx->blk_eval.old_in_eval = in_eval; \
+ cx->blk_eval.old_in_eval = PL_in_eval; \
cx->blk_eval.old_op_type = op->op_type; \
cx->blk_eval.old_name = n; \
- cx->blk_eval.old_eval_root = eval_root; \
- cx->blk_eval.cur_text = linestr;
+ cx->blk_eval.old_eval_root = PL_eval_root; \
+ cx->blk_eval.cur_text = PL_linestr;
#define POPEVAL(cx) \
- in_eval = cx->blk_eval.old_in_eval; \
+ PL_in_eval = cx->blk_eval.old_in_eval; \
optype = cx->blk_eval.old_op_type; \
- eval_root = cx->blk_eval.old_eval_root;
+ PL_eval_root = cx->blk_eval.old_eval_root;
/* loop context */
struct block_loop {
};
#define PUSHLOOP(cx, ivar, s) \
- cx->blk_loop.label = curcop->cop_label; \
- cx->blk_loop.resetsp = s - stack_base; \
+ cx->blk_loop.label = PL_curcop->cop_label; \
+ cx->blk_loop.resetsp = s - PL_stack_base; \
cx->blk_loop.redo_op = cLOOP->op_redoop; \
cx->blk_loop.next_op = cLOOP->op_nextop; \
cx->blk_loop.last_op = cLOOP->op_lastop; \
#define POPLOOP1(cx) \
cxloop = cx->blk_loop; /* because DESTROY may clobber *cx */ \
- newsp = stack_base + cxloop.resetsp;
+ newsp = PL_stack_base + cxloop.resetsp;
#define POPLOOP2() \
SvREFCNT_dec(cxloop.iterlval); \
SvREFCNT_dec(*cxloop.itervar); \
*cxloop.itervar = cxloop.itersave; \
} \
- if (cxloop.iterary && cxloop.iterary != curstack) \
+ if (cxloop.iterary && cxloop.iterary != PL_curstack) \
SvREFCNT_dec(cxloop.iterary);
/* context common to subroutines, evals and loops */
/* Enter a block. */
#define PUSHBLOCK(cx,t,sp) CXINC, cx = &cxstack[cxstack_ix], \
cx->cx_type = t, \
- cx->blk_oldsp = sp - stack_base, \
- cx->blk_oldcop = curcop, \
- cx->blk_oldmarksp = markstack_ptr - markstack, \
- cx->blk_oldscopesp = scopestack_ix, \
- cx->blk_oldretsp = retstack_ix, \
- cx->blk_oldpm = curpm, \
+ cx->blk_oldsp = sp - PL_stack_base, \
+ cx->blk_oldcop = PL_curcop, \
+ cx->blk_oldmarksp = PL_markstack_ptr - PL_markstack, \
+ cx->blk_oldscopesp = PL_scopestack_ix, \
+ cx->blk_oldretsp = PL_retstack_ix, \
+ cx->blk_oldpm = PL_curpm, \
cx->blk_gimme = gimme; \
DEBUG_l( PerlIO_printf(PerlIO_stderr(), "Entering block %ld, type %s\n", \
(long)cxstack_ix, block_type[t]); )
/* Exit a block (RETURN and LAST). */
#define POPBLOCK(cx,pm) cx = &cxstack[cxstack_ix--], \
- newsp = stack_base + cx->blk_oldsp, \
- curcop = cx->blk_oldcop, \
- markstack_ptr = markstack + cx->blk_oldmarksp, \
- scopestack_ix = cx->blk_oldscopesp, \
- retstack_ix = cx->blk_oldretsp, \
- pm = cx->blk_oldpm, \
- gimme = cx->blk_gimme; \
+ newsp = PL_stack_base + cx->blk_oldsp, \
+ PL_curcop = cx->blk_oldcop, \
+ PL_markstack_ptr = PL_markstack + cx->blk_oldmarksp, \
+ PL_scopestack_ix = cx->blk_oldscopesp, \
+ PL_retstack_ix = cx->blk_oldretsp, \
+ pm = cx->blk_oldpm, \
+ gimme = cx->blk_gimme; \
DEBUG_l( PerlIO_printf(PerlIO_stderr(), "Leaving block %ld, type %s\n", \
(long)cxstack_ix+1,block_type[cx->cx_type]); )
/* Continue a block elsewhere (NEXT and REDO). */
-#define TOPBLOCK(cx) cx = &cxstack[cxstack_ix], \
- stack_sp = stack_base + cx->blk_oldsp, \
- markstack_ptr = markstack + cx->blk_oldmarksp, \
- scopestack_ix = cx->blk_oldscopesp, \
- retstack_ix = cx->blk_oldretsp
+#define TOPBLOCK(cx) cx = &cxstack[cxstack_ix], \
+ PL_stack_sp = PL_stack_base + cx->blk_oldsp, \
+ PL_markstack_ptr = PL_markstack + cx->blk_oldmarksp, \
+ PL_scopestack_ix = cx->blk_oldscopesp, \
+ PL_retstack_ix = cx->blk_oldretsp
/* substitution context */
struct subst {
typedef struct stackinfo PERL_SI;
-#define cxstack (curstackinfo->si_cxstack)
-#define cxstack_ix (curstackinfo->si_cxix)
-#define cxstack_max (curstackinfo->si_cxmax)
+#define cxstack (PL_curstackinfo->si_cxstack)
+#define cxstack_ix (PL_curstackinfo->si_cxix)
+#define cxstack_max (PL_curstackinfo->si_cxmax)
#ifdef DEBUGGING
-# define SET_MARKBASE curstackinfo->si_markbase = markstack_ptr
+# define SET_MARKBASE PL_curstackinfo->si_markbase = PL_markstack_ptr
#else
# define SET_MARKBASE NOOP
#endif
#define PUSHSTACKi(type) \
STMT_START { \
- PERL_SI *next = curstackinfo->si_next; \
+ PERL_SI *next = PL_curstackinfo->si_next; \
if (!next) { \
next = new_stackinfo(32, 2048/sizeof(PERL_CONTEXT) - 1); \
- next->si_prev = curstackinfo; \
- curstackinfo->si_next = next; \
+ next->si_prev = PL_curstackinfo; \
+ PL_curstackinfo->si_next = next; \
} \
next->si_type = type; \
next->si_cxix = -1; \
AvFILLp(next->si_stack) = 0; \
- SWITCHSTACK(curstack,next->si_stack); \
- curstackinfo = next; \
+ SWITCHSTACK(PL_curstack,next->si_stack); \
+ PL_curstackinfo = next; \
SET_MARKBASE; \
} STMT_END
#define POPSTACK \
STMT_START { \
- PERL_SI *prev = curstackinfo->si_prev; \
+ PERL_SI *prev = PL_curstackinfo->si_prev; \
if (!prev) { \
PerlIO_printf(PerlIO_stderr(), "panic: POPSTACK\n"); \
my_exit(1); \
} \
- SWITCHSTACK(curstack,prev->si_stack); \
+ SWITCHSTACK(PL_curstack,prev->si_stack); \
/* don't free prev here, free them all at the END{} */ \
- curstackinfo = prev; \
+ PL_curstackinfo = prev; \
} STMT_END
#define POPSTACK_TO(s) \
STMT_START { \
- while (curstack != s) { \
+ while (PL_curstack != s) { \
dounwind(-1); \
POPSTACK; \
} \
dTHR;
va_list args;
register I32 i;
- GV* gv = curcop->cop_filegv;
+ GV* gv = PL_curcop->cop_filegv;
#ifdef USE_THREADS
PerlIO_printf(Perl_debug_log, "0x%lx (%s:%ld)\t",
#else
PerlIO_printf(Perl_debug_log, "(%s:%ld)\t",
SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "<free>",
- (long)curcop->cop_line);
+ (long)PL_curcop->cop_line);
#endif /* USE_THREADS */
- for (i=0; i<dlevel; i++)
- PerlIO_printf(Perl_debug_log, "%c%c ",debname[i],debdelim[i]);
+ for (i=0; i<PL_dlevel; i++)
+ PerlIO_printf(Perl_debug_log, "%c%c ",PL_debname[i],PL_debdelim[i]);
va_start(args, pat);
(void) PerlIO_vprintf(Perl_debug_log,pat,args);
deb_growlevel(void)
{
#ifdef DEBUGGING
- dlmax += 128;
- Renew(debname, dlmax, char);
- Renew(debdelim, dlmax, char);
+ PL_dlmax += 128;
+ Renew(PL_debname, PL_dlmax, char);
+ Renew(PL_debdelim, PL_dlmax, char);
#endif /* DEBUGGING */
}
#ifdef DEBUGGING
dTHR;
PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
- (unsigned long)curstack, (unsigned long)stack_base,
- (long)*markstack_ptr, (long)(stack_sp-stack_base),
- (long)(stack_max-stack_base));
+ (unsigned long)PL_curstack, (unsigned long)PL_stack_base,
+ (long)*PL_markstack_ptr, (long)(PL_stack_sp-PL_stack_base),
+ (long)(PL_stack_max-PL_stack_base));
PerlIO_printf(Perl_debug_log, "%8lx %8lx %8ld %8ld %8ld\n",
- (unsigned long)mainstack, (unsigned long)AvARRAY(curstack),
- (long)mainstack, (long)AvFILLp(curstack), (long)AvMAX(curstack));
+ (unsigned long)PL_mainstack, (unsigned long)AvARRAY(PL_curstack),
+ (long)PL_mainstack, (long)AvFILLp(PL_curstack), (long)AvMAX(PL_curstack));
#endif /* DEBUGGING */
return 0;
}
{
#ifdef DEBUGGING
dTHR;
- I32 top = stack_sp - stack_base;
+ I32 top = PL_stack_sp - PL_stack_base;
register I32 i = top - 30;
- I32 *markscan = curstackinfo->si_markbase;
+ I32 *markscan = PL_curstackinfo->si_markbase;
if (i < 0)
i = 0;
- while (++markscan <= markstack_ptr)
+ while (++markscan <= PL_markstack_ptr)
if (*markscan >= i)
break;
#else
PerlIO_printf(Perl_debug_log, i ? " => ... " : " => ");
#endif /* USE_THREADS */
- if (stack_base[0] != &sv_undef || stack_sp < stack_base)
+ if (PL_stack_base[0] != &PL_sv_undef || PL_stack_sp < PL_stack_base)
PerlIO_printf(Perl_debug_log, " [STACK UNDERFLOW!!!]\n");
do {
++i;
- if (markscan <= markstack_ptr && *markscan < i) {
+ if (markscan <= PL_markstack_ptr && *markscan < i) {
do {
++markscan;
PerlIO_putc(Perl_debug_log, '*');
}
- while (markscan <= markstack_ptr && *markscan < i);
+ while (markscan <= PL_markstack_ptr && *markscan < i);
PerlIO_printf(Perl_debug_log, " ");
}
if (i > top)
break;
- PerlIO_printf(Perl_debug_log, "%-4s ", SvPEEK(stack_base[i]));
+ PerlIO_printf(Perl_debug_log, "%-4s ", SvPEEK(PL_stack_base[i]));
}
while (1);
PerlIO_printf(Perl_debug_log, "\n");
int result;
bool was_fdopen = FALSE;
- forkprocess = 1; /* assume true if no fork */
+ PL_forkprocess = 1; /* assume true if no fork */
if (IoIFP(io)) {
fd = PerlIO_fileno(IoIFP(io));
if (IoTYPE(io) == '-')
result = 0;
- else if (fd <= maxsysfd) {
+ else if (fd <= PL_maxsysfd) {
saveifp = IoIFP(io);
saveofp = IoOFP(io);
savetype = IoTYPE(io);
}
else
result = PerlIO_close(IoIFP(io));
- if (result == EOF && fd > maxsysfd)
+ if (result == EOF && fd > PL_maxsysfd)
PerlIO_printf(PerlIO_stderr(), "Warning: unable to close filehandle %s properly.\n",
GvENAME(gv));
IoOFP(io) = IoIFP(io) = Nullfp;
TAINT_PROPER("piped open");
if (name[strlen(name)-1] == '|') {
name[strlen(name)-1] = '\0' ;
- if (dowarn)
+ if (PL_dowarn)
warn("Can't do bidirectional pipe");
}
fp = PerlProc_popen(name,"w");
}
}
if (!fp) {
- if (dowarn && IoTYPE(io) == '<' && strchr(name, '\n'))
+ if (PL_dowarn && IoTYPE(io) == '<' && strchr(name, '\n'))
warn(warn_nl, "open");
goto say_false;
}
if (IoTYPE(io) &&
IoTYPE(io) != '|' && IoTYPE(io) != '-') {
dTHR;
- if (PerlLIO_fstat(PerlIO_fileno(fp),&statbuf) < 0) {
+ if (PerlLIO_fstat(PerlIO_fileno(fp),&PL_statbuf) < 0) {
(void)PerlIO_close(fp);
goto say_false;
}
- if (S_ISSOCK(statbuf.st_mode))
+ if (S_ISSOCK(PL_statbuf.st_mode))
IoTYPE(io) = 's'; /* in case a socket was passed in to us */
#ifdef HAS_SOCKET
else if (
#ifdef S_IFMT
- !(statbuf.st_mode & S_IFMT)
+ !(PL_statbuf.st_mode & S_IFMT)
#else
!statbuf.st_mode
#endif
SV *sv;
PerlLIO_dup2(PerlIO_fileno(fp), fd);
- sv = *av_fetch(fdpid,PerlIO_fileno(fp),TRUE);
+ sv = *av_fetch(PL_fdpid,PerlIO_fileno(fp),TRUE);
(void)SvUPGRADE(sv, SVt_IV);
pid = SvIVX(sv);
SvIVX(sv) = 0;
- sv = *av_fetch(fdpid,fd,TRUE);
+ sv = *av_fetch(PL_fdpid,fd,TRUE);
(void)SvUPGRADE(sv, SVt_IV);
SvIVX(sv) = pid;
if (!was_fdopen)
}
#if defined(HAS_FCNTL) && defined(F_SETFD)
fd = PerlIO_fileno(fp);
- fcntl(fd,F_SETFD,fd > maxsysfd);
+ fcntl(fd,F_SETFD,fd > PL_maxsysfd);
#endif
IoIFP(io) = fp;
if (writing) {
dTHR;
if (IoTYPE(io) == 's'
- || (IoTYPE(io) == '>' && S_ISCHR(statbuf.st_mode)) ) {
+ || (IoTYPE(io) == '>' && S_ISCHR(PL_statbuf.st_mode)) ) {
if (!(IoOFP(io) = PerlIO_fdopen(PerlIO_fileno(fp),"w"))) {
PerlIO_close(fp);
IoIFP(io) = Nullfp;
int fileuid;
int filegid;
- if (!argvoutgv)
- argvoutgv = gv_fetchpv("ARGVOUT",TRUE,SVt_PVIO);
- if (filemode & (S_ISUID|S_ISGID)) {
- PerlIO_flush(IoIFP(GvIOn(argvoutgv))); /* chmod must follow last write */
+ if (!PL_argvoutgv)
+ PL_argvoutgv = gv_fetchpv("ARGVOUT",TRUE,SVt_PVIO);
+ if (PL_filemode & (S_ISUID|S_ISGID)) {
+ PerlIO_flush(IoIFP(GvIOn(PL_argvoutgv))); /* chmod must follow last write */
#ifdef HAS_FCHMOD
- (void)fchmod(lastfd,filemode);
+ (void)fchmod(PL_lastfd,PL_filemode);
#else
(void)PerlLIO_chmod(oldname,filemode);
#endif
}
- filemode = 0;
+ PL_filemode = 0;
while (av_len(GvAV(gv)) >= 0) {
dTHR;
STRLEN oldlen;
SAVEFREESV(sv);
sv_setsv(GvSV(gv),sv);
SvSETMAGIC(GvSV(gv));
- oldname = SvPVx(GvSV(gv), oldlen);
- if (do_open(gv,oldname,oldlen,inplace!=0,0,0,Nullfp)) {
- if (inplace) {
+ PL_oldname = SvPVx(GvSV(gv), oldlen);
+ if (do_open(gv,PL_oldname,oldlen,PL_inplace!=0,0,0,Nullfp)) {
+ if (PL_inplace) {
TAINT_PROPER("inplace open");
- if (oldlen == 1 && *oldname == '-') {
+ if (oldlen == 1 && *PL_oldname == '-') {
setdefout(gv_fetchpv("STDOUT",TRUE,SVt_PVIO));
return IoIFP(GvIOp(gv));
}
filedev = statbuf.st_dev;
fileino = statbuf.st_ino;
#endif
- filemode = statbuf.st_mode;
- fileuid = statbuf.st_uid;
- filegid = statbuf.st_gid;
- if (!S_ISREG(filemode)) {
+ PL_filemode = PL_statbuf.st_mode;
+ fileuid = PL_statbuf.st_uid;
+ filegid = PL_statbuf.st_gid;
+ if (!S_ISREG(PL_filemode)) {
warn("Can't do inplace edit: %s is not a regular file",
- oldname );
+ PL_oldname );
do_close(gv,FALSE);
continue;
}
- if (*inplace) {
- char *star = strchr(inplace, '*');
+ if (*PL_inplace) {
+ char *star = strchr(PL_inplace, '*');
if (star) {
- char *begin = inplace;
+ char *begin = PL_inplace;
sv_setpvn(sv, "", 0);
do {
sv_catpvn(sv, begin, star - begin);
- sv_catpvn(sv, oldname, oldlen);
+ sv_catpvn(sv, PL_oldname, oldlen);
begin = ++star;
} while ((star = strchr(begin, '*')));
if (*begin)
sv_catpv(sv,begin);
}
else {
- sv_catpv(sv,inplace);
+ sv_catpv(sv,PL_inplace);
}
#ifndef FLEXFILENAMES
if (PerlLIO_stat(SvPVX(sv),&statbuf) >= 0
#endif
#ifdef HAS_RENAME
#ifndef DOSISH
- if (PerlLIO_rename(oldname,SvPVX(sv)) < 0) {
+ if (PerlLIO_rename(PL_oldname,SvPVX(sv)) < 0) {
warn("Can't rename %s to %s: %s, skipping file",
- oldname, SvPVX(sv), Strerror(errno) );
+ PL_oldname, SvPVX(sv), Strerror(errno) );
do_close(gv,FALSE);
continue;
}
else {
#if !defined(DOSISH) && !defined(AMIGAOS)
# ifndef VMS /* Don't delete; use automatic file versioning */
- if (UNLINK(oldname) < 0) {
+ if (UNLINK(PL_oldname) < 0) {
warn("Can't remove %s: %s, skipping file",
- oldname, Strerror(errno) );
+ PL_oldname, Strerror(errno) );
do_close(gv,FALSE);
continue;
}
#endif
}
- sv_setpvn(sv,">",!inplace);
- sv_catpvn(sv,oldname,oldlen);
+ sv_setpvn(sv,">",!PL_inplace);
+ sv_catpvn(sv,PL_oldname,oldlen);
SETERRNO(0,0); /* in case sprintf set errno */
- if (!do_open(argvoutgv,SvPVX(sv),SvCUR(sv),inplace!=0,
+ if (!do_open(PL_argvoutgv,SvPVX(sv),SvCUR(sv),PL_inplace!=0,
O_WRONLY|O_CREAT|OPEN_EXCL,0666,Nullfp)) {
warn("Can't do inplace edit on %s: %s",
- oldname, Strerror(errno) );
+ PL_oldname, Strerror(errno) );
do_close(gv,FALSE);
continue;
}
- setdefout(argvoutgv);
- lastfd = PerlIO_fileno(IoIFP(GvIOp(argvoutgv)));
- (void)PerlLIO_fstat(lastfd,&statbuf);
+ setdefout(PL_argvoutgv);
+ PL_lastfd = PerlIO_fileno(IoIFP(GvIOp(PL_argvoutgv)));
+ (void)PerlLIO_fstat(PL_lastfd,&PL_statbuf);
#ifdef HAS_FCHMOD
- (void)fchmod(lastfd,filemode);
+ (void)fchmod(PL_lastfd,PL_filemode);
#else
# if !(defined(WIN32) && defined(__BORLANDC__))
/* Borland runtime creates a readonly file! */
(void)PerlLIO_chmod(oldname,filemode);
# endif
#endif
- if (fileuid != statbuf.st_uid || filegid != statbuf.st_gid) {
+ if (fileuid != PL_statbuf.st_uid || filegid != PL_statbuf.st_gid) {
#ifdef HAS_FCHOWN
- (void)fchown(lastfd,fileuid,filegid);
+ (void)fchown(PL_lastfd,fileuid,filegid);
#else
#ifdef HAS_CHOWN
(void)PerlLIO_chown(oldname,fileuid,filegid);
}
else
PerlIO_printf(PerlIO_stderr(), "Can't open %s: %s\n",
- SvPV(sv, na), Strerror(errno));
+ SvPV(sv, PL_na), Strerror(errno));
}
- if (inplace) {
- (void)do_close(argvoutgv,FALSE);
+ if (PL_inplace) {
+ (void)do_close(PL_argvoutgv,FALSE);
setdefout(gv_fetchpv("STDOUT",TRUE,SVt_PVIO));
}
return Nullfp;
goto badexit;
}
- sv_setsv(sv,&sv_yes);
+ sv_setsv(sv,&PL_sv_yes);
return;
badexit:
- sv_setsv(sv,&sv_undef);
+ sv_setsv(sv,&PL_sv_undef);
return;
}
#endif
IO *io;
if (!gv)
- gv = argvgv;
+ gv = PL_argvgv;
if (!gv || SvTYPE(gv) != SVt_PVGV) {
if (not_implicit)
SETERRNO(EBADF,SS$_IVCHAN);
io = GvIO(gv);
if (!io) { /* never opened */
if (not_implicit) {
- if (dowarn)
+ if (PL_dowarn)
warn("Close on unopened file <%s>",GvENAME(gv));
SETERRNO(EBADF,SS$_IVCHAN);
}
PerlIO_set_cnt(IoIFP(io),-1);
}
if (op->op_flags & OPf_SPECIAL) { /* not necessarily a real EOF yet? */
- if (!nextargv(argvgv)) /* get another fp handy */
+ if (!nextargv(PL_argvgv)) /* get another fp handy */
return TRUE;
}
else
#endif
return PerlIO_tell(fp);
}
- if (dowarn)
+ if (PL_dowarn)
warn("tell() on unopened file");
SETERRNO(EBADF,RMS$_IFI);
return -1L;
#endif
return PerlIO_seek(fp, pos, whence) >= 0;
}
- if (dowarn)
+ if (PL_dowarn)
warn("seek() on unopened file");
SETERRNO(EBADF,RMS$_IFI);
return FALSE;
if (gv && (io = GvIO(gv)) && (fp = IoIFP(io)))
return PerlLIO_lseek(PerlIO_fileno(fp), pos, whence);
- if (dowarn)
+ if (PL_dowarn)
warn("sysseek() on unopened file");
SETERRNO(EBADF,RMS$_IFI);
return -1L;
/* assuming fp is checked earlier */
if (!sv)
return TRUE;
- if (ofmt) {
+ if (PL_ofmt) {
if (SvGMAGICAL(sv))
mg_get(sv);
if (SvIOK(sv) && SvIVX(sv) != 0) {
- PerlIO_printf(fp, ofmt, (double)SvIVX(sv));
+ PerlIO_printf(fp, PL_ofmt, (double)SvIVX(sv));
return !PerlIO_error(fp);
}
if ( (SvNOK(sv) && SvNVX(sv) != 0.0)
|| (looks_like_number(sv) && sv_2nv(sv) != 0.0) ) {
- PerlIO_printf(fp, ofmt, SvNVX(sv));
+ PerlIO_printf(fp, PL_ofmt, SvNVX(sv));
return !PerlIO_error(fp);
}
}
switch (SvTYPE(sv)) {
case SVt_NULL:
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
return TRUE;
case SVt_IV:
do_fstat:
io = GvIO(tmpgv);
if (io && IoIFP(io)) {
- statgv = tmpgv;
- sv_setpv(statname,"");
- laststype = OP_STAT;
- return (laststatval = PerlLIO_fstat(PerlIO_fileno(IoIFP(io)), &statcache));
+ PL_statgv = tmpgv;
+ sv_setpv(PL_statname,"");
+ PL_laststype = OP_STAT;
+ return (PL_laststatval = PerlLIO_fstat(PerlIO_fileno(IoIFP(io)), &PL_statcache));
}
else {
- if (tmpgv == defgv)
- return laststatval;
- if (dowarn)
+ if (tmpgv == PL_defgv)
+ return PL_laststatval;
+ if (PL_dowarn)
warn("Stat on unopened file <%s>",
GvENAME(tmpgv));
- statgv = Nullgv;
- sv_setpv(statname,"");
- return (laststatval = -1);
+ PL_statgv = Nullgv;
+ sv_setpv(PL_statname,"");
+ return (PL_laststatval = -1);
}
}
else {
goto do_fstat;
}
- s = SvPV(sv, na);
- statgv = Nullgv;
- sv_setpv(statname, s);
- laststype = OP_STAT;
- laststatval = PerlLIO_stat(s, &statcache);
- if (laststatval < 0 && dowarn && strchr(s, '\n'))
+ s = SvPV(sv, PL_na);
+ PL_statgv = Nullgv;
+ sv_setpv(PL_statname, s);
+ PL_laststype = OP_STAT;
+ PL_laststatval = PerlLIO_stat(s, &PL_statcache);
+ if (PL_laststatval < 0 && PL_dowarn && strchr(s, '\n'))
warn(warn_nl, "stat");
- return laststatval;
+ return PL_laststatval;
}
}
SV *sv;
if (op->op_flags & OPf_REF) {
EXTEND(SP,1);
- if (cGVOP->op_gv == defgv) {
- if (laststype != OP_LSTAT)
+ if (cGVOP->op_gv == PL_defgv) {
+ if (PL_laststype != OP_LSTAT)
croak("The stat preceding -l _ wasn't an lstat");
- return laststatval;
+ return PL_laststatval;
}
croak("You can't use -l on a filehandle");
}
- laststype = OP_LSTAT;
- statgv = Nullgv;
+ PL_laststype = OP_LSTAT;
+ PL_statgv = Nullgv;
sv = POPs;
PUTBACK;
- sv_setpv(statname,SvPV(sv, na));
+ sv_setpv(PL_statname,SvPV(sv, PL_na));
#ifdef HAS_LSTAT
- laststatval = PerlLIO_lstat(SvPV(sv, na),&statcache);
+ PL_laststatval = PerlLIO_lstat(SvPV(sv, PL_na),&PL_statcache);
#else
laststatval = PerlLIO_stat(SvPV(sv, na),&statcache);
#endif
- if (laststatval < 0 && dowarn && strchr(SvPV(sv, na), '\n'))
+ if (PL_laststatval < 0 && PL_dowarn && strchr(SvPV(sv, PL_na), '\n'))
warn(warn_nl, "lstat");
- return laststatval;
+ return PL_laststatval;
}
bool
if (sp > mark) {
dTHR;
- New(401,Argv, sp - mark + 1, char*);
- a = Argv;
+ New(401,PL_Argv, sp - mark + 1, char*);
+ a = PL_Argv;
while (++mark <= sp) {
if (*mark)
- *a++ = SvPVx(*mark, na);
+ *a++ = SvPVx(*mark, PL_na);
else
*a++ = "";
}
*a = Nullch;
- if (*Argv[0] != '/') /* will execvp use PATH? */
+ if (*PL_Argv[0] != '/') /* will execvp use PATH? */
TAINT_ENV(); /* testing IFS here is overkill, probably */
- if (really && *(tmps = SvPV(really, na)))
- PerlProc_execvp(tmps,Argv);
+ if (really && *(tmps = SvPV(really, PL_na)))
+ PerlProc_execvp(tmps,PL_Argv);
else
- PerlProc_execvp(Argv[0],Argv);
- if (dowarn)
- warn("Can't exec \"%s\": %s", Argv[0], Strerror(errno));
+ PerlProc_execvp(PL_Argv[0],PL_Argv);
+ if (PL_dowarn)
+ warn("Can't exec \"%s\": %s", PL_Argv[0], Strerror(errno));
}
do_execfree();
return FALSE;
void
do_execfree(void)
{
- if (Argv) {
- Safefree(Argv);
- Argv = Null(char **);
+ if (PL_Argv) {
+ Safefree(PL_Argv);
+ PL_Argv = Null(char **);
}
- if (Cmd) {
- Safefree(Cmd);
- Cmd = Nullch;
+ if (PL_Cmd) {
+ Safefree(PL_Cmd);
+ PL_Cmd = Nullch;
}
}
/* save an extra exec if possible */
#ifdef CSH
- if (strnEQ(cmd,cshname,cshlen) && strnEQ(cmd+cshlen," -c",3)) {
+ if (strnEQ(cmd,PL_cshname,PL_cshlen) && strnEQ(cmd+PL_cshlen," -c",3)) {
strcpy(flags,"-c");
- s = cmd+cshlen+3;
+ s = cmd+PL_cshlen+3;
if (*s == 'f') {
s++;
strcat(flags,"f");
*--s = '\0';
if (s[-1] == '\'') {
*--s = '\0';
- PerlProc_execl(cshname,"csh", flags,ncmd,(char*)0);
+ PerlProc_execl(PL_cshname,"csh", flags,ncmd,(char*)0);
*s = '\'';
return FALSE;
}
break;
}
doshell:
- PerlProc_execl(sh_path, "sh", "-c", cmd, (char*)0);
+ PerlProc_execl(PL_sh_path, "sh", "-c", cmd, (char*)0);
return FALSE;
}
}
- New(402,Argv, (s - cmd) / 2 + 2, char*);
- Cmd = savepvn(cmd, s-cmd);
- a = Argv;
- for (s = Cmd; *s;) {
+ New(402,PL_Argv, (s - cmd) / 2 + 2, char*);
+ PL_Cmd = savepvn(cmd, s-cmd);
+ a = PL_Argv;
+ for (s = PL_Cmd; *s;) {
while (*s && isSPACE(*s)) s++;
if (*s)
*(a++) = s;
*s++ = '\0';
}
*a = Nullch;
- if (Argv[0]) {
- PerlProc_execvp(Argv[0],Argv);
+ if (PL_Argv[0]) {
+ PerlProc_execvp(PL_Argv[0],PL_Argv);
if (errno == ENOEXEC) { /* for system V NIH syndrome */
do_execfree();
goto doshell;
}
- if (dowarn)
- warn("Can't exec \"%s\": %s", Argv[0], Strerror(errno));
+ if (PL_dowarn)
+ warn("Can't exec \"%s\": %s", PL_Argv[0], Strerror(errno));
}
do_execfree();
return FALSE;
SV **oldmark = mark;
#define APPLY_TAINT_PROPER() \
- STMT_START { \
- if (tainting && tainted) { goto taint_proper_label; } \
+ STMT_START { \
+ if (PL_tainting && PL_tainted) { goto taint_proper_label; } \
} STMT_END
/* This is a first heuristic; it doesn't catch tainting magic. */
- if (tainting) {
+ if (PL_tainting) {
while (++mark <= sp) {
if (SvTAINTED(*mark)) {
TAINT;
APPLY_TAINT_PROPER();
tot = sp - mark;
while (++mark <= sp) {
- char *name = SvPVx(*mark, na);
+ char *name = SvPVx(*mark, PL_na);
APPLY_TAINT_PROPER();
if (PerlLIO_chmod(name, val))
tot--;
APPLY_TAINT_PROPER();
tot = sp - mark;
while (++mark <= sp) {
- char *name = SvPVx(*mark, na);
+ char *name = SvPVx(*mark, PL_na);
APPLY_TAINT_PROPER();
if (PerlLIO_chown(name, val, val2))
tot--;
APPLY_TAINT_PROPER();
if (mark == sp)
break;
- s = SvPVx(*++mark, na);
+ s = SvPVx(*++mark, PL_na);
if (isUPPER(*s)) {
if (*s == 'S' && s[1] == 'I' && s[2] == 'G')
s += 3;
APPLY_TAINT_PROPER();
tot = sp - mark;
while (++mark <= sp) {
- s = SvPVx(*mark, na);
+ s = SvPVx(*mark, PL_na);
APPLY_TAINT_PROPER();
- if (euid || unsafe) {
+ if (PL_euid || PL_unsafe) {
if (UNLINK(s))
tot--;
}
else { /* don't let root wipe out directories without -U */
#ifdef HAS_LSTAT
- if (PerlLIO_lstat(s,&statbuf) < 0 || S_ISDIR(statbuf.st_mode))
+ if (PerlLIO_lstat(s,&PL_statbuf) < 0 || S_ISDIR(PL_statbuf.st_mode))
#else
if (PerlLIO_stat(s,&statbuf) < 0 || S_ISDIR(statbuf.st_mode))
#endif
APPLY_TAINT_PROPER();
tot = sp - mark;
while (++mark <= sp) {
- char *name = SvPVx(*mark, na);
+ char *name = SvPVx(*mark, PL_na);
APPLY_TAINT_PROPER();
if (PerlLIO_utime(name, &utbuf))
tot--;
return (bit & statbufp->st_mode) ? TRUE : FALSE;
#else /* ! DOSISH */
- if ((effective ? euid : uid) == 0) { /* root is special */
+ if ((effective ? PL_euid : PL_uid) == 0) { /* root is special */
if (bit == S_IXUSR) {
if (statbufp->st_mode & 0111 || S_ISDIR(statbufp->st_mode))
return TRUE;
return TRUE; /* root reads and writes anything */
return FALSE;
}
- if (statbufp->st_uid == (effective ? euid : uid) ) {
+ if (statbufp->st_uid == (effective ? PL_euid : PL_uid) ) {
if (statbufp->st_mode & bit)
return TRUE; /* ok as "user" */
}
I32
ingroup(I32 testgid, I32 effective)
{
- if (testgid == (effective ? egid : gid))
+ if (testgid == (effective ? PL_egid : PL_gid))
return TRUE;
#ifdef HAS_GETGROUPS
#ifndef NGROUPS
max = AvFILL(av);
for (i = 0; i <= max; i++) {
sv = (SV*)av_fetch(av, i, FALSE);
- if (sv && ((sv = *(SV**)sv), sv != &sv_undef))
+ if (sv && ((sv = *(SV**)sv), sv != &PL_sv_undef))
do_chop(astr, sv);
}
return;
STRLEN len;
char *s;
- if (RsSNARF(rs))
+ if (RsSNARF(PL_rs))
return 0;
count = 0;
if (SvTYPE(sv) == SVt_PVAV) {
max = AvFILL(av);
for (i = 0; i <= max; i++) {
sv = (SV*)av_fetch(av, i, FALSE);
- if (sv && ((sv = *(SV**)sv), sv != &sv_undef))
+ if (sv && ((sv = *(SV**)sv), sv != &PL_sv_undef))
count += do_chomp(sv);
}
return count;
s = SvPV_force(sv, len);
if (s && len) {
s += --len;
- if (RsPARA(rs)) {
+ if (RsPARA(PL_rs)) {
if (*s != '\n')
goto nope;
++count;
}
else {
STRLEN rslen;
- char *rsptr = SvPV(rs, rslen);
+ char *rsptr = SvPV(PL_rs, rslen);
if (rslen == 1) {
if (*s != *rsptr)
goto nope;
len = leftlen < rightlen ? leftlen : rightlen;
lensave = len;
if (SvOK(sv) || SvTYPE(sv) > SVt_PVMG) {
- dc = SvPV_force(sv, na);
+ dc = SvPV_force(sv, PL_na);
if (SvCUR(sv) < len) {
dc = SvGROW(sv, len + 1);
(void)memzero(dc + SvCUR(sv), len - SvCUR(sv) + 1);
#ifdef DEBUGGING
dTHR;
PerlIO_setlinebuf(Perl_debug_log);
- if (main_root)
- dump_op(main_root);
- dump_packsubs(defstash);
+ if (PL_main_root)
+ dump_op(PL_main_root);
+ dump_packsubs(PL_defstash);
#endif /* DEBUGGING */
}
if (GvFORM(gv))
dump_form(gv);
if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
- (hv = GvHV(gv)) && HvNAME(hv) && hv != defstash)
+ (hv = GvHV(gv)) && HvNAME(hv) && hv != PL_defstash)
dump_packsubs(hv); /* nested package */
}
}
dump_eval(void)
{
#ifdef DEBUGGING
- dump_op(eval_root);
+ dump_op(PL_eval_root);
#endif /* DEBUGGING */
}
}
else
PerlIO_printf(Perl_debug_log, "DONE\n");
- dumplvl++;
+ PL_dumplvl++;
if (o->op_targ) {
if (o->op_type == OP_NULL)
dump(" (was %s)\n", op_name[o->op_targ]);
ENTER;
SAVEFREESV(tmpsv);
gv_fullname3(tmpsv, cGVOPo->op_gv, Nullch);
- dump("GV = %s\n", SvPV(tmpsv, na));
+ dump("GV = %s\n", SvPV(tmpsv, PL_na));
LEAVE;
}
else
for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling)
dump_op(kid);
}
- dumplvl--;
+ PL_dumplvl--;
dump("}\n");
#endif /* DEBUGGING */
}
return;
}
sv = sv_newmortal();
- dumplvl++;
+ PL_dumplvl++;
PerlIO_printf(Perl_debug_log, "{\n");
gv_fullname3(sv, gv, Nullch);
dump("GV_NAME = %s", SvPVX(sv));
dump("-> %s", SvPVX(sv));
}
dump("\n");
- dumplvl--;
+ PL_dumplvl--;
dump("}\n");
#endif /* DEBUGGING */
}
return;
}
dump("{\n");
- dumplvl++;
+ PL_dumplvl++;
if (pm->op_pmflags & PMf_ONCE)
ch = '?';
else
SvREFCNT_dec(tmpsv);
}
- dumplvl--;
+ PL_dumplvl--;
dump("}\n");
#endif /* DEBUGGING */
}
va_list args;
va_start(args, pat);
- for (i = dumplvl*4; i; i--)
+ for (i = PL_dumplvl*4; i; i--)
(void)PerlIO_putc(Perl_debug_log,' ');
PerlIO_vprintf(Perl_debug_log,pat,args);
va_end(args);
my ($sym) = @_;
hide($sym, "Perl_$sym");
}
+sub embedvar ($) {
+ my ($sym) = @_;
+# hide($sym, "Perl_$sym");
+ return '';
+}
+
sub multon ($$$) {
my ($sym,$pre,$ptr) = @_;
- hide($sym, "($ptr$pre$sym)");
+ hide("PL_$sym", "($ptr$pre$sym)");
}
sub multoff ($$) {
my ($sym,$pre) = @_;
- hide("$pre$sym", $sym);
+ hide("$pre$sym", "PL_$sym");
}
unlink 'embed.h';
END
for $sym (sort keys %intrp) {
- print EM embed($sym);
+ print EM embedvar($sym);
}
print EM <<'END';
END
for $sym (sort keys %thread) {
- print EM embed($sym);
+ print EM embedvar($sym);
}
print EM <<'END';
END
for $sym (sort keys %globvar) {
- print EM embed($sym);
+ print EM embedvar($sym);
}
print EM <<'END';
#ifndef USE_THREADS
/* If we do not have threads then per-thread vars are per-interpreter */
-#define Sv (curinterp->TSv)
-#define Xpv (curinterp->TXpv)
-#define av_fetch_sv (curinterp->Tav_fetch_sv)
-#define bodytarget (curinterp->Tbodytarget)
-#define bostr (curinterp->Tbostr)
-#define chopset (curinterp->Tchopset)
-#define colors (curinterp->Tcolors)
-#define colorset (curinterp->Tcolorset)
-#define curcop (curinterp->Tcurcop)
-#define curpad (curinterp->Tcurpad)
-#define curpm (curinterp->Tcurpm)
-#define curstack (curinterp->Tcurstack)
-#define curstackinfo (curinterp->Tcurstackinfo)
-#define curstash (curinterp->Tcurstash)
-#define defoutgv (curinterp->Tdefoutgv)
-#define defstash (curinterp->Tdefstash)
-#define delaymagic (curinterp->Tdelaymagic)
-#define dirty (curinterp->Tdirty)
-#define extralen (curinterp->Textralen)
-#define firstgv (curinterp->Tfirstgv)
-#define formtarget (curinterp->Tformtarget)
-#define hv_fetch_ent_mh (curinterp->Thv_fetch_ent_mh)
-#define hv_fetch_sv (curinterp->Thv_fetch_sv)
-#define in_eval (curinterp->Tin_eval)
-#define last_in_gv (curinterp->Tlast_in_gv)
-#define lastgotoprobe (curinterp->Tlastgotoprobe)
-#define lastscream (curinterp->Tlastscream)
-#define localizing (curinterp->Tlocalizing)
-#define mainstack (curinterp->Tmainstack)
-#define markstack (curinterp->Tmarkstack)
-#define markstack_max (curinterp->Tmarkstack_max)
-#define markstack_ptr (curinterp->Tmarkstack_ptr)
-#define maxscream (curinterp->Tmaxscream)
-#define modcount (curinterp->Tmodcount)
-#define nrs (curinterp->Tnrs)
-#define ofs (curinterp->Tofs)
-#define ofslen (curinterp->Tofslen)
-#define op (curinterp->Top)
-#define opsave (curinterp->Topsave)
-#define reg_eval_set (curinterp->Treg_eval_set)
-#define reg_flags (curinterp->Treg_flags)
-#define reg_start_tmp (curinterp->Treg_start_tmp)
-#define reg_start_tmpl (curinterp->Treg_start_tmpl)
-#define regbol (curinterp->Tregbol)
-#define regcc (curinterp->Tregcc)
-#define regcode (curinterp->Tregcode)
-#define regcomp_parse (curinterp->Tregcomp_parse)
-#define regcomp_rx (curinterp->Tregcomp_rx)
-#define regcompp (curinterp->Tregcompp)
-#define regdata (curinterp->Tregdata)
-#define regdummy (curinterp->Tregdummy)
-#define regendp (curinterp->Tregendp)
-#define regeol (curinterp->Tregeol)
-#define regexecp (curinterp->Tregexecp)
-#define regflags (curinterp->Tregflags)
-#define regindent (curinterp->Tregindent)
-#define reginput (curinterp->Treginput)
-#define reginterp_cnt (curinterp->Treginterp_cnt)
-#define reglastparen (curinterp->Treglastparen)
-#define regnarrate (curinterp->Tregnarrate)
-#define regnaughty (curinterp->Tregnaughty)
-#define regnpar (curinterp->Tregnpar)
-#define regprecomp (curinterp->Tregprecomp)
-#define regprev (curinterp->Tregprev)
-#define regprogram (curinterp->Tregprogram)
-#define regsawback (curinterp->Tregsawback)
-#define regseen (curinterp->Tregseen)
-#define regsize (curinterp->Tregsize)
-#define regstartp (curinterp->Tregstartp)
-#define regtill (curinterp->Tregtill)
-#define regxend (curinterp->Tregxend)
-#define restartop (curinterp->Trestartop)
-#define retstack (curinterp->Tretstack)
-#define retstack_ix (curinterp->Tretstack_ix)
-#define retstack_max (curinterp->Tretstack_max)
-#define rs (curinterp->Trs)
-#define savestack (curinterp->Tsavestack)
-#define savestack_ix (curinterp->Tsavestack_ix)
-#define savestack_max (curinterp->Tsavestack_max)
-#define scopestack (curinterp->Tscopestack)
-#define scopestack_ix (curinterp->Tscopestack_ix)
-#define scopestack_max (curinterp->Tscopestack_max)
-#define screamfirst (curinterp->Tscreamfirst)
-#define screamnext (curinterp->Tscreamnext)
-#define secondgv (curinterp->Tsecondgv)
-#define seen_evals (curinterp->Tseen_evals)
-#define seen_zerolen (curinterp->Tseen_zerolen)
-#define sortcop (curinterp->Tsortcop)
-#define sortcxix (curinterp->Tsortcxix)
-#define sortstash (curinterp->Tsortstash)
-#define stack_base (curinterp->Tstack_base)
-#define stack_max (curinterp->Tstack_max)
-#define stack_sp (curinterp->Tstack_sp)
-#define start_env (curinterp->Tstart_env)
-#define statbuf (curinterp->Tstatbuf)
-#define statcache (curinterp->Tstatcache)
-#define statgv (curinterp->Tstatgv)
-#define statname (curinterp->Tstatname)
-#define tainted (curinterp->Ttainted)
-#define timesbuf (curinterp->Ttimesbuf)
-#define tmps_floor (curinterp->Ttmps_floor)
-#define tmps_ix (curinterp->Ttmps_ix)
-#define tmps_max (curinterp->Ttmps_max)
-#define tmps_stack (curinterp->Ttmps_stack)
-#define top_env (curinterp->Ttop_env)
-#define toptarget (curinterp->Ttoptarget)
+#define PL_Sv (curinterp->TSv)
+#define PL_Xpv (curinterp->TXpv)
+#define PL_av_fetch_sv (curinterp->Tav_fetch_sv)
+#define PL_bodytarget (curinterp->Tbodytarget)
+#define PL_bostr (curinterp->Tbostr)
+#define PL_chopset (curinterp->Tchopset)
+#define PL_colors (curinterp->Tcolors)
+#define PL_colorset (curinterp->Tcolorset)
+#define PL_curcop (curinterp->Tcurcop)
+#define PL_curpad (curinterp->Tcurpad)
+#define PL_curpm (curinterp->Tcurpm)
+#define PL_curstack (curinterp->Tcurstack)
+#define PL_curstackinfo (curinterp->Tcurstackinfo)
+#define PL_curstash (curinterp->Tcurstash)
+#define PL_defoutgv (curinterp->Tdefoutgv)
+#define PL_defstash (curinterp->Tdefstash)
+#define PL_delaymagic (curinterp->Tdelaymagic)
+#define PL_dirty (curinterp->Tdirty)
+#define PL_extralen (curinterp->Textralen)
+#define PL_firstgv (curinterp->Tfirstgv)
+#define PL_formtarget (curinterp->Tformtarget)
+#define PL_hv_fetch_ent_mh (curinterp->Thv_fetch_ent_mh)
+#define PL_hv_fetch_sv (curinterp->Thv_fetch_sv)
+#define PL_in_eval (curinterp->Tin_eval)
+#define PL_last_in_gv (curinterp->Tlast_in_gv)
+#define PL_lastgotoprobe (curinterp->Tlastgotoprobe)
+#define PL_lastscream (curinterp->Tlastscream)
+#define PL_localizing (curinterp->Tlocalizing)
+#define PL_mainstack (curinterp->Tmainstack)
+#define PL_markstack (curinterp->Tmarkstack)
+#define PL_markstack_max (curinterp->Tmarkstack_max)
+#define PL_markstack_ptr (curinterp->Tmarkstack_ptr)
+#define PL_maxscream (curinterp->Tmaxscream)
+#define PL_modcount (curinterp->Tmodcount)
+#define PL_nrs (curinterp->Tnrs)
+#define PL_ofs (curinterp->Tofs)
+#define PL_ofslen (curinterp->Tofslen)
+#define PL_op (curinterp->Top)
+#define PL_opsave (curinterp->Topsave)
+#define PL_reg_eval_set (curinterp->Treg_eval_set)
+#define PL_reg_flags (curinterp->Treg_flags)
+#define PL_reg_start_tmp (curinterp->Treg_start_tmp)
+#define PL_reg_start_tmpl (curinterp->Treg_start_tmpl)
+#define PL_regbol (curinterp->Tregbol)
+#define PL_regcc (curinterp->Tregcc)
+#define PL_regcode (curinterp->Tregcode)
+#define PL_regcomp_parse (curinterp->Tregcomp_parse)
+#define PL_regcomp_rx (curinterp->Tregcomp_rx)
+#define PL_regcompp (curinterp->Tregcompp)
+#define PL_regdata (curinterp->Tregdata)
+#define PL_regdummy (curinterp->Tregdummy)
+#define PL_regendp (curinterp->Tregendp)
+#define PL_regeol (curinterp->Tregeol)
+#define PL_regexecp (curinterp->Tregexecp)
+#define PL_regflags (curinterp->Tregflags)
+#define PL_regindent (curinterp->Tregindent)
+#define PL_reginput (curinterp->Treginput)
+#define PL_reginterp_cnt (curinterp->Treginterp_cnt)
+#define PL_reglastparen (curinterp->Treglastparen)
+#define PL_regnarrate (curinterp->Tregnarrate)
+#define PL_regnaughty (curinterp->Tregnaughty)
+#define PL_regnpar (curinterp->Tregnpar)
+#define PL_regprecomp (curinterp->Tregprecomp)
+#define PL_regprev (curinterp->Tregprev)
+#define PL_regprogram (curinterp->Tregprogram)
+#define PL_regsawback (curinterp->Tregsawback)
+#define PL_regseen (curinterp->Tregseen)
+#define PL_regsize (curinterp->Tregsize)
+#define PL_regstartp (curinterp->Tregstartp)
+#define PL_regtill (curinterp->Tregtill)
+#define PL_regxend (curinterp->Tregxend)
+#define PL_restartop (curinterp->Trestartop)
+#define PL_retstack (curinterp->Tretstack)
+#define PL_retstack_ix (curinterp->Tretstack_ix)
+#define PL_retstack_max (curinterp->Tretstack_max)
+#define PL_rs (curinterp->Trs)
+#define PL_savestack (curinterp->Tsavestack)
+#define PL_savestack_ix (curinterp->Tsavestack_ix)
+#define PL_savestack_max (curinterp->Tsavestack_max)
+#define PL_scopestack (curinterp->Tscopestack)
+#define PL_scopestack_ix (curinterp->Tscopestack_ix)
+#define PL_scopestack_max (curinterp->Tscopestack_max)
+#define PL_screamfirst (curinterp->Tscreamfirst)
+#define PL_screamnext (curinterp->Tscreamnext)
+#define PL_secondgv (curinterp->Tsecondgv)
+#define PL_seen_evals (curinterp->Tseen_evals)
+#define PL_seen_zerolen (curinterp->Tseen_zerolen)
+#define PL_sortcop (curinterp->Tsortcop)
+#define PL_sortcxix (curinterp->Tsortcxix)
+#define PL_sortstash (curinterp->Tsortstash)
+#define PL_stack_base (curinterp->Tstack_base)
+#define PL_stack_max (curinterp->Tstack_max)
+#define PL_stack_sp (curinterp->Tstack_sp)
+#define PL_start_env (curinterp->Tstart_env)
+#define PL_statbuf (curinterp->Tstatbuf)
+#define PL_statcache (curinterp->Tstatcache)
+#define PL_statgv (curinterp->Tstatgv)
+#define PL_statname (curinterp->Tstatname)
+#define PL_tainted (curinterp->Ttainted)
+#define PL_timesbuf (curinterp->Ttimesbuf)
+#define PL_tmps_floor (curinterp->Ttmps_floor)
+#define PL_tmps_ix (curinterp->Ttmps_ix)
+#define PL_tmps_max (curinterp->Ttmps_max)
+#define PL_tmps_stack (curinterp->Ttmps_stack)
+#define PL_top_env (curinterp->Ttop_env)
+#define PL_toptarget (curinterp->Ttoptarget)
#endif /* !USE_THREADS */
/* These are always per-interpreter if there is more than one */
-#define Argv (curinterp->IArgv)
-#define Cmd (curinterp->ICmd)
-#define DBcv (curinterp->IDBcv)
-#define DBgv (curinterp->IDBgv)
-#define DBline (curinterp->IDBline)
-#define DBsignal (curinterp->IDBsignal)
-#define DBsingle (curinterp->IDBsingle)
-#define DBsub (curinterp->IDBsub)
-#define DBtrace (curinterp->IDBtrace)
-#define ampergv (curinterp->Iampergv)
-#define archpat_auto (curinterp->Iarchpat_auto)
-#define argvgv (curinterp->Iargvgv)
-#define argvoutgv (curinterp->Iargvoutgv)
-#define basetime (curinterp->Ibasetime)
-#define beginav (curinterp->Ibeginav)
-#define cddir (curinterp->Icddir)
-#define compcv (curinterp->Icompcv)
-#define compiling (curinterp->Icompiling)
-#define comppad (curinterp->Icomppad)
-#define comppad_name (curinterp->Icomppad_name)
-#define comppad_name_fill (curinterp->Icomppad_name_fill)
-#define comppad_name_floor (curinterp->Icomppad_name_floor)
-#define copline (curinterp->Icopline)
-#define curcopdb (curinterp->Icurcopdb)
-#define curstname (curinterp->Icurstname)
-#define dbargs (curinterp->Idbargs)
-#define debdelim (curinterp->Idebdelim)
-#define debname (curinterp->Idebname)
-#define debstash (curinterp->Idebstash)
-#define defgv (curinterp->Idefgv)
-#define diehook (curinterp->Idiehook)
-#define dlevel (curinterp->Idlevel)
-#define dlmax (curinterp->Idlmax)
-#define doextract (curinterp->Idoextract)
-#define doswitches (curinterp->Idoswitches)
-#define dowarn (curinterp->Idowarn)
-#define dumplvl (curinterp->Idumplvl)
-#define e_script (curinterp->Ie_script)
-#define endav (curinterp->Iendav)
-#define envgv (curinterp->Ienvgv)
-#define errgv (curinterp->Ierrgv)
-#define eval_root (curinterp->Ieval_root)
-#define eval_start (curinterp->Ieval_start)
-#define exitlist (curinterp->Iexitlist)
-#define exitlistlen (curinterp->Iexitlistlen)
-#define fdpid (curinterp->Ifdpid)
-#define filemode (curinterp->Ifilemode)
-#define forkprocess (curinterp->Iforkprocess)
-#define formfeed (curinterp->Iformfeed)
-#define generation (curinterp->Igeneration)
-#define gensym (curinterp->Igensym)
-#define globalstash (curinterp->Iglobalstash)
-#define hintgv (curinterp->Ihintgv)
-#define in_clean_all (curinterp->Iin_clean_all)
-#define in_clean_objs (curinterp->Iin_clean_objs)
-#define incgv (curinterp->Iincgv)
-#define initav (curinterp->Iinitav)
-#define inplace (curinterp->Iinplace)
-#define last_proto (curinterp->Ilast_proto)
-#define lastfd (curinterp->Ilastfd)
-#define lastsize (curinterp->Ilastsize)
-#define lastspbase (curinterp->Ilastspbase)
-#define laststatval (curinterp->Ilaststatval)
-#define laststype (curinterp->Ilaststype)
-#define leftgv (curinterp->Ileftgv)
-#define lineary (curinterp->Ilineary)
-#define linestart (curinterp->Ilinestart)
-#define localpatches (curinterp->Ilocalpatches)
-#define main_cv (curinterp->Imain_cv)
-#define main_root (curinterp->Imain_root)
-#define main_start (curinterp->Imain_start)
-#define maxsysfd (curinterp->Imaxsysfd)
-#define mess_sv (curinterp->Imess_sv)
-#define minus_F (curinterp->Iminus_F)
-#define minus_a (curinterp->Iminus_a)
-#define minus_c (curinterp->Iminus_c)
-#define minus_l (curinterp->Iminus_l)
-#define minus_n (curinterp->Iminus_n)
-#define minus_p (curinterp->Iminus_p)
-#define modglobal (curinterp->Imodglobal)
-#define multiline (curinterp->Imultiline)
-#define mystrk (curinterp->Imystrk)
-#define ofmt (curinterp->Iofmt)
-#define oldlastpm (curinterp->Ioldlastpm)
-#define oldname (curinterp->Ioldname)
-#define op_mask (curinterp->Iop_mask)
-#define origargc (curinterp->Iorigargc)
-#define origargv (curinterp->Iorigargv)
-#define origfilename (curinterp->Iorigfilename)
-#define ors (curinterp->Iors)
-#define orslen (curinterp->Iorslen)
-#define parsehook (curinterp->Iparsehook)
-#define patchlevel (curinterp->Ipatchlevel)
-#define pending_ident (curinterp->Ipending_ident)
-#define perl_destruct_level (curinterp->Iperl_destruct_level)
-#define perldb (curinterp->Iperldb)
-#define preambleav (curinterp->Ipreambleav)
-#define preambled (curinterp->Ipreambled)
-#define preprocess (curinterp->Ipreprocess)
-#define profiledata (curinterp->Iprofiledata)
-#define replgv (curinterp->Ireplgv)
-#define rightgv (curinterp->Irightgv)
-#define rsfp (curinterp->Irsfp)
-#define rsfp_filters (curinterp->Irsfp_filters)
-#define sawampersand (curinterp->Isawampersand)
-#define sawstudy (curinterp->Isawstudy)
-#define sawvec (curinterp->Isawvec)
-#define siggv (curinterp->Isiggv)
-#define splitstr (curinterp->Isplitstr)
-#define statusvalue (curinterp->Istatusvalue)
-#define statusvalue_vms (curinterp->Istatusvalue_vms)
-#define stdingv (curinterp->Istdingv)
-#define strchop (curinterp->Istrchop)
-#define strtab (curinterp->Istrtab)
-#define sub_generation (curinterp->Isub_generation)
-#define sublex_info (curinterp->Isublex_info)
-#define sv_arenaroot (curinterp->Isv_arenaroot)
-#define sv_count (curinterp->Isv_count)
-#define sv_objcount (curinterp->Isv_objcount)
-#define sv_root (curinterp->Isv_root)
-#define sys_intern (curinterp->Isys_intern)
-#define tainting (curinterp->Itainting)
-#define threadnum (curinterp->Ithreadnum)
-#define thrsv (curinterp->Ithrsv)
-#define unsafe (curinterp->Iunsafe)
-#define warnhook (curinterp->Iwarnhook)
+#define PL_Argv (curinterp->IArgv)
+#define PL_Cmd (curinterp->ICmd)
+#define PL_DBcv (curinterp->IDBcv)
+#define PL_DBgv (curinterp->IDBgv)
+#define PL_DBline (curinterp->IDBline)
+#define PL_DBsignal (curinterp->IDBsignal)
+#define PL_DBsingle (curinterp->IDBsingle)
+#define PL_DBsub (curinterp->IDBsub)
+#define PL_DBtrace (curinterp->IDBtrace)
+#define PL_ampergv (curinterp->Iampergv)
+#define PL_archpat_auto (curinterp->Iarchpat_auto)
+#define PL_argvgv (curinterp->Iargvgv)
+#define PL_argvoutgv (curinterp->Iargvoutgv)
+#define PL_basetime (curinterp->Ibasetime)
+#define PL_beginav (curinterp->Ibeginav)
+#define PL_cddir (curinterp->Icddir)
+#define PL_compcv (curinterp->Icompcv)
+#define PL_compiling (curinterp->Icompiling)
+#define PL_comppad (curinterp->Icomppad)
+#define PL_comppad_name (curinterp->Icomppad_name)
+#define PL_comppad_name_fill (curinterp->Icomppad_name_fill)
+#define PL_comppad_name_floor (curinterp->Icomppad_name_floor)
+#define PL_copline (curinterp->Icopline)
+#define PL_curcopdb (curinterp->Icurcopdb)
+#define PL_curstname (curinterp->Icurstname)
+#define PL_dbargs (curinterp->Idbargs)
+#define PL_debdelim (curinterp->Idebdelim)
+#define PL_debname (curinterp->Idebname)
+#define PL_debstash (curinterp->Idebstash)
+#define PL_defgv (curinterp->Idefgv)
+#define PL_diehook (curinterp->Idiehook)
+#define PL_dlevel (curinterp->Idlevel)
+#define PL_dlmax (curinterp->Idlmax)
+#define PL_doextract (curinterp->Idoextract)
+#define PL_doswitches (curinterp->Idoswitches)
+#define PL_dowarn (curinterp->Idowarn)
+#define PL_dumplvl (curinterp->Idumplvl)
+#define PL_e_script (curinterp->Ie_script)
+#define PL_endav (curinterp->Iendav)
+#define PL_envgv (curinterp->Ienvgv)
+#define PL_errgv (curinterp->Ierrgv)
+#define PL_eval_root (curinterp->Ieval_root)
+#define PL_eval_start (curinterp->Ieval_start)
+#define PL_exitlist (curinterp->Iexitlist)
+#define PL_exitlistlen (curinterp->Iexitlistlen)
+#define PL_fdpid (curinterp->Ifdpid)
+#define PL_filemode (curinterp->Ifilemode)
+#define PL_forkprocess (curinterp->Iforkprocess)
+#define PL_formfeed (curinterp->Iformfeed)
+#define PL_generation (curinterp->Igeneration)
+#define PL_gensym (curinterp->Igensym)
+#define PL_globalstash (curinterp->Iglobalstash)
+#define PL_hintgv (curinterp->Ihintgv)
+#define PL_in_clean_all (curinterp->Iin_clean_all)
+#define PL_in_clean_objs (curinterp->Iin_clean_objs)
+#define PL_incgv (curinterp->Iincgv)
+#define PL_initav (curinterp->Iinitav)
+#define PL_inplace (curinterp->Iinplace)
+#define PL_last_proto (curinterp->Ilast_proto)
+#define PL_lastfd (curinterp->Ilastfd)
+#define PL_lastsize (curinterp->Ilastsize)
+#define PL_lastspbase (curinterp->Ilastspbase)
+#define PL_laststatval (curinterp->Ilaststatval)
+#define PL_laststype (curinterp->Ilaststype)
+#define PL_leftgv (curinterp->Ileftgv)
+#define PL_lineary (curinterp->Ilineary)
+#define PL_linestart (curinterp->Ilinestart)
+#define PL_localpatches (curinterp->Ilocalpatches)
+#define PL_main_cv (curinterp->Imain_cv)
+#define PL_main_root (curinterp->Imain_root)
+#define PL_main_start (curinterp->Imain_start)
+#define PL_maxsysfd (curinterp->Imaxsysfd)
+#define PL_mess_sv (curinterp->Imess_sv)
+#define PL_minus_F (curinterp->Iminus_F)
+#define PL_minus_a (curinterp->Iminus_a)
+#define PL_minus_c (curinterp->Iminus_c)
+#define PL_minus_l (curinterp->Iminus_l)
+#define PL_minus_n (curinterp->Iminus_n)
+#define PL_minus_p (curinterp->Iminus_p)
+#define PL_modglobal (curinterp->Imodglobal)
+#define PL_multiline (curinterp->Imultiline)
+#define PL_mystrk (curinterp->Imystrk)
+#define PL_ofmt (curinterp->Iofmt)
+#define PL_oldlastpm (curinterp->Ioldlastpm)
+#define PL_oldname (curinterp->Ioldname)
+#define PL_op_mask (curinterp->Iop_mask)
+#define PL_origargc (curinterp->Iorigargc)
+#define PL_origargv (curinterp->Iorigargv)
+#define PL_origfilename (curinterp->Iorigfilename)
+#define PL_ors (curinterp->Iors)
+#define PL_orslen (curinterp->Iorslen)
+#define PL_parsehook (curinterp->Iparsehook)
+#define PL_patchlevel (curinterp->Ipatchlevel)
+#define PL_pending_ident (curinterp->Ipending_ident)
+#define PL_perl_destruct_level (curinterp->Iperl_destruct_level)
+#define PL_perldb (curinterp->Iperldb)
+#define PL_preambleav (curinterp->Ipreambleav)
+#define PL_preambled (curinterp->Ipreambled)
+#define PL_preprocess (curinterp->Ipreprocess)
+#define PL_profiledata (curinterp->Iprofiledata)
+#define PL_replgv (curinterp->Ireplgv)
+#define PL_rightgv (curinterp->Irightgv)
+#define PL_rsfp (curinterp->Irsfp)
+#define PL_rsfp_filters (curinterp->Irsfp_filters)
+#define PL_sawampersand (curinterp->Isawampersand)
+#define PL_sawstudy (curinterp->Isawstudy)
+#define PL_sawvec (curinterp->Isawvec)
+#define PL_siggv (curinterp->Isiggv)
+#define PL_splitstr (curinterp->Isplitstr)
+#define PL_statusvalue (curinterp->Istatusvalue)
+#define PL_statusvalue_vms (curinterp->Istatusvalue_vms)
+#define PL_stdingv (curinterp->Istdingv)
+#define PL_strchop (curinterp->Istrchop)
+#define PL_strtab (curinterp->Istrtab)
+#define PL_sub_generation (curinterp->Isub_generation)
+#define PL_sublex_info (curinterp->Isublex_info)
+#define PL_sv_arenaroot (curinterp->Isv_arenaroot)
+#define PL_sv_count (curinterp->Isv_count)
+#define PL_sv_objcount (curinterp->Isv_objcount)
+#define PL_sv_root (curinterp->Isv_root)
+#define PL_sys_intern (curinterp->Isys_intern)
+#define PL_tainting (curinterp->Itainting)
+#define PL_threadnum (curinterp->Ithreadnum)
+#define PL_thrsv (curinterp->Ithrsv)
+#define PL_unsafe (curinterp->Iunsafe)
+#define PL_warnhook (curinterp->Iwarnhook)
#else /* !MULTIPLICITY */
-#define IArgv Argv
-#define ICmd Cmd
-#define IDBcv DBcv
-#define IDBgv DBgv
-#define IDBline DBline
-#define IDBsignal DBsignal
-#define IDBsingle DBsingle
-#define IDBsub DBsub
-#define IDBtrace DBtrace
-#define Iampergv ampergv
-#define Iarchpat_auto archpat_auto
-#define Iargvgv argvgv
-#define Iargvoutgv argvoutgv
-#define Ibasetime basetime
-#define Ibeginav beginav
-#define Icddir cddir
-#define Icompcv compcv
-#define Icompiling compiling
-#define Icomppad comppad
-#define Icomppad_name comppad_name
-#define Icomppad_name_fill comppad_name_fill
-#define Icomppad_name_floor comppad_name_floor
-#define Icopline copline
-#define Icurcopdb curcopdb
-#define Icurstname curstname
-#define Idbargs dbargs
-#define Idebdelim debdelim
-#define Idebname debname
-#define Idebstash debstash
-#define Idefgv defgv
-#define Idiehook diehook
-#define Idlevel dlevel
-#define Idlmax dlmax
-#define Idoextract doextract
-#define Idoswitches doswitches
-#define Idowarn dowarn
-#define Idumplvl dumplvl
-#define Ie_script e_script
-#define Iendav endav
-#define Ienvgv envgv
-#define Ierrgv errgv
-#define Ieval_root eval_root
-#define Ieval_start eval_start
-#define Iexitlist exitlist
-#define Iexitlistlen exitlistlen
-#define Ifdpid fdpid
-#define Ifilemode filemode
-#define Iforkprocess forkprocess
-#define Iformfeed formfeed
-#define Igeneration generation
-#define Igensym gensym
-#define Iglobalstash globalstash
-#define Ihintgv hintgv
-#define Iin_clean_all in_clean_all
-#define Iin_clean_objs in_clean_objs
-#define Iincgv incgv
-#define Iinitav initav
-#define Iinplace inplace
-#define Ilast_proto last_proto
-#define Ilastfd lastfd
-#define Ilastsize lastsize
-#define Ilastspbase lastspbase
-#define Ilaststatval laststatval
-#define Ilaststype laststype
-#define Ileftgv leftgv
-#define Ilineary lineary
-#define Ilinestart linestart
-#define Ilocalpatches localpatches
-#define Imain_cv main_cv
-#define Imain_root main_root
-#define Imain_start main_start
-#define Imaxsysfd maxsysfd
-#define Imess_sv mess_sv
-#define Iminus_F minus_F
-#define Iminus_a minus_a
-#define Iminus_c minus_c
-#define Iminus_l minus_l
-#define Iminus_n minus_n
-#define Iminus_p minus_p
-#define Imodglobal modglobal
-#define Imultiline multiline
-#define Imystrk mystrk
-#define Iofmt ofmt
-#define Ioldlastpm oldlastpm
-#define Ioldname oldname
-#define Iop_mask op_mask
-#define Iorigargc origargc
-#define Iorigargv origargv
-#define Iorigfilename origfilename
-#define Iors ors
-#define Iorslen orslen
-#define Iparsehook parsehook
-#define Ipatchlevel patchlevel
-#define Ipending_ident pending_ident
-#define Iperl_destruct_level perl_destruct_level
-#define Iperldb perldb
-#define Ipreambleav preambleav
-#define Ipreambled preambled
-#define Ipreprocess preprocess
-#define Iprofiledata profiledata
-#define Ireplgv replgv
-#define Irightgv rightgv
-#define Irsfp rsfp
-#define Irsfp_filters rsfp_filters
-#define Isawampersand sawampersand
-#define Isawstudy sawstudy
-#define Isawvec sawvec
-#define Isiggv siggv
-#define Isplitstr splitstr
-#define Istatusvalue statusvalue
-#define Istatusvalue_vms statusvalue_vms
-#define Istdingv stdingv
-#define Istrchop strchop
-#define Istrtab strtab
-#define Isub_generation sub_generation
-#define Isublex_info sublex_info
-#define Isv_arenaroot sv_arenaroot
-#define Isv_count sv_count
-#define Isv_objcount sv_objcount
-#define Isv_root sv_root
-#define Isys_intern sys_intern
-#define Itainting tainting
-#define Ithreadnum threadnum
-#define Ithrsv thrsv
-#define Iunsafe unsafe
-#define Iwarnhook warnhook
+#define IArgv PL_Argv
+#define ICmd PL_Cmd
+#define IDBcv PL_DBcv
+#define IDBgv PL_DBgv
+#define IDBline PL_DBline
+#define IDBsignal PL_DBsignal
+#define IDBsingle PL_DBsingle
+#define IDBsub PL_DBsub
+#define IDBtrace PL_DBtrace
+#define Iampergv PL_ampergv
+#define Iarchpat_auto PL_archpat_auto
+#define Iargvgv PL_argvgv
+#define Iargvoutgv PL_argvoutgv
+#define Ibasetime PL_basetime
+#define Ibeginav PL_beginav
+#define Icddir PL_cddir
+#define Icompcv PL_compcv
+#define Icompiling PL_compiling
+#define Icomppad PL_comppad
+#define Icomppad_name PL_comppad_name
+#define Icomppad_name_fill PL_comppad_name_fill
+#define Icomppad_name_floor PL_comppad_name_floor
+#define Icopline PL_copline
+#define Icurcopdb PL_curcopdb
+#define Icurstname PL_curstname
+#define Idbargs PL_dbargs
+#define Idebdelim PL_debdelim
+#define Idebname PL_debname
+#define Idebstash PL_debstash
+#define Idefgv PL_defgv
+#define Idiehook PL_diehook
+#define Idlevel PL_dlevel
+#define Idlmax PL_dlmax
+#define Idoextract PL_doextract
+#define Idoswitches PL_doswitches
+#define Idowarn PL_dowarn
+#define Idumplvl PL_dumplvl
+#define Ie_script PL_e_script
+#define Iendav PL_endav
+#define Ienvgv PL_envgv
+#define Ierrgv PL_errgv
+#define Ieval_root PL_eval_root
+#define Ieval_start PL_eval_start
+#define Iexitlist PL_exitlist
+#define Iexitlistlen PL_exitlistlen
+#define Ifdpid PL_fdpid
+#define Ifilemode PL_filemode
+#define Iforkprocess PL_forkprocess
+#define Iformfeed PL_formfeed
+#define Igeneration PL_generation
+#define Igensym PL_gensym
+#define Iglobalstash PL_globalstash
+#define Ihintgv PL_hintgv
+#define Iin_clean_all PL_in_clean_all
+#define Iin_clean_objs PL_in_clean_objs
+#define Iincgv PL_incgv
+#define Iinitav PL_initav
+#define Iinplace PL_inplace
+#define Ilast_proto PL_last_proto
+#define Ilastfd PL_lastfd
+#define Ilastsize PL_lastsize
+#define Ilastspbase PL_lastspbase
+#define Ilaststatval PL_laststatval
+#define Ilaststype PL_laststype
+#define Ileftgv PL_leftgv
+#define Ilineary PL_lineary
+#define Ilinestart PL_linestart
+#define Ilocalpatches PL_localpatches
+#define Imain_cv PL_main_cv
+#define Imain_root PL_main_root
+#define Imain_start PL_main_start
+#define Imaxsysfd PL_maxsysfd
+#define Imess_sv PL_mess_sv
+#define Iminus_F PL_minus_F
+#define Iminus_a PL_minus_a
+#define Iminus_c PL_minus_c
+#define Iminus_l PL_minus_l
+#define Iminus_n PL_minus_n
+#define Iminus_p PL_minus_p
+#define Imodglobal PL_modglobal
+#define Imultiline PL_multiline
+#define Imystrk PL_mystrk
+#define Iofmt PL_ofmt
+#define Ioldlastpm PL_oldlastpm
+#define Ioldname PL_oldname
+#define Iop_mask PL_op_mask
+#define Iorigargc PL_origargc
+#define Iorigargv PL_origargv
+#define Iorigfilename PL_origfilename
+#define Iors PL_ors
+#define Iorslen PL_orslen
+#define Iparsehook PL_parsehook
+#define Ipatchlevel PL_patchlevel
+#define Ipending_ident PL_pending_ident
+#define Iperl_destruct_level PL_perl_destruct_level
+#define Iperldb PL_perldb
+#define Ipreambleav PL_preambleav
+#define Ipreambled PL_preambled
+#define Ipreprocess PL_preprocess
+#define Iprofiledata PL_profiledata
+#define Ireplgv PL_replgv
+#define Irightgv PL_rightgv
+#define Irsfp PL_rsfp
+#define Irsfp_filters PL_rsfp_filters
+#define Isawampersand PL_sawampersand
+#define Isawstudy PL_sawstudy
+#define Isawvec PL_sawvec
+#define Isiggv PL_siggv
+#define Isplitstr PL_splitstr
+#define Istatusvalue PL_statusvalue
+#define Istatusvalue_vms PL_statusvalue_vms
+#define Istdingv PL_stdingv
+#define Istrchop PL_strchop
+#define Istrtab PL_strtab
+#define Isub_generation PL_sub_generation
+#define Isublex_info PL_sublex_info
+#define Isv_arenaroot PL_sv_arenaroot
+#define Isv_count PL_sv_count
+#define Isv_objcount PL_sv_objcount
+#define Isv_root PL_sv_root
+#define Isys_intern PL_sys_intern
+#define Itainting PL_tainting
+#define Ithreadnum PL_threadnum
+#define Ithrsv PL_thrsv
+#define Iunsafe PL_unsafe
+#define Iwarnhook PL_warnhook
#ifndef USE_THREADS
-#define TSv Sv
-#define TXpv Xpv
-#define Tav_fetch_sv av_fetch_sv
-#define Tbodytarget bodytarget
-#define Tbostr bostr
-#define Tchopset chopset
-#define Tcolors colors
-#define Tcolorset colorset
-#define Tcurcop curcop
-#define Tcurpad curpad
-#define Tcurpm curpm
-#define Tcurstack curstack
-#define Tcurstackinfo curstackinfo
-#define Tcurstash curstash
-#define Tdefoutgv defoutgv
-#define Tdefstash defstash
-#define Tdelaymagic delaymagic
-#define Tdirty dirty
-#define Textralen extralen
-#define Tfirstgv firstgv
-#define Tformtarget formtarget
-#define Thv_fetch_ent_mh hv_fetch_ent_mh
-#define Thv_fetch_sv hv_fetch_sv
-#define Tin_eval in_eval
-#define Tlast_in_gv last_in_gv
-#define Tlastgotoprobe lastgotoprobe
-#define Tlastscream lastscream
-#define Tlocalizing localizing
-#define Tmainstack mainstack
-#define Tmarkstack markstack
-#define Tmarkstack_max markstack_max
-#define Tmarkstack_ptr markstack_ptr
-#define Tmaxscream maxscream
-#define Tmodcount modcount
-#define Tnrs nrs
-#define Tofs ofs
-#define Tofslen ofslen
-#define Top op
-#define Topsave opsave
-#define Treg_eval_set reg_eval_set
-#define Treg_flags reg_flags
-#define Treg_start_tmp reg_start_tmp
-#define Treg_start_tmpl reg_start_tmpl
-#define Tregbol regbol
-#define Tregcc regcc
-#define Tregcode regcode
-#define Tregcomp_parse regcomp_parse
-#define Tregcomp_rx regcomp_rx
-#define Tregcompp regcompp
-#define Tregdata regdata
-#define Tregdummy regdummy
-#define Tregendp regendp
-#define Tregeol regeol
-#define Tregexecp regexecp
-#define Tregflags regflags
-#define Tregindent regindent
-#define Treginput reginput
-#define Treginterp_cnt reginterp_cnt
-#define Treglastparen reglastparen
-#define Tregnarrate regnarrate
-#define Tregnaughty regnaughty
-#define Tregnpar regnpar
-#define Tregprecomp regprecomp
-#define Tregprev regprev
-#define Tregprogram regprogram
-#define Tregsawback regsawback
-#define Tregseen regseen
-#define Tregsize regsize
-#define Tregstartp regstartp
-#define Tregtill regtill
-#define Tregxend regxend
-#define Trestartop restartop
-#define Tretstack retstack
-#define Tretstack_ix retstack_ix
-#define Tretstack_max retstack_max
-#define Trs rs
-#define Tsavestack savestack
-#define Tsavestack_ix savestack_ix
-#define Tsavestack_max savestack_max
-#define Tscopestack scopestack
-#define Tscopestack_ix scopestack_ix
-#define Tscopestack_max scopestack_max
-#define Tscreamfirst screamfirst
-#define Tscreamnext screamnext
-#define Tsecondgv secondgv
-#define Tseen_evals seen_evals
-#define Tseen_zerolen seen_zerolen
-#define Tsortcop sortcop
-#define Tsortcxix sortcxix
-#define Tsortstash sortstash
-#define Tstack_base stack_base
-#define Tstack_max stack_max
-#define Tstack_sp stack_sp
-#define Tstart_env start_env
-#define Tstatbuf statbuf
-#define Tstatcache statcache
-#define Tstatgv statgv
-#define Tstatname statname
-#define Ttainted tainted
-#define Ttimesbuf timesbuf
-#define Ttmps_floor tmps_floor
-#define Ttmps_ix tmps_ix
-#define Ttmps_max tmps_max
-#define Ttmps_stack tmps_stack
-#define Ttop_env top_env
-#define Ttoptarget toptarget
+#define TSv PL_Sv
+#define TXpv PL_Xpv
+#define Tav_fetch_sv PL_av_fetch_sv
+#define Tbodytarget PL_bodytarget
+#define Tbostr PL_bostr
+#define Tchopset PL_chopset
+#define Tcolors PL_colors
+#define Tcolorset PL_colorset
+#define Tcurcop PL_curcop
+#define Tcurpad PL_curpad
+#define Tcurpm PL_curpm
+#define Tcurstack PL_curstack
+#define Tcurstackinfo PL_curstackinfo
+#define Tcurstash PL_curstash
+#define Tdefoutgv PL_defoutgv
+#define Tdefstash PL_defstash
+#define Tdelaymagic PL_delaymagic
+#define Tdirty PL_dirty
+#define Textralen PL_extralen
+#define Tfirstgv PL_firstgv
+#define Tformtarget PL_formtarget
+#define Thv_fetch_ent_mh PL_hv_fetch_ent_mh
+#define Thv_fetch_sv PL_hv_fetch_sv
+#define Tin_eval PL_in_eval
+#define Tlast_in_gv PL_last_in_gv
+#define Tlastgotoprobe PL_lastgotoprobe
+#define Tlastscream PL_lastscream
+#define Tlocalizing PL_localizing
+#define Tmainstack PL_mainstack
+#define Tmarkstack PL_markstack
+#define Tmarkstack_max PL_markstack_max
+#define Tmarkstack_ptr PL_markstack_ptr
+#define Tmaxscream PL_maxscream
+#define Tmodcount PL_modcount
+#define Tnrs PL_nrs
+#define Tofs PL_ofs
+#define Tofslen PL_ofslen
+#define Top PL_op
+#define Topsave PL_opsave
+#define Treg_eval_set PL_reg_eval_set
+#define Treg_flags PL_reg_flags
+#define Treg_start_tmp PL_reg_start_tmp
+#define Treg_start_tmpl PL_reg_start_tmpl
+#define Tregbol PL_regbol
+#define Tregcc PL_regcc
+#define Tregcode PL_regcode
+#define Tregcomp_parse PL_regcomp_parse
+#define Tregcomp_rx PL_regcomp_rx
+#define Tregcompp PL_regcompp
+#define Tregdata PL_regdata
+#define Tregdummy PL_regdummy
+#define Tregendp PL_regendp
+#define Tregeol PL_regeol
+#define Tregexecp PL_regexecp
+#define Tregflags PL_regflags
+#define Tregindent PL_regindent
+#define Treginput PL_reginput
+#define Treginterp_cnt PL_reginterp_cnt
+#define Treglastparen PL_reglastparen
+#define Tregnarrate PL_regnarrate
+#define Tregnaughty PL_regnaughty
+#define Tregnpar PL_regnpar
+#define Tregprecomp PL_regprecomp
+#define Tregprev PL_regprev
+#define Tregprogram PL_regprogram
+#define Tregsawback PL_regsawback
+#define Tregseen PL_regseen
+#define Tregsize PL_regsize
+#define Tregstartp PL_regstartp
+#define Tregtill PL_regtill
+#define Tregxend PL_regxend
+#define Trestartop PL_restartop
+#define Tretstack PL_retstack
+#define Tretstack_ix PL_retstack_ix
+#define Tretstack_max PL_retstack_max
+#define Trs PL_rs
+#define Tsavestack PL_savestack
+#define Tsavestack_ix PL_savestack_ix
+#define Tsavestack_max PL_savestack_max
+#define Tscopestack PL_scopestack
+#define Tscopestack_ix PL_scopestack_ix
+#define Tscopestack_max PL_scopestack_max
+#define Tscreamfirst PL_screamfirst
+#define Tscreamnext PL_screamnext
+#define Tsecondgv PL_secondgv
+#define Tseen_evals PL_seen_evals
+#define Tseen_zerolen PL_seen_zerolen
+#define Tsortcop PL_sortcop
+#define Tsortcxix PL_sortcxix
+#define Tsortstash PL_sortstash
+#define Tstack_base PL_stack_base
+#define Tstack_max PL_stack_max
+#define Tstack_sp PL_stack_sp
+#define Tstart_env PL_start_env
+#define Tstatbuf PL_statbuf
+#define Tstatcache PL_statcache
+#define Tstatgv PL_statgv
+#define Tstatname PL_statname
+#define Ttainted PL_tainted
+#define Ttimesbuf PL_timesbuf
+#define Ttmps_floor PL_tmps_floor
+#define Ttmps_ix PL_tmps_ix
+#define Ttmps_max PL_tmps_max
+#define Ttmps_stack PL_tmps_stack
+#define Ttop_env PL_top_env
+#define Ttoptarget PL_toptarget
#endif /* USE_THREADS */
#ifdef EMBED
-#define Argv Perl_Argv
-#define Cmd Perl_Cmd
-#define DBcv Perl_DBcv
-#define DBgv Perl_DBgv
-#define DBline Perl_DBline
-#define DBsignal Perl_DBsignal
-#define DBsingle Perl_DBsingle
-#define DBsub Perl_DBsub
-#define DBtrace Perl_DBtrace
-#define ampergv Perl_ampergv
-#define archpat_auto Perl_archpat_auto
-#define argvgv Perl_argvgv
-#define argvoutgv Perl_argvoutgv
-#define basetime Perl_basetime
-#define beginav Perl_beginav
-#define cddir Perl_cddir
-#define compcv Perl_compcv
-#define compiling Perl_compiling
-#define comppad Perl_comppad
-#define comppad_name Perl_comppad_name
-#define comppad_name_fill Perl_comppad_name_fill
-#define comppad_name_floor Perl_comppad_name_floor
-#define copline Perl_copline
-#define curcopdb Perl_curcopdb
-#define curstname Perl_curstname
-#define dbargs Perl_dbargs
-#define debdelim Perl_debdelim
-#define debname Perl_debname
-#define debstash Perl_debstash
-#define defgv Perl_defgv
-#define diehook Perl_diehook
-#define dlevel Perl_dlevel
-#define dlmax Perl_dlmax
-#define doextract Perl_doextract
-#define doswitches Perl_doswitches
-#define dowarn Perl_dowarn
-#define dumplvl Perl_dumplvl
-#define e_script Perl_e_script
-#define endav Perl_endav
-#define envgv Perl_envgv
-#define errgv Perl_errgv
-#define eval_root Perl_eval_root
-#define eval_start Perl_eval_start
-#define exitlist Perl_exitlist
-#define exitlistlen Perl_exitlistlen
-#define fdpid Perl_fdpid
-#define filemode Perl_filemode
-#define forkprocess Perl_forkprocess
-#define formfeed Perl_formfeed
-#define generation Perl_generation
-#define gensym Perl_gensym
-#define globalstash Perl_globalstash
-#define hintgv Perl_hintgv
-#define in_clean_all Perl_in_clean_all
-#define in_clean_objs Perl_in_clean_objs
-#define incgv Perl_incgv
-#define initav Perl_initav
-#define inplace Perl_inplace
-#define last_proto Perl_last_proto
-#define lastfd Perl_lastfd
-#define lastsize Perl_lastsize
-#define lastspbase Perl_lastspbase
-#define laststatval Perl_laststatval
-#define laststype Perl_laststype
-#define leftgv Perl_leftgv
-#define lineary Perl_lineary
-#define linestart Perl_linestart
-#define localpatches Perl_localpatches
-#define main_cv Perl_main_cv
-#define main_root Perl_main_root
-#define main_start Perl_main_start
-#define maxsysfd Perl_maxsysfd
-#define mess_sv Perl_mess_sv
-#define minus_F Perl_minus_F
-#define minus_a Perl_minus_a
-#define minus_c Perl_minus_c
-#define minus_l Perl_minus_l
-#define minus_n Perl_minus_n
-#define minus_p Perl_minus_p
-#define modglobal Perl_modglobal
-#define multiline Perl_multiline
-#define mystrk Perl_mystrk
-#define ofmt Perl_ofmt
-#define oldlastpm Perl_oldlastpm
-#define oldname Perl_oldname
-#define op_mask Perl_op_mask
-#define origargc Perl_origargc
-#define origargv Perl_origargv
-#define origfilename Perl_origfilename
-#define ors Perl_ors
-#define orslen Perl_orslen
-#define parsehook Perl_parsehook
-#define patchlevel Perl_patchlevel
-#define pending_ident Perl_pending_ident
-#define perl_destruct_level Perl_perl_destruct_level
-#define perldb Perl_perldb
-#define preambleav Perl_preambleav
-#define preambled Perl_preambled
-#define preprocess Perl_preprocess
-#define profiledata Perl_profiledata
-#define replgv Perl_replgv
-#define rightgv Perl_rightgv
-#define rsfp Perl_rsfp
-#define rsfp_filters Perl_rsfp_filters
-#define sawampersand Perl_sawampersand
-#define sawstudy Perl_sawstudy
-#define sawvec Perl_sawvec
-#define siggv Perl_siggv
-#define splitstr Perl_splitstr
-#define statusvalue Perl_statusvalue
-#define statusvalue_vms Perl_statusvalue_vms
-#define stdingv Perl_stdingv
-#define strchop Perl_strchop
-#define strtab Perl_strtab
-#define sub_generation Perl_sub_generation
-#define sublex_info Perl_sublex_info
-#define sv_arenaroot Perl_sv_arenaroot
-#define sv_count Perl_sv_count
-#define sv_objcount Perl_sv_objcount
-#define sv_root Perl_sv_root
-#define sys_intern Perl_sys_intern
-#define tainting Perl_tainting
-#define threadnum Perl_threadnum
-#define thrsv Perl_thrsv
-#define unsafe Perl_unsafe
-#define warnhook Perl_warnhook
#ifndef USE_THREADS
-#define Sv Perl_Sv
-#define Xpv Perl_Xpv
-#define av_fetch_sv Perl_av_fetch_sv
-#define bodytarget Perl_bodytarget
-#define bostr Perl_bostr
-#define chopset Perl_chopset
-#define colors Perl_colors
-#define colorset Perl_colorset
-#define curcop Perl_curcop
-#define curpad Perl_curpad
-#define curpm Perl_curpm
-#define curstack Perl_curstack
-#define curstackinfo Perl_curstackinfo
-#define curstash Perl_curstash
-#define defoutgv Perl_defoutgv
-#define defstash Perl_defstash
-#define delaymagic Perl_delaymagic
-#define dirty Perl_dirty
-#define extralen Perl_extralen
-#define firstgv Perl_firstgv
-#define formtarget Perl_formtarget
-#define hv_fetch_ent_mh Perl_hv_fetch_ent_mh
-#define hv_fetch_sv Perl_hv_fetch_sv
-#define in_eval Perl_in_eval
-#define last_in_gv Perl_last_in_gv
-#define lastgotoprobe Perl_lastgotoprobe
-#define lastscream Perl_lastscream
-#define localizing Perl_localizing
-#define mainstack Perl_mainstack
-#define markstack Perl_markstack
-#define markstack_max Perl_markstack_max
-#define markstack_ptr Perl_markstack_ptr
-#define maxscream Perl_maxscream
-#define modcount Perl_modcount
-#define nrs Perl_nrs
-#define ofs Perl_ofs
-#define ofslen Perl_ofslen
-#define op Perl_op
-#define opsave Perl_opsave
-#define reg_eval_set Perl_reg_eval_set
-#define reg_flags Perl_reg_flags
-#define reg_start_tmp Perl_reg_start_tmp
-#define reg_start_tmpl Perl_reg_start_tmpl
-#define regbol Perl_regbol
-#define regcc Perl_regcc
-#define regcode Perl_regcode
-#define regcomp_parse Perl_regcomp_parse
-#define regcomp_rx Perl_regcomp_rx
-#define regcompp Perl_regcompp
-#define regdata Perl_regdata
-#define regdummy Perl_regdummy
-#define regendp Perl_regendp
-#define regeol Perl_regeol
-#define regexecp Perl_regexecp
-#define regflags Perl_regflags
-#define regindent Perl_regindent
-#define reginput Perl_reginput
-#define reginterp_cnt Perl_reginterp_cnt
-#define reglastparen Perl_reglastparen
-#define regnarrate Perl_regnarrate
-#define regnaughty Perl_regnaughty
-#define regnpar Perl_regnpar
-#define regprecomp Perl_regprecomp
-#define regprev Perl_regprev
-#define regprogram Perl_regprogram
-#define regsawback Perl_regsawback
-#define regseen Perl_regseen
-#define regsize Perl_regsize
-#define regstartp Perl_regstartp
-#define regtill Perl_regtill
-#define regxend Perl_regxend
-#define restartop Perl_restartop
-#define retstack Perl_retstack
-#define retstack_ix Perl_retstack_ix
-#define retstack_max Perl_retstack_max
-#define rs Perl_rs
-#define savestack Perl_savestack
-#define savestack_ix Perl_savestack_ix
-#define savestack_max Perl_savestack_max
-#define scopestack Perl_scopestack
-#define scopestack_ix Perl_scopestack_ix
-#define scopestack_max Perl_scopestack_max
-#define screamfirst Perl_screamfirst
-#define screamnext Perl_screamnext
-#define secondgv Perl_secondgv
-#define seen_evals Perl_seen_evals
-#define seen_zerolen Perl_seen_zerolen
-#define sortcop Perl_sortcop
-#define sortcxix Perl_sortcxix
-#define sortstash Perl_sortstash
-#define stack_base Perl_stack_base
-#define stack_max Perl_stack_max
-#define stack_sp Perl_stack_sp
-#define start_env Perl_start_env
-#define statbuf Perl_statbuf
-#define statcache Perl_statcache
-#define statgv Perl_statgv
-#define statname Perl_statname
-#define tainted Perl_tainted
-#define timesbuf Perl_timesbuf
-#define tmps_floor Perl_tmps_floor
-#define tmps_ix Perl_tmps_ix
-#define tmps_max Perl_tmps_max
-#define tmps_stack Perl_tmps_stack
-#define top_env Perl_top_env
-#define toptarget Perl_toptarget
#endif /* USE_THREADS */
#endif /* EMBED */
#ifdef USE_THREADS
-#define Sv (thr->TSv)
-#define Xpv (thr->TXpv)
-#define av_fetch_sv (thr->Tav_fetch_sv)
-#define bodytarget (thr->Tbodytarget)
-#define bostr (thr->Tbostr)
-#define chopset (thr->Tchopset)
-#define colors (thr->Tcolors)
-#define colorset (thr->Tcolorset)
-#define curcop (thr->Tcurcop)
-#define curpad (thr->Tcurpad)
-#define curpm (thr->Tcurpm)
-#define curstack (thr->Tcurstack)
-#define curstackinfo (thr->Tcurstackinfo)
-#define curstash (thr->Tcurstash)
-#define defoutgv (thr->Tdefoutgv)
-#define defstash (thr->Tdefstash)
-#define delaymagic (thr->Tdelaymagic)
-#define dirty (thr->Tdirty)
-#define extralen (thr->Textralen)
-#define firstgv (thr->Tfirstgv)
-#define formtarget (thr->Tformtarget)
-#define hv_fetch_ent_mh (thr->Thv_fetch_ent_mh)
-#define hv_fetch_sv (thr->Thv_fetch_sv)
-#define in_eval (thr->Tin_eval)
-#define last_in_gv (thr->Tlast_in_gv)
-#define lastgotoprobe (thr->Tlastgotoprobe)
-#define lastscream (thr->Tlastscream)
-#define localizing (thr->Tlocalizing)
-#define mainstack (thr->Tmainstack)
-#define markstack (thr->Tmarkstack)
-#define markstack_max (thr->Tmarkstack_max)
-#define markstack_ptr (thr->Tmarkstack_ptr)
-#define maxscream (thr->Tmaxscream)
-#define modcount (thr->Tmodcount)
-#define nrs (thr->Tnrs)
-#define ofs (thr->Tofs)
-#define ofslen (thr->Tofslen)
-#define op (thr->Top)
-#define opsave (thr->Topsave)
-#define reg_eval_set (thr->Treg_eval_set)
-#define reg_flags (thr->Treg_flags)
-#define reg_start_tmp (thr->Treg_start_tmp)
-#define reg_start_tmpl (thr->Treg_start_tmpl)
-#define regbol (thr->Tregbol)
-#define regcc (thr->Tregcc)
-#define regcode (thr->Tregcode)
-#define regcomp_parse (thr->Tregcomp_parse)
-#define regcomp_rx (thr->Tregcomp_rx)
-#define regcompp (thr->Tregcompp)
-#define regdata (thr->Tregdata)
-#define regdummy (thr->Tregdummy)
-#define regendp (thr->Tregendp)
-#define regeol (thr->Tregeol)
-#define regexecp (thr->Tregexecp)
-#define regflags (thr->Tregflags)
-#define regindent (thr->Tregindent)
-#define reginput (thr->Treginput)
-#define reginterp_cnt (thr->Treginterp_cnt)
-#define reglastparen (thr->Treglastparen)
-#define regnarrate (thr->Tregnarrate)
-#define regnaughty (thr->Tregnaughty)
-#define regnpar (thr->Tregnpar)
-#define regprecomp (thr->Tregprecomp)
-#define regprev (thr->Tregprev)
-#define regprogram (thr->Tregprogram)
-#define regsawback (thr->Tregsawback)
-#define regseen (thr->Tregseen)
-#define regsize (thr->Tregsize)
-#define regstartp (thr->Tregstartp)
-#define regtill (thr->Tregtill)
-#define regxend (thr->Tregxend)
-#define restartop (thr->Trestartop)
-#define retstack (thr->Tretstack)
-#define retstack_ix (thr->Tretstack_ix)
-#define retstack_max (thr->Tretstack_max)
-#define rs (thr->Trs)
-#define savestack (thr->Tsavestack)
-#define savestack_ix (thr->Tsavestack_ix)
-#define savestack_max (thr->Tsavestack_max)
-#define scopestack (thr->Tscopestack)
-#define scopestack_ix (thr->Tscopestack_ix)
-#define scopestack_max (thr->Tscopestack_max)
-#define screamfirst (thr->Tscreamfirst)
-#define screamnext (thr->Tscreamnext)
-#define secondgv (thr->Tsecondgv)
-#define seen_evals (thr->Tseen_evals)
-#define seen_zerolen (thr->Tseen_zerolen)
-#define sortcop (thr->Tsortcop)
-#define sortcxix (thr->Tsortcxix)
-#define sortstash (thr->Tsortstash)
-#define stack_base (thr->Tstack_base)
-#define stack_max (thr->Tstack_max)
-#define stack_sp (thr->Tstack_sp)
-#define start_env (thr->Tstart_env)
-#define statbuf (thr->Tstatbuf)
-#define statcache (thr->Tstatcache)
-#define statgv (thr->Tstatgv)
-#define statname (thr->Tstatname)
-#define tainted (thr->Ttainted)
-#define timesbuf (thr->Ttimesbuf)
-#define tmps_floor (thr->Ttmps_floor)
-#define tmps_ix (thr->Ttmps_ix)
-#define tmps_max (thr->Ttmps_max)
-#define tmps_stack (thr->Ttmps_stack)
-#define top_env (thr->Ttop_env)
-#define toptarget (thr->Ttoptarget)
+#define PL_Sv (thr->TSv)
+#define PL_Xpv (thr->TXpv)
+#define PL_av_fetch_sv (thr->Tav_fetch_sv)
+#define PL_bodytarget (thr->Tbodytarget)
+#define PL_bostr (thr->Tbostr)
+#define PL_chopset (thr->Tchopset)
+#define PL_colors (thr->Tcolors)
+#define PL_colorset (thr->Tcolorset)
+#define PL_curcop (thr->Tcurcop)
+#define PL_curpad (thr->Tcurpad)
+#define PL_curpm (thr->Tcurpm)
+#define PL_curstack (thr->Tcurstack)
+#define PL_curstackinfo (thr->Tcurstackinfo)
+#define PL_curstash (thr->Tcurstash)
+#define PL_defoutgv (thr->Tdefoutgv)
+#define PL_defstash (thr->Tdefstash)
+#define PL_delaymagic (thr->Tdelaymagic)
+#define PL_dirty (thr->Tdirty)
+#define PL_extralen (thr->Textralen)
+#define PL_firstgv (thr->Tfirstgv)
+#define PL_formtarget (thr->Tformtarget)
+#define PL_hv_fetch_ent_mh (thr->Thv_fetch_ent_mh)
+#define PL_hv_fetch_sv (thr->Thv_fetch_sv)
+#define PL_in_eval (thr->Tin_eval)
+#define PL_last_in_gv (thr->Tlast_in_gv)
+#define PL_lastgotoprobe (thr->Tlastgotoprobe)
+#define PL_lastscream (thr->Tlastscream)
+#define PL_localizing (thr->Tlocalizing)
+#define PL_mainstack (thr->Tmainstack)
+#define PL_markstack (thr->Tmarkstack)
+#define PL_markstack_max (thr->Tmarkstack_max)
+#define PL_markstack_ptr (thr->Tmarkstack_ptr)
+#define PL_maxscream (thr->Tmaxscream)
+#define PL_modcount (thr->Tmodcount)
+#define PL_nrs (thr->Tnrs)
+#define PL_ofs (thr->Tofs)
+#define PL_ofslen (thr->Tofslen)
+#define PL_op (thr->Top)
+#define PL_opsave (thr->Topsave)
+#define PL_reg_eval_set (thr->Treg_eval_set)
+#define PL_reg_flags (thr->Treg_flags)
+#define PL_reg_start_tmp (thr->Treg_start_tmp)
+#define PL_reg_start_tmpl (thr->Treg_start_tmpl)
+#define PL_regbol (thr->Tregbol)
+#define PL_regcc (thr->Tregcc)
+#define PL_regcode (thr->Tregcode)
+#define PL_regcomp_parse (thr->Tregcomp_parse)
+#define PL_regcomp_rx (thr->Tregcomp_rx)
+#define PL_regcompp (thr->Tregcompp)
+#define PL_regdata (thr->Tregdata)
+#define PL_regdummy (thr->Tregdummy)
+#define PL_regendp (thr->Tregendp)
+#define PL_regeol (thr->Tregeol)
+#define PL_regexecp (thr->Tregexecp)
+#define PL_regflags (thr->Tregflags)
+#define PL_regindent (thr->Tregindent)
+#define PL_reginput (thr->Treginput)
+#define PL_reginterp_cnt (thr->Treginterp_cnt)
+#define PL_reglastparen (thr->Treglastparen)
+#define PL_regnarrate (thr->Tregnarrate)
+#define PL_regnaughty (thr->Tregnaughty)
+#define PL_regnpar (thr->Tregnpar)
+#define PL_regprecomp (thr->Tregprecomp)
+#define PL_regprev (thr->Tregprev)
+#define PL_regprogram (thr->Tregprogram)
+#define PL_regsawback (thr->Tregsawback)
+#define PL_regseen (thr->Tregseen)
+#define PL_regsize (thr->Tregsize)
+#define PL_regstartp (thr->Tregstartp)
+#define PL_regtill (thr->Tregtill)
+#define PL_regxend (thr->Tregxend)
+#define PL_restartop (thr->Trestartop)
+#define PL_retstack (thr->Tretstack)
+#define PL_retstack_ix (thr->Tretstack_ix)
+#define PL_retstack_max (thr->Tretstack_max)
+#define PL_rs (thr->Trs)
+#define PL_savestack (thr->Tsavestack)
+#define PL_savestack_ix (thr->Tsavestack_ix)
+#define PL_savestack_max (thr->Tsavestack_max)
+#define PL_scopestack (thr->Tscopestack)
+#define PL_scopestack_ix (thr->Tscopestack_ix)
+#define PL_scopestack_max (thr->Tscopestack_max)
+#define PL_screamfirst (thr->Tscreamfirst)
+#define PL_screamnext (thr->Tscreamnext)
+#define PL_secondgv (thr->Tsecondgv)
+#define PL_seen_evals (thr->Tseen_evals)
+#define PL_seen_zerolen (thr->Tseen_zerolen)
+#define PL_sortcop (thr->Tsortcop)
+#define PL_sortcxix (thr->Tsortcxix)
+#define PL_sortstash (thr->Tsortstash)
+#define PL_stack_base (thr->Tstack_base)
+#define PL_stack_max (thr->Tstack_max)
+#define PL_stack_sp (thr->Tstack_sp)
+#define PL_start_env (thr->Tstart_env)
+#define PL_statbuf (thr->Tstatbuf)
+#define PL_statcache (thr->Tstatcache)
+#define PL_statgv (thr->Tstatgv)
+#define PL_statname (thr->Tstatname)
+#define PL_tainted (thr->Ttainted)
+#define PL_timesbuf (thr->Ttimesbuf)
+#define PL_tmps_floor (thr->Ttmps_floor)
+#define PL_tmps_ix (thr->Ttmps_ix)
+#define PL_tmps_max (thr->Ttmps_max)
+#define PL_tmps_stack (thr->Ttmps_stack)
+#define PL_top_env (thr->Ttop_env)
+#define PL_toptarget (thr->Ttoptarget)
#endif /* USE_THREADS */
#ifdef PERL_GLOBAL_STRUCT
-#define No (Perl_Vars.GNo)
-#define Yes (Perl_Vars.GYes)
-#define amagic_generation (Perl_Vars.Gamagic_generation)
-#define an (Perl_Vars.Gan)
-#define bufend (Perl_Vars.Gbufend)
-#define bufptr (Perl_Vars.Gbufptr)
-#define collation_ix (Perl_Vars.Gcollation_ix)
-#define collation_name (Perl_Vars.Gcollation_name)
-#define collation_standard (Perl_Vars.Gcollation_standard)
-#define collxfrm_base (Perl_Vars.Gcollxfrm_base)
-#define collxfrm_mult (Perl_Vars.Gcollxfrm_mult)
-#define cop_seqmax (Perl_Vars.Gcop_seqmax)
-#define cryptseen (Perl_Vars.Gcryptseen)
-#define cshlen (Perl_Vars.Gcshlen)
-#define cshname (Perl_Vars.Gcshname)
-#define curinterp (Perl_Vars.Gcurinterp)
-#define curthr (Perl_Vars.Gcurthr)
-#define debug (Perl_Vars.Gdebug)
-#define do_undump (Perl_Vars.Gdo_undump)
-#define egid (Perl_Vars.Gegid)
-#define error_count (Perl_Vars.Gerror_count)
-#define euid (Perl_Vars.Geuid)
-#define eval_cond (Perl_Vars.Geval_cond)
-#define eval_mutex (Perl_Vars.Geval_mutex)
-#define eval_owner (Perl_Vars.Geval_owner)
-#define evalseq (Perl_Vars.Gevalseq)
-#define expect (Perl_Vars.Gexpect)
-#define gid (Perl_Vars.Ggid)
-#define he_root (Perl_Vars.Ghe_root)
-#define hexdigit (Perl_Vars.Ghexdigit)
-#define hints (Perl_Vars.Ghints)
-#define in_my (Perl_Vars.Gin_my)
-#define in_my_stash (Perl_Vars.Gin_my_stash)
-#define last_lop (Perl_Vars.Glast_lop)
-#define last_lop_op (Perl_Vars.Glast_lop_op)
-#define last_uni (Perl_Vars.Glast_uni)
-#define lex_brackets (Perl_Vars.Glex_brackets)
-#define lex_brackstack (Perl_Vars.Glex_brackstack)
-#define lex_casemods (Perl_Vars.Glex_casemods)
-#define lex_casestack (Perl_Vars.Glex_casestack)
-#define lex_defer (Perl_Vars.Glex_defer)
-#define lex_dojoin (Perl_Vars.Glex_dojoin)
-#define lex_expect (Perl_Vars.Glex_expect)
-#define lex_fakebrack (Perl_Vars.Glex_fakebrack)
-#define lex_formbrack (Perl_Vars.Glex_formbrack)
-#define lex_inpat (Perl_Vars.Glex_inpat)
-#define lex_inwhat (Perl_Vars.Glex_inwhat)
-#define lex_op (Perl_Vars.Glex_op)
-#define lex_repl (Perl_Vars.Glex_repl)
-#define lex_starts (Perl_Vars.Glex_starts)
-#define lex_state (Perl_Vars.Glex_state)
-#define lex_stuff (Perl_Vars.Glex_stuff)
-#define linestr (Perl_Vars.Glinestr)
-#define malloc_mutex (Perl_Vars.Gmalloc_mutex)
-#define max_intro_pending (Perl_Vars.Gmax_intro_pending)
-#define maxo (Perl_Vars.Gmaxo)
-#define min_intro_pending (Perl_Vars.Gmin_intro_pending)
-#define multi_close (Perl_Vars.Gmulti_close)
-#define multi_end (Perl_Vars.Gmulti_end)
-#define multi_open (Perl_Vars.Gmulti_open)
-#define multi_start (Perl_Vars.Gmulti_start)
-#define na (Perl_Vars.Gna)
-#define nexttoke (Perl_Vars.Gnexttoke)
-#define nexttype (Perl_Vars.Gnexttype)
-#define nextval (Perl_Vars.Gnextval)
-#define nice_chunk (Perl_Vars.Gnice_chunk)
-#define nice_chunk_size (Perl_Vars.Gnice_chunk_size)
-#define ninterps (Perl_Vars.Gninterps)
-#define nomemok (Perl_Vars.Gnomemok)
-#define nthreads (Perl_Vars.Gnthreads)
-#define nthreads_cond (Perl_Vars.Gnthreads_cond)
-#define numeric_local (Perl_Vars.Gnumeric_local)
-#define numeric_name (Perl_Vars.Gnumeric_name)
-#define numeric_standard (Perl_Vars.Gnumeric_standard)
-#define oldbufptr (Perl_Vars.Goldbufptr)
-#define oldoldbufptr (Perl_Vars.Goldoldbufptr)
-#define op_seqmax (Perl_Vars.Gop_seqmax)
-#define origalen (Perl_Vars.Gorigalen)
-#define origenviron (Perl_Vars.Gorigenviron)
-#define osname (Perl_Vars.Gosname)
-#define pad_reset_pending (Perl_Vars.Gpad_reset_pending)
-#define padix (Perl_Vars.Gpadix)
-#define padix_floor (Perl_Vars.Gpadix_floor)
-#define patleave (Perl_Vars.Gpatleave)
-#define pidstatus (Perl_Vars.Gpidstatus)
-#define runops (Perl_Vars.Grunops)
-#define sh_path (Perl_Vars.Gsh_path)
-#define sighandlerp (Perl_Vars.Gsighandlerp)
-#define specialsv_list (Perl_Vars.Gspecialsv_list)
-#define subline (Perl_Vars.Gsubline)
-#define subname (Perl_Vars.Gsubname)
-#define sv_mutex (Perl_Vars.Gsv_mutex)
-#define sv_no (Perl_Vars.Gsv_no)
-#define sv_undef (Perl_Vars.Gsv_undef)
-#define sv_yes (Perl_Vars.Gsv_yes)
-#define svref_mutex (Perl_Vars.Gsvref_mutex)
-#define thisexpr (Perl_Vars.Gthisexpr)
-#define thr_key (Perl_Vars.Gthr_key)
-#define threads_mutex (Perl_Vars.Gthreads_mutex)
-#define threadsv_names (Perl_Vars.Gthreadsv_names)
-#define tokenbuf (Perl_Vars.Gtokenbuf)
-#define uid (Perl_Vars.Guid)
-#define xiv_arenaroot (Perl_Vars.Gxiv_arenaroot)
-#define xiv_root (Perl_Vars.Gxiv_root)
-#define xnv_root (Perl_Vars.Gxnv_root)
-#define xpv_root (Perl_Vars.Gxpv_root)
-#define xrv_root (Perl_Vars.Gxrv_root)
+#define PL_No (Perl_Vars.GNo)
+#define PL_Yes (Perl_Vars.GYes)
+#define PL_amagic_generation (Perl_Vars.Gamagic_generation)
+#define PL_an (Perl_Vars.Gan)
+#define PL_bufend (Perl_Vars.Gbufend)
+#define PL_bufptr (Perl_Vars.Gbufptr)
+#define PL_collation_ix (Perl_Vars.Gcollation_ix)
+#define PL_collation_name (Perl_Vars.Gcollation_name)
+#define PL_collation_standard (Perl_Vars.Gcollation_standard)
+#define PL_collxfrm_base (Perl_Vars.Gcollxfrm_base)
+#define PL_collxfrm_mult (Perl_Vars.Gcollxfrm_mult)
+#define PL_cop_seqmax (Perl_Vars.Gcop_seqmax)
+#define PL_cryptseen (Perl_Vars.Gcryptseen)
+#define PL_cshlen (Perl_Vars.Gcshlen)
+#define PL_cshname (Perl_Vars.Gcshname)
+#define PL_curinterp (Perl_Vars.Gcurinterp)
+#define PL_curthr (Perl_Vars.Gcurthr)
+#define PL_debug (Perl_Vars.Gdebug)
+#define PL_do_undump (Perl_Vars.Gdo_undump)
+#define PL_egid (Perl_Vars.Gegid)
+#define PL_error_count (Perl_Vars.Gerror_count)
+#define PL_euid (Perl_Vars.Geuid)
+#define PL_eval_cond (Perl_Vars.Geval_cond)
+#define PL_eval_mutex (Perl_Vars.Geval_mutex)
+#define PL_eval_owner (Perl_Vars.Geval_owner)
+#define PL_evalseq (Perl_Vars.Gevalseq)
+#define PL_expect (Perl_Vars.Gexpect)
+#define PL_gid (Perl_Vars.Ggid)
+#define PL_he_root (Perl_Vars.Ghe_root)
+#define PL_hexdigit (Perl_Vars.Ghexdigit)
+#define PL_hints (Perl_Vars.Ghints)
+#define PL_in_my (Perl_Vars.Gin_my)
+#define PL_in_my_stash (Perl_Vars.Gin_my_stash)
+#define PL_last_lop (Perl_Vars.Glast_lop)
+#define PL_last_lop_op (Perl_Vars.Glast_lop_op)
+#define PL_last_uni (Perl_Vars.Glast_uni)
+#define PL_lex_brackets (Perl_Vars.Glex_brackets)
+#define PL_lex_brackstack (Perl_Vars.Glex_brackstack)
+#define PL_lex_casemods (Perl_Vars.Glex_casemods)
+#define PL_lex_casestack (Perl_Vars.Glex_casestack)
+#define PL_lex_defer (Perl_Vars.Glex_defer)
+#define PL_lex_dojoin (Perl_Vars.Glex_dojoin)
+#define PL_lex_expect (Perl_Vars.Glex_expect)
+#define PL_lex_fakebrack (Perl_Vars.Glex_fakebrack)
+#define PL_lex_formbrack (Perl_Vars.Glex_formbrack)
+#define PL_lex_inpat (Perl_Vars.Glex_inpat)
+#define PL_lex_inwhat (Perl_Vars.Glex_inwhat)
+#define PL_lex_op (Perl_Vars.Glex_op)
+#define PL_lex_repl (Perl_Vars.Glex_repl)
+#define PL_lex_starts (Perl_Vars.Glex_starts)
+#define PL_lex_state (Perl_Vars.Glex_state)
+#define PL_lex_stuff (Perl_Vars.Glex_stuff)
+#define PL_linestr (Perl_Vars.Glinestr)
+#define PL_malloc_mutex (Perl_Vars.Gmalloc_mutex)
+#define PL_max_intro_pending (Perl_Vars.Gmax_intro_pending)
+#define PL_maxo (Perl_Vars.Gmaxo)
+#define PL_min_intro_pending (Perl_Vars.Gmin_intro_pending)
+#define PL_multi_close (Perl_Vars.Gmulti_close)
+#define PL_multi_end (Perl_Vars.Gmulti_end)
+#define PL_multi_open (Perl_Vars.Gmulti_open)
+#define PL_multi_start (Perl_Vars.Gmulti_start)
+#define PL_na (Perl_Vars.Gna)
+#define PL_nexttoke (Perl_Vars.Gnexttoke)
+#define PL_nexttype (Perl_Vars.Gnexttype)
+#define PL_nextval (Perl_Vars.Gnextval)
+#define PL_nice_chunk (Perl_Vars.Gnice_chunk)
+#define PL_nice_chunk_size (Perl_Vars.Gnice_chunk_size)
+#define PL_ninterps (Perl_Vars.Gninterps)
+#define PL_nomemok (Perl_Vars.Gnomemok)
+#define PL_nthreads (Perl_Vars.Gnthreads)
+#define PL_nthreads_cond (Perl_Vars.Gnthreads_cond)
+#define PL_numeric_local (Perl_Vars.Gnumeric_local)
+#define PL_numeric_name (Perl_Vars.Gnumeric_name)
+#define PL_numeric_standard (Perl_Vars.Gnumeric_standard)
+#define PL_oldbufptr (Perl_Vars.Goldbufptr)
+#define PL_oldoldbufptr (Perl_Vars.Goldoldbufptr)
+#define PL_op_seqmax (Perl_Vars.Gop_seqmax)
+#define PL_origalen (Perl_Vars.Gorigalen)
+#define PL_origenviron (Perl_Vars.Gorigenviron)
+#define PL_osname (Perl_Vars.Gosname)
+#define PL_pad_reset_pending (Perl_Vars.Gpad_reset_pending)
+#define PL_padix (Perl_Vars.Gpadix)
+#define PL_padix_floor (Perl_Vars.Gpadix_floor)
+#define PL_patleave (Perl_Vars.Gpatleave)
+#define PL_pidstatus (Perl_Vars.Gpidstatus)
+#define PL_runops (Perl_Vars.Grunops)
+#define PL_sh_path (Perl_Vars.Gsh_path)
+#define PL_sighandlerp (Perl_Vars.Gsighandlerp)
+#define PL_specialsv_list (Perl_Vars.Gspecialsv_list)
+#define PL_subline (Perl_Vars.Gsubline)
+#define PL_subname (Perl_Vars.Gsubname)
+#define PL_sv_mutex (Perl_Vars.Gsv_mutex)
+#define PL_sv_no (Perl_Vars.Gsv_no)
+#define PL_sv_undef (Perl_Vars.Gsv_undef)
+#define PL_sv_yes (Perl_Vars.Gsv_yes)
+#define PL_svref_mutex (Perl_Vars.Gsvref_mutex)
+#define PL_thisexpr (Perl_Vars.Gthisexpr)
+#define PL_thr_key (Perl_Vars.Gthr_key)
+#define PL_threads_mutex (Perl_Vars.Gthreads_mutex)
+#define PL_threadsv_names (Perl_Vars.Gthreadsv_names)
+#define PL_tokenbuf (Perl_Vars.Gtokenbuf)
+#define PL_uid (Perl_Vars.Guid)
+#define PL_xiv_arenaroot (Perl_Vars.Gxiv_arenaroot)
+#define PL_xiv_root (Perl_Vars.Gxiv_root)
+#define PL_xnv_root (Perl_Vars.Gxnv_root)
+#define PL_xpv_root (Perl_Vars.Gxpv_root)
+#define PL_xrv_root (Perl_Vars.Gxrv_root)
#else /* !PERL_GLOBAL_STRUCT */
-#define GNo No
-#define GYes Yes
-#define Gamagic_generation amagic_generation
-#define Gan an
-#define Gbufend bufend
-#define Gbufptr bufptr
-#define Gcollation_ix collation_ix
-#define Gcollation_name collation_name
-#define Gcollation_standard collation_standard
-#define Gcollxfrm_base collxfrm_base
-#define Gcollxfrm_mult collxfrm_mult
-#define Gcop_seqmax cop_seqmax
-#define Gcryptseen cryptseen
-#define Gcshlen cshlen
-#define Gcshname cshname
-#define Gcurinterp curinterp
-#define Gcurthr curthr
-#define Gdebug debug
-#define Gdo_undump do_undump
-#define Gegid egid
-#define Gerror_count error_count
-#define Geuid euid
-#define Geval_cond eval_cond
-#define Geval_mutex eval_mutex
-#define Geval_owner eval_owner
-#define Gevalseq evalseq
-#define Gexpect expect
-#define Ggid gid
-#define Ghe_root he_root
-#define Ghexdigit hexdigit
-#define Ghints hints
-#define Gin_my in_my
-#define Gin_my_stash in_my_stash
-#define Glast_lop last_lop
-#define Glast_lop_op last_lop_op
-#define Glast_uni last_uni
-#define Glex_brackets lex_brackets
-#define Glex_brackstack lex_brackstack
-#define Glex_casemods lex_casemods
-#define Glex_casestack lex_casestack
-#define Glex_defer lex_defer
-#define Glex_dojoin lex_dojoin
-#define Glex_expect lex_expect
-#define Glex_fakebrack lex_fakebrack
-#define Glex_formbrack lex_formbrack
-#define Glex_inpat lex_inpat
-#define Glex_inwhat lex_inwhat
-#define Glex_op lex_op
-#define Glex_repl lex_repl
-#define Glex_starts lex_starts
-#define Glex_state lex_state
-#define Glex_stuff lex_stuff
-#define Glinestr linestr
-#define Gmalloc_mutex malloc_mutex
-#define Gmax_intro_pending max_intro_pending
-#define Gmaxo maxo
-#define Gmin_intro_pending min_intro_pending
-#define Gmulti_close multi_close
-#define Gmulti_end multi_end
-#define Gmulti_open multi_open
-#define Gmulti_start multi_start
-#define Gna na
-#define Gnexttoke nexttoke
-#define Gnexttype nexttype
-#define Gnextval nextval
-#define Gnice_chunk nice_chunk
-#define Gnice_chunk_size nice_chunk_size
-#define Gninterps ninterps
-#define Gnomemok nomemok
-#define Gnthreads nthreads
-#define Gnthreads_cond nthreads_cond
-#define Gnumeric_local numeric_local
-#define Gnumeric_name numeric_name
-#define Gnumeric_standard numeric_standard
-#define Goldbufptr oldbufptr
-#define Goldoldbufptr oldoldbufptr
-#define Gop_seqmax op_seqmax
-#define Gorigalen origalen
-#define Gorigenviron origenviron
-#define Gosname osname
-#define Gpad_reset_pending pad_reset_pending
-#define Gpadix padix
-#define Gpadix_floor padix_floor
-#define Gpatleave patleave
-#define Gpidstatus pidstatus
-#define Grunops runops
-#define Gsh_path sh_path
-#define Gsighandlerp sighandlerp
-#define Gspecialsv_list specialsv_list
-#define Gsubline subline
-#define Gsubname subname
-#define Gsv_mutex sv_mutex
-#define Gsv_no sv_no
-#define Gsv_undef sv_undef
-#define Gsv_yes sv_yes
-#define Gsvref_mutex svref_mutex
-#define Gthisexpr thisexpr
-#define Gthr_key thr_key
-#define Gthreads_mutex threads_mutex
-#define Gthreadsv_names threadsv_names
-#define Gtokenbuf tokenbuf
-#define Guid uid
-#define Gxiv_arenaroot xiv_arenaroot
-#define Gxiv_root xiv_root
-#define Gxnv_root xnv_root
-#define Gxpv_root xpv_root
-#define Gxrv_root xrv_root
+#define GNo PL_No
+#define GYes PL_Yes
+#define Gamagic_generation PL_amagic_generation
+#define Gan PL_an
+#define Gbufend PL_bufend
+#define Gbufptr PL_bufptr
+#define Gcollation_ix PL_collation_ix
+#define Gcollation_name PL_collation_name
+#define Gcollation_standard PL_collation_standard
+#define Gcollxfrm_base PL_collxfrm_base
+#define Gcollxfrm_mult PL_collxfrm_mult
+#define Gcop_seqmax PL_cop_seqmax
+#define Gcryptseen PL_cryptseen
+#define Gcshlen PL_cshlen
+#define Gcshname PL_cshname
+#define Gcurinterp PL_curinterp
+#define Gcurthr PL_curthr
+#define Gdebug PL_debug
+#define Gdo_undump PL_do_undump
+#define Gegid PL_egid
+#define Gerror_count PL_error_count
+#define Geuid PL_euid
+#define Geval_cond PL_eval_cond
+#define Geval_mutex PL_eval_mutex
+#define Geval_owner PL_eval_owner
+#define Gevalseq PL_evalseq
+#define Gexpect PL_expect
+#define Ggid PL_gid
+#define Ghe_root PL_he_root
+#define Ghexdigit PL_hexdigit
+#define Ghints PL_hints
+#define Gin_my PL_in_my
+#define Gin_my_stash PL_in_my_stash
+#define Glast_lop PL_last_lop
+#define Glast_lop_op PL_last_lop_op
+#define Glast_uni PL_last_uni
+#define Glex_brackets PL_lex_brackets
+#define Glex_brackstack PL_lex_brackstack
+#define Glex_casemods PL_lex_casemods
+#define Glex_casestack PL_lex_casestack
+#define Glex_defer PL_lex_defer
+#define Glex_dojoin PL_lex_dojoin
+#define Glex_expect PL_lex_expect
+#define Glex_fakebrack PL_lex_fakebrack
+#define Glex_formbrack PL_lex_formbrack
+#define Glex_inpat PL_lex_inpat
+#define Glex_inwhat PL_lex_inwhat
+#define Glex_op PL_lex_op
+#define Glex_repl PL_lex_repl
+#define Glex_starts PL_lex_starts
+#define Glex_state PL_lex_state
+#define Glex_stuff PL_lex_stuff
+#define Glinestr PL_linestr
+#define Gmalloc_mutex PL_malloc_mutex
+#define Gmax_intro_pending PL_max_intro_pending
+#define Gmaxo PL_maxo
+#define Gmin_intro_pending PL_min_intro_pending
+#define Gmulti_close PL_multi_close
+#define Gmulti_end PL_multi_end
+#define Gmulti_open PL_multi_open
+#define Gmulti_start PL_multi_start
+#define Gna PL_na
+#define Gnexttoke PL_nexttoke
+#define Gnexttype PL_nexttype
+#define Gnextval PL_nextval
+#define Gnice_chunk PL_nice_chunk
+#define Gnice_chunk_size PL_nice_chunk_size
+#define Gninterps PL_ninterps
+#define Gnomemok PL_nomemok
+#define Gnthreads PL_nthreads
+#define Gnthreads_cond PL_nthreads_cond
+#define Gnumeric_local PL_numeric_local
+#define Gnumeric_name PL_numeric_name
+#define Gnumeric_standard PL_numeric_standard
+#define Goldbufptr PL_oldbufptr
+#define Goldoldbufptr PL_oldoldbufptr
+#define Gop_seqmax PL_op_seqmax
+#define Gorigalen PL_origalen
+#define Gorigenviron PL_origenviron
+#define Gosname PL_osname
+#define Gpad_reset_pending PL_pad_reset_pending
+#define Gpadix PL_padix
+#define Gpadix_floor PL_padix_floor
+#define Gpatleave PL_patleave
+#define Gpidstatus PL_pidstatus
+#define Grunops PL_runops
+#define Gsh_path PL_sh_path
+#define Gsighandlerp PL_sighandlerp
+#define Gspecialsv_list PL_specialsv_list
+#define Gsubline PL_subline
+#define Gsubname PL_subname
+#define Gsv_mutex PL_sv_mutex
+#define Gsv_no PL_sv_no
+#define Gsv_undef PL_sv_undef
+#define Gsv_yes PL_sv_yes
+#define Gsvref_mutex PL_svref_mutex
+#define Gthisexpr PL_thisexpr
+#define Gthr_key PL_thr_key
+#define Gthreads_mutex PL_threads_mutex
+#define Gthreadsv_names PL_threadsv_names
+#define Gtokenbuf PL_tokenbuf
+#define Guid PL_uid
+#define Gxiv_arenaroot PL_xiv_arenaroot
+#define Gxiv_root PL_xiv_root
+#define Gxnv_root PL_xnv_root
+#define Gxpv_root PL_xpv_root
+#define Gxrv_root PL_xrv_root
#ifdef EMBED
-#define No Perl_No
-#define Yes Perl_Yes
-#define amagic_generation Perl_amagic_generation
-#define an Perl_an
-#define bufend Perl_bufend
-#define bufptr Perl_bufptr
-#define collation_ix Perl_collation_ix
-#define collation_name Perl_collation_name
-#define collation_standard Perl_collation_standard
-#define collxfrm_base Perl_collxfrm_base
-#define collxfrm_mult Perl_collxfrm_mult
-#define cop_seqmax Perl_cop_seqmax
-#define cryptseen Perl_cryptseen
-#define cshlen Perl_cshlen
-#define cshname Perl_cshname
-#define curinterp Perl_curinterp
-#define curthr Perl_curthr
-#define debug Perl_debug
-#define do_undump Perl_do_undump
-#define egid Perl_egid
-#define error_count Perl_error_count
-#define euid Perl_euid
-#define eval_cond Perl_eval_cond
-#define eval_mutex Perl_eval_mutex
-#define eval_owner Perl_eval_owner
-#define evalseq Perl_evalseq
-#define expect Perl_expect
-#define gid Perl_gid
-#define he_root Perl_he_root
-#define hexdigit Perl_hexdigit
-#define hints Perl_hints
-#define in_my Perl_in_my
-#define in_my_stash Perl_in_my_stash
-#define last_lop Perl_last_lop
-#define last_lop_op Perl_last_lop_op
-#define last_uni Perl_last_uni
-#define lex_brackets Perl_lex_brackets
-#define lex_brackstack Perl_lex_brackstack
-#define lex_casemods Perl_lex_casemods
-#define lex_casestack Perl_lex_casestack
-#define lex_defer Perl_lex_defer
-#define lex_dojoin Perl_lex_dojoin
-#define lex_expect Perl_lex_expect
-#define lex_fakebrack Perl_lex_fakebrack
-#define lex_formbrack Perl_lex_formbrack
-#define lex_inpat Perl_lex_inpat
-#define lex_inwhat Perl_lex_inwhat
-#define lex_op Perl_lex_op
-#define lex_repl Perl_lex_repl
-#define lex_starts Perl_lex_starts
-#define lex_state Perl_lex_state
-#define lex_stuff Perl_lex_stuff
-#define linestr Perl_linestr
-#define malloc_mutex Perl_malloc_mutex
-#define max_intro_pending Perl_max_intro_pending
-#define maxo Perl_maxo
-#define min_intro_pending Perl_min_intro_pending
-#define multi_close Perl_multi_close
-#define multi_end Perl_multi_end
-#define multi_open Perl_multi_open
-#define multi_start Perl_multi_start
-#define na Perl_na
-#define nexttoke Perl_nexttoke
-#define nexttype Perl_nexttype
-#define nextval Perl_nextval
-#define nice_chunk Perl_nice_chunk
-#define nice_chunk_size Perl_nice_chunk_size
-#define ninterps Perl_ninterps
-#define nomemok Perl_nomemok
-#define nthreads Perl_nthreads
-#define nthreads_cond Perl_nthreads_cond
-#define numeric_local Perl_numeric_local
-#define numeric_name Perl_numeric_name
-#define numeric_standard Perl_numeric_standard
-#define oldbufptr Perl_oldbufptr
-#define oldoldbufptr Perl_oldoldbufptr
-#define op_seqmax Perl_op_seqmax
-#define origalen Perl_origalen
-#define origenviron Perl_origenviron
-#define osname Perl_osname
-#define pad_reset_pending Perl_pad_reset_pending
-#define padix Perl_padix
-#define padix_floor Perl_padix_floor
-#define patleave Perl_patleave
-#define pidstatus Perl_pidstatus
-#define runops Perl_runops
-#define sh_path Perl_sh_path
-#define sighandlerp Perl_sighandlerp
-#define specialsv_list Perl_specialsv_list
-#define subline Perl_subline
-#define subname Perl_subname
-#define sv_mutex Perl_sv_mutex
-#define sv_no Perl_sv_no
-#define sv_undef Perl_sv_undef
-#define sv_yes Perl_sv_yes
-#define svref_mutex Perl_svref_mutex
-#define thisexpr Perl_thisexpr
-#define thr_key Perl_thr_key
-#define threads_mutex Perl_threads_mutex
-#define threadsv_names Perl_threadsv_names
-#define tokenbuf Perl_tokenbuf
-#define uid Perl_uid
-#define xiv_arenaroot Perl_xiv_arenaroot
-#define xiv_root Perl_xiv_root
-#define xnv_root Perl_xnv_root
-#define xpv_root Perl_xpv_root
-#define xrv_root Perl_xrv_root
#endif /* EMBED */
#endif /* PERL_GLOBAL_STRUCT */
char *type = 0;
IV iv;
- for (iv = 0; iv < sizeof(specialsv_list)/sizeof(SV*); iv++) {
- if (sv == specialsv_list[iv]) {
+ for (iv = 0; iv < sizeof(PL_specialsv_list)/sizeof(SV*); iv++) {
+ if (sv == PL_specialsv_list[iv]) {
type = "B::SPECIAL";
break;
}
BOOT:
INIT_SPECIALSV_LIST;
-#define B_main_cv() main_cv
-#define B_main_root() main_root
-#define B_main_start() main_start
-#define B_comppadlist() (main_cv ? CvPADLIST(main_cv) : CvPADLIST(compcv))
-#define B_sv_undef() &sv_undef
-#define B_sv_yes() &sv_yes
-#define B_sv_no() &sv_no
+#define B_main_cv() PL_main_cv
+#define B_main_root() PL_main_root
+#define B_main_start() PL_main_start
+#define B_comppadlist() (PL_main_cv ? CvPADLIST(PL_main_cv) : CvPADLIST(PL_compcv))
+#define B_sv_undef() &PL_sv_undef
+#define B_sv_yes() &PL_sv_yes
+#define B_sv_no() &PL_sv_no
B::CV
B_main_cv()
int opnum
CODE:
ST(0) = sv_newmortal();
- if (opnum >= 0 && opnum < maxo) {
+ if (opnum >= 0 && opnum < PL_maxo) {
sv_setpvn(ST(0), "pp_", 3);
sv_catpv(ST(0), op_name[opnum]);
}
void
minus_c()
CODE:
- minus_c = TRUE;
+ PL_minus_c = TRUE;
SV *
cstring(sv)
if (SvGMAGICAL(val))
mg_get(val);
- if (val == &sv_undef || !SvOK(val)) {
+ if (val == &PL_sv_undef || !SvOK(val)) {
sv_catpvn(retval, "undef", 5);
return 1;
}
XPUSHs(val); PUTBACK;
i = perl_call_method(SvPVX(freezer), G_EVAL|G_SCALAR);
SPAGAIN;
- if (SvTRUE(GvSV(errgv)))
+ if (SvTRUE(GvSV(PL_errgv)))
warn("WARNING(Freezer method call failed): %s",
- SvPVX(GvSV(errgv)));
+ SvPVX(GvSV(PL_errgv)));
else if (i)
val = newSVsv(POPs);
PUTBACK; FREETMPS; LEAVE;
if (svp)
elem = *svp;
else
- elem = &sv_undef;
+ elem = &PL_sv_undef;
ilen = inamelen;
sv_setiv(ixsv, ix);
todumpav = namesav = Nullav;
seenhv = Nullhv;
val = pad = xpad = apad = sep = tmp = varname
- = freezer = toaster = bless = &sv_undef;
+ = freezer = toaster = bless = &PL_sv_undef;
name = sv_newmortal();
indent = 2;
terse = useqq = purity = deepcopy = 0;
if ((svp = av_fetch(todumpav, i, FALSE)))
val = *svp;
else
- val = &sv_undef;
+ val = &PL_sv_undef;
if ((svp = av_fetch(namesav, i, TRUE)))
sv_setsv(name, *svp);
else
if (rld_success) {
result = path;
/* prevent multiple loads of same file into same process */
- hv_store(dl_loaded_files, path, strlen(path), &sv_yes, 0);
+ hv_store(dl_loaded_files, path, strlen(path), &PL_sv_yes, 0);
} else {
TransferError(nxerr);
result = (char*) 0;
New(0, tmpbuf, strlen(filename) + 5, char);
SAVEFREEPV(tmpbuf);
sprintf(tmpbuf,"%s.dir",filename);
- if (stat(tmpbuf, &statbuf) < 0) {
+ if (stat(tmpbuf, &PL_statbuf) < 0) {
if (flags & O_CREAT) {
if (mode < 0 || close(creat(tmpbuf,mode)) < 0)
croak("ODBM_File: Can't create %s", filename);
#include "perl.h"
#include "XSUB.h"
-/* maxo shouldn't differ from MAXO but leave room anyway (see BOOT:) */
+/* PL_maxo shouldn't differ from MAXO but leave room anyway (see BOOT:) */
#define OP_MASK_BUF_SIZE (MAXO + 100)
/* XXX op_named_bits and opset_all are never freed */
op_named_bits = newHV();
op_names = get_op_names();
- for(i=0; i < maxo; ++i) {
+ for(i=0; i < PL_maxo; ++i) {
SV *sv;
sv = newSViv(i);
SvREADONLY_on(sv);
while(i-- > 0)
bitmap[i] = 0xFF;
/* Take care to set the right number of bits in the last byte */
- bitmap[len-1] = (maxo & 0x07) ? ~(0xFF << (maxo & 0x07)) : 0xFF;
+ bitmap[len-1] = (PL_maxo & 0x07) ? ~(0xFF << (PL_maxo & 0x07)) : 0xFF;
put_op_bitspec(":all",0, opset_all); /* don't mortalise */
}
int myopcode = SvIV(bitspec);
int offset = myopcode >> 3;
int bit = myopcode & 0x07;
- if (myopcode >= maxo || myopcode < 0)
+ if (myopcode >= PL_maxo || myopcode < 0)
croak("panic: opcode \"%s\" value %d is invalid", opname, myopcode);
if (opcode_debug >= 2)
warn("set_opset_bits bit %2d (off=%d, bit=%d) %s %s\n",
static void
-opmask_add(SV *opset) /* THE ONLY FUNCTION TO EDIT op_mask ITSELF */
+opmask_add(SV *opset) /* THE ONLY FUNCTION TO EDIT PL_op_mask ITSELF */
{
int i,j;
char *bitmask;
verify_opset(opset,1); /* croaks on bad opset */
- if (!op_mask) /* caller must ensure op_mask exists */
- croak("Can't add to uninitialised op_mask");
+ if (!PL_op_mask) /* caller must ensure PL_op_mask exists */
+ croak("Can't add to uninitialised PL_op_mask");
/* OPCODES ALREADY MASKED ARE NEVER UNMASKED. See opmask_addlocal() */
myopcode += 8;
continue;
}
- for (j=0; j < 8 && myopcode < maxo; )
- op_mask[myopcode++] |= bits & (1 << j++);
+ for (j=0; j < 8 && myopcode < PL_maxo; )
+ PL_op_mask[myopcode++] |= bits & (1 << j++);
}
}
static void
-opmask_addlocal(SV *opset, char *op_mask_buf) /* Localise op_mask then opmask_add() */
+opmask_addlocal(SV *opset, char *op_mask_buf) /* Localise PL_op_mask then opmask_add() */
{
- char *orig_op_mask = op_mask;
- SAVEPPTR(op_mask);
+ char *orig_op_mask = PL_op_mask;
+ SAVEPPTR(PL_op_mask);
#if !(defined(PERL_OBJECT) && defined(__BORLANDC__))
/* XXX casting to an ordinary function ptr from a member function ptr
* is disallowed by Borland
*/
if (opcode_debug >= 2)
- SAVEDESTRUCTOR((void(CPERLscope(*))_((void*)))warn,"op_mask restored");
+ SAVEDESTRUCTOR((void(CPERLscope(*))_((void*)))warn,"PL_op_mask restored");
#endif
- op_mask = &op_mask_buf[0];
+ PL_op_mask = &op_mask_buf[0];
if (orig_op_mask)
- Copy(orig_op_mask, op_mask, maxo, char);
+ Copy(orig_op_mask, PL_op_mask, PL_maxo, char);
else
- Zero(op_mask, maxo, char);
+ Zero(PL_op_mask, PL_maxo, char);
opmask_add(opset);
}
PROTOTYPES: ENABLE
BOOT:
- assert(maxo < OP_MASK_BUF_SIZE);
- opset_len = (maxo + 7) / 8;
+ assert(PL_maxo < OP_MASK_BUF_SIZE);
+ opset_len = (PL_maxo + 7) / 8;
if (opcode_debug >= 1)
warn("opset_len %ld\n", (long)opset_len);
op_names_init();
opmask_addlocal(mask, op_mask_buf);
- save_aptr(&endav);
- endav = (AV*)sv_2mortal((SV*)newAV()); /* ignore END blocks for now */
+ save_aptr(&PL_endav);
+ PL_endav = (AV*)sv_2mortal((SV*)newAV()); /* ignore END blocks for now */
- save_hptr(&defstash); /* save current default stack */
+ save_hptr(&PL_defstash); /* save current default stack */
/* the assignment to global defstash changes our sense of 'main' */
- defstash = gv_stashpv(Package, GV_ADDWARN); /* should exist already */
+ PL_defstash = gv_stashpv(Package, GV_ADDWARN); /* should exist already */
/* defstash must itself contain a main:: so we'll add that now */
/* take care with the ref counts (was cause of long standing bug) */
/* XXX I'm still not sure if this is right, GV_ADDWARN should warn! */
gv = gv_fetchpv("main::", GV_ADDWARN, SVt_PVHV);
sv_free((SV*)GvHV(gv));
- GvHV(gv) = (HV*)SvREFCNT_inc(defstash);
+ GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash);
PUSHMARK(SP);
perl_call_sv(codesv, GIMME|G_EVAL|G_KEEPERR); /* use callers context */
bitmap = SvPVX(opset);
while(len-- > 0)
bitmap[len] = ~bitmap[len];
- /* take care of extra bits beyond maxo in last byte */
- if (maxo & 07)
- bitmap[opset_len-1] &= ~(0xFF << (maxo & 0x07));
+ /* take care of extra bits beyond PL_maxo in last byte */
+ if (PL_maxo & 07)
+ bitmap[opset_len-1] &= ~(0xFF << (PL_maxo & 0x07));
}
ST(0) = opset;
verify_opset(opset,1);
for (myopcode=0, i=0; i < opset_len; i++) {
U16 bits = bitmap[i];
- for (j=0; j < 8 && myopcode < maxo; j++, myopcode++) {
+ for (j=0; j < 8 && myopcode < PL_maxo; j++, myopcode++) {
if ( bits & (1 << j) )
XPUSHs(sv_2mortal(newSVpv(names[myopcode], 0)));
}
SV *bitspec = get_op_bitspec(opname, len, 1);
if (SvIOK(bitspec)) {
myopcode = SvIV(bitspec);
- if (myopcode < 0 || myopcode >= maxo)
+ if (myopcode < 0 || myopcode >= PL_maxo)
croak("panic: opcode %d (%s) out of range",myopcode,opname);
XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0)));
}
myopcode = 0;
for (b=0; b < opset_len; b++) {
U16 bits = bitmap[b];
- for (j=0; j < 8 && myopcode < maxo; j++, myopcode++)
+ for (j=0; j < 8 && myopcode < PL_maxo; j++, myopcode++)
if (bits & (1 << j))
XPUSHs(sv_2mortal(newSVpv(op_desc[myopcode], 0)));
}
opmask_add(opset)
SV *opset
PREINIT:
- if (!op_mask)
- Newz(0, op_mask, maxo, char);
+ if (!PL_op_mask)
+ Newz(0, PL_op_mask, PL_maxo, char);
void
opcodes()
croak("opcodes in list context not yet implemented"); /* XXX */
}
else {
- XPUSHs(sv_2mortal(newSViv(maxo)));
+ XPUSHs(sv_2mortal(newSViv(PL_maxo)));
}
void
opmask()
CODE:
ST(0) = sv_2mortal(new_opset(Nullsv));
- if (op_mask) {
+ if (PL_op_mask) {
char *bitmap = SvPVX(ST(0));
int myopcode;
- for(myopcode=0; myopcode < maxo; ++myopcode) {
- if (op_mask[myopcode])
+ for(myopcode=0; myopcode < PL_maxo; ++myopcode) {
+ if (PL_op_mask[myopcode])
bitmap[myopcode >> 3] |= 1 << (myopcode & 0x07);
}
}
# This code is really grody because we're trying to make the signal
# interface look beautiful, which is hard.
- if (!siggv)
+ if (!PL_siggv)
gv_fetchpv("SIG", TRUE, SVt_PVHV);
{
struct sigaction oact;
POSIX__SigSet sigset;
SV** svp;
- SV** sigsvp = hv_fetch(GvHVn(siggv),
+ SV** sigsvp = hv_fetch(GvHVn(PL_siggv),
sig_name[sig],
strlen(sig_name[sig]),
TRUE);
cp++;
continue;
}
- if (base == 16 && (s=strchr(hexdigit,c))) {
+ if (base == 16 && (s=strchr(PL_hexdigit,c))) {
val = (val << 4) +
- ((s - hexdigit) & 15);
+ ((s - PL_hexdigit) & 15);
cp++;
continue;
}
int i;
CV *cv;
PPCODE:
- if (!compcv || !(cv = CvOUTSIDE(compcv)))
+ if (!PL_compcv || !(cv = CvOUTSIDE(PL_compcv)))
croak("can't set attributes outside a subroutine scope");
for (i = 1; i < items; i++) {
char *attr = SvPV(ST(i), na);
deinstall(void)
{
dTHR;
- regexecp = ®exec_flags;
- regcompp = &pregcomp;
+ PL_regexecp = ®exec_flags;
+ PL_regcompp = &pregcomp;
if (!oldfl)
- debug &= ~R_DB;
+ PL_debug &= ~R_DB;
}
static void
install(void)
{
dTHR;
- regexecp = &my_regexec;
- regcompp = &my_regcomp;
- oldfl = debug & R_DB;
- debug |= R_DB;
+ PL_regexecp = &my_regexec;
+ PL_regcompp = &my_regcomp;
+ oldfl = PL_debug & R_DB;
+ PL_debug |= R_DB;
}
MODULE = re PACKAGE = re
tmpbuf[0] = '_';
tmpbuf[1] = '<';
strcpy(tmpbuf + 2, name);
- gv = *(GV**)hv_fetch(defstash, tmpbuf, tmplen, TRUE);
+ gv = *(GV**)hv_fetch(PL_defstash, tmpbuf, tmplen, TRUE);
if (!isGV(gv))
- gv_init(gv, defstash, tmpbuf, tmplen, FALSE);
+ gv_init(gv, PL_defstash, tmpbuf, tmplen, FALSE);
if (tmpbuf != smallbuf)
Safefree(tmpbuf);
sv_setpv(GvSV(gv), name);
Newz(602, gp, 1, GP);
GvGP(gv) = gp_ref(gp);
GvSV(gv) = NEWSV(72,0);
- GvLINE(gv) = curcop->cop_line;
- GvFILEGV(gv) = curcop->cop_filegv;
+ GvLINE(gv) = PL_curcop->cop_line;
+ GvFILEGV(gv) = PL_curcop->cop_filegv;
GvCVGEN(gv) = 0;
GvEGV(gv) = gv;
sv_magic((SV*)gv, (SV*)gv, '*', name, len);
SvIOK_off(gv);
ENTER;
start_subparse(0,0); /* Create CV in compcv. */
- GvCV(gv) = compcv;
+ GvCV(gv) = PL_compcv;
LEAVE;
- sub_generation++;
+ PL_sub_generation++;
CvGV(GvCV(gv)) = (GV*)SvREFCNT_inc(gv);
- CvFILEGV(GvCV(gv)) = curcop->cop_filegv;
- CvSTASH(GvCV(gv)) = curstash;
+ CvFILEGV(GvCV(gv)) = PL_curcop->cop_filegv;
+ CvSTASH(GvCV(gv)) = PL_curstash;
#ifdef USE_THREADS
CvOWNER(GvCV(gv)) = 0;
if (!CvMUTEXP(GvCV(gv)))
gv_init(topgv, stash, name, len, TRUE);
if (cv = GvCV(topgv)) {
/* If genuine method or valid cache entry, use it */
- if (!GvCVGEN(topgv) || GvCVGEN(topgv) == sub_generation)
+ if (!GvCVGEN(topgv) || GvCVGEN(topgv) == PL_sub_generation)
return topgv;
/* Stale cached entry: junk it */
SvREFCNT_dec(cv);
GvCV(topgv) = cv = Nullcv;
GvCVGEN(topgv) = 0;
}
- else if (GvCVGEN(topgv) == sub_generation)
+ else if (GvCVGEN(topgv) == PL_sub_generation)
return 0; /* cache indicates sub doesn't exist */
}
gvp = (GV**)hv_fetch(stash, "ISA", 3, FALSE);
- av = (gvp && (gv = *gvp) && gv != (GV*)&sv_undef) ? GvAV(gv) : Nullav;
+ av = (gvp && (gv = *gvp) && gv != (GV*)&PL_sv_undef) ? GvAV(gv) : Nullav;
/* create and re-create @.*::SUPER::ISA on demand */
if (!av || !SvMAGIC(av)) {
packlen -= 7;
basestash = gv_stashpvn(packname, packlen, TRUE);
gvp = (GV**)hv_fetch(basestash, "ISA", 3, FALSE);
- if (gvp && (gv = *gvp) != (GV*)&sv_undef && (av = GvAV(gv))) {
+ if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (av = GvAV(gv))) {
dTHR; /* just for SvREFCNT_dec */
gvp = (GV**)hv_fetch(stash, "ISA", 3, TRUE);
if (!gvp || !(gv = *gvp))
SV* sv = *svp++;
HV* basestash = gv_stashsv(sv, FALSE);
if (!basestash) {
- if (dowarn)
+ if (PL_dowarn)
warn("Can't locate package %s for @%s::ISA",
SvPVX(sv), HvNAME(stash));
continue;
if (cv = GvCV(topgv))
SvREFCNT_dec(cv);
GvCV(topgv) = (CV*)SvREFCNT_inc(GvCV(gv));
- GvCVGEN(topgv) = sub_generation;
+ GvCVGEN(topgv) = PL_sub_generation;
}
return gv;
}
else if (topgv && GvREFCNT(topgv) == 1) {
/* cache the fact that the method is not defined */
- GvCVGEN(topgv) = sub_generation;
+ GvCVGEN(topgv) = PL_sub_generation;
}
}
}
if ((nsplit - origname) == 5 && strnEQ(origname, "SUPER", 5)) {
/* ->SUPER::method should really be looked up in original stash */
SV *tmpstr = sv_2mortal(newSVpvf("%s::SUPER",
- HvNAME(curcop->cop_stash)));
+ HvNAME(PL_curcop->cop_stash)));
stash = gv_stashpvn(SvPVX(tmpstr), SvCUR(tmpstr), TRUE);
DEBUG_o( deb("Treating %s as %s::%s\n",
origname, HvNAME(stash), name) );
gv = gv_fetchmeth(stash, name, nend - name, 0);
if (!gv) {
if (strEQ(name,"import"))
- gv = (GV*)&sv_yes;
+ gv = (GV*)&PL_sv_yes;
else if (autoload)
gv = gv_autoload4(stash, name, nend - name, TRUE);
}
/*
* Inheriting AUTOLOAD for non-methods works ... for now.
*/
- if (dowarn && !method && (GvCVGEN(gv) || GvSTASH(gv) != stash))
+ if (PL_dowarn && !method && (GvCVGEN(gv) || GvSTASH(gv) != stash))
warn(
"Use of inherited AUTOLOAD for non-method %s::%.*s() is deprecated",
HvNAME(stash), (int)len, name);
(*namend == ':' && namend[1] == ':'))
{
if (!stash)
- stash = defstash;
+ stash = PL_defstash;
if (!stash || !SvREFCNT(stash)) /* symbol table under destruction */
return Nullgv;
tmpbuf[len] = '\0';
gvp = (GV**)hv_fetch(stash,tmpbuf,len,add);
gv = gvp ? *gvp : Nullgv;
- if (gv && gv != (GV*)&sv_undef) {
+ if (gv && gv != (GV*)&PL_sv_undef) {
if (SvTYPE(gv) != SVt_PVGV)
gv_init(gv, stash, tmpbuf, len, (add & GV_ADDMULTI));
else
}
if (tmpbuf != smallbuf)
Safefree(tmpbuf);
- if (!gv || gv == (GV*)&sv_undef)
+ if (!gv || gv == (GV*)&PL_sv_undef)
return Nullgv;
if (!(stash = GvHV(gv)))
namend++;
name = namend;
if (!*name)
- return gv ? gv : (GV*)*hv_fetch(defstash, "main::", 6, TRUE);
+ return gv ? gv : (GV*)*hv_fetch(PL_defstash, "main::", 6, TRUE);
}
}
len = namend - name;
global = TRUE;
if (global)
- stash = defstash;
- else if ((COP*)curcop == &compiling) {
- stash = curstash;
- if (add && (hints & HINT_STRICT_VARS) &&
+ stash = PL_defstash;
+ else if ((COP*)PL_curcop == &PL_compiling) {
+ stash = PL_curstash;
+ if (add && (PL_hints & HINT_STRICT_VARS) &&
sv_type != SVt_PVCV &&
sv_type != SVt_PVGV &&
sv_type != SVt_PVFM &&
{
gvp = (GV**)hv_fetch(stash,name,len,0);
if (!gvp ||
- *gvp == (GV*)&sv_undef ||
+ *gvp == (GV*)&PL_sv_undef ||
SvTYPE(*gvp) != SVt_PVGV)
{
stash = 0;
}
}
else
- stash = curcop->cop_stash;
+ stash = PL_curcop->cop_stash;
}
else
- stash = defstash;
+ stash = PL_defstash;
}
/* By this point we should have a stash and a name */
warn("Global symbol \"%s\" requires explicit package name",
name);
}
- ++error_count;
- stash = curstash ? curstash : defstash; /* avoid core dumps */
+ ++PL_error_count;
+ stash = PL_curstash ? PL_curstash : PL_defstash; /* avoid core dumps */
add_gvflags = ((sv_type == SVt_PV) ? GVf_IMPORTED_SV
: (sv_type == SVt_PVAV) ? GVf_IMPORTED_AV
: (sv_type == SVt_PVHV) ? GVf_IMPORTED_HV
return Nullgv;
gvp = (GV**)hv_fetch(stash,name,len,add);
- if (!gvp || *gvp == (GV*)&sv_undef)
+ if (!gvp || *gvp == (GV*)&PL_sv_undef)
return Nullgv;
gv = *gvp;
if (SvTYPE(gv) == SVt_PVGV) {
if (strEQ(name, "SIG")) {
HV *hv;
I32 i;
- siggv = gv;
- GvMULTI_on(siggv);
- hv = GvHVn(siggv);
- hv_magic(hv, siggv, 'S');
+ PL_siggv = gv;
+ GvMULTI_on(PL_siggv);
+ hv = GvHVn(PL_siggv);
+ hv_magic(hv, PL_siggv, 'S');
for(i=1;sig_name[i];i++) {
SV ** init;
init=hv_fetch(hv,sig_name[i],strlen(sig_name[i]),1);
if(init)
- sv_setsv(*init,&sv_undef);
+ sv_setsv(*init,&PL_sv_undef);
psig_ptr[i] = 0;
psig_name[i] = 0;
}
case '&':
if (len > 1)
break;
- ampergv = gv;
- sawampersand = TRUE;
+ PL_ampergv = gv;
+ PL_sawampersand = TRUE;
goto ro_magicalize;
case '`':
if (len > 1)
break;
- leftgv = gv;
- sawampersand = TRUE;
+ PL_leftgv = gv;
+ PL_sawampersand = TRUE;
goto ro_magicalize;
case '\'':
if (len > 1)
break;
- rightgv = gv;
- sawampersand = TRUE;
+ PL_rightgv = gv;
+ PL_sawampersand = TRUE;
goto ro_magicalize;
case ':':
if (len > 1)
break;
- sv_setpv(GvSV(gv),chopset);
+ sv_setpv(GvSV(gv),PL_chopset);
goto magicalize;
case '?':
case '!':
if (len > 1)
break;
- if (sv_type > SVt_PV && curcop != &compiling) {
+ if (sv_type > SVt_PV && PL_curcop != &PL_compiling) {
HV* stash = gv_stashpvn("Errno",5,FALSE);
if(!stash || !(gv_fetchmethod(stash, "TIEHASH"))) {
dSP;
goto magicalize;
case '#':
case '*':
- if (dowarn && len == 1 && sv_type == SVt_PV)
+ if (PL_dowarn && len == 1 && sv_type == SVt_PV)
warn("Use of $%s is deprecated", name);
/* FALL THROUGH */
case '[':
if (len > 1)
break;
sv_setpv(GvSV(gv),"\f");
- formfeed = GvSV(gv);
+ PL_formfeed = GvSV(gv);
break;
case ';':
if (len > 1)
if (len == 1) {
SV *sv = GvSV(gv);
sv_upgrade(sv, SVt_PVNV);
- sv_setpv(sv, patchlevel);
+ sv_setpv(sv, PL_patchlevel);
(void)sv_2nv(sv);
SvREADONLY_on(sv);
}
if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
(gv = (GV*)HeVAL(entry)) && (hv = GvHV(gv)) && HvNAME(hv))
{
- if (hv != defstash)
+ if (hv != PL_defstash)
gv_check(hv); /* nested package */
}
else if (isALPHA(*HeKEY(entry))) {
gv = (GV*)HeVAL(entry);
if (SvTYPE(gv) != SVt_PVGV || GvMULTI(gv))
continue;
- curcop->cop_line = GvLINE(gv);
+ PL_curcop->cop_line = GvLINE(gv);
filegv = GvFILEGV(gv);
- curcop->cop_filegv = filegv;
+ PL_curcop->cop_filegv = filegv;
if (filegv && GvMULTI(filegv)) /* Filename began with slash */
continue;
warn("Name \"%s::%s\" used only once: possible typo",
GV *
newGVgen(char *pack)
{
- return gv_fetchpv(form("%s::_GEN_%ld", pack, (long)gensym++),
+ return gv_fetchpv(form("%s::_GEN_%ld", pack, (long)PL_gensym++),
TRUE, SVt_PVGV);
}
}
else {
/* Adding a new name to a subroutine invalidates method cache */
- sub_generation++;
+ PL_sub_generation++;
}
}
return gp;
}
if (gp->gp_cv) {
/* Deleting the name of a subroutine invalidates method cache */
- sub_generation++;
+ PL_sub_generation++;
}
if (--gp->gp_refcnt > 0) {
if (gp->gp_egv == gv)
AMT *amtp = (mg) ? (AMT*)mg->mg_ptr: (AMT *) NULL;
AMT amt;
- if (mg && amtp->was_ok_am == amagic_generation
- && amtp->was_ok_sub == sub_generation)
+ if (mg && amtp->was_ok_am == PL_amagic_generation
+ && amtp->was_ok_sub == PL_sub_generation)
return AMT_AMAGIC(amtp);
if (amtp && AMT_AMAGIC(amtp)) { /* Have table. */
int i;
DEBUG_o( deb("Recalcing overload magic in package %s\n",HvNAME(stash)) );
- amt.was_ok_am = amagic_generation;
- amt.was_ok_sub = sub_generation;
+ amt.was_ok_am = PL_amagic_generation;
+ amt.was_ok_sub = PL_sub_generation;
amt.fallback = AMGfallNO;
amt.flags = 0;
#ifdef OVERLOAD_VIA_HASH
gvp=(GV**)hv_fetch(stash,"OVERLOAD",8,FALSE); /* A shortcut */
- if (gvp && ((gv = *gvp) != (GV*)&sv_undef && (hv = GvHV(gv)))) {
+ if (gvp && ((gv = *gvp) != (GV*)&PL_sv_undef && (hv = GvHV(gv)))) {
int filled=0;
int i;
char *cp;
cp = (char *)AMG_names[i];
svp = (SV**)hv_fetch(hv, cp, strlen(cp), FALSE);
- if (svp && ((sv = *svp) != &sv_undef)) {
+ if (svp && ((sv = *svp) != &PL_sv_undef)) {
switch (SvTYPE(sv)) {
default:
if (!SvROK(sv)) {
GV *ngv;
DEBUG_o( deb("Resolving method `%.256s' for overloaded `%s' in package `%.256s'\n",
- SvPV(GvSV(gv), na), cp, HvNAME(stash)) );
+ SvPV(GvSV(gv), PL_na), cp, HvNAME(stash)) );
if (!SvPOK(GvSV(gv))
|| !(ngv = gv_fetchmethod_autoload(stash, SvPVX(GvSV(gv)),
FALSE)))
case inc_amg:
if (((cv = cvp[off=add_ass_amg]) && (inc_dec_ass=1))
|| ((cv = cvp[off=add_amg]) && (postpr=1))) {
- right = &sv_yes; lr = -1; assign = 1;
+ right = &PL_sv_yes; lr = -1; assign = 1;
}
break;
case dec_amg:
if (((cv = cvp[off=subtr_ass_amg]) && (inc_dec_ass=1))
|| ((cv = cvp[off=subtr_amg]) && (postpr=1))) {
- right = &sv_yes; lr = -1; assign = 1;
+ right = &PL_sv_yes; lr = -1; assign = 1;
}
break;
case bool__amg:
ENTER;
SAVEOP();
op = (OP *) &myop;
- if (PERLDB_SUB && curstash != debstash)
+ if (PERLDB_SUB && PL_curstash != PL_debstash)
op->op_private |= OPpENTERSUB_DB;
PUTBACK;
pp_pushmark(ARGS);
EXTEND(SP, notfound + 5);
PUSHs(lr>0? right: left);
PUSHs(lr>0? left: right);
- PUSHs( lr > 0 ? &sv_yes : ( assign ? &sv_undef : &sv_no ));
+ PUSHs( lr > 0 ? &PL_sv_yes : ( assign ? &PL_sv_undef : &PL_sv_no ));
if (notfound) {
PUSHs( sv_2mortal(newSVpv((char *)AMG_names[method + assignshift],0)) );
}
new_he(void)
{
HE* he;
- if (he_root) {
- he = he_root;
- he_root = HeNEXT(he);
+ if (PL_he_root) {
+ he = PL_he_root;
+ PL_he_root = HeNEXT(he);
return he;
}
return more_he();
STATIC void
del_he(HE *p)
{
- HeNEXT(p) = (HE*)he_root;
- he_root = p;
+ HeNEXT(p) = (HE*)PL_he_root;
+ PL_he_root = p;
}
STATIC HE*
{
register HE* he;
register HE* heend;
- New(54, he_root, 1008/sizeof(HE), HE);
- he = he_root;
+ New(54, PL_he_root, 1008/sizeof(HE), HE);
+ he = PL_he_root;
heend = &he[1008 / sizeof(HE) - 1];
while (he < heend) {
HeNEXT(he) = (HE*)(he + 1);
dTHR;
sv = sv_newmortal();
mg_copy((SV*)hv, sv, key, klen);
- hv_fetch_sv = sv;
- return &hv_fetch_sv;
+ PL_hv_fetch_sv = sv;
+ return &PL_hv_fetch_sv;
}
#ifdef ENV_IS_CASELESS
else if (mg_find((SV*)hv,'E')) {
sv = sv_newmortal();
keysv = sv_2mortal(newSVsv(keysv));
mg_copy((SV*)hv, sv, (char*)keysv, HEf_SVKEY);
- if (!HeKEY_hek(&hv_fetch_ent_mh)) {
+ if (!HeKEY_hek(&PL_hv_fetch_ent_mh)) {
char *k;
New(54, k, HEK_BASESIZE + sizeof(SV*), char);
- HeKEY_hek(&hv_fetch_ent_mh) = (HEK*)k;
+ HeKEY_hek(&PL_hv_fetch_ent_mh) = (HEK*)k;
}
- HeSVKEY_set(&hv_fetch_ent_mh, keysv);
- HeVAL(&hv_fetch_ent_mh) = sv;
- return &hv_fetch_ent_mh;
+ HeSVKEY_set(&PL_hv_fetch_ent_mh, keysv);
+ HeVAL(&PL_hv_fetch_ent_mh) = sv;
+ return &PL_hv_fetch_ent_mh;
}
#ifdef ENV_IS_CASELESS
else if (mg_find((SV*)hv,'E')) {
bool needs_store;
hv_magic_check (hv, &needs_copy, &needs_store);
if (needs_copy) {
- bool save_taint = tainted;
- if (tainting)
- tainted = SvTAINTED(keysv);
+ bool save_taint = PL_tainted;
+ if (PL_tainting)
+ PL_tainted = SvTAINTED(keysv);
keysv = sv_2mortal(newSVsv(keysv));
mg_copy((SV*)hv, val, (char*)keysv, HEf_SVKEY);
TAINT_IF(save_taint);
register HE *entry;
register HE **oentry;
- nomemok = TRUE;
+ PL_nomemok = TRUE;
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
Renew(a, ARRAY_ALLOC_BYTES(newsize), char);
if (!a) {
#define MALLOC_OVERHEAD 16
New(2, a, ARRAY_ALLOC_BYTES(newsize), char);
if (!a) {
- nomemok = FALSE;
+ PL_nomemok = FALSE;
return;
}
Copy(xhv->xhv_array, a, oldsize * sizeof(HE*), char);
Safefree(xhv->xhv_array);
#endif
- nomemok = FALSE;
+ PL_nomemok = FALSE;
Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/
xhv->xhv_max = --newsize;
xhv->xhv_array = a;
a = xhv->xhv_array;
if (a) {
- nomemok = TRUE;
+ PL_nomemok = TRUE;
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
Renew(a, ARRAY_ALLOC_BYTES(newsize), char);
if (!a) {
#else
New(2, a, ARRAY_ALLOC_BYTES(newsize), char);
if (!a) {
- nomemok = FALSE;
+ PL_nomemok = FALSE;
return;
}
Copy(xhv->xhv_array, a, oldsize * sizeof(HE*), char);
else
Safefree(xhv->xhv_array);
#endif
- nomemok = FALSE;
+ PL_nomemok = FALSE;
Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/
}
else {
return;
val = HeVAL(entry);
if (val && isGV(val) && GvCVu(val) && HvNAME(hv))
- sub_generation++; /* may be deletion of method from stash */
+ PL_sub_generation++; /* may be deletion of method from stash */
SvREFCNT_dec(val);
if (HeKLEN(entry) == HEf_SVKEY) {
SvREFCNT_dec(HeKEY_sv(entry));
if (!entry)
return;
if (isGV(HeVAL(entry)) && GvCVu(HeVAL(entry)) && HvNAME(hv))
- sub_generation++; /* may be deletion of method from stash */
+ PL_sub_generation++; /* may be deletion of method from stash */
sv_2mortal(HeVAL(entry)); /* free between statements */
if (HeKLEN(entry) == HEf_SVKEY) {
sv_2mortal(HeKEY_sv(entry));
if (--*Svp == Nullsv)
hv_delete(strtab, str, len, G_DISCARD, hash);
} */
- xhv = (XPVHV*)SvANY(strtab);
+ xhv = (XPVHV*)SvANY(PL_strtab);
/* assert(xhv_array != 0) */
oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
for (entry = *oentry; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) {
if (!(Svp = hv_fetch(strtab, str, len, FALSE)))
hv_store(strtab, str, len, Nullsv, hash);
*/
- xhv = (XPVHV*)SvANY(strtab);
+ xhv = (XPVHV*)SvANY(PL_strtab);
/* assert(xhv_array != 0) */
oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
for (entry = *oentry; entry; i=0, entry = HeNEXT(entry)) {
if (i) { /* initial entry? */
++xhv->xhv_fill;
if (xhv->xhv_keys > xhv->xhv_max)
- hsplit(strtab);
+ hsplit(PL_strtab);
}
}
HeKEY_sv(he) : \
sv_2mortal(newSVpv(HeKEY(he), \
HeKLEN(he)))) : \
- &sv_undef)
+ &PL_sv_undef)
#define HeSVKEY_set(he,sv) ((HeKLEN(he) = HEf_SVKEY), (HeKEY_sv(he) = sv))
#define Nullhek Null(HEK*)
T_U_LONG
$var = (unsigned long)SvIV($arg)
T_CHAR
- $var = (char)*SvPV($arg,na)
+ $var = (char)*SvPV($arg,PL_na)
T_U_CHAR
$var = (unsigned char)SvIV($arg)
T_FLOAT
T_DOUBLE
$var = (double)SvNV($arg)
T_PV
- $var = ($type)SvPV($arg,na)
+ $var = ($type)SvPV($arg,PL_na)
T_PTR
$var = ($type)SvIV($arg)
T_PTRREF
T_OPAQUE
$var NOT IMPLEMENTED
T_OPAQUEPTR
- $var = ($type)SvPV($arg,na)
+ $var = ($type)SvPV($arg,PL_na)
T_PACKED
$var = XS_unpack_$ntype($arg)
T_PACKEDARRAY
}
print Q<<"EOF";;
-# ST(0) = &sv_yes;
-# XSRETURN(1);
+# XSRETURN_YES;
#]]
#
EOF
switch (*mg->mg_ptr) {
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
paren = atoi(mg->mg_ptr);
getparen:
if (paren <= rx->nparens &&
}
return 0;
case '+':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
paren = rx->lastparen;
if (paren)
goto getparen;
}
return 0;
case '`':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
if ((s = rx->subbeg) && rx->startp[0]) {
i = rx->startp[0] - s;
if (i >= 0)
}
return 0;
case '\'':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
if (rx->subend && (s = rx->endp[0])) {
i = rx->subend - s;
if (i >= 0)
}
return 0;
case ',':
- return (STRLEN)ofslen;
+ return (STRLEN)PL_ofslen;
case '\\':
- return (STRLEN)orslen;
+ return (STRLEN)PL_orslen;
}
magic_get(sv,mg);
if (!SvPOK(sv) && SvNIOK(sv))
- sv_2pv(sv, &na);
+ sv_2pv(sv, &PL_na);
if (SvPOK(sv))
return SvCUR(sv);
return 0;
switch (*mg->mg_ptr) {
case '\001': /* ^A */
- sv_setsv(sv, bodytarget);
+ sv_setsv(sv, PL_bodytarget);
break;
case '\004': /* ^D */
- sv_setiv(sv, (IV)(debug & 32767));
+ sv_setiv(sv, (IV)(PL_debug & 32767));
break;
case '\005': /* ^E */
#ifdef VMS
SvNOK_on(sv); /* what a wonderful hack! */
break;
case '\006': /* ^F */
- sv_setiv(sv, (IV)maxsysfd);
+ sv_setiv(sv, (IV)PL_maxsysfd);
break;
case '\010': /* ^H */
- sv_setiv(sv, (IV)hints);
+ sv_setiv(sv, (IV)PL_hints);
break;
case '\t': /* ^I */
- if (inplace)
- sv_setpv(sv, inplace);
+ if (PL_inplace)
+ sv_setpv(sv, PL_inplace);
else
- sv_setsv(sv, &sv_undef);
+ sv_setsv(sv, &PL_sv_undef);
break;
case '\017': /* ^O */
- sv_setpv(sv, osname);
+ sv_setpv(sv, PL_osname);
break;
case '\020': /* ^P */
- sv_setiv(sv, (IV)perldb);
+ sv_setiv(sv, (IV)PL_perldb);
break;
case '\023': /* ^S */
{
dTHR;
- if (lex_state != LEX_NOTPARSING)
+ if (PL_lex_state != LEX_NOTPARSING)
SvOK_off(sv);
- else if (in_eval)
+ else if (PL_in_eval)
sv_setiv(sv, 1);
else
sv_setiv(sv, 0);
#ifdef BIG_TIME
sv_setnv(sv, basetime);
#else
- sv_setiv(sv, (IV)basetime);
+ sv_setiv(sv, (IV)PL_basetime);
#endif
break;
case '\027': /* ^W */
- sv_setiv(sv, (IV)dowarn);
+ sv_setiv(sv, (IV)PL_dowarn);
break;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '&':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
/*
* Pre-threads, this was paren = atoi(GvENAME((GV*)mg->mg_obj));
* XXX Does the new way break anything?
getrx:
if (i >= 0) {
bool was_tainted;
- if (tainting) {
- was_tainted = tainted;
- tainted = FALSE;
+ if (PL_tainting) {
+ was_tainted = PL_tainted;
+ PL_tainted = FALSE;
}
sv_setpvn(sv,s,i);
- if (tainting)
- tainted = (was_tainted || RX_MATCH_TAINTED(rx));
+ if (PL_tainting)
+ PL_tainted = (was_tainted || RX_MATCH_TAINTED(rx));
break;
}
}
}
- sv_setsv(sv,&sv_undef);
+ sv_setsv(sv,&PL_sv_undef);
break;
case '+':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
paren = rx->lastparen;
if (paren)
goto getparen;
}
- sv_setsv(sv,&sv_undef);
+ sv_setsv(sv,&PL_sv_undef);
break;
case '`':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
if ((s = rx->subbeg) && rx->startp[0]) {
i = rx->startp[0] - s;
goto getrx;
}
}
- sv_setsv(sv,&sv_undef);
+ sv_setsv(sv,&PL_sv_undef);
break;
case '\'':
- if (curpm && (rx = curpm->op_pmregexp)) {
+ if (PL_curpm && (rx = PL_curpm->op_pmregexp)) {
if (rx->subend && (s = rx->endp[0])) {
i = rx->subend - s;
goto getrx;
}
}
- sv_setsv(sv,&sv_undef);
+ sv_setsv(sv,&PL_sv_undef);
break;
case '.':
#ifndef lint
- if (GvIO(last_in_gv)) {
- sv_setiv(sv, (IV)IoLINES(GvIO(last_in_gv)));
+ if (GvIO(PL_last_in_gv)) {
+ sv_setiv(sv, (IV)IoLINES(GvIO(PL_last_in_gv)));
}
#endif
break;
}
break;
case '^':
- s = IoTOP_NAME(GvIOp(defoutgv));
+ s = IoTOP_NAME(GvIOp(PL_defoutgv));
if (s)
sv_setpv(sv,s);
else {
- sv_setpv(sv,GvENAME(defoutgv));
+ sv_setpv(sv,GvENAME(PL_defoutgv));
sv_catpv(sv,"_TOP");
}
break;
case '~':
- s = IoFMT_NAME(GvIOp(defoutgv));
+ s = IoFMT_NAME(GvIOp(PL_defoutgv));
if (!s)
- s = GvENAME(defoutgv);
+ s = GvENAME(PL_defoutgv);
sv_setpv(sv,s);
break;
#ifndef lint
case '=':
- sv_setiv(sv, (IV)IoPAGE_LEN(GvIOp(defoutgv)));
+ sv_setiv(sv, (IV)IoPAGE_LEN(GvIOp(PL_defoutgv)));
break;
case '-':
- sv_setiv(sv, (IV)IoLINES_LEFT(GvIOp(defoutgv)));
+ sv_setiv(sv, (IV)IoLINES_LEFT(GvIOp(PL_defoutgv)));
break;
case '%':
- sv_setiv(sv, (IV)IoPAGE(GvIOp(defoutgv)));
+ sv_setiv(sv, (IV)IoPAGE(GvIOp(PL_defoutgv)));
break;
#endif
case ':':
case '/':
break;
case '[':
- WITH_THR(sv_setiv(sv, (IV)curcop->cop_arybase));
+ WITH_THR(sv_setiv(sv, (IV)PL_curcop->cop_arybase));
break;
case '|':
- sv_setiv(sv, (IV)(IoFLAGS(GvIOp(defoutgv)) & IOf_FLUSH) != 0 );
+ sv_setiv(sv, (IV)(IoFLAGS(GvIOp(PL_defoutgv)) & IOf_FLUSH) != 0 );
break;
case ',':
- sv_setpvn(sv,ofs,ofslen);
+ sv_setpvn(sv,PL_ofs,PL_ofslen);
break;
case '\\':
- sv_setpvn(sv,ors,orslen);
+ sv_setpvn(sv,PL_ors,PL_orslen);
break;
case '#':
- sv_setpv(sv,ofmt);
+ sv_setpv(sv,PL_ofmt);
break;
case '!':
#ifdef VMS
SvNOK_on(sv); /* what a wonderful hack! */
break;
case '<':
- sv_setiv(sv, (IV)uid);
+ sv_setiv(sv, (IV)PL_uid);
break;
case '>':
- sv_setiv(sv, (IV)euid);
+ sv_setiv(sv, (IV)PL_euid);
break;
case '(':
- sv_setiv(sv, (IV)gid);
- sv_setpvf(sv, "%Vd", (IV)gid);
+ sv_setiv(sv, (IV)PL_gid);
+ sv_setpvf(sv, "%Vd", (IV)PL_gid);
goto add_groups;
case ')':
- sv_setiv(sv, (IV)egid);
- sv_setpvf(sv, "%Vd", (IV)egid);
+ sv_setiv(sv, (IV)PL_egid);
+ sv_setpvf(sv, "%Vd", (IV)PL_egid);
add_groups:
#ifdef HAS_GETGROUPS
{
#if !defined(OS2) && !defined(AMIGAOS) && !defined(WIN32) && !defined(MSDOS)
/* And you'll never guess what the dog had */
/* in its mouth... */
- if (tainting) {
+ if (PL_tainting) {
MgTAINTEDDIR_off(mg);
#ifdef VMS
if (s && klen == 8 && strEQ(ptr, "DCL$PATH")) {
int
magic_clearenv(SV *sv, MAGIC *mg)
{
- my_setenv(MgPV(mg,na),Nullch);
+ my_setenv(MgPV(mg,PL_na),Nullch);
return 0;
}
die("Can't make list assignment to %%ENV on this system");
#else
dTHR;
- if (localizing) {
+ if (PL_localizing) {
HE* entry;
magic_clear_all_env(sv,mg);
hv_iterinit((HV*)sv);
while (entry = hv_iternext((HV*)sv)) {
I32 keylen;
my_setenv(hv_iterkey(entry, &keylen),
- SvPV(hv_iterval((HV*)sv, entry), na));
+ SvPV(hv_iterval((HV*)sv, entry), PL_na));
}
}
#endif
#else
I32 i;
- if (environ == origenviron)
+ if (environ == PL_origenviron)
New(901, environ, 1, char*);
else
for (i = 0; environ[i]; i++)
{
I32 i;
/* Are we fetching a signal entry? */
- i = whichsig(MgPV(mg,na));
+ i = whichsig(MgPV(mg,PL_na));
if (i) {
if(psig_ptr[i])
sv_setsv(sv,psig_ptr[i]);
if(sigstate == SIG_IGN)
sv_setpv(sv,"IGNORE");
else
- sv_setsv(sv,&sv_undef);
+ sv_setsv(sv,&PL_sv_undef);
psig_ptr[i] = SvREFCNT_inc(sv);
SvTEMP_off(sv);
}
{
I32 i;
/* Are we clearing a signal entry? */
- i = whichsig(MgPV(mg,na));
+ i = whichsig(MgPV(mg,PL_na));
if (i) {
if(psig_ptr[i]) {
SvREFCNT_dec(psig_ptr[i]);
I32 i;
SV** svp;
- s = MgPV(mg,na);
+ s = MgPV(mg,PL_na);
if (*s == '_') {
if (strEQ(s,"__DIE__"))
- svp = &diehook;
+ svp = &PL_diehook;
else if (strEQ(s,"__WARN__"))
- svp = &warnhook;
+ svp = &PL_warnhook;
else if (strEQ(s,"__PARSE__"))
- svp = &parsehook;
+ svp = &PL_parsehook;
else
croak("No such hook: %s", s);
i = 0;
else {
i = whichsig(s); /* ...no, a brick */
if (!i) {
- if (dowarn || strEQ(s,"ALARM"))
+ if (PL_dowarn || strEQ(s,"ALARM"))
warn("No such signal: SIG%s", s);
return 0;
}
}
if (SvTYPE(sv) == SVt_PVGV || SvROK(sv)) {
if (i)
- (void)rsignal(i, sighandlerp);
+ (void)rsignal(i, PL_sighandlerp);
else
*svp = SvREFCNT_inc(sv);
return 0;
}
- s = SvPV_force(sv,na);
+ s = SvPV_force(sv,PL_na);
if (strEQ(s,"IGNORE")) {
if (i)
(void)rsignal(i, SIG_IGN);
if (!strchr(s,':') && !strchr(s,'\''))
sv_setpv(sv, form("main::%s", s));
if (i)
- (void)rsignal(i, sighandlerp);
+ (void)rsignal(i, PL_sighandlerp);
else
*svp = SvREFCNT_inc(sv);
}
int
magic_setisa(SV *sv, MAGIC *mg)
{
- sub_generation++;
+ PL_sub_generation++;
return 0;
}
magic_setamagic(SV *sv, MAGIC *mg)
{
/* HV_badAMAGIC_on(Sv_STASH(sv)); */
- amagic_generation++;
+ PL_amagic_generation++;
return 0;
}
PUSHSTACKi(PERLSI_MAGIC);
if (magic_methcall(mg, meth, G_SCALAR, 2, NULL)) {
- sv_setsv(sv, *stack_sp--);
+ sv_setsv(sv, *PL_stack_sp--);
}
POPSTACK;
SAVETMPS;
PUSHSTACKi(PERLSI_MAGIC);
if (magic_methcall(mg, "FETCHSIZE", G_SCALAR, 2, NULL)) {
- sv = *stack_sp--;
+ sv = *PL_stack_sp--;
retval = (U32) SvIV(sv)-1;
}
POPSTACK;
PUTBACK;
if (perl_call_method(meth, G_SCALAR))
- sv_setsv(key, *stack_sp--);
+ sv_setsv(key, *PL_stack_sp--);
POPSTACK;
FREETMPS;
GV* gv;
SV** svp;
- gv = DBline;
+ gv = PL_DBline;
i = SvTRUE(sv);
svp = av_fetch(GvAV(gv),
- atoi(MgPV(mg,na)), FALSE);
+ atoi(MgPV(mg,PL_na)), FALSE);
if (svp && SvIOKp(*svp) && (o = (OP*)SvSTASH(*svp)))
o->op_private = i;
else
magic_getarylen(SV *sv, MAGIC *mg)
{
dTHR;
- sv_setiv(sv, AvFILL((AV*)mg->mg_obj) + curcop->cop_arybase);
+ sv_setiv(sv, AvFILL((AV*)mg->mg_obj) + PL_curcop->cop_arybase);
return 0;
}
magic_setarylen(SV *sv, MAGIC *mg)
{
dTHR;
- av_fill((AV*)mg->mg_obj, SvIV(sv) - curcop->cop_arybase);
+ av_fill((AV*)mg->mg_obj, SvIV(sv) - PL_curcop->cop_arybase);
return 0;
}
mg = mg_find(lsv, 'g');
if (mg && mg->mg_len >= 0) {
dTHR;
- sv_setiv(sv, mg->mg_len + curcop->cop_arybase);
+ sv_setiv(sv, mg->mg_len + PL_curcop->cop_arybase);
return 0;
}
}
}
len = SvPOK(lsv) ? SvCUR(lsv) : sv_len(lsv);
- WITH_THR(pos = SvIV(sv) - curcop->cop_arybase);
+ WITH_THR(pos = SvIV(sv) - PL_curcop->cop_arybase);
if (pos < 0) {
pos += len;
if (pos < 0)
if (!SvOK(sv))
return 0;
- s = SvPV(sv, na);
+ s = SvPV(sv, PL_na);
if (*s == '*' && s[1])
s++;
gv = gv_fetchpv(s,TRUE, SVt_PVGV);
magic_settaint(SV *sv, MAGIC *mg)
{
dTHR;
- if (localizing) {
- if (localizing == 1)
+ if (PL_localizing) {
+ if (PL_localizing == 1)
mg->mg_len <<= 1;
else
mg->mg_len >>= 1;
}
- else if (tainted)
+ else if (PL_tainted)
mg->mg_len |= 1;
else
mg->mg_len &= ~1;
if ((I32)LvTARGOFF(sv) <= AvFILL(av))
targ = AvARRAY(av)[LvTARGOFF(sv)];
}
- if (targ && targ != &sv_undef) {
+ if (targ && targ != &PL_sv_undef) {
dTHR; /* just for SvREFCNT_dec */
/* somebody else defined it for us */
SvREFCNT_dec(LvTARG(sv));
}
else
targ = LvTARG(sv);
- sv_setsv(sv, targ ? targ : &sv_undef);
+ sv_setsv(sv, targ ? targ : &PL_sv_undef);
return 0;
}
if (svp)
value = *svp;
}
- if (!value || value == &sv_undef)
- croak(no_helem, SvPV(mg->mg_obj, na));
+ if (!value || value == &PL_sv_undef)
+ croak(no_helem, SvPV(mg->mg_obj, PL_na));
}
else {
AV* av = (AV*)LvTARG(sv);
LvTARG(sv) = Nullsv; /* array can't be extended */
else {
SV** svp = av_fetch(av, LvTARGOFF(sv), TRUE);
- if (!svp || (value = *svp) == &sv_undef)
+ if (!svp || (value = *svp) == &PL_sv_undef)
croak(no_aelem, (I32)LvTARGOFF(sv));
}
}
STRLEN len;
switch (*mg->mg_ptr) {
case '\001': /* ^A */
- sv_setsv(bodytarget, sv);
+ sv_setsv(PL_bodytarget, sv);
break;
case '\004': /* ^D */
- debug = (SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) | 0x80000000;
+ PL_debug = (SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) | 0x80000000;
DEBUG_x(dump_all());
break;
case '\005': /* ^E */
#endif
break;
case '\006': /* ^F */
- maxsysfd = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ PL_maxsysfd = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
break;
case '\010': /* ^H */
- hints = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ PL_hints = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
break;
case '\t': /* ^I */
- if (inplace)
- Safefree(inplace);
+ if (PL_inplace)
+ Safefree(PL_inplace);
if (SvOK(sv))
- inplace = savepv(SvPV(sv,na));
+ PL_inplace = savepv(SvPV(sv,PL_na));
else
- inplace = Nullch;
+ PL_inplace = Nullch;
break;
case '\017': /* ^O */
- if (osname)
- Safefree(osname);
+ if (PL_osname)
+ Safefree(PL_osname);
if (SvOK(sv))
- osname = savepv(SvPV(sv,na));
+ PL_osname = savepv(SvPV(sv,PL_na));
else
- osname = Nullch;
+ PL_osname = Nullch;
break;
case '\020': /* ^P */
- perldb = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ PL_perldb = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
break;
case '\024': /* ^T */
#ifdef BIG_TIME
basetime = (Time_t)(SvNOK(sv) ? SvNVX(sv) : sv_2nv(sv));
#else
- basetime = (Time_t)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ PL_basetime = (Time_t)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
#endif
break;
case '\027': /* ^W */
- dowarn = (bool)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ PL_dowarn = (bool)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
break;
case '.':
- if (localizing) {
- if (localizing == 1)
- save_sptr((SV**)&last_in_gv);
+ if (PL_localizing) {
+ if (PL_localizing == 1)
+ save_sptr((SV**)&PL_last_in_gv);
}
- else if (SvOK(sv) && GvIO(last_in_gv))
- IoLINES(GvIOp(last_in_gv)) = (long)SvIV(sv);
+ else if (SvOK(sv) && GvIO(PL_last_in_gv))
+ IoLINES(GvIOp(PL_last_in_gv)) = (long)SvIV(sv);
break;
case '^':
- Safefree(IoTOP_NAME(GvIOp(defoutgv)));
- IoTOP_NAME(GvIOp(defoutgv)) = s = savepv(SvPV(sv,na));
- IoTOP_GV(GvIOp(defoutgv)) = gv_fetchpv(s,TRUE, SVt_PVIO);
+ Safefree(IoTOP_NAME(GvIOp(PL_defoutgv)));
+ IoTOP_NAME(GvIOp(PL_defoutgv)) = s = savepv(SvPV(sv,PL_na));
+ IoTOP_GV(GvIOp(PL_defoutgv)) = gv_fetchpv(s,TRUE, SVt_PVIO);
break;
case '~':
- Safefree(IoFMT_NAME(GvIOp(defoutgv)));
- IoFMT_NAME(GvIOp(defoutgv)) = s = savepv(SvPV(sv,na));
- IoFMT_GV(GvIOp(defoutgv)) = gv_fetchpv(s,TRUE, SVt_PVIO);
+ Safefree(IoFMT_NAME(GvIOp(PL_defoutgv)));
+ IoFMT_NAME(GvIOp(PL_defoutgv)) = s = savepv(SvPV(sv,PL_na));
+ IoFMT_GV(GvIOp(PL_defoutgv)) = gv_fetchpv(s,TRUE, SVt_PVIO);
break;
case '=':
- IoPAGE_LEN(GvIOp(defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ IoPAGE_LEN(GvIOp(PL_defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
break;
case '-':
- IoLINES_LEFT(GvIOp(defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
- if (IoLINES_LEFT(GvIOp(defoutgv)) < 0L)
- IoLINES_LEFT(GvIOp(defoutgv)) = 0L;
+ IoLINES_LEFT(GvIOp(PL_defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ if (IoLINES_LEFT(GvIOp(PL_defoutgv)) < 0L)
+ IoLINES_LEFT(GvIOp(PL_defoutgv)) = 0L;
break;
case '%':
- IoPAGE(GvIOp(defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ IoPAGE(GvIOp(PL_defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
break;
case '|':
{
- IO *io = GvIOp(defoutgv);
+ IO *io = GvIOp(PL_defoutgv);
if ((SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) == 0)
IoFLAGS(io) &= ~IOf_FLUSH;
else {
break;
case '*':
i = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
- multiline = (i != 0);
+ PL_multiline = (i != 0);
break;
case '/':
- SvREFCNT_dec(nrs);
- nrs = newSVsv(sv);
- SvREFCNT_dec(rs);
- rs = SvREFCNT_inc(nrs);
+ SvREFCNT_dec(PL_nrs);
+ PL_nrs = newSVsv(sv);
+ SvREFCNT_dec(PL_rs);
+ PL_rs = SvREFCNT_inc(PL_nrs);
break;
case '\\':
- if (ors)
- Safefree(ors);
+ if (PL_ors)
+ Safefree(PL_ors);
if (SvOK(sv) || SvGMAGICAL(sv))
- ors = savepv(SvPV(sv,orslen));
+ PL_ors = savepv(SvPV(sv,PL_orslen));
else {
- ors = Nullch;
- orslen = 0;
+ PL_ors = Nullch;
+ PL_orslen = 0;
}
break;
case ',':
- if (ofs)
- Safefree(ofs);
- ofs = savepv(SvPV(sv, ofslen));
+ if (PL_ofs)
+ Safefree(PL_ofs);
+ PL_ofs = savepv(SvPV(sv, PL_ofslen));
break;
case '#':
- if (ofmt)
- Safefree(ofmt);
- ofmt = savepv(SvPV(sv,na));
+ if (PL_ofmt)
+ Safefree(PL_ofmt);
+ PL_ofmt = savepv(SvPV(sv,PL_na));
break;
case '[':
- compiling.cop_arybase = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ PL_compiling.cop_arybase = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
break;
case '?':
#ifdef COMPLEX_STATUS
(SvIV(sv) == EVMSERR) ? 4 : vaxc$errno);
break;
case '<':
- uid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
- if (delaymagic) {
- delaymagic |= DM_RUID;
+ PL_uid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ if (PL_delaymagic) {
+ PL_delaymagic |= DM_RUID;
break; /* don't do magic till later */
}
#ifdef HAS_SETRUID
(void)setruid((Uid_t)uid);
#else
#ifdef HAS_SETREUID
- (void)setreuid((Uid_t)uid, (Uid_t)-1);
+ (void)setreuid((Uid_t)PL_uid, (Uid_t)-1);
#else
#ifdef HAS_SETRESUID
(void)setresuid((Uid_t)uid, (Uid_t)-1, (Uid_t)-1);
#endif
#endif
#endif
- uid = (I32)PerlProc_getuid();
- tainting |= (uid && (euid != uid || egid != gid));
+ PL_uid = (I32)PerlProc_getuid();
+ PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case '>':
- euid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
- if (delaymagic) {
- delaymagic |= DM_EUID;
+ PL_euid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ if (PL_delaymagic) {
+ PL_delaymagic |= DM_EUID;
break; /* don't do magic till later */
}
#ifdef HAS_SETEUID
- (void)seteuid((Uid_t)euid);
+ (void)seteuid((Uid_t)PL_euid);
#else
#ifdef HAS_SETREUID
(void)setreuid((Uid_t)-1, (Uid_t)euid);
#endif
#endif
#endif
- euid = (I32)PerlProc_geteuid();
- tainting |= (uid && (euid != uid || egid != gid));
+ PL_euid = (I32)PerlProc_geteuid();
+ PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case '(':
- gid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
- if (delaymagic) {
- delaymagic |= DM_RGID;
+ PL_gid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+ if (PL_delaymagic) {
+ PL_delaymagic |= DM_RGID;
break; /* don't do magic till later */
}
#ifdef HAS_SETRGID
(void)setrgid((Gid_t)gid);
#else
#ifdef HAS_SETREGID
- (void)setregid((Gid_t)gid, (Gid_t)-1);
+ (void)setregid((Gid_t)PL_gid, (Gid_t)-1);
#else
#ifdef HAS_SETRESGID
(void)setresgid((Gid_t)gid, (Gid_t)-1, (Gid_t) 1);
#endif
#endif
#endif
- gid = (I32)PerlProc_getgid();
- tainting |= (uid && (euid != uid || egid != gid));
+ PL_gid = (I32)PerlProc_getgid();
+ PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case ')':
#ifdef HAS_SETGROUPS
{
- char *p = SvPV(sv, na);
+ char *p = SvPV(sv, PL_na);
Groups_t gary[NGROUPS];
SET_NUMERIC_STANDARD();
while (isSPACE(*p))
++p;
- egid = I_V(atof(p));
+ PL_egid = I_V(atof(p));
for (i = 0; i < NGROUPS; ++i) {
while (*p && !isSPACE(*p))
++p;
#else /* HAS_SETGROUPS */
egid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
#endif /* HAS_SETGROUPS */
- if (delaymagic) {
- delaymagic |= DM_EGID;
+ if (PL_delaymagic) {
+ PL_delaymagic |= DM_EGID;
break; /* don't do magic till later */
}
#ifdef HAS_SETEGID
- (void)setegid((Gid_t)egid);
+ (void)setegid((Gid_t)PL_egid);
#else
#ifdef HAS_SETREGID
(void)setregid((Gid_t)-1, (Gid_t)egid);
#endif
#endif
#endif
- egid = (I32)PerlProc_getegid();
- tainting |= (uid && (euid != uid || egid != gid));
+ PL_egid = (I32)PerlProc_getegid();
+ PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
break;
case ':':
- chopset = SvPV_force(sv,na);
+ PL_chopset = SvPV_force(sv,PL_na);
break;
case '0':
- if (!origalen) {
- s = origargv[0];
+ if (!PL_origalen) {
+ s = PL_origargv[0];
s += strlen(s);
/* See if all the arguments are contiguous in memory */
- for (i = 1; i < origargc; i++) {
- if (origargv[i] == s + 1
+ for (i = 1; i < PL_origargc; i++) {
+ if (PL_origargv[i] == s + 1
#ifdef OS2
|| origargv[i] == s + 2
#endif
break;
}
/* can grab env area too? */
- if (origenviron && (origenviron[0] == s + 1
+ if (PL_origenviron && (PL_origenviron[0] == s + 1
#ifdef OS2
|| (origenviron[0] == s + 9 && (s += 8))
#endif
)) {
my_setenv("NoNe SuCh", Nullch);
/* force copy of environment */
- for (i = 0; origenviron[i]; i++)
- if (origenviron[i] == s + 1)
+ for (i = 0; PL_origenviron[i]; i++)
+ if (PL_origenviron[i] == s + 1)
s += strlen(++s);
else
break;
}
- origalen = s - origargv[0];
+ PL_origalen = s - PL_origargv[0];
}
s = SvPV_force(sv,len);
i = len;
- if (i >= origalen) {
- i = origalen;
+ if (i >= PL_origalen) {
+ i = PL_origalen;
/* don't allow system to limit $0 seen by script */
/* SvCUR_set(sv, i); *SvEND(sv) = '\0'; */
- Copy(s, origargv[0], i, char);
- s = origargv[0]+i;
+ Copy(s, PL_origargv[0], i, char);
+ s = PL_origargv[0]+i;
*s = '\0';
}
else {
- Copy(s, origargv[0], i, char);
- s = origargv[0]+i;
+ Copy(s, PL_origargv[0], i, char);
+ s = PL_origargv[0]+i;
*s++ = '\0';
- while (++i < origalen)
+ while (++i < PL_origalen)
*s++ = ' ';
- s = origargv[0]+i;
- for (i = 1; i < origargc; i++)
- origargv[i] = Nullch;
+ s = PL_origargv[0]+i;
+ for (i = 1; i < PL_origargc; i++)
+ PL_origargv[i] = Nullch;
}
break;
#ifdef USE_THREADS
U32 flags = *(U32*)p;
if (flags & 1)
- savestack_ix -= 5; /* Unprotect save in progress. */
+ PL_savestack_ix -= 5; /* Unprotect save in progress. */
/* cxstack_ix-- Not needed, die already unwound it. */
if (flags & 64)
SvREFCNT_dec(sig_sv);
dSP;
GV *gv = Nullgv;
HV *st;
- SV *sv, *tSv = Sv;
+ SV *sv, *tSv = PL_Sv;
CV *cv = Nullcv;
OP *myop = op;
U32 flags = 0;
- I32 o_save_i = savestack_ix, type;
- XPV *tXpv = Xpv;
+ I32 o_save_i = PL_savestack_ix, type;
+ XPV *tXpv = PL_Xpv;
- if (savestack_ix + 15 <= savestack_max)
+ if (PL_savestack_ix + 15 <= PL_savestack_max)
flags |= 1;
- if (markstack_ptr < markstack_max - 2)
+ if (PL_markstack_ptr < PL_markstack_max - 2)
flags |= 4;
- if (retstack_ix < retstack_max - 2)
+ if (PL_retstack_ix < PL_retstack_max - 2)
flags |= 8;
- if (scopestack_ix < scopestack_max - 3)
+ if (PL_scopestack_ix < PL_scopestack_max - 3)
flags |= 16;
if (!psig_ptr[sig])
/* Max number of items pushed there is 3*n or 4. We cannot fix
infinity, so we fix 4 (in fact 5): */
if (flags & 1) {
- savestack_ix += 5; /* Protect save in progress. */
- o_save_i = savestack_ix;
+ PL_savestack_ix += 5; /* Protect save in progress. */
+ o_save_i = PL_savestack_ix;
SAVEDESTRUCTOR(unwind_handler_stack, (void*)&flags);
}
if (flags & 4)
- markstack_ptr++; /* Protect mark. */
+ PL_markstack_ptr++; /* Protect mark. */
if (flags & 8) {
- retstack_ix++;
- retstack[retstack_ix] = NULL;
+ PL_retstack_ix++;
+ PL_retstack[PL_retstack_ix] = NULL;
}
if (flags & 16)
- scopestack_ix += 1;
+ PL_scopestack_ix += 1;
/* sv_2cv is too complicated, try a simpler variant first: */
if (!SvROK(psig_ptr[sig]) || !(cv = (CV*)SvRV(psig_ptr[sig]))
|| SvTYPE(cv) != SVt_PVCV)
cv = sv_2cv(psig_ptr[sig],&st,&gv,TRUE);
if (!cv || !CvROOT(cv)) {
- if (dowarn)
+ if (PL_dowarn)
warn("SIG%s handler \"%s\" not defined.\n",
sig_name[sig], (gv ? GvENAME(gv)
: ((cv && CvGV(cv))
POPSTACK;
cleanup:
if (flags & 1)
- savestack_ix -= 8; /* Unprotect save in progress. */
+ PL_savestack_ix -= 8; /* Unprotect save in progress. */
if (flags & 4)
- markstack_ptr--;
+ PL_markstack_ptr--;
if (flags & 8)
- retstack_ix--;
+ PL_retstack_ix--;
if (flags & 16)
- scopestack_ix -= 1;
+ PL_scopestack_ix -= 1;
if (flags & 64)
SvREFCNT_dec(sv);
op = myop; /* Apparently not needed... */
- Sv = tSv; /* Restore global temporaries. */
- Xpv = tXpv;
+ PL_Sv = tSv; /* Restore global temporaries. */
+ PL_Xpv = tXpv;
return;
}
perl_init_i18nl10n(1);
- if (!do_undump) {
+ if (!PL_do_undump) {
my_perl = perl_alloc();
if (!my_perl)
exit(1);
perl_construct( my_perl );
- perl_destruct_level = 0;
+ PL_perl_destruct_level = 0;
}
exitstatus = perl_parse( my_perl, xs_init, argc, argv, (char **) NULL );
* think the expression is of the right type: croak actually does a Siglongjmp.
*/
#define CHECKOP(type,o) \
- ((op_mask && op_mask[type]) \
+ ((PL_op_mask && PL_op_mask[type]) \
? ( op_free((OP*)o), \
croak("%s trapped by operation mask", op_desc[type]), \
Nullop ) \
{
SV* tmpsv = sv_newmortal();
gv_efullname3(tmpsv, gv, Nullch);
- return SvPV(tmpsv,na);
+ return SvPV(tmpsv,PL_na);
}
STATIC OP *
SV *msg = sv_2mortal(
newSVpvf("(Did you mean $ or @ instead of %c?)\n",
type == OP_ENTERSUB ? '&' : '%'));
- if (in_eval & 2)
+ if (PL_in_eval & 2)
warn("%_", msg);
- else if (in_eval)
- sv_catsv(GvSV(errgv), msg);
+ else if (PL_in_eval)
+ sv_catsv(GvSV(PL_errgv), msg);
else
PerlIO_write(PerlIO_stderr(), SvPVX(msg), SvCUR(msg));
}
}
croak("Can't use global %s in \"my\"",name);
}
- if (dowarn && AvFILLp(comppad_name) >= 0) {
- SV **svp = AvARRAY(comppad_name);
- for (off = AvFILLp(comppad_name); off > comppad_name_floor; off--) {
+ if (PL_dowarn && AvFILLp(PL_comppad_name) >= 0) {
+ SV **svp = AvARRAY(PL_comppad_name);
+ for (off = AvFILLp(PL_comppad_name); off > PL_comppad_name_floor; off--) {
if ((sv = svp[off])
- && sv != &sv_undef
+ && sv != &PL_sv_undef
&& SvIVX(sv) == 999999999 /* var is in open scope */
&& strEQ(name, SvPVX(sv)))
{
sv = NEWSV(1102,0);
sv_upgrade(sv, SVt_PVNV);
sv_setpv(sv, name);
- if (in_my_stash) {
+ if (PL_in_my_stash) {
if (*name != '$')
croak("Can't declare class for non-scalar %s in \"my\"",name);
SvOBJECT_on(sv);
(void)SvUPGRADE(sv, SVt_PVMG);
- SvSTASH(sv) = (HV*)SvREFCNT_inc(in_my_stash);
- sv_objcount++;
+ SvSTASH(sv) = (HV*)SvREFCNT_inc(PL_in_my_stash);
+ PL_sv_objcount++;
}
- av_store(comppad_name, off, sv);
+ av_store(PL_comppad_name, off, sv);
SvNVX(sv) = (double)999999999;
SvIVX(sv) = 0; /* Not yet introduced--see newSTATEOP */
- if (!min_intro_pending)
- min_intro_pending = off;
- max_intro_pending = off;
+ if (!PL_min_intro_pending)
+ PL_min_intro_pending = off;
+ PL_max_intro_pending = off;
if (*name == '@')
- av_store(comppad, off, (SV*)newAV());
+ av_store(PL_comppad, off, (SV*)newAV());
else if (*name == '%')
- av_store(comppad, off, (SV*)newHV());
- SvPADMY_on(curpad[off]);
+ av_store(PL_comppad, off, (SV*)newHV());
+ SvPADMY_on(PL_curpad[off]);
return off;
}
SV **svp = av_fetch(curlist, 0, FALSE);
AV *curname;
- if (!svp || *svp == &sv_undef)
+ if (!svp || *svp == &PL_sv_undef)
continue;
curname = (AV*)*svp;
svp = AvARRAY(curname);
for (off = AvFILLp(curname); off > 0; off--) {
if ((sv = svp[off]) &&
- sv != &sv_undef &&
+ sv != &PL_sv_undef &&
seq <= SvIVX(sv) &&
seq > I_32(SvNVX(sv)) &&
strEQ(SvPVX(sv), name))
newoff = pad_alloc(OP_PADSV, SVs_PADMY);
sv_upgrade(namesv, SVt_PVNV);
sv_setpv(namesv, name);
- av_store(comppad_name, newoff, namesv);
- SvNVX(namesv) = (double)curcop->cop_seq;
+ av_store(PL_comppad_name, newoff, namesv);
+ SvNVX(namesv) = (double)PL_curcop->cop_seq;
SvIVX(namesv) = 999999999; /* A ref, intro immediately */
SvFAKE_on(namesv); /* A ref, not a real var */
- if (CvANON(compcv) || SvTYPE(compcv) == SVt_PVFM) {
+ if (CvANON(PL_compcv) || SvTYPE(PL_compcv) == SVt_PVFM) {
/* "It's closures all the way down." */
- CvCLONE_on(compcv);
+ CvCLONE_on(PL_compcv);
if (cv == startcv) {
- if (CvANON(compcv))
+ if (CvANON(PL_compcv))
oldsv = Nullsv; /* no need to keep ref */
}
else {
if (CvANON(bcv))
CvCLONE_on(bcv);
else {
- if (dowarn && !CvUNIQUE(cv))
+ if (PL_dowarn && !CvUNIQUE(cv))
warn(
"Variable \"%s\" may be unavailable",
name);
}
}
}
- else if (!CvUNIQUE(compcv)) {
- if (dowarn && !SvFAKE(sv) && !CvUNIQUE(cv))
+ else if (!CvUNIQUE(PL_compcv)) {
+ if (PL_dowarn && !SvFAKE(sv) && !CvUNIQUE(cv))
warn("Variable \"%s\" will not stay shared", name);
}
}
- av_store(comppad, newoff, SvREFCNT_inc(oldsv));
+ av_store(PL_comppad, newoff, SvREFCNT_inc(oldsv));
return newoff;
}
}
default:
if (i == 0 && saweval) {
seq = cxstack[saweval].blk_oldcop->cop_seq;
- return pad_findlex(name, newoff, seq, main_cv, 0);
+ return pad_findlex(name, newoff, seq, PL_main_cv, 0);
}
break;
case CXt_EVAL:
if (!saweval)
return 0;
cv = cx->blk_sub.cv;
- if (debstash && CvSTASH(cv) == debstash) { /* ignore DB'* scope */
+ if (PL_debstash && CvSTASH(cv) == PL_debstash) { /* ignore DB'* scope */
saweval = i; /* so we know where we were called from */
continue;
}
I32 off;
I32 pendoff = 0;
SV *sv;
- SV **svp = AvARRAY(comppad_name);
- U32 seq = cop_seqmax;
+ SV **svp = AvARRAY(PL_comppad_name);
+ U32 seq = PL_cop_seqmax;
#ifdef USE_THREADS
/*
#endif /* USE_THREADS */
/* The one we're looking for is probably just before comppad_name_fill. */
- for (off = AvFILLp(comppad_name); off > 0; off--) {
+ for (off = AvFILLp(PL_comppad_name); off > 0; off--) {
if ((sv = svp[off]) &&
- sv != &sv_undef &&
+ sv != &PL_sv_undef &&
(!SvIVX(sv) ||
(seq <= SvIVX(sv) &&
seq > I_32(SvNVX(sv)))) &&
}
/* See if it's in a nested scope */
- off = pad_findlex(name, 0, seq, CvOUTSIDE(compcv), cxstack_ix);
+ off = pad_findlex(name, 0, seq, CvOUTSIDE(PL_compcv), cxstack_ix);
if (off) {
/* If there is a pending local definition, this new alias must die */
if (pendoff)
- SvIVX(AvARRAY(comppad_name)[off]) = seq;
+ SvIVX(AvARRAY(PL_comppad_name)[off]) = seq;
return off; /* pad_findlex returns 0 for failure...*/
}
return NOT_IN_PAD; /* ...but we return NOT_IN_PAD for failure */
pad_leavemy(I32 fill)
{
I32 off;
- SV **svp = AvARRAY(comppad_name);
+ SV **svp = AvARRAY(PL_comppad_name);
SV *sv;
- if (min_intro_pending && fill < min_intro_pending) {
- for (off = max_intro_pending; off >= min_intro_pending; off--) {
- if ((sv = svp[off]) && sv != &sv_undef)
+ if (PL_min_intro_pending && fill < PL_min_intro_pending) {
+ for (off = PL_max_intro_pending; off >= PL_min_intro_pending; off--) {
+ if ((sv = svp[off]) && sv != &PL_sv_undef)
warn("%s never introduced", SvPVX(sv));
}
}
/* "Deintroduce" my variables that are leaving with this scope. */
- for (off = AvFILLp(comppad_name); off > fill; off--) {
- if ((sv = svp[off]) && sv != &sv_undef && SvIVX(sv) == 999999999)
- SvIVX(sv) = cop_seqmax;
+ for (off = AvFILLp(PL_comppad_name); off > fill; off--) {
+ if ((sv = svp[off]) && sv != &PL_sv_undef && SvIVX(sv) == 999999999)
+ SvIVX(sv) = PL_cop_seqmax;
}
}
SV *sv;
I32 retval;
- if (AvARRAY(comppad) != curpad)
+ if (AvARRAY(PL_comppad) != PL_curpad)
croak("panic: pad_alloc");
- if (pad_reset_pending)
+ if (PL_pad_reset_pending)
pad_reset();
if (tmptype & SVs_PADMY) {
do {
- sv = *av_fetch(comppad, AvFILLp(comppad) + 1, TRUE);
+ sv = *av_fetch(PL_comppad, AvFILLp(PL_comppad) + 1, TRUE);
} while (SvPADBUSY(sv)); /* need a fresh one */
- retval = AvFILLp(comppad);
+ retval = AvFILLp(PL_comppad);
}
else {
- SV **names = AvARRAY(comppad_name);
- SSize_t names_fill = AvFILLp(comppad_name);
+ SV **names = AvARRAY(PL_comppad_name);
+ SSize_t names_fill = AvFILLp(PL_comppad_name);
for (;;) {
/*
* "foreach" index vars temporarily become aliases to non-"my"
* values. Thus we must skip, not just pad values that are
* marked as current pad values, but also those with names.
*/
- if (++padix <= names_fill &&
- (sv = names[padix]) && sv != &sv_undef)
+ if (++PL_padix <= names_fill &&
+ (sv = names[PL_padix]) && sv != &PL_sv_undef)
continue;
- sv = *av_fetch(comppad, padix, TRUE);
+ sv = *av_fetch(PL_comppad, PL_padix, TRUE);
if (!(SvFLAGS(sv) & (SVs_PADTMP|SVs_PADMY)))
break;
}
- retval = padix;
+ retval = PL_padix;
}
SvFLAGS(sv) |= tmptype;
- curpad = AvARRAY(comppad);
+ PL_curpad = AvARRAY(PL_comppad);
#ifdef USE_THREADS
DEBUG_X(PerlIO_printf(Perl_debug_log, "0x%lx Pad 0x%lx alloc %ld for %s\n",
(unsigned long) thr, (unsigned long) curpad,
(long) retval, op_name[optype]));
#else
DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad 0x%lx alloc %ld for %s\n",
- (unsigned long) curpad,
+ (unsigned long) PL_curpad,
(long) retval, op_name[optype]));
#endif /* USE_THREADS */
return (PADOFFSET)retval;
if (!po)
croak("panic: pad_sv po");
DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad 0x%lx sv %d\n",
- (unsigned long) curpad, po));
+ (unsigned long) PL_curpad, po));
#endif /* USE_THREADS */
- return curpad[po]; /* eventually we'll turn this into a macro */
+ return PL_curpad[po]; /* eventually we'll turn this into a macro */
}
void
pad_free(PADOFFSET po)
{
dTHR;
- if (!curpad)
+ if (!PL_curpad)
return;
- if (AvARRAY(comppad) != curpad)
+ if (AvARRAY(PL_comppad) != PL_curpad)
croak("panic: pad_free curpad");
if (!po)
croak("panic: pad_free po");
(unsigned long) thr, (unsigned long) curpad, po));
#else
DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad 0x%lx free %d\n",
- (unsigned long) curpad, po));
+ (unsigned long) PL_curpad, po));
#endif /* USE_THREADS */
- if (curpad[po] && curpad[po] != &sv_undef)
- SvPADTMP_off(curpad[po]);
- if ((I32)po < padix)
- padix = po - 1;
+ if (PL_curpad[po] && PL_curpad[po] != &PL_sv_undef)
+ SvPADTMP_off(PL_curpad[po]);
+ if ((I32)po < PL_padix)
+ PL_padix = po - 1;
}
void
pad_swipe(PADOFFSET po)
{
dTHR;
- if (AvARRAY(comppad) != curpad)
+ if (AvARRAY(PL_comppad) != PL_curpad)
croak("panic: pad_swipe curpad");
if (!po)
croak("panic: pad_swipe po");
(unsigned long) thr, (unsigned long) curpad, po));
#else
DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad 0x%lx swipe %d\n",
- (unsigned long) curpad, po));
+ (unsigned long) PL_curpad, po));
#endif /* USE_THREADS */
- SvPADTMP_off(curpad[po]);
- curpad[po] = NEWSV(1107,0);
- SvPADTMP_on(curpad[po]);
- if ((I32)po < padix)
- padix = po - 1;
+ SvPADTMP_off(PL_curpad[po]);
+ PL_curpad[po] = NEWSV(1107,0);
+ SvPADTMP_on(PL_curpad[po]);
+ if ((I32)po < PL_padix)
+ PL_padix = po - 1;
}
/* XXX pad_reset() is currently disabled because it results in serious bugs.
padix = padix_floor;
}
#endif
- pad_reset_pending = FALSE;
+ PL_pad_reset_pending = FALSE;
}
#ifdef USE_THREADS
STATIC OP *
scalarboolean(OP *o)
{
- if (dowarn &&
+ if (PL_dowarn &&
o->op_type == OP_SASSIGN && cBINOPo->op_first->op_type == OP_CONST) {
dTHR;
- line_t oldline = curcop->cop_line;
+ line_t oldline = PL_curcop->cop_line;
- if (copline != NOLINE)
- curcop->cop_line = copline;
+ if (PL_copline != NOLINE)
+ PL_curcop->cop_line = PL_copline;
warn("Found = in conditional, should be ==");
- curcop->cop_line = oldline;
+ PL_curcop->cop_line = oldline;
}
return scalar(o);
}
OP *kid;
/* assumes no premature commitment */
- if (!o || (o->op_flags & OPf_WANT) || error_count
+ if (!o || (o->op_flags & OPf_WANT) || PL_error_count
|| o->op_type == OP_RETURN)
return o;
else
scalar(kid);
}
- WITH_THR(curcop = &compiling);
+ WITH_THR(PL_curcop = &PL_compiling);
break;
case OP_SCOPE:
case OP_LINESEQ:
else
scalar(kid);
}
- WITH_THR(curcop = &compiling);
+ WITH_THR(PL_curcop = &PL_compiling);
break;
}
return o;
SV* sv;
/* assumes no premature commitment */
- if (!o || (o->op_flags & OPf_WANT) == OPf_WANT_LIST || error_count
+ if (!o || (o->op_flags & OPf_WANT) == OPf_WANT_LIST || PL_error_count
|| o->op_type == OP_RETURN)
return o;
case OP_NEXTSTATE:
case OP_DBSTATE:
- WITH_THR(curcop = ((COP*)o)); /* for warning below */
+ WITH_THR(PL_curcop = ((COP*)o)); /* for warning below */
break;
case OP_CONST:
sv = cSVOPo->op_sv;
- if (dowarn) {
+ if (PL_dowarn) {
useless = "a constant";
if (SvNIOK(sv) && (SvNV(sv) == 0.0 || SvNV(sv) == 1.0))
useless = 0;
case OP_NULL:
if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
- WITH_THR(curcop = ((COP*)o)); /* for warning below */
+ WITH_THR(PL_curcop = ((COP*)o)); /* for warning below */
if (o->op_flags & OPf_STACKED)
break;
/* FALL THROUGH */
}
break;
}
- if (useless && dowarn)
+ if (useless && PL_dowarn)
warn("Useless use of %s in void context", useless);
return o;
}
OP *kid;
/* assumes no premature commitment */
- if (!o || (o->op_flags & OPf_WANT) || error_count
+ if (!o || (o->op_flags & OPf_WANT) || PL_error_count
|| o->op_type == OP_RETURN)
return o;
else
list(kid);
}
- WITH_THR(curcop = &compiling);
+ WITH_THR(PL_curcop = &PL_compiling);
break;
case OP_SCOPE:
case OP_LINESEQ:
else
list(kid);
}
- WITH_THR(curcop = &compiling);
+ WITH_THR(PL_curcop = &PL_compiling);
break;
case OP_REQUIRE:
/* all requires must return a boolean value */
scalarvoid(kid);
}
}
- curcop = &compiling;
+ PL_curcop = &PL_compiling;
}
o->op_flags &= ~OPf_PARENS;
- if (hints & HINT_BLOCK_SCOPE)
+ if (PL_hints & HINT_BLOCK_SCOPE)
o->op_flags |= OPf_PARENS;
}
else
OP *kid;
SV *sv;
- if (!o || error_count)
+ if (!o || PL_error_count)
return o;
switch (o->op_type) {
case OP_UNDEF:
- modcount++;
+ PL_modcount++;
return o;
case OP_CONST:
if (!(o->op_private & (OPpCONST_ARYBASE)))
goto nomod;
- if (eval_start && eval_start->op_type == OP_CONST) {
- compiling.cop_arybase = (I32)SvIV(((SVOP*)eval_start)->op_sv);
- eval_start = 0;
+ if (PL_eval_start && PL_eval_start->op_type == OP_CONST) {
+ PL_compiling.cop_arybase = (I32)SvIV(((SVOP*)PL_eval_start)->op_sv);
+ PL_eval_start = 0;
}
else if (!type) {
- SAVEI32(compiling.cop_arybase);
- compiling.cop_arybase = 0;
+ SAVEI32(PL_compiling.cop_arybase);
+ PL_compiling.cop_arybase = 0;
}
else if (type == OP_REFGEN)
goto nomod;
case OP_I_SUBTRACT:
if (!(o->op_flags & OPf_STACKED))
goto nomod;
- modcount++;
+ PL_modcount++;
break;
case OP_COND_EXPR:
if (!type && cUNOPo->op_first->op_type != OP_GV)
croak("Can't localize through a reference");
if (type == OP_REFGEN && o->op_flags & OPf_PARENS) {
- modcount = 10000;
+ PL_modcount = 10000;
return o; /* Treat \(@foo) like ordinary list. */
}
/* FALL THROUGH */
case OP_DBSTATE:
case OP_REFGEN:
case OP_CHOMP:
- modcount = 10000;
+ PL_modcount = 10000;
break;
case OP_RV2SV:
if (!type && cUNOPo->op_first->op_type != OP_GV)
/* FALL THROUGH */
case OP_GV:
case OP_AV2ARYLEN:
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
case OP_SASSIGN:
case OP_AELEMFAST:
- modcount++;
+ PL_modcount++;
break;
case OP_PADAV:
case OP_PADHV:
- modcount = 10000;
+ PL_modcount = 10000;
if (type == OP_REFGEN && o->op_flags & OPf_PARENS)
return o; /* Treat \(@foo) like ordinary list. */
if (scalar_mod_type(o, type))
goto nomod;
/* FALL THROUGH */
case OP_PADSV:
- modcount++;
+ PL_modcount++;
if (!type)
croak("Can't localize lexical variable %s",
- SvPV(*av_fetch(comppad_name, o->op_targ, 4), na));
+ SvPV(*av_fetch(PL_comppad_name, o->op_targ, 4), PL_na));
break;
#ifdef USE_THREADS
if (type == OP_ENTERSUB &&
!(o->op_private & (OPpLVAL_INTRO | OPpDEREF)))
o->op_private |= OPpLVAL_DEFER;
- modcount++;
+ PL_modcount++;
break;
case OP_SCOPE:
else if (!type) {
o->op_private |= OPpLVAL_INTRO;
o->op_flags &= ~OPf_SPECIAL;
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
}
else if (type != OP_GREPSTART && type != OP_ENTERSUB)
o->op_flags |= OPf_REF;
{
OP *kid;
- if (!o || error_count)
+ if (!o || PL_error_count)
return o;
switch (o->op_type) {
OP *kid;
I32 type;
- if (!o || error_count)
+ if (!o || PL_error_count)
return o;
type = o->op_type;
{
OP *o;
- if (dowarn &&
+ if (PL_dowarn &&
(left->op_type == OP_RV2AV ||
left->op_type == OP_RV2HV ||
left->op_type == OP_PADAV ||
scope(OP *o)
{
if (o) {
- if (o->op_flags & OPf_PARENS || PERLDB_NOOPT || tainting) {
+ if (o->op_flags & OPf_PARENS || PERLDB_NOOPT || PL_tainting) {
o = prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), o);
o->op_type = OP_LEAVE;
o->op_ppaddr = ppaddr[OP_LEAVE];
void
save_hints(void)
{
- SAVEI32(hints);
- SAVESPTR(GvHV(hintgv));
- GvHV(hintgv) = newHVhv(GvHV(hintgv));
- SAVEFREESV(GvHV(hintgv));
+ SAVEI32(PL_hints);
+ SAVESPTR(GvHV(PL_hintgv));
+ GvHV(PL_hintgv) = newHVhv(GvHV(PL_hintgv));
+ SAVEFREESV(GvHV(PL_hintgv));
}
int
block_start(int full)
{
dTHR;
- int retval = savestack_ix;
+ int retval = PL_savestack_ix;
- SAVEI32(comppad_name_floor);
+ SAVEI32(PL_comppad_name_floor);
if (full) {
- if ((comppad_name_fill = AvFILLp(comppad_name)) > 0)
- comppad_name_floor = comppad_name_fill;
+ if ((PL_comppad_name_fill = AvFILLp(PL_comppad_name)) > 0)
+ PL_comppad_name_floor = PL_comppad_name_fill;
else
- comppad_name_floor = 0;
- }
- SAVEI32(min_intro_pending);
- SAVEI32(max_intro_pending);
- min_intro_pending = 0;
- SAVEI32(comppad_name_fill);
- SAVEI32(padix_floor);
- padix_floor = padix;
- pad_reset_pending = FALSE;
+ PL_comppad_name_floor = 0;
+ }
+ SAVEI32(PL_min_intro_pending);
+ SAVEI32(PL_max_intro_pending);
+ PL_min_intro_pending = 0;
+ SAVEI32(PL_comppad_name_fill);
+ SAVEI32(PL_padix_floor);
+ PL_padix_floor = PL_padix;
+ PL_pad_reset_pending = FALSE;
SAVEHINTS();
- hints &= ~HINT_BLOCK_SCOPE;
+ PL_hints &= ~HINT_BLOCK_SCOPE;
return retval;
}
block_end(I32 floor, OP *seq)
{
dTHR;
- int needblockscope = hints & HINT_BLOCK_SCOPE;
+ int needblockscope = PL_hints & HINT_BLOCK_SCOPE;
OP* retval = scalarseq(seq);
LEAVE_SCOPE(floor);
- pad_reset_pending = FALSE;
+ PL_pad_reset_pending = FALSE;
if (needblockscope)
- hints |= HINT_BLOCK_SCOPE; /* propagate out */
- pad_leavemy(comppad_name_fill);
- cop_seqmax++;
+ PL_hints |= HINT_BLOCK_SCOPE; /* propagate out */
+ pad_leavemy(PL_comppad_name_fill);
+ PL_cop_seqmax++;
return retval;
}
o->op_targ = find_threadsv("_");
return o;
#else
- return newSVREF(newGVOP(OP_GV, 0, defgv));
+ return newSVREF(newGVOP(OP_GV, 0, PL_defgv));
#endif /* USE_THREADS */
}
newPROG(OP *o)
{
dTHR;
- if (in_eval) {
- eval_root = newUNOP(OP_LEAVEEVAL, ((in_eval & 4) ? OPf_SPECIAL : 0), o);
- eval_start = linklist(eval_root);
- eval_root->op_next = 0;
- peep(eval_start);
+ if (PL_in_eval) {
+ PL_eval_root = newUNOP(OP_LEAVEEVAL, ((PL_in_eval & 4) ? OPf_SPECIAL : 0), o);
+ PL_eval_start = linklist(PL_eval_root);
+ PL_eval_root->op_next = 0;
+ peep(PL_eval_start);
}
else {
if (!o)
return;
- main_root = scope(sawparens(scalarvoid(o)));
- curcop = &compiling;
- main_start = LINKLIST(main_root);
- main_root->op_next = 0;
- peep(main_start);
- compcv = 0;
+ PL_main_root = scope(sawparens(scalarvoid(o)));
+ PL_curcop = &PL_compiling;
+ PL_main_start = LINKLIST(PL_main_root);
+ PL_main_root->op_next = 0;
+ peep(PL_main_start);
+ PL_compcv = 0;
/* Register with debugger */
if (PERLDB_INTER) {
if (cv) {
dSP;
PUSHMARK(SP);
- XPUSHs((SV*)compiling.cop_filegv);
+ XPUSHs((SV*)PL_compiling.cop_filegv);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
}
if (o->op_flags & OPf_PARENS)
list(o);
else {
- if (dowarn && bufptr > oldbufptr && bufptr[-1] == ',') {
+ if (PL_dowarn && PL_bufptr > PL_oldbufptr && PL_bufptr[-1] == ',') {
char *s;
- for (s = bufptr; *s && (isALNUM(*s) || strchr("@$%, ",*s)); s++) ;
+ for (s = PL_bufptr; *s && (isALNUM(*s) || strchr("@$%, ",*s)); s++) ;
if (*s == ';' || *s == '=')
warn("Parens missing around \"%s\" list", lex ? "my" : "local");
}
}
- in_my = FALSE;
- in_my_stash = Nullhv;
+ PL_in_my = FALSE;
+ PL_in_my_stash = Nullhv;
if (lex)
return my(o);
else
if (opargs[type] & OA_TARGET)
o->op_targ = pad_alloc(type, SVs_PADTMP);
- if ((opargs[type] & OA_OTHERINT) && (hints & HINT_INTEGER))
+ if ((opargs[type] & OA_OTHERINT) && (PL_hints & HINT_INTEGER))
o->op_ppaddr = ppaddr[type = ++(o->op_type)];
if (!(opargs[type] & OA_FOLDCONST))
goto nope;
}
- if (error_count)
+ if (PL_error_count)
goto nope; /* Don't try to run w/ errors */
for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
o->op_next = 0;
op = curop;
CALLRUNOPS();
- sv = *(stack_sp--);
+ sv = *(PL_stack_sp--);
if (o->op_targ && sv == PAD_SV(o->op_targ)) /* grab pad temp? */
pad_swipe(o->op_targ);
else if (SvTEMP(sv)) { /* grab mortal temp? */
if (!(opargs[type] & OA_OTHERINT))
return o;
- if (!(hints & HINT_INTEGER)) {
+ if (!(PL_hints & HINT_INTEGER)) {
if (type == OP_DIVIDE || !(o->op_flags & OPf_KIDS))
return o;
{
dTHR;
register OP *curop;
- I32 oldtmps_floor = tmps_floor;
+ I32 oldtmps_floor = PL_tmps_floor;
list(o);
- if (error_count)
+ if (PL_error_count)
return o; /* Don't attempt to run with errors */
op = curop = LINKLIST(o);
CALLRUNOPS();
op = curop;
pp_anonlist(ARGS);
- tmps_floor = oldtmps_floor;
+ PL_tmps_floor = oldtmps_floor;
o->op_type = OP_RV2AV;
o->op_ppaddr = ppaddr[OP_RV2AV];
curop = ((UNOP*)o)->op_first;
- ((UNOP*)o)->op_first = newSVOP(OP_CONST, 0, SvREFCNT_inc(*stack_sp--));
+ ((UNOP*)o)->op_first = newSVOP(OP_CONST, 0, SvREFCNT_inc(*PL_stack_sp--));
op_free(curop);
linklist(o);
return list(o);
pmop->op_flags = flags;
pmop->op_private = 0 | (flags >> 8);
- if (hints & HINT_RE_TAINT)
+ if (PL_hints & HINT_RE_TAINT)
pmop->op_pmpermflags |= PMf_RETAINT;
- if (hints & HINT_LOCALE)
+ if (PL_hints & HINT_LOCALE)
pmop->op_pmpermflags |= PMf_LOCALE;
pmop->op_pmflags = pmop->op_pmpermflags;
/* link into pm list */
- if (type != OP_TRANS && curstash) {
- pmop->op_pmnext = HvPMROOT(curstash);
- HvPMROOT(curstash) = pmop;
+ if (type != OP_TRANS && PL_curstash) {
+ pmop->op_pmnext = HvPMROOT(PL_curstash);
+ HvPMROOT(PL_curstash) = pmop;
}
return (OP*)pmop;
if (o->op_type == OP_TRANS)
return pmtrans(o, expr, repl);
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
pm = (PMOP*)o;
if (expr->op_type == OP_CONST) {
op_free(expr);
}
else {
- if (pm->op_pmflags & PMf_KEEP || !(hints & HINT_RE_EVAL))
- expr = newUNOP((!(hints & HINT_RE_EVAL)
+ if (pm->op_pmflags & PMf_KEEP || !(PL_hints & HINT_RE_EVAL))
+ expr = newUNOP((!(PL_hints & HINT_RE_EVAL)
? OP_REGCRESET
: OP_REGCMAYBE),0,expr);
rcop->op_type = OP_REGCOMP;
rcop->op_ppaddr = ppaddr[OP_REGCOMP];
rcop->op_first = scalar(expr);
- rcop->op_flags |= ((hints & HINT_RE_EVAL)
+ rcop->op_flags |= ((PL_hints & HINT_RE_EVAL)
? (OPf_SPECIAL | OPf_KIDS)
: OPf_KIDS);
rcop->op_private = 1;
rcop->op_other = o;
/* establish postfix order */
- if (pm->op_pmflags & PMf_KEEP || !(hints & HINT_RE_EVAL)) {
+ if (pm->op_pmflags & PMf_KEEP || !(PL_hints & HINT_RE_EVAL)) {
LINKLIST(expr);
rcop->op_next = expr;
((UNOP*)expr)->op_first->op_next = (OP*)rcop;
dTHR;
SV *sv;
- save_hptr(&curstash);
- save_item(curstname);
+ save_hptr(&PL_curstash);
+ save_item(PL_curstname);
if (o) {
STRLEN len;
char *name;
sv = cSVOPo->op_sv;
name = SvPV(sv, len);
- curstash = gv_stashpvn(name,len,TRUE);
- sv_setpvn(curstname, name, len);
+ PL_curstash = gv_stashpvn(name,len,TRUE);
+ sv_setpvn(PL_curstname, name, len);
op_free(o);
}
else {
- sv_setpv(curstname,"<none>");
- curstash = Nullhv;
+ sv_setpv(PL_curstname,"<none>");
+ PL_curstash = Nullhv;
}
- copline = NOLINE;
- expect = XSTATE;
+ PL_copline = NOLINE;
+ PL_expect = XSTATE;
}
void
newSTATEOP(0, Nullch, veop)),
newSTATEOP(0, Nullch, imop) ));
- copline = NOLINE;
- expect = XSTATE;
+ PL_copline = NOLINE;
+ PL_expect = XSTATE;
}
OP *
if (list_assignment(left)) {
dTHR;
- modcount = 0;
- eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
+ PL_modcount = 0;
+ PL_eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
left = mod(left, OP_AASSIGN);
- if (eval_start)
- eval_start = 0;
+ if (PL_eval_start)
+ PL_eval_start = 0;
else {
op_free(left);
op_free(right);
if (!(left->op_private & OPpLVAL_INTRO)) {
OP *curop;
OP *lastop = o;
- generation++;
+ PL_generation++;
for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
if (opargs[curop->op_type] & OA_DANGEROUS) {
if (curop->op_type == OP_GV) {
GV *gv = ((GVOP*)curop)->op_gv;
- if (gv == defgv || SvCUR(gv) == generation)
+ if (gv == PL_defgv || SvCUR(gv) == PL_generation)
break;
- SvCUR(gv) = generation;
+ SvCUR(gv) = PL_generation;
}
else if (curop->op_type == OP_PADSV ||
curop->op_type == OP_PADAV ||
curop->op_type == OP_PADHV ||
curop->op_type == OP_PADANY) {
- SV **svp = AvARRAY(comppad_name);
+ SV **svp = AvARRAY(PL_comppad_name);
SV *sv = svp[curop->op_targ];
- if (SvCUR(sv) == generation)
+ if (SvCUR(sv) == PL_generation)
break;
- SvCUR(sv) = generation; /* (SvCUR not used any more) */
+ SvCUR(sv) = PL_generation; /* (SvCUR not used any more) */
}
else if (curop->op_type == OP_RV2CV)
break;
else if (curop->op_type == OP_PUSHRE) {
if (((PMOP*)curop)->op_pmreplroot) {
GV *gv = (GV*)((PMOP*)curop)->op_pmreplroot;
- if (gv == defgv || SvCUR(gv) == generation)
+ if (gv == PL_defgv || SvCUR(gv) == PL_generation)
break;
- SvCUR(gv) = generation;
+ SvCUR(gv) = PL_generation;
}
}
else
}
}
else {
- if (modcount < 10000 &&
+ if (PL_modcount < 10000 &&
((LISTOP*)right)->op_last->op_type == OP_CONST)
{
SV *sv = ((SVOP*)((LISTOP*)right)->op_last)->op_sv;
if (SvIVX(sv) == 0)
- sv_setiv(sv, modcount+1);
+ sv_setiv(sv, PL_modcount+1);
}
}
}
return newBINOP(OP_NULL, flags, mod(scalar(left), OP_SASSIGN), scalar(right));
}
else {
- eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
+ PL_eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
o = newBINOP(OP_SASSIGN, flags,
scalar(right), mod(scalar(left), OP_SASSIGN) );
- if (eval_start)
- eval_start = 0;
+ if (PL_eval_start)
+ PL_eval_start = 0;
else {
op_free(o);
return Nullop;
register COP *cop;
Newz(1101, cop, 1, COP);
- if (PERLDB_LINE && curcop->cop_line && curstash != debstash) {
+ if (PERLDB_LINE && PL_curcop->cop_line && PL_curstash != PL_debstash) {
cop->op_type = OP_DBSTATE;
cop->op_ppaddr = ppaddr[ OP_DBSTATE ];
}
if (label) {
cop->cop_label = label;
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
}
cop->cop_seq = seq;
- cop->cop_arybase = curcop->cop_arybase;
+ cop->cop_arybase = PL_curcop->cop_arybase;
- if (copline == NOLINE)
- cop->cop_line = curcop->cop_line;
+ if (PL_copline == NOLINE)
+ cop->cop_line = PL_curcop->cop_line;
else {
- cop->cop_line = copline;
- copline = NOLINE;
+ cop->cop_line = PL_copline;
+ PL_copline = NOLINE;
}
- cop->cop_filegv = (GV*)SvREFCNT_inc(curcop->cop_filegv);
- cop->cop_stash = curstash;
+ cop->cop_filegv = (GV*)SvREFCNT_inc(PL_curcop->cop_filegv);
+ cop->cop_stash = PL_curstash;
- if (PERLDB_LINE && curstash != debstash) {
- SV **svp = av_fetch(GvAV(curcop->cop_filegv),(I32)cop->cop_line, FALSE);
- if (svp && *svp != &sv_undef && !SvIOK(*svp)) {
+ if (PERLDB_LINE && PL_curstash != PL_debstash) {
+ SV **svp = av_fetch(GvAV(PL_curcop->cop_filegv),(I32)cop->cop_line, FALSE);
+ if (svp && *svp != &PL_sv_undef && !SvIOK(*svp)) {
(void)SvIOK_on(*svp);
SvIVX(*svp) = 1;
SvSTASH(*svp) = (HV*)cop;
SV *sv;
I32 i;
- if (! min_intro_pending)
- return cop_seqmax;
+ if (! PL_min_intro_pending)
+ return PL_cop_seqmax;
- svp = AvARRAY(comppad_name);
- for (i = min_intro_pending; i <= max_intro_pending; i++) {
- if ((sv = svp[i]) && sv != &sv_undef && !SvIVX(sv)) {
+ svp = AvARRAY(PL_comppad_name);
+ for (i = PL_min_intro_pending; i <= PL_max_intro_pending; i++) {
+ if ((sv = svp[i]) && sv != &PL_sv_undef && !SvIVX(sv)) {
SvIVX(sv) = 999999999; /* Don't know scope end yet. */
- SvNVX(sv) = (double)cop_seqmax;
+ SvNVX(sv) = (double)PL_cop_seqmax;
}
}
- min_intro_pending = 0;
- comppad_name_fill = max_intro_pending; /* Needn't search higher */
- return cop_seqmax++;
+ PL_min_intro_pending = 0;
+ PL_comppad_name_fill = PL_max_intro_pending; /* Needn't search higher */
+ return PL_cop_seqmax++;
}
OP *
}
}
if (first->op_type == OP_CONST) {
- if (dowarn && (first->op_private & OPpCONST_BARE))
+ if (PL_dowarn && (first->op_private & OPpCONST_BARE))
warn("Probable precedence problem on %s", op_desc[type]);
if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) {
op_free(first);
else
scalar(other);
}
- else if (dowarn && (first->op_flags & OPf_KIDS)) {
+ else if (PL_dowarn && (first->op_flags & OPf_KIDS)) {
OP *k1 = ((UNOP*)first)->op_first;
OP *k2 = k1->op_sibling;
OPCODE warnop = 0;
break;
}
if (warnop) {
- line_t oldline = curcop->cop_line;
- curcop->cop_line = copline;
+ line_t oldline = PL_curcop->cop_line;
+ PL_curcop->cop_line = PL_copline;
warn("Value of %s%s can be \"0\"; test with defined()",
op_desc[warnop],
((warnop == OP_READLINE || warnop == OP_GLOB)
? " construct" : "() operator"));
- curcop->cop_line = oldline;
+ PL_curcop->cop_line = oldline;
}
}
if (expr) {
cont = append_elem(OP_LINESEQ, cont, newOP(OP_UNSTACK, 0));
if ((line_t)whileline != NOLINE) {
- copline = whileline;
+ PL_copline = whileline;
cont = append_elem(OP_LINESEQ, cont,
newSTATEOP(0, Nullch, Nullop));
}
redo = LINKLIST(listop);
if (expr) {
- copline = whileline;
+ PL_copline = whileline;
scalar(listop);
o = new_logop(OP_AND, 0, &expr, &listop);
if (o == expr && o->op_type == OP_CONST && !SvTRUE(cSVOPo->op_sv)) {
padoff = find_threadsv("_");
iterflags |= OPf_SPECIAL;
#else
- sv = newGVOP(OP_GV, 0, defgv);
+ sv = newGVOP(OP_GV, 0, PL_defgv);
#endif
}
if (expr->op_type == OP_RV2AV || expr->op_type == OP_PADAV) {
Renew(loop, 1, LOOP);
loop->op_targ = padoff;
wop = newWHILEOP(flags, 1, loop, forline, newOP(OP_ITER, 0), block, cont);
- copline = forline;
+ PL_copline = forline;
return newSTATEOP(0, label, wop);
}
o = newOP(type, OPf_SPECIAL);
else {
o = newPVOP(type, 0, savepv(label->op_type == OP_CONST
- ? SvPVx(((SVOP*)label)->op_sv, na)
+ ? SvPVx(((SVOP*)label)->op_sv, PL_na)
: ""));
}
op_free(label);
label = newUNOP(OP_REFGEN, 0, mod(label, OP_REFGEN));
o = newUNOP(type, OPf_STACKED, label);
}
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
return o;
}
#endif /* USE_THREADS */
ENTER;
- SAVESPTR(curpad);
- curpad = 0;
+ SAVESPTR(PL_curpad);
+ PL_curpad = 0;
if (!CvCLONED(cv))
op_free(CvROOT(cv));
SV* sv = svp ? *svp : Nullsv;
if (!sv)
continue;
- if (sv == (SV*)comppad_name)
- comppad_name = Nullav;
- else if (sv == (SV*)comppad) {
- comppad = Nullav;
- curpad = Null(SV**);
+ if (sv == (SV*)PL_comppad_name)
+ PL_comppad_name = Nullav;
+ else if (sv == (SV*)PL_comppad) {
+ PL_comppad = Nullav;
+ PL_curpad = Null(SV**);
}
SvREFCNT_dec(sv);
}
assert(!CvUNIQUE(proto));
ENTER;
- SAVESPTR(curpad);
- SAVESPTR(comppad);
- SAVESPTR(comppad_name);
- SAVESPTR(compcv);
+ SAVESPTR(PL_curpad);
+ SAVESPTR(PL_comppad);
+ SAVESPTR(PL_comppad_name);
+ SAVESPTR(PL_compcv);
- cv = compcv = (CV*)NEWSV(1104,0);
+ cv = PL_compcv = (CV*)NEWSV(1104,0);
sv_upgrade((SV *)cv, SvTYPE(proto));
CvCLONED_on(cv);
if (CvANON(proto))
if (SvPOK(proto))
sv_setpvn((SV*)cv, SvPVX(proto), SvCUR(proto));
- comppad_name = newAV();
+ PL_comppad_name = newAV();
for (ix = fname; ix >= 0; ix--)
- av_store(comppad_name, ix, SvREFCNT_inc(pname[ix]));
+ av_store(PL_comppad_name, ix, SvREFCNT_inc(pname[ix]));
- comppad = newAV();
+ PL_comppad = newAV();
comppadlist = newAV();
AvREAL_off(comppadlist);
- av_store(comppadlist, 0, (SV*)comppad_name);
- av_store(comppadlist, 1, (SV*)comppad);
+ av_store(comppadlist, 0, (SV*)PL_comppad_name);
+ av_store(comppadlist, 1, (SV*)PL_comppad);
CvPADLIST(cv) = comppadlist;
- av_fill(comppad, AvFILLp(protopad));
- curpad = AvARRAY(comppad);
+ av_fill(PL_comppad, AvFILLp(protopad));
+ PL_curpad = AvARRAY(PL_comppad);
av = newAV(); /* will be @_ */
av_extend(av, 0);
- av_store(comppad, 0, (SV*)av);
+ av_store(PL_comppad, 0, (SV*)av);
AvFLAGS(av) = AVf_REIFY;
for (ix = fpad; ix > 0; ix--) {
SV* namesv = (ix <= fname) ? pname[ix] : Nullsv;
- if (namesv && namesv != &sv_undef) {
+ if (namesv && namesv != &PL_sv_undef) {
char *name = SvPVX(namesv); /* XXX */
if (SvFLAGS(namesv) & SVf_FAKE) { /* lexical from outside? */
I32 off = pad_findlex(name, ix, SvIVX(namesv),
CvOUTSIDE(cv), cxstack_ix);
if (!off)
- curpad[ix] = SvREFCNT_inc(ppad[ix]);
+ PL_curpad[ix] = SvREFCNT_inc(ppad[ix]);
else if (off != ix)
croak("panic: cv_clone: %s", name);
}
sv = NEWSV(0,0);
if (!SvPADBUSY(sv))
SvPADMY_on(sv);
- curpad[ix] = sv;
+ PL_curpad[ix] = sv;
}
}
else {
SV* sv = NEWSV(0,0);
SvPADTMP_on(sv);
- curpad[ix] = sv;
+ PL_curpad[ix] = sv;
}
}
for (ix = fpad; ix > 0; ix--) {
SV* namesv = (ix <= fname) ? pname[ix] : Nullsv;
if (namesv
- && namesv != &sv_undef
+ && namesv != &PL_sv_undef
&& !(SvFLAGS(namesv) & SVf_FAKE)
&& *SvPVX(namesv) == '&'
&& CvCLONE(ppad[ix]))
SvREFCNT_dec(ppad[ix]);
CvCLONE_on(kid);
SvPADMY_on(kid);
- curpad[ix] = (SV*)kid;
+ PL_curpad[ix] = (SV*)kid;
}
}
newSUB(I32 floor, OP *o, OP *proto, OP *block)
{
dTHR;
- char *name = o ? SvPVx(cSVOPo->op_sv, na) : Nullch;
+ char *name = o ? SvPVx(cSVOPo->op_sv, PL_na) : Nullch;
GV *gv = gv_fetchpv(name ? name : "__ANON__",
GV_ADDMULTI | (block ? 0 : GV_NOINIT), SVt_PVCV);
- char *ps = proto ? SvPVx(((SVOP*)proto)->op_sv, na) : Nullch;
+ char *ps = proto ? SvPVx(((SVOP*)proto)->op_sv, PL_na) : Nullch;
register CV *cv=0;
I32 ix;
sv_setpv((SV*)gv, ps);
else
sv_setiv((SV*)gv, -1);
- SvREFCNT_dec(compcv);
- cv = compcv = NULL;
- sub_generation++;
+ SvREFCNT_dec(PL_compcv);
+ cv = PL_compcv = NULL;
+ PL_sub_generation++;
goto noblock;
}
bool const_changed = TRUE;
if (!block) {
/* just a "sub foo;" when &foo is already defined */
- SAVEFREESV(compcv);
+ SAVEFREESV(PL_compcv);
goto done;
}
/* ahem, death to those who redefine active sort subs */
- if (curstackinfo->si_type == PERLSI_SORT && sortcop == CvSTART(cv))
+ if (PL_curstackinfo->si_type == PERLSI_SORT && PL_sortcop == CvSTART(cv))
croak("Can't redefine active sort subroutine %s", name);
if(const_sv = cv_const_sv(cv))
const_changed = sv_cmp(const_sv, op_const_sv(block, Nullcv));
- if ((const_sv && const_changed) || dowarn && !(CvGV(cv) && GvSTASH(CvGV(cv))
+ if ((const_sv && const_changed) || PL_dowarn && !(CvGV(cv) && GvSTASH(CvGV(cv))
&& HvNAME(GvSTASH(CvGV(cv)))
&& strEQ(HvNAME(GvSTASH(CvGV(cv))),
"autouse"))) {
- line_t oldline = curcop->cop_line;
- curcop->cop_line = copline;
+ line_t oldline = PL_curcop->cop_line;
+ PL_curcop->cop_line = PL_copline;
warn(const_sv ? "Constant subroutine %s redefined"
: "Subroutine %s redefined", name);
- curcop->cop_line = oldline;
+ PL_curcop->cop_line = oldline;
}
SvREFCNT_dec(cv);
cv = Nullcv;
}
if (cv) { /* must reuse cv if autoloaded */
cv_undef(cv);
- CvFLAGS(cv) = CvFLAGS(compcv);
- CvOUTSIDE(cv) = CvOUTSIDE(compcv);
- CvOUTSIDE(compcv) = 0;
- CvPADLIST(cv) = CvPADLIST(compcv);
- CvPADLIST(compcv) = 0;
- if (SvREFCNT(compcv) > 1) /* XXX Make closures transit through stub. */
- CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc((SV*)cv);
- SvREFCNT_dec(compcv);
+ CvFLAGS(cv) = CvFLAGS(PL_compcv);
+ CvOUTSIDE(cv) = CvOUTSIDE(PL_compcv);
+ CvOUTSIDE(PL_compcv) = 0;
+ CvPADLIST(cv) = CvPADLIST(PL_compcv);
+ CvPADLIST(PL_compcv) = 0;
+ if (SvREFCNT(PL_compcv) > 1) /* XXX Make closures transit through stub. */
+ CvOUTSIDE(PL_compcv) = (CV*)SvREFCNT_inc((SV*)cv);
+ SvREFCNT_dec(PL_compcv);
}
else {
- cv = compcv;
+ cv = PL_compcv;
if (name) {
GvCV(gv) = cv;
GvCVGEN(gv) = 0;
- sub_generation++;
+ PL_sub_generation++;
}
}
CvGV(cv) = (GV*)SvREFCNT_inc(gv);
- CvFILEGV(cv) = curcop->cop_filegv;
- CvSTASH(cv) = curstash;
+ CvFILEGV(cv) = PL_curcop->cop_filegv;
+ CvSTASH(cv) = PL_curstash;
#ifdef USE_THREADS
CvOWNER(cv) = 0;
if (!CvMUTEXP(cv))
if (ps)
sv_setpv((SV*)cv, ps);
- if (error_count) {
+ if (PL_error_count) {
op_free(block);
block = Nullop;
if (name) {
if (strEQ(s, "BEGIN")) {
char *not_safe =
"BEGIN not safe after errors--compilation aborted";
- if (in_eval & 4)
+ if (PL_in_eval & 4)
croak(not_safe);
else {
/* force display of errors found but not reported */
sv_catpv(ERRSV, not_safe);
- croak("%s", SvPVx(ERRSV, na));
+ croak("%s", SvPVx(ERRSV, PL_na));
}
}
}
}
if (!block) {
noblock:
- copline = NOLINE;
+ PL_copline = NOLINE;
LEAVE_SCOPE(floor);
return cv;
}
- if (AvFILLp(comppad_name) < AvFILLp(comppad))
- av_store(comppad_name, AvFILLp(comppad), Nullsv);
+ if (AvFILLp(PL_comppad_name) < AvFILLp(PL_comppad))
+ av_store(PL_comppad_name, AvFILLp(PL_comppad), Nullsv);
if (CvCLONE(cv)) {
- SV **namep = AvARRAY(comppad_name);
- for (ix = AvFILLp(comppad); ix > 0; ix--) {
+ SV **namep = AvARRAY(PL_comppad_name);
+ for (ix = AvFILLp(PL_comppad); ix > 0; ix--) {
SV *namesv;
- if (SvIMMORTAL(curpad[ix]))
+ if (SvIMMORTAL(PL_curpad[ix]))
continue;
/*
* The only things that a clonable function needs in its
* The rest are created anew during cloning.
*/
if (!((namesv = namep[ix]) != Nullsv &&
- namesv != &sv_undef &&
+ namesv != &PL_sv_undef &&
(SvFAKE(namesv) ||
*SvPVX(namesv) == '&')))
{
- SvREFCNT_dec(curpad[ix]);
- curpad[ix] = Nullsv;
+ SvREFCNT_dec(PL_curpad[ix]);
+ PL_curpad[ix] = Nullsv;
}
}
}
else {
AV *av = newAV(); /* Will be @_ */
av_extend(av, 0);
- av_store(comppad, 0, (SV*)av);
+ av_store(PL_comppad, 0, (SV*)av);
AvFLAGS(av) = AVf_REIFY;
- for (ix = AvFILLp(comppad); ix > 0; ix--) {
- if (SvIMMORTAL(curpad[ix]))
+ for (ix = AvFILLp(PL_comppad); ix > 0; ix--) {
+ if (SvIMMORTAL(PL_curpad[ix]))
continue;
- if (!SvPADMY(curpad[ix]))
- SvPADTMP_on(curpad[ix]);
+ if (!SvPADMY(PL_curpad[ix]))
+ SvPADTMP_on(PL_curpad[ix]);
}
}
if (name) {
char *s;
- if (PERLDB_SUBLINE && curstash != debstash) {
+ if (PERLDB_SUBLINE && PL_curstash != PL_debstash) {
SV *sv = NEWSV(0,0);
SV *tmpstr = sv_newmortal();
GV *db_postponed = gv_fetchpv("DB::postponed", GV_ADDMULTI, SVt_PVHV);
HV *hv;
sv_setpvf(sv, "%_:%ld-%ld",
- GvSV(curcop->cop_filegv),
- (long)subline, (long)curcop->cop_line);
+ GvSV(PL_curcop->cop_filegv),
+ (long)PL_subline, (long)PL_curcop->cop_line);
gv_efullname3(tmpstr, gv, Nullch);
- hv_store(GvHV(DBsub), SvPVX(tmpstr), SvCUR(tmpstr), sv, 0);
+ hv_store(GvHV(PL_DBsub), SvPVX(tmpstr), SvCUR(tmpstr), sv, 0);
hv = GvHVn(db_postponed);
if (HvFILL(hv) > 0 && hv_exists(hv, SvPVX(tmpstr), SvCUR(tmpstr))
&& (cv = GvCV(db_postponed))) {
else
s = name;
if (strEQ(s, "BEGIN")) {
- I32 oldscope = scopestack_ix;
+ I32 oldscope = PL_scopestack_ix;
ENTER;
- SAVESPTR(compiling.cop_filegv);
- SAVEI16(compiling.cop_line);
- save_svref(&rs);
- sv_setsv(rs, nrs);
+ SAVESPTR(PL_compiling.cop_filegv);
+ SAVEI16(PL_compiling.cop_line);
+ save_svref(&PL_rs);
+ sv_setsv(PL_rs, PL_nrs);
- if (!beginav)
- beginav = newAV();
+ if (!PL_beginav)
+ PL_beginav = newAV();
DEBUG_x( dump_sub(gv) );
- av_push(beginav, (SV *)cv);
+ av_push(PL_beginav, (SV *)cv);
GvCV(gv) = 0;
- call_list(oldscope, beginav);
+ call_list(oldscope, PL_beginav);
- curcop = &compiling;
+ PL_curcop = &PL_compiling;
LEAVE;
}
- else if (strEQ(s, "END") && !error_count) {
- if (!endav)
- endav = newAV();
- av_unshift(endav, 1);
- av_store(endav, 0, (SV *)cv);
+ else if (strEQ(s, "END") && !PL_error_count) {
+ if (!PL_endav)
+ PL_endav = newAV();
+ av_unshift(PL_endav, 1);
+ av_store(PL_endav, 0, (SV *)cv);
GvCV(gv) = 0;
}
- else if (strEQ(s, "INIT") && !error_count) {
- if (!initav)
- initav = newAV();
- av_push(initav, SvREFCNT_inc(cv));
+ else if (strEQ(s, "INIT") && !PL_error_count) {
+ if (!PL_initav)
+ PL_initav = newAV();
+ av_push(PL_initav, SvREFCNT_inc(cv));
}
}
done:
- copline = NOLINE;
+ PL_copline = NOLINE;
LEAVE_SCOPE(floor);
return cv;
}
newCONSTSUB(HV *stash, char *name, SV *sv)
{
dTHR;
- U32 oldhints = hints;
- HV *old_cop_stash = curcop->cop_stash;
- HV *old_curstash = curstash;
- line_t oldline = curcop->cop_line;
- curcop->cop_line = copline;
+ U32 oldhints = PL_hints;
+ HV *old_cop_stash = PL_curcop->cop_stash;
+ HV *old_curstash = PL_curstash;
+ line_t oldline = PL_curcop->cop_line;
+ PL_curcop->cop_line = PL_copline;
- hints &= ~HINT_BLOCK_SCOPE;
+ PL_hints &= ~HINT_BLOCK_SCOPE;
if(stash)
- curstash = curcop->cop_stash = stash;
+ PL_curstash = PL_curcop->cop_stash = stash;
newSUB(
start_subparse(FALSE, 0),
newSVOP(OP_CONST, 0, newSVpv(name,0)),
- newSVOP(OP_CONST, 0, &sv_no), /* SvPV(&sv_no) == "" -- GMB */
+ newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&sv_no) == "" -- GMB */
newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
);
- hints = oldhints;
- curcop->cop_stash = old_cop_stash;
- curstash = old_curstash;
- curcop->cop_line = oldline;
+ PL_hints = oldhints;
+ PL_curcop->cop_stash = old_cop_stash;
+ PL_curstash = old_curstash;
+ PL_curcop->cop_line = oldline;
}
CV *
}
else if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) {
/* already defined (or promised) */
- if (dowarn && !(CvGV(cv) && GvSTASH(CvGV(cv))
+ if (PL_dowarn && !(CvGV(cv) && GvSTASH(CvGV(cv))
&& HvNAME(GvSTASH(CvGV(cv)))
&& strEQ(HvNAME(GvSTASH(CvGV(cv))), "autouse"))) {
- line_t oldline = curcop->cop_line;
- curcop->cop_line = copline;
+ line_t oldline = PL_curcop->cop_line;
+ PL_curcop->cop_line = PL_copline;
warn("Subroutine %s redefined",name);
- curcop->cop_line = oldline;
+ PL_curcop->cop_line = oldline;
}
SvREFCNT_dec(cv);
cv = 0;
if (name) {
GvCV(gv) = cv;
GvCVGEN(gv) = 0;
- sub_generation++;
+ PL_sub_generation++;
}
}
CvGV(cv) = (GV*)SvREFCNT_inc(gv);
else
s = name;
if (strEQ(s, "BEGIN")) {
- if (!beginav)
- beginav = newAV();
- av_push(beginav, (SV *)cv);
+ if (!PL_beginav)
+ PL_beginav = newAV();
+ av_push(PL_beginav, (SV *)cv);
GvCV(gv) = 0;
}
else if (strEQ(s, "END")) {
- if (!endav)
- endav = newAV();
- av_unshift(endav, 1);
- av_store(endav, 0, (SV *)cv);
+ if (!PL_endav)
+ PL_endav = newAV();
+ av_unshift(PL_endav, 1);
+ av_store(PL_endav, 0, (SV *)cv);
GvCV(gv) = 0;
}
else if (strEQ(s, "INIT")) {
- if (!initav)
- initav = newAV();
- av_push(initav, (SV *)cv);
+ if (!PL_initav)
+ PL_initav = newAV();
+ av_push(PL_initav, (SV *)cv);
}
}
else
I32 ix;
if (o)
- name = SvPVx(cSVOPo->op_sv, na);
+ name = SvPVx(cSVOPo->op_sv, PL_na);
else
name = "STDOUT";
gv = gv_fetchpv(name,TRUE, SVt_PVFM);
GvMULTI_on(gv);
if (cv = GvFORM(gv)) {
- if (dowarn) {
- line_t oldline = curcop->cop_line;
+ if (PL_dowarn) {
+ line_t oldline = PL_curcop->cop_line;
- curcop->cop_line = copline;
+ PL_curcop->cop_line = PL_copline;
warn("Format %s redefined",name);
- curcop->cop_line = oldline;
+ PL_curcop->cop_line = oldline;
}
SvREFCNT_dec(cv);
}
- cv = compcv;
+ cv = PL_compcv;
GvFORM(gv) = cv;
CvGV(cv) = (GV*)SvREFCNT_inc(gv);
- CvFILEGV(cv) = curcop->cop_filegv;
+ CvFILEGV(cv) = PL_curcop->cop_filegv;
- for (ix = AvFILLp(comppad); ix > 0; ix--) {
- if (!SvPADMY(curpad[ix]) && !SvIMMORTAL(curpad[ix]))
- SvPADTMP_on(curpad[ix]);
+ for (ix = AvFILLp(PL_comppad); ix > 0; ix--) {
+ if (!SvPADMY(PL_curpad[ix]) && !SvIMMORTAL(PL_curpad[ix]))
+ SvPADTMP_on(PL_curpad[ix]);
}
CvROOT(cv) = newUNOP(OP_LEAVEWRITE, 0, scalarseq(block));
CvROOT(cv)->op_next = 0;
peep(CvSTART(cv));
op_free(o);
- copline = NOLINE;
+ PL_copline = NOLINE;
LEAVE_SCOPE(floor);
}
SvIVX(name) = -1;
SvNVX(name) = 1;
ix = pad_alloc(o->op_type, SVs_PADMY);
- av_store(comppad_name, ix, name);
- av_store(comppad, ix, cSVOPo->op_sv);
+ av_store(PL_comppad_name, ix, name);
+ av_store(PL_comppad, ix, cSVOPo->op_sv);
SvPADMY_on(cSVOPo->op_sv);
cSVOPo->op_sv = Nullsv;
cSVOPo->op_targ = ix;
OP *
ck_bitop(OP *o)
{
- o->op_private = hints;
+ o->op_private = PL_hints;
return o;
}
OP *
ck_eval(OP *o)
{
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
if (o->op_flags & OPf_KIDS) {
SVOP *kid = (SVOP*)cUNOPo->op_first;
op_free(o);
o = newUNOP(OP_ENTEREVAL, 0, newDEFSVOP());
}
- o->op_targ = (PADOFFSET)hints;
+ o->op_targ = (PADOFFSET)PL_hints;
return o;
}
dTHR;
SVOP *kid = (SVOP*)cUNOPo->op_first;
- o->op_private |= (hints & HINT_STRICT_REFS);
+ o->op_private |= (PL_hints & HINT_STRICT_REFS);
if (kid->op_type == OP_CONST) {
char *name;
int iscv;
GV *gv;
- name = SvPV(kid->op_sv, na);
- if ((hints & HINT_STRICT_REFS) && (kid->op_private & OPpCONST_BARE)) {
+ name = SvPV(kid->op_sv, PL_na);
+ if ((PL_hints & HINT_STRICT_REFS) && (kid->op_private & OPpCONST_BARE)) {
char *badthing = Nullch;
switch (o->op_type) {
case OP_RV2SV:
if (kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE)) {
OP *newop = newGVOP(type, OPf_REF,
- gv_fetchpv(SvPVx(kid->op_sv, na), TRUE, SVt_PVIO));
+ gv_fetchpv(SvPVx(kid->op_sv, PL_na), TRUE, SVt_PVIO));
op_free(o);
return newop;
}
case OA_AVREF:
if (kid->op_type == OP_CONST &&
(kid->op_private & OPpCONST_BARE)) {
- char *name = SvPVx(((SVOP*)kid)->op_sv, na);
+ char *name = SvPVx(((SVOP*)kid)->op_sv, PL_na);
OP *newop = newAVREF(newGVOP(OP_GV, 0,
gv_fetchpv(name, TRUE, SVt_PVAV) ));
- if (dowarn)
+ if (PL_dowarn)
warn("Array @%s missing the @ in argument %ld of %s()",
name, (long)numargs, op_desc[type]);
op_free(kid);
case OA_HVREF:
if (kid->op_type == OP_CONST &&
(kid->op_private & OPpCONST_BARE)) {
- char *name = SvPVx(((SVOP*)kid)->op_sv, na);
+ char *name = SvPVx(((SVOP*)kid)->op_sv, PL_na);
OP *newop = newHVREF(newGVOP(OP_GV, 0,
gv_fetchpv(name, TRUE, SVt_PVHV) ));
- if (dowarn)
+ if (PL_dowarn)
warn("Hash %%%s missing the %% in argument %ld of %s()",
name, (long)numargs, op_desc[type]);
op_free(kid);
if (kid->op_type == OP_CONST &&
(kid->op_private & OPpCONST_BARE)) {
OP *newop = newGVOP(OP_GV, 0,
- gv_fetchpv(SvPVx(((SVOP*)kid)->op_sv, na), TRUE,
+ gv_fetchpv(SvPVx(((SVOP*)kid)->op_sv, PL_na), TRUE,
SVt_PVIO) );
op_free(kid);
kid = newop;
else
scalar(kid);
o = ck_fun(o);
- if (error_count)
+ if (PL_error_count)
return o;
kid = cLISTOPo->op_first->op_sibling;
if (kid->op_type != OP_NULL)
o->op_private = 0;
#ifdef USE_LOCALE
- if (hints & HINT_LOCALE)
+ if (PL_hints & HINT_LOCALE)
o->op_private |= OPpLOCALE;
#endif
o->op_private = 0;
#ifdef USE_LOCALE
- if (hints & HINT_LOCALE)
+ if (PL_hints & HINT_LOCALE)
o->op_private |= OPpLOCALE;
#endif
{
o->op_private = 0;
#ifdef USE_LOCALE
- if (hints & HINT_LOCALE)
+ if (PL_hints & HINT_LOCALE)
o->op_private |= OPpLOCALE;
#endif
}
#else
argop = newUNOP(OP_RV2AV, 0,
- scalar(newGVOP(OP_GV, 0, !CvUNIQUE(compcv) ?
- defgv : gv_fetchpv("ARGV", TRUE, SVt_PVAV))));
+ scalar(newGVOP(OP_GV, 0, !CvUNIQUE(PL_compcv) ?
+ PL_defgv : gv_fetchpv("ARGV", TRUE, SVt_PVAV))));
#endif /* USE_THREADS */
return newUNOP(type, 0, scalar(argop));
}
{
o->op_private = 0;
#ifdef USE_LOCALE
- if (hints & HINT_LOCALE)
+ if (PL_hints & HINT_LOCALE)
o->op_private |= OPpLOCALE;
#endif
cv = GvCVu(tmpop->op_sv);
if (cv && SvPOK(cv) && !(o->op_private & OPpENTERSUB_AMPER)) {
namegv = CvANON(cv) ? (GV*)tmpop->op_sv : CvGV(cv);
- proto = SvPV((SV*)cv, na);
+ proto = SvPV((SV*)cv, PL_na);
}
}
}
- o->op_private |= (hints & HINT_STRICT_REFS);
- if (PERLDB_SUB && curstash != debstash)
+ o->op_private |= (PL_hints & HINT_STRICT_REFS);
+ if (PERLDB_SUB && PL_curstash != PL_debstash)
o->op_private |= OPpENTERSUB_DB;
while (o2 != cvop) {
if (proto) {
default:
oops:
croak("Malformed prototype for %s: %s",
- gv_ename(namegv), SvPV((SV*)cv, na));
+ gv_ename(namegv), SvPV((SV*)cv, PL_na));
}
}
else
return;
ENTER;
SAVEOP();
- SAVESPTR(curcop);
+ SAVESPTR(PL_curcop);
for (; o; o = o->op_next) {
if (o->op_seq)
break;
- if (!op_seqmax)
- op_seqmax++;
+ if (!PL_op_seqmax)
+ PL_op_seqmax++;
op = o;
switch (o->op_type) {
case OP_NEXTSTATE:
case OP_DBSTATE:
- curcop = ((COP*)o); /* for warnings */
- o->op_seq = op_seqmax++;
+ PL_curcop = ((COP*)o); /* for warnings */
+ o->op_seq = PL_op_seqmax++;
break;
case OP_CONCAT:
case OP_QUOTEMETA:
if (o->op_next && o->op_next->op_type == OP_STRINGIFY)
null(o->op_next);
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
break;
case OP_STUB:
if ((o->op_flags & OPf_WANT) != OPf_WANT_LIST) {
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
break; /* Scalar stub must produce undef. List stub is noop */
}
goto nothin;
case OP_NULL:
if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
- curcop = ((COP*)o);
+ PL_curcop = ((COP*)o);
goto nothin;
case OP_SCALAR:
case OP_LINESEQ:
oldop->op_next = o->op_next;
continue;
}
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
break;
case OP_GV:
pop->op_next->op_type == OP_AELEM &&
!(pop->op_next->op_private &
(OPpLVAL_INTRO|OPpLVAL_DEFER|OPpDEREF)) &&
- (i = SvIV(((SVOP*)pop)->op_sv) - compiling.cop_arybase)
+ (i = SvIV(((SVOP*)pop)->op_sv) - PL_compiling.cop_arybase)
<= 255 &&
i >= 0)
{
GvAVn(((GVOP*)o)->op_gv);
}
}
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
break;
case OP_PADAV:
case OP_GREPWHILE:
case OP_AND:
case OP_OR:
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
while (cLOGOP->op_other->op_type == OP_NULL)
cLOGOP->op_other = cLOGOP->op_other->op_next;
peep(cLOGOP->op_other);
break;
case OP_COND_EXPR:
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
peep(cCONDOP->op_true);
peep(cCONDOP->op_false);
break;
case OP_ENTERLOOP:
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
peep(cLOOP->op_redoop);
peep(cLOOP->op_nextop);
peep(cLOOP->op_lastop);
case OP_QR:
case OP_MATCH:
case OP_SUBST:
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
peep(cPMOP->op_pmreplstart);
break;
case OP_EXEC:
- o->op_seq = op_seqmax++;
- if (dowarn && o->op_next && o->op_next->op_type == OP_NEXTSTATE) {
+ o->op_seq = PL_op_seqmax++;
+ if (PL_dowarn && o->op_next && o->op_next->op_type == OP_NEXTSTATE) {
if (o->op_next->op_sibling &&
o->op_next->op_sibling->op_type != OP_EXIT &&
o->op_next->op_sibling->op_type != OP_WARN &&
o->op_next->op_sibling->op_type != OP_DIE) {
- line_t oldline = curcop->cop_line;
+ line_t oldline = PL_curcop->cop_line;
- curcop->cop_line = ((COP*)o->op_next)->cop_line;
+ PL_curcop->cop_line = ((COP*)o->op_next)->cop_line;
warn("Statement unlikely to be reached");
warn("(Maybe you meant system() when you said exec()?)\n");
- curcop->cop_line = oldline;
+ PL_curcop->cop_line = oldline;
}
}
break;
rop = (UNOP*)((BINOP*)o)->op_first;
if (rop->op_type != OP_RV2HV || rop->op_first->op_type != OP_PADSV)
break;
- lexname = *av_fetch(comppad_name, rop->op_first->op_targ, TRUE);
+ lexname = *av_fetch(PL_comppad_name, rop->op_first->op_targ, TRUE);
if (!SvOBJECT(lexname))
break;
fields = (GV**)hv_fetch(SvSTASH(lexname), "FIELDS", 6, FALSE);
indsvp = hv_fetch(GvHV(*fields), key, keylen, FALSE);
if (!indsvp) {
croak("No such field \"%s\" in variable %s of type %s",
- key, SvPV(lexname, na), HvNAME(SvSTASH(lexname)));
+ key, SvPV(lexname, PL_na), HvNAME(SvSTASH(lexname)));
}
ind = SvIV(*indsvp);
if (ind < 1)
}
default:
- o->op_seq = op_seqmax++;
+ o->op_seq = PL_op_seqmax++;
break;
}
oldop = o;
{
PerlInterpreter *sv_interp;
- curinterp = 0;
+ PL_curinterp = 0;
New(53, sv_interp, 1, PerlInterpreter);
return sv_interp;
}
#endif /* USE_THREADS */
#ifndef PERL_OBJECT
- if (!(curinterp = sv_interp))
+ if (!(PL_curinterp = sv_interp))
return;
#endif
#endif
/* Init the real globals (and main thread)? */
- if (!linestr) {
+ if (!PL_linestr) {
#ifdef USE_THREADS
INIT_THREADS;
thr = init_main_thread();
#endif /* USE_THREADS */
- linestr = NEWSV(65,79);
- sv_upgrade(linestr,SVt_PVIV);
+ PL_linestr = NEWSV(65,79);
+ sv_upgrade(PL_linestr,SVt_PVIV);
- if (!SvREADONLY(&sv_undef)) {
+ if (!SvREADONLY(&PL_sv_undef)) {
/* set read-only and try to insure than we wont see REFCNT==0
very often */
- SvREADONLY_on(&sv_undef);
- SvREFCNT(&sv_undef) = (~(U32)0)/2;
+ SvREADONLY_on(&PL_sv_undef);
+ SvREFCNT(&PL_sv_undef) = (~(U32)0)/2;
- sv_setpv(&sv_no,No);
- SvNV(&sv_no);
- SvREADONLY_on(&sv_no);
- SvREFCNT(&sv_no) = (~(U32)0)/2;
+ sv_setpv(&PL_sv_no,PL_No);
+ SvNV(&PL_sv_no);
+ SvREADONLY_on(&PL_sv_no);
+ SvREFCNT(&PL_sv_no) = (~(U32)0)/2;
- sv_setpv(&sv_yes,Yes);
- SvNV(&sv_yes);
- SvREADONLY_on(&sv_yes);
- SvREFCNT(&sv_yes) = (~(U32)0)/2;
+ sv_setpv(&PL_sv_yes,PL_Yes);
+ SvNV(&PL_sv_yes);
+ SvREADONLY_on(&PL_sv_yes);
+ SvREFCNT(&PL_sv_yes) = (~(U32)0)/2;
}
#ifdef PERL_OBJECT
/* TODO: */
/* sighandlerp = sighandler; */
#else
- sighandlerp = sighandler;
+ PL_sighandlerp = sighandler;
#endif
- pidstatus = newHV();
+ PL_pidstatus = newHV();
#ifdef MSDOS
/*
#endif
}
- nrs = newSVpv("\n", 1);
- rs = SvREFCNT_inc(nrs);
+ PL_nrs = newSVpv("\n", 1);
+ PL_rs = SvREFCNT_inc(PL_nrs);
init_stacks(ARGS);
#ifdef MULTIPLICITY
init_interp();
perl_destruct_level = 1;
#else
- if (perl_destruct_level > 0)
+ if (PL_perl_destruct_level > 0)
init_interp();
#endif
init_ids();
- lex_state = LEX_NOTPARSING;
+ PL_lex_state = LEX_NOTPARSING;
- start_env.je_prev = NULL;
- start_env.je_ret = -1;
- start_env.je_mustcatch = TRUE;
- top_env = &start_env;
+ PL_start_env.je_prev = NULL;
+ PL_start_env.je_ret = -1;
+ PL_start_env.je_mustcatch = TRUE;
+ PL_top_env = &PL_start_env;
STATUS_ALL_SUCCESS;
SET_NUMERIC_STANDARD();
#if defined(SUBVERSION) && SUBVERSION > 0
- sprintf(patchlevel, "%7.5f", (double) 5
+ sprintf(PL_patchlevel, "%7.5f", (double) 5
+ ((double) PATCHLEVEL / (double) 1000)
+ ((double) SUBVERSION / (double) 100000));
#else
#endif
#if defined(LOCAL_PATCH_COUNT)
- localpatches = local_patches; /* For possible -v */
+ PL_localpatches = local_patches; /* For possible -v */
#endif
PerlIO_init(); /* Hook to IO system */
- fdpid = newAV(); /* for remembering popen pids by fd */
- modglobal = newHV(); /* pointers to per-interpreter module globals */
+ PL_fdpid = newAV(); /* for remembering popen pids by fd */
+ PL_modglobal = newHV(); /* pointers to per-interpreter module globals */
DEBUG( {
- New(51,debname,128,char);
- New(52,debdelim,128,char);
+ New(51,PL_debname,128,char);
+ New(52,PL_debdelim,128,char);
} )
ENTER;
#endif /* USE_THREADS */
#ifndef PERL_OBJECT
- if (!(curinterp = sv_interp))
+ if (!(PL_curinterp = sv_interp))
return;
#endif
#endif /* !defined(FAKE_THREADS) */
#endif /* USE_THREADS */
- destruct_level = perl_destruct_level;
+ destruct_level = PL_perl_destruct_level;
#ifdef DEBUGGING
{
char *s;
/* We must account for everything. */
/* Destroy the main CV and syntax tree */
- if (main_root) {
- curpad = AvARRAY(comppad);
- op_free(main_root);
- main_root = Nullop;
+ if (PL_main_root) {
+ PL_curpad = AvARRAY(PL_comppad);
+ op_free(PL_main_root);
+ PL_main_root = Nullop;
}
- curcop = &compiling;
- main_start = Nullop;
- SvREFCNT_dec(main_cv);
- main_cv = Nullcv;
+ PL_curcop = &PL_compiling;
+ PL_main_start = Nullop;
+ SvREFCNT_dec(PL_main_cv);
+ PL_main_cv = Nullcv;
- if (sv_objcount) {
+ if (PL_sv_objcount) {
/*
* Try to destruct global references. We do this first so that the
* destructors and destructees still exist. Some sv's might remain.
* Non-referenced objects are on their own.
*/
- dirty = TRUE;
+ PL_dirty = TRUE;
sv_clean_objs();
}
/* unhook hooks which will soon be, or use, destroyed data */
- SvREFCNT_dec(warnhook);
- warnhook = Nullsv;
- SvREFCNT_dec(diehook);
- diehook = Nullsv;
- SvREFCNT_dec(parsehook);
- parsehook = Nullsv;
+ SvREFCNT_dec(PL_warnhook);
+ PL_warnhook = Nullsv;
+ SvREFCNT_dec(PL_diehook);
+ PL_diehook = Nullsv;
+ SvREFCNT_dec(PL_parsehook);
+ PL_parsehook = Nullsv;
/* call exit list functions */
- while (exitlistlen-- > 0)
- exitlist[exitlistlen].fn(PERL_OBJECT_THIS_ exitlist[exitlistlen].ptr);
+ while (PL_exitlistlen-- > 0)
+ PL_exitlist[PL_exitlistlen].fn(PERL_OBJECT_THIS_ PL_exitlist[PL_exitlistlen].ptr);
- Safefree(exitlist);
+ Safefree(PL_exitlist);
if (destruct_level == 0){
/* loosen bonds of global variables */
- if(rsfp) {
- (void)PerlIO_close(rsfp);
- rsfp = Nullfp;
+ if(PL_rsfp) {
+ (void)PerlIO_close(PL_rsfp);
+ PL_rsfp = Nullfp;
}
/* Filters for program text */
- SvREFCNT_dec(rsfp_filters);
- rsfp_filters = Nullav;
+ SvREFCNT_dec(PL_rsfp_filters);
+ PL_rsfp_filters = Nullav;
/* switches */
- preprocess = FALSE;
- minus_n = FALSE;
- minus_p = FALSE;
- minus_l = FALSE;
- minus_a = FALSE;
- minus_F = FALSE;
- doswitches = FALSE;
- dowarn = FALSE;
- doextract = FALSE;
- sawampersand = FALSE; /* must save all match strings */
- sawstudy = FALSE; /* do fbm_instr on all strings */
- sawvec = FALSE;
- unsafe = FALSE;
-
- Safefree(inplace);
- inplace = Nullch;
-
- if (e_script) {
- SvREFCNT_dec(e_script);
- e_script = Nullsv;
+ PL_preprocess = FALSE;
+ PL_minus_n = FALSE;
+ PL_minus_p = FALSE;
+ PL_minus_l = FALSE;
+ PL_minus_a = FALSE;
+ PL_minus_F = FALSE;
+ PL_doswitches = FALSE;
+ PL_dowarn = FALSE;
+ PL_doextract = FALSE;
+ PL_sawampersand = FALSE; /* must save all match strings */
+ PL_sawstudy = FALSE; /* do fbm_instr on all strings */
+ PL_sawvec = FALSE;
+ PL_unsafe = FALSE;
+
+ Safefree(PL_inplace);
+ PL_inplace = Nullch;
+
+ if (PL_e_script) {
+ SvREFCNT_dec(PL_e_script);
+ PL_e_script = Nullsv;
}
/* magical thingies */
- Safefree(ofs); /* $, */
- ofs = Nullch;
+ Safefree(PL_ofs); /* $, */
+ PL_ofs = Nullch;
- Safefree(ors); /* $\ */
- ors = Nullch;
+ Safefree(PL_ors); /* $\ */
+ PL_ors = Nullch;
- SvREFCNT_dec(rs); /* $/ */
- rs = Nullsv;
+ SvREFCNT_dec(PL_rs); /* $/ */
+ PL_rs = Nullsv;
- SvREFCNT_dec(nrs); /* $/ helper */
- nrs = Nullsv;
+ SvREFCNT_dec(PL_nrs); /* $/ helper */
+ PL_nrs = Nullsv;
- multiline = 0; /* $* */
+ PL_multiline = 0; /* $* */
- SvREFCNT_dec(statname);
- statname = Nullsv;
- statgv = Nullgv;
+ SvREFCNT_dec(PL_statname);
+ PL_statname = Nullsv;
+ PL_statgv = Nullgv;
/* defgv, aka *_ should be taken care of elsewhere */
/* clean up after study() */
- SvREFCNT_dec(lastscream);
- lastscream = Nullsv;
- Safefree(screamfirst);
- screamfirst = 0;
- Safefree(screamnext);
- screamnext = 0;
+ SvREFCNT_dec(PL_lastscream);
+ PL_lastscream = Nullsv;
+ Safefree(PL_screamfirst);
+ PL_screamfirst = 0;
+ Safefree(PL_screamnext);
+ PL_screamnext = 0;
/* startup and shutdown function lists */
- SvREFCNT_dec(beginav);
- SvREFCNT_dec(endav);
- SvREFCNT_dec(initav);
- beginav = Nullav;
- endav = Nullav;
- initav = Nullav;
+ SvREFCNT_dec(PL_beginav);
+ SvREFCNT_dec(PL_endav);
+ SvREFCNT_dec(PL_initav);
+ PL_beginav = Nullav;
+ PL_endav = Nullav;
+ PL_initav = Nullav;
/* shortcuts just get cleared */
- envgv = Nullgv;
- siggv = Nullgv;
- incgv = Nullgv;
- hintgv = Nullgv;
- errgv = Nullgv;
- argvgv = Nullgv;
- argvoutgv = Nullgv;
- stdingv = Nullgv;
- last_in_gv = Nullgv;
- replgv = Nullgv;
+ PL_envgv = Nullgv;
+ PL_siggv = Nullgv;
+ PL_incgv = Nullgv;
+ PL_hintgv = Nullgv;
+ PL_errgv = Nullgv;
+ PL_argvgv = Nullgv;
+ PL_argvoutgv = Nullgv;
+ PL_stdingv = Nullgv;
+ PL_last_in_gv = Nullgv;
+ PL_replgv = Nullgv;
/* reset so print() ends up where we expect */
setdefout(Nullgv);
/* Prepare to destruct main symbol table. */
- hv = defstash;
- defstash = 0;
+ hv = PL_defstash;
+ PL_defstash = 0;
SvREFCNT_dec(hv);
FREETMPS;
if (destruct_level >= 2) {
- if (scopestack_ix != 0)
+ if (PL_scopestack_ix != 0)
warn("Unbalanced scopes: %ld more ENTERs than LEAVEs\n",
- (long)scopestack_ix);
- if (savestack_ix != 0)
+ (long)PL_scopestack_ix);
+ if (PL_savestack_ix != 0)
warn("Unbalanced saves: %ld more saves than restores\n",
- (long)savestack_ix);
- if (tmps_floor != -1)
+ (long)PL_savestack_ix);
+ if (PL_tmps_floor != -1)
warn("Unbalanced tmps: %ld more allocs than frees\n",
- (long)tmps_floor + 1);
+ (long)PL_tmps_floor + 1);
if (cxstack_ix != -1)
warn("Unbalanced context: %ld more PUSHes than POPs\n",
(long)cxstack_ix + 1);
/* Now absolutely destruct everything, somehow or other, loops or no. */
last_sv_count = 0;
- SvFLAGS(strtab) |= SVTYPEMASK; /* don't clean out strtab now */
- while (sv_count != 0 && sv_count != last_sv_count) {
- last_sv_count = sv_count;
+ SvFLAGS(PL_strtab) |= SVTYPEMASK; /* don't clean out strtab now */
+ while (PL_sv_count != 0 && PL_sv_count != last_sv_count) {
+ last_sv_count = PL_sv_count;
sv_clean_all();
}
- SvFLAGS(strtab) &= ~SVTYPEMASK;
- SvFLAGS(strtab) |= SVt_PVHV;
+ SvFLAGS(PL_strtab) &= ~SVTYPEMASK;
+ SvFLAGS(PL_strtab) |= SVt_PVHV;
/* Destruct the global string table. */
{
HE **array;
riter = 0;
- max = HvMAX(strtab);
- array = HvARRAY(strtab);
+ max = HvMAX(PL_strtab);
+ array = HvARRAY(PL_strtab);
hent = array[0];
for (;;) {
if (hent) {
}
}
}
- SvREFCNT_dec(strtab);
+ SvREFCNT_dec(PL_strtab);
- if (sv_count != 0)
- warn("Scalars leaked: %ld\n", (long)sv_count);
+ if (PL_sv_count != 0)
+ warn("Scalars leaked: %ld\n", (long)PL_sv_count);
sv_free_arenas();
/* No SVs have survived, need to clean out */
- linestr = NULL;
- pidstatus = Nullhv;
- Safefree(origfilename);
- Safefree(archpat_auto);
- Safefree(reg_start_tmp);
- Safefree(HeKEY_hek(&hv_fetch_ent_mh));
- Safefree(op_mask);
+ PL_linestr = NULL;
+ PL_pidstatus = Nullhv;
+ Safefree(PL_origfilename);
+ Safefree(PL_archpat_auto);
+ Safefree(PL_reg_start_tmp);
+ Safefree(HeKEY_hek(&PL_hv_fetch_ent_mh));
+ Safefree(PL_op_mask);
nuke_stacks();
- hints = 0; /* Reset hints. Should hints be per-interpreter ? */
+ PL_hints = 0; /* Reset hints. Should hints be per-interpreter ? */
DEBUG_P(debprofdump());
#ifdef USE_THREADS
/* As the absolutely last thing, free the non-arena SV for mess() */
- if (mess_sv) {
+ if (PL_mess_sv) {
/* we know that type >= SVt_PV */
- SvOOK_off(mess_sv);
- Safefree(SvPVX(mess_sv));
- Safefree(SvANY(mess_sv));
- Safefree(mess_sv);
- mess_sv = Nullsv;
+ SvOOK_off(PL_mess_sv);
+ Safefree(SvPVX(PL_mess_sv));
+ Safefree(SvANY(PL_mess_sv));
+ Safefree(PL_mess_sv);
+ PL_mess_sv = Nullsv;
}
}
#ifdef PERL_OBJECT
Safefree(this);
#else
- if (!(curinterp = sv_interp))
+ if (!(PL_curinterp = sv_interp))
return;
Safefree(sv_interp);
#endif
perl_atexit(void (*fn) (void *), void *ptr)
#endif
{
- Renew(exitlist, exitlistlen+1, PerlExitListEntry);
- exitlist[exitlistlen].fn = fn;
- exitlist[exitlistlen].ptr = ptr;
- ++exitlistlen;
+ Renew(PL_exitlist, PL_exitlistlen+1, PerlExitListEntry);
+ PL_exitlist[PL_exitlistlen].fn = fn;
+ PL_exitlist[PL_exitlistlen].ptr = ptr;
+ ++PL_exitlistlen;
}
int
#endif
#ifndef PERL_OBJECT
- if (!(curinterp = sv_interp))
+ if (!(PL_curinterp = sv_interp))
return 255;
#endif
("__environ", (unsigned long *) &environ_pointer, NULL);
#endif /* environ */
- origargv = argv;
- origargc = argc;
+ PL_origargv = argv;
+ PL_origargc = argc;
#ifndef VMS /* VMS doesn't have environ array */
- origenviron = environ;
+ PL_origenviron = environ;
#endif
- if (do_undump) {
+ if (PL_do_undump) {
/* Come here if running an undumped a.out. */
- origfilename = savepv(argv[0]);
- do_undump = FALSE;
+ PL_origfilename = savepv(argv[0]);
+ PL_do_undump = FALSE;
cxstack_ix = -1; /* start label stack again */
init_ids();
init_postdump_symbols(argc,argv,env);
return 0;
}
- if (main_root) {
- curpad = AvARRAY(comppad);
- op_free(main_root);
- main_root = Nullop;
+ if (PL_main_root) {
+ PL_curpad = AvARRAY(PL_comppad);
+ op_free(PL_main_root);
+ PL_main_root = Nullop;
}
- main_start = Nullop;
- SvREFCNT_dec(main_cv);
- main_cv = Nullcv;
+ PL_main_start = Nullop;
+ SvREFCNT_dec(PL_main_cv);
+ PL_main_cv = Nullcv;
- time(&basetime);
- oldscope = scopestack_ix;
+ time(&PL_basetime);
+ oldscope = PL_scopestack_ix;
JMPENV_PUSH(ret);
switch (ret) {
/* FALL THROUGH */
case 2:
/* my_exit() was called */
- while (scopestack_ix > oldscope)
+ while (PL_scopestack_ix > oldscope)
LEAVE;
FREETMPS;
- curstash = defstash;
- if (endav)
- call_list(oldscope, endav);
+ PL_curstash = PL_defstash;
+ if (PL_endav)
+ call_list(oldscope, PL_endav);
JMPENV_POP;
return STATUS_NATIVE_EXPORT;
case 3:
return 1;
}
- sv_setpvn(linestr,"",0);
+ sv_setpvn(PL_linestr,"",0);
sv = newSVpv("",0); /* first used for -I flags */
SAVEFREESV(sv);
init_main_stash();
break;
case 'T':
- tainting = TRUE;
+ PL_tainting = TRUE;
s++;
goto reswitch;
case 'e':
- if (euid != uid || egid != gid)
+ if (PL_euid != PL_uid || PL_egid != PL_gid)
croak("No -e allowed in setuid scripts");
- if (!e_script) {
- e_script = newSVpv("",0);
+ if (!PL_e_script) {
+ PL_e_script = newSVpv("",0);
filter_add(read_e_script, NULL);
}
if (*++s)
- sv_catpv(e_script, s);
+ sv_catpv(PL_e_script, s);
else if (argv[1]) {
- sv_catpv(e_script, argv[1]);
+ sv_catpv(PL_e_script, argv[1]);
argc--,argv++;
}
else
croak("No code specified for -e");
- sv_catpv(e_script, "\n");
+ sv_catpv(PL_e_script, "\n");
break;
case 'I': /* -I handled both here and in moreswitches() */
break;
case 'P':
forbid_setid("-P");
- preprocess = TRUE;
+ PL_preprocess = TRUE;
s++;
goto reswitch;
case 'S':
s++;
goto reswitch;
case 'V':
- if (!preambleav)
- preambleav = newAV();
- av_push(preambleav, newSVpv("use Config qw(myconfig config_vars)",0));
+ if (!PL_preambleav)
+ PL_preambleav = newAV();
+ av_push(PL_preambleav, newSVpv("use Config qw(myconfig config_vars)",0));
if (*++s != ':') {
- Sv = newSVpv("print myconfig();",0);
+ PL_Sv = newSVpv("print myconfig();",0);
#ifdef VMS
sv_catpv(Sv,"print \"\\nCharacteristics of this PERLSHR image: \\n\",");
#else
- sv_catpv(Sv,"print \"\\nCharacteristics of this binary (from libperl): \\n\",");
+ sv_catpv(PL_Sv,"print \"\\nCharacteristics of this binary (from libperl): \\n\",");
#endif
#if defined(DEBUGGING) || defined(NO_EMBED) || defined(MULTIPLICITY)
- sv_catpv(Sv,"\" Compile-time options:");
+ sv_catpv(PL_Sv,"\" Compile-time options:");
# ifdef DEBUGGING
- sv_catpv(Sv," DEBUGGING");
+ sv_catpv(PL_Sv," DEBUGGING");
# endif
# ifdef NO_EMBED
sv_catpv(Sv," NO_EMBED");
# ifdef MULTIPLICITY
sv_catpv(Sv," MULTIPLICITY");
# endif
- sv_catpv(Sv,"\\n\",");
+ sv_catpv(PL_Sv,"\\n\",");
#endif
#if defined(LOCAL_PATCH_COUNT)
if (LOCAL_PATCH_COUNT > 0) {
int i;
- sv_catpv(Sv,"\" Locally applied patches:\\n\",");
+ sv_catpv(PL_Sv,"\" Locally applied patches:\\n\",");
for (i = 1; i <= LOCAL_PATCH_COUNT; i++) {
- if (localpatches[i])
- sv_catpvf(Sv,"\" \\t%s\\n\",",localpatches[i]);
+ if (PL_localpatches[i])
+ sv_catpvf(PL_Sv,"\" \\t%s\\n\",",PL_localpatches[i]);
}
}
#endif
- sv_catpvf(Sv,"\" Built under %s\\n\"",OSNAME);
+ sv_catpvf(PL_Sv,"\" Built under %s\\n\"",OSNAME);
#ifdef __DATE__
# ifdef __TIME__
- sv_catpvf(Sv,",\" Compiled at %s %s\\n\"",__DATE__,__TIME__);
+ sv_catpvf(PL_Sv,",\" Compiled at %s %s\\n\"",__DATE__,__TIME__);
# else
sv_catpvf(Sv,",\" Compiled on %s\\n\"",__DATE__);
# endif
#endif
- sv_catpv(Sv, "; \
+ sv_catpv(PL_Sv, "; \
$\"=\"\\n \"; \
@env = map { \"$_=\\\"$ENV{$_}\\\"\" } sort grep {/^PERL/} keys %ENV; \
print \" \\%ENV:\\n @env\\n\" if @env; \
print \" \\@INC:\\n @INC\\n\";");
}
else {
- Sv = newSVpv("config_vars(qw(",0);
- sv_catpv(Sv, ++s);
- sv_catpv(Sv, "))");
+ PL_Sv = newSVpv("config_vars(qw(",0);
+ sv_catpv(PL_Sv, ++s);
+ sv_catpv(PL_Sv, "))");
s += strlen(s);
}
- av_push(preambleav, Sv);
+ av_push(PL_preambleav, PL_Sv);
scriptname = BIT_BUCKET; /* don't look for script or read stdin */
goto reswitch;
case 'x':
- doextract = TRUE;
+ PL_doextract = TRUE;
s++;
if (*s)
- cddir = savepv(s);
+ PL_cddir = savepv(s);
break;
case 0:
break;
}
switch_end:
- if (!tainting && (s = PerlEnv_getenv("PERL5OPT"))) {
+ if (!PL_tainting && (s = PerlEnv_getenv("PERL5OPT"))) {
while (s && *s) {
while (isSPACE(*s))
s++;
if (!scriptname)
scriptname = argv[0];
- if (e_script) {
+ if (PL_e_script) {
argc++,argv--;
scriptname = BIT_BUCKET; /* don't look for script or read stdin */
}
validate_suid(validarg, scriptname,fdscript);
- if (doextract)
+ if (PL_doextract)
find_beginning();
- main_cv = compcv = (CV*)NEWSV(1104,0);
- sv_upgrade((SV *)compcv, SVt_PVCV);
- CvUNIQUE_on(compcv);
-
- comppad = newAV();
- av_push(comppad, Nullsv);
- curpad = AvARRAY(comppad);
- comppad_name = newAV();
- comppad_name_fill = 0;
- min_intro_pending = 0;
- padix = 0;
+ PL_main_cv = PL_compcv = (CV*)NEWSV(1104,0);
+ sv_upgrade((SV *)PL_compcv, SVt_PVCV);
+ CvUNIQUE_on(PL_compcv);
+
+ PL_comppad = newAV();
+ av_push(PL_comppad, Nullsv);
+ PL_curpad = AvARRAY(PL_comppad);
+ PL_comppad_name = newAV();
+ PL_comppad_name_fill = 0;
+ PL_min_intro_pending = 0;
+ PL_padix = 0;
#ifdef USE_THREADS
av_store(comppad_name, 0, newSVpv("@_", 2));
curpad[0] = (SV*)newAV();
comppadlist = newAV();
AvREAL_off(comppadlist);
- av_store(comppadlist, 0, (SV*)comppad_name);
- av_store(comppadlist, 1, (SV*)comppad);
- CvPADLIST(compcv) = comppadlist;
+ av_store(comppadlist, 0, (SV*)PL_comppad_name);
+ av_store(comppadlist, 1, (SV*)PL_comppad);
+ CvPADLIST(PL_compcv) = comppadlist;
boot_core_UNIVERSAL();
/* init_postdump_symbols not currently designed to be called */
/* more than once (ENV isn't cleared first, for example) */
/* But running with -u leaves %ENV & @ARGV undefined! XXX */
- if (!do_undump)
+ if (!PL_do_undump)
init_postdump_symbols(argc,argv,env);
init_lexer();
/* now parse the script */
SETERRNO(0,SS$_NORMAL);
- error_count = 0;
- if (yyparse() || error_count) {
- if (minus_c)
- croak("%s had compilation errors.\n", origfilename);
+ PL_error_count = 0;
+ if (yyparse() || PL_error_count) {
+ if (PL_minus_c)
+ croak("%s had compilation errors.\n", PL_origfilename);
else {
croak("Execution of %s aborted due to compilation errors.\n",
- origfilename);
+ PL_origfilename);
}
}
- curcop->cop_line = 0;
- curstash = defstash;
- preprocess = FALSE;
- if (e_script) {
- SvREFCNT_dec(e_script);
- e_script = Nullsv;
+ PL_curcop->cop_line = 0;
+ PL_curstash = PL_defstash;
+ PL_preprocess = FALSE;
+ if (PL_e_script) {
+ SvREFCNT_dec(PL_e_script);
+ PL_e_script = Nullsv;
}
/* now that script is parsed, we can modify record separator */
- SvREFCNT_dec(rs);
- rs = SvREFCNT_inc(nrs);
- sv_setsv(perl_get_sv("/", TRUE), rs);
- if (do_undump)
+ SvREFCNT_dec(PL_rs);
+ PL_rs = SvREFCNT_inc(PL_nrs);
+ sv_setsv(perl_get_sv("/", TRUE), PL_rs);
+ if (PL_do_undump)
my_unexec();
- if (dowarn)
- gv_check(defstash);
+ if (PL_dowarn)
+ gv_check(PL_defstash);
LEAVE;
FREETMPS;
#endif
ENTER;
- restartop = 0;
+ PL_restartop = 0;
JMPENV_POP;
return 0;
}
int ret;
#ifndef PERL_OBJECT
- if (!(curinterp = sv_interp))
+ if (!(PL_curinterp = sv_interp))
return 255;
#endif
- oldscope = scopestack_ix;
+ oldscope = PL_scopestack_ix;
JMPENV_PUSH(ret);
switch (ret) {
break;
case 2:
/* my_exit() was called */
- while (scopestack_ix > oldscope)
+ while (PL_scopestack_ix > oldscope)
LEAVE;
FREETMPS;
- curstash = defstash;
- if (endav)
- call_list(oldscope, endav);
+ PL_curstash = PL_defstash;
+ if (PL_endav)
+ call_list(oldscope, PL_endav);
#ifdef MYMALLOC
if (PerlEnv_getenv("PERL_DEBUG_MSTATS"))
dump_mstats("after execution: ");
JMPENV_POP;
return STATUS_NATIVE_EXPORT;
case 3:
- if (!restartop) {
+ if (!PL_restartop) {
PerlIO_printf(PerlIO_stderr(), "panic: restartop\n");
FREETMPS;
JMPENV_POP;
return 1;
}
- POPSTACK_TO(mainstack);
+ POPSTACK_TO(PL_mainstack);
break;
}
DEBUG_r(PerlIO_printf(Perl_debug_log, "%s $` $& $' support.\n",
- sawampersand ? "Enabling" : "Omitting"));
+ PL_sawampersand ? "Enabling" : "Omitting"));
- if (!restartop) {
+ if (!PL_restartop) {
DEBUG_x(dump_all());
DEBUG(PerlIO_printf(Perl_debug_log, "\nEXECUTING...\n\n"));
#ifdef USE_THREADS
(unsigned long) thr));
#endif /* USE_THREADS */
- if (minus_c) {
- PerlIO_printf(PerlIO_stderr(), "%s syntax OK\n", origfilename);
+ if (PL_minus_c) {
+ PerlIO_printf(PerlIO_stderr(), "%s syntax OK\n", PL_origfilename);
my_exit(0);
}
- if (PERLDB_SINGLE && DBsingle)
- sv_setiv(DBsingle, 1);
- if (initav)
- call_list(oldscope, initav);
+ if (PERLDB_SINGLE && PL_DBsingle)
+ sv_setiv(PL_DBsingle, 1);
+ if (PL_initav)
+ call_list(oldscope, PL_initav);
}
/* do it */
- if (restartop) {
- op = restartop;
- restartop = 0;
+ if (PL_restartop) {
+ op = PL_restartop;
+ PL_restartop = 0;
CALLRUNOPS();
}
- else if (main_start) {
- CvDEPTH(main_cv) = 1;
- op = main_start;
+ else if (PL_main_start) {
+ CvDEPTH(PL_main_cv) = 1;
+ op = PL_main_start;
CALLRUNOPS();
}
pp_method(ARGS);
if(op == &myop)
op = Nullop;
- return perl_call_sv(*stack_sp--, flags);
+ return perl_call_sv(*PL_stack_sp--, flags);
}
/* May be called with any of a CV, a GV, or an SV containing the name. */
SAVEOP();
op = (OP*)&myop;
- EXTEND(stack_sp, 1);
- *++stack_sp = sv;
+ EXTEND(PL_stack_sp, 1);
+ *++PL_stack_sp = sv;
oldmark = TOPMARK;
- oldscope = scopestack_ix;
+ oldscope = PL_scopestack_ix;
- if (PERLDB_SUB && curstash != debstash
+ if (PERLDB_SUB && PL_curstash != PL_debstash
/* Handle first BEGIN of -d. */
- && (DBcv || (DBcv = GvCV(DBsub)))
+ && (PL_DBcv || (PL_DBcv = GvCV(PL_DBsub)))
/* Try harder, since this may have been a sighandler, thus
* curstash may be meaningless. */
- && (SvTYPE(sv) != SVt_PVCV || CvSTASH((CV*)sv) != debstash)
+ && (SvTYPE(sv) != SVt_PVCV || CvSTASH((CV*)sv) != PL_debstash)
&& !(flags & G_NODEBUG))
op->op_private |= OPpENTERSUB_DB;
if (flags & G_EVAL) {
cLOGOP->op_other = op;
- markstack_ptr--;
+ PL_markstack_ptr--;
/* we're trying to emulate pp_entertry() here */
{
register PERL_CONTEXT *cx;
SAVETMPS;
push_return(op->op_next);
- PUSHBLOCK(cx, CXt_EVAL, stack_sp);
+ PUSHBLOCK(cx, CXt_EVAL, PL_stack_sp);
PUSHEVAL(cx, 0, 0);
- eval_root = op; /* Only needed so that goto works right. */
+ PL_eval_root = op; /* Only needed so that goto works right. */
- in_eval = 1;
+ PL_in_eval = 1;
if (flags & G_KEEPERR)
- in_eval |= 4;
+ PL_in_eval |= 4;
else
sv_setpv(ERRSV,"");
}
- markstack_ptr++;
+ PL_markstack_ptr++;
JMPENV_PUSH(ret);
switch (ret) {
/* FALL THROUGH */
case 2:
/* my_exit() was called */
- curstash = defstash;
+ PL_curstash = PL_defstash;
FREETMPS;
JMPENV_POP;
- if (statusvalue)
+ if (PL_statusvalue)
croak("Callback called exit");
my_exit_jump();
/* NOTREACHED */
case 3:
- if (restartop) {
- op = restartop;
- restartop = 0;
+ if (PL_restartop) {
+ op = PL_restartop;
+ PL_restartop = 0;
break;
}
- stack_sp = stack_base + oldmark;
+ PL_stack_sp = PL_stack_base + oldmark;
if (flags & G_ARRAY)
retval = 0;
else {
retval = 1;
- *++stack_sp = &sv_undef;
+ *++PL_stack_sp = &PL_sv_undef;
}
goto cleanup;
}
op = pp_entersub(ARGS);
if (op)
CALLRUNOPS();
- retval = stack_sp - (stack_base + oldmark);
+ retval = PL_stack_sp - (PL_stack_base + oldmark);
if ((flags & G_EVAL) && !(flags & G_KEEPERR))
sv_setpv(ERRSV,"");
cleanup:
if (flags & G_EVAL) {
- if (scopestack_ix > oldscope) {
+ if (PL_scopestack_ix > oldscope) {
SV **newsp;
PMOP *newpm;
I32 gimme;
POPBLOCK(cx,newpm);
POPEVAL(cx);
pop_return();
- curpm = newpm;
+ PL_curpm = newpm;
LEAVE;
}
JMPENV_POP;
CATCH_SET(oldcatch);
if (flags & G_DISCARD) {
- stack_sp = stack_base + oldmark;
+ PL_stack_sp = PL_stack_base + oldmark;
retval = 0;
FREETMPS;
LEAVE;
{
dSP;
UNOP myop; /* fake syntax tree node */
- I32 oldmark = SP - stack_base;
+ I32 oldmark = SP - PL_stack_base;
I32 retval;
I32 oldscope;
dJMPENV;
SAVEOP();
op = (OP*)&myop;
Zero(op, 1, UNOP);
- EXTEND(stack_sp, 1);
- *++stack_sp = sv;
- oldscope = scopestack_ix;
+ EXTEND(PL_stack_sp, 1);
+ *++PL_stack_sp = sv;
+ oldscope = PL_scopestack_ix;
if (!(flags & G_NOARGS))
myop.op_flags = OPf_STACKED;
/* FALL THROUGH */
case 2:
/* my_exit() was called */
- curstash = defstash;
+ PL_curstash = PL_defstash;
FREETMPS;
JMPENV_POP;
- if (statusvalue)
+ if (PL_statusvalue)
croak("Callback called exit");
my_exit_jump();
/* NOTREACHED */
case 3:
- if (restartop) {
- op = restartop;
- restartop = 0;
+ if (PL_restartop) {
+ op = PL_restartop;
+ PL_restartop = 0;
break;
}
- stack_sp = stack_base + oldmark;
+ PL_stack_sp = PL_stack_base + oldmark;
if (flags & G_ARRAY)
retval = 0;
else {
retval = 1;
- *++stack_sp = &sv_undef;
+ *++PL_stack_sp = &PL_sv_undef;
}
goto cleanup;
}
op = pp_entereval(ARGS);
if (op)
CALLRUNOPS();
- retval = stack_sp - (stack_base + oldmark);
+ retval = PL_stack_sp - (PL_stack_base + oldmark);
if (!(flags & G_KEEPERR))
sv_setpv(ERRSV,"");
cleanup:
JMPENV_POP;
if (flags & G_DISCARD) {
- stack_sp = stack_base + oldmark;
+ PL_stack_sp = PL_stack_base + oldmark;
retval = 0;
FREETMPS;
LEAVE;
PUTBACK;
if (croak_on_error && SvTRUE(ERRSV))
- croak(SvPVx(ERRSV, na));
+ croak(SvPVx(ERRSV, PL_na));
return sv;
}
{
dTHR;
rschar = scan_oct(s, 4, &numlen);
- SvREFCNT_dec(nrs);
+ SvREFCNT_dec(PL_nrs);
if (rschar & ~((U8)~0))
- nrs = &sv_undef;
+ PL_nrs = &PL_sv_undef;
else if (!rschar && numlen >= 2)
- nrs = newSVpv("", 0);
+ PL_nrs = newSVpv("", 0);
else {
char ch = rschar;
- nrs = newSVpv(&ch, 1);
+ PL_nrs = newSVpv(&ch, 1);
}
return s + numlen;
}
case 'F':
- minus_F = TRUE;
- splitstr = savepv(s + 1);
+ PL_minus_F = TRUE;
+ PL_splitstr = savepv(s + 1);
s += strlen(s);
return s;
case 'a':
- minus_a = TRUE;
+ PL_minus_a = TRUE;
s++;
return s;
case 'c':
- minus_c = TRUE;
+ PL_minus_c = TRUE;
s++;
return s;
case 'd':
my_setenv("PERL5DB", form("use Devel::%s;", ++s));
s += strlen(s);
}
- if (!perldb) {
- perldb = PERLDB_ALL;
+ if (!PL_perldb) {
+ PL_perldb = PERLDB_ALL;
init_debugger();
}
return s;
char *d;
for (s++; *s && (d = strchr(debopts,*s)); s++)
- debug |= 1 << (d - debopts);
+ PL_debug |= 1 << (d - debopts);
}
else {
- debug = atoi(s+1);
+ PL_debug = atoi(s+1);
for (s++; isDIGIT(*s); s++) ;
}
- debug |= 0x80000000;
+ PL_debug |= 0x80000000;
#else
warn("Recompile perl with -DDEBUGGING to use -D switch\n");
for (s++; isALNUM(*s); s++) ;
/*SUPPRESS 530*/
return s;
case 'h':
- usage(origargv[0]);
+ usage(PL_origargv[0]);
PerlProc_exit(0);
case 'i':
- if (inplace)
- Safefree(inplace);
- inplace = savepv(s+1);
+ if (PL_inplace)
+ Safefree(PL_inplace);
+ PL_inplace = savepv(s+1);
/*SUPPRESS 530*/
- for (s = inplace; *s && !isSPACE(*s); s++) ;
+ for (s = PL_inplace; *s && !isSPACE(*s); s++) ;
if (*s) {
*s++ = '\0';
if (*s == '-') /* Additional switches on #! line. */
croak("No space allowed after -I");
return s;
case 'l':
- minus_l = TRUE;
+ PL_minus_l = TRUE;
s++;
- if (ors)
- Safefree(ors);
+ if (PL_ors)
+ Safefree(PL_ors);
if (isDIGIT(*s)) {
- ors = savepv("\n");
- orslen = 1;
- *ors = scan_oct(s, 3 + (*s == '0'), &numlen);
+ PL_ors = savepv("\n");
+ PL_orslen = 1;
+ *PL_ors = scan_oct(s, 3 + (*s == '0'), &numlen);
s += numlen;
}
else {
dTHR;
- if (RsPARA(nrs)) {
- ors = "\n\n";
- orslen = 2;
+ if (RsPARA(PL_nrs)) {
+ PL_ors = "\n\n";
+ PL_orslen = 2;
}
else
- ors = SvPV(nrs, orslen);
- ors = savepvn(ors, orslen);
+ PL_ors = SvPV(PL_nrs, PL_orslen);
+ PL_ors = savepvn(PL_ors, PL_orslen);
}
return s;
case 'M':
sv_catpv(sv, "})");
}
s += strlen(s);
- if (preambleav == NULL)
- preambleav = newAV();
- av_push(preambleav, sv);
+ if (PL_preambleav == NULL)
+ PL_preambleav = newAV();
+ av_push(PL_preambleav, sv);
}
else
croak("No space allowed after -%c", *(s-1));
return s;
case 'n':
- minus_n = TRUE;
+ PL_minus_n = TRUE;
s++;
return s;
case 'p':
- minus_p = TRUE;
+ PL_minus_p = TRUE;
s++;
return s;
case 's':
forbid_setid("-s");
- doswitches = TRUE;
+ PL_doswitches = TRUE;
s++;
return s;
case 'T':
- if (!tainting)
+ if (!PL_tainting)
croak("Too late for \"-T\" option");
s++;
return s;
case 'u':
- do_undump = TRUE;
+ PL_do_undump = TRUE;
s++;
return s;
case 'U':
- unsafe = TRUE;
+ PL_unsafe = TRUE;
s++;
return s;
case 'v':
Internet, point your browser at http://www.perl.com/, the Perl Home Page.\n\n");
PerlProc_exit(0);
case 'w':
- dowarn = TRUE;
+ PL_dowarn = TRUE;
s++;
return s;
case '*':
break;
#endif
case 'P':
- if (preprocess)
+ if (PL_preprocess)
return s+1;
/* FALL THROUGH */
default:
/* Note that strtab is a rather special HV. Assumptions are made
about not iterating on it, and not adding tie magic to it.
It is properly deallocated in perl_destruct() */
- strtab = newHV();
- HvSHAREKEYS_off(strtab); /* mandatory */
- hv_ksplit(strtab, 512);
+ PL_strtab = newHV();
+ HvSHAREKEYS_off(PL_strtab); /* mandatory */
+ hv_ksplit(PL_strtab, 512);
- curstash = defstash = newHV();
- curstname = newSVpv("main",4);
+ PL_curstash = PL_defstash = newHV();
+ PL_curstname = newSVpv("main",4);
gv = gv_fetchpv("main::",TRUE, SVt_PVHV);
SvREFCNT_dec(GvHV(gv));
- GvHV(gv) = (HV*)SvREFCNT_inc(defstash);
+ GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash);
SvREADONLY_on(gv);
- HvNAME(defstash) = savepv("main");
- incgv = gv_HVadd(gv_AVadd(gv_fetchpv("INC",TRUE, SVt_PVAV)));
- GvMULTI_on(incgv);
- hintgv = gv_fetchpv("\010",TRUE, SVt_PV); /* ^H */
- GvMULTI_on(hintgv);
- defgv = gv_fetchpv("_",TRUE, SVt_PVAV);
- errgv = gv_HVadd(gv_fetchpv("@", TRUE, SVt_PV));
- GvMULTI_on(errgv);
- replgv = gv_fetchpv("\022", TRUE, SVt_PV); /* ^R */
- GvMULTI_on(replgv);
+ HvNAME(PL_defstash) = savepv("main");
+ PL_incgv = gv_HVadd(gv_AVadd(gv_fetchpv("INC",TRUE, SVt_PVAV)));
+ GvMULTI_on(PL_incgv);
+ PL_hintgv = gv_fetchpv("\010",TRUE, SVt_PV); /* ^H */
+ GvMULTI_on(PL_hintgv);
+ PL_defgv = gv_fetchpv("_",TRUE, SVt_PVAV);
+ PL_errgv = gv_HVadd(gv_fetchpv("@", TRUE, SVt_PV));
+ GvMULTI_on(PL_errgv);
+ PL_replgv = gv_fetchpv("\022", TRUE, SVt_PV); /* ^R */
+ GvMULTI_on(PL_replgv);
(void)form("%240s",""); /* Preallocate temp - for immediate signals. */
sv_grow(ERRSV, 240); /* Preallocate - for immediate signals. */
sv_setpvn(ERRSV, "", 0);
- curstash = defstash;
- compiling.cop_stash = defstash;
- debstash = GvHV(gv_fetchpv("DB::", GV_ADDMULTI, SVt_PVHV));
- globalstash = GvHV(gv_fetchpv("CORE::GLOBAL::", GV_ADDMULTI, SVt_PVHV));
+ PL_curstash = PL_defstash;
+ PL_compiling.cop_stash = PL_defstash;
+ PL_debstash = GvHV(gv_fetchpv("DB::", GV_ADDMULTI, SVt_PVHV));
+ PL_globalstash = GvHV(gv_fetchpv("CORE::GLOBAL::", GV_ADDMULTI, SVt_PVHV));
/* We must init $/ before switches are processed. */
sv_setpvn(GvSV(gv_fetchpv("/", TRUE, SVt_PV)), "\n", 1);
}
*fdscript = -1;
- if (e_script) {
- origfilename = savepv("-e");
+ if (PL_e_script) {
+ PL_origfilename = savepv("-e");
}
else {
/* if find_script() returns, it returns a malloc()-ed value */
- origfilename = scriptname = find_script(scriptname, dosearch, NULL, 1);
+ PL_origfilename = scriptname = find_script(scriptname, dosearch, NULL, 1);
if (strnEQ(scriptname, "/dev/fd/", 8) && isDIGIT(scriptname[8]) ) {
char *s = scriptname + 8;
s++;
if (*s) {
scriptname = savepv(s + 1);
- Safefree(origfilename);
- origfilename = scriptname;
+ Safefree(PL_origfilename);
+ PL_origfilename = scriptname;
}
}
}
- curcop->cop_filegv = gv_fetchfile(origfilename);
- if (strEQ(origfilename,"-"))
+ PL_curcop->cop_filegv = gv_fetchfile(PL_origfilename);
+ if (strEQ(PL_origfilename,"-"))
scriptname = "";
if (*fdscript >= 0) {
- rsfp = PerlIO_fdopen(*fdscript,PERL_SCRIPT_MODE);
+ PL_rsfp = PerlIO_fdopen(*fdscript,PERL_SCRIPT_MODE);
#if defined(HAS_FCNTL) && defined(F_SETFD)
- if (rsfp)
- fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */
+ if (PL_rsfp)
+ fcntl(PerlIO_fileno(PL_rsfp),F_SETFD,1); /* ensure close-on-exec */
#endif
}
- else if (preprocess) {
+ else if (PL_preprocess) {
char *cpp_cfg = CPPSTDIN;
SV *cpp = newSVpv("",0);
SV *cmd = NEWSV(0,0);
#else
"sed",
#endif
- (doextract ? "-e '1,/^#/d\n'" : ""),
+ (PL_doextract ? "-e '1,/^#/d\n'" : ""),
#endif
scriptname, cpp, sv, CPPMINUS);
- doextract = FALSE;
+ PL_doextract = FALSE;
#ifdef IAMSUID /* actually, this is caught earlier */
if (euid != uid && !euid) { /* if running suidperl */
#ifdef HAS_SETEUID
croak("Can't do seteuid!\n");
}
#endif /* IAMSUID */
- rsfp = PerlProc_popen(SvPVX(cmd), "r");
+ PL_rsfp = PerlProc_popen(SvPVX(cmd), "r");
SvREFCNT_dec(cmd);
SvREFCNT_dec(cpp);
}
else if (!*scriptname) {
forbid_setid("program input from stdin");
- rsfp = PerlIO_stdin();
+ PL_rsfp = PerlIO_stdin();
}
else {
- rsfp = PerlIO_open(scriptname,PERL_SCRIPT_MODE);
+ PL_rsfp = PerlIO_open(scriptname,PERL_SCRIPT_MODE);
#if defined(HAS_FCNTL) && defined(F_SETFD)
- if (rsfp)
- fcntl(PerlIO_fileno(rsfp),F_SETFD,1); /* ensure close-on-exec */
+ if (PL_rsfp)
+ fcntl(PerlIO_fileno(PL_rsfp),F_SETFD,1); /* ensure close-on-exec */
#endif
}
- if (!rsfp) {
+ if (!PL_rsfp) {
#ifdef DOSUID
#ifndef IAMSUID /* in case script is not readable before setuid */
if (euid && PerlLIO_stat(SvPVX(GvSV(curcop->cop_filegv)),&statbuf) >= 0 &&
#endif
#endif
croak("Can't open perl script \"%s\": %s\n",
- SvPVX(GvSV(curcop->cop_filegv)), Strerror(errno));
+ SvPVX(GvSV(PL_curcop->cop_filegv)), Strerror(errno));
}
}
croak("Can't do setuid\n");
#endif /* IAMSUID */
#else /* !DOSUID */
- if (euid != uid || egid != gid) { /* (suidperl doesn't exist, in fact) */
+ if (PL_euid != PL_uid || PL_egid != PL_gid) { /* (suidperl doesn't exist, in fact) */
#ifndef SETUID_SCRIPTS_ARE_SECURE_NOW
dTHR;
PerlLIO_fstat(PerlIO_fileno(rsfp),&statbuf); /* may be either wrapped or real suid */
/* skip forward in input to the real script? */
forbid_setid("-x");
- while (doextract) {
- if ((s = sv_gets(linestr, rsfp, 0)) == Nullch)
+ while (PL_doextract) {
+ if ((s = sv_gets(PL_linestr, PL_rsfp, 0)) == Nullch)
croak("No Perl script found in input\n");
if (*s == '#' && s[1] == '!' && (s = instr(s,"perl"))) {
- PerlIO_ungetc(rsfp, '\n'); /* to keep line count right */
- doextract = FALSE;
+ PerlIO_ungetc(PL_rsfp, '\n'); /* to keep line count right */
+ PL_doextract = FALSE;
while (*s && !(isSPACE (*s) || *s == '#')) s++;
s2 = s;
while (*s == ' ' || *s == '\t') s++;
/*SUPPRESS 530*/
while (s = moreswitches(s)) ;
}
- if (cddir && PerlDir_chdir(cddir) < 0)
- croak("Can't chdir to %s",cddir);
+ if (PL_cddir && PerlDir_chdir(PL_cddir) < 0)
+ croak("Can't chdir to %s",PL_cddir);
}
}
}
STATIC void
init_ids(void)
{
- uid = (int)PerlProc_getuid();
- euid = (int)PerlProc_geteuid();
- gid = (int)PerlProc_getgid();
- egid = (int)PerlProc_getegid();
+ PL_uid = (int)PerlProc_getuid();
+ PL_euid = (int)PerlProc_geteuid();
+ PL_gid = (int)PerlProc_getgid();
+ PL_egid = (int)PerlProc_getegid();
#ifdef VMS
uid |= gid << 16;
euid |= egid << 16;
#endif
- tainting |= (uid && (euid != uid || egid != gid));
+ PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
}
STATIC void
forbid_setid(char *s)
{
- if (euid != uid)
+ if (PL_euid != PL_uid)
croak("No %s allowed while running setuid", s);
- if (egid != gid)
+ if (PL_egid != PL_gid)
croak("No %s allowed while running setgid", s);
}
init_debugger(void)
{
dTHR;
- curstash = debstash;
- dbargs = GvAV(gv_AVadd((gv_fetchpv("args", GV_ADDMULTI, SVt_PVAV))));
- AvREAL_off(dbargs);
- DBgv = gv_fetchpv("DB", GV_ADDMULTI, SVt_PVGV);
- DBline = gv_fetchpv("dbline", GV_ADDMULTI, SVt_PVAV);
- DBsub = gv_HVadd(gv_fetchpv("sub", GV_ADDMULTI, SVt_PVHV));
- DBsingle = GvSV((gv_fetchpv("single", GV_ADDMULTI, SVt_PV)));
- sv_setiv(DBsingle, 0);
- DBtrace = GvSV((gv_fetchpv("trace", GV_ADDMULTI, SVt_PV)));
- sv_setiv(DBtrace, 0);
- DBsignal = GvSV((gv_fetchpv("signal", GV_ADDMULTI, SVt_PV)));
- sv_setiv(DBsignal, 0);
- curstash = defstash;
+ PL_curstash = PL_debstash;
+ PL_dbargs = GvAV(gv_AVadd((gv_fetchpv("args", GV_ADDMULTI, SVt_PVAV))));
+ AvREAL_off(PL_dbargs);
+ PL_DBgv = gv_fetchpv("DB", GV_ADDMULTI, SVt_PVGV);
+ PL_DBline = gv_fetchpv("dbline", GV_ADDMULTI, SVt_PVAV);
+ PL_DBsub = gv_HVadd(gv_fetchpv("sub", GV_ADDMULTI, SVt_PVHV));
+ PL_DBsingle = GvSV((gv_fetchpv("single", GV_ADDMULTI, SVt_PV)));
+ sv_setiv(PL_DBsingle, 0);
+ PL_DBtrace = GvSV((gv_fetchpv("trace", GV_ADDMULTI, SVt_PV)));
+ sv_setiv(PL_DBtrace, 0);
+ PL_DBsignal = GvSV((gv_fetchpv("signal", GV_ADDMULTI, SVt_PV)));
+ sv_setiv(PL_DBsignal, 0);
+ PL_curstash = PL_defstash;
}
#ifndef STRESS_REALLOC
init_stacks(ARGSproto)
{
/* start with 128-item stack and 8K cxstack */
- curstackinfo = new_stackinfo(REASONABLE(128),
+ PL_curstackinfo = new_stackinfo(REASONABLE(128),
REASONABLE(8192/sizeof(PERL_CONTEXT) - 1));
- curstackinfo->si_type = PERLSI_MAIN;
- curstack = curstackinfo->si_stack;
- mainstack = curstack; /* remember in case we switch stacks */
+ PL_curstackinfo->si_type = PERLSI_MAIN;
+ PL_curstack = PL_curstackinfo->si_stack;
+ PL_mainstack = PL_curstack; /* remember in case we switch stacks */
- stack_base = AvARRAY(curstack);
- stack_sp = stack_base;
- stack_max = stack_base + AvMAX(curstack);
+ PL_stack_base = AvARRAY(PL_curstack);
+ PL_stack_sp = PL_stack_base;
+ PL_stack_max = PL_stack_base + AvMAX(PL_curstack);
- New(50,tmps_stack,REASONABLE(128),SV*);
- tmps_floor = -1;
- tmps_ix = -1;
- tmps_max = REASONABLE(128);
+ New(50,PL_tmps_stack,REASONABLE(128),SV*);
+ PL_tmps_floor = -1;
+ PL_tmps_ix = -1;
+ PL_tmps_max = REASONABLE(128);
- New(54,markstack,REASONABLE(32),I32);
- markstack_ptr = markstack;
- markstack_max = markstack + REASONABLE(32);
+ New(54,PL_markstack,REASONABLE(32),I32);
+ PL_markstack_ptr = PL_markstack;
+ PL_markstack_max = PL_markstack + REASONABLE(32);
SET_MARKBASE;
- New(54,scopestack,REASONABLE(32),I32);
- scopestack_ix = 0;
- scopestack_max = REASONABLE(32);
+ New(54,PL_scopestack,REASONABLE(32),I32);
+ PL_scopestack_ix = 0;
+ PL_scopestack_max = REASONABLE(32);
- New(54,savestack,REASONABLE(128),ANY);
- savestack_ix = 0;
- savestack_max = REASONABLE(128);
+ New(54,PL_savestack,REASONABLE(128),ANY);
+ PL_savestack_ix = 0;
+ PL_savestack_max = REASONABLE(128);
- New(54,retstack,REASONABLE(16),OP*);
- retstack_ix = 0;
- retstack_max = REASONABLE(16);
+ New(54,PL_retstack,REASONABLE(16),OP*);
+ PL_retstack_ix = 0;
+ PL_retstack_max = REASONABLE(16);
}
#undef REASONABLE
nuke_stacks(void)
{
dTHR;
- while (curstackinfo->si_next)
- curstackinfo = curstackinfo->si_next;
- while (curstackinfo) {
- PERL_SI *p = curstackinfo->si_prev;
+ while (PL_curstackinfo->si_next)
+ PL_curstackinfo = PL_curstackinfo->si_next;
+ while (PL_curstackinfo) {
+ PERL_SI *p = PL_curstackinfo->si_prev;
/* curstackinfo->si_stack got nuked by sv_free_arenas() */
- Safefree(curstackinfo->si_cxstack);
- Safefree(curstackinfo);
- curstackinfo = p;
+ Safefree(PL_curstackinfo->si_cxstack);
+ Safefree(PL_curstackinfo);
+ PL_curstackinfo = p;
}
- Safefree(tmps_stack);
- Safefree(markstack);
- Safefree(scopestack);
- Safefree(savestack);
- Safefree(retstack);
+ Safefree(PL_tmps_stack);
+ Safefree(PL_markstack);
+ Safefree(PL_scopestack);
+ Safefree(PL_savestack);
+ Safefree(PL_retstack);
DEBUG( {
- Safefree(debname);
- Safefree(debdelim);
+ Safefree(PL_debname);
+ Safefree(PL_debdelim);
} )
}
#ifdef PERL_OBJECT
PerlIO *tmpfp;
#endif
- tmpfp = rsfp;
- rsfp = Nullfp;
- lex_start(linestr);
- rsfp = tmpfp;
- subname = newSVpv("main",4);
+ tmpfp = PL_rsfp;
+ PL_rsfp = Nullfp;
+ lex_start(PL_linestr);
+ PL_rsfp = tmpfp;
+ PL_subname = newSVpv("main",4);
}
STATIC void
GV *othergv;
sv_setpvn(perl_get_sv("\"", TRUE), " ", 1);
- stdingv = gv_fetchpv("STDIN",TRUE, SVt_PVIO);
- GvMULTI_on(stdingv);
- IoIFP(GvIOp(stdingv)) = PerlIO_stdin();
+ PL_stdingv = gv_fetchpv("STDIN",TRUE, SVt_PVIO);
+ GvMULTI_on(PL_stdingv);
+ IoIFP(GvIOp(PL_stdingv)) = PerlIO_stdin();
tmpgv = gv_fetchpv("stdin",TRUE, SVt_PV);
GvMULTI_on(tmpgv);
- GvIOp(tmpgv) = (IO*)SvREFCNT_inc(GvIOp(stdingv));
+ GvIOp(tmpgv) = (IO*)SvREFCNT_inc(GvIOp(PL_stdingv));
tmpgv = gv_fetchpv("STDOUT",TRUE, SVt_PVIO);
GvMULTI_on(tmpgv);
setdefout(tmpgv);
tmpgv = gv_fetchpv("stdout",TRUE, SVt_PV);
GvMULTI_on(tmpgv);
- GvIOp(tmpgv) = (IO*)SvREFCNT_inc(GvIOp(defoutgv));
+ GvIOp(tmpgv) = (IO*)SvREFCNT_inc(GvIOp(PL_defoutgv));
othergv = gv_fetchpv("STDERR",TRUE, SVt_PVIO);
GvMULTI_on(othergv);
GvMULTI_on(tmpgv);
GvIOp(tmpgv) = (IO*)SvREFCNT_inc(GvIOp(othergv));
- statname = NEWSV(66,0); /* last filename we did stat on */
+ PL_statname = NEWSV(66,0); /* last filename we did stat on */
- if (!osname)
- osname = savepv(OSNAME);
+ if (!PL_osname)
+ PL_osname = savepv(OSNAME);
}
STATIC void
GV* tmpgv;
argc--,argv++; /* skip name of script */
- if (doswitches) {
+ if (PL_doswitches) {
for (; argc > 0 && **argv == '-'; argc--,argv++) {
if (!argv[0][1])
break;
sv_setiv(GvSV(gv_fetchpv(argv[0]+1,TRUE, SVt_PV)),1);
}
}
- toptarget = NEWSV(0,0);
- sv_upgrade(toptarget, SVt_PVFM);
- sv_setpvn(toptarget, "", 0);
- bodytarget = NEWSV(0,0);
- sv_upgrade(bodytarget, SVt_PVFM);
- sv_setpvn(bodytarget, "", 0);
- formtarget = bodytarget;
+ PL_toptarget = NEWSV(0,0);
+ sv_upgrade(PL_toptarget, SVt_PVFM);
+ sv_setpvn(PL_toptarget, "", 0);
+ PL_bodytarget = NEWSV(0,0);
+ sv_upgrade(PL_bodytarget, SVt_PVFM);
+ sv_setpvn(PL_bodytarget, "", 0);
+ PL_formtarget = PL_bodytarget;
TAINT;
if (tmpgv = gv_fetchpv("0",TRUE, SVt_PV)) {
- sv_setpv(GvSV(tmpgv),origfilename);
+ sv_setpv(GvSV(tmpgv),PL_origfilename);
magicname("0", "0", 1);
}
if (tmpgv = gv_fetchpv("\030",TRUE, SVt_PV))
- sv_setpv(GvSV(tmpgv),origargv[0]);
- if (argvgv = gv_fetchpv("ARGV",TRUE, SVt_PVAV)) {
- GvMULTI_on(argvgv);
- (void)gv_AVadd(argvgv);
- av_clear(GvAVn(argvgv));
+ sv_setpv(GvSV(tmpgv),PL_origargv[0]);
+ if (PL_argvgv = gv_fetchpv("ARGV",TRUE, SVt_PVAV)) {
+ GvMULTI_on(PL_argvgv);
+ (void)gv_AVadd(PL_argvgv);
+ av_clear(GvAVn(PL_argvgv));
for (; argc > 0; argc--,argv++) {
- av_push(GvAVn(argvgv),newSVpv(argv[0],0));
+ av_push(GvAVn(PL_argvgv),newSVpv(argv[0],0));
}
}
- if (envgv = gv_fetchpv("ENV",TRUE, SVt_PVHV)) {
+ if (PL_envgv = gv_fetchpv("ENV",TRUE, SVt_PVHV)) {
HV *hv;
- GvMULTI_on(envgv);
- hv = GvHVn(envgv);
- hv_magic(hv, envgv, 'E');
+ GvMULTI_on(PL_envgv);
+ hv = GvHVn(PL_envgv);
+ hv_magic(hv, PL_envgv, 'E');
#ifndef VMS /* VMS doesn't have environ array */
/* Note that if the supplied env parameter is actually a copy
of the global environ then it may now point to free'd memory
init_perllib(void)
{
char *s;
- if (!tainting) {
+ if (!PL_tainting) {
#ifndef VMS
s = PerlEnv_getenv("PERL5LIB");
if (s)
incpush(SITELIB_EXP, FALSE);
#endif
#endif
- if (!tainting)
+ if (!PL_tainting)
incpush(".", FALSE);
}
if (addsubdirs) {
subdir = sv_newmortal();
- if (!archpat_auto) {
- STRLEN len = (sizeof(ARCHNAME) + strlen(patchlevel)
+ if (!PL_archpat_auto) {
+ STRLEN len = (sizeof(ARCHNAME) + strlen(PL_patchlevel)
+ sizeof("//auto"));
- New(55, archpat_auto, len, char);
- sprintf(archpat_auto, "/%s/%s/auto", ARCHNAME, patchlevel);
+ New(55, PL_archpat_auto, len, char);
+ sprintf(PL_archpat_auto, "/%s/%s/auto", ARCHNAME, PL_patchlevel);
#ifdef VMS
for (len = sizeof(ARCHNAME) + 2;
archpat_auto[len] != '\0' && archpat_auto[len] != '/'; len++)
#endif
/* .../archname/version if -d .../archname/version/auto */
sv_setsv(subdir, libdir);
- sv_catpv(subdir, archpat_auto);
+ sv_catpv(subdir, PL_archpat_auto);
if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 &&
S_ISDIR(tmpstatbuf.st_mode))
- av_push(GvAVn(incgv),
+ av_push(GvAVn(PL_incgv),
newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto"));
/* .../archname if -d .../archname/auto */
sv_insert(subdir, SvCUR(libdir) + sizeof(ARCHNAME),
- strlen(patchlevel) + 1, "", 0);
+ strlen(PL_patchlevel) + 1, "", 0);
if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 &&
S_ISDIR(tmpstatbuf.st_mode))
- av_push(GvAVn(incgv),
+ av_push(GvAVn(PL_incgv),
newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto"));
}
/* finally push this lib directory on the end of @INC */
- av_push(GvAVn(incgv), libdir);
+ av_push(GvAVn(PL_incgv), libdir);
}
}
call_list(I32 oldscope, AV *paramList)
{
dTHR;
- line_t oldline = curcop->cop_line;
+ line_t oldline = PL_curcop->cop_line;
STRLEN len;
dJMPENV;
int ret;
switch (ret) {
case 0: {
SV* atsv = ERRSV;
- PUSHMARK(stack_sp);
+ PUSHMARK(PL_stack_sp);
perl_call_sv((SV*)cv, G_EVAL|G_DISCARD);
(void)SvPV(atsv, len);
if (len) {
JMPENV_POP;
- curcop = &compiling;
- curcop->cop_line = oldline;
- if (paramList == beginav)
+ PL_curcop = &PL_compiling;
+ PL_curcop->cop_line = oldline;
+ if (paramList == PL_beginav)
sv_catpv(atsv, "BEGIN failed--compilation aborted");
else
sv_catpv(atsv, "END failed--cleanup aborted");
- while (scopestack_ix > oldscope)
+ while (PL_scopestack_ix > oldscope)
LEAVE;
croak("%s", SvPVX(atsv));
}
/* FALL THROUGH */
case 2:
/* my_exit() was called */
- while (scopestack_ix > oldscope)
+ while (PL_scopestack_ix > oldscope)
LEAVE;
FREETMPS;
- curstash = defstash;
- if (endav)
- call_list(oldscope, endav);
+ PL_curstash = PL_defstash;
+ if (PL_endav)
+ call_list(oldscope, PL_endav);
JMPENV_POP;
- curcop = &compiling;
- curcop->cop_line = oldline;
- if (statusvalue) {
- if (paramList == beginav)
+ PL_curcop = &PL_compiling;
+ PL_curcop->cop_line = oldline;
+ if (PL_statusvalue) {
+ if (paramList == PL_beginav)
croak("BEGIN failed--compilation aborted");
else
croak("END failed--cleanup aborted");
my_exit_jump();
/* NOTREACHED */
case 3:
- if (!restartop) {
+ if (!PL_restartop) {
PerlIO_printf(PerlIO_stderr(), "panic: restartop\n");
FREETMPS;
break;
}
JMPENV_POP;
- curcop = &compiling;
- curcop->cop_line = oldline;
+ PL_curcop = &PL_compiling;
+ PL_curcop->cop_line = oldline;
JMPENV_JUMP(3);
}
JMPENV_POP;
I32 gimme;
SV **newsp;
- if (e_script) {
- SvREFCNT_dec(e_script);
- e_script = Nullsv;
+ if (PL_e_script) {
+ SvREFCNT_dec(PL_e_script);
+ PL_e_script = Nullsv;
}
- POPSTACK_TO(mainstack);
+ POPSTACK_TO(PL_mainstack);
if (cxstack_ix >= 0) {
if (cxstack_ix > 0)
dounwind(0);
- POPBLOCK(cx,curpm);
+ POPBLOCK(cx,PL_curpm);
LEAVE;
}
#endif
{
char *p, *nl;
- p = SvPVX(e_script);
+ p = SvPVX(PL_e_script);
nl = strchr(p, '\n');
- nl = (nl) ? nl+1 : SvEND(e_script);
+ nl = (nl) ? nl+1 : SvEND(PL_e_script);
if (nl-p == 0)
return 0;
sv_catpvn(buf_sv, p, nl-p);
- sv_chop(e_script, nl);
+ sv_chop(PL_e_script, nl);
return 1;
}
#define PERL_OBJECT_THIS
#define _PERL_OBJECT_THIS
#define PERL_OBJECT_THIS_
-#define CALLRUNOPS runops
-#define CALLREGCOMP (*regcompp)
-#define CALLREGEXEC (*regexecp)
+#define CALLRUNOPS PL_runops
+#define CALLREGCOMP (*PL_regcompp)
+#define CALLREGEXEC (*PL_regexecp)
#endif /* PERL_OBJECT */
# define VOL
#endif
-#define TAINT (tainted = TRUE)
-#define TAINT_NOT (tainted = FALSE)
-#define TAINT_IF(c) if (c) { tainted = TRUE; }
-#define TAINT_ENV() if (tainting) { taint_env(); }
-#define TAINT_PROPER(s) if (tainting) { taint_proper(no_security, s); }
+#define TAINT (PL_tainted = TRUE)
+#define TAINT_NOT (PL_tainted = FALSE)
+#define TAINT_IF(c) if (c) { PL_tainted = TRUE; }
+#define TAINT_ENV() if (PL_tainting) { taint_env(); }
+#define TAINT_PROPER(s) if (PL_tainting) { taint_proper(no_security, s); }
/* XXX All process group stuff is handled in pp_sys.c. Should these
defines move there? If so, I could simplify this a lot. --AD 9/96.
# define DEFSV THREADSV(0)
# define SAVE_DEFSV save_threadsv(0)
#else
-# define ERRSV GvSV(errgv)
-# define ERRHV GvHV(errgv)
-# define DEFSV GvSV(defgv)
-# define SAVE_DEFSV SAVESPTR(GvSV(defgv))
+# define ERRSV GvSV(PL_errgv)
+# define ERRHV GvHV(PL_errgv)
+# define DEFSV GvSV(PL_defgv)
+# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
#endif /* USE_THREADS */
#ifndef errno
#endif
#define FILTER_READ(idx, sv, len) filter_read(idx, sv, len)
-#define FILTER_DATA(idx) (AvARRAY(rsfp_filters)[idx])
-#define FILTER_ISREADER(idx) (idx >= AvFILLp(rsfp_filters))
+#define FILTER_DATA(idx) (AvARRAY(PL_rsfp_filters)[idx])
+#define FILTER_ISREADER(idx) (idx >= AvFILLp(PL_rsfp_filters))
#ifdef DOSISH
# if defined(OS2)
STMT_START { \
statusvalue_vms = (n); \
if ((I32)statusvalue_vms == -1) \
- statusvalue = -1; \
+ PL_statusvalue = -1; \
else if (statusvalue_vms & STS$M_SUCCESS) \
- statusvalue = 0; \
+ PL_statusvalue = 0; \
else if ((statusvalue_vms & STS$M_SEVERITY) == 0) \
- statusvalue = 1 << 8; \
+ PL_statusvalue = 1 << 8; \
else \
- statusvalue = (statusvalue_vms & STS$M_SEVERITY) << 8; \
+ PL_statusvalue = (statusvalue_vms & STS$M_SEVERITY) << 8; \
} STMT_END
-# define STATUS_POSIX statusvalue
+# define STATUS_POSIX PL_statusvalue
# ifdef VMSISH_STATUS
# define STATUS_CURRENT (VMSISH_STATUS ? STATUS_NATIVE : STATUS_POSIX)
# else
# endif
# define STATUS_POSIX_SET(n) \
STMT_START { \
- statusvalue = (n); \
- if (statusvalue != -1) { \
- statusvalue &= 0xFFFF; \
- statusvalue_vms = statusvalue ? 44 : 1; \
+ PL_statusvalue = (n); \
+ if (PL_statusvalue != -1) { \
+ PL_statusvalue &= 0xFFFF; \
+ statusvalue_vms = PL_statusvalue ? 44 : 1; \
} \
else statusvalue_vms = -1; \
} STMT_END
-# define STATUS_ALL_SUCCESS (statusvalue = 0, statusvalue_vms = 1)
-# define STATUS_ALL_FAILURE (statusvalue = 1, statusvalue_vms = 44)
+# define STATUS_ALL_SUCCESS (PL_statusvalue = 0, statusvalue_vms = 1)
+# define STATUS_ALL_FAILURE (PL_statusvalue = 1, statusvalue_vms = 44)
#else
# define STATUS_NATIVE STATUS_POSIX
# define STATUS_NATIVE_EXPORT STATUS_POSIX
# define STATUS_NATIVE_SET STATUS_POSIX_SET
-# define STATUS_POSIX statusvalue
+# define STATUS_POSIX PL_statusvalue
# define STATUS_POSIX_SET(n) \
STMT_START { \
- statusvalue = (n); \
- if (statusvalue != -1) \
- statusvalue &= 0xFFFF; \
+ PL_statusvalue = (n); \
+ if (PL_statusvalue != -1) \
+ PL_statusvalue &= 0xFFFF; \
} STMT_END
# define STATUS_CURRENT STATUS_POSIX
-# define STATUS_ALL_SUCCESS (statusvalue = 0)
-# define STATUS_ALL_FAILURE (statusvalue = 1)
+# define STATUS_ALL_SUCCESS (PL_statusvalue = 0)
+# define STATUS_ALL_FAILURE (PL_statusvalue = 1)
#endif
/* Some unistd.h's give a prototype for pause() even though
#endif
#define YYDEBUG 1
#define DEB(a) a
-#define DEBUG(a) if (debug) a
-#define DEBUG_p(a) if (debug & 1) a
-#define DEBUG_s(a) if (debug & 2) a
-#define DEBUG_l(a) if (debug & 4) a
-#define DEBUG_t(a) if (debug & 8) a
-#define DEBUG_o(a) if (debug & 16) a
-#define DEBUG_c(a) if (debug & 32) a
-#define DEBUG_P(a) if (debug & 64) a
-#define DEBUG_m(a) if (curinterp && debug & 128) a
-#define DEBUG_f(a) if (debug & 256) a
-#define DEBUG_r(a) if (debug & 512) a
-#define DEBUG_x(a) if (debug & 1024) a
-#define DEBUG_u(a) if (debug & 2048) a
-#define DEBUG_L(a) if (debug & 4096) a
-#define DEBUG_H(a) if (debug & 8192) a
-#define DEBUG_X(a) if (debug & 16384) a
-#define DEBUG_D(a) if (debug & 32768) a
+#define DEBUG(a) if (PL_debug) a
+#define DEBUG_p(a) if (PL_debug & 1) a
+#define DEBUG_s(a) if (PL_debug & 2) a
+#define DEBUG_l(a) if (PL_debug & 4) a
+#define DEBUG_t(a) if (PL_debug & 8) a
+#define DEBUG_o(a) if (PL_debug & 16) a
+#define DEBUG_c(a) if (PL_debug & 32) a
+#define DEBUG_P(a) if (PL_debug & 64) a
+#define DEBUG_m(a) if (PL_curinterp && PL_debug & 128) a
+#define DEBUG_f(a) if (PL_debug & 256) a
+#define DEBUG_r(a) if (PL_debug & 512) a
+#define DEBUG_x(a) if (PL_debug & 1024) a
+#define DEBUG_u(a) if (PL_debug & 2048) a
+#define DEBUG_L(a) if (PL_debug & 4096) a
+#define DEBUG_H(a) if (PL_debug & 8192) a
+#define DEBUG_X(a) if (PL_debug & 16384) a
+#define DEBUG_D(a) if (PL_debug & 32768) a
#else
#define DEB(a)
#define DEBUG(a)
#define PERLDBf_NONAME 0x40 /* For _SUB: no name of the subr. */
#define PERLDBf_GOTO 0x80 /* Report goto: call DB::goto. */
-#define PERLDB_SUB (perldb && (perldb & PERLDBf_SUB))
-#define PERLDB_LINE (perldb && (perldb & PERLDBf_LINE))
-#define PERLDB_NOOPT (perldb && (perldb & PERLDBf_NOOPT))
-#define PERLDB_INTER (perldb && (perldb & PERLDBf_INTER))
-#define PERLDB_SUBLINE (perldb && (perldb & PERLDBf_SUBLINE))
-#define PERLDB_SINGLE (perldb && (perldb & PERLDBf_SINGLE))
-#define PERLDB_SUB_NN (perldb && (perldb & (PERLDBf_NONAME)))
-#define PERLDB_GOTO (perldb && (perldb & PERLDBf_GOTO))
+#define PERLDB_SUB (PL_perldb && (PL_perldb & PERLDBf_SUB))
+#define PERLDB_LINE (PL_perldb && (PL_perldb & PERLDBf_LINE))
+#define PERLDB_NOOPT (PL_perldb && (PL_perldb & PERLDBf_NOOPT))
+#define PERLDB_INTER (PL_perldb && (PL_perldb & PERLDBf_INTER))
+#define PERLDB_SUBLINE (PL_perldb && (PL_perldb & PERLDBf_SUBLINE))
+#define PERLDB_SINGLE (PL_perldb && (PL_perldb & PERLDBf_SINGLE))
+#define PERLDB_SUB_NN (PL_perldb && (PL_perldb & (PERLDBf_NONAME)))
+#define PERLDB_GOTO (PL_perldb && (PL_perldb & PERLDBf_GOTO))
#ifdef USE_LOCALE_NUMERIC
#define SET_NUMERIC_STANDARD() \
STMT_START { \
- if (! numeric_standard) \
+ if (! PL_numeric_standard) \
perl_set_numeric_standard(); \
} STMT_END
#define SET_NUMERIC_LOCAL() \
STMT_START { \
- if (! numeric_local) \
+ if (! PL_numeric_local) \
perl_set_numeric_local(); \
} STMT_END
*/
#define offer_nice_chunk(chunk, chunk_size) do { \
LOCK_SV_MUTEX; \
- if (!nice_chunk) { \
- nice_chunk = (char*)(chunk); \
- nice_chunk_size = (chunk_size); \
+ if (!PL_nice_chunk) { \
+ PL_nice_chunk = (char*)(chunk); \
+ PL_nice_chunk_size = (chunk_size); \
} \
else { \
Safefree(chunk); \
#line 86 "perly.y"
{
#if defined(YYDEBUG) && defined(DEBUGGING)
- yydebug = (debug & 1);
+ yydebug = (PL_debug & 1);
#endif
- expect = XSTATE;
+ PL_expect = XSTATE;
}
break;
case 2:
break;
case 3:
#line 97 "perly.y"
-{ if (copline > (line_t)yyvsp[-3].ival)
- copline = yyvsp[-3].ival;
+{ if (PL_copline > (line_t)yyvsp[-3].ival)
+ PL_copline = yyvsp[-3].ival;
yyval.opval = block_end(yyvsp[-2].ival, yyvsp[-1].opval); }
break;
case 4:
break;
case 5:
#line 107 "perly.y"
-{ if (copline > (line_t)yyvsp[-3].ival)
- copline = yyvsp[-3].ival;
+{ if (PL_copline > (line_t)yyvsp[-3].ival)
+ PL_copline = yyvsp[-3].ival;
yyval.opval = block_end(yyvsp[-2].ival, yyvsp[-1].opval); }
break;
case 6:
#line 121 "perly.y"
{ yyval.opval = append_list(OP_LINESEQ,
(LISTOP*)yyvsp[-1].opval, (LISTOP*)yyvsp[0].opval);
- pad_reset_pending = TRUE;
- if (yyvsp[-1].opval && yyvsp[0].opval) hints |= HINT_BLOCK_SCOPE; }
+ PL_pad_reset_pending = TRUE;
+ if (yyvsp[-1].opval && yyvsp[0].opval) PL_hints |= HINT_BLOCK_SCOPE; }
break;
case 10:
#line 128 "perly.y"
}
else {
yyval.opval = Nullop;
- copline = NOLINE;
+ PL_copline = NOLINE;
}
- expect = XSTATE; }
+ PL_expect = XSTATE; }
break;
case 13:
#line 140 "perly.y"
{ yyval.opval = newSTATEOP(0, yyvsp[-2].pval, yyvsp[-1].opval);
- expect = XSTATE; }
+ PL_expect = XSTATE; }
break;
case 14:
#line 145 "perly.y"
break;
case 23:
#line 166 "perly.y"
-{ copline = yyvsp[-5].ival;
+{ PL_copline = yyvsp[-5].ival;
yyval.opval = newSTATEOP(0, Nullch,
newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval));
- hints |= HINT_BLOCK_SCOPE; }
+ PL_hints |= HINT_BLOCK_SCOPE; }
break;
case 24:
#line 173 "perly.y"
-{ copline = yyvsp[-6].ival;
+{ PL_copline = yyvsp[-6].ival;
yyval.opval = block_end(yyvsp[-4].ival,
newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval)); }
break;
case 25:
#line 177 "perly.y"
-{ copline = yyvsp[-6].ival;
+{ PL_copline = yyvsp[-6].ival;
yyval.opval = block_end(yyvsp[-4].ival,
newCONDOP(0, yyvsp[-3].opval, scope(yyvsp[-1].opval), yyvsp[0].opval)); }
break;
break;
case 28:
#line 189 "perly.y"
-{ copline = yyvsp[-6].ival;
+{ PL_copline = yyvsp[-6].ival;
yyval.opval = block_end(yyvsp[-4].ival,
newSTATEOP(0, yyvsp[-7].pval,
newWHILEOP(0, 1, (LOOP*)Nullop,
break;
case 29:
#line 195 "perly.y"
-{ copline = yyvsp[-6].ival;
+{ PL_copline = yyvsp[-6].ival;
yyval.opval = block_end(yyvsp[-4].ival,
newSTATEOP(0, yyvsp[-7].pval,
newWHILEOP(0, 1, (LOOP*)Nullop,
newWHILEOP(0, 1, (LOOP*)Nullop,
yyvsp[-9].ival, scalar(yyvsp[-4].opval),
yyvsp[0].opval, scalar(yyvsp[-2].opval)));
- copline = yyvsp[-9].ival;
+ PL_copline = yyvsp[-9].ival;
yyval.opval = block_end(yyvsp[-7].ival, newSTATEOP(0, yyvsp[-10].pval, forop)); }
break;
case 34:
break;
case 57:
#line 294 "perly.y"
-{ char *name = SvPV(((SVOP*)yyvsp[0].opval)->op_sv, na);
+{ char *name = SvPV(((SVOP*)yyvsp[0].opval)->op_sv, PL_na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ CvUNIQUE_on(PL_compcv);
yyval.opval = yyvsp[0].opval; }
break;
case 58:
break;
case 61:
#line 307 "perly.y"
-{ yyval.opval = Nullop; expect = XSTATE; }
+{ yyval.opval = Nullop; PL_expect = XSTATE; }
break;
case 62:
#line 311 "perly.y"
break;
case 64:
#line 317 "perly.y"
-{ CvUNIQUE_on(compcv); /* It's a BEGIN {} */ }
+{ CvUNIQUE_on(PL_compcv); /* It's a BEGIN {} */ }
break;
case 65:
#line 319 "perly.y"
case 123:
#line 465 "perly.y"
{ yyval.opval = newBINOP(OP_HELEM, 0, oopsHV(yyvsp[-4].opval), jmaybe(yyvsp[-2].opval));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
break;
case 124:
#line 468 "perly.y"
{ yyval.opval = newBINOP(OP_HELEM, 0,
ref(newHVREF(yyvsp[-5].opval),OP_RV2HV),
jmaybe(yyvsp[-2].opval));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
break;
case 125:
#line 473 "perly.y"
{ assertref(yyvsp[-4].opval); yyval.opval = newBINOP(OP_HELEM, 0,
ref(newHVREF(yyvsp[-4].opval),OP_RV2HV),
jmaybe(yyvsp[-2].opval));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
break;
case 126:
#line 478 "perly.y"
newLISTOP(OP_HSLICE, 0,
list(yyvsp[-2].opval),
ref(oopsHV(yyvsp[-4].opval), OP_HSLICE)));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
break;
case 130:
#line 495 "perly.y"
case 143:
#line 544 "perly.y"
{ yyval.opval = newOP(yyvsp[0].ival, OPf_SPECIAL);
- hints |= HINT_BLOCK_SCOPE; }
+ PL_hints |= HINT_BLOCK_SCOPE; }
break;
case 144:
#line 547 "perly.y"
break;
case 166:
#line 597 "perly.y"
-{ in_my = 0; yyval.opval = my(yyvsp[0].opval); }
+{ PL_in_my = 0; yyval.opval = my(yyvsp[0].opval); }
break;
case 167:
#line 601 "perly.y"
prog : /* NULL */
{
#if defined(YYDEBUG) && defined(DEBUGGING)
- yydebug = (debug & 1);
+ yydebug = (PL_debug & 1);
#endif
- expect = XSTATE;
+ PL_expect = XSTATE;
}
/*CONTINUED*/ lineseq
{ newPROG($2); }
;
block : '{' remember lineseq '}'
- { if (copline > (line_t)$1)
- copline = $1;
+ { if (PL_copline > (line_t)$1)
+ PL_copline = $1;
$$ = block_end($2, $3); }
;
;
mblock : '{' mremember lineseq '}'
- { if (copline > (line_t)$1)
- copline = $1;
+ { if (PL_copline > (line_t)$1)
+ PL_copline = $1;
$$ = block_end($2, $3); }
;
| lineseq line
{ $$ = append_list(OP_LINESEQ,
(LISTOP*)$1, (LISTOP*)$2);
- pad_reset_pending = TRUE;
- if ($1 && $2) hints |= HINT_BLOCK_SCOPE; }
+ PL_pad_reset_pending = TRUE;
+ if ($1 && $2) PL_hints |= HINT_BLOCK_SCOPE; }
;
line : label cond
}
else {
$$ = Nullop;
- copline = NOLINE;
+ PL_copline = NOLINE;
}
- expect = XSTATE; }
+ PL_expect = XSTATE; }
| label sideff ';'
{ $$ = newSTATEOP(0, $1, $2);
- expect = XSTATE; }
+ PL_expect = XSTATE; }
;
sideff : error
| ELSE mblock
{ $$ = scope($2); }
| ELSIF '(' mexpr ')' mblock else
- { copline = $1;
+ { PL_copline = $1;
$$ = newSTATEOP(0, Nullch,
newCONDOP(0, $3, scope($5), $6));
- hints |= HINT_BLOCK_SCOPE; }
+ PL_hints |= HINT_BLOCK_SCOPE; }
;
cond : IF '(' remember mexpr ')' mblock else
- { copline = $1;
+ { PL_copline = $1;
$$ = block_end($3,
newCONDOP(0, $4, scope($6), $7)); }
| UNLESS '(' remember miexpr ')' mblock else
- { copline = $1;
+ { PL_copline = $1;
$$ = block_end($3,
newCONDOP(0, $4, scope($6), $7)); }
;
;
loop : label WHILE '(' remember mtexpr ')' mblock cont
- { copline = $2;
+ { PL_copline = $2;
$$ = block_end($4,
newSTATEOP(0, $1,
newWHILEOP(0, 1, (LOOP*)Nullop,
$2, $5, $7, $8))); }
| label UNTIL '(' remember miexpr ')' mblock cont
- { copline = $2;
+ { PL_copline = $2;
$$ = block_end($4,
newSTATEOP(0, $1,
newWHILEOP(0, 1, (LOOP*)Nullop,
newWHILEOP(0, 1, (LOOP*)Nullop,
$2, scalar($7),
$11, scalar($9)));
- copline = $2;
+ PL_copline = $2;
$$ = block_end($4, newSTATEOP(0, $1, forop)); }
| label block cont /* a block is a loop that happens once */
{ $$ = newSTATEOP(0, $1,
{ $$ = start_subparse(TRUE, 0); }
;
-subname : WORD { char *name = SvPV(((SVOP*)$1)->op_sv, na);
+subname : WORD { char *name = SvPV(((SVOP*)$1)->op_sv, PL_na);
if (strEQ(name, "BEGIN") || strEQ(name, "END")
|| strEQ(name, "INIT"))
- CvUNIQUE_on(compcv);
+ CvUNIQUE_on(PL_compcv);
$$ = $1; }
;
;
subbody : block { $$ = $1; }
- | ';' { $$ = Nullop; expect = XSTATE; }
+ | ';' { $$ = Nullop; PL_expect = XSTATE; }
;
package : PACKAGE WORD ';'
;
use : USE startsub
- { CvUNIQUE_on(compcv); /* It's a BEGIN {} */ }
+ { CvUNIQUE_on(PL_compcv); /* It's a BEGIN {} */ }
WORD WORD listexpr ';'
{ utilize($1, $2, $4, $5, $6); }
;
{ $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));}
| scalar '{' expr ';' '}' %prec '('
{ $$ = newBINOP(OP_HELEM, 0, oopsHV($1), jmaybe($3));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
| term ARROW '{' expr ';' '}' %prec '('
{ $$ = newBINOP(OP_HELEM, 0,
ref(newHVREF($1),OP_RV2HV),
jmaybe($4));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
| term '{' expr ';' '}' %prec '('
{ assertref($1); $$ = newBINOP(OP_HELEM, 0,
ref(newHVREF($1),OP_RV2HV),
jmaybe($3));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
| '(' expr ')' '[' expr ']' %prec '('
{ $$ = newSLICEOP(0, $5, $2); }
| '(' ')' '[' expr ']' %prec '('
newLISTOP(OP_HSLICE, 0,
list($3),
ref(oopsHV($1), OP_HSLICE)));
- expect = XOPERATOR; }
+ PL_expect = XOPERATOR; }
| THING %prec '('
{ $$ = $1; }
| amper
newCVREF(0, scalar($1)))); }
| LOOPEX
{ $$ = newOP($1, OPf_SPECIAL);
- hints |= HINT_BLOCK_SCOPE; }
+ PL_hints |= HINT_BLOCK_SCOPE; }
| LOOPEX term
{ $$ = newLOOPEX($1,$2); }
| NOTOP argexpr
;
my_scalar: scalar
- { in_my = 0; $$ = my($1); }
+ { PL_in_my = 0; $$ = my($1); }
;
amper : '&' indirob
{
djSP;
if (GIMME_V == G_SCALAR)
- XPUSHs(&sv_undef);
+ XPUSHs(&PL_sv_undef);
RETURN;
}
{
djSP; dTARGET;
if (op->op_private & OPpLVAL_INTRO)
- SAVECLEARSV(curpad[op->op_targ]);
+ SAVECLEARSV(PL_curpad[op->op_targ]);
EXTEND(SP, 1);
if (op->op_flags & OPf_REF) {
PUSHs(TARG);
U32 i;
for (i=0; i < maxarg; i++) {
SV **svp = av_fetch((AV*)TARG, i, FALSE);
- SP[i+1] = (svp) ? *svp : &sv_undef;
+ SP[i+1] = (svp) ? *svp : &PL_sv_undef;
}
}
else {
XPUSHs(TARG);
if (op->op_private & OPpLVAL_INTRO)
- SAVECLEARSV(curpad[op->op_targ]);
+ SAVECLEARSV(PL_curpad[op->op_targ]);
if (op->op_flags & OPf_REF)
RETURN;
gimme = GIMME_V;
if (op->op_flags & OPf_REF ||
op->op_private & HINT_STRICT_REFS)
DIE(no_usym, "a symbol");
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
RETSETUNDEF;
}
- sym = SvPV(sv, na);
+ sym = SvPV(sv, PL_na);
if (op->op_private & HINT_STRICT_REFS)
DIE(no_symref, sym, "a symbol");
sv = (SV*)gv_fetchpv(sym, TRUE, SVt_PVGV);
if (op->op_flags & OPf_REF ||
op->op_private & HINT_STRICT_REFS)
DIE(no_usym, "a SCALAR");
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
RETSETUNDEF;
}
- sym = SvPV(sv, na);
+ sym = SvPV(sv, PL_na);
if (op->op_private & HINT_STRICT_REFS)
DIE(no_symref, sym, "a SCALAR");
gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PV);
if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) {
mg = mg_find(sv, 'g');
if (mg && mg->mg_len >= 0) {
- PUSHi(mg->mg_len + curcop->cop_arybase);
+ PUSHi(mg->mg_len + PL_curcop->cop_arybase);
RETURN;
}
}
cv = (CV*)sv_2mortal((SV*)cv_clone(cv));
}
else
- cv = (CV*)&sv_undef;
+ cv = (CV*)&PL_sv_undef;
SETs((SV*)cv);
RETURN;
}
GV *gv;
SV *ret;
- ret = &sv_undef;
+ ret = &PL_sv_undef;
if (SvPOK(TOPs) && SvCUR(TOPs) >= 7) {
char *s = SvPVX(TOPs);
if (strnEQ(s, "CORE::", 6)) {
PP(pp_anoncode)
{
djSP;
- CV* cv = (CV*)curpad[op->op_targ];
+ CV* cv = (CV*)PL_curpad[op->op_targ];
if (CvCLONE(cv))
cv = (CV*)sv_2mortal((SV*)cv_clone(cv));
EXTEND(SP,1);
if (++MARK <= SP)
*MARK = *SP;
else
- *MARK = &sv_undef;
+ *MARK = &PL_sv_undef;
*MARK = refto(*MARK);
SP = MARK;
RETURN;
if (LvTARGLEN(sv))
vivify_defelem(sv);
if (!(sv = LvTARG(sv)))
- sv = &sv_undef;
+ sv = &PL_sv_undef;
}
else if (SvPADTMP(sv))
sv = newSVsv(sv);
HV *stash;
if (MAXARG == 1)
- stash = curcop->cop_stash;
+ stash = PL_curcop->cop_stash;
else {
SV *ssv = POPs;
STRLEN len;
char *ptr = SvPV(ssv,len);
- if (dowarn && len == 0)
+ if (PL_dowarn && len == 0)
warn("Explicit blessing to '' (assuming package main)");
stash = gv_stashpvn(ptr, len, TRUE);
}
djSP;
sv = POPs;
- elem = SvPV(sv, na);
+ elem = SvPV(sv, PL_na);
gv = (GV*)POPs;
tmpRef = Nullsv;
sv = Nullsv;
if (sv)
sv_2mortal(sv);
else
- sv = &sv_undef;
+ sv = &PL_sv_undef;
XPUSHs(sv);
RETURN;
}
register I32 *snext;
STRLEN len;
- if (sv == lastscream) {
+ if (sv == PL_lastscream) {
if (SvSCREAM(sv))
RETPUSHYES;
}
else {
- if (lastscream) {
- SvSCREAM_off(lastscream);
- SvREFCNT_dec(lastscream);
+ if (PL_lastscream) {
+ SvSCREAM_off(PL_lastscream);
+ SvREFCNT_dec(PL_lastscream);
}
- lastscream = SvREFCNT_inc(sv);
+ PL_lastscream = SvREFCNT_inc(sv);
}
s = (unsigned char*)(SvPV(sv, len));
pos = len;
if (pos <= 0)
RETPUSHNO;
- if (pos > maxscream) {
- if (maxscream < 0) {
- maxscream = pos + 80;
- New(301, screamfirst, 256, I32);
- New(302, screamnext, maxscream, I32);
+ if (pos > PL_maxscream) {
+ if (PL_maxscream < 0) {
+ PL_maxscream = pos + 80;
+ New(301, PL_screamfirst, 256, I32);
+ New(302, PL_screamnext, PL_maxscream, I32);
}
else {
- maxscream = pos + pos / 4;
- Renew(screamnext, maxscream, I32);
+ PL_maxscream = pos + pos / 4;
+ Renew(PL_screamnext, PL_maxscream, I32);
}
}
- sfirst = screamfirst;
- snext = screamnext;
+ sfirst = PL_screamfirst;
+ snext = PL_screamnext;
if (!sfirst || !snext)
DIE("do_study: out of memory");
hv_undef((HV*)sv);
break;
case SVt_PVCV:
- if (dowarn && cv_const_sv((CV*)sv))
+ if (PL_dowarn && cv_const_sv((CV*)sv))
warn("Constant subroutine %s undefined",
CvANON((CV*)sv) ? "(anonymous)" : GvENAME(CvGV((CV*)sv)));
/* FALL THROUGH */
break;
case SVt_PVGV:
if (SvFAKE(sv))
- SvSetMagicSV(sv, &sv_undef);
+ SvSetMagicSV(sv, &PL_sv_undef);
else {
GP *gp;
gp_free((GV*)sv);
Newz(602, gp, 1, GP);
GvGP(sv) = gp_ref(gp);
GvSV(sv) = NEWSV(72,0);
- GvLINE(sv) = curcop->cop_line;
+ GvLINE(sv) = PL_curcop->cop_line;
GvEGV(sv) = (GV*)sv;
GvMULTI_on(sv);
}
tmpstr = POPs;
if (TARG == tmpstr && SvTHINKFIRST(tmpstr)) {
- if (SvREADONLY(tmpstr) && curcop != &compiling)
+ if (SvREADONLY(tmpstr) && PL_curcop != &PL_compiling)
DIE("Can't x= to readonly value");
if (SvROK(tmpstr))
sv_unref(tmpstr);
else if (left > right)
value = 1;
else {
- SETs(&sv_undef);
+ SETs(&PL_sv_undef);
RETURN;
}
SETi(value);
#ifdef OVERLOAD
djSP; tryAMAGICunSET(not);
#endif /* OVERLOAD */
- *stack_sp = boolSV(!SvTRUE(*stack_sp));
+ *PL_stack_sp = boolSV(!SvTRUE(*PL_stack_sp));
return NORMAL;
}
# endif
#endif
u += SEED_C3 * (U32)getpid();
- u += SEED_C4 * (U32)(UV)stack_sp;
+ u += SEED_C4 * (U32)(UV)PL_stack_sp;
#ifndef PLAN9 /* XXX Plan9 assembler chokes on this; fix needed */
u += SEED_C5 * (U32)(UV)&when;
#endif
I32 fail;
I32 lvalue = op->op_flags & OPf_MOD;
char *tmps;
- I32 arybase = curcop->cop_arybase;
+ I32 arybase = PL_curcop->cop_arybase;
char *repl = 0;
STRLEN repl_len;
rem -= pos;
}
if (fail < 0) {
- if (dowarn || lvalue || repl)
+ if (PL_dowarn || lvalue || repl)
warn("substr outside of string");
RETPUSHUNDEF;
}
if (lvalue) { /* it's an lvalue! */
if (!SvGMAGICAL(sv)) {
if (SvROK(sv)) {
- SvPV_force(sv,na);
- if (dowarn)
+ SvPV_force(sv,PL_na);
+ if (PL_dowarn)
warn("Attempt to use reference as lvalue in substr");
}
if (SvOK(sv)) /* is it defined ? */
char *tmps;
char *tmps2;
STRLEN biglen;
- I32 arybase = curcop->cop_arybase;
+ I32 arybase = PL_curcop->cop_arybase;
if (MAXARG < 3)
offset = 0;
I32 retval;
char *tmps;
char *tmps2;
- I32 arybase = curcop->cop_arybase;
+ I32 arybase = PL_curcop->cop_arybase;
if (MAXARG >= 3)
offstr = POPs;
{
djSP; dTARGET; dPOPTOPssrl;
#ifdef HAS_CRYPT
- char *tmps = SvPV(left, na);
+ char *tmps = SvPV(left, PL_na);
#ifdef FCRYPT
sv_setpv(TARG, fcrypt(tmps, SvPV(right, na)));
#else
- sv_setpv(TARG, crypt(tmps, SvPV(right, na)));
+ sv_setpv(TARG, crypt(tmps, SvPV(right, PL_na)));
#endif
#else
DIE(
sv = TARG;
SETs(sv);
}
- s = SvPV_force(sv, na);
+ s = SvPV_force(sv, PL_na);
if (*s) {
if (op->op_private & OPpLOCALE) {
TAINT;
sv = TARG;
SETs(sv);
}
- s = SvPV_force(sv, na);
+ s = SvPV_force(sv, PL_na);
if (*s) {
if (op->op_private & OPpLOCALE) {
TAINT;
register SV** svp;
register AV* av = (AV*)POPs;
register I32 lval = op->op_flags & OPf_MOD;
- I32 arybase = curcop->cop_arybase;
+ I32 arybase = PL_curcop->cop_arybase;
I32 elem;
if (SvTYPE(av) == SVt_PVAV) {
elem -= arybase;
svp = av_fetch(av, elem, lval);
if (lval) {
- if (!svp || *svp == &sv_undef)
+ if (!svp || *svp == &PL_sv_undef)
DIE(no_aelem, elem);
if (op->op_private & OPpLVAL_INTRO)
save_aelem(av, elem, svp);
}
- *MARK = svp ? *svp : &sv_undef;
+ *MARK = svp ? *svp : &PL_sv_undef;
}
}
if (GIMME != G_ARRAY) {
sv = hv_delete_ent(hv, *MARK, discard, 0);
else
DIE("Not a HASH reference");
- *MARK = sv ? sv : &sv_undef;
+ *MARK = sv ? sv : &PL_sv_undef;
}
if (discard)
SP = ORIGMARK;
else
DIE("Not a HASH reference");
if (!sv)
- sv = &sv_undef;
+ sv = &PL_sv_undef;
if (!discard)
PUSHs(sv);
}
svp = avhv_fetch_ent((AV*)hv, keysv, lval, 0);
}
if (lval) {
- if (!svp || *svp == &sv_undef)
- DIE(no_helem, SvPV(keysv, na));
+ if (!svp || *svp == &PL_sv_undef)
+ DIE(no_helem, SvPV(keysv, PL_na));
if (op->op_private & OPpLVAL_INTRO)
save_helem(hv, keysv, svp);
}
- *MARK = svp ? *svp : &sv_undef;
+ *MARK = svp ? *svp : &PL_sv_undef;
}
}
if (GIMME != G_ARRAY) {
if (++MARK <= SP)
*MARK = *SP; /* unwanted list, return last item */
else
- *MARK = &sv_undef;
+ *MARK = &PL_sv_undef;
SP = MARK;
}
RETURN;
PP(pp_lslice)
{
djSP;
- SV **lastrelem = stack_sp;
- SV **lastlelem = stack_base + POPMARK;
- SV **firstlelem = stack_base + POPMARK + 1;
+ SV **lastrelem = PL_stack_sp;
+ SV **lastlelem = PL_stack_base + POPMARK;
+ SV **firstlelem = PL_stack_base + POPMARK + 1;
register SV **firstrelem = lastlelem + 1;
- I32 arybase = curcop->cop_arybase;
+ I32 arybase = PL_curcop->cop_arybase;
I32 lval = op->op_flags & OPf_MOD;
I32 is_something_there = lval;
else
ix -= arybase;
if (ix < 0 || ix >= max)
- *firstlelem = &sv_undef;
+ *firstlelem = &PL_sv_undef;
else
*firstlelem = firstrelem[ix];
SP = firstlelem;
if (ix < 0) {
ix += max;
if (ix < 0)
- *lelem = &sv_undef;
+ *lelem = &PL_sv_undef;
else if (!(*lelem = firstrelem[ix]))
- *lelem = &sv_undef;
+ *lelem = &PL_sv_undef;
}
else {
ix -= arybase;
if (ix >= max || !(*lelem = firstrelem[ix]))
- *lelem = &sv_undef;
+ *lelem = &PL_sv_undef;
}
if (!is_something_there && (SvOK(*lelem) || SvGMAGICAL(*lelem)))
is_something_there = TRUE;
SV *val = NEWSV(46, 0);
if (MARK < SP)
sv_setsv(val, *++MARK);
- else if (dowarn)
+ else if (PL_dowarn)
warn("Odd number of elements in hash assignment");
(void)hv_store_ent(hv,key,val,0);
}
if (offset < 0)
offset += AvFILLp(ary) + 1;
else
- offset -= curcop->cop_arybase;
+ offset -= PL_curcop->cop_arybase;
if (offset < 0)
DIE(no_aelem, i);
if (++MARK < SP) {
}
i = -diff;
while (i)
- dst[--i] = &sv_undef;
+ dst[--i] = &PL_sv_undef;
if (newlen) {
for (src = tmparyval, dst = AvARRAY(ary) + offset;
Safefree(tmparyval);
}
else
- *MARK = &sv_undef;
+ *MARK = &PL_sv_undef;
}
SP = MARK;
RETURN;
{
djSP; dMARK; dORIGMARK; dTARGET;
register AV *ary = (AV*)*++MARK;
- register SV *sv = &sv_undef;
+ register SV *sv = &PL_sv_undef;
MAGIC *mg;
if (SvRMAGICAL(ary) && (mg = mg_find((SV*)ary,'P'))) {
STRLEN len;
if (SP - MARK > 1)
- do_join(TARG, &sv_no, MARK, SP);
+ do_join(TARG, &PL_sv_no, MARK, SP);
else
sv_setsv(TARG, (SP > MARK) ? *SP : DEFSV);
up = SvPV_force(TARG, len);
default:
croak("Invalid type in unpack: '%c'", (int)datumtype);
case ',': /* grandfather in commas but with a warning */
- if (commas++ == 0 && dowarn)
+ if (commas++ == 0 && PL_dowarn)
warn("Invalid type in unpack: '%c'", (int)datumtype);
break;
case '%':
bits >>= 4;
else
bits = *s++;
- *pat++ = hexdigit[bits & 15];
+ *pat++ = PL_hexdigit[bits & 15];
}
}
else {
bits <<= 4;
else
bits = *s++;
- *pat++ = hexdigit[(bits >> 4) & 15];
+ *pat++ = PL_hexdigit[(bits >> 4) & 15];
}
}
*pat = '\0';
break;
}
}
- t = SvPV(sv, na);
+ t = SvPV(sv, PL_na);
while (*t == '0')
t++;
sv_chop(sv, t);
}
}
if (SP == oldsp && gimme == G_SCALAR)
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
RETURN;
}
is_an_int(char *s, STRLEN l)
{
SV *result = newSVpv("", l);
- char *result_c = SvPV(result, na); /* convenience */
+ char *result_c = SvPV(result, PL_na); /* convenience */
char *out = result_c;
bool skip = 1;
bool ignore = 0;
MARK++;
sv_setpvn(cat, "", 0);
while (pat < patend) {
-#define NEXTFROM (items-- > 0 ? *MARK++ : &sv_no)
+#define NEXTFROM (items-- > 0 ? *MARK++ : &PL_sv_no)
datumtype = *pat++ & 0xFF;
if (isSPACE(datumtype))
continue;
default:
croak("Invalid type in pack: '%c'", (int)datumtype);
case ',': /* grandfather in commas but with a warning */
- if (commas++ == 0 && dowarn)
+ if (commas++ == 0 && PL_dowarn)
warn("Invalid type in pack: '%c'", (int)datumtype);
break;
case '%':
case 'p':
while (len-- > 0) {
fromstr = NEXTFROM;
- if (fromstr == &sv_undef)
+ if (fromstr == &PL_sv_undef)
aptr = NULL;
else {
/* XXX better yet, could spirit away the string to
* of pack() (and all copies of the result) are
* gone.
*/
- if (dowarn && (SvTEMP(fromstr) || SvPADTMP(fromstr)))
+ if (PL_dowarn && (SvTEMP(fromstr) || SvPADTMP(fromstr)))
warn("Attempt to pack pointer to temporary value");
if (SvPOK(fromstr) || SvNIOK(fromstr))
- aptr = SvPV(fromstr,na);
+ aptr = SvPV(fromstr,PL_na);
else
- aptr = SvPV_force(fromstr,na);
+ aptr = SvPV_force(fromstr,PL_na);
}
sv_catpvn(cat, (char*)&aptr, sizeof(char*));
}
I32 origlimit = limit;
I32 realarray = 0;
I32 base;
- AV *oldstack = curstack;
+ AV *oldstack = PL_curstack;
I32 gimme = GIMME_V;
- I32 oldsave = savestack_ix;
+ I32 oldsave = PL_savestack_ix;
I32 make_mortal = 1;
MAGIC *mg = (MAGIC *) NULL;
#ifdef USE_THREADS
ary = (AV*)curpad[0];
#else
- ary = GvAVn(defgv);
+ ary = GvAVn(PL_defgv);
#endif /* USE_THREADS */
else
ary = Nullav;
if (!AvREAL(ary)) {
AvREAL_on(ary);
for (i = AvFILLp(ary); i >= 0; i--)
- AvARRAY(ary)[i] = &sv_undef; /* don't free mere refs */
+ AvARRAY(ary)[i] = &PL_sv_undef; /* don't free mere refs */
}
/* temporarily switch stacks */
- SWITCHSTACK(curstack, ary);
+ SWITCHSTACK(PL_curstack, ary);
make_mortal = 0;
}
}
- base = SP - stack_base;
+ base = SP - PL_stack_base;
orig = s;
if (pm->op_pmflags & PMf_SKIPWHITE) {
if (pm->op_pmflags & PMf_LOCALE) {
}
}
if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
- SAVEINT(multiline);
- multiline = pm->op_pmflags & PMf_MULTILINE;
+ SAVEINT(PL_multiline);
+ PL_multiline = pm->op_pmflags & PMf_MULTILINE;
}
if (!limit)
}
LEAVE_SCOPE(oldsave);
- iters = (SP - stack_base) - base;
+ iters = (SP - PL_stack_base) - base;
if (iters > maxiters)
DIE("Split loop");
EXTEND(SP, iters);
for (i=0; i < iters; i++) {
SV **svp = av_fetch(ary, i, FALSE);
- PUSHs((svp) ? *svp : &sv_undef);
+ PUSHs((svp) ? *svp : &PL_sv_undef);
}
RETURN;
}
#define MARK mark
#define TARG targ
-#define PUSHMARK(p) if (++markstack_ptr == markstack_max) \
+#define PUSHMARK(p) if (++PL_markstack_ptr == PL_markstack_max) \
markstack_grow(); \
- *markstack_ptr = (p) - stack_base
+ *PL_markstack_ptr = (p) - PL_stack_base
-#define TOPMARK (*markstack_ptr)
-#define POPMARK (*markstack_ptr--)
+#define TOPMARK (*PL_markstack_ptr)
+#define POPMARK (*PL_markstack_ptr--)
-#define djSP register SV **sp = stack_sp
+#define djSP register SV **sp = PL_stack_sp
#define dSP dTHR; djSP
-#define dMARK register SV **mark = stack_base + POPMARK
-#define dORIGMARK I32 origmark = mark - stack_base
-#define SETORIGMARK origmark = mark - stack_base
-#define ORIGMARK (stack_base + origmark)
+#define dMARK register SV **mark = PL_stack_base + POPMARK
+#define dORIGMARK I32 origmark = mark - PL_stack_base
+#define SETORIGMARK origmark = mark - PL_stack_base
+#define ORIGMARK (PL_stack_base + origmark)
-#define SPAGAIN sp = stack_sp
-#define MSPAGAIN sp = stack_sp; mark = ORIGMARK
+#define SPAGAIN sp = PL_stack_sp
+#define MSPAGAIN sp = PL_stack_sp; mark = ORIGMARK
#define GETTARGETSTACKED targ = (op->op_flags & OPf_STACKED ? POPs : PAD_SV(op->op_targ))
#define dTARGETSTACKED SV * GETTARGETSTACKED
#define NORMAL op->op_next
#define DIE return die
-#define PUTBACK stack_sp = sp
+#define PUTBACK PL_stack_sp = sp
#define RETURN return PUTBACK, NORMAL
#define RETURNOP(o) return PUTBACK, o
#define RETURNX(x) return x, PUTBACK, NORMAL
#define POPs (*sp--)
-#define POPp (SvPVx(POPs, na))
+#define POPp (SvPVx(POPs, PL_na))
#define POPn (SvNVx(POPs))
#define POPi ((IV)SvIVx(POPs))
#define POPu ((UV)SvUVx(POPs))
#define POPl ((long)SvIVx(POPs))
#define TOPs (*sp)
-#define TOPp (SvPV(TOPs, na))
+#define TOPp (SvPV(TOPs, PL_na))
#define TOPn (SvNV(TOPs))
#define TOPi ((IV)SvIV(TOPs))
#define TOPu ((UV)SvUV(TOPs))
#define TOPl ((long)SvIV(TOPs))
/* Go to some pains in the rare event that we must extend the stack. */
-#define EXTEND(p,n) STMT_START { if (stack_max - p < (n)) { \
+#define EXTEND(p,n) STMT_START { if (PL_stack_max - p < (n)) { \
sp = stack_grow(sp,p, (int) (n)); \
} } STMT_END
/* Same thing, but update mark register too. */
-#define MEXTEND(p,n) STMT_START {if (stack_max - p < (n)) { \
- int markoff = mark - stack_base; \
+#define MEXTEND(p,n) STMT_START {if (PL_stack_max - p < (n)) { \
+ int markoff = mark - PL_stack_base; \
sp = stack_grow(sp,p,(int) (n)); \
- mark = stack_base + markoff; \
+ mark = PL_stack_base + markoff; \
} } STMT_END
#define PUSHs(s) (*++sp = (s))
#define dPOPTOPiirl dPOPXiirl(TOP)
#define dPOPTOPiirl_ul dPOPXiirl_ul(TOP)
-#define RETPUSHYES RETURNX(PUSHs(&sv_yes))
-#define RETPUSHNO RETURNX(PUSHs(&sv_no))
-#define RETPUSHUNDEF RETURNX(PUSHs(&sv_undef))
+#define RETPUSHYES RETURNX(PUSHs(&PL_sv_yes))
+#define RETPUSHNO RETURNX(PUSHs(&PL_sv_no))
+#define RETPUSHUNDEF RETURNX(PUSHs(&PL_sv_undef))
-#define RETSETYES RETURNX(SETs(&sv_yes))
-#define RETSETNO RETURNX(SETs(&sv_no))
-#define RETSETUNDEF RETURNX(SETs(&sv_undef))
+#define RETSETYES RETURNX(SETs(&PL_sv_yes))
+#define RETSETNO RETURNX(SETs(&PL_sv_no))
+#define RETSETUNDEF RETURNX(SETs(&PL_sv_undef))
#define ARGTARG op->op_targ
#define MAXARG op->op_private
#define SWITCHSTACK(f,t) \
STMT_START { \
- AvFILLp(f) = sp - stack_base; \
- stack_base = AvARRAY(t); \
- stack_max = stack_base + AvMAX(t); \
- sp = stack_sp = stack_base + AvFILLp(t); \
- curstack = t; \
+ AvFILLp(f) = sp - PL_stack_base; \
+ PL_stack_base = AvARRAY(t); \
+ PL_stack_max = PL_stack_base + AvMAX(t); \
+ sp = PL_stack_sp = PL_stack_base + AvFILLp(t); \
+ PL_curstack = t; \
} STMT_END
#define EXTEND_MORTAL(n) \
STMT_START { \
- if (tmps_ix + (n) >= tmps_max) \
- Renew(tmps_stack, tmps_max = tmps_ix + (n) + 1, SV*); \
+ if (PL_tmps_ix + (n) >= PL_tmps_max) \
+ Renew(PL_tmps_stack, PL_tmps_max = PL_tmps_ix + (n) + 1, SV*); \
} STMT_END
#ifdef OVERLOAD
#define AMGf_unary 8
#define tryAMAGICbinW(meth,assign,set) STMT_START { \
- if (amagic_generation) { \
+ if (PL_amagic_generation) { \
SV* tmpsv; \
SV* right= *(sp); SV* left= *(sp-1);\
if ((SvAMAGIC(left)||SvAMAGIC(right))&&\
#define tryAMAGICbin(meth,assign) tryAMAGICbinW(meth,assign,SETsv)
#define tryAMAGICbinSET(meth,assign) tryAMAGICbinW(meth,assign,SETs)
-#define AMG_CALLun(sv,meth) amagic_call(sv,&sv_undef, \
+#define AMG_CALLun(sv,meth) amagic_call(sv,&PL_sv_undef, \
CAT2(meth,_amg),AMGf_noright | AMGf_unary)
#define AMG_CALLbinL(left,right,meth) \
amagic_call(left,right,CAT2(meth,_amg),AMGf_noright)
#define tryAMAGICunW(meth,set) STMT_START { \
- if (amagic_generation) { \
+ if (PL_amagic_generation) { \
SV* tmpsv; \
SV* arg= *(sp); \
if ((SvAMAGIC(arg))&&\
{
/* XXXX Should store the old value to allow for tie/overload - and
restore in regcomp, where marked with XXXX. */
- reginterp_cnt = 0;
+ PL_reginterp_cnt = 0;
return NORMAL;
}
pm->op_pmregexp = Null(REGEXP*); /* crucial if regcomp aborts */
}
if (op->op_flags & OPf_SPECIAL)
- reginterp_cnt = I32_MAX; /* Mark as safe. */
+ PL_reginterp_cnt = I32_MAX; /* Mark as safe. */
pm->op_pmflags = pm->op_pmpermflags; /* reset case sensitivity */
pm->op_pmregexp = CALLREGCOMP(t, t + len, pm);
- reginterp_cnt = 0; /* XXXX Be extra paranoid - needed
+ PL_reginterp_cnt = 0; /* XXXX Be extra paranoid - needed
inside tie/overload accessors. */
}
}
#ifndef INCOMPLETE_TAINTS
- if (tainting) {
- if (tainted)
+ if (PL_tainting) {
+ if (PL_tainted)
pm->op_pmdynflags |= PMdf_TAINTED;
else
pm->op_pmdynflags &= ~PMdf_TAINTED;
}
#endif
- if (!pm->op_pmregexp->prelen && curpm)
- pm = curpm;
+ if (!pm->op_pmregexp->prelen && PL_curpm)
+ pm = PL_curpm;
else if (strEQ("\\s+", pm->op_pmregexp->precomp))
pm->op_pmflags |= PMf_WHITE;
I32 itemsize;
I32 fieldsize;
I32 lines = 0;
- bool chopspace = (strchr(chopset, ' ') != Nullch);
+ bool chopspace = (strchr(PL_chopset, ' ') != Nullch);
char *chophere;
char *linemark;
double value;
doparseform(tmpForm);
}
- SvPV_force(formtarget, len);
- t = SvGROW(formtarget, len + SvCUR(tmpForm) + 1); /* XXX SvCUR bad */
+ SvPV_force(PL_formtarget, len);
+ t = SvGROW(PL_formtarget, len + SvCUR(tmpForm) + 1); /* XXX SvCUR bad */
t += len;
f = SvPV(tmpForm, len);
/* need to jump to the next word */
if (MARK < SP)
sv = *++MARK;
else {
- sv = &sv_no;
- if (dowarn)
+ sv = &PL_sv_no;
+ if (PL_dowarn)
warn("Not enough format arguments");
}
break;
else {
if (*s & ~31)
gotsome = TRUE;
- if (strchr(chopset, *s))
+ if (strchr(PL_chopset, *s))
chophere = s + 1;
}
s++;
lines++;
}
}
- SvCUR_set(formtarget, t - SvPVX(formtarget));
- sv_catpvn(formtarget, item, itemsize);
- SvGROW(formtarget, SvCUR(formtarget) + SvCUR(tmpForm) + 1);
- t = SvPVX(formtarget) + SvCUR(formtarget);
+ SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget));
+ sv_catpvn(PL_formtarget, item, itemsize);
+ SvGROW(PL_formtarget, SvCUR(PL_formtarget) + SvCUR(tmpForm) + 1);
+ t = SvPVX(PL_formtarget) + SvCUR(PL_formtarget);
}
break;
if (gotsome) {
if (arg) { /* repeat until fields exhausted? */
*t = '\0';
- SvCUR_set(formtarget, t - SvPVX(formtarget));
- lines += FmLINES(formtarget);
+ SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget));
+ lines += FmLINES(PL_formtarget);
if (lines == 200) {
arg = t - linemark;
if (strnEQ(linemark, linemark - arg, arg))
DIE("Runaway format");
}
- FmLINES(formtarget) = lines;
+ FmLINES(PL_formtarget) = lines;
SP = ORIGMARK;
RETURNOP(cLISTOP->op_first);
}
}
s = t - 3;
if (strnEQ(s," ",3)) {
- while (s > SvPVX(formtarget) && isSPACE(s[-1]))
+ while (s > SvPVX(PL_formtarget) && isSPACE(s[-1]))
s--;
}
*s++ = '.';
case FF_END:
*t = '\0';
- SvCUR_set(formtarget, t - SvPVX(formtarget));
- FmLINES(formtarget) += lines;
+ SvCUR_set(PL_formtarget, t - SvPVX(PL_formtarget));
+ FmLINES(PL_formtarget) += lines;
SP = ORIGMARK;
RETPUSHYES;
}
djSP;
SV *src;
- if (stack_base + *markstack_ptr == SP) {
+ if (PL_stack_base + *PL_markstack_ptr == SP) {
(void)POPMARK;
if (GIMME_V == G_SCALAR)
- XPUSHs(&sv_no);
+ XPUSHs(&PL_sv_no);
RETURNOP(op->op_next->op_next);
}
- stack_sp = stack_base + *markstack_ptr + 1;
+ PL_stack_sp = PL_stack_base + *PL_markstack_ptr + 1;
pp_pushmark(ARGS); /* push dst */
pp_pushmark(ARGS); /* push src */
ENTER; /* enter outer scope */
/* SAVE_DEFSV does *not* suffice here */
save_sptr(&THREADSV(0));
#else
- SAVESPTR(GvSV(defgv));
+ SAVESPTR(GvSV(PL_defgv));
#endif /* USE_THREADS */
ENTER; /* enter inner scope */
- SAVESPTR(curpm);
+ SAVESPTR(PL_curpm);
- src = stack_base[*markstack_ptr];
+ src = PL_stack_base[*PL_markstack_ptr];
SvTEMP_off(src);
DEFSV = src;
PP(pp_mapwhile)
{
djSP;
- I32 diff = (SP - stack_base) - *markstack_ptr;
+ I32 diff = (SP - PL_stack_base) - *PL_markstack_ptr;
I32 count;
I32 shift;
SV** src;
SV** dst;
- ++markstack_ptr[-1];
+ ++PL_markstack_ptr[-1];
if (diff) {
- if (diff > markstack_ptr[-1] - markstack_ptr[-2]) {
- shift = diff - (markstack_ptr[-1] - markstack_ptr[-2]);
- count = (SP - stack_base) - markstack_ptr[-1] + 2;
+ if (diff > PL_markstack_ptr[-1] - PL_markstack_ptr[-2]) {
+ shift = diff - (PL_markstack_ptr[-1] - PL_markstack_ptr[-2]);
+ count = (SP - PL_stack_base) - PL_markstack_ptr[-1] + 2;
EXTEND(SP,shift);
src = SP;
dst = (SP += shift);
- markstack_ptr[-1] += shift;
- *markstack_ptr += shift;
+ PL_markstack_ptr[-1] += shift;
+ *PL_markstack_ptr += shift;
while (--count)
*dst-- = *src--;
}
- dst = stack_base + (markstack_ptr[-2] += diff) - 1;
+ dst = PL_stack_base + (PL_markstack_ptr[-2] += diff) - 1;
++diff;
while (--diff)
*dst-- = SvTEMP(TOPs) ? POPs : sv_mortalcopy(POPs);
LEAVE; /* exit inner scope */
/* All done yet? */
- if (markstack_ptr[-1] > *markstack_ptr) {
+ if (PL_markstack_ptr[-1] > *PL_markstack_ptr) {
I32 items;
I32 gimme = GIMME_V;
(void)POPMARK; /* pop top */
LEAVE; /* exit outer scope */
(void)POPMARK; /* pop src */
- items = --*markstack_ptr - markstack_ptr[-1];
+ items = --*PL_markstack_ptr - PL_markstack_ptr[-1];
(void)POPMARK; /* pop dst */
- SP = stack_base + POPMARK; /* pop original mark */
+ SP = PL_stack_base + POPMARK; /* pop original mark */
if (gimme == G_SCALAR) {
dTARGET;
XPUSHi(items);
SV *src;
ENTER; /* enter inner scope */
- SAVESPTR(curpm);
+ SAVESPTR(PL_curpm);
- src = stack_base[markstack_ptr[-1]];
+ src = PL_stack_base[PL_markstack_ptr[-1]];
SvTEMP_off(src);
DEFSV = src;
}
ENTER;
- SAVEPPTR(sortcop);
+ SAVEPPTR(PL_sortcop);
if (op->op_flags & OPf_STACKED) {
if (op->op_flags & OPf_SPECIAL) {
OP *kid = cLISTOP->op_first->op_sibling; /* pass pushmark */
kid = kUNOP->op_first; /* pass rv2gv */
kid = kUNOP->op_first; /* pass leave */
- sortcop = kid->op_next;
- stash = curcop->cop_stash;
+ PL_sortcop = kid->op_next;
+ stash = PL_curcop->cop_stash;
}
else {
cv = sv_2cv(*++MARK, &stash, &gv, 0);
}
DIE("Not a CODE reference in sort");
}
- sortcop = CvSTART(cv);
+ PL_sortcop = CvSTART(cv);
SAVESPTR(CvROOT(cv)->op_ppaddr);
CvROOT(cv)->op_ppaddr = ppaddr[OP_NULL];
- SAVESPTR(curpad);
- curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(cv))[1]);
+ SAVESPTR(PL_curpad);
+ PL_curpad = AvARRAY((AV*)AvARRAY(CvPADLIST(cv))[1]);
}
}
else {
- sortcop = Nullop;
- stash = curcop->cop_stash;
+ PL_sortcop = Nullop;
+ stash = PL_curcop->cop_stash;
}
up = myorigmark + 1;
/*SUPPRESS 560*/
if (*up = *++MARK) { /* Weed out nulls. */
SvTEMP_off(*up);
- if (!sortcop && !SvPOK(*up))
- (void)sv_2pv(*up, &na);
+ if (!PL_sortcop && !SvPOK(*up))
+ (void)sv_2pv(*up, &PL_na);
up++;
}
}
max = --up - myorigmark;
- if (sortcop) {
+ if (PL_sortcop) {
if (max > 1) {
PERL_CONTEXT *cx;
SV** newsp;
CATCH_SET(TRUE);
PUSHSTACKi(PERLSI_SORT);
- if (sortstash != stash) {
- firstgv = gv_fetchpv("a", TRUE, SVt_PV);
- secondgv = gv_fetchpv("b", TRUE, SVt_PV);
- sortstash = stash;
+ if (PL_sortstash != stash) {
+ PL_firstgv = gv_fetchpv("a", TRUE, SVt_PV);
+ PL_secondgv = gv_fetchpv("b", TRUE, SVt_PV);
+ PL_sortstash = stash;
}
- SAVESPTR(GvSV(firstgv));
- SAVESPTR(GvSV(secondgv));
+ SAVESPTR(GvSV(PL_firstgv));
+ SAVESPTR(GvSV(PL_secondgv));
- PUSHBLOCK(cx, CXt_NULL, stack_base);
+ PUSHBLOCK(cx, CXt_NULL, PL_stack_base);
if (!(op->op_flags & OPf_SPECIAL)) {
bool hasargs = FALSE;
cx->cx_type = CXt_SUB;
if (!CvDEPTH(cv))
(void)SvREFCNT_inc(cv); /* in preparation for POPSUB */
}
- sortcxix = cxstack_ix;
+ PL_sortcxix = cxstack_ix;
qsortsv((myorigmark+1), max, FUNC_NAME_TO_PTR(sortcv));
- POPBLOCK(cx,curpm);
+ POPBLOCK(cx,PL_curpm);
POPSTACK;
CATCH_SET(oldcatch);
}
}
}
LEAVE;
- stack_sp = ORIGMARK + max;
+ PL_stack_sp = ORIGMARK + max;
return nextop;
}
SV *targ = PAD_SV(op->op_targ);
if ((op->op_private & OPpFLIP_LINENUM)
- ? (last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(last_in_gv)))
+ ? (PL_last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)))
: SvTRUE(sv) ) {
sv_setiv(PAD_SV(cUNOP->op_first->op_targ), 1);
if (op->op_flags & OPf_SPECIAL) {
SV *targ = PAD_SV(cUNOP->op_first->op_targ);
sv_inc(targ);
if ((op->op_private & OPpFLIP_LINENUM)
- ? (last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(last_in_gv)))
+ ? (PL_last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)))
: SvTRUE(sv) ) {
sv_setiv(PAD_SV(((UNOP*)cUNOP->op_first)->op_first->op_targ), 0);
sv_catpv(targ, "E0");
cx = &cxstack[i];
switch (cx->cx_type) {
case CXt_SUBST:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting substitution via %s", op_name[op->op_type]);
break;
case CXt_SUB:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting subroutine via %s", op_name[op->op_type]);
break;
case CXt_EVAL:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting eval via %s", op_name[op->op_type]);
break;
case CXt_NULL:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting pseudo-block via %s", op_name[op->op_type]);
return -1;
case CXt_LOOP:
cx = &cxstack[i];
switch (cx->cx_type) {
case CXt_SUBST:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting substitution via %s", op_name[op->op_type]);
break;
case CXt_SUB:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting subroutine via %s", op_name[op->op_type]);
break;
case CXt_EVAL:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting eval via %s", op_name[op->op_type]);
break;
case CXt_NULL:
- if (dowarn)
+ if (PL_dowarn)
warn("Exiting pseudo-block via %s", op_name[op->op_type]);
return -1;
case CXt_LOOP:
die_where(char *message)
{
dSP;
- if (in_eval) {
+ if (PL_in_eval) {
I32 cxix;
register PERL_CONTEXT *cx;
I32 gimme;
SV **newsp;
if (message) {
- if (in_eval & 4) {
+ if (PL_in_eval & 4) {
SV **svp;
STRLEN klen = strlen(message);
sv_setpv(ERRSV, message);
}
else
- message = SvPVx(ERRSV, na);
+ message = SvPVx(ERRSV, PL_na);
- while ((cxix = dopoptoeval(cxstack_ix)) < 0 && curstackinfo->si_prev) {
+ while ((cxix = dopoptoeval(cxstack_ix)) < 0 && PL_curstackinfo->si_prev) {
dounwind(-1);
POPSTACK;
}
if (cxix < cxstack_ix)
dounwind(cxix);
- POPBLOCK(cx,curpm);
+ POPBLOCK(cx,PL_curpm);
if (cx->cx_type != CXt_EVAL) {
PerlIO_printf(PerlIO_stderr(), "panic: die %s", message);
my_exit(1);
POPEVAL(cx);
if (gimme == G_SCALAR)
- *++newsp = &sv_undef;
- stack_sp = newsp;
+ *++newsp = &PL_sv_undef;
+ PL_stack_sp = newsp;
LEAVE;
if (optype == OP_REQUIRE) {
- char* msg = SvPVx(ERRSV, na);
+ char* msg = SvPVx(ERRSV, PL_na);
DIE("%s", *msg ? msg : "Compilation failed in require");
}
return pop_return();
register I32 cxix = dopoptosub(cxstack_ix);
register PERL_CONTEXT *cx;
register PERL_CONTEXT *ccstack = cxstack;
- PERL_SI *top_si = curstackinfo;
+ PERL_SI *top_si = PL_curstackinfo;
I32 dbcxix;
I32 gimme;
HV *hv;
RETPUSHUNDEF;
RETURN;
}
- if (DBsub && cxix >= 0 &&
- ccstack[cxix].blk_sub.cv == GvCV(DBsub))
+ if (PL_DBsub && cxix >= 0 &&
+ ccstack[cxix].blk_sub.cv == GvCV(PL_DBsub))
count++;
if (!count--)
break;
dbcxix = dopoptosub_at(ccstack, cxix - 1);
/* We expect that ccstack[dbcxix] is CXt_SUB, anyway, the
field below is defined for any cx. */
- if (DBsub && dbcxix >= 0 && ccstack[dbcxix].blk_sub.cv == GvCV(DBsub))
+ if (PL_DBsub && dbcxix >= 0 && ccstack[dbcxix].blk_sub.cv == GvCV(PL_DBsub))
cx = &ccstack[dbcxix];
}
if (GIMME != G_ARRAY) {
hv = cx->blk_oldcop->cop_stash;
if (!hv)
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
else {
dTARGET;
sv_setpv(TARG, HvNAME(hv));
hv = cx->blk_oldcop->cop_stash;
if (!hv)
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
else
PUSHs(sv_2mortal(newSVpv(HvNAME(hv), 0)));
PUSHs(sv_2mortal(newSVpv(SvPVX(GvSV(cx->blk_oldcop->cop_filegv)), 0)));
}
gimme = (I32)cx->blk_gimme;
if (gimme == G_VOID)
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
else
PUSHs(sv_2mortal(newSViv(gimme & G_ARRAY)));
if (cx->cx_type == CXt_EVAL) {
if (cx->blk_eval.old_op_type == OP_ENTEREVAL) {
PUSHs(cx->blk_eval.cur_text);
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
else if (cx->blk_eval.old_name) { /* Try blocks have old_name == 0. */
/* Require, put the name. */
PUSHs(sv_2mortal(newSVpv(cx->blk_eval.old_name, 0)));
- PUSHs(&sv_yes);
+ PUSHs(&PL_sv_yes);
}
}
else if (cx->cx_type == CXt_SUB &&
cx->blk_sub.hasargs &&
- curcop->cop_stash == debstash)
+ PL_curcop->cop_stash == PL_debstash)
{
AV *ary = cx->blk_sub.argarray;
int off = AvARRAY(ary) - AvALLOC(ary);
- if (!dbargs) {
+ if (!PL_dbargs) {
GV* tmpgv;
- dbargs = GvAV(gv_AVadd(tmpgv = gv_fetchpv("DB::args", TRUE,
+ PL_dbargs = GvAV(gv_AVadd(tmpgv = gv_fetchpv("DB::args", TRUE,
SVt_PVAV)));
GvMULTI_on(tmpgv);
- AvREAL_off(dbargs); /* XXX Should be REIFY */
+ AvREAL_off(PL_dbargs); /* XXX Should be REIFY */
}
- if (AvMAX(dbargs) < AvFILLp(ary) + off)
- av_extend(dbargs, AvFILLp(ary) + off);
- Copy(AvALLOC(ary), AvARRAY(dbargs), AvFILLp(ary) + 1 + off, SV*);
- AvFILLp(dbargs) = AvFILLp(ary) + off;
+ if (AvMAX(PL_dbargs) < AvFILLp(ary) + off)
+ av_extend(PL_dbargs, AvFILLp(ary) + off);
+ Copy(AvALLOC(ary), AvARRAY(PL_dbargs), AvFILLp(ary) + 1 + off, SV*);
+ AvFILLp(PL_dbargs) = AvFILLp(ary) + off;
}
RETURN;
}
sortcv(SV *a, SV *b)
{
dTHR;
- I32 oldsaveix = savestack_ix;
- I32 oldscopeix = scopestack_ix;
+ I32 oldsaveix = PL_savestack_ix;
+ I32 oldscopeix = PL_scopestack_ix;
I32 result;
- GvSV(firstgv) = a;
- GvSV(secondgv) = b;
- stack_sp = stack_base;
- op = sortcop;
+ GvSV(PL_firstgv) = a;
+ GvSV(PL_secondgv) = b;
+ PL_stack_sp = PL_stack_base;
+ op = PL_sortcop;
CALLRUNOPS();
- if (stack_sp != stack_base + 1)
+ if (PL_stack_sp != PL_stack_base + 1)
croak("Sort subroutine didn't return single value");
- if (!SvNIOKp(*stack_sp))
+ if (!SvNIOKp(*PL_stack_sp))
croak("Sort subroutine didn't return a numeric value");
- result = SvIV(*stack_sp);
- while (scopestack_ix > oldscopeix) {
+ result = SvIV(*PL_stack_sp);
+ while (PL_scopestack_ix > oldscopeix) {
LEAVE;
}
leave_scope(oldsaveix);
tmps = "";
else
tmps = POPp;
- sv_reset(tmps, curcop->cop_stash);
- PUSHs(&sv_yes);
+ sv_reset(tmps, PL_curcop->cop_stash);
+ PUSHs(&PL_sv_yes);
RETURN;
}
PP(pp_dbstate)
{
- curcop = (COP*)op;
+ PL_curcop = (COP*)op;
TAINT_NOT; /* Each statement is presumed innocent */
- stack_sp = stack_base + cxstack[cxstack_ix].blk_oldsp;
+ PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
FREETMPS;
- if (op->op_private || SvIV(DBsingle) || SvIV(DBsignal) || SvIV(DBtrace))
+ if (op->op_private || SvIV(PL_DBsingle) || SvIV(PL_DBsignal) || SvIV(PL_DBtrace))
{
djSP;
register CV *cv;
I32 hasargs;
GV *gv;
- gv = DBgv;
+ gv = PL_DBgv;
cv = GvCV(gv);
if (!cv)
DIE("No DB::DB routine defined");
- if (CvDEPTH(cv) >= 1 && !(debug & (1<<30))) /* don't do recursive DB::DB call */
+ if (CvDEPTH(cv) >= 1 && !(PL_debug & (1<<30))) /* don't do recursive DB::DB call */
return NORMAL;
ENTER;
SAVETMPS;
- SAVEI32(debug);
+ SAVEI32(PL_debug);
SAVESTACK_POS();
- debug = 0;
+ PL_debug = 0;
hasargs = 0;
SPAGAIN;
PUSHSUB(cx);
CvDEPTH(cv)++;
(void)SvREFCNT_inc(cv);
- SAVESPTR(curpad);
- curpad = AvARRAY((AV*)*av_fetch(CvPADLIST(cv),1,FALSE));
+ SAVESPTR(PL_curpad);
+ PL_curpad = AvARRAY((AV*)*av_fetch(CvPADLIST(cv),1,FALSE));
RETURNOP(CvSTART(cv));
}
else
else
#endif /* USE_THREADS */
if (op->op_targ) {
- svp = &curpad[op->op_targ]; /* "my" variable */
+ svp = &PL_curpad[op->op_targ]; /* "my" variable */
SAVESPTR(*svp);
}
else {
}
}
else {
- cx->blk_loop.iterary = curstack;
- AvFILLp(curstack) = SP - stack_base;
- cx->blk_loop.iterix = MARK - stack_base;
+ cx->blk_loop.iterary = PL_curstack;
+ AvFILLp(PL_curstack) = SP - PL_stack_base;
+ cx->blk_loop.iterix = MARK - PL_stack_base;
}
RETURN;
if (mark < SP)
*++newsp = sv_mortalcopy(*SP);
else
- *++newsp = &sv_undef;
+ *++newsp = &PL_sv_undef;
}
else {
while (mark < SP) {
PUTBACK;
POPLOOP2(); /* Stack values are safe: release loop vars ... */
- curpm = newpm; /* ... and pop $1 et al */
+ PL_curpm = newpm; /* ... and pop $1 et al */
LEAVE;
LEAVE;
PMOP *newpm;
I32 optype = 0;
- if (curstackinfo->si_type == PERLSI_SORT) {
- if (cxstack_ix == sortcxix || dopoptosub(cxstack_ix) <= sortcxix) {
- if (cxstack_ix > sortcxix)
- dounwind(sortcxix);
- AvARRAY(curstack)[1] = *SP;
- stack_sp = stack_base + 1;
+ if (PL_curstackinfo->si_type == PERLSI_SORT) {
+ if (cxstack_ix == PL_sortcxix || dopoptosub(cxstack_ix) <= PL_sortcxix) {
+ if (cxstack_ix > PL_sortcxix)
+ dounwind(PL_sortcxix);
+ AvARRAY(PL_curstack)[1] = *SP;
+ PL_stack_sp = PL_stack_base + 1;
return 0;
}
}
{
/* Unassume the success we assumed earlier. */
char *name = cx->blk_eval.old_name;
- (void)hv_delete(GvHVn(incgv), name, strlen(name), G_DISCARD);
+ (void)hv_delete(GvHVn(PL_incgv), name, strlen(name), G_DISCARD);
DIE("%s did not return a true value", name);
}
break;
} else
*++newsp = sv_mortalcopy(*SP);
} else
- *++newsp = &sv_undef;
+ *++newsp = &PL_sv_undef;
}
else if (gimme == G_ARRAY) {
while (++MARK <= SP) {
TAINT_NOT; /* Each item is independent */
}
}
- stack_sp = newsp;
+ PL_stack_sp = newsp;
/* Stack values are safe: */
if (popsub2) {
POPSUB2(); /* release CV and @_ ... */
}
- curpm = newpm; /* ... and pop $1 et al */
+ PL_curpm = newpm; /* ... and pop $1 et al */
LEAVE;
return pop_return();
OP *nextop;
SV **newsp;
PMOP *newpm;
- SV **mark = stack_base + cxstack[cxstack_ix].blk_oldsp;
+ SV **mark = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
if (op->op_flags & OPf_SPECIAL) {
cxix = dopoptoloop(cxstack_ix);
*++newsp = ((pop2 == CXt_SUB) && SvTEMP(*SP))
? *SP : sv_mortalcopy(*SP);
else
- *++newsp = &sv_undef;
+ *++newsp = &PL_sv_undef;
}
else if (gimme == G_ARRAY) {
while (++MARK <= SP) {
POPSUB2(); /* release CV and @_ ... */
break;
}
- curpm = newpm; /* ... and pop $1 et al */
+ PL_curpm = newpm; /* ... and pop $1 et al */
LEAVE;
return nextop;
dounwind(cxix);
TOPBLOCK(cx);
- oldsave = scopestack[scopestack_ix - 1];
+ oldsave = PL_scopestack[PL_scopestack_ix - 1];
LEAVE_SCOPE(oldsave);
return cx->blk_loop.next_op;
}
dounwind(cxix);
TOPBLOCK(cx);
- oldsave = scopestack[scopestack_ix - 1];
+ oldsave = PL_scopestack[PL_scopestack_ix - 1];
LEAVE_SCOPE(oldsave);
return cx->blk_loop.redo_op;
}
return kid;
}
for (kid = cUNOPo->op_first; kid; kid = kid->op_sibling) {
- if (kid == lastgotoprobe)
+ if (kid == PL_lastgotoprobe)
continue;
if ((kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) &&
(ops == opstack ||
TOPBLOCK(cx);
if (cx->cx_type == CXt_EVAL && cx->blk_eval.old_op_type == OP_ENTEREVAL)
DIE("Can't goto subroutine from an eval-string");
- mark = stack_sp;
+ mark = PL_stack_sp;
if (cx->cx_type == CXt_SUB &&
cx->blk_sub.hasargs) { /* put @_ back onto stack */
AV* av = cx->blk_sub.argarray;
items = AvFILLp(av) + 1;
- stack_sp++;
- EXTEND(stack_sp, items); /* @_ could have been extended. */
- Copy(AvARRAY(av), stack_sp, items, SV*);
- stack_sp += items;
+ PL_stack_sp++;
+ EXTEND(PL_stack_sp, items); /* @_ could have been extended. */
+ Copy(AvARRAY(av), PL_stack_sp, items, SV*);
+ PL_stack_sp += items;
#ifndef USE_THREADS
- SvREFCNT_dec(GvAV(defgv));
- GvAV(defgv) = cx->blk_sub.savearray;
+ SvREFCNT_dec(GvAV(PL_defgv));
+ GvAV(PL_defgv) = cx->blk_sub.savearray;
#endif /* USE_THREADS */
AvREAL_off(av);
av_clear(av);
#ifdef USE_THREADS
av = (AV*)curpad[0];
#else
- av = GvAV(defgv);
+ av = GvAV(PL_defgv);
#endif
items = AvFILLp(av) + 1;
- stack_sp++;
- EXTEND(stack_sp, items); /* @_ could have been extended. */
- Copy(AvARRAY(av), stack_sp, items, SV*);
- stack_sp += items;
+ PL_stack_sp++;
+ EXTEND(PL_stack_sp, items); /* @_ could have been extended. */
+ Copy(AvARRAY(av), PL_stack_sp, items, SV*);
+ PL_stack_sp += items;
}
if (cx->cx_type == CXt_SUB &&
!(CvDEPTH(cx->blk_sub.cv) = cx->blk_sub.olddepth))
SvREFCNT_dec(cx->blk_sub.cv);
- oldsave = scopestack[scopestack_ix - 1];
+ oldsave = PL_scopestack[PL_scopestack_ix - 1];
LEAVE_SCOPE(oldsave);
/* Now do some callish stuff. */
}
fp3 = (I32(*)_((int,int,int)))CvXSUB(cv);
items = (*fp3)(CvXSUBANY(cv).any_i32,
- mark - stack_base + 1,
+ mark - PL_stack_base + 1,
items);
- SP = stack_base + items;
+ SP = PL_stack_base + items;
}
else {
SV **newsp;
I32 gimme;
- stack_sp--; /* There is no cv arg. */
+ PL_stack_sp--; /* There is no cv arg. */
/* Push a mark for the start of arglist */
PUSHMARK(mark);
(void)(*CvXSUB(cv))(cv _PERL_OBJECT_THIS);
/* Pop the current context like a decent sub should */
- POPBLOCK(cx, curpm);
+ POPBLOCK(cx, PL_curpm);
/* Do _not_ use PUTBACK, keep the XSUB's return stack! */
}
LEAVE;
AV* padlist = CvPADLIST(cv);
SV** svp = AvARRAY(padlist);
if (cx->cx_type == CXt_EVAL) {
- in_eval = cx->blk_eval.old_in_eval;
- eval_root = cx->blk_eval.old_eval_root;
+ PL_in_eval = cx->blk_eval.old_in_eval;
+ PL_eval_root = cx->blk_eval.old_eval_root;
cx->cx_type = CXt_SUB;
cx->blk_sub.hasargs = 0;
}
if (CvDEPTH(cv) < 2)
(void)SvREFCNT_inc(cv);
else { /* save temporaries on recursion? */
- if (CvDEPTH(cv) == 100 && dowarn)
+ if (CvDEPTH(cv) == 100 && PL_dowarn)
sub_crush_depth(cv);
if (CvDEPTH(cv) > AvFILLp(padlist)) {
AV *newpad = newAV();
I32 ix = AvFILLp((AV*)svp[1]);
svp = AvARRAY(svp[0]);
for ( ;ix > 0; ix--) {
- if (svp[ix] != &sv_undef) {
+ if (svp[ix] != &PL_sv_undef) {
char *name = SvPVX(svp[ix]);
if ((SvFLAGS(svp[ix]) & SVf_FAKE)
|| *name == '&')
}
}
#endif /* USE_THREADS */
- SAVESPTR(curpad);
- curpad = AvARRAY((AV*)svp[CvDEPTH(cv)]);
+ SAVESPTR(PL_curpad);
+ PL_curpad = AvARRAY((AV*)svp[CvDEPTH(cv)]);
#ifndef USE_THREADS
if (cx->blk_sub.hasargs)
#endif /* USE_THREADS */
{
- AV* av = (AV*)curpad[0];
+ AV* av = (AV*)PL_curpad[0];
SV** ary;
#ifndef USE_THREADS
- cx->blk_sub.savearray = GvAV(defgv);
- GvAV(defgv) = (AV*)SvREFCNT_inc(av);
+ cx->blk_sub.savearray = GvAV(PL_defgv);
+ GvAV(PL_defgv) = (AV*)SvREFCNT_inc(av);
#endif /* USE_THREADS */
cx->blk_sub.argarray = av;
++mark;
* We do not care about using sv to call CV;
* it's for informational purposes only.
*/
- SV *sv = GvSV(DBsub);
+ SV *sv = GvSV(PL_DBsub);
CV *gotocv;
if (PERLDB_SUB_NN) {
}
if ( PERLDB_GOTO
&& (gotocv = perl_get_cv("DB::goto", FALSE)) ) {
- PUSHMARK( stack_sp );
+ PUSHMARK( PL_stack_sp );
perl_call_sv((SV*)gotocv, G_SCALAR | G_NODEBUG);
- stack_sp--;
+ PL_stack_sp--;
}
}
RETURNOP(CvSTART(cv));
}
}
else
- label = SvPV(sv,na);
+ label = SvPV(sv,PL_na);
}
else if (op->op_flags & OPf_SPECIAL) {
if (! do_dump)
/* find label */
- lastgotoprobe = 0;
+ PL_lastgotoprobe = 0;
*enterops = 0;
for (ix = cxstack_ix; ix >= 0; ix--) {
cx = &cxstack[ix];
switch (cx->cx_type) {
case CXt_EVAL:
- gotoprobe = eval_root; /* XXX not good for nested eval */
+ gotoprobe = PL_eval_root; /* XXX not good for nested eval */
break;
case CXt_LOOP:
gotoprobe = cx->blk_oldcop->op_sibling;
if (ix)
gotoprobe = cx->blk_oldcop->op_sibling;
else
- gotoprobe = main_root;
+ gotoprobe = PL_main_root;
break;
case CXt_SUB:
if (CvDEPTH(cx->blk_sub.cv)) {
default:
if (ix)
DIE("panic: goto");
- gotoprobe = main_root;
+ gotoprobe = PL_main_root;
break;
}
retop = dofindlabel(gotoprobe, label,
enterops, enterops + GOTO_DEPTH);
if (retop)
break;
- lastgotoprobe = gotoprobe;
+ PL_lastgotoprobe = gotoprobe;
}
if (!retop)
DIE("Can't find label %s", label);
ix = 0;
dounwind(ix);
TOPBLOCK(cx);
- oldsave = scopestack[scopestack_ix];
+ oldsave = PL_scopestack[PL_scopestack_ix];
LEAVE_SCOPE(oldsave);
}
#ifdef VMS
if (!retop) retop = main_start;
#endif
- restartop = retop;
- do_undump = TRUE;
+ PL_restartop = retop;
+ PL_do_undump = TRUE;
my_unexec();
- restartop = 0; /* hmm, must be GNU unexec().. */
- do_undump = FALSE;
+ PL_restartop = 0; /* hmm, must be GNU unexec().. */
+ PL_do_undump = FALSE;
}
- if (top_env->je_prev) {
- restartop = retop;
+ if (PL_top_env->je_prev) {
+ PL_restartop = retop;
JMPENV_JUMP(3);
}
#endif
}
my_exit(anum);
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
RETURN;
}
op = o;
#ifdef DEBUGGING
assert(CATCH_GET == TRUE);
- DEBUG_l(deb("Setting up local jumplevel %p, was %p\n", &cur_env, top_env));
+ DEBUG_l(deb("Setting up local jumplevel %p, was %p\n", &cur_env, PL_top_env));
#endif
JMPENV_PUSH(ret);
switch (ret) {
JMPENV_JUMP(ret);
/* NOTREACHED */
case 3:
- if (!restartop) {
+ if (!PL_restartop) {
PerlIO_printf(PerlIO_stderr(), "panic: restartop\n");
break;
}
- op = restartop;
- restartop = 0;
+ op = PL_restartop;
+ PL_restartop = 0;
/* FALL THROUGH */
case 0:
CALLRUNOPS();
SAVETMPS;
/* switch to eval mode */
- SAVESPTR(compiling.cop_filegv);
- SAVEI16(compiling.cop_line);
- sprintf(tmpbuf, "_<(%.10s_eval %lu)", code, (unsigned long)++evalseq);
- compiling.cop_filegv = gv_fetchfile(tmpbuf+2);
- compiling.cop_line = 1;
+ SAVESPTR(PL_compiling.cop_filegv);
+ SAVEI16(PL_compiling.cop_line);
+ sprintf(tmpbuf, "_<(%.10s_eval %lu)", code, (unsigned long)++PL_evalseq);
+ PL_compiling.cop_filegv = gv_fetchfile(tmpbuf+2);
+ PL_compiling.cop_line = 1;
/* XXX For C<eval "...">s within BEGIN {} blocks, this ends up
deleting the eval's FILEGV from the stash before gv_check() runs
(i.e. before run-time proper). To work around the coredump that
ensues, we always turn GvMULTI_on for any globals that were
introduced within evals. See force_ident(). GSAR 96-10-12 */
safestr = savepv(tmpbuf);
- SAVEDELETE(defstash, safestr, strlen(safestr));
+ SAVEDELETE(PL_defstash, safestr, strlen(safestr));
SAVEHINTS();
#ifdef OP_IN_REGISTER
opsave = op;
#else
SAVEPPTR(op);
#endif
- hints = 0;
+ PL_hints = 0;
op = &dummy;
op->op_type = 0; /* Avoid uninit warning. */
PUSHBLOCK(cx, CXt_EVAL, SP);
PUSHEVAL(cx, 0, compiling.cop_filegv);
rop = doeval(G_SCALAR, startop);
- POPBLOCK(cx,curpm);
+ POPBLOCK(cx,PL_curpm);
POPEVAL(cx);
(*startop)->op_type = OP_NULL;
(*startop)->op_ppaddr = ppaddr[OP_NULL];
lex_end();
- *avp = (AV*)SvREFCNT_inc(comppad);
+ *avp = (AV*)SvREFCNT_inc(PL_comppad);
LEAVE;
#ifdef OP_IN_REGISTER
op = opsave;
AV* comppadlist;
I32 i;
- in_eval = 1;
+ PL_in_eval = 1;
PUSHMARK(SP);
/* set up a scratch pad */
- SAVEI32(padix);
- SAVESPTR(curpad);
- SAVESPTR(comppad);
- SAVESPTR(comppad_name);
- SAVEI32(comppad_name_fill);
- SAVEI32(min_intro_pending);
- SAVEI32(max_intro_pending);
+ SAVEI32(PL_padix);
+ SAVESPTR(PL_curpad);
+ SAVESPTR(PL_comppad);
+ SAVESPTR(PL_comppad_name);
+ SAVEI32(PL_comppad_name_fill);
+ SAVEI32(PL_min_intro_pending);
+ SAVEI32(PL_max_intro_pending);
- caller = compcv;
+ caller = PL_compcv;
for (i = cxstack_ix - 1; i >= 0; i--) {
PERL_CONTEXT *cx = &cxstack[i];
if (cx->cx_type == CXt_EVAL)
}
}
- SAVESPTR(compcv);
- compcv = (CV*)NEWSV(1104,0);
- sv_upgrade((SV *)compcv, SVt_PVCV);
- CvUNIQUE_on(compcv);
+ SAVESPTR(PL_compcv);
+ PL_compcv = (CV*)NEWSV(1104,0);
+ sv_upgrade((SV *)PL_compcv, SVt_PVCV);
+ CvUNIQUE_on(PL_compcv);
#ifdef USE_THREADS
CvOWNER(compcv) = 0;
New(666, CvMUTEXP(compcv), 1, perl_mutex);
MUTEX_INIT(CvMUTEXP(compcv));
#endif /* USE_THREADS */
- comppad = newAV();
- av_push(comppad, Nullsv);
- curpad = AvARRAY(comppad);
- comppad_name = newAV();
- comppad_name_fill = 0;
- min_intro_pending = 0;
- padix = 0;
+ PL_comppad = newAV();
+ av_push(PL_comppad, Nullsv);
+ PL_curpad = AvARRAY(PL_comppad);
+ PL_comppad_name = newAV();
+ PL_comppad_name_fill = 0;
+ PL_min_intro_pending = 0;
+ PL_padix = 0;
#ifdef USE_THREADS
av_store(comppad_name, 0, newSVpv("@_", 2));
curpad[0] = (SV*)newAV();
comppadlist = newAV();
AvREAL_off(comppadlist);
- av_store(comppadlist, 0, (SV*)comppad_name);
- av_store(comppadlist, 1, (SV*)comppad);
- CvPADLIST(compcv) = comppadlist;
+ av_store(comppadlist, 0, (SV*)PL_comppad_name);
+ av_store(comppadlist, 1, (SV*)PL_comppad);
+ CvPADLIST(PL_compcv) = comppadlist;
if (!saveop || saveop->op_type != OP_REQUIRE)
- CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc(caller);
+ CvOUTSIDE(PL_compcv) = (CV*)SvREFCNT_inc(caller);
- SAVEFREESV(compcv);
+ SAVEFREESV(PL_compcv);
/* make sure we compile in the right package */
- newstash = curcop->cop_stash;
- if (curstash != newstash) {
- SAVESPTR(curstash);
- curstash = newstash;
+ newstash = PL_curcop->cop_stash;
+ if (PL_curstash != newstash) {
+ SAVESPTR(PL_curstash);
+ PL_curstash = newstash;
}
- SAVESPTR(beginav);
- beginav = newAV();
- SAVEFREESV(beginav);
+ SAVESPTR(PL_beginav);
+ PL_beginav = newAV();
+ SAVEFREESV(PL_beginav);
/* try to compile it */
- eval_root = Nullop;
- error_count = 0;
- curcop = &compiling;
- curcop->cop_arybase = 0;
- SvREFCNT_dec(rs);
- rs = newSVpv("\n", 1);
+ PL_eval_root = Nullop;
+ PL_error_count = 0;
+ PL_curcop = &PL_compiling;
+ PL_curcop->cop_arybase = 0;
+ SvREFCNT_dec(PL_rs);
+ PL_rs = newSVpv("\n", 1);
if (saveop && saveop->op_flags & OPf_SPECIAL)
- in_eval |= 4;
+ PL_in_eval |= 4;
else
sv_setpv(ERRSV,"");
- if (yyparse() || error_count || !eval_root) {
+ if (yyparse() || PL_error_count || !PL_eval_root) {
SV **newsp;
I32 gimme;
PERL_CONTEXT *cx;
I32 optype = 0; /* Might be reset by POPEVAL. */
op = saveop;
- if (eval_root) {
- op_free(eval_root);
- eval_root = Nullop;
+ if (PL_eval_root) {
+ op_free(PL_eval_root);
+ PL_eval_root = Nullop;
}
- SP = stack_base + POPMARK; /* pop original mark */
+ SP = PL_stack_base + POPMARK; /* pop original mark */
if (!startop) {
- POPBLOCK(cx,curpm);
+ POPBLOCK(cx,PL_curpm);
POPEVAL(cx);
pop_return();
}
lex_end();
LEAVE;
if (optype == OP_REQUIRE) {
- char* msg = SvPVx(ERRSV, na);
+ char* msg = SvPVx(ERRSV, PL_na);
DIE("%s", *msg ? msg : "Compilation failed in require");
} else if (startop) {
- char* msg = SvPVx(ERRSV, na);
+ char* msg = SvPVx(ERRSV, PL_na);
- POPBLOCK(cx,curpm);
+ POPBLOCK(cx,PL_curpm);
POPEVAL(cx);
croak("%sCompilation failed in regexp", (*msg ? msg : "Unknown error\n"));
}
- SvREFCNT_dec(rs);
- rs = SvREFCNT_inc(nrs);
+ SvREFCNT_dec(PL_rs);
+ PL_rs = SvREFCNT_inc(PL_nrs);
#ifdef USE_THREADS
MUTEX_LOCK(&eval_mutex);
eval_owner = 0;
#endif /* USE_THREADS */
RETPUSHUNDEF;
}
- SvREFCNT_dec(rs);
- rs = SvREFCNT_inc(nrs);
- compiling.cop_line = 0;
+ SvREFCNT_dec(PL_rs);
+ PL_rs = SvREFCNT_inc(PL_nrs);
+ PL_compiling.cop_line = 0;
if (startop) {
- *startop = eval_root;
- SvREFCNT_dec(CvOUTSIDE(compcv));
- CvOUTSIDE(compcv) = Nullcv;
+ *startop = PL_eval_root;
+ SvREFCNT_dec(CvOUTSIDE(PL_compcv));
+ CvOUTSIDE(PL_compcv) = Nullcv;
} else
- SAVEFREEOP(eval_root);
+ SAVEFREEOP(PL_eval_root);
if (gimme & G_VOID)
- scalarvoid(eval_root);
+ scalarvoid(PL_eval_root);
else if (gimme & G_ARRAY)
- list(eval_root);
+ list(PL_eval_root);
else
- scalar(eval_root);
+ scalar(PL_eval_root);
DEBUG_x(dump_eval());
if (cv) {
dSP;
PUSHMARK(SP);
- XPUSHs((SV*)compiling.cop_filegv);
+ XPUSHs((SV*)PL_compiling.cop_filegv);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
}
/* compiled okay, so do it */
- CvDEPTH(compcv) = 1;
- SP = stack_base + POPMARK; /* pop original mark */
+ CvDEPTH(PL_compcv) = 1;
+ SP = PL_stack_base + POPMARK; /* pop original mark */
op = saveop; /* The caller may need it. */
#ifdef USE_THREADS
MUTEX_LOCK(&eval_mutex);
MUTEX_UNLOCK(&eval_mutex);
#endif /* USE_THREADS */
- RETURNOP(eval_start);
+ RETURNOP(PL_eval_start);
}
PP(pp_require)
sv = POPs;
if (SvNIOKp(sv) && !SvPOKp(sv)) {
SET_NUMERIC_STANDARD();
- if (atof(patchlevel) + 0.00000999 < SvNV(sv))
+ if (atof(PL_patchlevel) + 0.00000999 < SvNV(sv))
DIE("Perl %s required--this is only version %s, stopped",
- SvPV(sv,na),patchlevel);
+ SvPV(sv,PL_na),PL_patchlevel);
RETPUSHYES;
}
name = SvPV(sv, len);
DIE("Null filename used");
TAINT_PROPER("require");
if (op->op_type == OP_REQUIRE &&
- (svp = hv_fetch(GvHVn(incgv), name, len, 0)) &&
- *svp != &sv_undef)
+ (svp = hv_fetch(GvHVn(PL_incgv), name, len, 0)) &&
+ *svp != &PL_sv_undef)
RETPUSHYES;
/* prepare to compile file */
tryrsfp = PerlIO_open(name,PERL_SCRIPT_MODE);
}
else {
- AV *ar = GvAVn(incgv);
+ AV *ar = GvAVn(PL_incgv);
I32 i;
#ifdef VMS
char *unixname;
{
namesv = NEWSV(806, 0);
for (i = 0; i <= AvFILL(ar); i++) {
- char *dir = SvPVx(*av_fetch(ar, i, TRUE), na);
+ char *dir = SvPVx(*av_fetch(ar, i, TRUE), PL_na);
#ifdef VMS
char *unixdir;
if ((unixdir = tounixpath(dir, Nullch)) == Nullch)
}
}
}
- SAVESPTR(compiling.cop_filegv);
- compiling.cop_filegv = gv_fetchfile(tryrsfp ? tryname : name);
+ SAVESPTR(PL_compiling.cop_filegv);
+ PL_compiling.cop_filegv = gv_fetchfile(tryrsfp ? tryname : name);
SvREFCNT_dec(namesv);
if (!tryrsfp) {
if (op->op_type == OP_REQUIRE) {
SV *msg = sv_2mortal(newSVpvf("Can't locate %s in @INC", name));
SV *dirmsgsv = NEWSV(0, 0);
- AV *ar = GvAVn(incgv);
+ AV *ar = GvAVn(PL_incgv);
I32 i;
if (instr(SvPVX(msg), ".h "))
sv_catpv(msg, " (change .h to .ph maybe?)");
sv_catpv(msg, " (did you run h2ph?)");
sv_catpv(msg, " (@INC contains:");
for (i = 0; i <= AvFILL(ar); i++) {
- char *dir = SvPVx(*av_fetch(ar, i, TRUE), na);
+ char *dir = SvPVx(*av_fetch(ar, i, TRUE), PL_na);
sv_setpvf(dirmsgsv, " %s", dir);
sv_catsv(msg, dirmsgsv);
}
}
/* Assume success here to prevent recursive requirement. */
- (void)hv_store(GvHVn(incgv), name, strlen(name),
- newSVsv(GvSV(compiling.cop_filegv)), 0 );
+ (void)hv_store(GvHVn(PL_incgv), name, strlen(name),
+ newSVsv(GvSV(PL_compiling.cop_filegv)), 0 );
ENTER;
SAVETMPS;
lex_start(sv_2mortal(newSVpv("",0)));
- if (rsfp_filters){
- save_aptr(&rsfp_filters);
- rsfp_filters = NULL;
+ if (PL_rsfp_filters){
+ save_aptr(&PL_rsfp_filters);
+ PL_rsfp_filters = NULL;
}
- rsfp = tryrsfp;
+ PL_rsfp = tryrsfp;
name = savepv(name);
SAVEFREEPV(name);
SAVEHINTS();
- hints = 0;
+ PL_hints = 0;
/* switch to eval mode */
PUSHBLOCK(cx, CXt_EVAL, SP);
PUSHEVAL(cx, name, compiling.cop_filegv);
- compiling.cop_line = 0;
+ PL_compiling.cop_line = 0;
PUTBACK;
#ifdef USE_THREADS
djSP;
register PERL_CONTEXT *cx;
dPOPss;
- I32 gimme = GIMME_V, was = sub_generation;
+ I32 gimme = GIMME_V, was = PL_sub_generation;
char tmpbuf[TYPE_DIGITS(long) + 12];
char *safestr;
STRLEN len;
/* switch to eval mode */
- SAVESPTR(compiling.cop_filegv);
- sprintf(tmpbuf, "_<(eval %lu)", (unsigned long)++evalseq);
- compiling.cop_filegv = gv_fetchfile(tmpbuf+2);
- compiling.cop_line = 1;
+ SAVESPTR(PL_compiling.cop_filegv);
+ sprintf(tmpbuf, "_<(eval %lu)", (unsigned long)++PL_evalseq);
+ PL_compiling.cop_filegv = gv_fetchfile(tmpbuf+2);
+ PL_compiling.cop_line = 1;
/* XXX For C<eval "...">s within BEGIN {} blocks, this ends up
deleting the eval's FILEGV from the stash before gv_check() runs
(i.e. before run-time proper). To work around the coredump that
ensues, we always turn GvMULTI_on for any globals that were
introduced within evals. See force_ident(). GSAR 96-10-12 */
safestr = savepv(tmpbuf);
- SAVEDELETE(defstash, safestr, strlen(safestr));
+ SAVEDELETE(PL_defstash, safestr, strlen(safestr));
SAVEHINTS();
- hints = op->op_targ;
+ PL_hints = op->op_targ;
push_return(op->op_next);
PUSHBLOCK(cx, CXt_EVAL, SP);
/* prepare to compile string */
- if (PERLDB_LINE && curstash != debstash)
- save_lines(GvAV(compiling.cop_filegv), linestr);
+ if (PERLDB_LINE && PL_curstash != PL_debstash)
+ save_lines(GvAV(PL_compiling.cop_filegv), PL_linestr);
PUTBACK;
#ifdef USE_THREADS
MUTEX_LOCK(&eval_mutex);
MUTEX_UNLOCK(&eval_mutex);
#endif /* USE_THREADS */
ret = doeval(gimme, NULL);
- if (PERLDB_INTER && was != sub_generation /* Some subs defined here. */
+ if (PERLDB_INTER && was != PL_sub_generation /* Some subs defined here. */
&& ret != op->op_next) { /* Successive compilation. */
strcpy(safestr, "_<(eval )"); /* Anything fake and short. */
}
}
else {
MEXTEND(mark,0);
- *MARK = &sv_undef;
+ *MARK = &PL_sv_undef;
}
}
else {
}
}
}
- curpm = newpm; /* Don't pop $1 et al till now */
+ PL_curpm = newpm; /* Don't pop $1 et al till now */
/*
* Closures mentioned at top level of eval cannot be referenced
* (Note that the fact that compcv and friends are still set here
* is, AFAIK, an accident.) --Chip
*/
- if (AvFILLp(comppad_name) >= 0) {
- SV **svp = AvARRAY(comppad_name);
+ if (AvFILLp(PL_comppad_name) >= 0) {
+ SV **svp = AvARRAY(PL_comppad_name);
I32 ix;
- for (ix = AvFILLp(comppad_name); ix >= 0; ix--) {
+ for (ix = AvFILLp(PL_comppad_name); ix >= 0; ix--) {
SV *sv = svp[ix];
- if (sv && sv != &sv_undef && *SvPVX(sv) == '&') {
+ if (sv && sv != &PL_sv_undef && *SvPVX(sv) == '&') {
SvREFCNT_dec(sv);
- svp[ix] = &sv_undef;
+ svp[ix] = &PL_sv_undef;
- sv = curpad[ix];
+ sv = PL_curpad[ix];
if (CvCLONE(sv)) {
SvREFCNT_dec(CvOUTSIDE(sv));
CvOUTSIDE(sv) = Nullcv;
SvREFCNT_dec(sv);
sv = NEWSV(0,0);
SvPADTMP_on(sv);
- curpad[ix] = sv;
+ PL_curpad[ix] = sv;
}
}
}
}
#ifdef DEBUGGING
- assert(CvDEPTH(compcv) == 1);
+ assert(CvDEPTH(PL_compcv) == 1);
#endif
- CvDEPTH(compcv) = 0;
+ CvDEPTH(PL_compcv) = 0;
lex_end();
if (optype == OP_REQUIRE &&
{
/* Unassume the success we assumed earlier. */
char *name = cx->blk_eval.old_name;
- (void)hv_delete(GvHVn(incgv), name, strlen(name), G_DISCARD);
+ (void)hv_delete(GvHVn(PL_incgv), name, strlen(name), G_DISCARD);
retop = die("%s did not return a true value", name);
/* die_where() did LEAVE, or we won't be here */
}
push_return(cLOGOP->op_other->op_next);
PUSHBLOCK(cx, CXt_EVAL, SP);
PUSHEVAL(cx, 0, 0);
- eval_root = op; /* Only needed so that goto works right. */
+ PL_eval_root = op; /* Only needed so that goto works right. */
- in_eval = 1;
+ PL_in_eval = 1;
sv_setpv(ERRSV,"");
PUTBACK;
return DOCATCH(op->op_next);
}
else {
MEXTEND(mark,0);
- *MARK = &sv_undef;
+ *MARK = &PL_sv_undef;
}
SP = MARK;
}
}
}
}
- curpm = newpm; /* Don't pop $1 et al till now */
+ PL_curpm = newpm; /* Don't pop $1 et al till now */
LEAVE;
sv_setpv(ERRSV,"");
PP(pp_nextstate)
{
- curcop = (COP*)op;
+ PL_curcop = (COP*)op;
TAINT_NOT; /* Each statement is presumed innocent */
- stack_sp = stack_base + cxstack[cxstack_ix].blk_oldsp;
+ PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
FREETMPS;
return NORMAL;
}
PP(pp_pushmark)
{
- PUSHMARK(stack_sp);
+ PUSHMARK(PL_stack_sp);
return NORMAL;
}
SV *temp;
temp = left; left = right; right = temp;
}
- if (tainting && tainted && !SvTAINTED(left))
+ if (PL_tainting && PL_tainted && !SvTAINTED(left))
TAINT_NOT;
SvSetMagicSV(right, left);
SETs(right);
{
I32 oldsave;
TAINT_NOT; /* Each statement is presumed innocent */
- stack_sp = stack_base + cxstack[cxstack_ix].blk_oldsp;
+ PL_stack_sp = PL_stack_base + cxstack[cxstack_ix].blk_oldsp;
FREETMPS;
- oldsave = scopestack[scopestack_ix - 1];
+ oldsave = PL_scopestack[PL_scopestack_ix - 1];
LEAVE_SCOPE(oldsave);
return NORMAL;
}
XPUSHs(TARG);
if (op->op_flags & OPf_MOD) {
if (op->op_private & OPpLVAL_INTRO)
- SAVECLEARSV(curpad[op->op_targ]);
+ SAVECLEARSV(PL_curpad[op->op_targ]);
else if (op->op_private & OPpDEREF) {
PUTBACK;
- vivify_ref(curpad[op->op_targ], op->op_private & OPpDEREF);
+ vivify_ref(PL_curpad[op->op_targ], op->op_private & OPpDEREF);
SPAGAIN;
}
}
PP(pp_readline)
{
- last_in_gv = (GV*)(*stack_sp--);
+ PL_last_in_gv = (GV*)(*PL_stack_sp--);
return do_readline();
}
AV *av = GvAV((GV*)cSVOP->op_sv);
U32 lval = op->op_flags & OPf_MOD;
SV** svp = av_fetch(av, op->op_private, lval);
- SV *sv = (svp ? *svp : &sv_undef);
+ SV *sv = (svp ? *svp : &PL_sv_undef);
EXTEND(SP, 1);
if (!lval && SvGMAGICAL(sv)) /* see note in pp_helem() */
sv = sv_mortalcopy(sv);
if (op->op_flags & OPf_STACKED)
gv = (GV*)*++MARK;
else
- gv = defoutgv;
+ gv = PL_defoutgv;
if (SvRMAGICAL(gv) && (mg = mg_find((SV*)gv, 'q'))) {
if (MARK == ORIGMARK) {
/* If using default handle then we need to make space to
RETURN;
}
if (!(io = GvIO(gv))) {
- if (dowarn) {
+ if (PL_dowarn) {
SV* sv = sv_newmortal();
gv_fullname3(sv, gv, Nullch);
- warn("Filehandle %s never opened", SvPV(sv,na));
+ warn("Filehandle %s never opened", SvPV(sv,PL_na));
}
SETERRNO(EBADF,RMS$_IFI);
goto just_say_no;
}
else if (!(fp = IoOFP(io))) {
- if (dowarn) {
+ if (PL_dowarn) {
SV* sv = sv_newmortal();
gv_fullname3(sv, gv, Nullch);
if (IoIFP(io))
- warn("Filehandle %s opened only for input", SvPV(sv,na));
+ warn("Filehandle %s opened only for input", SvPV(sv,PL_na));
else
- warn("print on closed filehandle %s", SvPV(sv,na));
+ warn("print on closed filehandle %s", SvPV(sv,PL_na));
}
SETERRNO(EBADF,IoIFP(io)?RMS$_FAC:RMS$_IFI);
goto just_say_no;
}
else {
MARK++;
- if (ofslen) {
+ if (PL_ofslen) {
while (MARK <= SP) {
if (!do_print(*MARK, fp))
break;
MARK++;
if (MARK <= SP) {
- if (PerlIO_write(fp, ofs, ofslen) == 0 || PerlIO_error(fp)) {
+ if (PerlIO_write(fp, PL_ofs, PL_ofslen) == 0 || PerlIO_error(fp)) {
MARK--;
break;
}
if (MARK <= SP)
goto just_say_no;
else {
- if (orslen)
- if (PerlIO_write(fp, ors, orslen) == 0 || PerlIO_error(fp))
+ if (PL_orslen)
+ if (PerlIO_write(fp, PL_ors, PL_orslen) == 0 || PerlIO_error(fp))
goto just_say_no;
if (IoFLAGS(io) & IOf_FLUSH)
}
}
SP = ORIGMARK;
- PUSHs(&sv_yes);
+ PUSHs(&PL_sv_yes);
RETURN;
just_say_no:
SP = ORIGMARK;
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
RETURN;
}
if (op->op_flags & OPf_REF ||
op->op_private & HINT_STRICT_REFS)
DIE(no_usym, "an ARRAY");
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
if (GIMME == G_ARRAY)
RETURN;
RETPUSHUNDEF;
}
- sym = SvPV(sv,na);
+ sym = SvPV(sv,PL_na);
if (op->op_private & HINT_STRICT_REFS)
DIE(no_symref, sym, "an ARRAY");
gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PVAV);
U32 i;
for (i=0; i < maxarg; i++) {
SV **svp = av_fetch(av, i, FALSE);
- SP[i+1] = (svp) ? *svp : &sv_undef;
+ SP[i+1] = (svp) ? *svp : &PL_sv_undef;
}
}
else {
if (op->op_flags & OPf_REF ||
op->op_private & HINT_STRICT_REFS)
DIE(no_usym, "a HASH");
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
if (GIMME == G_ARRAY) {
SP--;
}
RETSETUNDEF;
}
- sym = SvPV(sv,na);
+ sym = SvPV(sv,PL_na);
if (op->op_private & HINT_STRICT_REFS)
DIE(no_symref, sym, "a HASH");
gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PVHV);
}
if (GIMME == G_ARRAY) { /* array wanted */
- *stack_sp = (SV*)hv;
+ *PL_stack_sp = (SV*)hv;
return do_kv(ARGS);
}
else {
PP(pp_aassign)
{
djSP;
- SV **lastlelem = stack_sp;
- SV **lastrelem = stack_base + POPMARK;
- SV **firstrelem = stack_base + POPMARK + 1;
+ SV **lastlelem = PL_stack_sp;
+ SV **lastrelem = PL_stack_base + POPMARK;
+ SV **firstrelem = PL_stack_base + POPMARK + 1;
SV **firstlelem = lastrelem + 1;
register SV **relem;
I32 i;
int magic;
- delaymagic = DM_DELAY; /* catch simultaneous items */
+ PL_delaymagic = DM_DELAY; /* catch simultaneous items */
/* If there's a common identifier on both sides we have to take
* special care that assigning the identifier on the left doesn't
if (*relem)
sv = *(relem++);
else
- sv = &sv_no, relem++;
+ sv = &PL_sv_no, relem++;
tmpstr = NEWSV(29,0);
if (*relem)
sv_setsv(tmpstr,*relem); /* value */
if (relem == lastrelem) {
if (*relem) {
HE *didstore;
- if (dowarn) {
+ if (PL_dowarn) {
if (relem == firstrelem &&
SvROK(*relem) &&
( SvTYPE(SvRV(*relem)) == SVt_PVAV ||
break;
default:
if (SvTHINKFIRST(sv)) {
- if (SvREADONLY(sv) && curcop != &compiling) {
+ if (SvREADONLY(sv) && PL_curcop != &PL_compiling) {
if (!SvIMMORTAL(sv))
DIE(no_modify);
if (relem <= lastrelem)
*(relem++) = sv;
}
else
- sv_setsv(sv, &sv_undef);
+ sv_setsv(sv, &PL_sv_undef);
SvSETMAGIC(sv);
break;
}
}
- if (delaymagic & ~DM_DELAY) {
- if (delaymagic & DM_UID) {
+ if (PL_delaymagic & ~DM_DELAY) {
+ if (PL_delaymagic & DM_UID) {
#ifdef HAS_SETRESUID
(void)setresuid(uid,euid,(Uid_t)-1);
#else
# ifdef HAS_SETREUID
- (void)setreuid(uid,euid);
+ (void)setreuid(PL_uid,PL_euid);
# else
# ifdef HAS_SETRUID
if ((delaymagic & DM_UID) == DM_RUID) {
}
# endif /* HAS_SETREUID */
#endif /* HAS_SETRESUID */
- uid = (int)PerlProc_getuid();
- euid = (int)PerlProc_geteuid();
+ PL_uid = (int)PerlProc_getuid();
+ PL_euid = (int)PerlProc_geteuid();
}
- if (delaymagic & DM_GID) {
+ if (PL_delaymagic & DM_GID) {
#ifdef HAS_SETRESGID
(void)setresgid(gid,egid,(Gid_t)-1);
#else
# ifdef HAS_SETREGID
- (void)setregid(gid,egid);
+ (void)setregid(PL_gid,PL_egid);
# else
# ifdef HAS_SETRGID
if ((delaymagic & DM_GID) == DM_RGID) {
}
# endif /* HAS_SETREGID */
#endif /* HAS_SETRESGID */
- gid = (int)PerlProc_getgid();
- egid = (int)PerlProc_getegid();
+ PL_gid = (int)PerlProc_getgid();
+ PL_egid = (int)PerlProc_getegid();
}
- tainting |= (uid && (euid != uid || egid != gid));
+ PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
}
- delaymagic = 0;
+ PL_delaymagic = 0;
gimme = GIMME_V;
if (gimme == G_VOID)
SP = firstrelem + (lastlelem - firstlelem);
lelem = firstlelem + (relem - firstrelem);
while (relem <= SP)
- *relem++ = (lelem <= lastlelem) ? *lelem++ : &sv_undef;
+ *relem++ = (lelem <= lastlelem) ? *lelem++ : &PL_sv_undef;
}
RETURN;
}
I32 gimme = GIMME;
STRLEN len;
I32 minmatch = 0;
- I32 oldsave = savestack_ix;
+ I32 oldsave = PL_savestack_ix;
I32 update_minmatch = 1;
SV *screamer;
if (!s)
DIE("panic: do_match");
rxtainted = ((pm->op_pmdynflags & PMdf_TAINTED) ||
- (tainted && (pm->op_pmflags & PMf_RETAINT)));
+ (PL_tainted && (pm->op_pmflags & PMf_RETAINT)));
TAINT_NOT;
if (pm->op_pmdynflags & PMdf_USED) {
RETPUSHNO;
}
- if (!rx->prelen && curpm) {
- pm = curpm;
+ if (!rx->prelen && PL_curpm) {
+ pm = PL_curpm;
rx = pm->op_pmregexp;
}
if (rx->minlen > len) goto failure;
if (!rx->nparens && !global)
gimme = G_SCALAR; /* accidental array context? */
safebase = (((gimme == G_ARRAY) || global || !rx->nparens)
- && !sawampersand);
+ && !PL_sawampersand);
safebase = safebase ? 0 : REXEC_COPY_STR ;
if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
- SAVEINT(multiline);
- multiline = pm->op_pmflags & PMf_MULTILINE;
+ SAVEINT(PL_multiline);
+ PL_multiline = pm->op_pmflags & PMf_MULTILINE;
}
play_it_again:
if ( screamer ) {
I32 p = -1;
- if (screamfirst[BmRARE(rx->check_substr)] < 0)
+ if (PL_screamfirst[BmRARE(rx->check_substr)] < 0)
goto nope;
else if (!(s = screaminstr(TARG, rx->check_substr,
rx->check_offset_min, 0, &p, 0)))
goto nope;
else if ((rx->reganch & ROPT_CHECK_ALL)
- && !sawampersand && !SvTAIL(rx->check_substr))
+ && !PL_sawampersand && !SvTAIL(rx->check_substr))
goto yup;
}
else if (!(s = fbm_instr((unsigned char*)s + rx->check_offset_min,
(unsigned char*)strend,
rx->check_substr, 0)))
goto nope;
- else if ((rx->reganch & ROPT_CHECK_ALL) && !sawampersand)
+ else if ((rx->reganch & ROPT_CHECK_ALL) && !PL_sawampersand)
goto yup;
if (s && rx->check_offset_max < s - t) {
++BmUSEFUL(rx->check_substr);
}
/* Now checkstring is fixed, i.e. at fixed offset from the
beginning of match, and the match is anchored at s. */
- else if (!multiline) { /* Anchored near beginning of string. */
+ else if (!PL_multiline) { /* Anchored near beginning of string. */
I32 slen;
if (*SvPVX(rx->check_substr) != s[rx->check_offset_min]
|| ((slen = SvCUR(rx->check_substr)) > 1
if (CALLREGEXEC(rx, s, strend, truebase, minmatch,
screamer, NULL, safebase))
{
- curpm = pm;
+ PL_curpm = pm;
if (pm->op_pmflags & PMf_ONCE)
pm->op_pmdynflags |= PMdf_USED;
goto gotcha;
RX_MATCH_TAINTED_on(rx);
TAINT_IF(RX_MATCH_TAINTED(rx));
++BmUSEFUL(rx->check_substr);
- curpm = pm;
+ PL_curpm = pm;
if (pm->op_pmflags & PMf_ONCE)
pm->op_pmdynflags |= PMdf_USED;
Safefree(rx->subbase);
rx->endp[0] = s + SvCUR(rx->check_substr);
goto gotcha;
}
- if (sawampersand) {
+ if (PL_sawampersand) {
char *tmps;
tmps = rx->subbase = savepvn(t, strend-t);
STRLEN tmplen = 0;
STRLEN offset;
PerlIO *fp;
- register IO *io = GvIO(last_in_gv);
+ register IO *io = GvIO(PL_last_in_gv);
register I32 type = op->op_type;
I32 gimme = GIMME_V;
MAGIC *mg;
- if (SvRMAGICAL(last_in_gv) && (mg = mg_find((SV*)last_in_gv, 'q'))) {
+ if (SvRMAGICAL(PL_last_in_gv) && (mg = mg_find((SV*)PL_last_in_gv, 'q'))) {
PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
if (IoFLAGS(io) & IOf_START) {
IoFLAGS(io) &= ~IOf_START;
IoLINES(io) = 0;
- if (av_len(GvAVn(last_in_gv)) < 0) {
- do_open(last_in_gv,"-",1,FALSE,0,0,Nullfp);
- sv_setpvn(GvSV(last_in_gv), "-", 1);
- SvSETMAGIC(GvSV(last_in_gv));
+ if (av_len(GvAVn(PL_last_in_gv)) < 0) {
+ do_open(PL_last_in_gv,"-",1,FALSE,0,0,Nullfp);
+ sv_setpvn(GvSV(PL_last_in_gv), "-", 1);
+ SvSETMAGIC(GvSV(PL_last_in_gv));
fp = IoIFP(io);
goto have_fp;
}
}
- fp = nextargv(last_in_gv);
+ fp = nextargv(PL_last_in_gv);
if (!fp) { /* Note: fp != IoIFP(io) */
- (void)do_close(last_in_gv, FALSE); /* now it does*/
+ (void)do_close(PL_last_in_gv, FALSE); /* now it does*/
IoFLAGS(io) |= IOf_START;
}
}
#endif /* !OS2 */
#else /* !DOSISH */
#if defined(CSH)
- sv_setpvn(tmpcmd, cshname, cshlen);
+ sv_setpvn(tmpcmd, PL_cshname, PL_cshlen);
sv_catpv(tmpcmd, " -cf 'set nonomatch; glob ");
sv_catsv(tmpcmd, tmpglob);
sv_catpv(tmpcmd, "' 2>/dev/null |");
#endif
#endif /* !CSH */
#endif /* !DOSISH */
- (void)do_open(last_in_gv, SvPVX(tmpcmd), SvCUR(tmpcmd),
+ (void)do_open(PL_last_in_gv, SvPVX(tmpcmd), SvCUR(tmpcmd),
FALSE, 0, 0, Nullfp);
fp = IoIFP(io);
#endif /* !VMS */
SP--;
}
if (!fp) {
- if (dowarn && io && !(IoFLAGS(io) & IOf_START))
- warn("Read on closed filehandle <%s>", GvENAME(last_in_gv));
+ if (PL_dowarn && io && !(IoFLAGS(io) & IOf_START))
+ warn("Read on closed filehandle <%s>", GvENAME(PL_last_in_gv));
if (gimme == G_SCALAR) {
(void)SvOK_off(TARG);
PUSHTARG;
if (!sv_gets(sv, fp, offset)) {
PerlIO_clearerr(fp);
if (IoFLAGS(io) & IOf_ARGV) {
- fp = nextargv(last_in_gv);
+ fp = nextargv(PL_last_in_gv);
if (fp)
continue;
- (void)do_close(last_in_gv, FALSE);
+ (void)do_close(PL_last_in_gv, FALSE);
IoFLAGS(io) |= IOf_START;
}
else if (type == OP_GLOB) {
- if (do_close(last_in_gv, FALSE) & ~0xFF)
+ if (do_close(PL_last_in_gv, FALSE) & ~0xFF)
warn("internal error: glob failed");
}
if (gimme == G_SCALAR) {
if (type == OP_GLOB) {
char *tmps;
- if (SvCUR(sv) > 0 && SvCUR(rs) > 0) {
+ if (SvCUR(sv) > 0 && SvCUR(PL_rs) > 0) {
tmps = SvEND(sv) - 1;
- if (*tmps == *SvPVX(rs)) {
+ if (*tmps == *SvPVX(PL_rs)) {
*tmps = '\0';
SvCUR(sv)--;
}
if (!isALPHA(*tmps) && !isDIGIT(*tmps) &&
strchr("$&*(){}[]'\";\\|?<>~`", *tmps))
break;
- if (*tmps && PerlLIO_stat(SvPVX(sv), &statbuf) < 0) {
+ if (*tmps && PerlLIO_stat(SvPVX(sv), &PL_statbuf) < 0) {
(void)POPs; /* Unmatched wildcard? Chuck it... */
continue;
}
RETPUSHUNDEF;
}
if (lval) {
- if (!svp || *svp == &sv_undef) {
+ if (!svp || *svp == &PL_sv_undef) {
SV* lv;
SV* key2;
if (!defer)
- DIE(no_helem, SvPV(keysv, na));
+ DIE(no_helem, SvPV(keysv, PL_na));
lv = sv_newmortal();
sv_upgrade(lv, SVt_PVLV);
LvTYPE(lv) = 'y';
else if (op->op_private & OPpDEREF)
vivify_ref(*svp, op->op_private & OPpDEREF);
}
- sv = (svp ? *svp : &sv_undef);
+ sv = (svp ? *svp : &PL_sv_undef);
/* This makes C<local $tied{foo} = $tied{foo}> possible.
* Pushing the magical RHS on to the stack is useless, since
* that magic is soon destined to be misled by the local(),
if (op->op_flags & OPf_SPECIAL) {
cx = &cxstack[cxstack_ix];
- cx->blk_oldpm = curpm; /* fake block should preserve $1 et al */
+ cx->blk_oldpm = PL_curpm; /* fake block should preserve $1 et al */
}
POPBLOCK(cx,newpm);
*MARK = sv_mortalcopy(TOPs);
else {
MEXTEND(mark,0);
- *MARK = &sv_undef;
+ *MARK = &PL_sv_undef;
}
SP = MARK;
}
}
}
}
- curpm = newpm; /* Don't pop $1 et al till now */
+ PL_curpm = newpm; /* Don't pop $1 et al till now */
LEAVE;
}
/* iterate array */
- if (cx->blk_loop.iterix >= (av == curstack ? cx->blk_oldsp : AvFILL(av)))
+ if (cx->blk_loop.iterix >= (av == PL_curstack ? cx->blk_oldsp : AvFILL(av)))
RETPUSHNO;
SvREFCNT_dec(*cx->blk_loop.itervar);
: AvARRAY(av)[++cx->blk_loop.iterix])
SvTEMP_off(sv);
else
- sv = &sv_undef;
- if (av != curstack && SvIMMORTAL(sv)) {
+ sv = &PL_sv_undef;
+ if (av != PL_curstack && SvIMMORTAL(sv)) {
SV *lv = cx->blk_loop.iterlval;
if (lv && SvREFCNT(lv) > 1) {
SvREFCNT_dec(lv);
register REGEXP *rx = pm->op_pmregexp;
STRLEN len;
int force_on_match = 0;
- I32 oldsave = savestack_ix;
+ I32 oldsave = PL_savestack_ix;
I32 update_minmatch = 1;
SV *screamer;
if (!SvPOKp(TARG) || SvTYPE(TARG) == SVt_PVGV)
force_on_match = 1;
rxtainted = ((pm->op_pmdynflags & PMdf_TAINTED) ||
- (tainted && (pm->op_pmflags & PMf_RETAINT)));
- if (tainted)
+ (PL_tainted && (pm->op_pmflags & PMf_RETAINT)));
+ if (PL_tainted)
rxtainted |= 2;
TAINT_NOT;
strend = s + len;
maxiters = (strend - s) + 10;
- if (!rx->prelen && curpm) {
- pm = curpm;
+ if (!rx->prelen && PL_curpm) {
+ pm = PL_curpm;
rx = pm->op_pmregexp;
}
screamer = ( (SvSCREAM(TARG) && rx->check_substr
&& SvTYPE(rx->check_substr) == SVt_PVBM
&& SvVALID(rx->check_substr))
? TARG : Nullsv);
- safebase = (!rx->nparens && !sawampersand) ? 0 : REXEC_COPY_STR;
+ safebase = (!rx->nparens && !PL_sawampersand) ? 0 : REXEC_COPY_STR;
if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
- SAVEINT(multiline);
- multiline = pm->op_pmflags & PMf_MULTILINE;
+ SAVEINT(PL_multiline);
+ PL_multiline = pm->op_pmflags & PMf_MULTILINE;
}
orig = m = s;
if (rx->check_substr) {
if (screamer) {
I32 p = -1;
- if (screamfirst[BmRARE(rx->check_substr)] < 0)
+ if (PL_screamfirst[BmRARE(rx->check_substr)] < 0)
goto nope;
else if (!(s = screaminstr(TARG, rx->check_substr, rx->check_offset_min, 0, &p, 0)))
goto nope;
}
/* Now checkstring is fixed, i.e. at fixed offset from the
beginning of match, and the match is anchored at s. */
- else if (!multiline) { /* Anchored at beginning of string. */
+ else if (!PL_multiline) { /* Anchored at beginning of string. */
I32 slen;
if (*SvPVX(rx->check_substr) != s[rx->check_offset_min]
|| ((slen = SvCUR(rx->check_substr)) > 1
&& !(rx->reganch & ROPT_LOOKBEHIND_SEEN)) {
if (!CALLREGEXEC(rx, s, strend, orig, 0, screamer, NULL, safebase)) {
SPAGAIN;
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
LEAVE_SCOPE(oldsave);
RETURN;
}
goto force_it;
}
d = s;
- curpm = pm;
+ PL_curpm = pm;
SvSCREAM_off(TARG); /* disable possible screamer */
if (once) {
rxtainted |= RX_MATCH_TAINTED(rx);
}
TAINT_IF(rxtainted & 1);
SPAGAIN;
- PUSHs(&sv_yes);
+ PUSHs(&PL_sv_yes);
}
else {
do {
rxtainted |= RX_MATCH_TAINTED(rx);
dstr = NEWSV(25, len);
sv_setpvn(dstr, m, s-m);
- curpm = pm;
+ PL_curpm = pm;
if (!c) {
register PERL_CONTEXT *cx;
SPAGAIN;
ret_no:
SPAGAIN;
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
LEAVE_SCOPE(oldsave);
RETURN;
}
djSP;
if (SvTRUEx(POPs))
- stack_base[markstack_ptr[-1]++] = stack_base[*markstack_ptr];
- ++*markstack_ptr;
+ PL_stack_base[PL_markstack_ptr[-1]++] = PL_stack_base[*PL_markstack_ptr];
+ ++*PL_markstack_ptr;
LEAVE; /* exit inner scope */
/* All done yet? */
- if (stack_base + *markstack_ptr > SP) {
+ if (PL_stack_base + *PL_markstack_ptr > SP) {
I32 items;
I32 gimme = GIMME_V;
LEAVE; /* exit outer scope */
(void)POPMARK; /* pop src */
- items = --*markstack_ptr - markstack_ptr[-1];
+ items = --*PL_markstack_ptr - PL_markstack_ptr[-1];
(void)POPMARK; /* pop dst */
- SP = stack_base + POPMARK; /* pop original mark */
+ SP = PL_stack_base + POPMARK; /* pop original mark */
if (gimme == G_SCALAR) {
dTARGET;
XPUSHi(items);
SV *src;
ENTER; /* enter inner scope */
- SAVESPTR(curpm);
+ SAVESPTR(PL_curpm);
- src = stack_base[*markstack_ptr];
+ src = PL_stack_base[*PL_markstack_ptr];
SvTEMP_off(src);
DEFSV = src;
*MARK = SvTEMP(TOPs) ? TOPs : sv_mortalcopy(TOPs);
} else {
MEXTEND(MARK, 0);
- *MARK = &sv_undef;
+ *MARK = &PL_sv_undef;
}
SP = MARK;
}
PUTBACK;
POPSUB2(); /* Stack values are safe: release CV and @_ ... */
- curpm = newpm; /* ... and pop $1 et al */
+ PL_curpm = newpm; /* ... and pop $1 et al */
LEAVE;
return pop_return();
get_db_sub(SV **svp, CV *cv)
{
dTHR;
- SV *dbsv = GvSV(DBsub);
+ SV *dbsv = GvSV(PL_DBsub);
if (!PERLDB_SUB_NN) {
GV *gv = CvGV(cv);
}
if (CvXSUB(cv))
- curcopdb = curcop;
- cv = GvCV(DBsub);
+ PL_curcopdb = PL_curcop;
+ cv = GvCV(PL_DBsub);
return cv;
}
if (!SvROK(sv)) {
char *sym;
- if (sv == &sv_yes) { /* unfound import, ignore */
+ if (sv == &PL_sv_yes) { /* unfound import, ignore */
if (hasargs)
- SP = stack_base + POPMARK;
+ SP = PL_stack_base + POPMARK;
RETURN;
}
if (SvGMAGICAL(sv)) {
sym = SvPOKp(sv) ? SvPVX(sv) : Nullch;
}
else
- sym = SvPV(sv, na);
+ sym = SvPV(sv, PL_na);
if (!sym)
DIE(no_usym, "a subroutine");
if (op->op_private & HINT_STRICT_REFS)
}
gimme = GIMME_V;
- if ((op->op_private & OPpENTERSUB_DB) && GvCV(DBsub) && !CvNODEBUG(cv))
+ if ((op->op_private & OPpENTERSUB_DB) && GvCV(PL_DBsub) && !CvNODEBUG(cv))
cv = get_db_sub(&sv, cv);
if (!cv)
DIE("No DBsub routine");
SP[1] = SP[0];
SP--;
}
- stack_sp = mark + 1;
+ PL_stack_sp = mark + 1;
fp3 = (I32(*)_((int,int,int)))CvXSUB(cv);
items = (*fp3)(CvXSUBANY(cv).any_i32,
- MARK - stack_base + 1,
+ MARK - PL_stack_base + 1,
items);
- stack_sp = stack_base + items;
+ PL_stack_sp = PL_stack_base + items;
}
else {
I32 markix = TOPMARK;
#ifdef USE_THREADS
av = (AV*)curpad[0];
#else
- av = GvAV(defgv);
+ av = GvAV(PL_defgv);
#endif /* USE_THREADS */
items = AvFILLp(av) + 1; /* @_ is not tieable */
PUTBACK ;
}
}
- if (curcopdb) { /* We assume that the first
+ if (PL_curcopdb) { /* We assume that the first
XSUB in &DB::sub is the
called one. */
- SAVESPTR(curcop);
- curcop = curcopdb;
- curcopdb = NULL;
+ SAVESPTR(PL_curcop);
+ PL_curcop = PL_curcopdb;
+ PL_curcopdb = NULL;
}
/* Do we need to open block here? XXXX */
(void)(*CvXSUB(cv))(cv _PERL_OBJECT_THIS);
/* Enforce some sanity in scalar context. */
- if (gimme == G_SCALAR && ++markix != stack_sp - stack_base ) {
- if (markix > stack_sp - stack_base)
- *(stack_base + markix) = &sv_undef;
+ if (gimme == G_SCALAR && ++markix != PL_stack_sp - PL_stack_base ) {
+ if (markix > PL_stack_sp - PL_stack_base)
+ *(PL_stack_base + markix) = &PL_sv_undef;
else
- *(stack_base + markix) = *stack_sp;
- stack_sp = stack_base + markix;
+ *(PL_stack_base + markix) = *PL_stack_sp;
+ PL_stack_sp = PL_stack_base + markix;
}
}
LEAVE;
if (CvDEPTH(cv) < 2)
(void)SvREFCNT_inc(cv);
else { /* save temporaries on recursion? */
- if (CvDEPTH(cv) == 100 && dowarn
- && !(PERLDB_SUB && cv == GvCV(DBsub)))
+ if (CvDEPTH(cv) == 100 && PL_dowarn
+ && !(PERLDB_SUB && cv == GvCV(PL_DBsub)))
sub_crush_depth(cv);
if (CvDEPTH(cv) > AvFILLp(padlist)) {
AV *av;
I32 ix = AvFILLp((AV*)svp[1]);
svp = AvARRAY(svp[0]);
for ( ;ix > 0; ix--) {
- if (svp[ix] != &sv_undef) {
+ if (svp[ix] != &PL_sv_undef) {
char *name = SvPVX(svp[ix]);
if ((SvFLAGS(svp[ix]) & SVf_FAKE) /* outer lexical? */
|| *name == '&') /* anonymous code? */
}
}
#endif /* USE_THREADS */
- SAVESPTR(curpad);
- curpad = AvARRAY((AV*)svp[CvDEPTH(cv)]);
+ SAVESPTR(PL_curpad);
+ PL_curpad = AvARRAY((AV*)svp[CvDEPTH(cv)]);
#ifndef USE_THREADS
if (hasargs)
#endif /* USE_THREADS */
DEBUG_L(PerlIO_printf(PerlIO_stderr(),
"%p entersub preparing @_\n", thr));
#endif
- av = (AV*)curpad[0];
+ av = (AV*)PL_curpad[0];
if (AvREAL(av)) {
av_clear(av);
AvREAL_off(av);
}
#ifndef USE_THREADS
- cx->blk_sub.savearray = GvAV(defgv);
- GvAV(defgv) = (AV*)SvREFCNT_inc(av);
+ cx->blk_sub.savearray = GvAV(PL_defgv);
+ GvAV(PL_defgv) = (AV*)SvREFCNT_inc(av);
#endif /* USE_THREADS */
cx->blk_sub.argarray = av;
++MARK;
SV *sv;
if (elem > 0)
- elem -= curcop->cop_arybase;
+ elem -= PL_curcop->cop_arybase;
if (SvTYPE(av) != SVt_PVAV)
RETPUSHUNDEF;
svp = av_fetch(av, elem, lval && !defer);
if (lval) {
- if (!svp || *svp == &sv_undef) {
+ if (!svp || *svp == &PL_sv_undef) {
SV* lv;
if (!defer)
DIE(no_aelem, elem);
else if (op->op_private & OPpDEREF)
vivify_ref(*svp, op->op_private & OPpDEREF);
}
- sv = (svp ? *svp : &sv_undef);
+ sv = (svp ? *svp : &PL_sv_undef);
if (!lval && SvGMAGICAL(sv)) /* see note in pp_helem() */
sv = sv_mortalcopy(sv);
PUSHs(sv);
}
}
- name = SvPV(TOPs, na);
- sv = *(stack_base + TOPMARK + 1);
+ name = SvPV(TOPs, PL_na);
+ sv = *(PL_stack_base + TOPMARK + 1);
if (SvGMAGICAL(sv))
mg_get(sv);
stash = gv_stashpvn(packname, packlen, TRUE);
goto fetch;
}
- *(stack_base + TOPMARK + 1) = sv_2mortal(newRV((SV*)iogv));
+ *(PL_stack_base + TOPMARK + 1) = sv_2mortal(newRV((SV*)iogv));
}
if (!ob || !SvOBJECT(ob))
sep = p, leaf = p + 2;
}
if (!sep || ((sep - name) == 5 && strnEQ(name, "SUPER", 5))) {
- packname = HvNAME(sep ? curcop->cop_stash : stash);
+ packname = HvNAME(sep ? PL_curcop->cop_stash : stash);
packlen = strlen(packname);
}
else {
ENTER;
#ifndef VMS
- if (tainting) {
+ if (PL_tainting) {
/*
* The external globbing program may use things we can't control,
* so for security reasons we must assume the worst.
}
#endif /* !VMS */
- SAVESPTR(last_in_gv); /* We don't want this to be permanent. */
- last_in_gv = (GV*)*stack_sp--;
+ SAVESPTR(PL_last_in_gv); /* We don't want this to be permanent. */
+ PL_last_in_gv = (GV*)*PL_stack_sp--;
- SAVESPTR(rs); /* This is not permanent, either. */
- rs = sv_2mortal(newSVpv("", 1));
+ SAVESPTR(PL_rs); /* This is not permanent, either. */
+ PL_rs = sv_2mortal(newSVpv("", 1));
#ifndef DOSISH
#ifndef CSH
*SvPVX(rs) = '\n';
PP(pp_rcatline)
{
- last_in_gv = cGVOP->op_gv;
+ PL_last_in_gv = cGVOP->op_gv;
return do_readline();
}
char *tmps;
if (SP - MARK != 1) {
dTARGET;
- do_join(TARG, &sv_no, MARK, SP);
- tmps = SvPV(TARG, na);
+ do_join(TARG, &PL_sv_no, MARK, SP);
+ tmps = SvPV(TARG, PL_na);
SP = MARK + 1;
}
else {
- tmps = SvPV(TOPs, na);
+ tmps = SvPV(TOPs, PL_na);
}
if (!tmps || !*tmps) {
SV *error = ERRSV;
(void)SvUPGRADE(error, SVt_PV);
if (SvPOK(error) && SvCUR(error))
sv_catpv(error, "\t...caught");
- tmps = SvPV(error, na);
+ tmps = SvPV(error, PL_na);
}
if (!tmps || !*tmps)
tmps = "Warning: something's wrong";
char *pat = "%s";
if (SP - MARK != 1) {
dTARGET;
- do_join(TARG, &sv_no, MARK, SP);
- tmps = SvPV(TARG, na);
+ do_join(TARG, &PL_sv_no, MARK, SP);
+ tmps = SvPV(TARG, PL_na);
SP = MARK + 1;
}
else {
tmpsv = TOPs;
- tmps = SvROK(tmpsv) ? Nullch : SvPV(tmpsv, na);
+ tmps = SvROK(tmpsv) ? Nullch : SvPV(tmpsv, PL_na);
}
if (!tmps || !*tmps) {
SV *error = ERRSV;
HV *stash = SvSTASH(SvRV(error));
GV *gv = gv_fetchmethod(stash, "PROPAGATE");
if (gv) {
- SV *file = sv_2mortal(newSVsv(GvSV(curcop->cop_filegv)));
- SV *line = sv_2mortal(newSViv(curcop->cop_line));
+ SV *file = sv_2mortal(newSVsv(GvSV(PL_curcop->cop_filegv)));
+ SV *line = sv_2mortal(newSViv(PL_curcop->cop_line));
EXTEND(SP, 3);
PUSHMARK(SP);
PUSHs(error);
PUTBACK;
perl_call_sv((SV*)GvCV(gv),
G_SCALAR|G_EVAL|G_KEEPERR);
- sv_setsv(error,*stack_sp--);
+ sv_setsv(error,*PL_stack_sp--);
}
}
pat = Nullch;
else {
if (SvPOK(error) && SvCUR(error))
sv_catpv(error, "\t...propagated");
- tmps = SvPV(error, na);
+ tmps = SvPV(error, PL_na);
}
}
if (!tmps || !*tmps)
IoFLAGS(GvIOp(gv)) &= ~IOf_UNTAINT;
tmps = SvPV(sv, len);
if (do_open(gv, tmps, len, FALSE, 0, 0, Nullfp))
- PUSHi( (I32)forkprocess );
- else if (forkprocess == 0) /* we are a new child */
+ PUSHi( (I32)PL_forkprocess );
+ else if (PL_forkprocess == 0) /* we are a new child */
PUSHi(0);
else
RETPUSHUNDEF;
MAGIC *mg;
if (MAXARG == 0)
- gv = defoutgv;
+ gv = PL_defoutgv;
else
gv = (GV*)POPs;
HV* stash;
GV *gv;
SV *sv;
- I32 markoff = MARK - stack_base;
+ I32 markoff = MARK - PL_stack_base;
char *methname;
int how = 'P';
U32 items;
stash = gv_stashsv(*MARK, FALSE);
if (!stash || !(gv = gv_fetchmethod(stash, methname))) {
DIE("Can't locate object method \"%s\" via package \"%s\"",
- methname, SvPV(*MARK,na));
+ methname, SvPV(*MARK,PL_na));
}
ENTER;
PUSHSTACKi(PERLSI_MAGIC);
sv_magic(varsv, sv, how, Nullch, 0);
}
LEAVE;
- SP = stack_base + markoff;
+ SP = PL_stack_base + markoff;
PUSHs(sv);
RETURN;
}
sv = POPs;
- if (dowarn) {
+ if (PL_dowarn) {
MAGIC * mg ;
if (SvMAGICAL(sv)) {
if (SvTYPE(sv) == SVt_PVHV || SvTYPE(sv) == SVt_PVAV)
hv = (HV*)POPs;
- sv = sv_mortalcopy(&sv_no);
+ sv = sv_mortalcopy(&PL_sv_no);
sv_setpv(sv, "AnyDBM_File");
stash = gv_stashsv(sv, FALSE);
if (!stash || !(gv = gv_fetchmethod(stash, "TIEHASH"))) {
continue;
}
else if (!SvPOK(sv))
- SvPV_force(sv,na); /* force string conversion */
+ SvPV_force(sv,PL_na); /* force string conversion */
j = SvLEN(sv);
if (j < growsize) {
Sv_Grow(sv, growsize);
if (GIMME == G_ARRAY && tbuf) {
value = (double)(timebuf.tv_sec) +
(double)(timebuf.tv_usec) / 1000000.0;
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setnv(sv, value);
}
RETURN;
dTHR;
if (gv)
(void)SvREFCNT_inc(gv);
- if (defoutgv)
- SvREFCNT_dec(defoutgv);
- defoutgv = gv;
+ if (PL_defoutgv)
+ SvREFCNT_dec(PL_defoutgv);
+ PL_defoutgv = gv;
}
PP(pp_select)
newdefout = (op->op_private > 0) ? ((GV *) POPs) : (GV *) NULL;
- egv = GvEGV(defoutgv);
+ egv = GvEGV(PL_defoutgv);
if (!egv)
- egv = defoutgv;
+ egv = PL_defoutgv;
hv = GvSTASH(egv);
if (! hv)
- XPUSHs(&sv_undef);
+ XPUSHs(&PL_sv_undef);
else {
GV **gvp = (GV**)hv_fetch(hv, GvNAME(egv), GvNAMELEN(egv), FALSE);
if (gvp && *gvp == egv) {
- gv_efullname3(TARG, defoutgv, Nullch);
+ gv_efullname3(TARG, PL_defoutgv, Nullch);
XPUSHTARG;
}
else {
MAGIC *mg;
if (MAXARG <= 0)
- gv = stdingv;
+ gv = PL_stdingv;
else
gv = (GV*)POPs;
if (!gv)
- gv = argvgv;
+ gv = PL_argvgv;
if (SvRMAGICAL(gv) && (mg = mg_find((SV*)gv, 'q'))) {
I32 gimme = GIMME_V;
SAVETMPS;
push_return(retop);
- PUSHBLOCK(cx, CXt_SUB, stack_sp);
+ PUSHBLOCK(cx, CXt_SUB, PL_stack_sp);
PUSHFORMAT(cx);
- SAVESPTR(curpad);
- curpad = AvARRAY((AV*)svp[1]);
+ SAVESPTR(PL_curpad);
+ PL_curpad = AvARRAY((AV*)svp[1]);
setdefout(gv); /* locally select filehandle so $% et al work */
return CvSTART(cv);
CV *cv;
if (MAXARG == 0)
- gv = defoutgv;
+ gv = PL_defoutgv;
else {
gv = (GV*)POPs;
if (!gv)
- gv = defoutgv;
+ gv = PL_defoutgv;
}
EXTEND(SP, 1);
io = GvIO(gv);
register PERL_CONTEXT *cx;
DEBUG_f(PerlIO_printf(Perl_debug_log, "left=%ld, todo=%ld\n",
- (long)IoLINES_LEFT(io), (long)FmLINES(formtarget)));
- if (IoLINES_LEFT(io) < FmLINES(formtarget) &&
- formtarget != toptarget)
+ (long)IoLINES_LEFT(io), (long)FmLINES(PL_formtarget)));
+ if (IoLINES_LEFT(io) < FmLINES(PL_formtarget) &&
+ PL_formtarget != PL_toptarget)
{
GV *fgv;
CV *cv;
}
if (IoFLAGS(io) & IOf_DIDTOP) { /* Oh dear. It still doesn't fit. */
I32 lines = IoLINES_LEFT(io);
- char *s = SvPVX(formtarget);
+ char *s = SvPVX(PL_formtarget);
if (lines <= 0) /* Yow, header didn't even fit!!! */
goto forget_top;
while (lines-- > 0) {
s++;
}
if (s) {
- PerlIO_write(ofp, SvPVX(formtarget), s - SvPVX(formtarget));
- sv_chop(formtarget, s);
- FmLINES(formtarget) -= IoLINES_LEFT(io);
+ PerlIO_write(ofp, SvPVX(PL_formtarget), s - SvPVX(PL_formtarget));
+ sv_chop(PL_formtarget, s);
+ FmLINES(PL_formtarget) -= IoLINES_LEFT(io);
}
}
if (IoLINES_LEFT(io) >= 0 && IoPAGE(io) > 0)
- PerlIO_write(ofp, SvPVX(formfeed), SvCUR(formfeed));
+ PerlIO_write(ofp, SvPVX(PL_formfeed), SvCUR(PL_formfeed));
IoLINES_LEFT(io) = IoPAGE_LEN(io);
IoPAGE(io)++;
- formtarget = toptarget;
+ PL_formtarget = PL_toptarget;
IoFLAGS(io) |= IOf_DIDTOP;
fgv = IoTOP_GV(io);
if (!fgv)
}
forget_top:
- POPBLOCK(cx,curpm);
+ POPBLOCK(cx,PL_curpm);
POPFORMAT(cx);
LEAVE;
fp = IoOFP(io);
if (!fp) {
- if (dowarn) {
+ if (PL_dowarn) {
if (IoIFP(io))
warn("Filehandle only opened for input");
else
warn("Write on closed filehandle");
}
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
}
else {
- if ((IoLINES_LEFT(io) -= FmLINES(formtarget)) < 0) {
- if (dowarn)
+ if ((IoLINES_LEFT(io) -= FmLINES(PL_formtarget)) < 0) {
+ if (PL_dowarn)
warn("page overflow");
}
- if (!PerlIO_write(ofp, SvPVX(formtarget), SvCUR(formtarget)) ||
+ if (!PerlIO_write(ofp, SvPVX(PL_formtarget), SvCUR(PL_formtarget)) ||
PerlIO_error(fp))
- PUSHs(&sv_no);
+ PUSHs(&PL_sv_no);
else {
- FmLINES(formtarget) = 0;
- SvCUR_set(formtarget, 0);
- *SvEND(formtarget) = '\0';
+ FmLINES(PL_formtarget) = 0;
+ SvCUR_set(PL_formtarget, 0);
+ *SvEND(PL_formtarget) = '\0';
if (IoFLAGS(io) & IOf_FLUSH)
(void)PerlIO_flush(fp);
- PUSHs(&sv_yes);
+ PUSHs(&PL_sv_yes);
}
}
- formtarget = bodytarget;
+ PL_formtarget = PL_bodytarget;
PUTBACK;
return pop_return();
}
if (op->op_flags & OPf_STACKED)
gv = (GV*)*++MARK;
else
- gv = defoutgv;
+ gv = PL_defoutgv;
if (SvRMAGICAL(gv) && (mg = mg_find((SV*)gv, 'q'))) {
if (MARK == ORIGMARK) {
sv = NEWSV(0,0);
if (!(io = GvIO(gv))) {
- if (dowarn) {
+ if (PL_dowarn) {
gv_fullname3(sv, gv, Nullch);
- warn("Filehandle %s never opened", SvPV(sv,na));
+ warn("Filehandle %s never opened", SvPV(sv,PL_na));
}
SETERRNO(EBADF,RMS$_IFI);
goto just_say_no;
}
else if (!(fp = IoOFP(io))) {
- if (dowarn) {
+ if (PL_dowarn) {
gv_fullname3(sv, gv, Nullch);
if (IoIFP(io))
- warn("Filehandle %s opened only for input", SvPV(sv,na));
+ warn("Filehandle %s opened only for input", SvPV(sv,PL_na));
else
- warn("printf on closed filehandle %s", SvPV(sv,na));
+ warn("printf on closed filehandle %s", SvPV(sv,PL_na));
}
SETERRNO(EBADF,IoIFP(io)?RMS$_FAC:RMS$_IFI);
goto just_say_no;
}
SvREFCNT_dec(sv);
SP = ORIGMARK;
- PUSHs(&sv_yes);
+ PUSHs(&PL_sv_yes);
RETURN;
just_say_no:
SvREFCNT_dec(sv);
SP = ORIGMARK;
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
RETURN;
}
tmps = SvPV(sv, len);
if (do_open(gv, tmps, len, TRUE, mode, perm, Nullfp)) {
IoLINES(GvIOp(gv)) = 0;
- PUSHs(&sv_yes);
+ PUSHs(&PL_sv_yes);
}
else {
- PUSHs(&sv_undef);
+ PUSHs(&PL_sv_undef);
}
RETURN;
}
io = GvIO(gv);
if (!io || !IoIFP(io)) {
length = -1;
- if (dowarn) {
+ if (PL_dowarn) {
if (op->op_type == OP_SYSWRITE)
warn("Syswrite on closed filehandle");
else
GV *gv;
if (MAXARG <= 0)
- gv = last_in_gv;
+ gv = PL_last_in_gv;
else
- gv = last_in_gv = (GV*)POPs;
+ gv = PL_last_in_gv = (GV*)POPs;
PUSHs(boolSV(!gv || do_eof(gv)));
RETURN;
}
GV *gv;
if (MAXARG <= 0)
- gv = last_in_gv;
+ gv = PL_last_in_gv;
else
- gv = last_in_gv = (GV*)POPs;
+ gv = PL_last_in_gv = (GV*)POPs;
PUSHi( do_tell(gv) );
RETURN;
}
int whence = POPi;
long offset = POPl;
- gv = last_in_gv = (GV*)POPs;
+ gv = PL_last_in_gv = (GV*)POPs;
if (op->op_type == OP_SEEK)
PUSHs(boolSV(do_seek(gv, offset, whence)));
else {
long n = do_sysseek(gv, offset, whence);
- PUSHs((n < 0) ? &sv_undef
+ PUSHs((n < 0) ? &PL_sv_undef
: sv_2mortal(n ? newSViv((IV)n)
: newSVpv(zero_but_true, ZBTLEN)));
}
goto do_ftruncate;
}
- name = SvPV(sv, na);
+ name = SvPV(sv, PL_na);
TAINT_PROPER("truncate");
#ifdef HAS_TRUNCATE
if (truncate(name, len) < 0)
#ifdef FLOCK
argtype = POPi;
if (MAXARG <= 0)
- gv = last_in_gv;
+ gv = PL_last_in_gv;
else
gv = (GV*)POPs;
if (gv && GvIO(gv))
RETPUSHUNDEF;
nuts:
- if (dowarn)
+ if (PL_dowarn)
warn("bind() on closed fd");
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
RETPUSHUNDEF;
nuts:
- if (dowarn)
+ if (PL_dowarn)
warn("connect() on closed fd");
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
RETPUSHUNDEF;
nuts:
- if (dowarn)
+ if (PL_dowarn)
warn("listen() on closed fd");
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
RETURN;
nuts:
- if (dowarn)
+ if (PL_dowarn)
warn("accept() on closed fd");
SETERRNO(EBADF,SS$_IVCHAN);
RETURN;
nuts:
- if (dowarn)
+ if (PL_dowarn)
warn("shutdown() on closed fd");
SETERRNO(EBADF,SS$_IVCHAN);
RETPUSHUNDEF;
char *buf;
int aint;
if (SvPOKp(sv)) {
- buf = SvPV(sv, na);
- len = na;
+ buf = SvPV(sv, PL_na);
+ len = PL_na;
}
else {
aint = (int)SvIV(sv);
}
if (PerlSock_setsockopt(fd, lvl, optname, buf, len) < 0)
goto nuts2;
- PUSHs(&sv_yes);
+ PUSHs(&PL_sv_yes);
}
break;
}
RETURN;
nuts:
- if (dowarn)
+ if (PL_dowarn)
warn("[gs]etsockopt() on closed fd");
SETERRNO(EBADF,SS$_IVCHAN);
nuts2:
RETURN;
nuts:
- if (dowarn)
+ if (PL_dowarn)
warn("get{sock, peer}name() on closed fd");
SETERRNO(EBADF,SS$_IVCHAN);
nuts2:
if (op->op_flags & OPf_REF) {
tmpgv = cGVOP->op_gv;
do_fstat:
- if (tmpgv != defgv) {
- laststype = OP_STAT;
- statgv = tmpgv;
- sv_setpv(statname, "");
- laststatval = (GvIO(tmpgv) && IoIFP(GvIOp(tmpgv))
- ? PerlLIO_fstat(PerlIO_fileno(IoIFP(GvIOn(tmpgv))), &statcache) : -1);
+ if (tmpgv != PL_defgv) {
+ PL_laststype = OP_STAT;
+ PL_statgv = tmpgv;
+ sv_setpv(PL_statname, "");
+ PL_laststatval = (GvIO(tmpgv) && IoIFP(GvIOp(tmpgv))
+ ? PerlLIO_fstat(PerlIO_fileno(IoIFP(GvIOn(tmpgv))), &PL_statcache) : -1);
}
- if (laststatval < 0)
+ if (PL_laststatval < 0)
max = 0;
}
else {
tmpgv = (GV*)SvRV(sv);
goto do_fstat;
}
- sv_setpv(statname, SvPV(sv,na));
- statgv = Nullgv;
+ sv_setpv(PL_statname, SvPV(sv,PL_na));
+ PL_statgv = Nullgv;
#ifdef HAS_LSTAT
- laststype = op->op_type;
+ PL_laststype = op->op_type;
if (op->op_type == OP_LSTAT)
- laststatval = PerlLIO_lstat(SvPV(statname, na), &statcache);
+ PL_laststatval = PerlLIO_lstat(SvPV(PL_statname, PL_na), &PL_statcache);
else
#endif
- laststatval = PerlLIO_stat(SvPV(statname, na), &statcache);
- if (laststatval < 0) {
- if (dowarn && strchr(SvPV(statname, na), '\n'))
+ PL_laststatval = PerlLIO_stat(SvPV(PL_statname, PL_na), &PL_statcache);
+ if (PL_laststatval < 0) {
+ if (PL_dowarn && strchr(SvPV(PL_statname, PL_na), '\n'))
warn(warn_nl, "stat");
max = 0;
}
if (max) {
EXTEND(SP, max);
EXTEND_MORTAL(max);
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_dev)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_ino)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_mode)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_nlink)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_uid)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_gid)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_dev)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_ino)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_mode)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_nlink)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_uid)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_gid)));
#ifdef USE_STAT_RDEV
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_rdev)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_rdev)));
#else
PUSHs(sv_2mortal(newSVpv("", 0)));
#endif
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_size)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_size)));
#ifdef BIG_TIME
PUSHs(sv_2mortal(newSVnv((U32)statcache.st_atime)));
PUSHs(sv_2mortal(newSVnv((U32)statcache.st_mtime)));
PUSHs(sv_2mortal(newSVnv((U32)statcache.st_ctime)));
#else
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_atime)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_mtime)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_ctime)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_atime)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_mtime)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_ctime)));
#endif
#ifdef USE_STAT_BLOCKS
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_blksize)));
- PUSHs(sv_2mortal(newSViv((I32)statcache.st_blocks)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_blksize)));
+ PUSHs(sv_2mortal(newSViv((I32)PL_statcache.st_blocks)));
#else
PUSHs(sv_2mortal(newSVpv("", 0)));
PUSHs(sv_2mortal(newSVpv("", 0)));
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (cando(S_IRUSR, 0, &statcache))
+ if (cando(S_IRUSR, 0, &PL_statcache))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (cando(S_IWUSR, 0, &statcache))
+ if (cando(S_IWUSR, 0, &PL_statcache))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (cando(S_IXUSR, 0, &statcache))
+ if (cando(S_IXUSR, 0, &PL_statcache))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (cando(S_IRUSR, 1, &statcache))
+ if (cando(S_IRUSR, 1, &PL_statcache))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (cando(S_IWUSR, 1, &statcache))
+ if (cando(S_IWUSR, 1, &PL_statcache))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (cando(S_IXUSR, 1, &statcache))
+ if (cando(S_IXUSR, 1, &PL_statcache))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (statcache.st_uid == (op->op_type == OP_FTEOWNED ? euid : uid) )
+ if (PL_statcache.st_uid == (op->op_type == OP_FTEOWNED ? PL_euid : PL_uid) )
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (!statcache.st_size)
+ if (!PL_statcache.st_size)
RETPUSHYES;
RETPUSHNO;
}
djSP; dTARGET;
if (result < 0)
RETPUSHUNDEF;
- PUSHi(statcache.st_size);
+ PUSHi(PL_statcache.st_size);
RETURN;
}
djSP; dTARGET;
if (result < 0)
RETPUSHUNDEF;
- PUSHn( ((I32)basetime - (I32)statcache.st_mtime) / 86400.0 );
+ PUSHn( ((I32)PL_basetime - (I32)PL_statcache.st_mtime) / 86400.0 );
RETURN;
}
djSP; dTARGET;
if (result < 0)
RETPUSHUNDEF;
- PUSHn( ((I32)basetime - (I32)statcache.st_atime) / 86400.0 );
+ PUSHn( ((I32)PL_basetime - (I32)PL_statcache.st_atime) / 86400.0 );
RETURN;
}
djSP; dTARGET;
if (result < 0)
RETPUSHUNDEF;
- PUSHn( ((I32)basetime - (I32)statcache.st_ctime) / 86400.0 );
+ PUSHn( ((I32)PL_basetime - (I32)PL_statcache.st_ctime) / 86400.0 );
RETURN;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (S_ISSOCK(statcache.st_mode))
+ if (S_ISSOCK(PL_statcache.st_mode))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (S_ISCHR(statcache.st_mode))
+ if (S_ISCHR(PL_statcache.st_mode))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (S_ISBLK(statcache.st_mode))
+ if (S_ISBLK(PL_statcache.st_mode))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (S_ISREG(statcache.st_mode))
+ if (S_ISREG(PL_statcache.st_mode))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (S_ISDIR(statcache.st_mode))
+ if (S_ISDIR(PL_statcache.st_mode))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (S_ISFIFO(statcache.st_mode))
+ if (S_ISFIFO(PL_statcache.st_mode))
RETPUSHYES;
RETPUSHNO;
}
djSP;
if (result < 0)
RETPUSHUNDEF;
- if (S_ISLNK(statcache.st_mode))
+ if (S_ISLNK(PL_statcache.st_mode))
RETPUSHYES;
RETPUSHNO;
}
SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
- if (statcache.st_mode & S_ISUID)
+ if (PL_statcache.st_mode & S_ISUID)
RETPUSHYES;
#endif
RETPUSHNO;
SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
- if (statcache.st_mode & S_ISGID)
+ if (PL_statcache.st_mode & S_ISGID)
RETPUSHYES;
#endif
RETPUSHNO;
SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
- if (statcache.st_mode & S_ISVTX)
+ if (PL_statcache.st_mode & S_ISVTX)
RETPUSHYES;
#endif
RETPUSHNO;
if (gv) {
EXTEND(SP, 1);
- if (gv == defgv) {
- if (statgv)
- io = GvIO(statgv);
+ if (gv == PL_defgv) {
+ if (PL_statgv)
+ io = GvIO(PL_statgv);
else {
- sv = statname;
+ sv = PL_statname;
goto really_filename;
}
}
else {
- statgv = gv;
- laststatval = -1;
- sv_setpv(statname, "");
- io = GvIO(statgv);
+ PL_statgv = gv;
+ PL_laststatval = -1;
+ sv_setpv(PL_statname, "");
+ io = GvIO(PL_statgv);
}
if (io && IoIFP(io)) {
if (! PerlIO_has_base(IoIFP(io)))
DIE("-T and -B not implemented on filehandles");
- laststatval = PerlLIO_fstat(PerlIO_fileno(IoIFP(io)), &statcache);
- if (laststatval < 0)
+ PL_laststatval = PerlLIO_fstat(PerlIO_fileno(IoIFP(io)), &PL_statcache);
+ if (PL_laststatval < 0)
RETPUSHUNDEF;
- if (S_ISDIR(statcache.st_mode)) /* handle NFS glitch */
+ if (S_ISDIR(PL_statcache.st_mode)) /* handle NFS glitch */
if (op->op_type == OP_FTTEXT)
RETPUSHNO;
else
len = 512;
}
else {
- if (dowarn)
+ if (PL_dowarn)
warn("Test on unopened file <%s>",
GvENAME(cGVOP->op_gv));
SETERRNO(EBADF,RMS$_IFI);
else {
sv = POPs;
really_filename:
- statgv = Nullgv;
- laststatval = -1;
- sv_setpv(statname, SvPV(sv, na));
+ PL_statgv = Nullgv;
+ PL_laststatval = -1;
+ sv_setpv(PL_statname, SvPV(sv, PL_na));
#ifdef HAS_OPEN3
- i = PerlLIO_open3(SvPV(sv, na), O_RDONLY, 0);
+ i = PerlLIO_open3(SvPV(sv, PL_na), O_RDONLY, 0);
#else
i = PerlLIO_open(SvPV(sv, na), 0);
#endif
if (i < 0) {
- if (dowarn && strchr(SvPV(sv, na), '\n'))
+ if (PL_dowarn && strchr(SvPV(sv, PL_na), '\n'))
warn(warn_nl, "open");
RETPUSHUNDEF;
}
- laststatval = PerlLIO_fstat(i, &statcache);
- if (laststatval < 0)
+ PL_laststatval = PerlLIO_fstat(i, &PL_statcache);
+ if (PL_laststatval < 0)
RETPUSHUNDEF;
len = PerlLIO_read(i, tbuf, 512);
(void)PerlLIO_close(i);
if (len <= 0) {
- if (S_ISDIR(statcache.st_mode) && op->op_type == OP_FTTEXT)
+ if (S_ISDIR(PL_statcache.st_mode) && op->op_type == OP_FTTEXT)
RETPUSHNO; /* special case NFS directories */
RETPUSHYES; /* null file is anything */
}
else
tmps = POPp;
if (!tmps || !*tmps) {
- svp = hv_fetch(GvHVn(envgv), "HOME", 4, FALSE);
+ svp = hv_fetch(GvHVn(PL_envgv), "HOME", 4, FALSE);
if (svp)
- tmps = SvPV(*svp, na);
+ tmps = SvPV(*svp, PL_na);
}
if (!tmps || !*tmps) {
- svp = hv_fetch(GvHVn(envgv), "LOGDIR", 6, FALSE);
+ svp = hv_fetch(GvHVn(PL_envgv), "LOGDIR", 6, FALSE);
if (svp)
- tmps = SvPV(*svp, na);
+ tmps = SvPV(*svp, PL_na);
}
#ifdef VMS
if (!tmps || !*tmps) {
int anum;
char *tmps2 = POPp;
- char *tmps = SvPV(TOPs, na);
+ char *tmps = SvPV(TOPs, PL_na);
TAINT_PROPER("rename");
#ifdef HAS_RENAME
anum = PerlLIO_rename(tmps, tmps2);
djSP; dTARGET;
#ifdef HAS_LINK
char *tmps2 = POPp;
- char *tmps = SvPV(TOPs, na);
+ char *tmps = SvPV(TOPs, PL_na);
TAINT_PROPER("link");
SETi( link(tmps, tmps2) >= 0 );
#else
djSP; dTARGET;
#ifdef HAS_SYMLINK
char *tmps2 = POPp;
- char *tmps = SvPV(TOPs, na);
+ char *tmps = SvPV(TOPs, PL_na);
TAINT_PROPER("symlink");
SETi( symlink(tmps, tmps2) >= 0 );
RETURN;
#ifndef HAS_MKDIR
int oldumask;
#endif
- char *tmps = SvPV(TOPs, na);
+ char *tmps = SvPV(TOPs, PL_na);
TAINT_PROPER("mkdir");
#ifdef HAS_MKDIR
/*SUPPRESS 560*/
if (tmpgv = gv_fetchpv("$", TRUE, SVt_PV))
sv_setiv(GvSV(tmpgv), (IV)getpid());
- hv_clear(pidstatus); /* no kids, so don't wait for 'em */
+ hv_clear(PL_pidstatus); /* no kids, so don't wait for 'em */
}
PUSHi(childpid);
RETURN;
Sigsave_t ihand,qhand; /* place to save signals during system() */
if (SP - MARK == 1) {
- if (tainting) {
- char *junk = SvPV(TOPs, na);
+ if (PL_tainting) {
+ char *junk = SvPV(TOPs, PL_na);
TAINT_ENV();
TAINT_PROPER("system");
}
else if (SP - MARK != 1)
value = (I32)do_aexec(Nullsv, MARK, SP);
else {
- value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), na));
+ value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), PL_na));
}
PerlProc__exit(-1);
#else /* ! FORK or VMS or OS/2 */
value = (I32)do_aexec(Nullsv, MARK, SP);
#endif
else {
- if (tainting) {
- char *junk = SvPV(*SP, na);
+ if (PL_tainting) {
+ char *junk = SvPV(*SP, PL_na);
TAINT_ENV();
TAINT_PROPER("exec");
}
#ifdef VMS
value = (I32)vms_do_exec(SvPVx(sv_mortalcopy(*SP), na));
#else
- value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), na));
+ value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), PL_na));
#endif
}
SP = ORIGMARK;
EXTEND(SP, 4);
#ifndef VMS
- (void)PerlProc_times(×buf);
+ (void)PerlProc_times(&PL_timesbuf);
#else
(void)PerlProc_times((tbuffer_t *)×buf); /* time.h uses different name for */
/* struct tms, though same data */
/* is returned. */
#endif
- PUSHs(sv_2mortal(newSVnv(((double)timesbuf.tms_utime)/HZ)));
+ PUSHs(sv_2mortal(newSVnv(((double)PL_timesbuf.tms_utime)/HZ)));
if (GIMME == G_ARRAY) {
- PUSHs(sv_2mortal(newSVnv(((double)timesbuf.tms_stime)/HZ)));
- PUSHs(sv_2mortal(newSVnv(((double)timesbuf.tms_cutime)/HZ)));
- PUSHs(sv_2mortal(newSVnv(((double)timesbuf.tms_cstime)/HZ)));
+ PUSHs(sv_2mortal(newSVnv(((double)PL_timesbuf.tms_stime)/HZ)));
+ PUSHs(sv_2mortal(newSVnv(((double)PL_timesbuf.tms_cutime)/HZ)));
+ PUSHs(sv_2mortal(newSVnv(((double)PL_timesbuf.tms_cstime)/HZ)));
}
RETURN;
#endif /* HAS_TIMES */
}
if (hent) {
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, (char*)hent->h_name);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
for (elem = hent->h_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
sv_catpvn(sv, " ", 1);
}
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)hent->h_addrtype);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
len = hent->h_length;
sv_setiv(sv, (IV)len);
#ifdef h_addr
for (elem = hent->h_addr_list; elem && *elem; elem++) {
- XPUSHs(sv = sv_mortalcopy(&sv_no));
+ XPUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpvn(sv, *elem, len);
}
#else
}
if (nent) {
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, nent->n_name);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
for (elem = nent->n_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
sv_catpvn(sv, " ", 1);
}
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)nent->n_addrtype);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)nent->n_net);
}
}
if (pent) {
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, pent->p_name);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
for (elem = pent->p_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
sv_catpvn(sv, " ", 1);
}
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)pent->p_proto);
}
}
if (sent) {
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, sent->s_name);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
for (elem = sent->s_aliases; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
sv_catpvn(sv, " ", 1);
}
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef HAS_NTOHS
sv_setiv(sv, (IV)PerlSock_ntohs(sent->s_port));
#else
sv_setiv(sv, (IV)(sent->s_port));
#endif
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, sent->s_proto);
}
}
if (pwent) {
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, pwent->pw_name);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef PWPASSWD
sv_setpv(sv, pwent->pw_passwd);
#endif
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)pwent->pw_uid);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)pwent->pw_gid);
/* pw_change, pw_quota, and pw_age are mutually exclusive. */
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef PWCHANGE
sv_setiv(sv, (IV)pwent->pw_change);
#else
#endif
/* pw_class and pw_comment are mutually exclusive. */
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef PWCLASS
sv_setpv(sv, pwent->pw_class);
#else
# endif
#endif
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef PWGECOS
sv_setpv(sv, pwent->pw_gecos);
#endif
SvTAINTED_on(sv);
#endif
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, pwent->pw_dir);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, pwent->pw_shell);
#ifdef PWEXPIRE
}
if (grent) {
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setpv(sv, grent->gr_name);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
#ifdef GRPASSWD
sv_setpv(sv, grent->gr_passwd);
#endif
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)grent->gr_gid);
- PUSHs(sv = sv_mortalcopy(&sv_no));
+ PUSHs(sv = sv_mortalcopy(&PL_sv_no));
for (elem = grent->gr_mem; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
I32 retval = -1;
MAGIC *mg;
- if (tainting) {
+ if (PL_tainting) {
while (++MARK <= SP) {
if (SvTAINTED(*MARK)) {
TAINT;
while (++MARK <= SP) {
if (SvNIOK(*MARK) || !i)
a[i++] = SvIV(*MARK);
- else if (*MARK == &sv_undef)
+ else if (*MARK == &PL_sv_undef)
a[i++] = 0;
else
- a[i++] = (unsigned long)SvPV_force(*MARK, na);
+ a[i++] = (unsigned long)SvPV_force(*MARK, PL_na);
if (i > 15)
break;
}
? (flags & ~SCF_DO_SUBSTR) : flags);
if (!scan) /* It was not CURLYX, but CURLY. */
scan = next;
- if (dowarn && (minnext + deltanext == 0)
+ if (PL_dowarn && (minnext + deltanext == 0)
&& !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
&& maxcount <= 10000) /* Complement check for big count */
warn("Strange *+?{} on zero-length expression");
add_data(I32 n, char *s)
{
dTHR;
- if (regcomp_rx->data) {
- Renewc(regcomp_rx->data,
- sizeof(*regcomp_rx->data) + sizeof(void*) * (regcomp_rx->data->count + n - 1),
+ if (PL_regcomp_rx->data) {
+ Renewc(PL_regcomp_rx->data,
+ sizeof(*PL_regcomp_rx->data) + sizeof(void*) * (PL_regcomp_rx->data->count + n - 1),
char, struct reg_data);
- Renew(regcomp_rx->data->what, regcomp_rx->data->count + n, U8);
- regcomp_rx->data->count += n;
+ Renew(PL_regcomp_rx->data->what, PL_regcomp_rx->data->count + n, U8);
+ PL_regcomp_rx->data->count += n;
} else {
- Newc(1207, regcomp_rx->data, sizeof(*regcomp_rx->data) + sizeof(void*) * (n - 1),
+ Newc(1207, PL_regcomp_rx->data, sizeof(*PL_regcomp_rx->data) + sizeof(void*) * (n - 1),
char, struct reg_data);
- New(1208, regcomp_rx->data->what, n, U8);
- regcomp_rx->data->count = n;
+ New(1208, PL_regcomp_rx->data->what, n, U8);
+ PL_regcomp_rx->data->count = n;
}
- Copy(s, regcomp_rx->data->what + regcomp_rx->data->count - n, n, U8);
- return regcomp_rx->data->count - n;
+ Copy(s, PL_regcomp_rx->data->what + PL_regcomp_rx->data->count - n, n, U8);
+ return PL_regcomp_rx->data->count - n;
}
/*
if (exp == NULL)
FAIL("NULL regexp argument");
- regprecomp = savepvn(exp, xend - exp);
+ PL_regprecomp = savepvn(exp, xend - exp);
DEBUG_r(PerlIO_printf(Perl_debug_log, "compiling RE `%*s'\n",
- xend - exp, regprecomp));
- regflags = pm->op_pmflags;
- regsawback = 0;
+ xend - exp, PL_regprecomp));
+ PL_regflags = pm->op_pmflags;
+ PL_regsawback = 0;
- regseen = 0;
- seen_zerolen = *exp == '^' ? -1 : 0;
- seen_evals = 0;
- extralen = 0;
+ PL_regseen = 0;
+ PL_seen_zerolen = *exp == '^' ? -1 : 0;
+ PL_seen_evals = 0;
+ PL_extralen = 0;
/* First pass: determine size, legality. */
- regcomp_parse = exp;
- regxend = xend;
- regnaughty = 0;
- regnpar = 1;
- regsize = 0L;
- regcode = ®dummy;
- regc((U8)MAGIC, (char*)regcode);
+ PL_regcomp_parse = exp;
+ PL_regxend = xend;
+ PL_regnaughty = 0;
+ PL_regnpar = 1;
+ PL_regsize = 0L;
+ PL_regcode = &PL_regdummy;
+ regc((U8)MAGIC, (char*)PL_regcode);
if (reg(0, &flags) == NULL) {
- Safefree(regprecomp);
- regprecomp = Nullch;
+ Safefree(PL_regprecomp);
+ PL_regprecomp = Nullch;
return(NULL);
}
- DEBUG_r(PerlIO_printf(Perl_debug_log, "size %d ", regsize));
+ DEBUG_r(PerlIO_printf(Perl_debug_log, "size %d ", PL_regsize));
DEBUG_r(
- if (!colorset) {
+ if (!PL_colorset) {
int i = 0;
char *s = PerlEnv_getenv("TERMCAP_COLORS");
- colorset = 1;
+ PL_colorset = 1;
if (s) {
- colors[0] = s = savepv(s);
+ PL_colors[0] = s = savepv(s);
while (++i < 4) {
s = strchr(s, '\t');
if (!s)
FAIL("Not enough TABs in TERMCAP_COLORS");
*s = '\0';
- colors[i] = ++s;
+ PL_colors[i] = ++s;
}
} else {
while (i < 4)
- colors[i++] = "";
+ PL_colors[i++] = "";
}
/* Reset colors: */
PerlIO_printf(Perl_debug_log, "%s%s%s%s",
- colors[0],colors[1],colors[2],colors[3]);
+ PL_colors[0],PL_colors[1],PL_colors[2],PL_colors[3]);
}
);
/* Small enough for pointer-storage convention?
If extralen==0, this means that we will not need long jumps. */
- if (regsize >= 0x10000L && extralen)
- regsize += extralen;
+ if (PL_regsize >= 0x10000L && PL_extralen)
+ PL_regsize += PL_extralen;
else
- extralen = 0;
+ PL_extralen = 0;
/* Allocate space and initialize. */
- Newc(1001, r, sizeof(regexp) + (unsigned)regsize * sizeof(regnode),
+ Newc(1001, r, sizeof(regexp) + (unsigned)PL_regsize * sizeof(regnode),
char, regexp);
if (r == NULL)
FAIL("regexp out of space");
r->refcnt = 1;
r->prelen = xend - exp;
- r->precomp = regprecomp;
+ r->precomp = PL_regprecomp;
r->subbeg = r->subbase = NULL;
- r->nparens = regnpar - 1; /* set early to validate backrefs */
- regcomp_rx = r;
+ r->nparens = PL_regnpar - 1; /* set early to validate backrefs */
+ PL_regcomp_rx = r;
/* Second pass: emit code. */
- regcomp_parse = exp;
- regxend = xend;
- regnaughty = 0;
- regnpar = 1;
- regcode = r->program;
+ PL_regcomp_parse = exp;
+ PL_regxend = xend;
+ PL_regnaughty = 0;
+ PL_regnpar = 1;
+ PL_regcode = r->program;
/* Store the count of eval-groups for security checks: */
- regcode->next_off = ((seen_evals > U16_MAX) ? U16_MAX : seen_evals);
- regc((U8)MAGIC, (char*) regcode++);
+ PL_regcode->next_off = ((PL_seen_evals > U16_MAX) ? U16_MAX : PL_seen_evals);
+ regc((U8)MAGIC, (char*) PL_regcode++);
r->data = 0;
if (reg(0, &flags) == NULL)
return(NULL);
/* Dig out information for optimizations. */
r->reganch = pm->op_pmflags & PMf_COMPILETIME;
- pm->op_pmflags = regflags;
+ pm->op_pmflags = PL_regflags;
r->regstclass = NULL;
- r->naughty = regnaughty >= 10; /* Probably an expensive pattern. */
+ r->naughty = PL_regnaughty >= 10; /* Probably an expensive pattern. */
scan = r->program + 1; /* First BRANCH. */
/* XXXX To minimize changes to RE engine we always allocate
first = NEXTOPER(first);
goto again;
}
- if (sawplus && (!sawopen || !regsawback))
+ if (sawplus && (!sawopen || !PL_regsawback))
r->reganch |= ROPT_SKIP; /* x+ must match 1st of run */
/* Scan is after the zeroth branch, first is atomic matcher. */
data.longest = &(data.longest_fixed);
first = scan;
- minlen = study_chunk(&first, &fake, scan + regsize, /* Up to end */
+ minlen = study_chunk(&first, &fake, scan + PL_regsize, /* Up to end */
&data, SCF_DO_SUBSTR);
- if ( regnpar == 1 && data.longest == &(data.longest_fixed)
+ if ( PL_regnpar == 1 && data.longest == &(data.longest_fixed)
&& data.last_start_min == 0 && data.last_end > 0
- && !seen_zerolen
- && (!(regseen & REG_SEEN_GPOS) || (r->reganch & ROPT_ANCH_GPOS)))
+ && !PL_seen_zerolen
+ && (!(PL_regseen & REG_SEEN_GPOS) || (r->reganch & ROPT_ANCH_GPOS)))
r->reganch |= ROPT_CHECK_ALL;
scan_commit(&data);
SvREFCNT_dec(data.last_found);
if (longest_float_length
|| (data.flags & SF_FL_BEFORE_EOL
&& (!(data.flags & SF_FL_BEFORE_MEOL)
- || (regflags & PMf_MULTILINE)))) {
+ || (PL_regflags & PMf_MULTILINE)))) {
if (SvCUR(data.longest_fixed)
&& data.offset_fixed == data.offset_float_min)
goto remove; /* Like in (a)+. */
BmUSEFUL(r->float_substr) = 100;
if (data.flags & SF_FL_BEFORE_EOL /* Cannot have SEOL and MULTI */
&& (!(data.flags & SF_FL_BEFORE_MEOL)
- || (regflags & PMf_MULTILINE)))
+ || (PL_regflags & PMf_MULTILINE)))
SvTAIL_on(r->float_substr);
} else {
remove:
if (longest_fixed_length
|| (data.flags & SF_FIX_BEFORE_EOL /* Cannot have SEOL and MULTI */
&& (!(data.flags & SF_FIX_BEFORE_MEOL)
- || (regflags & PMf_MULTILINE)))) {
+ || (PL_regflags & PMf_MULTILINE)))) {
r->anchored_substr = data.longest_fixed;
r->anchored_offset = data.offset_fixed;
fbm_compile(r->anchored_substr, 0);
BmUSEFUL(r->anchored_substr) = 100;
if (data.flags & SF_FIX_BEFORE_EOL /* Cannot have SEOL and MULTI */
&& (!(data.flags & SF_FIX_BEFORE_MEOL)
- || (regflags & PMf_MULTILINE)))
+ || (PL_regflags & PMf_MULTILINE)))
SvTAIL_on(r->anchored_substr);
} else {
r->anchored_substr = Nullsv;
DEBUG_r(PerlIO_printf(Perl_debug_log, "\n"));
scan = r->program + 1;
- minlen = study_chunk(&scan, &fake, scan + regsize, NULL, 0);
+ minlen = study_chunk(&scan, &fake, scan + PL_regsize, NULL, 0);
r->check_substr = r->anchored_substr = r->float_substr = Nullsv;
}
r->minlen = minlen;
- if (regseen & REG_SEEN_GPOS)
+ if (PL_regseen & REG_SEEN_GPOS)
r->reganch |= ROPT_GPOS_SEEN;
- if (regseen & REG_SEEN_LOOKBEHIND)
+ if (PL_regseen & REG_SEEN_LOOKBEHIND)
r->reganch |= ROPT_LOOKBEHIND_SEEN;
- if (regseen & REG_SEEN_EVAL)
+ if (PL_regseen & REG_SEEN_EVAL)
r->reganch |= ROPT_EVAL_SEEN;
- Newz(1002, r->startp, regnpar, char*);
- Newz(1002, r->endp, regnpar, char*);
+ Newz(1002, r->startp, PL_regnpar, char*);
+ Newz(1002, r->endp, PL_regnpar, char*);
DEBUG_r(regdump(r));
return(r);
}
register regnode *lastbr;
register regnode *ender = 0;
register I32 parno = 0;
- I32 flags, oregflags = regflags, have_branch = 0, open = 0;
+ I32 flags, oregflags = PL_regflags, have_branch = 0, open = 0;
char c;
*flagp = 0; /* Tentatively. */
/* Make an OPEN node, if parenthesized. */
if (paren) {
- if (*regcomp_parse == '?') {
+ if (*PL_regcomp_parse == '?') {
U16 posflags = 0, negflags = 0;
U16 *flagsp = &posflags;
- regcomp_parse++;
- paren = *regcomp_parse++;
+ PL_regcomp_parse++;
+ paren = *PL_regcomp_parse++;
ret = NULL; /* For look-ahead/behind. */
switch (paren) {
case '<':
- regseen |= REG_SEEN_LOOKBEHIND;
- if (*regcomp_parse == '!')
+ PL_regseen |= REG_SEEN_LOOKBEHIND;
+ if (*PL_regcomp_parse == '!')
paren = ',';
- if (*regcomp_parse != '=' && *regcomp_parse != '!')
+ if (*PL_regcomp_parse != '=' && *PL_regcomp_parse != '!')
goto unknown;
- regcomp_parse++;
+ PL_regcomp_parse++;
case '=':
case '!':
- seen_zerolen++;
+ PL_seen_zerolen++;
case ':':
case '>':
break;
FAIL2("Sequence (?%c...) not implemented", (int)paren);
break;
case '#':
- while (*regcomp_parse && *regcomp_parse != ')')
- regcomp_parse++;
- if (*regcomp_parse != ')')
+ while (*PL_regcomp_parse && *PL_regcomp_parse != ')')
+ PL_regcomp_parse++;
+ if (*PL_regcomp_parse != ')')
FAIL("Sequence (?#... not terminated");
nextchar();
*flagp = TRYAGAIN;
dTHR;
I32 count = 1, n = 0;
char c;
- char *s = regcomp_parse;
+ char *s = PL_regcomp_parse;
SV *sv;
OP_4tree *sop, *rop;
- seen_zerolen++;
- regseen |= REG_SEEN_EVAL;
- while (count && (c = *regcomp_parse)) {
- if (c == '\\' && regcomp_parse[1])
- regcomp_parse++;
+ PL_seen_zerolen++;
+ PL_regseen |= REG_SEEN_EVAL;
+ while (count && (c = *PL_regcomp_parse)) {
+ if (c == '\\' && PL_regcomp_parse[1])
+ PL_regcomp_parse++;
else if (c == '{')
count++;
else if (c == '}')
count--;
- regcomp_parse++;
+ PL_regcomp_parse++;
}
- if (*regcomp_parse != ')')
+ if (*PL_regcomp_parse != ')')
FAIL("Sequence (?{...}) not terminated or not {}-balanced");
if (!SIZE_ONLY) {
AV *av;
- if (regcomp_parse - 1 - s)
- sv = newSVpv(s, regcomp_parse - 1 - s);
+ if (PL_regcomp_parse - 1 - s)
+ sv = newSVpv(s, PL_regcomp_parse - 1 - s);
else
sv = newSVpv("", 0);
rop = sv_compile_2op(sv, &sop, "re", &av);
n = add_data(3, "nso");
- regcomp_rx->data->data[n] = (void*)rop;
- regcomp_rx->data->data[n+1] = (void*)av;
- regcomp_rx->data->data[n+2] = (void*)sop;
+ PL_regcomp_rx->data->data[n] = (void*)rop;
+ PL_regcomp_rx->data->data[n+1] = (void*)av;
+ PL_regcomp_rx->data->data[n+2] = (void*)sop;
SvREFCNT_dec(sv);
} else { /* First pass */
- if (reginterp_cnt < ++seen_evals && curcop != &compiling)
+ if (PL_reginterp_cnt < ++PL_seen_evals && PL_curcop != &PL_compiling)
/* No compiled RE interpolated, has runtime
components ===> unsafe. */
FAIL("Eval-group not allowed at runtime, use re 'eval'");
- if (tainted)
+ if (PL_tainted)
FAIL("Eval-group in insecure regular expression");
}
}
case '(':
{
- if (regcomp_parse[0] == '?') {
- if (regcomp_parse[1] == '=' || regcomp_parse[1] == '!'
- || regcomp_parse[1] == '<'
- || regcomp_parse[1] == '{') { /* Lookahead or eval. */
+ if (PL_regcomp_parse[0] == '?') {
+ if (PL_regcomp_parse[1] == '=' || PL_regcomp_parse[1] == '!'
+ || PL_regcomp_parse[1] == '<'
+ || PL_regcomp_parse[1] == '{') { /* Lookahead or eval. */
I32 flag;
ret = reg_node(LOGICAL);
regtail(ret, reg(1, &flag));
goto insert_if;
}
- } else if (regcomp_parse[0] >= '1' && regcomp_parse[0] <= '9' ) {
- parno = atoi(regcomp_parse++);
+ } else if (PL_regcomp_parse[0] >= '1' && PL_regcomp_parse[0] <= '9' ) {
+ parno = atoi(PL_regcomp_parse++);
- while (isDIGIT(*regcomp_parse))
- regcomp_parse++;
+ while (isDIGIT(*PL_regcomp_parse))
+ PL_regcomp_parse++;
ret = reganode(GROUPP, parno);
if ((c = *nextchar()) != ')')
FAIL2("Switch (?(number%c not recognized", c);
regtail(ret, ender);
return ret;
} else {
- FAIL2("Unknown condition for (?(%.2s", regcomp_parse);
+ FAIL2("Unknown condition for (?(%.2s", PL_regcomp_parse);
}
}
case 0:
FAIL("Sequence (? incomplete");
break;
default:
- --regcomp_parse;
+ --PL_regcomp_parse;
parse_flags:
- while (*regcomp_parse && strchr("iogcmsx", *regcomp_parse)) {
- if (*regcomp_parse != 'o')
- pmflag(flagsp, *regcomp_parse);
- ++regcomp_parse;
+ while (*PL_regcomp_parse && strchr("iogcmsx", *PL_regcomp_parse)) {
+ if (*PL_regcomp_parse != 'o')
+ pmflag(flagsp, *PL_regcomp_parse);
+ ++PL_regcomp_parse;
}
- if (*regcomp_parse == '-') {
+ if (*PL_regcomp_parse == '-') {
flagsp = &negflags;
- ++regcomp_parse;
+ ++PL_regcomp_parse;
goto parse_flags;
}
- regflags |= posflags;
- regflags &= ~negflags;
- if (*regcomp_parse == ':') {
- regcomp_parse++;
+ PL_regflags |= posflags;
+ PL_regflags &= ~negflags;
+ if (*PL_regcomp_parse == ':') {
+ PL_regcomp_parse++;
paren = ':';
break;
}
unknown:
- if (*regcomp_parse != ')')
- FAIL2("Sequence (?%c...) not recognized", *regcomp_parse);
+ if (*PL_regcomp_parse != ')')
+ FAIL2("Sequence (?%c...) not recognized", *PL_regcomp_parse);
nextchar();
*flagp = TRYAGAIN;
return NULL;
}
}
else {
- parno = regnpar;
- regnpar++;
+ parno = PL_regnpar;
+ PL_regnpar++;
ret = reganode(OPEN, parno);
open = 1;
}
br = regbranch(&flags, 1);
if (br == NULL)
return(NULL);
- if (*regcomp_parse == '|') {
- if (!SIZE_ONLY && extralen) {
+ if (*PL_regcomp_parse == '|') {
+ if (!SIZE_ONLY && PL_extralen) {
reginsert(BRANCHJ, br);
} else
reginsert(BRANCH, br);
have_branch = 1;
if (SIZE_ONLY)
- extralen += 1; /* For BRANCHJ-BRANCH. */
+ PL_extralen += 1; /* For BRANCHJ-BRANCH. */
} else if (paren == ':') {
*flagp |= flags&SIMPLE;
}
*flagp |= HASWIDTH;
*flagp |= flags&SPSTART;
lastbr = br;
- while (*regcomp_parse == '|') {
- if (!SIZE_ONLY && extralen) {
+ while (*PL_regcomp_parse == '|') {
+ if (!SIZE_ONLY && PL_extralen) {
ender = reganode(LONGJMP,0);
regtail(NEXTOPER(NEXTOPER(lastbr)), ender); /* Append to the previous. */
}
if (SIZE_ONLY)
- extralen += 2; /* Account for LONGJMP. */
+ PL_extralen += 2; /* Account for LONGJMP. */
nextchar();
br = regbranch(&flags, 0);
if (br == NULL)
}
/* Check for proper termination. */
- if (paren && (regcomp_parse >= regxend || *nextchar() != ')')) {
+ if (paren && (PL_regcomp_parse >= PL_regxend || *nextchar() != ')')) {
FAIL("unmatched () in regexp");
- } else if (!paren && regcomp_parse < regxend) {
- if (*regcomp_parse == ')') {
+ } else if (!paren && PL_regcomp_parse < PL_regxend) {
+ if (*PL_regcomp_parse == ')') {
FAIL("unmatched () in regexp");
} else
FAIL("junk on end of regexp"); /* "Can't happen". */
/* NOTREACHED */
}
if (paren != 0) {
- regflags = oregflags;
+ PL_regflags = oregflags;
}
return(ret);
if (first)
ret = NULL;
else {
- if (!SIZE_ONLY && extralen)
+ if (!SIZE_ONLY && PL_extralen)
ret = reganode(BRANCHJ,0);
else
ret = reg_node(BRANCH);
}
if (!first && SIZE_ONLY)
- extralen += 1; /* BRANCHJ */
+ PL_extralen += 1; /* BRANCHJ */
*flagp = WORST; /* Tentatively. */
- regcomp_parse--;
+ PL_regcomp_parse--;
nextchar();
- while (regcomp_parse < regxend && *regcomp_parse != '|' && *regcomp_parse != ')') {
+ while (PL_regcomp_parse < PL_regxend && *PL_regcomp_parse != '|' && *PL_regcomp_parse != ')') {
flags &= ~TRYAGAIN;
latest = regpiece(&flags);
if (latest == NULL) {
if (chain == NULL) /* First piece. */
*flagp |= flags&SPSTART;
else {
- regnaughty++;
+ PL_regnaughty++;
regtail(chain, latest);
}
chain = latest;
register char op;
register char *next;
I32 flags;
- char *origparse = regcomp_parse;
+ char *origparse = PL_regcomp_parse;
char *maxpos;
I32 min;
I32 max = REG_INFTY;
return(NULL);
}
- op = *regcomp_parse;
+ op = *PL_regcomp_parse;
- if (op == '{' && regcurly(regcomp_parse)) {
- next = regcomp_parse + 1;
+ if (op == '{' && regcurly(PL_regcomp_parse)) {
+ next = PL_regcomp_parse + 1;
maxpos = Nullch;
while (isDIGIT(*next) || *next == ',') {
if (*next == ',') {
if (*next == '}') { /* got one */
if (!maxpos)
maxpos = next;
- regcomp_parse++;
- min = atoi(regcomp_parse);
+ PL_regcomp_parse++;
+ min = atoi(PL_regcomp_parse);
if (*maxpos == ',')
maxpos++;
else
- maxpos = regcomp_parse;
+ maxpos = PL_regcomp_parse;
max = atoi(maxpos);
if (!max && *maxpos != '0')
max = REG_INFTY; /* meaning "infinity" */
else if (max >= REG_INFTY)
FAIL2("Quantifier in {,} bigger than %d", REG_INFTY - 1);
- regcomp_parse = next;
+ PL_regcomp_parse = next;
nextchar();
do_curly:
if ((flags&SIMPLE)) {
- regnaughty += 2 + regnaughty / 2;
+ PL_regnaughty += 2 + PL_regnaughty / 2;
reginsert(CURLY, ret);
}
else {
- regnaughty += 4 + regnaughty; /* compound interest */
+ PL_regnaughty += 4 + PL_regnaughty; /* compound interest */
regtail(ret, reg_node(WHILEM));
- if (!SIZE_ONLY && extralen) {
+ if (!SIZE_ONLY && PL_extralen) {
reginsert(LONGJMP,ret);
reginsert(NOTHING,ret);
NEXT_OFF(ret) = 3; /* Go over LONGJMP. */
}
reginsert(CURLYX,ret);
- if (!SIZE_ONLY && extralen)
+ if (!SIZE_ONLY && PL_extralen)
NEXT_OFF(ret) = 3; /* Go over NOTHING to LONGJMP. */
regtail(ret, reg_node(NOTHING));
if (SIZE_ONLY)
- extralen += 3;
+ PL_extralen += 3;
}
ret->flags = 0;
if (op == '*' && (flags&SIMPLE)) {
reginsert(STAR, ret);
ret->flags = 0;
- regnaughty += 4;
+ PL_regnaughty += 4;
}
else if (op == '*') {
min = 0;
} else if (op == '+' && (flags&SIMPLE)) {
reginsert(PLUS, ret);
ret->flags = 0;
- regnaughty += 3;
+ PL_regnaughty += 3;
}
else if (op == '+') {
min = 1;
goto do_curly;
}
nest_check:
- if (dowarn && !SIZE_ONLY && !(flags&HASWIDTH) && max > 10000) {
+ if (PL_dowarn && !SIZE_ONLY && !(flags&HASWIDTH) && max > 10000) {
warn("%.*s matches null string many times",
- regcomp_parse - origparse, origparse);
+ PL_regcomp_parse - origparse, origparse);
}
- if (*regcomp_parse == '?') {
+ if (*PL_regcomp_parse == '?') {
nextchar();
reginsert(MINMOD, ret);
regtail(ret, ret + NODE_STEP_REGNODE);
}
- if (ISMULT2(regcomp_parse))
+ if (ISMULT2(PL_regcomp_parse))
FAIL("nested *?+ in regexp");
return(ret);
*flagp = WORST; /* Tentatively. */
tryagain:
- switch (*regcomp_parse) {
+ switch (*PL_regcomp_parse) {
case '^':
- seen_zerolen++;
+ PL_seen_zerolen++;
nextchar();
- if (regflags & PMf_MULTILINE)
+ if (PL_regflags & PMf_MULTILINE)
ret = reg_node(MBOL);
- else if (regflags & PMf_SINGLELINE)
+ else if (PL_regflags & PMf_SINGLELINE)
ret = reg_node(SBOL);
else
ret = reg_node(BOL);
break;
case '$':
- if (regcomp_parse[1])
- seen_zerolen++;
+ if (PL_regcomp_parse[1])
+ PL_seen_zerolen++;
nextchar();
- if (regflags & PMf_MULTILINE)
+ if (PL_regflags & PMf_MULTILINE)
ret = reg_node(MEOL);
- else if (regflags & PMf_SINGLELINE)
+ else if (PL_regflags & PMf_SINGLELINE)
ret = reg_node(SEOL);
else
ret = reg_node(EOL);
break;
case '.':
nextchar();
- if (regflags & PMf_SINGLELINE)
+ if (PL_regflags & PMf_SINGLELINE)
ret = reg_node(SANY);
else
ret = reg_node(ANY);
- regnaughty++;
+ PL_regnaughty++;
*flagp |= HASWIDTH|SIMPLE;
break;
case '[':
- regcomp_parse++;
+ PL_regcomp_parse++;
ret = regclass();
*flagp |= HASWIDTH|SIMPLE;
break;
*flagp |= TRYAGAIN;
return NULL;
}
- FAIL2("internal urp in regexp at /%s/", regcomp_parse);
+ FAIL2("internal urp in regexp at /%s/", PL_regcomp_parse);
/* Supposed to be caught earlier. */
break;
case '{':
- if (!regcurly(regcomp_parse)) {
- regcomp_parse++;
+ if (!regcurly(PL_regcomp_parse)) {
+ PL_regcomp_parse++;
goto defchar;
}
/* FALL THROUGH */
FAIL("?+*{} follows nothing in regexp");
break;
case '\\':
- switch (*++regcomp_parse) {
+ switch (*++PL_regcomp_parse) {
case 'A':
- seen_zerolen++;
+ PL_seen_zerolen++;
ret = reg_node(SBOL);
*flagp |= SIMPLE;
nextchar();
break;
case 'G':
ret = reg_node(GPOS);
- regseen |= REG_SEEN_GPOS;
+ PL_regseen |= REG_SEEN_GPOS;
*flagp |= SIMPLE;
nextchar();
break;
case 'z':
ret = reg_node(EOS);
*flagp |= SIMPLE;
- seen_zerolen++; /* Do not optimize RE away */
+ PL_seen_zerolen++; /* Do not optimize RE away */
nextchar();
break;
case 'w':
- ret = reg_node((regflags & PMf_LOCALE) ? ALNUML : ALNUM);
+ ret = reg_node((PL_regflags & PMf_LOCALE) ? ALNUML : ALNUM);
*flagp |= HASWIDTH|SIMPLE;
nextchar();
break;
case 'W':
- ret = reg_node((regflags & PMf_LOCALE) ? NALNUML : NALNUM);
+ ret = reg_node((PL_regflags & PMf_LOCALE) ? NALNUML : NALNUM);
*flagp |= HASWIDTH|SIMPLE;
nextchar();
break;
case 'b':
- seen_zerolen++;
- ret = reg_node((regflags & PMf_LOCALE) ? BOUNDL : BOUND);
+ PL_seen_zerolen++;
+ ret = reg_node((PL_regflags & PMf_LOCALE) ? BOUNDL : BOUND);
*flagp |= SIMPLE;
nextchar();
break;
case 'B':
- seen_zerolen++;
- ret = reg_node((regflags & PMf_LOCALE) ? NBOUNDL : NBOUND);
+ PL_seen_zerolen++;
+ ret = reg_node((PL_regflags & PMf_LOCALE) ? NBOUNDL : NBOUND);
*flagp |= SIMPLE;
nextchar();
break;
case 's':
- ret = reg_node((regflags & PMf_LOCALE) ? SPACEL : SPACE);
+ ret = reg_node((PL_regflags & PMf_LOCALE) ? SPACEL : SPACE);
*flagp |= HASWIDTH|SIMPLE;
nextchar();
break;
case 'S':
- ret = reg_node((regflags & PMf_LOCALE) ? NSPACEL : NSPACE);
+ ret = reg_node((PL_regflags & PMf_LOCALE) ? NSPACEL : NSPACE);
*flagp |= HASWIDTH|SIMPLE;
nextchar();
break;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
- I32 num = atoi(regcomp_parse);
+ I32 num = atoi(PL_regcomp_parse);
- if (num > 9 && num >= regnpar)
+ if (num > 9 && num >= PL_regnpar)
goto defchar;
else {
- if (!SIZE_ONLY && num > regcomp_rx->nparens)
+ if (!SIZE_ONLY && num > PL_regcomp_rx->nparens)
FAIL("reference to nonexistent group");
- regsawback = 1;
- ret = reganode((regflags & PMf_FOLD)
- ? ((regflags & PMf_LOCALE) ? REFFL : REFF)
+ PL_regsawback = 1;
+ ret = reganode((PL_regflags & PMf_FOLD)
+ ? ((PL_regflags & PMf_LOCALE) ? REFFL : REFF)
: REF, num);
*flagp |= HASWIDTH;
- while (isDIGIT(*regcomp_parse))
- regcomp_parse++;
- regcomp_parse--;
+ while (isDIGIT(*PL_regcomp_parse))
+ PL_regcomp_parse++;
+ PL_regcomp_parse--;
nextchar();
}
}
break;
case '\0':
- if (regcomp_parse >= regxend)
+ if (PL_regcomp_parse >= PL_regxend)
FAIL("trailing \\ in regexp");
/* FALL THROUGH */
default:
break;
case '#':
- if (regflags & PMf_EXTENDED) {
- while (regcomp_parse < regxend && *regcomp_parse != '\n') regcomp_parse++;
- if (regcomp_parse < regxend)
+ if (PL_regflags & PMf_EXTENDED) {
+ while (PL_regcomp_parse < PL_regxend && *PL_regcomp_parse != '\n') PL_regcomp_parse++;
+ if (PL_regcomp_parse < PL_regxend)
goto tryagain;
}
/* FALL THROUGH */
char *oldp, *s;
I32 numlen;
- regcomp_parse++;
+ PL_regcomp_parse++;
defchar:
- ret = reg_node((regflags & PMf_FOLD)
- ? ((regflags & PMf_LOCALE) ? EXACTFL : EXACTF)
+ ret = reg_node((PL_regflags & PMf_FOLD)
+ ? ((PL_regflags & PMf_LOCALE) ? EXACTFL : EXACTF)
: EXACT);
s = (char *) OPERAND(ret);
regc(0, s++); /* save spot for len */
- for (len = 0, p = regcomp_parse - 1;
- len < 127 && p < regxend;
+ for (len = 0, p = PL_regcomp_parse - 1;
+ len < 127 && p < PL_regxend;
len++)
{
oldp = p;
- if (regflags & PMf_EXTENDED)
- p = regwhite(p, regxend);
+ if (PL_regflags & PMf_EXTENDED)
+ p = regwhite(p, PL_regxend);
switch (*p) {
case '^':
case '$':
case '0': case '1': case '2': case '3':case '4':
case '5': case '6': case '7': case '8':case '9':
if (*p == '0' ||
- (isDIGIT(p[1]) && atoi(p) >= regnpar) ) {
+ (isDIGIT(p[1]) && atoi(p) >= PL_regnpar) ) {
ender = scan_oct(p, 3, &numlen);
p += numlen;
}
}
break;
case '\0':
- if (p >= regxend)
+ if (p >= PL_regxend)
FAIL("trailing \\ in regexp");
/* FALL THROUGH */
default:
ender = *p++;
break;
}
- if (regflags & PMf_EXTENDED)
- p = regwhite(p, regxend);
+ if (PL_regflags & PMf_EXTENDED)
+ p = regwhite(p, PL_regxend);
if (ISMULT2(p)) { /* Back off on ?+*. */
if (len)
p = oldp;
regc(ender, s++);
}
loopdone:
- regcomp_parse = p - 1;
+ PL_regcomp_parse = p - 1;
nextchar();
if (len < 0)
FAIL("internal disaster in regexp");
*OPERAND(ret) = len;
regc('\0', s++);
if (SIZE_ONLY) {
- regsize += (len + 2 + sizeof(regnode) - 1) / sizeof(regnode);
+ PL_regsize += (len + 2 + sizeof(regnode) - 1) / sizeof(regnode);
} else {
- regcode += (len + 2 + sizeof(regnode) - 1) / sizeof(regnode);
+ PL_regcode += (len + 2 + sizeof(regnode) - 1) / sizeof(regnode);
}
}
break;
register I32 def;
I32 numlen;
- s = opnd = (char *) OPERAND(regcode);
+ s = opnd = (char *) OPERAND(PL_regcode);
ret = reg_node(ANYOF);
for (Class = 0; Class < 33; Class++)
regc(0, s++);
- if (*regcomp_parse == '^') { /* Complement of range. */
- regnaughty++;
- regcomp_parse++;
+ if (*PL_regcomp_parse == '^') { /* Complement of range. */
+ PL_regnaughty++;
+ PL_regcomp_parse++;
if (!SIZE_ONLY)
*opnd |= ANYOF_INVERT;
}
if (!SIZE_ONLY) {
- regcode += ANY_SKIP;
- if (regflags & PMf_FOLD)
+ PL_regcode += ANY_SKIP;
+ if (PL_regflags & PMf_FOLD)
*opnd |= ANYOF_FOLD;
- if (regflags & PMf_LOCALE)
+ if (PL_regflags & PMf_LOCALE)
*opnd |= ANYOF_LOCALE;
} else {
- regsize += ANY_SKIP;
+ PL_regsize += ANY_SKIP;
}
- if (*regcomp_parse == ']' || *regcomp_parse == '-')
+ if (*PL_regcomp_parse == ']' || *PL_regcomp_parse == '-')
goto skipcond; /* allow 1st char to be ] or - */
- while (regcomp_parse < regxend && *regcomp_parse != ']') {
+ while (PL_regcomp_parse < PL_regxend && *PL_regcomp_parse != ']') {
skipcond:
- Class = UCHARAT(regcomp_parse++);
- if (Class == '[' && regcomp_parse + 1 < regxend &&
+ Class = UCHARAT(PL_regcomp_parse++);
+ if (Class == '[' && PL_regcomp_parse + 1 < PL_regxend &&
/* I smell either [: or [= or [. -- POSIX has been here, right? */
- (*regcomp_parse == ':' || *regcomp_parse == '=' || *regcomp_parse == '.')) {
- char posixccc = *regcomp_parse;
- char* posixccs = regcomp_parse++;
+ (*PL_regcomp_parse == ':' || *PL_regcomp_parse == '=' || *PL_regcomp_parse == '.')) {
+ char posixccc = *PL_regcomp_parse;
+ char* posixccs = PL_regcomp_parse++;
- while (regcomp_parse < regxend && *regcomp_parse != posixccc)
- regcomp_parse++;
- if (regcomp_parse == regxend)
+ while (PL_regcomp_parse < PL_regxend && *PL_regcomp_parse != posixccc)
+ PL_regcomp_parse++;
+ if (PL_regcomp_parse == PL_regxend)
/* Grandfather lone [:, [=, [. */
- regcomp_parse = posixccs;
+ PL_regcomp_parse = posixccs;
else {
- regcomp_parse++; /* skip over the posixccc */
- if (*regcomp_parse == ']') {
+ PL_regcomp_parse++; /* skip over the posixccc */
+ if (*PL_regcomp_parse == ']') {
/* Not Implemented Yet.
* (POSIX Extended Character Classes, that is)
* The text between e.g. [: and :] would start
* at posixccs + 1 and stop at regcomp_parse - 2. */
- if (dowarn && !SIZE_ONLY)
+ if (PL_dowarn && !SIZE_ONLY)
warn("Character class syntax [%c %c] is reserved for future extensions", posixccc, posixccc);
- regcomp_parse++; /* skip over the ending ] */
+ PL_regcomp_parse++; /* skip over the ending ] */
}
}
}
if (Class == '\\') {
- Class = UCHARAT(regcomp_parse++);
+ Class = UCHARAT(PL_regcomp_parse++);
switch (Class) {
case 'w':
if (!SIZE_ONLY) {
- if (regflags & PMf_LOCALE)
+ if (PL_regflags & PMf_LOCALE)
*opnd |= ANYOF_ALNUML;
else {
for (Class = 0; Class < 256; Class++)
continue;
case 'W':
if (!SIZE_ONLY) {
- if (regflags & PMf_LOCALE)
+ if (PL_regflags & PMf_LOCALE)
*opnd |= ANYOF_NALNUML;
else {
for (Class = 0; Class < 256; Class++)
continue;
case 's':
if (!SIZE_ONLY) {
- if (regflags & PMf_LOCALE)
+ if (PL_regflags & PMf_LOCALE)
*opnd |= ANYOF_SPACEL;
else {
for (Class = 0; Class < 256; Class++)
continue;
case 'S':
if (!SIZE_ONLY) {
- if (regflags & PMf_LOCALE)
+ if (PL_regflags & PMf_LOCALE)
*opnd |= ANYOF_NSPACEL;
else {
for (Class = 0; Class < 256; Class++)
Class = '\007';
break;
case 'x':
- Class = scan_hex(regcomp_parse, 2, &numlen);
- regcomp_parse += numlen;
+ Class = scan_hex(PL_regcomp_parse, 2, &numlen);
+ PL_regcomp_parse += numlen;
break;
case 'c':
- Class = UCHARAT(regcomp_parse++);
+ Class = UCHARAT(PL_regcomp_parse++);
Class = toCTRL(Class);
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
- Class = scan_oct(--regcomp_parse, 3, &numlen);
- regcomp_parse += numlen;
+ Class = scan_oct(--PL_regcomp_parse, 3, &numlen);
+ PL_regcomp_parse += numlen;
break;
}
}
}
else {
lastclass = Class;
- if (*regcomp_parse == '-' && regcomp_parse+1 < regxend &&
- regcomp_parse[1] != ']') {
- regcomp_parse++;
+ if (*PL_regcomp_parse == '-' && PL_regcomp_parse+1 < PL_regxend &&
+ PL_regcomp_parse[1] != ']') {
+ PL_regcomp_parse++;
range = 1;
continue; /* do it next time */
}
}
lastclass = Class;
}
- if (*regcomp_parse != ']')
+ if (*PL_regcomp_parse != ']')
FAIL("unmatched [] in regexp");
nextchar();
/* optimize case-insensitive simple patterns (e.g. /[a-z]/i) */
nextchar(void)
{
dTHR;
- char* retval = regcomp_parse++;
+ char* retval = PL_regcomp_parse++;
for (;;) {
- if (*regcomp_parse == '(' && regcomp_parse[1] == '?' &&
- regcomp_parse[2] == '#') {
- while (*regcomp_parse && *regcomp_parse != ')')
- regcomp_parse++;
- regcomp_parse++;
+ if (*PL_regcomp_parse == '(' && PL_regcomp_parse[1] == '?' &&
+ PL_regcomp_parse[2] == '#') {
+ while (*PL_regcomp_parse && *PL_regcomp_parse != ')')
+ PL_regcomp_parse++;
+ PL_regcomp_parse++;
continue;
}
- if (regflags & PMf_EXTENDED) {
- if (isSPACE(*regcomp_parse)) {
- regcomp_parse++;
+ if (PL_regflags & PMf_EXTENDED) {
+ if (isSPACE(*PL_regcomp_parse)) {
+ PL_regcomp_parse++;
continue;
}
- else if (*regcomp_parse == '#') {
- while (*regcomp_parse && *regcomp_parse != '\n')
- regcomp_parse++;
- regcomp_parse++;
+ else if (*PL_regcomp_parse == '#') {
+ while (*PL_regcomp_parse && *PL_regcomp_parse != '\n')
+ PL_regcomp_parse++;
+ PL_regcomp_parse++;
continue;
}
}
register regnode *ret;
register regnode *ptr;
- ret = regcode;
+ ret = PL_regcode;
if (SIZE_ONLY) {
SIZE_ALIGN(regsize);
- regsize += 1;
+ PL_regsize += 1;
return(ret);
}
NODE_ALIGN_FILL(ret);
ptr = ret;
FILL_ADVANCE_NODE(ptr, op);
- regcode = ptr;
+ PL_regcode = ptr;
return(ret);
}
register regnode *ret;
register regnode *ptr;
- ret = regcode;
+ ret = PL_regcode;
if (SIZE_ONLY) {
SIZE_ALIGN(regsize);
- regsize += 2;
+ PL_regsize += 2;
return(ret);
}
NODE_ALIGN_FILL(ret);
ptr = ret;
FILL_ADVANCE_NODE_ARG(ptr, op, arg);
- regcode = ptr;
+ PL_regcode = ptr;
return(ret);
}
/* (regkind[(U8)op] == CURLY ? EXTRA_STEP_2ARGS : 0); */
if (SIZE_ONLY) {
- regsize += NODE_STEP_REGNODE + offset;
+ PL_regsize += NODE_STEP_REGNODE + offset;
return;
}
- src = regcode;
- regcode += NODE_STEP_REGNODE + offset;
- dst = regcode;
+ src = PL_regcode;
+ PL_regcode += NODE_STEP_REGNODE + offset;
+ dst = PL_regcode;
while (src > opnd)
StructCopy(--src, --dst, regnode);
/* Header fields of interest. */
if (r->anchored_substr)
PerlIO_printf(Perl_debug_log, "anchored `%s%s%s'%s at %d ",
- colors[0],
+ PL_colors[0],
SvPVX(r->anchored_substr),
- colors[1],
+ PL_colors[1],
SvTAIL(r->anchored_substr) ? "$" : "",
r->anchored_offset);
if (r->float_substr)
PerlIO_printf(Perl_debug_log, "floating `%s%s%s'%s at %d..%u ",
- colors[0],
+ PL_colors[0],
SvPVX(r->float_substr),
- colors[1],
+ PL_colors[1],
SvTAIL(r->float_substr) ? "$" : "",
r->float_min_offset, r->float_max_offset);
if (r->check_substr)
p = "BRANCH";
break;
case EXACT:
- sv_catpvf(sv, "EXACT <%s%s%s>", colors[0], OPERAND(o) + 1, colors[1]);
+ sv_catpvf(sv, "EXACT <%s%s%s>", PL_colors[0], OPERAND(o) + 1, PL_colors[1]);
break;
case EXACTF:
- sv_catpvf(sv, "EXACTF <%s%s%s>", colors[0], OPERAND(o) + 1, colors[1]);
+ sv_catpvf(sv, "EXACTF <%s%s%s>", PL_colors[0], OPERAND(o) + 1, PL_colors[1]);
break;
case EXACTFL:
- sv_catpvf(sv, "EXACTFL <%s%s%s>", colors[0], OPERAND(o) + 1, colors[1]);
+ sv_catpvf(sv, "EXACTFL <%s%s%s>", PL_colors[0], OPERAND(o) + 1, PL_colors[1]);
break;
case NOTHING:
p = "NOTHING";
dTHR;
register I32 offset;
- if (p == ®dummy)
+ if (p == &PL_regdummy)
return(NULL);
offset = (reg_off_by_arg[OP(p)] ? ARG(p) : NEXT_OFF(p));
#define MAGIC 0234
-#define SIZE_ONLY (regcode == ®dummy)
+#define SIZE_ONLY (PL_regcode == &PL_regdummy)
/* Flags for first parameter byte of ANYOF */
#define ANYOF_INVERT 0x40
#define UCHARAT(p) regdummy
#endif /* lint */
-#define FAIL(m) croak ("/%.127s/: %s", regprecomp,m)
-#define FAIL2(pat,m) re_croak2("/%.127s/: ",pat,regprecomp,m)
+#define FAIL(m) croak ("/%.127s/: %s", PL_regprecomp,m)
+#define FAIL2(pat,m) re_croak2("/%.127s/: ",pat,PL_regprecomp,m)
#define EXTRA_SIZE(guy) ((sizeof(guy)-1)/sizeof(struct regnode))
regcppush(I32 parenfloor)
{
dTHR;
- int retval = savestack_ix;
- int i = (regsize - parenfloor) * 4;
+ int retval = PL_savestack_ix;
+ int i = (PL_regsize - parenfloor) * 4;
int p;
SSCHECK(i + 5);
- for (p = regsize; p > parenfloor; p--) {
- SSPUSHPTR(regendp[p]);
- SSPUSHPTR(regstartp[p]);
- SSPUSHPTR(reg_start_tmp[p]);
+ for (p = PL_regsize; p > parenfloor; p--) {
+ SSPUSHPTR(PL_regendp[p]);
+ SSPUSHPTR(PL_regstartp[p]);
+ SSPUSHPTR(PL_reg_start_tmp[p]);
SSPUSHINT(p);
}
- SSPUSHINT(regsize);
- SSPUSHINT(*reglastparen);
- SSPUSHPTR(reginput);
+ SSPUSHINT(PL_regsize);
+ SSPUSHINT(*PL_reglastparen);
+ SSPUSHPTR(PL_reginput);
SSPUSHINT(i + 3);
SSPUSHINT(SAVEt_REGCONTEXT);
return retval;
/* These are needed since we do not localize EVAL nodes: */
# define REGCP_SET DEBUG_r(PerlIO_printf(Perl_debug_log, \
" Setting an EVAL scope, savestack=%i\n", \
- savestack_ix)); lastcp = savestack_ix
+ PL_savestack_ix)); lastcp = PL_savestack_ix
-# define REGCP_UNWIND DEBUG_r(lastcp != savestack_ix ? \
+# define REGCP_UNWIND DEBUG_r(lastcp != PL_savestack_ix ? \
PerlIO_printf(Perl_debug_log, \
" Clearing an EVAL scope, savestack=%i..%i\n", \
- lastcp, savestack_ix) : 0); regcpblow(lastcp)
+ lastcp, PL_savestack_ix) : 0); regcpblow(lastcp)
STATIC char *
regcppop(void)
assert(i == SAVEt_REGCONTEXT);
i = SSPOPINT;
input = (char *) SSPOPPTR;
- *reglastparen = SSPOPINT;
- regsize = SSPOPINT;
+ *PL_reglastparen = SSPOPINT;
+ PL_regsize = SSPOPINT;
for (i -= 3; i > 0; i -= 4) {
paren = (U32)SSPOPINT;
- reg_start_tmp[paren] = (char *) SSPOPPTR;
- regstartp[paren] = (char *) SSPOPPTR;
+ PL_reg_start_tmp[paren] = (char *) SSPOPPTR;
+ PL_regstartp[paren] = (char *) SSPOPPTR;
tmps = (char*)SSPOPPTR;
- if (paren <= *reglastparen)
- regendp[paren] = tmps;
+ if (paren <= *PL_reglastparen)
+ PL_regendp[paren] = tmps;
DEBUG_r(
PerlIO_printf(Perl_debug_log,
" restoring \\%d to %d(%d)..%d%s\n",
- paren, regstartp[paren] - regbol,
- reg_start_tmp[paren] - regbol,
- regendp[paren] - regbol,
- (paren > *reglastparen ? "(no)" : ""));
+ paren, PL_regstartp[paren] - PL_regbol,
+ PL_reg_start_tmp[paren] - PL_regbol,
+ PL_regendp[paren] - PL_regbol,
+ (paren > *PL_reglastparen ? "(no)" : ""));
);
}
DEBUG_r(
- if (*reglastparen + 1 <= regnpar) {
+ if (*PL_reglastparen + 1 <= PL_regnpar) {
PerlIO_printf(Perl_debug_log,
" restoring \\%d..\\%d to undef\n",
- *reglastparen + 1, regnpar);
+ *PL_reglastparen + 1, PL_regnpar);
}
);
- for (paren = *reglastparen + 1; paren <= regnpar; paren++) {
- if (paren > regsize)
- regstartp[paren] = Nullch;
- regendp[paren] = Nullch;
+ for (paren = *PL_reglastparen + 1; paren <= PL_regnpar; paren++) {
+ if (paren > PL_regsize)
+ PL_regstartp[paren] = Nullch;
+ PL_regendp[paren] = Nullch;
}
return input;
}
I32 end_shift = 0; /* Same for the end. */
I32 scream_pos = -1; /* Internal iterator of scream. */
char *scream_olds;
- SV* oreplsv = GvSV(replgv);
+ SV* oreplsv = GvSV(PL_replgv);
cc.cur = 0;
cc.oldcc = 0;
- regcc = &cc;
+ PL_regcc = &cc;
- regprecomp = prog->precomp; /* Needed for error messages. */
+ PL_regprecomp = prog->precomp; /* Needed for error messages. */
#ifdef DEBUGGING
- regnarrate = debug & 512;
- regprogram = prog->program;
+ PL_regnarrate = PL_debug & 512;
+ PL_regprogram = prog->program;
#endif
/* Be paranoid... */
if (strend - startpos < minlen) goto phooey;
if (startpos == strbeg) /* is ^ valid at stringarg? */
- regprev = '\n';
+ PL_regprev = '\n';
else {
- regprev = stringarg[-1];
- if (!multiline && regprev == '\n')
- regprev = '\0'; /* force ^ to NOT match */
+ PL_regprev = stringarg[-1];
+ if (!PL_multiline && PL_regprev == '\n')
+ PL_regprev = '\0'; /* force ^ to NOT match */
}
/* Check validity of program. */
FAIL("corrupted regexp program");
}
- regnpar = prog->nparens;
- reg_flags = 0;
- reg_eval_set = 0;
+ PL_regnpar = prog->nparens;
+ PL_reg_flags = 0;
+ PL_reg_eval_set = 0;
/* If there is a "must appear" string, look for it. */
s = startpos;
&& prog->check_substr != Nullsv &&
!(prog->reganch & ROPT_ANCH_GPOS) &&
(!(prog->reganch & (ROPT_ANCH_BOL | ROPT_ANCH_MBOL))
- || (multiline && prog->check_substr == prog->anchored_substr)) )
+ || (PL_multiline && prog->check_substr == prog->anchored_substr)) )
{
start_shift = prog->check_offset_min;
/* Should be nonnegative! */
end_shift = minlen - start_shift - SvCUR(prog->check_substr);
if (screamer) {
- if (screamfirst[BmRARE(prog->check_substr)] >= 0)
+ if (PL_screamfirst[BmRARE(prog->check_substr)] >= 0)
s = screaminstr(screamer, prog->check_substr,
start_shift + (stringarg - strbeg),
end_shift, &scream_pos, 0);
}
/* Mark beginning of line for ^ and lookbehind. */
- regbol = startpos;
- bostr = strbeg;
+ PL_regbol = startpos;
+ PL_bostr = strbeg;
/* Mark end of line for $ (and such) */
- regeol = strend;
+ PL_regeol = strend;
/* see how far we have to get to not match where we matched before */
- regtill = startpos+minend;
+ PL_regtill = startpos+minend;
DEBUG_r(
PerlIO_printf(Perl_debug_log,
if (regtry(prog, startpos))
goto got_it;
else if (!(prog->reganch & ROPT_ANCH_GPOS) &&
- (multiline || (prog->reganch & ROPT_IMPLICIT)
+ (PL_multiline || (prog->reganch & ROPT_IMPLICIT)
|| (prog->reganch & ROPT_ANCH_MBOL)))
{
if (minlen)
}
break;
case BOUNDL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case BOUND:
if (minlen)
dontbother++,strend--;
- tmp = (s != startpos) ? UCHARAT(s - 1) : regprev;
+ tmp = (s != startpos) ? UCHARAT(s - 1) : PL_regprev;
tmp = ((OP(c) == BOUND ? isALNUM(tmp) : isALNUM_LC(tmp)) != 0);
while (s < strend) {
if (tmp == !(OP(c) == BOUND ? isALNUM(*s) : isALNUM_LC(*s))) {
goto got_it;
break;
case NBOUNDL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case NBOUND:
if (minlen)
dontbother++,strend--;
- tmp = (s != startpos) ? UCHARAT(s - 1) : regprev;
+ tmp = (s != startpos) ? UCHARAT(s - 1) : PL_regprev;
tmp = ((OP(c) == NBOUND ? isALNUM(tmp) : isALNUM_LC(tmp)) != 0);
while (s < strend) {
if (tmp == !(OP(c) == NBOUND ? isALNUM(*s) : isALNUM_LC(*s)))
}
break;
case ALNUML:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (s < strend) {
if (isALNUM_LC(*s)) {
if (tmp && regtry(prog, s))
}
break;
case NALNUML:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (s < strend) {
if (!isALNUM_LC(*s)) {
if (tmp && regtry(prog, s))
}
break;
case SPACEL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (s < strend) {
if (isSPACE_LC(*s)) {
if (tmp && regtry(prog, s))
}
break;
case NSPACEL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (s < strend) {
if (!isSPACE_LC(*s)) {
if (tmp && regtry(prog, s))
strend += dontbother; /* uncheat */
prog->subbeg = strbeg;
prog->subend = strend;
- RX_MATCH_TAINTED_set(prog, reg_flags & RF_tainted);
+ RX_MATCH_TAINTED_set(prog, PL_reg_flags & RF_tainted);
/* make sure $`, $&, $', and $digit will work later */
if (strbeg != prog->subbase) { /* second+ //g match. */
}
}
/* Preserve the current value of $^R */
- if (oreplsv != GvSV(replgv)) {
- sv_setsv(oreplsv, GvSV(replgv));/* So that when GvSV(replgv) is
+ if (oreplsv != GvSV(PL_replgv)) {
+ sv_setsv(oreplsv, GvSV(PL_replgv));/* So that when GvSV(replgv) is
restored, the value remains
the same. */
}
register char **ep;
CHECKPOINT lastcp;
- if ((prog->reganch & ROPT_EVAL_SEEN) && !reg_eval_set) {
- reg_eval_set = RS_init;
+ if ((prog->reganch & ROPT_EVAL_SEEN) && !PL_reg_eval_set) {
+ PL_reg_eval_set = RS_init;
DEBUG_r(DEBUG_s(
PerlIO_printf(Perl_debug_log, " setting stack tmpbase at %i\n",
- stack_sp - stack_base);
+ PL_stack_sp - PL_stack_base);
));
SAVEINT(cxstack[cxstack_ix].blk_oldsp);
- cxstack[cxstack_ix].blk_oldsp = stack_sp - stack_base;
+ cxstack[cxstack_ix].blk_oldsp = PL_stack_sp - PL_stack_base;
/* Otherwise OP_NEXTSTATE will free whatever on stack now. */
SAVETMPS;
/* Apparently this is not needed, judging by wantarray. */
/* SAVEINT(cxstack[cxstack_ix].blk_gimme);
cxstack[cxstack_ix].blk_gimme = G_SCALAR; */
}
- reginput = startpos;
- regstartp = prog->startp;
- regendp = prog->endp;
- reglastparen = &prog->lastparen;
+ PL_reginput = startpos;
+ PL_regstartp = prog->startp;
+ PL_regendp = prog->endp;
+ PL_reglastparen = &prog->lastparen;
prog->lastparen = 0;
- regsize = 0;
- if (reg_start_tmpl <= prog->nparens) {
- reg_start_tmpl = prog->nparens*3/2 + 3;
- if(reg_start_tmp)
- Renew(reg_start_tmp, reg_start_tmpl, char*);
+ PL_regsize = 0;
+ if (PL_reg_start_tmpl <= prog->nparens) {
+ PL_reg_start_tmpl = prog->nparens*3/2 + 3;
+ if(PL_reg_start_tmp)
+ Renew(PL_reg_start_tmp, PL_reg_start_tmpl, char*);
else
- New(22,reg_start_tmp, reg_start_tmpl, char*);
+ New(22,PL_reg_start_tmp, PL_reg_start_tmpl, char*);
}
sp = prog->startp;
ep = prog->endp;
- regdata = prog->data;
+ PL_regdata = prog->data;
if (prog->nparens) {
for (i = prog->nparens; i >= 0; i--) {
*sp++ = NULL;
REGCP_SET;
if (regmatch(prog->program + 1)) {
prog->startp[0] = startpos;
- prog->endp[0] = reginput;
+ prog->endp[0] = PL_reginput;
return 1;
}
REGCP_UNWIND;
register I32 n; /* no or next */
register I32 ln; /* len or last */
register char *s; /* operand or save */
- register char *locinput = reginput;
+ register char *locinput = PL_reginput;
register I32 c1, c2, paren; /* case fold search, parenth */
int minmod = 0, sw = 0, logical = 0;
#ifdef DEBUGGING
- regindent++;
+ PL_regindent++;
#endif
nextchr = UCHARAT(locinput);
#endif
DEBUG_r( {
SV *prop = sv_newmortal();
- int docolor = *colors[0];
+ int docolor = *PL_colors[0];
int taill = (docolor ? 10 : 7); /* 3 chars for "> <" */
- int l = (regeol - locinput > taill ? taill : regeol - locinput);
- int pref_len = (locinput - bostr > (5 + taill) - l
- ? (5 + taill) - l : locinput - bostr);
+ int l = (PL_regeol - locinput > taill ? taill : PL_regeol - locinput);
+ int pref_len = (locinput - PL_bostr > (5 + taill) - l
+ ? (5 + taill) - l : locinput - PL_bostr);
- if (l + pref_len < (5 + taill) && l < regeol - locinput)
- l = ( regeol - locinput > (5 + taill) - pref_len
- ? (5 + taill) - pref_len : regeol - locinput);
+ if (l + pref_len < (5 + taill) && l < PL_regeol - locinput)
+ l = ( PL_regeol - locinput > (5 + taill) - pref_len
+ ? (5 + taill) - pref_len : PL_regeol - locinput);
regprop(prop, scan);
PerlIO_printf(Perl_debug_log,
"%4i <%s%.*s%s%s%s%.*s%s>%*s|%3d:%*s%s\n",
- locinput - bostr,
- colors[2], pref_len, locinput - pref_len, colors[3],
+ locinput - PL_bostr,
+ PL_colors[2], pref_len, locinput - pref_len, PL_colors[3],
(docolor ? "" : "> <"),
- colors[0], l, locinput, colors[1],
+ PL_colors[0], l, locinput, PL_colors[1],
15 - l - pref_len + 1,
"",
- scan - regprogram, regindent*2, "",
+ scan - PL_regprogram, PL_regindent*2, "",
SvPVX(prop));
} );
switch (OP(scan)) {
case BOL:
- if (locinput == bostr
- ? regprev == '\n'
- : (multiline &&
- (nextchr || locinput < regeol) && locinput[-1] == '\n') )
+ if (locinput == PL_bostr
+ ? PL_regprev == '\n'
+ : (PL_multiline &&
+ (nextchr || locinput < PL_regeol) && locinput[-1] == '\n') )
{
/* regtill = regbol; */
break;
}
sayNO;
case MBOL:
- if (locinput == bostr
- ? regprev == '\n'
- : ((nextchr || locinput < regeol) && locinput[-1] == '\n') )
+ if (locinput == PL_bostr
+ ? PL_regprev == '\n'
+ : ((nextchr || locinput < PL_regeol) && locinput[-1] == '\n') )
{
break;
}
sayNO;
case SBOL:
- if (locinput == regbol && regprev == '\n')
+ if (locinput == PL_regbol && PL_regprev == '\n')
break;
sayNO;
case GPOS:
- if (locinput == regbol)
+ if (locinput == PL_regbol)
break;
sayNO;
case EOL:
- if (multiline)
+ if (PL_multiline)
goto meol;
else
goto seol;
case MEOL:
meol:
- if ((nextchr || locinput < regeol) && nextchr != '\n')
+ if ((nextchr || locinput < PL_regeol) && nextchr != '\n')
sayNO;
break;
case SEOL:
seol:
- if ((nextchr || locinput < regeol) && nextchr != '\n')
+ if ((nextchr || locinput < PL_regeol) && nextchr != '\n')
sayNO;
- if (regeol - locinput > 1)
+ if (PL_regeol - locinput > 1)
sayNO;
break;
case EOS:
- if (regeol != locinput)
+ if (PL_regeol != locinput)
sayNO;
break;
case SANY:
- if (!nextchr && locinput >= regeol)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
nextchr = UCHARAT(++locinput);
break;
case ANY:
- if (!nextchr && locinput >= regeol || nextchr == '\n')
+ if (!nextchr && locinput >= PL_regeol || nextchr == '\n')
sayNO;
nextchr = UCHARAT(++locinput);
break;
/* Inline the first character, for speed. */
if (UCHARAT(s) != nextchr)
sayNO;
- if (regeol - locinput < ln)
+ if (PL_regeol - locinput < ln)
sayNO;
if (ln > 1 && memNE(s, locinput, ln))
sayNO;
nextchr = UCHARAT(locinput);
break;
case EXACTFL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case EXACTF:
s = (char *) OPERAND(scan);
UCHARAT(s) != ((OP(scan) == EXACTF)
? fold : fold_locale)[nextchr])
sayNO;
- if (regeol - locinput < ln)
+ if (PL_regeol - locinput < ln)
sayNO;
if (ln > 1 && (OP(scan) == EXACTF
? ibcmp(s, locinput, ln)
nextchr = UCHARAT(locinput);
if (!REGINCLASS(s, nextchr))
sayNO;
- if (!nextchr && locinput >= regeol)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
nextchr = UCHARAT(++locinput);
break;
case ALNUML:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case ALNUM:
if (!nextchr)
nextchr = UCHARAT(++locinput);
break;
case NALNUML:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case NALNUM:
- if (!nextchr && locinput >= regeol)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
if (OP(scan) == NALNUM
? isALNUM(nextchr) : isALNUM_LC(nextchr))
break;
case BOUNDL:
case NBOUNDL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case BOUND:
case NBOUND:
/* was last char in word? */
- ln = (locinput != regbol) ? UCHARAT(locinput - 1) : regprev;
+ ln = (locinput != PL_regbol) ? UCHARAT(locinput - 1) : PL_regprev;
if (OP(scan) == BOUND || OP(scan) == NBOUND) {
ln = isALNUM(ln);
n = isALNUM(nextchr);
sayNO;
break;
case SPACEL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case SPACE:
- if (!nextchr && locinput >= regeol)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
if (!(OP(scan) == SPACE
? isSPACE(nextchr) : isSPACE_LC(nextchr)))
nextchr = UCHARAT(++locinput);
break;
case NSPACEL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case NSPACE:
if (!nextchr)
nextchr = UCHARAT(++locinput);
break;
case NDIGIT:
- if (!nextchr && locinput >= regeol)
+ if (!nextchr && locinput >= PL_regeol)
sayNO;
if (isDIGIT(nextchr))
sayNO;
nextchr = UCHARAT(++locinput);
break;
case REFFL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
/* FALL THROUGH */
case REF:
case REFF:
n = ARG(scan); /* which paren pair */
- s = regstartp[n];
- if (*reglastparen < n || !s)
+ s = PL_regstartp[n];
+ if (*PL_reglastparen < n || !s)
sayNO; /* Do not match unless seen CLOSEn. */
- if (s == regendp[n])
+ if (s == PL_regendp[n])
break;
/* Inline the first character, for speed. */
if (UCHARAT(s) != nextchr &&
(UCHARAT(s) != ((OP(scan) == REFF
? fold : fold_locale)[nextchr]))))
sayNO;
- ln = regendp[n] - s;
- if (locinput + ln > regeol)
+ ln = PL_regendp[n] - s;
+ if (locinput + ln > PL_regeol)
sayNO;
if (ln > 1 && (OP(scan) == REF
? memNE(s, locinput, ln)
{
dSP;
OP_4tree *oop = op;
- COP *ocurcop = curcop;
- SV **ocurpad = curpad;
+ COP *ocurcop = PL_curcop;
+ SV **ocurpad = PL_curpad;
SV *ret;
n = ARG(scan);
- op = (OP_4tree*)regdata->data[n];
+ op = (OP_4tree*)PL_regdata->data[n];
DEBUG_r( PerlIO_printf(Perl_debug_log, " re_eval 0x%x\n", op) );
- curpad = AvARRAY((AV*)regdata->data[n + 1]);
+ PL_curpad = AvARRAY((AV*)PL_regdata->data[n + 1]);
CALLRUNOPS(); /* Scalar context. */
SPAGAIN;
logical = 0;
sw = SvTRUE(ret);
} else
- sv_setsv(save_scalar(replgv), ret);
+ sv_setsv(save_scalar(PL_replgv), ret);
op = oop;
- curpad = ocurpad;
- curcop = ocurcop;
+ PL_curpad = ocurpad;
+ PL_curcop = ocurcop;
break;
}
case OPEN:
n = ARG(scan); /* which paren pair */
- reg_start_tmp[n] = locinput;
- if (n > regsize)
- regsize = n;
+ PL_reg_start_tmp[n] = locinput;
+ if (n > PL_regsize)
+ PL_regsize = n;
break;
case CLOSE:
n = ARG(scan); /* which paren pair */
- regstartp[n] = reg_start_tmp[n];
- regendp[n] = locinput;
- if (n > *reglastparen)
- *reglastparen = n;
+ PL_regstartp[n] = PL_reg_start_tmp[n];
+ PL_regendp[n] = locinput;
+ if (n > *PL_reglastparen)
+ *PL_reglastparen = n;
break;
case GROUPP:
n = ARG(scan); /* which paren pair */
- sw = (*reglastparen >= n && regendp[n] != NULL);
+ sw = (*PL_reglastparen >= n && PL_regendp[n] != NULL);
break;
case IFTHEN:
if (sw)
break;
case CURLYX: {
CURCUR cc;
- CHECKPOINT cp = savestack_ix;
+ CHECKPOINT cp = PL_savestack_ix;
if (OP(PREVOPER(next)) == NOTHING) /* LONGJMP */
next += ARG(next);
- cc.oldcc = regcc;
- regcc = &cc;
- cc.parenfloor = *reglastparen;
+ cc.oldcc = PL_regcc;
+ PL_regcc = &cc;
+ cc.parenfloor = *PL_reglastparen;
cc.cur = -1;
cc.min = ARG1(scan);
cc.max = ARG2(scan);
cc.next = next;
cc.minmod = minmod;
cc.lastloc = 0;
- reginput = locinput;
+ PL_reginput = locinput;
n = regmatch(PREVOPER(next)); /* start on the WHILEM */
regcpblow(cp);
- regcc = cc.oldcc;
+ PL_regcc = cc.oldcc;
saySAME(n);
}
/* NOT REACHED */
*/
CHECKPOINT cp, lastcp;
- CURCUR* cc = regcc;
+ CURCUR* cc = PL_regcc;
char *lastloc = cc->lastloc; /* Detection of 0-len. */
n = cc->cur + 1; /* how many we know we matched */
- reginput = locinput;
+ PL_reginput = locinput;
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s %ld out of %ld..%ld cc=%lx\n",
- REPORT_CODE_OFF+regindent*2, "",
+ REPORT_CODE_OFF+PL_regindent*2, "",
(long)n, (long)cc->min,
(long)cc->max, (long)cc)
);
/* If degenerate scan matches "", assume scan done. */
if (locinput == cc->lastloc && n >= cc->min) {
- regcc = cc->oldcc;
- ln = regcc->cur;
+ PL_regcc = cc->oldcc;
+ ln = PL_regcc->cur;
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s empty match detected, try continuation...\n",
- REPORT_CODE_OFF+regindent*2, "")
+ REPORT_CODE_OFF+PL_regindent*2, "")
);
if (regmatch(cc->next))
sayYES;
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s failed...\n",
- REPORT_CODE_OFF+regindent*2, "")
+ REPORT_CODE_OFF+PL_regindent*2, "")
);
- regcc->cur = ln;
- regcc = cc;
+ PL_regcc->cur = ln;
+ PL_regcc = cc;
sayNO;
}
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s failed...\n",
- REPORT_CODE_OFF+regindent*2, "")
+ REPORT_CODE_OFF+PL_regindent*2, "")
);
sayNO;
}
/* Prefer next over scan for minimal matching. */
if (cc->minmod) {
- regcc = cc->oldcc;
- ln = regcc->cur;
+ PL_regcc = cc->oldcc;
+ ln = PL_regcc->cur;
cp = regcppush(cc->parenfloor);
REGCP_SET;
if (regmatch(cc->next)) {
}
REGCP_UNWIND;
regcppop();
- regcc->cur = ln;
- regcc = cc;
+ PL_regcc->cur = ln;
+ PL_regcc = cc;
if (n >= cc->max) { /* Maximum greed exceeded? */
- if (dowarn && n >= REG_INFTY
- && !(reg_flags & RF_warned)) {
- reg_flags |= RF_warned;
+ if (PL_dowarn && n >= REG_INFTY
+ && !(PL_reg_flags & RF_warned)) {
+ PL_reg_flags |= RF_warned;
warn("Complex regular subexpression recursion "
"limit (%d) exceeded", REG_INFTY - 1);
}
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s trying longer...\n",
- REPORT_CODE_OFF+regindent*2, "")
+ REPORT_CODE_OFF+PL_regindent*2, "")
);
/* Try scanning more and see if it helps. */
- reginput = locinput;
+ PL_reginput = locinput;
cc->cur = n;
cc->lastloc = locinput;
cp = regcppush(cc->parenfloor);
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s failed...\n",
- REPORT_CODE_OFF+regindent*2, "")
+ REPORT_CODE_OFF+PL_regindent*2, "")
);
REGCP_UNWIND;
regcppop();
}
REGCP_UNWIND;
regcppop(); /* Restore some previous $<digit>s? */
- reginput = locinput;
+ PL_reginput = locinput;
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s failed, try continuation...\n",
- REPORT_CODE_OFF+regindent*2, "")
+ REPORT_CODE_OFF+PL_regindent*2, "")
);
}
- if (dowarn && n >= REG_INFTY && !(reg_flags & RF_warned)) {
- reg_flags |= RF_warned;
+ if (PL_dowarn && n >= REG_INFTY && !(PL_reg_flags & RF_warned)) {
+ PL_reg_flags |= RF_warned;
warn("count exceeded %d", REG_INFTY - 1);
}
/* Failed deeper matches of scan, so see if this one works. */
- regcc = cc->oldcc;
- ln = regcc->cur;
+ PL_regcc = cc->oldcc;
+ ln = PL_regcc->cur;
if (regmatch(cc->next))
sayYES;
DEBUG_r(
PerlIO_printf(Perl_debug_log, "%*s failed...\n",
- REPORT_CODE_OFF+regindent*2, "")
+ REPORT_CODE_OFF+PL_regindent*2, "")
);
- regcc->cur = ln;
- regcc = cc;
+ PL_regcc->cur = ln;
+ PL_regcc = cc;
cc->cur = n - 1;
cc->lastloc = lastloc;
sayNO;
if (OP(next) != c1) /* No choice. */
next = inner; /* Avoid recursion. */
else {
- int lastparen = *reglastparen;
+ int lastparen = *PL_reglastparen;
REGCP_SET;
do {
- reginput = locinput;
+ PL_reginput = locinput;
if (regmatch(inner))
sayYES;
REGCP_UNWIND;
- for (n = *reglastparen; n > lastparen; n--)
- regendp[n] = 0;
- *reglastparen = n;
+ for (n = *PL_reglastparen; n > lastparen; n--)
+ PL_regendp[n] = 0;
+ *PL_reglastparen = n;
scan = next;
/*SUPPRESS 560*/
if (n = (c1 == BRANCH ? NEXT_OFF(next) : ARG(next)))
n = ARG2(scan); /* max to match */
paren = scan->flags;
if (paren) {
- if (paren > regsize)
- regsize = paren;
- if (paren > *reglastparen)
- *reglastparen = paren;
+ if (paren > PL_regsize)
+ PL_regsize = paren;
+ if (paren > *PL_reglastparen)
+ *PL_reglastparen = paren;
}
scan = NEXTOPER(scan) + NODE_STEP_REGNODE;
if (paren)
scan += NEXT_OFF(scan); /* Skip former OPEN. */
- reginput = locinput;
+ PL_reginput = locinput;
if (minmod) {
minmod = 0;
if (ln && regrepeat_hard(scan, ln, &l) < ln)
future execution. */
&& !(paren && ln == 0))
ln = n;
- locinput = reginput;
+ locinput = PL_reginput;
if (regkind[(U8)OP(next)] == EXACT) {
c1 = UCHARAT(OPERAND(next) + 1);
if (OP(next) == EXACTF)
while (n >= ln || (n == REG_INFTY && ln > 0 && l)) { /* ln overflow ? */
/* If it could work, try it. */
if (c1 == -1000 ||
- UCHARAT(reginput) == c1 ||
- UCHARAT(reginput) == c2)
+ UCHARAT(PL_reginput) == c1 ||
+ UCHARAT(PL_reginput) == c2)
{
if (paren) {
if (n) {
- regstartp[paren] = reginput - l;
- regendp[paren] = reginput;
+ PL_regstartp[paren] = PL_reginput - l;
+ PL_regendp[paren] = PL_reginput;
} else
- regendp[paren] = NULL;
+ PL_regendp[paren] = NULL;
}
if (regmatch(next))
sayYES;
REGCP_UNWIND;
}
/* Couldn't or didn't -- move forward. */
- reginput = locinput;
+ PL_reginput = locinput;
if (regrepeat_hard(scan, 1, &l)) {
ln++;
- locinput = reginput;
+ locinput = PL_reginput;
}
else
sayNO;
future execution. */
&& !(paren && ln == 0))
ln = n;
- locinput = reginput;
+ locinput = PL_reginput;
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s matched %ld times, len=%ld...\n",
- REPORT_CODE_OFF+regindent*2, "", n, l)
+ REPORT_CODE_OFF+PL_regindent*2, "", n, l)
);
if (n >= ln) {
if (regkind[(U8)OP(next)] == EXACT) {
while (n >= ln) {
/* If it could work, try it. */
if (c1 == -1000 ||
- UCHARAT(reginput) == c1 ||
- UCHARAT(reginput) == c2)
+ UCHARAT(PL_reginput) == c1 ||
+ UCHARAT(PL_reginput) == c2)
{
DEBUG_r(
PerlIO_printf(Perl_debug_log,
"%*s trying tail with n=%ld...\n",
- REPORT_CODE_OFF+regindent*2, "", n)
+ REPORT_CODE_OFF+PL_regindent*2, "", n)
);
if (paren) {
if (n) {
- regstartp[paren] = reginput - l;
- regendp[paren] = reginput;
+ PL_regstartp[paren] = PL_reginput - l;
+ PL_regendp[paren] = PL_reginput;
} else
- regendp[paren] = NULL;
+ PL_regendp[paren] = NULL;
}
if (regmatch(next))
sayYES;
/* Couldn't or didn't -- back up. */
n--;
locinput -= l;
- reginput = locinput;
+ PL_reginput = locinput;
}
}
sayNO;
}
case CURLYN:
paren = scan->flags; /* Which paren to set */
- if (paren > regsize)
- regsize = paren;
- if (paren > *reglastparen)
- *reglastparen = paren;
+ if (paren > PL_regsize)
+ PL_regsize = paren;
+ if (paren > *PL_reglastparen)
+ *PL_reglastparen = paren;
ln = ARG1(scan); /* min to match */
n = ARG2(scan); /* max to match */
scan = regnext(NEXTOPER(scan) + NODE_STEP_REGNODE);
}
else
c1 = c2 = -1000;
- reginput = locinput;
+ PL_reginput = locinput;
if (minmod) {
CHECKPOINT lastcp;
minmod = 0;
while (n >= ln || (n == REG_INFTY && ln > 0)) { /* ln overflow ? */
/* If it could work, try it. */
if (c1 == -1000 ||
- UCHARAT(reginput) == c1 ||
- UCHARAT(reginput) == c2)
+ UCHARAT(PL_reginput) == c1 ||
+ UCHARAT(PL_reginput) == c2)
{
if (paren) {
if (n) {
- regstartp[paren] = reginput - 1;
- regendp[paren] = reginput;
+ PL_regstartp[paren] = PL_reginput - 1;
+ PL_regendp[paren] = PL_reginput;
} else
- regendp[paren] = NULL;
+ PL_regendp[paren] = NULL;
}
if (regmatch(next))
sayYES;
REGCP_UNWIND;
}
/* Couldn't or didn't -- move forward. */
- reginput = locinput + ln;
+ PL_reginput = locinput + ln;
if (regrepeat(scan, 1)) {
ln++;
- reginput = locinput + ln;
+ PL_reginput = locinput + ln;
} else
sayNO;
}
CHECKPOINT lastcp;
n = regrepeat(scan, n);
if (ln < n && regkind[(U8)OP(next)] == EOL &&
- (!multiline || OP(next) == SEOL))
+ (!PL_multiline || OP(next) == SEOL))
ln = n; /* why back off? */
REGCP_SET;
if (paren) {
while (n >= ln) {
/* If it could work, try it. */
if (c1 == -1000 ||
- UCHARAT(reginput) == c1 ||
- UCHARAT(reginput) == c2)
+ UCHARAT(PL_reginput) == c1 ||
+ UCHARAT(PL_reginput) == c2)
{
if (paren && n) {
if (n) {
- regstartp[paren] = reginput - 1;
- regendp[paren] = reginput;
+ PL_regstartp[paren] = PL_reginput - 1;
+ PL_regendp[paren] = PL_reginput;
} else
- regendp[paren] = NULL;
+ PL_regendp[paren] = NULL;
}
if (regmatch(next))
sayYES;
}
/* Couldn't or didn't -- back up. */
n--;
- reginput = locinput + n;
+ PL_reginput = locinput + n;
}
} else {
while (n >= ln) {
/* If it could work, try it. */
if (c1 == -1000 ||
- UCHARAT(reginput) == c1 ||
- UCHARAT(reginput) == c2)
+ UCHARAT(PL_reginput) == c1 ||
+ UCHARAT(PL_reginput) == c2)
{
if (regmatch(next))
sayYES;
}
/* Couldn't or didn't -- back up. */
n--;
- reginput = locinput + n;
+ PL_reginput = locinput + n;
}
}
}
sayNO;
break;
case END:
- if (locinput < regtill)
+ if (locinput < PL_regtill)
sayNO; /* Cannot match: too short. */
/* Fall through */
case SUCCEED:
- reginput = locinput; /* put where regtry can find it */
+ PL_reginput = locinput; /* put where regtry can find it */
sayYES; /* Success! */
case SUSPEND:
n = 1;
goto do_ifmatch;
case UNLESSM:
n = 0;
- if (locinput < bostr + scan->flags)
+ if (locinput < PL_bostr + scan->flags)
goto say_yes;
goto do_ifmatch;
case IFMATCH:
n = 1;
- if (locinput < bostr + scan->flags)
+ if (locinput < PL_bostr + scan->flags)
goto say_no;
do_ifmatch:
- reginput = locinput - scan->flags;
+ PL_reginput = locinput - scan->flags;
inner = NEXTOPER(NEXTOPER(scan));
if (regmatch(inner) != n) {
say_no:
sw = 1;
}
if (OP(scan) == SUSPEND) {
- locinput = reginput;
+ locinput = PL_reginput;
nextchr = UCHARAT(locinput);
}
/* FALL THROUGH. */
yes:
#ifdef DEBUGGING
- regindent--;
+ PL_regindent--;
#endif
return 1;
no:
#ifdef DEBUGGING
- regindent--;
+ PL_regindent--;
#endif
return 0;
}
register char *scan;
register char *opnd;
register I32 c;
- register char *loceol = regeol;
+ register char *loceol = PL_regeol;
- scan = reginput;
+ scan = PL_reginput;
if (max != REG_INFTY && max < loceol - scan)
loceol = scan + max;
opnd = (char *) OPERAND(p);
scan++;
break;
case EXACTFL: /* length of string is 1 */
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
c = UCHARAT(++opnd);
while (scan < loceol &&
(UCHARAT(scan) == c || UCHARAT(scan) == fold_locale[c]))
scan++;
break;
case ALNUML:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (scan < loceol && isALNUM_LC(*scan))
scan++;
break;
scan++;
break;
case NALNUML:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (scan < loceol && !isALNUM_LC(*scan))
scan++;
break;
scan++;
break;
case SPACEL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (scan < loceol && isSPACE_LC(*scan))
scan++;
break;
scan++;
break;
case NSPACEL:
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
while (scan < loceol && !isSPACE_LC(*scan))
scan++;
break;
break; /* So match right here or not at all. */
}
- c = scan - reginput;
- reginput = scan;
+ c = scan - PL_reginput;
+ PL_reginput = scan;
DEBUG_r(
{
dTHR;
register char *scan;
register char *start;
- register char *loceol = regeol;
+ register char *loceol = PL_regeol;
I32 l = -1;
- start = reginput;
- while (reginput < loceol && (scan = reginput, regmatch(p))) {
+ start = PL_reginput;
+ while (PL_reginput < loceol && (scan = PL_reginput, regmatch(p))) {
if (l == -1) {
- *lp = l = reginput - start;
+ *lp = l = PL_reginput - start;
if (max != REG_INFTY && l*max < loceol - scan)
loceol = scan + l*max;
if (l == 0) {
}
}
}
- if (reginput < loceol)
- reginput = scan;
+ if (PL_reginput < loceol)
+ PL_reginput = scan;
else
- scan = reginput;
+ scan = PL_reginput;
return (scan - start)/l;
}
else if (flags & ANYOF_FOLD) {
I32 cf;
if (flags & ANYOF_LOCALE) {
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
cf = fold_locale[c];
}
else
}
if (!match && (flags & ANYOF_ISA)) {
- reg_flags |= RF_tainted;
+ PL_reg_flags |= RF_tainted;
if (((flags & ANYOF_ALNUML) && isALNUM_LC(c)) ||
((flags & ANYOF_NALNUML) && !isALNUM_LC(c)) ||
}
do {
- if (debug) {
+ if (PL_debug) {
if (watchaddr != 0 && *watchaddr != watchok)
PerlIO_printf(Perl_debug_log, "WARNING: %lx changed from %lx to %lx\n",
(long)watchaddr, (long)watchok, (long)*watchaddr);
if (cGVOPo->op_gv) {
sv = NEWSV(0,0);
gv_fullname3(sv, cGVOPo->op_gv, Nullch);
- PerlIO_printf(Perl_debug_log, "(%s)", SvPV(sv, na));
+ PerlIO_printf(Perl_debug_log, "(%s)", SvPV(sv, PL_na));
SvREFCNT_dec(sv);
}
else
debprof(OP *o)
{
#ifdef DEBUGGING
- if (!profiledata)
- Newz(000, profiledata, MAXO, U32);
- ++profiledata[o->op_type];
+ if (!PL_profiledata)
+ Newz(000, PL_profiledata, MAXO, U32);
+ ++PL_profiledata[o->op_type];
#endif /* DEBUGGING */
}
{
#ifdef DEBUGGING
unsigned i;
- if (!profiledata)
+ if (!PL_profiledata)
return;
for (i = 0; i < MAXO; i++) {
- if (profiledata[i])
+ if (PL_profiledata[i])
PerlIO_printf(Perl_debug_log,
- "%5lu %s\n", (unsigned long)profiledata[i],
+ "%5lu %s\n", (unsigned long)PL_profiledata[i],
op_name[i]);
}
#endif /* DEBUGGING */
if (growing++)
abort();
#endif
- stack_sp = sp;
+ PL_stack_sp = sp;
#ifndef STRESS_REALLOC
- av_extend(curstack, (p - stack_base) + (n) + 128);
+ av_extend(PL_curstack, (p - PL_stack_base) + (n) + 128);
#else
av_extend(curstack, (p - stack_base) + (n) + 1);
#endif
#if defined(DEBUGGING) && !defined(USE_THREADS)
growing--;
#endif
- return stack_sp;
+ return PL_stack_sp;
}
#ifndef STRESS_REALLOC
si->si_stack = newAV();
AvREAL_off(si->si_stack);
av_extend(si->si_stack, stitems > 0 ? stitems-1 : 0);
- AvALLOC(si->si_stack)[0] = &sv_undef;
+ AvALLOC(si->si_stack)[0] = &PL_sv_undef;
AvFILLp(si->si_stack) = 0;
si->si_prev = 0;
si->si_next = 0;
push_return(OP *retop)
{
dTHR;
- if (retstack_ix == retstack_max) {
- retstack_max = GROW(retstack_max);
- Renew(retstack, retstack_max, OP*);
+ if (PL_retstack_ix == PL_retstack_max) {
+ PL_retstack_max = GROW(PL_retstack_max);
+ Renew(PL_retstack, PL_retstack_max, OP*);
}
- retstack[retstack_ix++] = retop;
+ PL_retstack[PL_retstack_ix++] = retop;
}
OP *
pop_return(void)
{
dTHR;
- if (retstack_ix > 0)
- return retstack[--retstack_ix];
+ if (PL_retstack_ix > 0)
+ return PL_retstack[--PL_retstack_ix];
else
return Nullop;
}
push_scope(void)
{
dTHR;
- if (scopestack_ix == scopestack_max) {
- scopestack_max = GROW(scopestack_max);
- Renew(scopestack, scopestack_max, I32);
+ if (PL_scopestack_ix == PL_scopestack_max) {
+ PL_scopestack_max = GROW(PL_scopestack_max);
+ Renew(PL_scopestack, PL_scopestack_max, I32);
}
- scopestack[scopestack_ix++] = savestack_ix;
+ PL_scopestack[PL_scopestack_ix++] = PL_savestack_ix;
}
pop_scope(void)
{
dTHR;
- I32 oldsave = scopestack[--scopestack_ix];
+ I32 oldsave = PL_scopestack[--PL_scopestack_ix];
LEAVE_SCOPE(oldsave);
}
markstack_grow(void)
{
dTHR;
- I32 oldmax = markstack_max - markstack;
+ I32 oldmax = PL_markstack_max - PL_markstack;
I32 newmax = GROW(oldmax);
- Renew(markstack, newmax, I32);
- markstack_ptr = markstack + oldmax;
- markstack_max = markstack + newmax;
+ Renew(PL_markstack, newmax, I32);
+ PL_markstack_ptr = PL_markstack + oldmax;
+ PL_markstack_max = PL_markstack + newmax;
}
void
savestack_grow(void)
{
dTHR;
- savestack_max = GROW(savestack_max) + 4;
- Renew(savestack, savestack_max, ANY);
+ PL_savestack_max = GROW(PL_savestack_max) + 4;
+ Renew(PL_savestack, PL_savestack_max, ANY);
}
#undef GROW
{
dTHR;
/* XXX should tmps_floor live in cxstack? */
- I32 myfloor = tmps_floor;
- while (tmps_ix > myfloor) { /* clean up after last statement */
- SV* sv = tmps_stack[tmps_ix];
- tmps_stack[tmps_ix--] = Nullsv;
+ I32 myfloor = PL_tmps_floor;
+ while (PL_tmps_ix > myfloor) { /* clean up after last statement */
+ SV* sv = PL_tmps_stack[PL_tmps_ix];
+ PL_tmps_stack[PL_tmps_ix--] = Nullsv;
if (sv) {
#ifdef DEBUGGING
SvTEMP_off(sv);
sv_upgrade(sv, SvTYPE(osv));
if (SvGMAGICAL(osv)) {
MAGIC* mg;
- bool oldtainted = tainted;
+ bool oldtainted = PL_tainted;
mg_get(osv);
- if (tainting && tainted && (mg = mg_find(osv, 't'))) {
+ if (PL_tainting && PL_tainted && (mg = mg_find(osv, 't'))) {
SAVESPTR(mg->mg_obj);
mg->mg_obj = osv;
}
SvFLAGS(osv) |= (SvFLAGS(osv) &
(SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
- tainted = oldtainted;
+ PL_tainted = oldtainted;
}
SvMAGIC(sv) = SvMAGIC(osv);
SvFLAGS(sv) |= SvMAGICAL(osv);
- localizing = 1;
+ PL_localizing = 1;
SvSETMAGIC(sv);
- localizing = 0;
+ PL_localizing = 0;
}
return sv;
}
register GP *gp;
if (GvCVu(gv))
- sub_generation++; /* taking a method out of circulation */
+ PL_sub_generation++; /* taking a method out of circulation */
Newz(602, gp, 1, GP);
GvGP(gv) = gp_ref(gp);
GvSV(gv) = NEWSV(72,0);
- GvLINE(gv) = curcop->cop_line;
+ GvLINE(gv) = PL_curcop->cop_line;
GvEGV(gv) = gv;
}
else {
SvFLAGS(av) |= SvMAGICAL(oav);
SvMAGICAL_off(oav);
SvMAGIC(oav) = 0;
- localizing = 1;
+ PL_localizing = 1;
SvSETMAGIC((SV*)av);
- localizing = 0;
+ PL_localizing = 0;
}
return av;
}
SvFLAGS(hv) |= SvMAGICAL(ohv);
SvMAGICAL_off(ohv);
SvMAGIC(ohv) = 0;
- localizing = 1;
+ PL_localizing = 1;
SvSETMAGIC((SV*)hv);
- localizing = 0;
+ PL_localizing = 0;
}
return hv;
}
{
dTHR;
SSCHECK(2);
- SSPUSHLONG((long)(svp-curpad));
+ SSPUSHLONG((long)(svp-PL_curpad));
SSPUSHINT(SAVEt_CLEARSV);
}
if (base < -1)
croak("panic: corrupt saved stack index");
- while (savestack_ix > base) {
+ while (PL_savestack_ix > base) {
switch (SSPOPINT) {
case SAVEt_ITEM: /* normal string */
value = (SV*)SSPOPPTR;
sv = (SV*)SSPOPPTR;
sv_replace(sv,value);
- localizing = 2;
+ PL_localizing = 2;
SvSETMAGIC(sv);
- localizing = 0;
+ PL_localizing = 0;
break;
case SAVEt_SV: /* scalar reference */
value = (SV*)SSPOPPTR;
}
SvREFCNT_dec(sv);
*(SV**)ptr = value;
- localizing = 2;
+ PL_localizing = 2;
SvSETMAGIC(value);
- localizing = 0;
+ PL_localizing = 0;
SvREFCNT_dec(value);
break;
case SAVEt_AV: /* array reference */
}
GvAV(gv) = av;
if (SvMAGICAL(av)) {
- localizing = 2;
+ PL_localizing = 2;
SvSETMAGIC((SV*)av);
- localizing = 0;
+ PL_localizing = 0;
}
break;
case SAVEt_HV: /* hash reference */
}
GvHV(gv) = hv;
if (SvMAGICAL(hv)) {
- localizing = 2;
+ PL_localizing = 2;
SvSETMAGIC((SV*)hv);
- localizing = 0;
+ PL_localizing = 0;
}
break;
case SAVEt_INT: /* int reference */
gp_free(gv);
GvGP(gv) = (GP*)ptr;
if (GvCVu(gv))
- sub_generation++; /* putting a method back into circulation */
+ PL_sub_generation++; /* putting a method back into circulation */
SvREFCNT_dec(gv);
break;
case SAVEt_FREESV:
break;
case SAVEt_FREEOP:
ptr = SSPOPPTR;
- if (comppad)
- curpad = AvARRAY(comppad);
+ if (PL_comppad)
+ PL_curpad = AvARRAY(PL_comppad);
op_free((OP*)ptr);
break;
case SAVEt_FREEPV:
Safefree((char*)ptr);
break;
case SAVEt_CLEARSV:
- ptr = (void*)&curpad[SSPOPLONG];
+ ptr = (void*)&PL_curpad[SSPOPLONG];
sv = *(SV**)ptr;
/* Can clear pad variable in place? */
if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) {
break;
case SAVEt_REGCONTEXT:
i = SSPOPINT;
- savestack_ix -= i; /* regexp must have croaked */
+ PL_savestack_ix -= i; /* regexp must have croaked */
break;
case SAVEt_STACK_POS: /* Position on Perl stack */
i = SSPOPINT;
- stack_sp = stack_base + i;
+ PL_stack_sp = PL_stack_base + i;
break;
case SAVEt_AELEM: /* array element */
value = (SV*)SSPOPPTR;
ptr = av_fetch(av,i,1);
if (ptr) {
sv = *(SV**)ptr;
- if (sv && sv != &sv_undef) {
+ if (sv && sv != &PL_sv_undef) {
if (SvRMAGICAL(av) && mg_find((SV*)av, 'P'))
(void)SvREFCNT_inc(sv);
SvREFCNT_dec(av);
ptr = hv_fetch_ent(hv, sv, 1, 0);
if (ptr) {
SV *oval = HeVAL((HE*)ptr);
- if (oval && oval != &sv_undef) {
+ if (oval && oval != &PL_sv_undef) {
ptr = &HeVAL((HE*)ptr);
if (SvRMAGICAL(hv) && mg_find((SV*)hv, 'P'))
(void)SvREFCNT_inc(*(SV**)ptr);
op = (OP*)SSPOPPTR;
break;
case SAVEt_HINTS:
- if (GvHV(hintgv)) {
- SvREFCNT_dec((SV*)GvHV(hintgv));
- GvHV(hintgv) = NULL;
+ if (GvHV(PL_hintgv)) {
+ SvREFCNT_dec((SV*)GvHV(PL_hintgv));
+ GvHV(PL_hintgv) = NULL;
}
- *(I32*)&hints = (I32)SSPOPINT;
+ *(I32*)&PL_hints = (I32)SSPOPINT;
break;
default:
croak("panic: leave_scope inconsistency");
#define SAVEt_OP 26
#define SAVEt_HINTS 27
-#define SSCHECK(need) if (savestack_ix + need > savestack_max) savestack_grow()
-#define SSPUSHINT(i) (savestack[savestack_ix++].any_i32 = (I32)(i))
-#define SSPUSHLONG(i) (savestack[savestack_ix++].any_long = (long)(i))
-#define SSPUSHIV(i) (savestack[savestack_ix++].any_iv = (IV)(i))
-#define SSPUSHPTR(p) (savestack[savestack_ix++].any_ptr = (void*)(p))
-#define SSPUSHDPTR(p) (savestack[savestack_ix++].any_dptr = (p))
-#define SSPOPINT (savestack[--savestack_ix].any_i32)
-#define SSPOPLONG (savestack[--savestack_ix].any_long)
-#define SSPOPIV (savestack[--savestack_ix].any_iv)
-#define SSPOPPTR (savestack[--savestack_ix].any_ptr)
-#define SSPOPDPTR (savestack[--savestack_ix].any_dptr)
+#define SSCHECK(need) if (PL_savestack_ix + need > PL_savestack_max) savestack_grow()
+#define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i))
+#define SSPUSHLONG(i) (PL_savestack[PL_savestack_ix++].any_long = (long)(i))
+#define SSPUSHIV(i) (PL_savestack[PL_savestack_ix++].any_iv = (IV)(i))
+#define SSPUSHPTR(p) (PL_savestack[PL_savestack_ix++].any_ptr = (void*)(p))
+#define SSPUSHDPTR(p) (PL_savestack[PL_savestack_ix++].any_dptr = (p))
+#define SSPOPINT (PL_savestack[--PL_savestack_ix].any_i32)
+#define SSPOPLONG (PL_savestack[--PL_savestack_ix].any_long)
+#define SSPOPIV (PL_savestack[--PL_savestack_ix].any_iv)
+#define SSPOPPTR (PL_savestack[--PL_savestack_ix].any_ptr)
+#define SSPOPDPTR (PL_savestack[--PL_savestack_ix].any_dptr)
-#define SAVETMPS save_int((int*)&tmps_floor), tmps_floor = tmps_ix
-#define FREETMPS if (tmps_ix > tmps_floor) free_tmps()
+#define SAVETMPS save_int((int*)&PL_tmps_floor), PL_tmps_floor = PL_tmps_ix
+#define FREETMPS if (PL_tmps_ix > PL_tmps_floor) free_tmps()
#ifdef DEBUGGING
#define ENTER \
STMT_START { \
push_scope(); \
DEBUG_l(WITH_THR(deb("ENTER scope %ld at %s:%d\n", \
- scopestack_ix, __FILE__, __LINE__))); \
+ PL_scopestack_ix, __FILE__, __LINE__))); \
} STMT_END
#define LEAVE \
STMT_START { \
DEBUG_l(WITH_THR(deb("LEAVE scope %ld at %s:%d\n", \
- scopestack_ix, __FILE__, __LINE__))); \
+ PL_scopestack_ix, __FILE__, __LINE__))); \
pop_scope(); \
} STMT_END
#else
#define ENTER push_scope()
#define LEAVE pop_scope()
#endif
-#define LEAVE_SCOPE(old) if (savestack_ix > old) leave_scope(old)
+#define LEAVE_SCOPE(old) if (PL_savestack_ix > old) leave_scope(old)
/*
* Not using SOFT_CAST on SAVEFREESV and SAVEFREESV
#define SAVESTACK_POS() \
STMT_START { \
SSCHECK(2); \
- SSPUSHINT(stack_sp - stack_base); \
+ SSPUSHINT(PL_stack_sp - PL_stack_base); \
SSPUSHINT(SAVEt_STACK_POS); \
} STMT_END
#define SAVEHINTS() \
STMT_START { \
- if (hints & HINT_LOCALIZE_HH) \
+ if (PL_hints & HINT_LOCALIZE_HH) \
save_hints(); \
else { \
SSCHECK(2); \
- SSPUSHINT(hints); \
+ SSPUSHINT(PL_hints); \
SSPUSHINT(SAVEt_HINTS); \
} \
} STMT_END
#define dJMPENV JMPENV cur_env
#define JMPENV_PUSH(v) \
STMT_START { \
- cur_env.je_prev = top_env; \
+ cur_env.je_prev = PL_top_env; \
OP_REG_TO_MEM; \
cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, 1); \
OP_MEM_TO_REG; \
- top_env = &cur_env; \
+ PL_top_env = &cur_env; \
cur_env.je_mustcatch = FALSE; \
(v) = cur_env.je_ret; \
} STMT_END
#define JMPENV_POP \
- STMT_START { top_env = cur_env.je_prev; } STMT_END
+ STMT_START { PL_top_env = cur_env.je_prev; } STMT_END
#define JMPENV_JUMP(v) \
STMT_START { \
OP_REG_TO_MEM; \
- if (top_env->je_prev) \
- PerlProc_longjmp(top_env->je_buf, (v)); \
+ if (PL_top_env->je_prev) \
+ PerlProc_longjmp(PL_top_env->je_buf, (v)); \
if ((v) == 2) \
PerlProc_exit(STATUS_NATIVE_EXPORT); \
PerlIO_printf(PerlIO_stderr(), "panic: top_env\n"); \
PerlProc_exit(1); \
} STMT_END
-#define CATCH_GET (top_env->je_mustcatch)
-#define CATCH_SET(v) (top_env->je_mustcatch = (v))
+#define CATCH_GET (PL_top_env->je_mustcatch)
+#define CATCH_SET(v) (PL_top_env->je_mustcatch = (v))
reg_add(sv)
SV* sv;
{
- if (sv_count >= (registry_size >> 1))
+ if (PL_sv_count >= (registry_size >> 1))
{
SV **oldreg = registry;
I32 oldsize = registry_size;
}
REG_ADD(sv);
- ++sv_count;
+ ++PL_sv_count;
}
static void
SV* sv;
{
REG_REMOVE(sv);
- --sv_count;
+ --PL_sv_count;
}
static void
#define plant_SV(p) \
do { \
- SvANY(p) = (void *)sv_root; \
+ SvANY(p) = (void *)PL_sv_root; \
SvFLAGS(p) = SVTYPEMASK; \
- sv_root = (p); \
- --sv_count; \
+ PL_sv_root = (p); \
+ --PL_sv_count; \
} while (0)
/* sv_mutex must be held while calling uproot_SV() */
#define uproot_SV(p) \
do { \
- (p) = sv_root; \
- sv_root = (SV*)SvANY(p); \
- ++sv_count; \
+ (p) = PL_sv_root; \
+ PL_sv_root = (SV*)SvANY(p); \
+ ++PL_sv_count; \
} while (0)
#define new_SV(p) do { \
LOCK_SV_MUTEX; \
- if (sv_root) \
+ if (PL_sv_root) \
uproot_SV(p); \
else \
(p) = more_sv(); \
#define del_SV(p) do { \
LOCK_SV_MUTEX; \
- if (debug & 32768) \
+ if (PL_debug & 32768) \
del_sv(p); \
else \
plant_SV(p); \
STATIC void
del_sv(SV *p)
{
- if (debug & 32768) {
+ if (PL_debug & 32768) {
SV* sva;
SV* sv;
SV* svend;
int ok = 0;
- for (sva = sv_arenaroot; sva; sva = (SV *) SvANY(sva)) {
+ for (sva = PL_sv_arenaroot; sva; sva = (SV *) SvANY(sva)) {
sv = sva + 1;
svend = &sva[SvREFCNT(sva)];
if (p >= sv && p < svend)
Zero(sva, size, char);
/* The first SV in an arena isn't an SV. */
- SvANY(sva) = (void *) sv_arenaroot; /* ptr to next arena */
+ SvANY(sva) = (void *) PL_sv_arenaroot; /* ptr to next arena */
SvREFCNT(sva) = size / sizeof(SV); /* number of SV slots */
SvFLAGS(sva) = flags; /* FAKE if not to be freed */
- sv_arenaroot = sva;
- sv_root = sva + 1;
+ PL_sv_arenaroot = sva;
+ PL_sv_root = sva + 1;
svend = &sva[SvREFCNT(sva) - 1];
sv = sva + 1;
{
register SV* sv;
- if (nice_chunk) {
- sv_add_arena(nice_chunk, nice_chunk_size, 0);
- nice_chunk = Nullch;
+ if (PL_nice_chunk) {
+ sv_add_arena(PL_nice_chunk, PL_nice_chunk_size, 0);
+ PL_nice_chunk = Nullch;
}
else {
char *chunk; /* must use New here to match call to */
SV* sv;
register SV* svend;
- for (sva = sv_arenaroot; sva; sva = (SV*)SvANY(sva)) {
+ for (sva = PL_sv_arenaroot; sva; sva = (SV*)SvANY(sva)) {
svend = &sva[SvREFCNT(sva)];
for (sv = sva + 1; sv < svend; ++sv) {
if (SvTYPE(sv) != SVTYPEMASK)
void
sv_clean_objs(void)
{
- in_clean_objs = TRUE;
+ PL_in_clean_objs = TRUE;
visit(FUNC_NAME_TO_PTR(do_clean_objs));
#ifndef DISABLE_DESTRUCTOR_KLUDGE
/* some barnacles may yet remain, clinging to typeglobs */
visit(FUNC_NAME_TO_PTR(do_clean_named_objs));
#endif
- in_clean_objs = FALSE;
+ PL_in_clean_objs = FALSE;
}
STATIC void
void
sv_clean_all(void)
{
- in_clean_all = TRUE;
+ PL_in_clean_all = TRUE;
visit(FUNC_NAME_TO_PTR(do_clean_all));
- in_clean_all = FALSE;
+ PL_in_clean_all = FALSE;
}
void
/* Free arenas here, but be careful about fake ones. (We assume
contiguity of the fake ones with the corresponding real ones.) */
- for (sva = sv_arenaroot; sva; sva = svanext) {
+ for (sva = PL_sv_arenaroot; sva; sva = svanext) {
svanext = (SV*) SvANY(sva);
while (svanext && SvFAKE(svanext))
svanext = (SV*) SvANY(svanext);
Safefree((void *)sva);
}
- if (nice_chunk)
- Safefree(nice_chunk);
- nice_chunk = Nullch;
- nice_chunk_size = 0;
- sv_arenaroot = 0;
- sv_root = 0;
+ if (PL_nice_chunk)
+ Safefree(PL_nice_chunk);
+ PL_nice_chunk = Nullch;
+ PL_nice_chunk_size = 0;
+ PL_sv_arenaroot = 0;
+ PL_sv_root = 0;
}
STATIC XPVIV*
new_xiv(void)
{
IV* xiv;
- if (xiv_root) {
- xiv = xiv_root;
+ if (PL_xiv_root) {
+ xiv = PL_xiv_root;
/*
* See comment in more_xiv() -- RAM.
*/
- xiv_root = *(IV**)xiv;
+ PL_xiv_root = *(IV**)xiv;
return (XPVIV*)((char*)xiv - STRUCT_OFFSET(XPVIV, xiv_iv));
}
return more_xiv();
del_xiv(XPVIV *p)
{
IV* xiv = (IV*)((char*)(p) + STRUCT_OFFSET(XPVIV, xiv_iv));
- *(IV**)xiv = xiv_root;
- xiv_root = xiv;
+ *(IV**)xiv = PL_xiv_root;
+ PL_xiv_root = xiv;
}
STATIC XPVIV*
register IV* xivend;
XPV* ptr;
New(705, ptr, 1008/sizeof(XPV), XPV);
- ptr->xpv_pv = (char*)xiv_arenaroot; /* linked list of xiv arenas */
- xiv_arenaroot = ptr; /* to keep Purify happy */
+ ptr->xpv_pv = (char*)PL_xiv_arenaroot; /* linked list of xiv arenas */
+ PL_xiv_arenaroot = ptr; /* to keep Purify happy */
xiv = (IV*) ptr;
xivend = &xiv[1008 / sizeof(IV) - 1];
xiv += (sizeof(XPV) - 1) / sizeof(IV) + 1; /* fudge by size of XPV */
- xiv_root = xiv;
+ PL_xiv_root = xiv;
while (xiv < xivend) {
*(IV**)xiv = (IV *)(xiv + 1);
xiv++;
new_xnv(void)
{
double* xnv;
- if (xnv_root) {
- xnv = xnv_root;
- xnv_root = *(double**)xnv;
+ if (PL_xnv_root) {
+ xnv = PL_xnv_root;
+ PL_xnv_root = *(double**)xnv;
return (XPVNV*)((char*)xnv - STRUCT_OFFSET(XPVNV, xnv_nv));
}
return more_xnv();
del_xnv(XPVNV *p)
{
double* xnv = (double*)((char*)(p) + STRUCT_OFFSET(XPVNV, xnv_nv));
- *(double**)xnv = xnv_root;
- xnv_root = xnv;
+ *(double**)xnv = PL_xnv_root;
+ PL_xnv_root = xnv;
}
STATIC XPVNV*
New(711, xnv, 1008/sizeof(double), double);
xnvend = &xnv[1008 / sizeof(double) - 1];
xnv += (sizeof(XPVIV) - 1) / sizeof(double) + 1; /* fudge by sizeof XPVIV */
- xnv_root = xnv;
+ PL_xnv_root = xnv;
while (xnv < xnvend) {
*(double**)xnv = (double*)(xnv + 1);
xnv++;
new_xrv(void)
{
XRV* xrv;
- if (xrv_root) {
- xrv = xrv_root;
- xrv_root = (XRV*)xrv->xrv_rv;
+ if (PL_xrv_root) {
+ xrv = PL_xrv_root;
+ PL_xrv_root = (XRV*)xrv->xrv_rv;
return xrv;
}
return more_xrv();
STATIC void
del_xrv(XRV *p)
{
- p->xrv_rv = (SV*)xrv_root;
- xrv_root = p;
+ p->xrv_rv = (SV*)PL_xrv_root;
+ PL_xrv_root = p;
}
STATIC XRV*
{
register XRV* xrv;
register XRV* xrvend;
- New(712, xrv_root, 1008/sizeof(XRV), XRV);
- xrv = xrv_root;
+ New(712, PL_xrv_root, 1008/sizeof(XRV), XRV);
+ xrv = PL_xrv_root;
xrvend = &xrv[1008 / sizeof(XRV) - 1];
while (xrv < xrvend) {
xrv->xrv_rv = (SV*)(xrv + 1);
new_xpv(void)
{
XPV* xpv;
- if (xpv_root) {
- xpv = xpv_root;
- xpv_root = (XPV*)xpv->xpv_pv;
+ if (PL_xpv_root) {
+ xpv = PL_xpv_root;
+ PL_xpv_root = (XPV*)xpv->xpv_pv;
return xpv;
}
return more_xpv();
STATIC void
del_xpv(XPV *p)
{
- p->xpv_pv = (char*)xpv_root;
- xpv_root = p;
+ p->xpv_pv = (char*)PL_xpv_root;
+ PL_xpv_root = p;
}
STATIC XPV*
{
register XPV* xpv;
register XPV* xpvend;
- New(713, xpv_root, 1008/sizeof(XPV), XPV);
- xpv = xpv_root;
+ New(713, PL_xpv_root, 1008/sizeof(XPV), XPV);
+ xpv = PL_xpv_root;
xpvend = &xpv[1008 / sizeof(XPV) - 1];
while (xpv < xpvend) {
xpv->xpv_pv = (char*)(xpv + 1);
sv_catpv(t, "WILD");
goto finish;
}
- else if (sv == &sv_undef || sv == &sv_no || sv == &sv_yes) {
- if (sv == &sv_undef) {
+ else if (sv == &PL_sv_undef || sv == &PL_sv_no || sv == &PL_sv_yes) {
+ if (sv == &PL_sv_undef) {
sv_catpv(t, "SV_UNDEF");
if (!(SvFLAGS(sv) & (SVf_OK|SVf_OOK|SVs_OBJECT|
SVs_GMG|SVs_SMG|SVs_RMG)) &&
SvREADONLY(sv))
goto finish;
}
- else if (sv == &sv_no) {
+ else if (sv == &PL_sv_no) {
sv_catpv(t, "SV_NO");
if (!(SvFLAGS(sv) & (SVf_ROK|SVf_OOK|SVs_OBJECT|
SVs_GMG|SVs_SMG|SVs_RMG)) &&
while (unref--)
sv_catpv(t, ")");
}
- return SvPV(t, na);
+ return SvPV(t, PL_na);
#else /* DEBUGGING */
return "";
#endif /* DEBUGGING */
if (SvPOKp(sv) && SvLEN(sv))
return asIV(sv);
if (!SvROK(sv)) {
- if (dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (PL_dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!localizing)
+ if (!PL_localizing)
warn(warn_uninit);
}
return 0;
}
if (SvPOKp(sv) && SvLEN(sv))
return asIV(sv);
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
return 0;
}
}
else {
dTHR;
- if (dowarn && !localizing && !(SvFLAGS(sv) & SVs_PADTMP))
+ if (PL_dowarn && !PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP))
warn(warn_uninit);
return 0;
}
if (SvPOKp(sv) && SvLEN(sv))
return asUV(sv);
if (!SvROK(sv)) {
- if (dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (PL_dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!localizing)
+ if (!PL_localizing)
warn(warn_uninit);
}
return 0;
}
if (SvPOKp(sv) && SvLEN(sv))
return asUV(sv);
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
return 0;
}
SvUVX(sv) = asUV(sv);
}
else {
- if (dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (PL_dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!localizing)
+ if (!PL_localizing)
warn(warn_uninit);
}
return 0;
if (SvNOKp(sv))
return SvNVX(sv);
if (SvPOKp(sv) && SvLEN(sv)) {
- if (dowarn && !SvIOKp(sv) && !looks_like_number(sv))
+ if (PL_dowarn && !SvIOKp(sv) && !looks_like_number(sv))
not_a_number(sv);
SET_NUMERIC_STANDARD();
return atof(SvPVX(sv));
if (SvIOKp(sv))
return (double)SvIVX(sv);
if (!SvROK(sv)) {
- if (dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (PL_dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!localizing)
+ if (!PL_localizing)
warn(warn_uninit);
}
return 0;
}
if (SvREADONLY(sv)) {
if (SvPOKp(sv) && SvLEN(sv)) {
- if (dowarn && !SvIOKp(sv) && !looks_like_number(sv))
+ if (PL_dowarn && !SvIOKp(sv) && !looks_like_number(sv))
not_a_number(sv);
SET_NUMERIC_STANDARD();
return atof(SvPVX(sv));
}
if (SvIOKp(sv))
return (double)SvIVX(sv);
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
return 0.0;
}
SvNVX(sv) = (double)SvIVX(sv);
}
else if (SvPOKp(sv) && SvLEN(sv)) {
- if (dowarn && !SvIOKp(sv) && !looks_like_number(sv))
+ if (PL_dowarn && !SvIOKp(sv) && !looks_like_number(sv))
not_a_number(sv);
SET_NUMERIC_STANDARD();
SvNVX(sv) = atof(SvPVX(sv));
}
else {
dTHR;
- if (dowarn && !localizing && !(SvFLAGS(sv) & SVs_PADTMP))
+ if (PL_dowarn && !PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP))
warn(warn_uninit);
return 0.0;
}
if (numtype == 1)
return atol(SvPVX(sv));
- if (!numtype && dowarn)
+ if (!numtype && PL_dowarn)
not_a_number(sv);
SET_NUMERIC_STANDARD();
d = atof(SvPVX(sv));
if (numtype == 1)
return strtoul(SvPVX(sv), Null(char**), 10);
#endif
- if (!numtype && dowarn)
+ if (!numtype && PL_dowarn)
not_a_number(sv);
SET_NUMERIC_STANDARD();
return U_V(atof(SvPVX(sv)));
goto tokensave;
}
if (!SvROK(sv)) {
- if (dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
+ if (PL_dowarn && !(SvFLAGS(sv) & SVs_PADTMP)) {
dTHR;
- if (!localizing)
+ if (!PL_localizing)
warn(warn_uninit);
}
*lp = 0;
mg->mg_ptr[mg->mg_len - 1] = ')';
mg->mg_ptr[mg->mg_len] = 0;
}
- reginterp_cnt += re->program[0].next_off;
+ PL_reginterp_cnt += re->program[0].next_off;
*lp = mg->mg_len;
return mg->mg_ptr;
}
tsv = Nullsv;
goto tokensave;
}
- if (dowarn)
+ if (PL_dowarn)
warn(warn_uninit);
*lp = 0;
return "";
}
else {
dTHR;
- if (dowarn && !localizing && !(SvFLAGS(sv) & SVs_PADTMP))
+ if (PL_dowarn && !PL_localizing && !(SvFLAGS(sv) & SVs_PADTMP))
warn(warn_uninit);
*lp = 0;
return "";
return;
SV_CHECK_THINKFIRST(dstr);
if (!sstr)
- sstr = &sv_undef;
+ sstr = &PL_sv_undef;
stype = SvTYPE(sstr);
dtype = SvTYPE(dstr);
SvTYPE(SvRV(sstr)) == SVt_PVGV) {
sstr = SvRV(sstr);
if (sstr == dstr) {
- if (curcop->cop_stash != GvSTASH(dstr))
+ if (PL_curcop->cop_stash != GvSTASH(dstr))
GvIMPORTED_on(dstr);
GvMULTI_on(dstr);
return;
SvFAKE_on(dstr); /* can coerce to non-glob */
}
/* ahem, death to those who redefine active sort subs */
- else if (curstackinfo->si_type == PERLSI_SORT
- && GvCV(dstr) && sortcop == CvSTART(GvCV(dstr)))
+ else if (PL_curstackinfo->si_type == PERLSI_SORT
+ && GvCV(dstr) && PL_sortcop == CvSTART(GvCV(dstr)))
croak("Can't redefine active sort subroutine %s",
GvNAME(dstr));
(void)SvOK_off(dstr);
gp_free((GV*)dstr);
GvGP(dstr) = gp_ref(GvGP(sstr));
SvTAINT(dstr);
- if (curcop->cop_stash != GvSTASH(dstr))
+ if (PL_curcop->cop_stash != GvSTASH(dstr))
GvIMPORTED_on(dstr);
GvMULTI_on(dstr);
return;
Newz(602,gp, 1, GP);
GvGP(dstr) = gp_ref(gp);
GvSV(dstr) = NEWSV(72,0);
- GvLINE(dstr) = curcop->cop_line;
+ GvLINE(dstr) = PL_curcop->cop_line;
GvEGV(dstr) = (GV*)dstr;
}
GvMULTI_on(dstr);
else
dref = (SV*)GvAV(dstr);
GvAV(dstr) = (AV*)sref;
- if (curcop->cop_stash != GvSTASH(dstr))
+ if (PL_curcop->cop_stash != GvSTASH(dstr))
GvIMPORTED_AV_on(dstr);
break;
case SVt_PVHV:
else
dref = (SV*)GvHV(dstr);
GvHV(dstr) = (HV*)sref;
- if (curcop->cop_stash != GvSTASH(dstr))
+ if (PL_curcop->cop_stash != GvSTASH(dstr))
GvIMPORTED_HV_on(dstr);
break;
case SVt_PVCV:
SvREFCNT_dec(GvCV(dstr));
GvCV(dstr) = Nullcv;
GvCVGEN(dstr) = 0; /* Switch off cacheness. */
- sub_generation++;
+ PL_sub_generation++;
}
SAVESPTR(GvCV(dstr));
}
Nullcv));
/* ahem, death to those who redefine
* active sort subs */
- if (curstackinfo->si_type == PERLSI_SORT &&
- sortcop == CvSTART(cv))
+ if (PL_curstackinfo->si_type == PERLSI_SORT &&
+ PL_sortcop == CvSTART(cv))
croak(
"Can't redefine active sort subroutine %s",
GvENAME((GV*)dstr));
- if (dowarn || (const_changed && const_sv)) {
+ if (PL_dowarn || (const_changed && const_sv)) {
if (!(CvGV(cv) && GvSTASH(CvGV(cv))
&& HvNAME(GvSTASH(CvGV(cv)))
&& strEQ(HvNAME(GvSTASH(CvGV(cv))),
GvCV(dstr) = (CV*)sref;
GvCVGEN(dstr) = 0; /* Switch off cacheness. */
GvASSUMECV_on(dstr);
- sub_generation++;
+ PL_sub_generation++;
}
- if (curcop->cop_stash != GvSTASH(dstr))
+ if (PL_curcop->cop_stash != GvSTASH(dstr))
GvIMPORTED_CV_on(dstr);
break;
case SVt_PVIO:
else
dref = (SV*)GvSV(dstr);
GvSV(dstr) = sref;
- if (curcop->cop_stash != GvSTASH(dstr))
+ if (PL_curcop->cop_stash != GvSTASH(dstr))
GvIMPORTED_SV_on(dstr);
break;
}
}
else {
if (dtype == SVt_PVGV) {
- if (dowarn)
+ if (PL_dowarn)
warn("Undefined value assigned to typeglob");
}
else
{
if (SvREADONLY(sv)) {
dTHR;
- if (curcop != &compiling)
+ if (PL_curcop != &PL_compiling)
croak(no_modify);
}
if (SvROK(sv))
if (SvREADONLY(sv)) {
dTHR;
- if (curcop != &compiling && !strchr("gBf", how))
+ if (PL_curcop != &PL_compiling && !strchr("gBf", how))
croak(no_modify);
}
if (SvMAGICAL(sv) || (how == 't' && SvTYPE(sv) >= SVt_PVMG)) {
if (SvOBJECT(sv)) {
dTHR;
- if (defstash) { /* Still have a symbol table? */
+ if (PL_defstash) { /* Still have a symbol table? */
djSP;
GV* destructor;
SV tmpref;
SvREFCNT_dec(SvSTASH(sv)); /* possibly of changed persuasion */
SvOBJECT_off(sv); /* Curse the object. */
if (SvTYPE(sv) != SVt_PVIO)
- --sv_objcount; /* XXX Might want something more general */
+ --PL_sv_objcount; /* XXX Might want something more general */
}
if (SvREFCNT(sv)) {
- if (in_clean_objs)
+ if (PL_in_clean_objs)
croak("DESTROY created new reference to dead object");
/* DESTROY gave object new lease on life */
return;
if (SvREFCNT(sv) == 0) {
if (SvFLAGS(sv) & SVf_BREAK)
return;
- if (in_clean_all) /* All is fair */
+ if (PL_in_clean_all) /* All is fair */
return;
if (SvREADONLY(sv) && SvIMMORTAL(sv)) {
/* make sure SvREFCNT(sv)==0 happens very seldom */
STRLEN len1, len2;
I32 retval;
- if (collation_standard)
+ if (PL_collation_standard)
goto raw_compare;
len1 = 0;
MAGIC *mg;
mg = SvMAGICAL(sv) ? mg_find(sv, 'o') : (MAGIC *) NULL;
- if (!mg || !mg->mg_ptr || *(U32*)mg->mg_ptr != collation_ix) {
+ if (!mg || !mg->mg_ptr || *(U32*)mg->mg_ptr != PL_collation_ix) {
char *s, *xf;
STRLEN len, xlen;
if (SvREADONLY(sv)) {
SAVEFREEPV(xf);
*nxp = xlen;
- return xf + sizeof(collation_ix);
+ return xf + sizeof(PL_collation_ix);
}
if (! mg) {
sv_magic(sv, 0, 'o', 0, 0);
}
if (mg && mg->mg_ptr) {
*nxp = mg->mg_len;
- return mg->mg_ptr + sizeof(collation_ix);
+ return mg->mg_ptr + sizeof(PL_collation_ix);
}
else {
*nxp = 0;
(void)SvUPGRADE(sv, SVt_PV);
SvSCREAM_off(sv);
- if (RsSNARF(rs)) {
+ if (RsSNARF(PL_rs)) {
rsptr = NULL;
rslen = 0;
}
- else if (RsRECORD(rs)) {
+ else if (RsRECORD(PL_rs)) {
I32 recsize, bytesread;
char *buffer;
/* Grab the size of the record we're getting */
- recsize = SvIV(SvRV(rs));
+ recsize = SvIV(SvRV(PL_rs));
(void)SvPOK_only(sv); /* Validate pointer */
/* Make sure we've got the room to yank in the whole thing */
if (SvLEN(sv) <= recsize + 3) {
SvCUR_set(sv, bytesread);
return(SvCUR(sv) ? SvPVX(sv) : Nullch);
}
- else if (RsPARA(rs)) {
+ else if (RsPARA(PL_rs)) {
rsptr = "\n\n";
rslen = 2;
}
else
- rsptr = SvPV(rs, rslen);
+ rsptr = SvPV(PL_rs, rslen);
rslast = rslen ? rsptr[rslen - 1] : '\0';
- if (RsPARA(rs)) { /* have to do this both before and after */
+ if (RsPARA(PL_rs)) { /* have to do this both before and after */
do { /* to make sure file boundaries work right */
if (PerlIO_eof(fp))
return 0;
}
}
- if (RsPARA(rs)) { /* have to do this both before and after */
+ if (RsPARA(PL_rs)) { /* have to do this both before and after */
while (i != EOF) { /* to make sure file boundaries work right */
i = PerlIO_getc(fp);
if (i != '\n') {
if (SvTHINKFIRST(sv)) {
if (SvREADONLY(sv)) {
dTHR;
- if (curcop != &compiling)
+ if (PL_curcop != &PL_compiling)
croak(no_modify);
}
if (SvROK(sv)) {
if (SvTHINKFIRST(sv)) {
if (SvREADONLY(sv)) {
dTHR;
- if (curcop != &compiling)
+ if (PL_curcop != &PL_compiling)
croak(no_modify);
}
if (SvROK(sv)) {
sv_mortalgrow(void)
{
dTHR;
- tmps_max += (tmps_max < 512) ? 128 : 512;
- Renew(tmps_stack, tmps_max, SV*);
+ PL_tmps_max += (PL_tmps_max < 512) ? 128 : 512;
+ Renew(PL_tmps_stack, PL_tmps_max, SV*);
}
SV *
SvREFCNT(sv) = 1;
SvFLAGS(sv) = 0;
sv_setsv(sv,oldstr);
- if (++tmps_ix >= tmps_max)
+ if (++PL_tmps_ix >= PL_tmps_max)
sv_mortalgrow();
- tmps_stack[tmps_ix] = sv;
+ PL_tmps_stack[PL_tmps_ix] = sv;
SvTEMP_on(sv);
return sv;
}
SvANY(sv) = 0;
SvREFCNT(sv) = 1;
SvFLAGS(sv) = SVs_TEMP;
- if (++tmps_ix >= tmps_max)
+ if (++PL_tmps_ix >= PL_tmps_max)
sv_mortalgrow();
- tmps_stack[tmps_ix] = sv;
+ PL_tmps_stack[PL_tmps_ix] = sv;
return sv;
}
return sv;
if (SvREADONLY(sv) && SvIMMORTAL(sv))
return sv;
- if (++tmps_ix >= tmps_max)
+ if (++PL_tmps_ix >= PL_tmps_max)
sv_mortalgrow();
- tmps_stack[tmps_ix] = sv;
+ PL_tmps_stack[PL_tmps_ix] = sv;
SvTEMP_on(sv);
return sv;
}
if (GvHV(gv) && !HvNAME(GvHV(gv))) {
hv_clear(GvHV(gv));
#ifndef VMS /* VMS has no environ array */
- if (gv == envgv)
+ if (gv == PL_envgv)
environ[0] = Nullch;
#endif
}
croak(no_usym, "filehandle");
if (SvROK(sv))
return sv_2io(SvRV(sv));
- gv = gv_fetchpv(SvPV(sv,na), FALSE, SVt_PVIO);
+ gv = gv_fetchpv(SvPV(sv,PL_na), FALSE, SVt_PVIO);
if (gv)
io = GvIO(gv);
else
io = 0;
if (!io)
- croak("Bad filehandle: %s", SvPV(sv,na));
+ croak("Bad filehandle: %s", SvPV(sv,PL_na));
break;
}
return io;
if (isGV(sv))
gv = (GV*)sv;
else
- gv = gv_fetchpv(SvPV(sv, na), lref, SVt_PVCV);
+ gv = gv_fetchpv(SvPV(sv, PL_na), lref, SVt_PVCV);
*gvp = gv;
if (!gv)
return Nullcv;
Nullop);
LEAVE;
if (!GvCVu(gv))
- croak("Unable to create sub named \"%s\"", SvPV(sv,na));
+ croak("Unable to create sub named \"%s\"", SvPV(sv,PL_na));
}
return GvCVu(gv);
}
if (SvREADONLY(sv)) {
dTHR;
- if (curcop != &compiling)
+ if (PL_curcop != &PL_compiling)
croak(no_modify);
}
sv_setref_pv(SV *rv, char *classname, void *pv)
{
if (!pv) {
- sv_setsv(rv, &sv_undef);
+ sv_setsv(rv, &PL_sv_undef);
SvSETMAGIC(rv);
}
else
croak(no_modify);
if (SvOBJECT(tmpRef)) {
if (SvTYPE(tmpRef) != SVt_PVIO)
- --sv_objcount;
+ --PL_sv_objcount;
SvREFCNT_dec(SvSTASH(tmpRef));
}
}
SvOBJECT_on(tmpRef);
if (SvTYPE(tmpRef) != SVt_PVIO)
- ++sv_objcount;
+ ++PL_sv_objcount;
(void)SvUPGRADE(tmpRef, SVt_PVMG);
SvSTASH(tmpRef) = (HV*)SvREFCNT_inc(stash);
default:
unknown:
- if (!args && dowarn &&
+ if (!args && PL_dowarn &&
(op->op_type == OP_PRTF || op->op_type == OP_SPRINTF)) {
SV *msg = sv_newmortal();
sv_setpvf(msg, "Invalid conversion in %s: ",
break;
case SVt_PVCV:
if (SvPOK(sv))
- PerlIO_printf(Perl_debug_log, " PROTOTYPE = \"%s\"\n", SvPV(sv,na));
+ PerlIO_printf(Perl_debug_log, " PROTOTYPE = \"%s\"\n", SvPV(sv,PL_na));
/* FALL THROUGH */
case SVt_PVFM:
PerlIO_printf(Perl_debug_log, " STASH = 0x%lx\n", (long)CvSTASH(sv));
(HV_AMAGICmb(stash) && \
((!HV_AMAGICbad(stash) && HV_AMAGIC(stash)) || Gv_AMupdate(stash)))
*/
-#define Gv_AMG(stash) (amagic_generation && Gv_AMupdate(stash))
+#define Gv_AMG(stash) (PL_amagic_generation && Gv_AMupdate(stash))
#endif /* OVERLOAD */
#define SvTHINKFIRST(sv) (SvFLAGS(sv) & SVf_THINKFIRST)
#define IoFLAGS(sv) ((XPVIO*) SvANY(sv))->xio_flags
#define SvTAINTED(sv) (SvMAGICAL(sv) && sv_tainted(sv))
-#define SvTAINTED_on(sv) STMT_START{ if(tainting){sv_taint(sv);} }STMT_END
-#define SvTAINTED_off(sv) STMT_START{ if(tainting){sv_untaint(sv);} }STMT_END
+#define SvTAINTED_on(sv) STMT_START{ if(PL_tainting){sv_taint(sv);} }STMT_END
+#define SvTAINTED_off(sv) STMT_START{ if(PL_tainting){sv_untaint(sv);} }STMT_END
#define SvTAINT(sv) \
STMT_START { \
- if (tainting) { \
+ if (PL_tainting) { \
dTHR; \
- if (tainted) \
+ if (PL_tainted) \
SvTAINTED_on(sv); \
} \
} STMT_END
#define SvPEEK(sv) sv_peek(sv)
-#define SvIMMORTAL(sv) ((sv)==&sv_undef || (sv)==&sv_yes || (sv)==&sv_no)
+#define SvIMMORTAL(sv) ((sv)==&PL_sv_undef || (sv)==&PL_sv_yes || (sv)==&PL_sv_no)
-#define boolSV(b) ((b) ? &sv_yes : &sv_no)
+#define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
#define isGV(sv) (SvTYPE(sv) == SVt_PVGV)
char *ug;
DEBUG_u(PerlIO_printf(Perl_debug_log,
- "%s %d %d %d\n", s, tainted, uid, euid));
+ "%s %d %d %d\n", s, PL_tainted, PL_uid, PL_euid));
- if (tainted) {
- if (euid != uid)
+ if (PL_tainted) {
+ if (PL_euid != PL_uid)
ug = " while running setuid";
- else if (egid != gid)
+ else if (PL_egid != PL_gid)
ug = " while running setgid";
else
ug = " while running with -T switch";
- if (!unsafe)
+ if (!PL_unsafe)
croak(f, s, ug);
- else if (dowarn)
+ else if (PL_dowarn)
warn(f, s, ug);
}
}
}
#endif /* VMS */
- svp = hv_fetch(GvHVn(envgv),"PATH",4,FALSE);
+ svp = hv_fetch(GvHVn(PL_envgv),"PATH",4,FALSE);
if (svp && *svp) {
if (SvTAINTED(*svp)) {
dTHR;
#ifndef VMS
/* tainted $TERM is okay if it contains no metachars */
- svp = hv_fetch(GvHVn(envgv),"TERM",4,FALSE);
+ svp = hv_fetch(GvHVn(PL_envgv),"TERM",4,FALSE);
if (svp && *svp && SvTAINTED(*svp)) {
dTHR; /* just for taint */
- bool was_tainted = tainted;
- char *t = SvPV(*svp, na);
- char *e = t + na;
- tainted = was_tainted;
+ bool was_tainted = PL_tainted;
+ char *t = SvPV(*svp, PL_na);
+ char *e = t + PL_na;
+ PL_tainted = was_tainted;
if (t < e && isALNUM(*t))
t++;
while (t < e && (isALNUM(*t) || *t == '-' || *t == ':'))
#endif /* !VMS */
for (e = misc_env; *e; e++) {
- svp = hv_fetch(GvHVn(envgv), *e, strlen(*e), FALSE);
- if (svp && *svp != &sv_undef && SvTAINTED(*svp)) {
+ svp = hv_fetch(GvHVn(PL_envgv), *e, strlen(*e), FALSE);
+ if (svp && *svp != &PL_sv_undef && SvTAINTED(*svp)) {
dTHR; /* just for taint */
TAINT;
taint_proper("Insecure $ENV{%s}%s", *e);
PERLVAR(Tcurstash, HV *) /* symbol table for current package */
PERLVAR(Trestartop, OP *) /* propagating an error from croak? */
-PERLVARI(Tcurcop, COP * VOL, &compiling)
+PERLVARI(Tcurcop, COP * VOL, &PL_compiling)
PERLVAR(Tin_eval, VOL int) /* trap "fatal" errors? */
PERLVAR(Tdelaymagic, int) /* ($<,$>) = ... */
PERLVAR(Tdirty, bool) /* in the middle of tearing things down? */
#ifdef CLINE
#undef CLINE
#endif
-#define CLINE (copline = (curcop->cop_line < copline ? curcop->cop_line : copline))
-
-#define TOKEN(retval) return (bufptr = s,(int)retval)
-#define OPERATOR(retval) return (expect = XTERM,bufptr = s,(int)retval)
-#define AOPERATOR(retval) return ao((expect = XTERM,bufptr = s,(int)retval))
-#define PREBLOCK(retval) return (expect = XBLOCK,bufptr = s,(int)retval)
-#define PRETERMBLOCK(retval) return (expect = XTERMBLOCK,bufptr = s,(int)retval)
-#define PREREF(retval) return (expect = XREF,bufptr = s,(int)retval)
-#define TERM(retval) return (CLINE, expect = XOPERATOR,bufptr = s,(int)retval)
-#define LOOPX(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)LOOPEX)
-#define FTST(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)UNIOP)
-#define FUN0(f) return(yylval.ival = f,expect = XOPERATOR,bufptr = s,(int)FUNC0)
-#define FUN1(f) return(yylval.ival = f,expect = XOPERATOR,bufptr = s,(int)FUNC1)
-#define BOop(f) return ao((yylval.ival=f,expect = XTERM,bufptr = s,(int)BITOROP))
-#define BAop(f) return ao((yylval.ival=f,expect = XTERM,bufptr = s,(int)BITANDOP))
-#define SHop(f) return ao((yylval.ival=f,expect = XTERM,bufptr = s,(int)SHIFTOP))
-#define PWop(f) return ao((yylval.ival=f,expect = XTERM,bufptr = s,(int)POWOP))
-#define PMop(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)MATCHOP)
-#define Aop(f) return ao((yylval.ival=f,expect = XTERM,bufptr = s,(int)ADDOP))
-#define Mop(f) return ao((yylval.ival=f,expect = XTERM,bufptr = s,(int)MULOP))
-#define Eop(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)EQOP)
-#define Rop(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)RELOP)
+#define CLINE (PL_copline = (PL_curcop->cop_line < PL_copline ? PL_curcop->cop_line : PL_copline))
+
+#define TOKEN(retval) return (PL_bufptr = s,(int)retval)
+#define OPERATOR(retval) return (PL_expect = XTERM,PL_bufptr = s,(int)retval)
+#define AOPERATOR(retval) return ao((PL_expect = XTERM,PL_bufptr = s,(int)retval))
+#define PREBLOCK(retval) return (PL_expect = XBLOCK,PL_bufptr = s,(int)retval)
+#define PRETERMBLOCK(retval) return (PL_expect = XTERMBLOCK,PL_bufptr = s,(int)retval)
+#define PREREF(retval) return (PL_expect = XREF,PL_bufptr = s,(int)retval)
+#define TERM(retval) return (CLINE, PL_expect = XOPERATOR,PL_bufptr = s,(int)retval)
+#define LOOPX(f) return(yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)LOOPEX)
+#define FTST(f) return(yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)UNIOP)
+#define FUN0(f) return(yylval.ival = f,PL_expect = XOPERATOR,PL_bufptr = s,(int)FUNC0)
+#define FUN1(f) return(yylval.ival = f,PL_expect = XOPERATOR,PL_bufptr = s,(int)FUNC1)
+#define BOop(f) return ao((yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)BITOROP))
+#define BAop(f) return ao((yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)BITANDOP))
+#define SHop(f) return ao((yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)SHIFTOP))
+#define PWop(f) return ao((yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)POWOP))
+#define PMop(f) return(yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)MATCHOP)
+#define Aop(f) return ao((yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)ADDOP))
+#define Mop(f) return ao((yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)MULOP))
+#define Eop(f) return(yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)EQOP)
+#define Rop(f) return(yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)RELOP)
/* This bit of chicanery makes a unary function followed by
* a parenthesis into a function with one argument, highest precedence.
*/
#define UNI(f) return(yylval.ival = f, \
- expect = XTERM, \
- bufptr = s, \
- last_uni = oldbufptr, \
- last_lop_op = f, \
+ PL_expect = XTERM, \
+ PL_bufptr = s, \
+ PL_last_uni = PL_oldbufptr, \
+ PL_last_lop_op = f, \
(*s == '(' || (s = skipspace(s), *s == '(') ? (int)FUNC1 : (int)UNIOP) )
#define UNIBRACK(f) return(yylval.ival = f, \
- bufptr = s, \
- last_uni = oldbufptr, \
+ PL_bufptr = s, \
+ PL_last_uni = PL_oldbufptr, \
(*s == '(' || (s = skipspace(s), *s == '(') ? (int)FUNC1 : (int)UNIOP) )
/* grandfather return to old style */
-#define OLDLOP(f) return(yylval.ival=f,expect = XTERM,bufptr = s,(int)LSTOP)
+#define OLDLOP(f) return(yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)LSTOP)
STATIC int
ao(int toketype)
{
- if (*bufptr == '=') {
- bufptr++;
+ if (*PL_bufptr == '=') {
+ PL_bufptr++;
if (toketype == ANDAND)
yylval.ival = OP_ANDASSIGN;
else if (toketype == OROR)
STATIC void
no_op(char *what, char *s)
{
- char *oldbp = bufptr;
- bool is_first = (oldbufptr == linestart);
+ char *oldbp = PL_bufptr;
+ bool is_first = (PL_oldbufptr == PL_linestart);
- bufptr = s;
+ PL_bufptr = s;
yywarn(form("%s found where operator expected", what));
if (is_first)
warn("\t(Missing semicolon on previous line?)\n");
- else if (oldoldbufptr && isIDFIRST(*oldoldbufptr)) {
+ else if (PL_oldoldbufptr && isIDFIRST(*PL_oldoldbufptr)) {
char *t;
- for (t = oldoldbufptr; *t && (isALNUM(*t) || *t == ':'); t++) ;
- if (t < bufptr && isSPACE(*t))
+ for (t = PL_oldoldbufptr; *t && (isALNUM(*t) || *t == ':'); t++) ;
+ if (t < PL_bufptr && isSPACE(*t))
warn("\t(Do you need to predeclare %.*s?)\n",
- t - oldoldbufptr, oldoldbufptr);
+ t - PL_oldoldbufptr, PL_oldoldbufptr);
}
else
warn("\t(Missing operator before %.*s?)\n", s - oldbp, oldbp);
- bufptr = oldbp;
+ PL_bufptr = oldbp;
}
STATIC void
if (nl)
*nl = '\0';
}
- else if (multi_close < 32 || multi_close == 127) {
+ else if (PL_multi_close < 32 || PL_multi_close == 127) {
*tmpbuf = '^';
- tmpbuf[1] = toCTRL(multi_close);
+ tmpbuf[1] = toCTRL(PL_multi_close);
s = "\\n";
tmpbuf[2] = '\0';
s = tmpbuf;
}
else {
- *tmpbuf = multi_close;
+ *tmpbuf = PL_multi_close;
tmpbuf[1] = '\0';
s = tmpbuf;
}
void
deprecate(char *s)
{
- if (dowarn)
+ if (PL_dowarn)
warn("Use of %s is deprecated", s);
}
char *s;
STRLEN len;
- SAVEI32(lex_dojoin);
- SAVEI32(lex_brackets);
- SAVEI32(lex_fakebrack);
- SAVEI32(lex_casemods);
- SAVEI32(lex_starts);
- SAVEI32(lex_state);
- SAVESPTR(lex_inpat);
- SAVEI32(lex_inwhat);
- SAVEI16(curcop->cop_line);
- SAVEPPTR(bufptr);
- SAVEPPTR(bufend);
- SAVEPPTR(oldbufptr);
- SAVEPPTR(oldoldbufptr);
- SAVEPPTR(linestart);
- SAVESPTR(linestr);
- SAVEPPTR(lex_brackstack);
- SAVEPPTR(lex_casestack);
- SAVEDESTRUCTOR(restore_rsfp, rsfp);
- SAVESPTR(lex_stuff);
- SAVEI32(lex_defer);
- SAVESPTR(lex_repl);
- SAVEDESTRUCTOR(restore_expect, tokenbuf + expect); /* encode as pointer */
- SAVEDESTRUCTOR(restore_lex_expect, tokenbuf + expect);
-
- lex_state = LEX_NORMAL;
- lex_defer = 0;
- expect = XSTATE;
- lex_brackets = 0;
- lex_fakebrack = 0;
- New(899, lex_brackstack, 120, char);
- New(899, lex_casestack, 12, char);
- SAVEFREEPV(lex_brackstack);
- SAVEFREEPV(lex_casestack);
- lex_casemods = 0;
- *lex_casestack = '\0';
- lex_dojoin = 0;
- lex_starts = 0;
- lex_stuff = Nullsv;
- lex_repl = Nullsv;
- lex_inpat = 0;
- lex_inwhat = 0;
- linestr = line;
- if (SvREADONLY(linestr))
- linestr = sv_2mortal(newSVsv(linestr));
- s = SvPV(linestr, len);
+ SAVEI32(PL_lex_dojoin);
+ SAVEI32(PL_lex_brackets);
+ SAVEI32(PL_lex_fakebrack);
+ SAVEI32(PL_lex_casemods);
+ SAVEI32(PL_lex_starts);
+ SAVEI32(PL_lex_state);
+ SAVESPTR(PL_lex_inpat);
+ SAVEI32(PL_lex_inwhat);
+ SAVEI16(PL_curcop->cop_line);
+ SAVEPPTR(PL_bufptr);
+ SAVEPPTR(PL_bufend);
+ SAVEPPTR(PL_oldbufptr);
+ SAVEPPTR(PL_oldoldbufptr);
+ SAVEPPTR(PL_linestart);
+ SAVESPTR(PL_linestr);
+ SAVEPPTR(PL_lex_brackstack);
+ SAVEPPTR(PL_lex_casestack);
+ SAVEDESTRUCTOR(restore_rsfp, PL_rsfp);
+ SAVESPTR(PL_lex_stuff);
+ SAVEI32(PL_lex_defer);
+ SAVESPTR(PL_lex_repl);
+ SAVEDESTRUCTOR(restore_expect, PL_tokenbuf + PL_expect); /* encode as pointer */
+ SAVEDESTRUCTOR(restore_lex_expect, PL_tokenbuf + PL_expect);
+
+ PL_lex_state = LEX_NORMAL;
+ PL_lex_defer = 0;
+ PL_expect = XSTATE;
+ PL_lex_brackets = 0;
+ PL_lex_fakebrack = 0;
+ New(899, PL_lex_brackstack, 120, char);
+ New(899, PL_lex_casestack, 12, char);
+ SAVEFREEPV(PL_lex_brackstack);
+ SAVEFREEPV(PL_lex_casestack);
+ PL_lex_casemods = 0;
+ *PL_lex_casestack = '\0';
+ PL_lex_dojoin = 0;
+ PL_lex_starts = 0;
+ PL_lex_stuff = Nullsv;
+ PL_lex_repl = Nullsv;
+ PL_lex_inpat = 0;
+ PL_lex_inwhat = 0;
+ PL_linestr = line;
+ if (SvREADONLY(PL_linestr))
+ PL_linestr = sv_2mortal(newSVsv(PL_linestr));
+ s = SvPV(PL_linestr, len);
if (len && s[len-1] != ';') {
- if (!(SvFLAGS(linestr) & SVs_TEMP))
- linestr = sv_2mortal(newSVsv(linestr));
- sv_catpvn(linestr, "\n;", 2);
+ if (!(SvFLAGS(PL_linestr) & SVs_TEMP))
+ PL_linestr = sv_2mortal(newSVsv(PL_linestr));
+ sv_catpvn(PL_linestr, "\n;", 2);
}
- SvTEMP_off(linestr);
- oldoldbufptr = oldbufptr = bufptr = linestart = SvPVX(linestr);
- bufend = bufptr + SvCUR(linestr);
- SvREFCNT_dec(rs);
- rs = newSVpv("\n", 1);
- rsfp = 0;
+ SvTEMP_off(PL_linestr);
+ PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = PL_bufptr + SvCUR(PL_linestr);
+ SvREFCNT_dec(PL_rs);
+ PL_rs = newSVpv("\n", 1);
+ PL_rsfp = 0;
}
void
lex_end(void)
{
- doextract = FALSE;
+ PL_doextract = FALSE;
}
STATIC void
{
PerlIO *fp = (PerlIO*)f;
- if (rsfp == PerlIO_stdin())
- PerlIO_clearerr(rsfp);
- else if (rsfp && (rsfp != fp))
- PerlIO_close(rsfp);
- rsfp = fp;
+ if (PL_rsfp == PerlIO_stdin())
+ PerlIO_clearerr(PL_rsfp);
+ else if (PL_rsfp && (PL_rsfp != fp))
+ PerlIO_close(PL_rsfp);
+ PL_rsfp = fp;
}
STATIC void
restore_expect(void *e)
{
/* a safe way to store a small integer in a pointer */
- expect = (expectation)((char *)e - tokenbuf);
+ PL_expect = (expectation)((char *)e - PL_tokenbuf);
}
STATIC void
restore_lex_expect(void *e)
{
/* a safe way to store a small integer in a pointer */
- lex_expect = (expectation)((char *)e - tokenbuf);
+ PL_lex_expect = (expectation)((char *)e - PL_tokenbuf);
}
STATIC void
char ch;
int sawline = 0;
- curcop->cop_line++;
+ PL_curcop->cop_line++;
if (*s++ != '#')
return;
while (*s == ' ' || *s == '\t') s++;
ch = *t;
*t = '\0';
if (t - s > 0)
- curcop->cop_filegv = gv_fetchfile(s);
+ PL_curcop->cop_filegv = gv_fetchfile(s);
else
- curcop->cop_filegv = gv_fetchfile(origfilename);
+ PL_curcop->cop_filegv = gv_fetchfile(PL_origfilename);
*t = ch;
- curcop->cop_line = atoi(n)-1;
+ PL_curcop->cop_line = atoi(n)-1;
}
STATIC char *
skipspace(register char *s)
{
dTHR;
- if (lex_formbrack && lex_brackets <= lex_formbrack) {
- while (s < bufend && (*s == ' ' || *s == '\t'))
+ if (PL_lex_formbrack && PL_lex_brackets <= PL_lex_formbrack) {
+ while (s < PL_bufend && (*s == ' ' || *s == '\t'))
s++;
return s;
}
for (;;) {
STRLEN prevlen;
- while (s < bufend && isSPACE(*s))
+ while (s < PL_bufend && isSPACE(*s))
s++;
- if (s < bufend && *s == '#') {
- while (s < bufend && *s != '\n')
+ if (s < PL_bufend && *s == '#') {
+ while (s < PL_bufend && *s != '\n')
s++;
- if (s < bufend)
+ if (s < PL_bufend)
s++;
}
- if (s < bufend || !rsfp || lex_state != LEX_NORMAL)
+ if (s < PL_bufend || !PL_rsfp || PL_lex_state != LEX_NORMAL)
return s;
- if ((s = filter_gets(linestr, rsfp, (prevlen = SvCUR(linestr)))) == Nullch) {
- if (minus_n || minus_p) {
- sv_setpv(linestr,minus_p ?
+ if ((s = filter_gets(PL_linestr, PL_rsfp, (prevlen = SvCUR(PL_linestr)))) == Nullch) {
+ if (PL_minus_n || PL_minus_p) {
+ sv_setpv(PL_linestr,PL_minus_p ?
";}continue{print or die qq(-p destination: $!\\n)" :
"");
- sv_catpv(linestr,";}");
- minus_n = minus_p = 0;
+ sv_catpv(PL_linestr,";}");
+ PL_minus_n = PL_minus_p = 0;
}
else
- sv_setpv(linestr,";");
- oldoldbufptr = oldbufptr = bufptr = s = linestart = SvPVX(linestr);
- bufend = SvPVX(linestr) + SvCUR(linestr);
- if (preprocess && !in_eval)
- (void)PerlProc_pclose(rsfp);
- else if ((PerlIO*)rsfp == PerlIO_stdin())
- PerlIO_clearerr(rsfp);
+ sv_setpv(PL_linestr,";");
+ PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = s = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ if (PL_preprocess && !PL_in_eval)
+ (void)PerlProc_pclose(PL_rsfp);
+ else if ((PerlIO*)PL_rsfp == PerlIO_stdin())
+ PerlIO_clearerr(PL_rsfp);
else
- (void)PerlIO_close(rsfp);
- rsfp = Nullfp;
+ (void)PerlIO_close(PL_rsfp);
+ PL_rsfp = Nullfp;
return s;
}
- linestart = bufptr = s + prevlen;
- bufend = s + SvCUR(linestr);
- s = bufptr;
+ PL_linestart = PL_bufptr = s + prevlen;
+ PL_bufend = s + SvCUR(PL_linestr);
+ s = PL_bufptr;
incline(s);
- if (PERLDB_LINE && curstash != debstash) {
+ if (PERLDB_LINE && PL_curstash != PL_debstash) {
SV *sv = NEWSV(85,0);
sv_upgrade(sv, SVt_PVMG);
- sv_setpvn(sv,bufptr,bufend-bufptr);
- av_store(GvAV(curcop->cop_filegv),(I32)curcop->cop_line,sv);
+ sv_setpvn(sv,PL_bufptr,PL_bufend-PL_bufptr);
+ av_store(GvAV(PL_curcop->cop_filegv),(I32)PL_curcop->cop_line,sv);
}
}
}
char ch;
char *t;
- if (oldoldbufptr != last_uni)
+ if (PL_oldoldbufptr != PL_last_uni)
return;
- while (isSPACE(*last_uni))
- last_uni++;
- for (s = last_uni; isALNUM(*s) || *s == '-'; s++) ;
- if ((t = strchr(s, '(')) && t < bufptr)
+ while (isSPACE(*PL_last_uni))
+ PL_last_uni++;
+ for (s = PL_last_uni; isALNUM(*s) || *s == '-'; s++) ;
+ if ((t = strchr(s, '(')) && t < PL_bufptr)
return;
ch = *s;
*s = '\0';
- warn("Warning: Use of \"%s\" without parens is ambiguous", last_uni);
+ warn("Warning: Use of \"%s\" without parens is ambiguous", PL_last_uni);
*s = ch;
}
uni(I32 f, char *s)
{
yylval.ival = f;
- expect = XTERM;
- bufptr = s;
+ PL_expect = XTERM;
+ PL_bufptr = s;
last_uni = oldbufptr;
last_lop_op = f;
if (*s == '(')
dTHR;
yylval.ival = f;
CLINE;
- expect = x;
- bufptr = s;
- last_lop = oldbufptr;
- last_lop_op = f;
- if (nexttoke)
+ PL_expect = x;
+ PL_bufptr = s;
+ PL_last_lop = PL_oldbufptr;
+ PL_last_lop_op = f;
+ if (PL_nexttoke)
return LSTOP;
if (*s == '(')
return FUNC;
STATIC void
force_next(I32 type)
{
- nexttype[nexttoke] = type;
- nexttoke++;
- if (lex_state != LEX_KNOWNEXT) {
- lex_defer = lex_state;
- lex_expect = expect;
- lex_state = LEX_KNOWNEXT;
+ PL_nexttype[PL_nexttoke] = type;
+ PL_nexttoke++;
+ if (PL_lex_state != LEX_KNOWNEXT) {
+ PL_lex_defer = PL_lex_state;
+ PL_lex_expect = PL_expect;
+ PL_lex_state = LEX_KNOWNEXT;
}
}
(allow_pack && *s == ':') ||
(allow_initial_tick && *s == '\'') )
{
- s = scan_word(s, tokenbuf, sizeof tokenbuf, allow_pack, &len);
- if (check_keyword && keyword(tokenbuf, len))
+ s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, allow_pack, &len);
+ if (check_keyword && keyword(PL_tokenbuf, len))
return start;
if (token == METHOD) {
s = skipspace(s);
if (*s == '(')
- expect = XTERM;
+ PL_expect = XTERM;
else {
- expect = XOPERATOR;
+ PL_expect = XOPERATOR;
force_next(')');
force_next('(');
}
}
- nextval[nexttoke].opval = (OP*)newSVOP(OP_CONST,0, newSVpv(tokenbuf,0));
- nextval[nexttoke].opval->op_private |= OPpCONST_BARE;
+ PL_nextval[PL_nexttoke].opval = (OP*)newSVOP(OP_CONST,0, newSVpv(PL_tokenbuf,0));
+ PL_nextval[PL_nexttoke].opval->op_private |= OPpCONST_BARE;
force_next(token);
}
return s;
{
if (s && *s) {
OP* o = (OP*)newSVOP(OP_CONST, 0, newSVpv(s,0));
- nextval[nexttoke].opval = o;
+ PL_nextval[PL_nexttoke].opval = o;
force_next(WORD);
if (kind) {
dTHR; /* just for in_eval */
/* XXX see note in pp_entereval() for why we forgo typo
warnings if the symbol must be introduced in an eval.
GSAR 96-10-12 */
- gv_fetchpv(s, in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : TRUE,
+ gv_fetchpv(s, PL_in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : TRUE,
kind == '$' ? SVt_PV :
kind == '@' ? SVt_PVAV :
kind == '%' ? SVt_PVHV :
}
/* NOTE: The parser sees the package name and the VERSION swapped */
- nextval[nexttoke].opval = version;
+ PL_nextval[PL_nexttoke].opval = version;
force_next(WORD);
return (s);
if (s == send)
goto finish;
d = s;
- if ( hints & HINT_NEW_STRING )
+ if ( PL_hints & HINT_NEW_STRING )
pv = sv_2mortal(newSVpv(SvPVX(pv), len));
while (s < send) {
if (*s == '\\') {
*d = '\0';
SvCUR_set(sv, d - SvPVX(sv));
finish:
- if ( hints & HINT_NEW_STRING )
+ if ( PL_hints & HINT_NEW_STRING )
return new_constant(NULL, 0, "q", sv, pv, "q");
return sv;
}
register I32 op_type = yylval.ival;
if (op_type == OP_NULL) {
- yylval.opval = lex_op;
- lex_op = Nullop;
+ yylval.opval = PL_lex_op;
+ PL_lex_op = Nullop;
return THING;
}
if (op_type == OP_CONST || op_type == OP_READLINE) {
- SV *sv = tokeq(lex_stuff);
+ SV *sv = tokeq(PL_lex_stuff);
if (SvTYPE(sv) == SVt_PVIV) {
/* Overloaded constants, nothing fancy: Convert to SVt_PV: */
sv = nsv;
}
yylval.opval = (OP*)newSVOP(op_type, 0, sv);
- lex_stuff = Nullsv;
+ PL_lex_stuff = Nullsv;
return THING;
}
- sublex_info.super_state = lex_state;
- sublex_info.sub_inwhat = op_type;
- sublex_info.sub_op = lex_op;
- lex_state = LEX_INTERPPUSH;
+ PL_sublex_info.super_state = PL_lex_state;
+ PL_sublex_info.sub_inwhat = op_type;
+ PL_sublex_info.sub_op = PL_lex_op;
+ PL_lex_state = LEX_INTERPPUSH;
- expect = XTERM;
- if (lex_op) {
- yylval.opval = lex_op;
- lex_op = Nullop;
+ PL_expect = XTERM;
+ if (PL_lex_op) {
+ yylval.opval = PL_lex_op;
+ PL_lex_op = Nullop;
return PMFUNC;
}
else
dTHR;
ENTER;
- lex_state = sublex_info.super_state;
- SAVEI32(lex_dojoin);
- SAVEI32(lex_brackets);
- SAVEI32(lex_fakebrack);
- SAVEI32(lex_casemods);
- SAVEI32(lex_starts);
- SAVEI32(lex_state);
- SAVESPTR(lex_inpat);
- SAVEI32(lex_inwhat);
- SAVEI16(curcop->cop_line);
- SAVEPPTR(bufptr);
- SAVEPPTR(oldbufptr);
- SAVEPPTR(oldoldbufptr);
- SAVEPPTR(linestart);
- SAVESPTR(linestr);
- SAVEPPTR(lex_brackstack);
- SAVEPPTR(lex_casestack);
-
- linestr = lex_stuff;
- lex_stuff = Nullsv;
-
- bufend = bufptr = oldbufptr = oldoldbufptr = linestart = SvPVX(linestr);
- bufend += SvCUR(linestr);
- SAVEFREESV(linestr);
-
- lex_dojoin = FALSE;
- lex_brackets = 0;
- lex_fakebrack = 0;
- New(899, lex_brackstack, 120, char);
- New(899, lex_casestack, 12, char);
- SAVEFREEPV(lex_brackstack);
- SAVEFREEPV(lex_casestack);
- lex_casemods = 0;
- *lex_casestack = '\0';
- lex_starts = 0;
- lex_state = LEX_INTERPCONCAT;
- curcop->cop_line = multi_start;
-
- lex_inwhat = sublex_info.sub_inwhat;
- if (lex_inwhat == OP_MATCH || lex_inwhat == OP_QR || lex_inwhat == OP_SUBST)
- lex_inpat = sublex_info.sub_op;
+ PL_lex_state = PL_sublex_info.super_state;
+ SAVEI32(PL_lex_dojoin);
+ SAVEI32(PL_lex_brackets);
+ SAVEI32(PL_lex_fakebrack);
+ SAVEI32(PL_lex_casemods);
+ SAVEI32(PL_lex_starts);
+ SAVEI32(PL_lex_state);
+ SAVESPTR(PL_lex_inpat);
+ SAVEI32(PL_lex_inwhat);
+ SAVEI16(PL_curcop->cop_line);
+ SAVEPPTR(PL_bufptr);
+ SAVEPPTR(PL_oldbufptr);
+ SAVEPPTR(PL_oldoldbufptr);
+ SAVEPPTR(PL_linestart);
+ SAVESPTR(PL_linestr);
+ SAVEPPTR(PL_lex_brackstack);
+ SAVEPPTR(PL_lex_casestack);
+
+ PL_linestr = PL_lex_stuff;
+ PL_lex_stuff = Nullsv;
+
+ PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend += SvCUR(PL_linestr);
+ SAVEFREESV(PL_linestr);
+
+ PL_lex_dojoin = FALSE;
+ PL_lex_brackets = 0;
+ PL_lex_fakebrack = 0;
+ New(899, PL_lex_brackstack, 120, char);
+ New(899, PL_lex_casestack, 12, char);
+ SAVEFREEPV(PL_lex_brackstack);
+ SAVEFREEPV(PL_lex_casestack);
+ PL_lex_casemods = 0;
+ *PL_lex_casestack = '\0';
+ PL_lex_starts = 0;
+ PL_lex_state = LEX_INTERPCONCAT;
+ PL_curcop->cop_line = PL_multi_start;
+
+ PL_lex_inwhat = PL_sublex_info.sub_inwhat;
+ if (PL_lex_inwhat == OP_MATCH || PL_lex_inwhat == OP_QR || PL_lex_inwhat == OP_SUBST)
+ PL_lex_inpat = PL_sublex_info.sub_op;
else
- lex_inpat = Nullop;
+ PL_lex_inpat = Nullop;
return '(';
}
STATIC I32
sublex_done(void)
{
- if (!lex_starts++) {
- expect = XOPERATOR;
+ if (!PL_lex_starts++) {
+ PL_expect = XOPERATOR;
yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv("",0));
return THING;
}
- if (lex_casemods) { /* oops, we've got some unbalanced parens */
- lex_state = LEX_INTERPCASEMOD;
+ if (PL_lex_casemods) { /* oops, we've got some unbalanced parens */
+ PL_lex_state = LEX_INTERPCASEMOD;
return yylex();
}
/* Is there a right-hand side to take care of? */
- if (lex_repl && (lex_inwhat == OP_SUBST || lex_inwhat == OP_TRANS)) {
- linestr = lex_repl;
- lex_inpat = 0;
- bufend = bufptr = oldbufptr = oldoldbufptr = linestart = SvPVX(linestr);
- bufend += SvCUR(linestr);
- SAVEFREESV(linestr);
- lex_dojoin = FALSE;
- lex_brackets = 0;
- lex_fakebrack = 0;
- lex_casemods = 0;
- *lex_casestack = '\0';
- lex_starts = 0;
- if (SvCOMPILED(lex_repl)) {
- lex_state = LEX_INTERPNORMAL;
- lex_starts++;
+ if (PL_lex_repl && (PL_lex_inwhat == OP_SUBST || PL_lex_inwhat == OP_TRANS)) {
+ PL_linestr = PL_lex_repl;
+ PL_lex_inpat = 0;
+ PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend += SvCUR(PL_linestr);
+ SAVEFREESV(PL_linestr);
+ PL_lex_dojoin = FALSE;
+ PL_lex_brackets = 0;
+ PL_lex_fakebrack = 0;
+ PL_lex_casemods = 0;
+ *PL_lex_casestack = '\0';
+ PL_lex_starts = 0;
+ if (SvCOMPILED(PL_lex_repl)) {
+ PL_lex_state = LEX_INTERPNORMAL;
+ PL_lex_starts++;
}
else
- lex_state = LEX_INTERPCONCAT;
- lex_repl = Nullsv;
+ PL_lex_state = LEX_INTERPCONCAT;
+ PL_lex_repl = Nullsv;
return ',';
}
else {
LEAVE;
- bufend = SvPVX(linestr);
- bufend += SvCUR(linestr);
- expect = XOPERATOR;
+ PL_bufend = SvPVX(PL_linestr);
+ PL_bufend += SvCUR(PL_linestr);
+ PL_expect = XOPERATOR;
return ')';
}
}
Extracts a pattern, double-quoted string, or transliteration. This
is terrifying code.
- It looks at lex_inwhat and lex_inpat to find out whether it's
- processing a pattern (lex_inpat is true), a transliteration
+ It looks at lex_inwhat and PL_lex_inpat to find out whether it's
+ processing a pattern (PL_lex_inpat is true), a transliteration
(lex_inwhat & OP_TRANS is true), or a double-quoted string.
Returns a pointer to the character scanned up to. Iff this is
STATIC char *
scan_const(char *start)
{
- register char *send = bufend; /* end of the constant */
+ register char *send = PL_bufend; /* end of the constant */
SV *sv = NEWSV(93, send - start); /* sv for the constant */
register char *s = start; /* start of the constant */
register char *d = SvPVX(sv); /* destination for copies */
/* leaveit is the set of acceptably-backslashed characters */
char *leaveit =
- lex_inpat
+ PL_lex_inpat
? "\\.^$@AGZdDwWsSbB+*?|()-nrtfeaxcz0123456789[{]} \t\n\r\f\v#"
: "";
while (s < send || dorange) {
/* get transliterations out of the way (they're most literal) */
- if (lex_inwhat == OP_TRANS) {
+ if (PL_lex_inwhat == OP_TRANS) {
/* expand a range A-Z to the full set of characters. AIE! */
if (dorange) {
I32 i; /* current expanded character */
/* if we get here, we're not doing a transliteration */
/* skip for regexp comments /(?#comment)/ */
- else if (*s == '(' && lex_inpat && s[1] == '?') {
+ else if (*s == '(' && PL_lex_inpat && s[1] == '?') {
if (s[2] == '#') {
while (s < send && *s != ')')
*d++ = *s++;
}
/* likewise skip #-initiated comments in //x patterns */
- else if (*s == '#' && lex_inpat &&
- ((PMOP*)lex_inpat)->op_pmflags & PMf_EXTENDED) {
+ else if (*s == '#' && PL_lex_inpat &&
+ ((PMOP*)PL_lex_inpat)->op_pmflags & PMf_EXTENDED) {
while (s+1 < send && *s != '\n')
*d++ = *s++;
}
variable.
*/
else if (*s == '$') {
- if (!lex_inpat) /* not a regexp, so $ must be var */
+ if (!PL_lex_inpat) /* not a regexp, so $ must be var */
break;
if (s + 1 < send && !strchr("()| \n\t", s[1]))
break; /* in regexp, $ might be tail anchor */
}
/* deprecate \1 in strings and substitution replacements */
- if (lex_inwhat == OP_SUBST && !lex_inpat &&
+ if (PL_lex_inwhat == OP_SUBST && !PL_lex_inpat &&
isDIGIT(*s) && *s != '0' && !isDIGIT(s[1]))
{
- if (dowarn)
+ if (PL_dowarn)
warn("\\%c better written as $%c", *s, *s);
*--s = '$';
break;
}
/* string-change backslash escapes */
- if (lex_inwhat != OP_TRANS && *s && strchr("lLuUEQ", *s)) {
+ if (PL_lex_inwhat != OP_TRANS && *s && strchr("lLuUEQ", *s)) {
--s;
break;
}
/* quoted - in transliterations */
case '-':
- if (lex_inwhat == OP_TRANS) {
+ if (PL_lex_inwhat == OP_TRANS) {
*d++ = *s++;
continue;
}
}
/* return the substring (via yylval) only if we parsed anything */
- if (s > bufptr) {
- if ( hints & ( lex_inpat ? HINT_NEW_RE : HINT_NEW_STRING ) )
- sv = new_constant(start, s - start, (lex_inpat ? "qr" : "q"),
+ if (s > PL_bufptr) {
+ if ( PL_hints & ( PL_lex_inpat ? HINT_NEW_RE : HINT_NEW_STRING ) )
+ sv = new_constant(start, s - start, (PL_lex_inpat ? "qr" : "q"),
sv, Nullsv,
- ( lex_inwhat == OP_TRANS
+ ( PL_lex_inwhat == OP_TRANS
? "tr"
- : ( (lex_inwhat == OP_SUBST && !lex_inpat)
+ : ( (PL_lex_inwhat == OP_SUBST && !PL_lex_inpat)
? "s"
: "qq")));
yylval.opval = (OP*)newSVOP(OP_CONST, 0, sv);
STATIC int
intuit_more(register char *s)
{
- if (lex_brackets)
+ if (PL_lex_brackets)
return TRUE;
if (*s == '-' && s[1] == '>' && (s[2] == '[' || s[2] == '{'))
return TRUE;
if (*s != '{' && *s != '[')
return FALSE;
- if (!lex_inpat)
+ if (!PL_lex_inpat)
return TRUE;
/* In a pattern, so maybe we have {n,m}. */
char seen[256];
unsigned char un_char = 255, last_un_char;
char *send = strchr(s,']');
- char tmpbuf[sizeof tokenbuf * 4];
+ char tmpbuf[sizeof PL_tokenbuf * 4];
if (!send) /* has to be an expression */
return TRUE;
intuit_method(char *start, GV *gv)
{
char *s = start + (*start == '$');
- char tmpbuf[sizeof tokenbuf];
+ char tmpbuf[sizeof PL_tokenbuf];
STRLEN len;
GV* indirgv;
}
s = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len);
if (*start == '$') {
- if (gv || last_lop_op == OP_PRINT || isUPPER(*tokenbuf))
+ if (gv || PL_last_lop_op == OP_PRINT || isUPPER(*PL_tokenbuf))
return 0;
s = skipspace(s);
- bufptr = start;
- expect = XREF;
+ PL_bufptr = start;
+ PL_expect = XREF;
return *s == '(' ? FUNCMETH : METHOD;
}
if (!keyword(tmpbuf, len)) {
/* filehandle or package name makes it a method */
if (!gv || GvIO(indirgv) || gv_stashpvn(tmpbuf, len, FALSE)) {
s = skipspace(s);
- if ((bufend - s) >= 2 && *s == '=' && *(s+1) == '>')
+ if ((PL_bufend - s) >= 2 && *s == '=' && *(s+1) == '>')
return 0; /* no assumptions -- "=>" quotes bearword */
bare_package:
- nextval[nexttoke].opval = (OP*)newSVOP(OP_CONST, 0,
+ PL_nextval[PL_nexttoke].opval = (OP*)newSVOP(OP_CONST, 0,
newSVpv(tmpbuf,0));
- nextval[nexttoke].opval->op_private = OPpCONST_BARE;
- expect = XTERM;
+ PL_nextval[PL_nexttoke].opval->op_private = OPpCONST_BARE;
+ PL_expect = XTERM;
force_next(WORD);
- bufptr = s;
+ PL_bufptr = s;
return *s == '(' ? FUNCMETH : METHOD;
}
}
STATIC char*
incl_perldb(void)
{
- if (perldb) {
+ if (PL_perldb) {
char *pdb = PerlEnv_getenv("PERL5DB");
if (pdb)
filter_debug = atoi((char*)datasv);
return NULL;
}
- if (!rsfp_filters)
- rsfp_filters = newAV();
+ if (!PL_rsfp_filters)
+ PL_rsfp_filters = newAV();
if (!datasv)
datasv = NEWSV(255,0);
if (!SvUPGRADE(datasv, SVt_PVIO))
die("Can't upgrade filter_add data to SVt_PVIO");
IoDIRP(datasv) = (DIR*)funcp; /* stash funcp into spare field */
if (filter_debug)
- warn("filter_add func %p (%s)", funcp, SvPV(datasv,na));
- av_unshift(rsfp_filters, 1);
- av_store(rsfp_filters, 0, datasv) ;
+ warn("filter_add func %p (%s)", funcp, SvPV(datasv,PL_na));
+ av_unshift(PL_rsfp_filters, 1);
+ av_store(PL_rsfp_filters, 0, datasv) ;
return(datasv);
}
{
if (filter_debug)
warn("filter_del func %p", funcp);
- if (!rsfp_filters || AvFILLp(rsfp_filters)<0)
+ if (!PL_rsfp_filters || AvFILLp(PL_rsfp_filters)<0)
return;
/* if filter is on top of stack (usual case) just pop it off */
- if (IoDIRP(FILTER_DATA(AvFILLp(rsfp_filters))) == (void*)funcp){
- sv_free(av_pop(rsfp_filters));
+ if (IoDIRP(FILTER_DATA(AvFILLp(PL_rsfp_filters))) == (void*)funcp){
+ sv_free(av_pop(PL_rsfp_filters));
return;
}
filter_t funcp;
SV *datasv = NULL;
- if (!rsfp_filters)
+ if (!PL_rsfp_filters)
return -1;
- if (idx > AvFILLp(rsfp_filters)){ /* Any more filters? */
+ if (idx > AvFILLp(PL_rsfp_filters)){ /* Any more filters? */
/* Provide a default input filter to make life easy. */
/* Note that we append to the line. This is handy. */
if (filter_debug)
/* ensure buf_sv is large enough */
SvGROW(buf_sv, old_len + maxlen) ;
- if ((len = PerlIO_read(rsfp, SvPVX(buf_sv) + old_len, maxlen)) <= 0){
- if (PerlIO_error(rsfp))
+ if ((len = PerlIO_read(PL_rsfp, SvPVX(buf_sv) + old_len, maxlen)) <= 0){
+ if (PerlIO_error(PL_rsfp))
return -1; /* error */
else
return 0 ; /* end of file */
SvCUR_set(buf_sv, old_len + len) ;
} else {
/* Want a line */
- if (sv_gets(buf_sv, rsfp, SvCUR(buf_sv)) == NULL) {
- if (PerlIO_error(rsfp))
+ if (sv_gets(buf_sv, PL_rsfp, SvCUR(buf_sv)) == NULL) {
+ if (PerlIO_error(PL_rsfp))
return -1; /* error */
else
return 0 ; /* end of file */
return SvCUR(buf_sv);
}
/* Skip this filter slot if filter has been deleted */
- if ( (datasv = FILTER_DATA(idx)) == &sv_undef){
+ if ( (datasv = FILTER_DATA(idx)) == &PL_sv_undef){
if (filter_debug)
warn("filter_read %d: skipped (filter deleted)\n", idx);
return FILTER_READ(idx+1, buf_sv, maxlen); /* recurse */
funcp = (filter_t)IoDIRP(datasv);
if (filter_debug)
warn("filter_read %d: via function %p (%s)\n",
- idx, funcp, SvPV(datasv,na));
+ idx, funcp, SvPV(datasv,PL_na));
/* Call function. The function is expected to */
/* call "FILTER_READ(idx+1, buf_sv)" first. */
/* Return: <0:error, =0:eof, >0:not eof */
filter_gets(register SV *sv, register PerlIO *fp, STRLEN append)
{
#ifdef WIN32FILTER
- if (!rsfp_filters) {
+ if (!PL_rsfp_filters) {
filter_add(win32_textfilter,NULL);
}
#endif
- if (rsfp_filters) {
+ if (PL_rsfp_filters) {
if (!append)
SvCUR_set(sv, 0); /* start with empty line */
GV **gvp = 0;
/* check if there's an identifier for us to look at */
- if (pending_ident) {
+ if (PL_pending_ident) {
/* pit holds the identifier we read and pending_ident is reset */
- char pit = pending_ident;
- pending_ident = 0;
+ char pit = PL_pending_ident;
+ PL_pending_ident = 0;
/* if we're in a my(), we can't allow dynamics here.
$foo'bar has already been turned into $foo::bar, so
if it's a legal name, the OP is a PADANY.
*/
- if (in_my) {
- if (strchr(tokenbuf,':'))
- croak(no_myglob,tokenbuf);
+ if (PL_in_my) {
+ if (strchr(PL_tokenbuf,':'))
+ croak(no_myglob,PL_tokenbuf);
yylval.opval = newOP(OP_PADANY, 0);
- yylval.opval->op_targ = pad_allocmy(tokenbuf);
+ yylval.opval->op_targ = pad_allocmy(PL_tokenbuf);
return PRIVATEREF;
}
(although why you'd do that is anyone's guess).
*/
- if (!strchr(tokenbuf,':')) {
+ if (!strchr(PL_tokenbuf,':')) {
#ifdef USE_THREADS
/* Check for single character per-thread SVs */
- if (tokenbuf[0] == '$' && tokenbuf[2] == '\0'
- && !isALPHA(tokenbuf[1]) /* Rule out obvious non-threadsvs */
- && (tmp = find_threadsv(&tokenbuf[1])) != NOT_IN_PAD)
+ if (PL_tokenbuf[0] == '$' && PL_tokenbuf[2] == '\0'
+ && !isALPHA(PL_tokenbuf[1]) /* Rule out obvious non-threadsvs */
+ && (tmp = find_threadsv(&PL_tokenbuf[1])) != NOT_IN_PAD)
{
yylval.opval = newOP(OP_THREADSV, 0);
yylval.opval->op_targ = tmp;
return PRIVATEREF;
}
#endif /* USE_THREADS */
- if ((tmp = pad_findmy(tokenbuf)) != NOT_IN_PAD) {
+ if ((tmp = pad_findmy(PL_tokenbuf)) != NOT_IN_PAD) {
/* if it's a sort block and they're naming $a or $b */
- if (last_lop_op == OP_SORT &&
- tokenbuf[0] == '$' &&
- (tokenbuf[1] == 'a' || tokenbuf[1] == 'b')
- && !tokenbuf[2])
+ if (PL_last_lop_op == OP_SORT &&
+ PL_tokenbuf[0] == '$' &&
+ (PL_tokenbuf[1] == 'a' || PL_tokenbuf[1] == 'b')
+ && !PL_tokenbuf[2])
{
- for (d = in_eval ? oldoldbufptr : linestart;
- d < bufend && *d != '\n';
+ for (d = PL_in_eval ? PL_oldoldbufptr : PL_linestart;
+ d < PL_bufend && *d != '\n';
d++)
{
if (strnEQ(d,"<=>",3) || strnEQ(d,"cmp",3)) {
croak("Can't use \"my %s\" in sort comparison",
- tokenbuf);
+ PL_tokenbuf);
}
}
}
and @foo isn't a variable we can find in the symbol
table.
*/
- if (pit == '@' && lex_state != LEX_NORMAL && !lex_brackets) {
- GV *gv = gv_fetchpv(tokenbuf+1, FALSE, SVt_PVAV);
- if (!gv || ((tokenbuf[0] == '@') ? !GvAV(gv) : !GvHV(gv)))
+ if (pit == '@' && PL_lex_state != LEX_NORMAL && !PL_lex_brackets) {
+ GV *gv = gv_fetchpv(PL_tokenbuf+1, FALSE, SVt_PVAV);
+ if (!gv || ((PL_tokenbuf[0] == '@') ? !GvAV(gv) : !GvHV(gv)))
yyerror(form("In string, %s now must be written as \\%s",
- tokenbuf, tokenbuf));
+ PL_tokenbuf, PL_tokenbuf));
}
/* build ops for a bareword */
- yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(tokenbuf+1, 0));
+ yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(PL_tokenbuf+1, 0));
yylval.opval->op_private = OPpCONST_ENTERED;
- gv_fetchpv(tokenbuf+1, in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : TRUE,
- ((tokenbuf[0] == '$') ? SVt_PV
- : (tokenbuf[0] == '@') ? SVt_PVAV
+ gv_fetchpv(PL_tokenbuf+1, PL_in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : TRUE,
+ ((PL_tokenbuf[0] == '$') ? SVt_PV
+ : (PL_tokenbuf[0] == '@') ? SVt_PVAV
: SVt_PVHV));
return WORD;
}
/* no identifier pending identification */
- switch (lex_state) {
+ switch (PL_lex_state) {
#ifdef COMMENTARY
case LEX_NORMAL: /* Some compilers will produce faster */
case LEX_INTERPNORMAL: /* code if we comment these out. */
/* when we're already built the next token, just pull it out the queue */
case LEX_KNOWNEXT:
- nexttoke--;
- yylval = nextval[nexttoke];
- if (!nexttoke) {
- lex_state = lex_defer;
- expect = lex_expect;
- lex_defer = LEX_NORMAL;
+ PL_nexttoke--;
+ yylval = PL_nextval[PL_nexttoke];
+ if (!PL_nexttoke) {
+ PL_lex_state = PL_lex_defer;
+ PL_expect = PL_lex_expect;
+ PL_lex_defer = LEX_NORMAL;
}
- return(nexttype[nexttoke]);
+ return(PL_nexttype[PL_nexttoke]);
/* interpolated case modifiers like \L \U, including \Q and \E.
- when we get here, bufptr is at the \
+ when we get here, PL_bufptr is at the \
*/
case LEX_INTERPCASEMOD:
#ifdef DEBUGGING
- if (bufptr != bufend && *bufptr != '\\')
+ if (PL_bufptr != PL_bufend && *PL_bufptr != '\\')
croak("panic: INTERPCASEMOD");
#endif
/* handle \E or end of string */
- if (bufptr == bufend || bufptr[1] == 'E') {
+ if (PL_bufptr == PL_bufend || PL_bufptr[1] == 'E') {
char oldmod;
/* if at a \E */
- if (lex_casemods) {
- oldmod = lex_casestack[--lex_casemods];
- lex_casestack[lex_casemods] = '\0';
+ if (PL_lex_casemods) {
+ oldmod = PL_lex_casestack[--PL_lex_casemods];
+ PL_lex_casestack[PL_lex_casemods] = '\0';
- if (bufptr != bufend && strchr("LUQ", oldmod)) {
- bufptr += 2;
- lex_state = LEX_INTERPCONCAT;
+ if (PL_bufptr != PL_bufend && strchr("LUQ", oldmod)) {
+ PL_bufptr += 2;
+ PL_lex_state = LEX_INTERPCONCAT;
}
return ')';
}
- if (bufptr != bufend)
- bufptr += 2;
- lex_state = LEX_INTERPCONCAT;
+ if (PL_bufptr != PL_bufend)
+ PL_bufptr += 2;
+ PL_lex_state = LEX_INTERPCONCAT;
return yylex();
}
else {
- s = bufptr + 1;
+ s = PL_bufptr + 1;
if (strnEQ(s, "L\\u", 3) || strnEQ(s, "U\\l", 3))
tmp = *s, *s = s[2], s[2] = tmp; /* misordered... */
if (strchr("LU", *s) &&
- (strchr(lex_casestack, 'L') || strchr(lex_casestack, 'U')))
+ (strchr(PL_lex_casestack, 'L') || strchr(PL_lex_casestack, 'U')))
{
- lex_casestack[--lex_casemods] = '\0';
+ PL_lex_casestack[--PL_lex_casemods] = '\0';
return ')';
}
- if (lex_casemods > 10) {
- char* newlb = Renew(lex_casestack, lex_casemods + 2, char);
- if (newlb != lex_casestack) {
+ if (PL_lex_casemods > 10) {
+ char* newlb = Renew(PL_lex_casestack, PL_lex_casemods + 2, char);
+ if (newlb != PL_lex_casestack) {
SAVEFREEPV(newlb);
- lex_casestack = newlb;
+ PL_lex_casestack = newlb;
}
}
- lex_casestack[lex_casemods++] = *s;
- lex_casestack[lex_casemods] = '\0';
- lex_state = LEX_INTERPCONCAT;
- nextval[nexttoke].ival = 0;
+ PL_lex_casestack[PL_lex_casemods++] = *s;
+ PL_lex_casestack[PL_lex_casemods] = '\0';
+ PL_lex_state = LEX_INTERPCONCAT;
+ PL_nextval[PL_nexttoke].ival = 0;
force_next('(');
if (*s == 'l')
- nextval[nexttoke].ival = OP_LCFIRST;
+ PL_nextval[PL_nexttoke].ival = OP_LCFIRST;
else if (*s == 'u')
- nextval[nexttoke].ival = OP_UCFIRST;
+ PL_nextval[PL_nexttoke].ival = OP_UCFIRST;
else if (*s == 'L')
- nextval[nexttoke].ival = OP_LC;
+ PL_nextval[PL_nexttoke].ival = OP_LC;
else if (*s == 'U')
- nextval[nexttoke].ival = OP_UC;
+ PL_nextval[PL_nexttoke].ival = OP_UC;
else if (*s == 'Q')
- nextval[nexttoke].ival = OP_QUOTEMETA;
+ PL_nextval[PL_nexttoke].ival = OP_QUOTEMETA;
else
croak("panic: yylex");
- bufptr = s + 1;
+ PL_bufptr = s + 1;
force_next(FUNC);
- if (lex_starts) {
- s = bufptr;
- lex_starts = 0;
+ if (PL_lex_starts) {
+ s = PL_bufptr;
+ PL_lex_starts = 0;
Aop(OP_CONCAT);
}
else
return sublex_push();
case LEX_INTERPSTART:
- if (bufptr == bufend)
+ if (PL_bufptr == PL_bufend)
return sublex_done();
- expect = XTERM;
- lex_dojoin = (*bufptr == '@');
- lex_state = LEX_INTERPNORMAL;
- if (lex_dojoin) {
- nextval[nexttoke].ival = 0;
+ PL_expect = XTERM;
+ PL_lex_dojoin = (*PL_bufptr == '@');
+ PL_lex_state = LEX_INTERPNORMAL;
+ if (PL_lex_dojoin) {
+ PL_nextval[PL_nexttoke].ival = 0;
force_next(',');
#ifdef USE_THREADS
nextval[nexttoke].opval = newOP(OP_THREADSV, 0);
#else
force_ident("\"", '$');
#endif /* USE_THREADS */
- nextval[nexttoke].ival = 0;
+ PL_nextval[PL_nexttoke].ival = 0;
force_next('$');
- nextval[nexttoke].ival = 0;
+ PL_nextval[PL_nexttoke].ival = 0;
force_next('(');
- nextval[nexttoke].ival = OP_JOIN; /* emulate join($", ...) */
+ PL_nextval[PL_nexttoke].ival = OP_JOIN; /* emulate join($", ...) */
force_next(FUNC);
}
- if (lex_starts++) {
- s = bufptr;
+ if (PL_lex_starts++) {
+ s = PL_bufptr;
Aop(OP_CONCAT);
}
return yylex();
case LEX_INTERPENDMAYBE:
- if (intuit_more(bufptr)) {
- lex_state = LEX_INTERPNORMAL; /* false alarm, more expr */
+ if (intuit_more(PL_bufptr)) {
+ PL_lex_state = LEX_INTERPNORMAL; /* false alarm, more expr */
break;
}
/* FALL THROUGH */
case LEX_INTERPEND:
- if (lex_dojoin) {
- lex_dojoin = FALSE;
- lex_state = LEX_INTERPCONCAT;
+ if (PL_lex_dojoin) {
+ PL_lex_dojoin = FALSE;
+ PL_lex_state = LEX_INTERPCONCAT;
return ')';
}
/* FALLTHROUGH */
case LEX_INTERPCONCAT:
#ifdef DEBUGGING
- if (lex_brackets)
+ if (PL_lex_brackets)
croak("panic: INTERPCONCAT");
#endif
- if (bufptr == bufend)
+ if (PL_bufptr == PL_bufend)
return sublex_done();
- if (SvIVX(linestr) == '\'') {
- SV *sv = newSVsv(linestr);
- if (!lex_inpat)
+ if (SvIVX(PL_linestr) == '\'') {
+ SV *sv = newSVsv(PL_linestr);
+ if (!PL_lex_inpat)
sv = tokeq(sv);
- else if ( hints & HINT_NEW_RE )
+ else if ( PL_hints & HINT_NEW_RE )
sv = new_constant(NULL, 0, "qr", sv, sv, "q");
yylval.opval = (OP*)newSVOP(OP_CONST, 0, sv);
- s = bufend;
+ s = PL_bufend;
}
else {
- s = scan_const(bufptr);
+ s = scan_const(PL_bufptr);
if (*s == '\\')
- lex_state = LEX_INTERPCASEMOD;
+ PL_lex_state = LEX_INTERPCASEMOD;
else
- lex_state = LEX_INTERPSTART;
+ PL_lex_state = LEX_INTERPSTART;
}
- if (s != bufptr) {
- nextval[nexttoke] = yylval;
- expect = XTERM;
+ if (s != PL_bufptr) {
+ PL_nextval[PL_nexttoke] = yylval;
+ PL_expect = XTERM;
force_next(THING);
- if (lex_starts++)
+ if (PL_lex_starts++)
Aop(OP_CONCAT);
else {
- bufptr = s;
+ PL_bufptr = s;
return yylex();
}
}
return yylex();
case LEX_FORMLINE:
- lex_state = LEX_NORMAL;
- s = scan_formline(bufptr);
- if (!lex_formbrack)
+ PL_lex_state = LEX_NORMAL;
+ s = scan_formline(PL_bufptr);
+ if (!PL_lex_formbrack)
goto rightbracket;
OPERATOR(';');
}
- s = bufptr;
- oldoldbufptr = oldbufptr;
- oldbufptr = s;
+ s = PL_bufptr;
+ PL_oldoldbufptr = PL_oldbufptr;
+ PL_oldbufptr = s;
DEBUG_p( {
- PerlIO_printf(PerlIO_stderr(), "### Tokener expecting %s at %s\n", exp_name[expect], s);
+ PerlIO_printf(PerlIO_stderr(), "### Tokener expecting %s at %s\n", exp_name[PL_expect], s);
} )
retry:
case 26:
goto fake_eof; /* emulate EOF on ^D or ^Z */
case 0:
- if (!rsfp) {
- last_uni = 0;
- last_lop = 0;
- if (lex_brackets)
+ if (!PL_rsfp) {
+ PL_last_uni = 0;
+ PL_last_lop = 0;
+ if (PL_lex_brackets)
yyerror("Missing right bracket");
TOKEN(0);
}
- if (s++ < bufend)
+ if (s++ < PL_bufend)
goto retry; /* ignore stray nulls */
- last_uni = 0;
- last_lop = 0;
- if (!in_eval && !preambled) {
- preambled = TRUE;
- sv_setpv(linestr,incl_perldb());
- if (SvCUR(linestr))
- sv_catpv(linestr,";");
- if (preambleav){
- while(AvFILLp(preambleav) >= 0) {
- SV *tmpsv = av_shift(preambleav);
- sv_catsv(linestr, tmpsv);
- sv_catpv(linestr, ";");
+ PL_last_uni = 0;
+ PL_last_lop = 0;
+ if (!PL_in_eval && !PL_preambled) {
+ PL_preambled = TRUE;
+ sv_setpv(PL_linestr,incl_perldb());
+ if (SvCUR(PL_linestr))
+ sv_catpv(PL_linestr,";");
+ if (PL_preambleav){
+ while(AvFILLp(PL_preambleav) >= 0) {
+ SV *tmpsv = av_shift(PL_preambleav);
+ sv_catsv(PL_linestr, tmpsv);
+ sv_catpv(PL_linestr, ";");
sv_free(tmpsv);
}
- sv_free((SV*)preambleav);
- preambleav = NULL;
+ sv_free((SV*)PL_preambleav);
+ PL_preambleav = NULL;
}
- if (minus_n || minus_p) {
- sv_catpv(linestr, "LINE: while (<>) {");
- if (minus_l)
- sv_catpv(linestr,"chomp;");
- if (minus_a) {
+ if (PL_minus_n || PL_minus_p) {
+ sv_catpv(PL_linestr, "LINE: while (<>) {");
+ if (PL_minus_l)
+ sv_catpv(PL_linestr,"chomp;");
+ if (PL_minus_a) {
GV* gv = gv_fetchpv("::F", TRUE, SVt_PVAV);
if (gv)
GvIMPORTED_AV_on(gv);
- if (minus_F) {
- if (strchr("/'\"", *splitstr)
- && strchr(splitstr + 1, *splitstr))
- sv_catpvf(linestr, "@F=split(%s);", splitstr);
+ if (PL_minus_F) {
+ if (strchr("/'\"", *PL_splitstr)
+ && strchr(PL_splitstr + 1, *PL_splitstr))
+ sv_catpvf(PL_linestr, "@F=split(%s);", PL_splitstr);
else {
char delim;
s = "'~#\200\1'"; /* surely one char is unused...*/
- while (s[1] && strchr(splitstr, *s)) s++;
+ while (s[1] && strchr(PL_splitstr, *s)) s++;
delim = *s;
- sv_catpvf(linestr, "@F=split(%s%c",
+ sv_catpvf(PL_linestr, "@F=split(%s%c",
"q" + (delim == '\''), delim);
- for (s = splitstr; *s; s++) {
+ for (s = PL_splitstr; *s; s++) {
if (*s == '\\')
- sv_catpvn(linestr, "\\", 1);
- sv_catpvn(linestr, s, 1);
+ sv_catpvn(PL_linestr, "\\", 1);
+ sv_catpvn(PL_linestr, s, 1);
}
- sv_catpvf(linestr, "%c);", delim);
+ sv_catpvf(PL_linestr, "%c);", delim);
}
}
else
- sv_catpv(linestr,"@F=split(' ');");
+ sv_catpv(PL_linestr,"@F=split(' ');");
}
}
- sv_catpv(linestr, "\n");
- oldoldbufptr = oldbufptr = s = linestart = SvPVX(linestr);
- bufend = SvPVX(linestr) + SvCUR(linestr);
- if (PERLDB_LINE && curstash != debstash) {
+ sv_catpv(PL_linestr, "\n");
+ PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ if (PERLDB_LINE && PL_curstash != PL_debstash) {
SV *sv = NEWSV(85,0);
sv_upgrade(sv, SVt_PVMG);
- sv_setsv(sv,linestr);
- av_store(GvAV(curcop->cop_filegv),(I32)curcop->cop_line,sv);
+ sv_setsv(sv,PL_linestr);
+ av_store(GvAV(PL_curcop->cop_filegv),(I32)PL_curcop->cop_line,sv);
}
goto retry;
}
do {
- if ((s = filter_gets(linestr, rsfp, 0)) == Nullch) {
+ if ((s = filter_gets(PL_linestr, PL_rsfp, 0)) == Nullch) {
fake_eof:
- if (rsfp) {
- if (preprocess && !in_eval)
- (void)PerlProc_pclose(rsfp);
- else if ((PerlIO *)rsfp == PerlIO_stdin())
- PerlIO_clearerr(rsfp);
+ if (PL_rsfp) {
+ if (PL_preprocess && !PL_in_eval)
+ (void)PerlProc_pclose(PL_rsfp);
+ else if ((PerlIO *)PL_rsfp == PerlIO_stdin())
+ PerlIO_clearerr(PL_rsfp);
else
- (void)PerlIO_close(rsfp);
- rsfp = Nullfp;
+ (void)PerlIO_close(PL_rsfp);
+ PL_rsfp = Nullfp;
}
- if (!in_eval && (minus_n || minus_p)) {
- sv_setpv(linestr,minus_p ? ";}continue{print" : "");
- sv_catpv(linestr,";}");
- oldoldbufptr = oldbufptr = s = linestart = SvPVX(linestr);
- bufend = SvPVX(linestr) + SvCUR(linestr);
- minus_n = minus_p = 0;
+ if (!PL_in_eval && (PL_minus_n || PL_minus_p)) {
+ sv_setpv(PL_linestr,PL_minus_p ? ";}continue{print" : "");
+ sv_catpv(PL_linestr,";}");
+ PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ PL_minus_n = PL_minus_p = 0;
goto retry;
}
- oldoldbufptr = oldbufptr = s = linestart = SvPVX(linestr);
- sv_setpv(linestr,"");
+ PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
+ sv_setpv(PL_linestr,"");
TOKEN(';'); /* not infinite loop because rsfp is NULL now */
}
- if (doextract) {
+ if (PL_doextract) {
if (*s == '#' && s[1] == '!' && instr(s,"perl"))
- doextract = FALSE;
+ PL_doextract = FALSE;
/* Incest with pod. */
if (*s == '=' && strnEQ(s, "=cut", 4)) {
- sv_setpv(linestr, "");
- oldoldbufptr = oldbufptr = s = linestart = SvPVX(linestr);
- bufend = SvPVX(linestr) + SvCUR(linestr);
- doextract = FALSE;
+ sv_setpv(PL_linestr, "");
+ PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ PL_doextract = FALSE;
}
}
incline(s);
- } while (doextract);
- oldoldbufptr = oldbufptr = bufptr = linestart = s;
- if (PERLDB_LINE && curstash != debstash) {
+ } while (PL_doextract);
+ PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = s;
+ if (PERLDB_LINE && PL_curstash != PL_debstash) {
SV *sv = NEWSV(85,0);
sv_upgrade(sv, SVt_PVMG);
- sv_setsv(sv,linestr);
- av_store(GvAV(curcop->cop_filegv),(I32)curcop->cop_line,sv);
+ sv_setsv(sv,PL_linestr);
+ av_store(GvAV(PL_curcop->cop_filegv),(I32)PL_curcop->cop_line,sv);
}
- bufend = SvPVX(linestr) + SvCUR(linestr);
- if (curcop->cop_line == 1) {
- while (s < bufend && isSPACE(*s))
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ if (PL_curcop->cop_line == 1) {
+ while (s < PL_bufend && isSPACE(*s))
s++;
if (*s == ':' && s[1] != ':') /* for csh execing sh scripts */
s++;
d = Nullch;
- if (!in_eval) {
+ if (!PL_in_eval) {
if (*s == '#' && *(s+1) == '!')
d = s + 2;
#ifdef ALTERNATE_SHEBANG
if (!d &&
*s == '#' &&
ipathend > ipath &&
- !minus_c &&
+ !PL_minus_c &&
!instr(s,"indir") &&
- instr(origargv[0],"perl"))
+ instr(PL_origargv[0],"perl"))
{
char **newargv;
*ipathend = '\0';
s = ipathend + 1;
- while (s < bufend && isSPACE(*s))
+ while (s < PL_bufend && isSPACE(*s))
s++;
- if (s < bufend) {
- Newz(899,newargv,origargc+3,char*);
+ if (s < PL_bufend) {
+ Newz(899,newargv,PL_origargc+3,char*);
newargv[1] = s;
- while (s < bufend && !isSPACE(*s))
+ while (s < PL_bufend && !isSPACE(*s))
s++;
*s = '\0';
- Copy(origargv+1, newargv+2, origargc+1, char*);
+ Copy(PL_origargv+1, newargv+2, PL_origargc+1, char*);
}
else
- newargv = origargv;
+ newargv = PL_origargv;
newargv[0] = ipath;
execv(ipath, newargv);
croak("Can't exec %s", ipath);
}
if (d) {
- U32 oldpdb = perldb;
- bool oldn = minus_n;
- bool oldp = minus_p;
+ U32 oldpdb = PL_perldb;
+ bool oldn = PL_minus_n;
+ bool oldp = PL_minus_p;
while (*d && !isSPACE(*d)) d++;
while (*d == ' ' || *d == '\t') d++;
d = moreswitches(d);
} while (d);
if (PERLDB_LINE && !oldpdb ||
- ( minus_n || minus_p ) && !(oldn || oldp) )
+ ( PL_minus_n || PL_minus_p ) && !(oldn || oldp) )
/* if we have already added "LINE: while (<>) {",
we must not do it again */
{
- sv_setpv(linestr, "");
- oldoldbufptr = oldbufptr = s = linestart = SvPVX(linestr);
- bufend = SvPVX(linestr) + SvCUR(linestr);
- preambled = FALSE;
+ sv_setpv(PL_linestr, "");
+ PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ PL_preambled = FALSE;
if (PERLDB_LINE)
- (void)gv_fetchfile(origfilename);
+ (void)gv_fetchfile(PL_origfilename);
goto retry;
}
}
}
}
}
- if (lex_formbrack && lex_brackets <= lex_formbrack) {
- bufptr = s;
- lex_state = LEX_FORMLINE;
+ if (PL_lex_formbrack && PL_lex_brackets <= PL_lex_formbrack) {
+ PL_bufptr = s;
+ PL_lex_state = LEX_FORMLINE;
return yylex();
}
goto retry;
goto retry;
case '#':
case '\n':
- if (lex_state != LEX_NORMAL || (in_eval && !rsfp)) {
- d = bufend;
+ if (PL_lex_state != LEX_NORMAL || (PL_in_eval && !PL_rsfp)) {
+ d = PL_bufend;
while (s < d && *s != '\n')
s++;
if (s < d)
s++;
incline(s);
- if (lex_formbrack && lex_brackets <= lex_formbrack) {
- bufptr = s;
- lex_state = LEX_FORMLINE;
+ if (PL_lex_formbrack && PL_lex_brackets <= PL_lex_formbrack) {
+ PL_bufptr = s;
+ PL_lex_state = LEX_FORMLINE;
return yylex();
}
}
else {
*s = '\0';
- bufend = s;
+ PL_bufend = s;
}
goto retry;
case '-':
if (s[1] && isALPHA(s[1]) && !isALNUM(s[2])) {
s++;
- bufptr = s;
+ PL_bufptr = s;
tmp = *s++;
- while (s < bufend && (*s == ' ' || *s == '\t'))
+ while (s < PL_bufend && (*s == ' ' || *s == '\t'))
s++;
if (strnEQ(s,"=>",2)) {
- s = force_word(bufptr,WORD,FALSE,FALSE,FALSE);
+ s = force_word(PL_bufptr,WORD,FALSE,FALSE,FALSE);
OPERATOR('-'); /* unary minus */
}
- last_uni = oldbufptr;
- last_lop_op = OP_FTEREAD; /* good enough */
+ PL_last_uni = PL_oldbufptr;
+ PL_last_lop_op = OP_FTEREAD; /* good enough */
switch (tmp) {
case 'r': FTST(OP_FTEREAD);
case 'w': FTST(OP_FTEWRITE);
tmp = *s++;
if (*s == tmp) {
s++;
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
TERM(POSTDEC);
else
OPERATOR(PREDEC);
else
TERM(ARROW);
}
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
Aop(OP_SUBTRACT);
else {
- if (isSPACE(*s) || !isSPACE(*bufptr))
+ if (isSPACE(*s) || !isSPACE(*PL_bufptr))
check_uni();
OPERATOR('-'); /* unary minus */
}
tmp = *s++;
if (*s == tmp) {
s++;
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
TERM(POSTINC);
else
OPERATOR(PREINC);
}
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
Aop(OP_ADD);
else {
- if (isSPACE(*s) || !isSPACE(*bufptr))
+ if (isSPACE(*s) || !isSPACE(*PL_bufptr))
check_uni();
OPERATOR('+');
}
case '*':
- if (expect != XOPERATOR) {
- s = scan_ident(s, bufend, tokenbuf, sizeof tokenbuf, TRUE);
- expect = XOPERATOR;
- force_ident(tokenbuf, '*');
- if (!*tokenbuf)
+ if (PL_expect != XOPERATOR) {
+ s = scan_ident(s, PL_bufend, PL_tokenbuf, sizeof PL_tokenbuf, TRUE);
+ PL_expect = XOPERATOR;
+ force_ident(PL_tokenbuf, '*');
+ if (!*PL_tokenbuf)
PREREF('*');
TERM('*');
}
Mop(OP_MULTIPLY);
case '%':
- if (expect == XOPERATOR) {
+ if (PL_expect == XOPERATOR) {
++s;
Mop(OP_MODULO);
}
- tokenbuf[0] = '%';
- s = scan_ident(s, bufend, tokenbuf + 1, sizeof tokenbuf - 1, TRUE);
- if (!tokenbuf[1]) {
- if (s == bufend)
+ PL_tokenbuf[0] = '%';
+ s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, TRUE);
+ if (!PL_tokenbuf[1]) {
+ if (s == PL_bufend)
yyerror("Final % should be \\% or %name");
PREREF('%');
}
- pending_ident = '%';
+ PL_pending_ident = '%';
TERM('%');
case '^':
s++;
BOop(OP_BIT_XOR);
case '[':
- lex_brackets++;
+ PL_lex_brackets++;
/* FALL THROUGH */
case '~':
case ',':
OPERATOR(':');
case '(':
s++;
- if (last_lop == oldoldbufptr || last_uni == oldoldbufptr)
- oldbufptr = oldoldbufptr; /* allow print(STDOUT 123) */
+ if (PL_last_lop == PL_oldoldbufptr || PL_last_uni == PL_oldoldbufptr)
+ PL_oldbufptr = PL_oldoldbufptr; /* allow print(STDOUT 123) */
else
- expect = XTERM;
+ PL_expect = XTERM;
TOKEN('(');
case ';':
- if (curcop->cop_line < copline)
- copline = curcop->cop_line;
+ if (PL_curcop->cop_line < PL_copline)
+ PL_copline = PL_curcop->cop_line;
tmp = *s++;
OPERATOR(tmp);
case ')':
TERM(tmp);
case ']':
s++;
- if (lex_brackets <= 0)
+ if (PL_lex_brackets <= 0)
yyerror("Unmatched right bracket");
else
- --lex_brackets;
- if (lex_state == LEX_INTERPNORMAL) {
- if (lex_brackets == 0) {
+ --PL_lex_brackets;
+ if (PL_lex_state == LEX_INTERPNORMAL) {
+ if (PL_lex_brackets == 0) {
if (*s != '[' && *s != '{' && (*s != '-' || s[1] != '>'))
- lex_state = LEX_INTERPEND;
+ PL_lex_state = LEX_INTERPEND;
}
}
TERM(']');
case '{':
leftbracket:
s++;
- if (lex_brackets > 100) {
- char* newlb = Renew(lex_brackstack, lex_brackets + 1, char);
- if (newlb != lex_brackstack) {
+ if (PL_lex_brackets > 100) {
+ char* newlb = Renew(PL_lex_brackstack, PL_lex_brackets + 1, char);
+ if (newlb != PL_lex_brackstack) {
SAVEFREEPV(newlb);
- lex_brackstack = newlb;
+ PL_lex_brackstack = newlb;
}
}
- switch (expect) {
+ switch (PL_expect) {
case XTERM:
- if (lex_formbrack) {
+ if (PL_lex_formbrack) {
s--;
PRETERMBLOCK(DO);
}
- if (oldoldbufptr == last_lop)
- lex_brackstack[lex_brackets++] = XTERM;
+ if (PL_oldoldbufptr == PL_last_lop)
+ PL_lex_brackstack[PL_lex_brackets++] = XTERM;
else
- lex_brackstack[lex_brackets++] = XOPERATOR;
+ PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
OPERATOR(HASHBRACK);
case XOPERATOR:
- while (s < bufend && (*s == ' ' || *s == '\t'))
+ while (s < PL_bufend && (*s == ' ' || *s == '\t'))
s++;
d = s;
- tokenbuf[0] = '\0';
- if (d < bufend && *d == '-') {
- tokenbuf[0] = '-';
+ PL_tokenbuf[0] = '\0';
+ if (d < PL_bufend && *d == '-') {
+ PL_tokenbuf[0] = '-';
d++;
- while (d < bufend && (*d == ' ' || *d == '\t'))
+ while (d < PL_bufend && (*d == ' ' || *d == '\t'))
d++;
}
- if (d < bufend && isIDFIRST(*d)) {
- d = scan_word(d, tokenbuf + 1, sizeof tokenbuf - 1,
+ if (d < PL_bufend && isIDFIRST(*d)) {
+ d = scan_word(d, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
FALSE, &len);
- while (d < bufend && (*d == ' ' || *d == '\t'))
+ while (d < PL_bufend && (*d == ' ' || *d == '\t'))
d++;
if (*d == '}') {
- char minus = (tokenbuf[0] == '-');
+ char minus = (PL_tokenbuf[0] == '-');
s = force_word(s + minus, WORD, FALSE, TRUE, FALSE);
if (minus)
force_next('-');
}
/* FALL THROUGH */
case XBLOCK:
- lex_brackstack[lex_brackets++] = XSTATE;
- expect = XSTATE;
+ PL_lex_brackstack[PL_lex_brackets++] = XSTATE;
+ PL_expect = XSTATE;
break;
case XTERMBLOCK:
- lex_brackstack[lex_brackets++] = XOPERATOR;
- expect = XSTATE;
+ PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
+ PL_expect = XSTATE;
break;
default: {
char *t;
- if (oldoldbufptr == last_lop)
- lex_brackstack[lex_brackets++] = XTERM;
+ if (PL_oldoldbufptr == PL_last_lop)
+ PL_lex_brackstack[PL_lex_brackets++] = XTERM;
else
- lex_brackstack[lex_brackets++] = XOPERATOR;
+ PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
s = skipspace(s);
if (*s == '}')
OPERATOR(HASHBRACK);
t = s;
if (*s == '\'' || *s == '"' || *s == '`') {
/* common case: get past first string, handling escapes */
- for (t++; t < bufend && *t != *s;)
+ for (t++; t < PL_bufend && *t != *s;)
if (*t++ == '\\' && (*t == '\\' || *t == *s))
t++;
t++;
}
else if (*s == 'q') {
- if (++t < bufend
+ if (++t < PL_bufend
&& (!isALNUM(*t)
- || ((*t == 'q' || *t == 'x') && ++t < bufend
+ || ((*t == 'q' || *t == 'x') && ++t < PL_bufend
&& !isALNUM(*t)))) {
char *tmps;
char open, close, term;
I32 brackets = 1;
- while (t < bufend && isSPACE(*t))
+ while (t < PL_bufend && isSPACE(*t))
t++;
term = *t;
open = term;
term = tmps[5];
close = term;
if (open == close)
- for (t++; t < bufend; t++) {
- if (*t == '\\' && t+1 < bufend && open != '\\')
+ for (t++; t < PL_bufend; t++) {
+ if (*t == '\\' && t+1 < PL_bufend && open != '\\')
t++;
else if (*t == open)
break;
}
else
- for (t++; t < bufend; t++) {
- if (*t == '\\' && t+1 < bufend)
+ for (t++; t < PL_bufend; t++) {
+ if (*t == '\\' && t+1 < PL_bufend)
t++;
else if (*t == close && --brackets <= 0)
break;
t++;
}
else if (isALPHA(*s)) {
- for (t++; t < bufend && isALNUM(*t); t++) ;
+ for (t++; t < PL_bufend && isALNUM(*t); t++) ;
}
- while (t < bufend && isSPACE(*t))
+ while (t < PL_bufend && isSPACE(*t))
t++;
/* if comma follows first term, call it an anon hash */
/* XXX it could be a comma expression with loop modifiers */
- if (t < bufend && ((*t == ',' && (*s == 'q' || !isLOWER(*s)))
+ if (t < PL_bufend && ((*t == ',' && (*s == 'q' || !isLOWER(*s)))
|| (*t == '=' && t[1] == '>')))
OPERATOR(HASHBRACK);
- if (expect == XREF)
- expect = XTERM;
+ if (PL_expect == XREF)
+ PL_expect = XTERM;
else {
- lex_brackstack[lex_brackets-1] = XSTATE;
- expect = XSTATE;
+ PL_lex_brackstack[PL_lex_brackets-1] = XSTATE;
+ PL_expect = XSTATE;
}
}
break;
}
- yylval.ival = curcop->cop_line;
+ yylval.ival = PL_curcop->cop_line;
if (isSPACE(*s) || *s == '#')
- copline = NOLINE; /* invalidate current command line number */
+ PL_copline = NOLINE; /* invalidate current command line number */
TOKEN('{');
case '}':
rightbracket:
s++;
- if (lex_brackets <= 0)
+ if (PL_lex_brackets <= 0)
yyerror("Unmatched right bracket");
else
- expect = (expectation)lex_brackstack[--lex_brackets];
- if (lex_brackets < lex_formbrack)
- lex_formbrack = 0;
- if (lex_state == LEX_INTERPNORMAL) {
- if (lex_brackets == 0) {
- if (lex_fakebrack) {
- lex_state = LEX_INTERPEND;
- bufptr = s;
+ PL_expect = (expectation)PL_lex_brackstack[--PL_lex_brackets];
+ if (PL_lex_brackets < PL_lex_formbrack)
+ PL_lex_formbrack = 0;
+ if (PL_lex_state == LEX_INTERPNORMAL) {
+ if (PL_lex_brackets == 0) {
+ if (PL_lex_fakebrack) {
+ PL_lex_state = LEX_INTERPEND;
+ PL_bufptr = s;
return yylex(); /* ignore fake brackets */
}
if (*s == '-' && s[1] == '>')
- lex_state = LEX_INTERPENDMAYBE;
+ PL_lex_state = LEX_INTERPENDMAYBE;
else if (*s != '[' && *s != '{')
- lex_state = LEX_INTERPEND;
+ PL_lex_state = LEX_INTERPEND;
}
}
- if (lex_brackets < lex_fakebrack) {
- bufptr = s;
- lex_fakebrack = 0;
+ if (PL_lex_brackets < PL_lex_fakebrack) {
+ PL_bufptr = s;
+ PL_lex_fakebrack = 0;
return yylex(); /* ignore fake brackets */
}
force_next('}');
if (tmp == '&')
AOPERATOR(ANDAND);
s--;
- if (expect == XOPERATOR) {
- if (dowarn && isALPHA(*s) && bufptr == linestart) {
- curcop->cop_line--;
+ if (PL_expect == XOPERATOR) {
+ if (PL_dowarn && isALPHA(*s) && PL_bufptr == PL_linestart) {
+ PL_curcop->cop_line--;
warn(warn_nosemi);
- curcop->cop_line++;
+ PL_curcop->cop_line++;
}
BAop(OP_BIT_AND);
}
- s = scan_ident(s - 1, bufend, tokenbuf, sizeof tokenbuf, TRUE);
- if (*tokenbuf) {
- expect = XOPERATOR;
- force_ident(tokenbuf, '&');
+ s = scan_ident(s - 1, PL_bufend, PL_tokenbuf, sizeof PL_tokenbuf, TRUE);
+ if (*PL_tokenbuf) {
+ PL_expect = XOPERATOR;
+ force_ident(PL_tokenbuf, '&');
}
else
PREREF('&');
OPERATOR(',');
if (tmp == '~')
PMop(OP_MATCH);
- if (dowarn && tmp && isSPACE(*s) && strchr("+-*/%.^&|<",tmp))
+ if (PL_dowarn && tmp && isSPACE(*s) && strchr("+-*/%.^&|<",tmp))
warn("Reversed %c= operator",(int)tmp);
s--;
- if (expect == XSTATE && isALPHA(tmp) &&
- (s == linestart+1 || s[-2] == '\n') )
+ if (PL_expect == XSTATE && isALPHA(tmp) &&
+ (s == PL_linestart+1 || s[-2] == '\n') )
{
- if (in_eval && !rsfp) {
- d = bufend;
+ if (PL_in_eval && !PL_rsfp) {
+ d = PL_bufend;
while (s < d) {
if (*s++ == '\n') {
incline(s);
}
goto retry;
}
- s = bufend;
- doextract = TRUE;
+ s = PL_bufend;
+ PL_doextract = TRUE;
goto retry;
}
- if (lex_brackets < lex_formbrack) {
+ if (PL_lex_brackets < PL_lex_formbrack) {
char *t;
for (t = s; *t == ' ' || *t == '\t'; t++) ;
if (*t == '\n' || *t == '#') {
s--;
- expect = XBLOCK;
+ PL_expect = XBLOCK;
goto leftbracket;
}
}
s--;
OPERATOR('!');
case '<':
- if (expect != XOPERATOR) {
+ if (PL_expect != XOPERATOR) {
if (s[1] != '<' && !strchr(s,'>'))
check_uni();
if (s[1] == '<')
case '$':
CLINE;
- if (expect == XOPERATOR) {
- if (lex_formbrack && lex_brackets == lex_formbrack) {
- expect = XTERM;
+ if (PL_expect == XOPERATOR) {
+ if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
+ PL_expect = XTERM;
depcom();
return ','; /* grandfather non-comma-format format */
}
}
if (s[1] == '#' && (isALPHA(s[2]) || strchr("_{$:", s[2]))) {
- if (expect == XOPERATOR)
- no_op("Array length", bufptr);
- tokenbuf[0] = '@';
- s = scan_ident(s + 1, bufend, tokenbuf + 1, sizeof tokenbuf - 1,
+ if (PL_expect == XOPERATOR)
+ no_op("Array length", PL_bufptr);
+ PL_tokenbuf[0] = '@';
+ s = scan_ident(s + 1, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
FALSE);
- if (!tokenbuf[1])
+ if (!PL_tokenbuf[1])
PREREF(DOLSHARP);
- expect = XOPERATOR;
- pending_ident = '#';
+ PL_expect = XOPERATOR;
+ PL_pending_ident = '#';
TOKEN(DOLSHARP);
}
- if (expect == XOPERATOR)
- no_op("Scalar", bufptr);
- tokenbuf[0] = '$';
- s = scan_ident(s, bufend, tokenbuf + 1, sizeof tokenbuf - 1, FALSE);
- if (!tokenbuf[1]) {
- if (s == bufend)
+ if (PL_expect == XOPERATOR)
+ no_op("Scalar", PL_bufptr);
+ PL_tokenbuf[0] = '$';
+ s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE);
+ if (!PL_tokenbuf[1]) {
+ if (s == PL_bufend)
yyerror("Final $ should be \\$ or $name");
PREREF('$');
}
/* This kludge not intended to be bulletproof. */
- if (tokenbuf[1] == '[' && !tokenbuf[2]) {
+ if (PL_tokenbuf[1] == '[' && !PL_tokenbuf[2]) {
yylval.opval = newSVOP(OP_CONST, 0,
- newSViv((IV)compiling.cop_arybase));
+ newSViv((IV)PL_compiling.cop_arybase));
yylval.opval->op_private = OPpCONST_ARYBASE;
TERM(THING);
}
d = s;
- if (lex_state == LEX_NORMAL)
+ if (PL_lex_state == LEX_NORMAL)
s = skipspace(s);
- if ((expect != XREF || oldoldbufptr == last_lop) && intuit_more(s)) {
+ if ((PL_expect != XREF || PL_oldoldbufptr == PL_last_lop) && intuit_more(s)) {
char *t;
if (*s == '[') {
- tokenbuf[0] = '@';
- if (dowarn) {
+ PL_tokenbuf[0] = '@';
+ if (PL_dowarn) {
for(t = s + 1;
isSPACE(*t) || isALNUM(*t) || *t == '$';
t++) ;
if (*t++ == ',') {
- bufptr = skipspace(bufptr);
- while (t < bufend && *t != ']')
+ PL_bufptr = skipspace(PL_bufptr);
+ while (t < PL_bufend && *t != ']')
t++;
warn("Multidimensional syntax %.*s not supported",
- (t - bufptr) + 1, bufptr);
+ (t - PL_bufptr) + 1, PL_bufptr);
}
}
}
else if (*s == '{') {
- tokenbuf[0] = '%';
- if (dowarn && strEQ(tokenbuf+1, "SIG") &&
+ PL_tokenbuf[0] = '%';
+ if (PL_dowarn && strEQ(PL_tokenbuf+1, "SIG") &&
(t = strchr(s, '}')) && (t = strchr(t, '=')))
{
- char tmpbuf[sizeof tokenbuf];
+ char tmpbuf[sizeof PL_tokenbuf];
STRLEN len;
for (t++; isSPACE(*t); t++) ;
if (isIDFIRST(*t)) {
}
}
- expect = XOPERATOR;
- if (lex_state == LEX_NORMAL && isSPACE(*d)) {
- bool islop = (last_lop == oldoldbufptr);
- if (!islop || last_lop_op == OP_GREPSTART)
- expect = XOPERATOR;
+ PL_expect = XOPERATOR;
+ if (PL_lex_state == LEX_NORMAL && isSPACE(*d)) {
+ bool islop = (PL_last_lop == PL_oldoldbufptr);
+ if (!islop || PL_last_lop_op == OP_GREPSTART)
+ PL_expect = XOPERATOR;
else if (strchr("$@\"'`q", *s))
- expect = XTERM; /* e.g. print $fh "foo" */
+ PL_expect = XTERM; /* e.g. print $fh "foo" */
else if (strchr("&*<%", *s) && isIDFIRST(s[1]))
- expect = XTERM; /* e.g. print $fh &sub */
+ PL_expect = XTERM; /* e.g. print $fh &sub */
else if (isIDFIRST(*s)) {
- char tmpbuf[sizeof tokenbuf];
+ char tmpbuf[sizeof PL_tokenbuf];
scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len);
if (tmp = keyword(tmpbuf, len)) {
/* binary operators exclude handle interpretations */
case -KEY_cmp:
break;
default:
- expect = XTERM; /* e.g. print $fh length() */
+ PL_expect = XTERM; /* e.g. print $fh length() */
break;
}
}
else {
GV *gv = gv_fetchpv(tmpbuf, FALSE, SVt_PVCV);
if (gv && GvCVu(gv))
- expect = XTERM; /* e.g. print $fh subr() */
+ PL_expect = XTERM; /* e.g. print $fh subr() */
}
}
else if (isDIGIT(*s))
- expect = XTERM; /* e.g. print $fh 3 */
+ PL_expect = XTERM; /* e.g. print $fh 3 */
else if (*s == '.' && isDIGIT(s[1]))
- expect = XTERM; /* e.g. print $fh .3 */
+ PL_expect = XTERM; /* e.g. print $fh .3 */
else if (strchr("/?-+", *s) && !isSPACE(s[1]))
- expect = XTERM; /* e.g. print $fh -1 */
+ PL_expect = XTERM; /* e.g. print $fh -1 */
else if (*s == '<' && s[1] == '<' && !isSPACE(s[2]))
- expect = XTERM; /* print $fh <<"EOF" */
+ PL_expect = XTERM; /* print $fh <<"EOF" */
}
- pending_ident = '$';
+ PL_pending_ident = '$';
TOKEN('$');
case '@':
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
no_op("Array", s);
- tokenbuf[0] = '@';
- s = scan_ident(s, bufend, tokenbuf + 1, sizeof tokenbuf - 1, FALSE);
- if (!tokenbuf[1]) {
- if (s == bufend)
+ PL_tokenbuf[0] = '@';
+ s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE);
+ if (!PL_tokenbuf[1]) {
+ if (s == PL_bufend)
yyerror("Final @ should be \\@ or @name");
PREREF('@');
}
- if (lex_state == LEX_NORMAL)
+ if (PL_lex_state == LEX_NORMAL)
s = skipspace(s);
- if ((expect != XREF || oldoldbufptr == last_lop) && intuit_more(s)) {
+ if ((PL_expect != XREF || PL_oldoldbufptr == PL_last_lop) && intuit_more(s)) {
if (*s == '{')
- tokenbuf[0] = '%';
+ PL_tokenbuf[0] = '%';
/* Warn about @ where they meant $. */
- if (dowarn) {
+ if (PL_dowarn) {
if (*s == '[' || *s == '{') {
char *t = s + 1;
while (*t && (isALNUM(*t) || strchr(" \t$#+-'\"", *t)))
t++;
if (*t == '}' || *t == ']') {
t++;
- bufptr = skipspace(bufptr);
+ PL_bufptr = skipspace(PL_bufptr);
warn("Scalar value %.*s better written as $%.*s",
- t-bufptr, bufptr, t-bufptr-1, bufptr+1);
+ t-PL_bufptr, PL_bufptr, t-PL_bufptr-1, PL_bufptr+1);
}
}
}
}
- pending_ident = '@';
+ PL_pending_ident = '@';
TERM('@');
case '/': /* may either be division or pattern */
case '?': /* may either be conditional or pattern */
- if (expect != XOPERATOR) {
+ if (PL_expect != XOPERATOR) {
/* Disable warning on "study /blah/" */
- if (oldoldbufptr == last_uni
- && (*last_uni != 's' || s - last_uni < 5
- || memNE(last_uni, "study", 5) || isALNUM(last_uni[5])))
+ if (PL_oldoldbufptr == PL_last_uni
+ && (*PL_last_uni != 's' || s - PL_last_uni < 5
+ || memNE(PL_last_uni, "study", 5) || isALNUM(PL_last_uni[5])))
check_uni();
s = scan_pat(s,OP_MATCH);
TERM(sublex_start());
OPERATOR(tmp);
case '.':
- if (lex_formbrack && lex_brackets == lex_formbrack && s[1] == '\n' &&
- (s == linestart || s[-1] == '\n') ) {
- lex_formbrack = 0;
- expect = XSTATE;
+ if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack && s[1] == '\n' &&
+ (s == PL_linestart || s[-1] == '\n') ) {
+ PL_lex_formbrack = 0;
+ PL_expect = XSTATE;
goto rightbracket;
}
- if (expect == XOPERATOR || !isDIGIT(s[1])) {
+ if (PL_expect == XOPERATOR || !isDIGIT(s[1])) {
tmp = *s++;
if (*s == tmp) {
s++;
yylval.ival = 0;
OPERATOR(DOTDOT);
}
- if (expect != XOPERATOR)
+ if (PL_expect != XOPERATOR)
check_uni();
Aop(OP_CONCAT);
}
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
s = scan_num(s);
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
no_op("Number",s);
TERM(THING);
case '\'':
s = scan_str(s);
- if (expect == XOPERATOR) {
- if (lex_formbrack && lex_brackets == lex_formbrack) {
- expect = XTERM;
+ if (PL_expect == XOPERATOR) {
+ if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
+ PL_expect = XTERM;
depcom();
return ','; /* grandfather non-comma-format format */
}
case '"':
s = scan_str(s);
- if (expect == XOPERATOR) {
- if (lex_formbrack && lex_brackets == lex_formbrack) {
- expect = XTERM;
+ if (PL_expect == XOPERATOR) {
+ if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) {
+ PL_expect = XTERM;
depcom();
return ','; /* grandfather non-comma-format format */
}
if (!s)
missingterm((char*)0);
yylval.ival = OP_CONST;
- for (d = SvPV(lex_stuff, len); len; len--, d++) {
+ for (d = SvPV(PL_lex_stuff, len); len; len--, d++) {
if (*d == '$' || *d == '@' || *d == '\\') {
yylval.ival = OP_STRINGIFY;
break;
case '`':
s = scan_str(s);
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
no_op("Backticks",s);
if (!s)
missingterm((char*)0);
case '\\':
s++;
- if (dowarn && lex_inwhat && isDIGIT(*s))
+ if (PL_dowarn && PL_lex_inwhat && isDIGIT(*s))
warn("Can't use \\%c to mean $%c in expression", *s, *s);
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
no_op("Backslash",s);
OPERATOR(REFGEN);
case 'x':
- if (isDIGIT(s[1]) && expect == XOPERATOR) {
+ if (isDIGIT(s[1]) && PL_expect == XOPERATOR) {
s++;
Mop(OP_REPEAT);
}
gv = Nullgv;
gvp = 0;
- bufptr = s;
- s = scan_word(s, tokenbuf, sizeof tokenbuf, FALSE, &len);
+ PL_bufptr = s;
+ s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len);
/* Some keywords can be followed by any delimiter, including ':' */
- tmp = (len == 1 && strchr("msyq", tokenbuf[0]) ||
- len == 2 && ((tokenbuf[0] == 't' && tokenbuf[1] == 'r') ||
- (tokenbuf[0] == 'q' &&
- strchr("qwxr", tokenbuf[1]))));
+ tmp = (len == 1 && strchr("msyq", PL_tokenbuf[0]) ||
+ len == 2 && ((PL_tokenbuf[0] == 't' && PL_tokenbuf[1] == 'r') ||
+ (PL_tokenbuf[0] == 'q' &&
+ strchr("qwxr", PL_tokenbuf[1]))));
/* x::* is just a word, unless x is "CORE" */
- if (!tmp && *s == ':' && s[1] == ':' && strNE(tokenbuf, "CORE"))
+ if (!tmp && *s == ':' && s[1] == ':' && strNE(PL_tokenbuf, "CORE"))
goto just_a_word;
d = s;
- while (d < bufend && isSPACE(*d))
+ while (d < PL_bufend && isSPACE(*d))
d++; /* no comments skipped here, or s### is misparsed */
/* Is this a label? */
- if (!tmp && expect == XSTATE
- && d < bufend && *d == ':' && *(d + 1) != ':') {
+ if (!tmp && PL_expect == XSTATE
+ && d < PL_bufend && *d == ':' && *(d + 1) != ':') {
s = d + 1;
- yylval.pval = savepv(tokenbuf);
+ yylval.pval = savepv(PL_tokenbuf);
CLINE;
TOKEN(LABEL);
}
/* Check for keywords */
- tmp = keyword(tokenbuf, len);
+ tmp = keyword(PL_tokenbuf, len);
/* Is this a word before a => operator? */
if (strnEQ(d,"=>",2)) {
CLINE;
- yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(tokenbuf,0));
+ yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(PL_tokenbuf,0));
yylval.opval->op_private = OPpCONST_BARE;
TERM(WORD);
}
if (tmp < 0) { /* second-class keyword? */
GV *ogv = Nullgv; /* override (winner) */
GV *hgv = Nullgv; /* hidden (loser) */
- if (expect != XOPERATOR && (*s != ':' || s[1] != ':')) {
+ if (PL_expect != XOPERATOR && (*s != ':' || s[1] != ':')) {
CV *cv;
- if ((gv = gv_fetchpv(tokenbuf, FALSE, SVt_PVCV)) &&
+ if ((gv = gv_fetchpv(PL_tokenbuf, FALSE, SVt_PVCV)) &&
(cv = GvCVu(gv)))
{
if (GvIMPORTED_CV(gv))
hgv = gv;
}
if (!ogv &&
- (gvp = (GV**)hv_fetch(globalstash,tokenbuf,len,FALSE)) &&
- (gv = *gvp) != (GV*)&sv_undef &&
+ (gvp = (GV**)hv_fetch(PL_globalstash,PL_tokenbuf,len,FALSE)) &&
+ (gv = *gvp) != (GV*)&PL_sv_undef &&
GvCVu(gv) && GvIMPORTED_CV(gv))
{
ogv = gv;
}
else if (gv && !gvp
&& -tmp==KEY_lock /* XXX generalizable kludge */
- && !hv_fetch(GvHVn(incgv), "Thread.pm", 9, FALSE))
+ && !hv_fetch(GvHVn(PL_incgv), "Thread.pm", 9, FALSE))
{
tmp = 0; /* any sub overrides "weak" keyword */
}
tmp = -tmp;
gv = Nullgv;
gvp = 0;
- if (dowarn && hgv)
+ if (PL_dowarn && hgv)
warn("Ambiguous call resolved as CORE::%s(), "
"qualify as such or use &", GvENAME(hgv));
}
default: /* not a keyword */
just_a_word: {
SV *sv;
- char lastchar = (bufptr == oldoldbufptr ? 0 : bufptr[-1]);
+ char lastchar = (PL_bufptr == PL_oldoldbufptr ? 0 : PL_bufptr[-1]);
/* Get the rest if it looks like a package qualifier */
if (*s == '\'' || *s == ':' && s[1] == ':') {
STRLEN morelen;
- s = scan_word(s, tokenbuf + len, sizeof tokenbuf - len,
+ s = scan_word(s, PL_tokenbuf + len, sizeof PL_tokenbuf - len,
TRUE, &morelen);
if (!morelen)
- croak("Bad name after %s%s", tokenbuf,
+ croak("Bad name after %s%s", PL_tokenbuf,
*s == '\'' ? "'" : "::");
len += morelen;
}
- if (expect == XOPERATOR) {
- if (bufptr == linestart) {
- curcop->cop_line--;
+ if (PL_expect == XOPERATOR) {
+ if (PL_bufptr == PL_linestart) {
+ PL_curcop->cop_line--;
warn(warn_nosemi);
- curcop->cop_line++;
+ PL_curcop->cop_line++;
}
else
no_op("Bareword",s);
(and a package name). */
if (len > 2 &&
- tokenbuf[len - 2] == ':' && tokenbuf[len - 1] == ':')
+ PL_tokenbuf[len - 2] == ':' && PL_tokenbuf[len - 1] == ':')
{
- if (dowarn && ! gv_fetchpv(tokenbuf, FALSE, SVt_PVHV))
+ if (PL_dowarn && ! gv_fetchpv(PL_tokenbuf, FALSE, SVt_PVHV))
warn("Bareword \"%s\" refers to nonexistent package",
- tokenbuf);
+ PL_tokenbuf);
len -= 2;
- tokenbuf[len] = '\0';
+ PL_tokenbuf[len] = '\0';
gv = Nullgv;
gvp = 0;
}
else {
len = 0;
if (!gv)
- gv = gv_fetchpv(tokenbuf, FALSE, SVt_PVCV);
+ gv = gv_fetchpv(PL_tokenbuf, FALSE, SVt_PVCV);
}
/* if we saw a global override before, get the right name */
if (gvp) {
sv = newSVpv("CORE::GLOBAL::",14);
- sv_catpv(sv,tokenbuf);
+ sv_catpv(sv,PL_tokenbuf);
}
else
- sv = newSVpv(tokenbuf,0);
+ sv = newSVpv(PL_tokenbuf,0);
/* Presume this is going to be a bareword of some sort. */
/* See if it's the indirect object for a list operator. */
- if (oldoldbufptr &&
- oldoldbufptr < bufptr &&
- (oldoldbufptr == last_lop || oldoldbufptr == last_uni) &&
+ if (PL_oldoldbufptr &&
+ PL_oldoldbufptr < PL_bufptr &&
+ (PL_oldoldbufptr == PL_last_lop || PL_oldoldbufptr == PL_last_uni) &&
/* NO SKIPSPACE BEFORE HERE! */
- (expect == XREF
- || ((opargs[last_lop_op] >> OASHIFT)& 7) == OA_FILEREF
- || (last_lop_op == OP_ENTERSUB
- && last_proto
- && last_proto[last_proto[0] == ';' ? 1 : 0] == '*')) )
+ (PL_expect == XREF
+ || ((opargs[PL_last_lop_op] >> OASHIFT)& 7) == OA_FILEREF
+ || (PL_last_lop_op == OP_ENTERSUB
+ && PL_last_proto
+ && PL_last_proto[PL_last_proto[0] == ';' ? 1 : 0] == '*')) )
{
bool immediate_paren = *s == '(';
/* If not a declared subroutine, it's an indirect object. */
/* (But it's an indir obj regardless for sort.) */
- if ((last_lop_op == OP_SORT ||
+ if ((PL_last_lop_op == OP_SORT ||
(!immediate_paren && (!gv || !GvCVu(gv))) ) &&
- (last_lop_op != OP_MAPSTART && last_lop_op != OP_GREPSTART)){
- expect = (last_lop == oldoldbufptr) ? XTERM : XOPERATOR;
+ (PL_last_lop_op != OP_MAPSTART && PL_last_lop_op != OP_GREPSTART)){
+ PL_expect = (PL_last_lop == PL_oldoldbufptr) ? XTERM : XOPERATOR;
goto bareword;
}
}
/* If followed by a paren, it's certainly a subroutine. */
- expect = XOPERATOR;
+ PL_expect = XOPERATOR;
s = skipspace(s);
if (*s == '(') {
CLINE;
goto its_constant;
}
}
- nextval[nexttoke].opval = yylval.opval;
- expect = XOPERATOR;
+ PL_nextval[PL_nexttoke].opval = yylval.opval;
+ PL_expect = XOPERATOR;
force_next(WORD);
yylval.ival = 0;
TOKEN('&');
/* If followed by var or block, call it a method (unless sub) */
if ((*s == '$' || *s == '{') && (!gv || !GvCVu(gv))) {
- last_lop = oldbufptr;
- last_lop_op = OP_METHOD;
+ PL_last_lop = PL_oldbufptr;
+ PL_last_lop_op = OP_METHOD;
PREBLOCK(METHOD);
}
CV* cv;
if (lastchar == '-')
warn("Ambiguous use of -%s resolved as -&%s()",
- tokenbuf, tokenbuf);
- last_lop = oldbufptr;
- last_lop_op = OP_ENTERSUB;
+ PL_tokenbuf, PL_tokenbuf);
+ PL_last_lop = PL_oldbufptr;
+ PL_last_lop_op = OP_ENTERSUB;
/* Check for a constant sub */
cv = GvCV(gv);
if ((sv = cv_const_sv(cv))) {
/* Is there a prototype? */
if (SvPOK(cv)) {
STRLEN len;
- last_proto = SvPV((SV*)cv, len);
+ PL_last_proto = SvPV((SV*)cv, len);
if (!len)
TERM(FUNC0SUB);
- if (strEQ(last_proto, "$"))
+ if (strEQ(PL_last_proto, "$"))
OPERATOR(UNIOPSUB);
- if (*last_proto == '&' && *s == '{') {
- sv_setpv(subname,"__ANON__");
+ if (*PL_last_proto == '&' && *s == '{') {
+ sv_setpv(PL_subname,"__ANON__");
PREBLOCK(LSTOPSUB);
}
} else
- last_proto = NULL;
- nextval[nexttoke].opval = yylval.opval;
- expect = XTERM;
+ PL_last_proto = NULL;
+ PL_nextval[PL_nexttoke].opval = yylval.opval;
+ PL_expect = XTERM;
force_next(WORD);
TOKEN(NOAMP);
}
- if (hints & HINT_STRICT_SUBS &&
+ if (PL_hints & HINT_STRICT_SUBS &&
lastchar != '-' &&
strnNE(s,"->",2) &&
- last_lop_op != OP_TRUNCATE && /* S/F prototype in opcode.pl */
- last_lop_op != OP_ACCEPT &&
- last_lop_op != OP_PIPE_OP &&
- last_lop_op != OP_SOCKPAIR)
+ PL_last_lop_op != OP_TRUNCATE && /* S/F prototype in opcode.pl */
+ PL_last_lop_op != OP_ACCEPT &&
+ PL_last_lop_op != OP_PIPE_OP &&
+ PL_last_lop_op != OP_SOCKPAIR)
{
warn(
"Bareword \"%s\" not allowed while \"strict subs\" in use",
- tokenbuf);
- ++error_count;
+ PL_tokenbuf);
+ ++PL_error_count;
}
/* Call it a bare word */
bareword:
- if (dowarn) {
+ if (PL_dowarn) {
if (lastchar != '-') {
- for (d = tokenbuf; *d && isLOWER(*d); d++) ;
+ for (d = PL_tokenbuf; *d && isLOWER(*d); d++) ;
if (!*d)
- warn(warn_reserved, tokenbuf);
+ warn(warn_reserved, PL_tokenbuf);
}
}
safe_bareword:
if (lastchar && strchr("*%&", lastchar)) {
warn("Operator or semicolon missing before %c%s",
- lastchar, tokenbuf);
+ lastchar, PL_tokenbuf);
warn("Ambiguous use of %c resolved as operator %c",
lastchar, lastchar);
}
case KEY___FILE__:
yylval.opval = (OP*)newSVOP(OP_CONST, 0,
- newSVsv(GvSV(curcop->cop_filegv)));
+ newSVsv(GvSV(PL_curcop->cop_filegv)));
TERM(THING);
case KEY___LINE__:
yylval.opval = (OP*)newSVOP(OP_CONST, 0,
- newSVpvf("%ld", (long)curcop->cop_line));
+ newSVpvf("%ld", (long)PL_curcop->cop_line));
TERM(THING);
case KEY___PACKAGE__:
yylval.opval = (OP*)newSVOP(OP_CONST, 0,
- (curstash
- ? newSVsv(curstname)
- : &sv_undef));
+ (PL_curstash
+ ? newSVsv(PL_curstname)
+ : &PL_sv_undef));
TERM(THING);
case KEY___DATA__:
GV *gv;
/*SUPPRESS 560*/
- if (rsfp && (!in_eval || tokenbuf[2] == 'D')) {
+ if (PL_rsfp && (!PL_in_eval || PL_tokenbuf[2] == 'D')) {
char *pname = "main";
- if (tokenbuf[2] == 'D')
- pname = HvNAME(curstash ? curstash : defstash);
+ if (PL_tokenbuf[2] == 'D')
+ pname = HvNAME(PL_curstash ? PL_curstash : PL_defstash);
gv = gv_fetchpv(form("%s::DATA", pname), TRUE, SVt_PVIO);
GvMULTI_on(gv);
if (!GvIO(gv))
GvIOp(gv) = newIO();
- IoIFP(GvIOp(gv)) = rsfp;
+ IoIFP(GvIOp(gv)) = PL_rsfp;
#if defined(HAS_FCNTL) && defined(F_SETFD)
{
- int fd = PerlIO_fileno(rsfp);
+ int fd = PerlIO_fileno(PL_rsfp);
fcntl(fd,F_SETFD,fd >= 3);
}
#endif
/* Mark this internal pseudo-handle as clean */
IoFLAGS(GvIOp(gv)) |= IOf_UNTAINT;
- if (preprocess)
+ if (PL_preprocess)
IoTYPE(GvIOp(gv)) = '|';
- else if ((PerlIO*)rsfp == PerlIO_stdin())
+ else if ((PerlIO*)PL_rsfp == PerlIO_stdin())
IoTYPE(GvIOp(gv)) = '-';
else
IoTYPE(GvIOp(gv)) = '<';
- rsfp = Nullfp;
+ PL_rsfp = Nullfp;
}
goto fake_eof;
}
case KEY_BEGIN:
case KEY_END:
case KEY_INIT:
- if (expect == XSTATE) {
- s = bufptr;
+ if (PL_expect == XSTATE) {
+ s = PL_bufptr;
goto really_sub;
}
goto just_a_word;
if (*s == ':' && s[1] == ':') {
s += 2;
d = s;
- s = scan_word(s, tokenbuf, sizeof tokenbuf, FALSE, &len);
- tmp = keyword(tokenbuf, len);
+ s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len);
+ tmp = keyword(PL_tokenbuf, len);
if (tmp < 0)
tmp = -tmp;
goto reserved_word;
LOP(OP_CRYPT,XTERM);
case KEY_chmod:
- if (dowarn) {
- for (d = s; d < bufend && (isSPACE(*d) || *d == '('); d++) ;
+ if (PL_dowarn) {
+ for (d = s; d < PL_bufend && (isSPACE(*d) || *d == '('); d++) ;
if (*d != '0' && isDIGIT(*d))
yywarn("chmod: mode argument is missing initial 0");
}
OPERATOR(DO);
case KEY_die:
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
LOP(OP_DIE,XTERM);
case KEY_defined:
PREBLOCK(ELSE);
case KEY_elsif:
- yylval.ival = curcop->cop_line;
+ yylval.ival = PL_curcop->cop_line;
OPERATOR(ELSIF);
case KEY_eq:
case KEY_eval:
s = skipspace(s);
- expect = (*s == '{') ? XTERMBLOCK : XTERM;
+ PL_expect = (*s == '{') ? XTERMBLOCK : XTERM;
UNIBRACK(OP_ENTEREVAL);
case KEY_eof:
case KEY_for:
case KEY_foreach:
- yylval.ival = curcop->cop_line;
+ yylval.ival = PL_curcop->cop_line;
s = skipspace(s);
- if (expect == XSTATE && isIDFIRST(*s)) {
+ if (PL_expect == XSTATE && isIDFIRST(*s)) {
char *p = s;
- if ((bufend - p) >= 3 &&
+ if ((PL_bufend - p) >= 3 &&
strnEQ(p, "my", 2) && isSPACE(*(p + 2)))
p += 2;
p = skipspace(p);
UNI(OP_HEX);
case KEY_if:
- yylval.ival = curcop->cop_line;
+ yylval.ival = PL_curcop->cop_line;
OPERATOR(IF);
case KEY_index:
LOP(OP_MSGSND,XTERM);
case KEY_my:
- in_my = TRUE;
+ PL_in_my = TRUE;
s = skipspace(s);
if (isIDFIRST(*s)) {
- s = scan_word(s, tokenbuf, sizeof tokenbuf, TRUE, &len);
- in_my_stash = gv_stashpv(tokenbuf, FALSE);
- if (!in_my_stash) {
+ s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len);
+ PL_in_my_stash = gv_stashpv(PL_tokenbuf, FALSE);
+ if (!PL_in_my_stash) {
char tmpbuf[1024];
- bufptr = s;
- sprintf(tmpbuf, "No such class %.1000s", tokenbuf);
+ PL_bufptr = s;
+ sprintf(tmpbuf, "No such class %.1000s", PL_tokenbuf);
yyerror(tmpbuf);
}
}
Eop(OP_SNE);
case KEY_no:
- if (expect != XSTATE)
+ if (PL_expect != XSTATE)
yyerror("\"no\" not allowed in expression");
s = force_word(s,WORD,FALSE,TRUE,FALSE);
s = force_version(s);
LOP(OP_OPEN_DIR,XTERM);
case KEY_print:
- checkcomma(s,tokenbuf,"filehandle");
+ checkcomma(s,PL_tokenbuf,"filehandle");
LOP(OP_PRINT,XREF);
case KEY_printf:
- checkcomma(s,tokenbuf,"filehandle");
+ checkcomma(s,PL_tokenbuf,"filehandle");
LOP(OP_PRTF,XREF);
case KEY_prototype:
s = scan_str(s);
if (!s)
missingterm((char*)0);
- if (dowarn && SvLEN(lex_stuff)) {
- d = SvPV_force(lex_stuff, len);
+ if (PL_dowarn && SvLEN(PL_lex_stuff)) {
+ d = SvPV_force(PL_lex_stuff, len);
for (; len; --len, ++d) {
if (*d == ',') {
warn("Possible attempt to separate words with commas");
}
}
force_next(')');
- nextval[nexttoke].opval = (OP*)newSVOP(OP_CONST, 0, tokeq(lex_stuff));
- lex_stuff = Nullsv;
+ PL_nextval[PL_nexttoke].opval = (OP*)newSVOP(OP_CONST, 0, tokeq(PL_lex_stuff));
+ PL_lex_stuff = Nullsv;
force_next(THING);
force_next(',');
- nextval[nexttoke].opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(" ",1));
+ PL_nextval[PL_nexttoke].opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(" ",1));
force_next(THING);
force_next('(');
yylval.ival = OP_SPLIT;
CLINE;
- expect = XTERM;
- bufptr = s;
- last_lop = oldbufptr;
- last_lop_op = OP_SPLIT;
+ PL_expect = XTERM;
+ PL_bufptr = s;
+ PL_last_lop = PL_oldbufptr;
+ PL_last_lop_op = OP_SPLIT;
return FUNC;
case KEY_qq:
if (!s)
missingterm((char*)0);
yylval.ival = OP_STRINGIFY;
- if (SvIVX(lex_stuff) == '\'')
- SvIVX(lex_stuff) = 0; /* qq'$foo' should intepolate */
+ if (SvIVX(PL_lex_stuff) == '\'')
+ SvIVX(PL_lex_stuff) = 0; /* qq'$foo' should intepolate */
TERM(sublex_start());
case KEY_qr:
OLDLOP(OP_RETURN);
case KEY_require:
- *tokenbuf = '\0';
+ *PL_tokenbuf = '\0';
s = force_word(s,WORD,TRUE,TRUE,FALSE);
- if (isIDFIRST(*tokenbuf))
- gv_stashpvn(tokenbuf, strlen(tokenbuf), TRUE);
+ if (isIDFIRST(*PL_tokenbuf))
+ gv_stashpvn(PL_tokenbuf, strlen(PL_tokenbuf), TRUE);
else if (*s == '<')
yyerror("<> should be quotes");
UNI(OP_REQUIRE);
LOP(OP_SOCKPAIR,XTERM);
case KEY_sort:
- checkcomma(s,tokenbuf,"subroutine name");
+ checkcomma(s,PL_tokenbuf,"subroutine name");
s = skipspace(s);
if (*s == ';' || *s == ')') /* probably a close */
croak("sort is now a reserved word");
- expect = XTERM;
+ PL_expect = XTERM;
s = force_word(s,WORD,TRUE,TRUE,FALSE);
LOP(OP_SORT,XREF);
UNI(OP_STAT);
case KEY_study:
- sawstudy++;
+ PL_sawstudy++;
UNI(OP_STUDY);
case KEY_substr:
s = skipspace(s);
if (isIDFIRST(*s) || *s == '\'' || *s == ':') {
- char tmpbuf[sizeof tokenbuf];
- expect = XBLOCK;
+ char tmpbuf[sizeof PL_tokenbuf];
+ PL_expect = XBLOCK;
d = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len);
if (strchr(tmpbuf, ':'))
- sv_setpv(subname, tmpbuf);
+ sv_setpv(PL_subname, tmpbuf);
else {
- sv_setsv(subname,curstname);
- sv_catpvn(subname,"::",2);
- sv_catpvn(subname,tmpbuf,len);
+ sv_setsv(PL_subname,PL_curstname);
+ sv_catpvn(PL_subname,"::",2);
+ sv_catpvn(PL_subname,tmpbuf,len);
}
s = force_word(s,WORD,FALSE,TRUE,TRUE);
s = skipspace(s);
}
else {
- expect = XTERMBLOCK;
- sv_setpv(subname,"?");
+ PL_expect = XTERMBLOCK;
+ sv_setpv(PL_subname,"?");
}
if (tmp == KEY_format) {
s = skipspace(s);
if (*s == '=')
- lex_formbrack = lex_brackets + 1;
+ PL_lex_formbrack = PL_lex_brackets + 1;
OPERATOR(FORMAT);
}
s = scan_str(s);
if (!s) {
- if (lex_stuff)
- SvREFCNT_dec(lex_stuff);
- lex_stuff = Nullsv;
+ if (PL_lex_stuff)
+ SvREFCNT_dec(PL_lex_stuff);
+ PL_lex_stuff = Nullsv;
croak("Prototype not terminated");
}
/* strip spaces */
- d = SvPVX(lex_stuff);
+ d = SvPVX(PL_lex_stuff);
tmp = 0;
for (p = d; *p; ++p) {
if (!isSPACE(*p))
d[tmp++] = *p;
}
d[tmp] = '\0';
- SvCUR(lex_stuff) = tmp;
-
- nexttoke++;
- nextval[1] = nextval[0];
- nexttype[1] = nexttype[0];
- nextval[0].opval = (OP*)newSVOP(OP_CONST, 0, lex_stuff);
- nexttype[0] = THING;
- if (nexttoke == 1) {
- lex_defer = lex_state;
- lex_expect = expect;
- lex_state = LEX_KNOWNEXT;
+ SvCUR(PL_lex_stuff) = tmp;
+
+ PL_nexttoke++;
+ PL_nextval[1] = PL_nextval[0];
+ PL_nexttype[1] = PL_nexttype[0];
+ PL_nextval[0].opval = (OP*)newSVOP(OP_CONST, 0, PL_lex_stuff);
+ PL_nexttype[0] = THING;
+ if (PL_nexttoke == 1) {
+ PL_lex_defer = PL_lex_state;
+ PL_lex_expect = PL_expect;
+ PL_lex_state = LEX_KNOWNEXT;
}
- lex_stuff = Nullsv;
+ PL_lex_stuff = Nullsv;
}
- if (*SvPV(subname,na) == '?') {
- sv_setpv(subname,"__ANON__");
+ if (*SvPV(PL_subname,PL_na) == '?') {
+ sv_setpv(PL_subname,"__ANON__");
TOKEN(ANONSUB);
}
PREBLOCK(SUB);
UNI(OP_UNTIE);
case KEY_until:
- yylval.ival = curcop->cop_line;
+ yylval.ival = PL_curcop->cop_line;
OPERATOR(UNTIL);
case KEY_unless:
- yylval.ival = curcop->cop_line;
+ yylval.ival = PL_curcop->cop_line;
OPERATOR(UNLESS);
case KEY_unlink:
LOP(OP_UTIME,XTERM);
case KEY_umask:
- if (dowarn) {
- for (d = s; d < bufend && (isSPACE(*d) || *d == '('); d++) ;
+ if (PL_dowarn) {
+ for (d = s; d < PL_bufend && (isSPACE(*d) || *d == '('); d++) ;
if (*d != '0' && isDIGIT(*d))
yywarn("umask: argument is missing initial 0");
}
LOP(OP_UNSHIFT,XTERM);
case KEY_use:
- if (expect != XSTATE)
+ if (PL_expect != XSTATE)
yyerror("\"use\" not allowed in expression");
s = skipspace(s);
if(isDIGIT(*s)) {
s = force_version(s);
if(*s == ';' || (s = skipspace(s), *s == ';')) {
- nextval[nexttoke].opval = Nullop;
+ PL_nextval[PL_nexttoke].opval = Nullop;
force_next(WORD);
}
}
UNI(OP_VALUES);
case KEY_vec:
- sawvec = TRUE;
+ PL_sawvec = TRUE;
LOP(OP_VEC,XTERM);
case KEY_while:
- yylval.ival = curcop->cop_line;
+ yylval.ival = PL_curcop->cop_line;
OPERATOR(WHILE);
case KEY_warn:
- hints |= HINT_BLOCK_SCOPE;
+ PL_hints |= HINT_BLOCK_SCOPE;
LOP(OP_WARN,XTERM);
case KEY_wait:
UNI(OP_ENTERWRITE);
case KEY_x:
- if (expect == XOPERATOR)
+ if (PL_expect == XOPERATOR)
Mop(OP_REPEAT);
check_uni();
goto just_a_word;
{
char *w;
- if (dowarn && *s == ' ' && s[1] == '(') { /* XXX gotta be a better way */
+ if (PL_dowarn && *s == ' ' && s[1] == '(') { /* XXX gotta be a better way */
int level = 1;
for (w = s+2; *w && level; w++) {
if (*w == '(')
if (!*w || !strchr(";|})]oaiuw!=", *w)) /* an advisory hack only... */
warn("%s (...) interpreted as function",name);
}
- while (s < bufend && isSPACE(*s))
+ while (s < PL_bufend && isSPACE(*s))
s++;
if (*s == '(')
s++;
- while (s < bufend && isSPACE(*s))
+ while (s < PL_bufend && isSPACE(*s))
s++;
if (isIDFIRST(*s)) {
w = s++;
while (isALNUM(*s))
s++;
- while (s < bufend && isSPACE(*s))
+ while (s < PL_bufend && isSPACE(*s))
s++;
if (*s == ',') {
int kw;
new_constant(char *s, STRLEN len, char *key, SV *sv, SV *pv, char *type)
{
dSP;
- HV *table = GvHV(hintgv); /* ^H */
+ HV *table = GvHV(PL_hintgv); /* ^H */
BINOP myop;
SV *res;
bool oldcatch = CATCH_GET;
if (type)
typesv = sv_2mortal(newSVpv(type, 0));
else
- typesv = &sv_undef;
+ typesv = &PL_sv_undef;
CATCH_SET(TRUE);
Zero(&myop, 1, BINOP);
myop.op_last = (OP *) &myop;
ENTER;
SAVEOP();
op = (OP *) &myop;
- if (PERLDB_SUB && curstash != debstash)
+ if (PERLDB_SUB && PL_curstash != PL_debstash)
op->op_private |= OPpENTERSUB_DB;
PUTBACK;
pp_pushmark(ARGS);
char *bracket = 0;
char funny = *s++;
- if (lex_brackets == 0)
- lex_fakebrack = 0;
+ if (PL_lex_brackets == 0)
+ PL_lex_fakebrack = 0;
if (isSPACE(*s))
s = skipspace(s);
d = dest;
*d = '\0';
d = dest;
if (*d) {
- if (lex_state != LEX_NORMAL)
- lex_state = LEX_INTERPENDMAYBE;
+ if (PL_lex_state != LEX_NORMAL)
+ PL_lex_state = LEX_INTERPENDMAYBE;
return s;
}
if (*s == '$' && s[1] &&
(isALNUM(s[1]) || strchr("${", s[1]) || strnEQ(s+1,"::",2)) )
{
- if (isDIGIT(s[1]) && lex_state == LEX_INTERPNORMAL)
+ if (isDIGIT(s[1]) && PL_lex_state == LEX_INTERPNORMAL)
deprecate("\"$$<digit>\" to mean \"${$}<digit>\"");
else
return s;
*d = '\0';
while (s < send && (*s == ' ' || *s == '\t')) s++;
if ((*s == '[' || (*s == '{' && strNE(dest, "sub")))) {
- if (dowarn && keyword(dest, d - dest)) {
+ if (PL_dowarn && keyword(dest, d - dest)) {
char *brack = *s == '[' ? "[...]" : "{...}";
warn("Ambiguous use of %c{%s%s} resolved to %c%s%s",
funny, dest, brack, funny, dest, brack);
}
- lex_fakebrack = lex_brackets+1;
+ PL_lex_fakebrack = PL_lex_brackets+1;
bracket++;
- lex_brackstack[lex_brackets++] = XOPERATOR;
+ PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
return s;
}
}
if (*s == '}') {
s++;
- if (lex_state == LEX_INTERPNORMAL && !lex_brackets)
- lex_state = LEX_INTERPEND;
+ if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets)
+ PL_lex_state = LEX_INTERPEND;
if (funny == '#')
funny = '@';
- if (dowarn && lex_state == LEX_NORMAL &&
+ if (PL_dowarn && PL_lex_state == LEX_NORMAL &&
(keyword(dest, d - dest) || perl_get_cv(dest, FALSE)))
warn("Ambiguous use of %c{%s} resolved to %c%s",
funny, dest, funny, dest);
*dest = '\0';
}
}
- else if (lex_state == LEX_INTERPNORMAL && !lex_brackets && !intuit_more(s))
- lex_state = LEX_INTERPEND;
+ else if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets && !intuit_more(s))
+ PL_lex_state = LEX_INTERPEND;
return s;
}
s = scan_str(start);
if (!s) {
- if (lex_stuff)
- SvREFCNT_dec(lex_stuff);
- lex_stuff = Nullsv;
+ if (PL_lex_stuff)
+ SvREFCNT_dec(PL_lex_stuff);
+ PL_lex_stuff = Nullsv;
croak("Search pattern not terminated");
}
pm = (PMOP*)newPMOP(type, 0);
- if (multi_open == '?')
+ if (PL_multi_open == '?')
pm->op_pmflags |= PMf_ONCE;
if(type == OP_QR) {
while (*s && strchr("iomsx", *s))
}
pm->op_pmpermflags = pm->op_pmflags;
- lex_op = (OP*)pm;
+ PL_lex_op = (OP*)pm;
yylval.ival = OP_MATCH;
return s;
}
s = scan_str(start);
if (!s) {
- if (lex_stuff)
- SvREFCNT_dec(lex_stuff);
- lex_stuff = Nullsv;
+ if (PL_lex_stuff)
+ SvREFCNT_dec(PL_lex_stuff);
+ PL_lex_stuff = Nullsv;
croak("Substitution pattern not terminated");
}
- if (s[-1] == multi_open)
+ if (s[-1] == PL_multi_open)
s--;
- first_start = multi_start;
+ first_start = PL_multi_start;
s = scan_str(s);
if (!s) {
- if (lex_stuff)
- SvREFCNT_dec(lex_stuff);
- lex_stuff = Nullsv;
- if (lex_repl)
- SvREFCNT_dec(lex_repl);
- lex_repl = Nullsv;
+ if (PL_lex_stuff)
+ SvREFCNT_dec(PL_lex_stuff);
+ PL_lex_stuff = Nullsv;
+ if (PL_lex_repl)
+ SvREFCNT_dec(PL_lex_repl);
+ PL_lex_repl = Nullsv;
croak("Substitution replacement not terminated");
}
- multi_start = first_start; /* so whole substitution is taken together */
+ PL_multi_start = first_start; /* so whole substitution is taken together */
pm = (PMOP*)newPMOP(OP_SUBST, 0);
while (*s) {
while (es-- > 0)
sv_catpv(repl, es ? "eval " : "do ");
sv_catpvn(repl, "{ ", 2);
- sv_catsv(repl, lex_repl);
+ sv_catsv(repl, PL_lex_repl);
sv_catpvn(repl, " };", 2);
SvCOMPILED_on(repl);
- SvREFCNT_dec(lex_repl);
- lex_repl = repl;
+ SvREFCNT_dec(PL_lex_repl);
+ PL_lex_repl = repl;
}
pm->op_pmpermflags = pm->op_pmflags;
- lex_op = (OP*)pm;
+ PL_lex_op = (OP*)pm;
yylval.ival = OP_SUBST;
return s;
}
s = scan_str(start);
if (!s) {
- if (lex_stuff)
- SvREFCNT_dec(lex_stuff);
- lex_stuff = Nullsv;
+ if (PL_lex_stuff)
+ SvREFCNT_dec(PL_lex_stuff);
+ PL_lex_stuff = Nullsv;
croak("Transliteration pattern not terminated");
}
- if (s[-1] == multi_open)
+ if (s[-1] == PL_multi_open)
s--;
s = scan_str(s);
if (!s) {
- if (lex_stuff)
- SvREFCNT_dec(lex_stuff);
- lex_stuff = Nullsv;
- if (lex_repl)
- SvREFCNT_dec(lex_repl);
- lex_repl = Nullsv;
+ if (PL_lex_stuff)
+ SvREFCNT_dec(PL_lex_stuff);
+ PL_lex_stuff = Nullsv;
+ if (PL_lex_repl)
+ SvREFCNT_dec(PL_lex_repl);
+ PL_lex_repl = Nullsv;
croak("Transliteration replacement not terminated");
}
}
o->op_private = Delete|squash|complement;
- lex_op = o;
+ PL_lex_op = o;
yylval.ival = OP_TRANS;
return s;
}
register char *d;
register char *e;
char *peek;
- int outer = (rsfp && !(lex_inwhat == OP_SCALAR));
+ int outer = (PL_rsfp && !(PL_lex_inwhat == OP_SCALAR));
s += 2;
- d = tokenbuf;
- e = tokenbuf + sizeof tokenbuf - 1;
+ d = PL_tokenbuf;
+ e = PL_tokenbuf + sizeof PL_tokenbuf - 1;
if (!outer)
*d++ = '\n';
for (peek = s; *peek == ' ' || *peek == '\t'; peek++) ;
if (*peek && strchr("`'\"",*peek)) {
s = peek;
term = *s++;
- s = delimcpy(d, e, s, bufend, term, &len);
+ s = delimcpy(d, e, s, PL_bufend, term, &len);
d += len;
- if (s < bufend)
+ if (s < PL_bufend)
s++;
}
else {
*d++ = *s;
}
}
- if (d >= tokenbuf + sizeof tokenbuf - 1)
+ if (d >= PL_tokenbuf + sizeof PL_tokenbuf - 1)
croak("Delimiter for here document is too long");
*d++ = '\n';
*d = '\0';
- len = d - tokenbuf;
+ len = d - PL_tokenbuf;
#ifdef TMP_CRLF_PATCH
d = strchr(s, '\r');
if (d) {
char *olds = s;
s = d;
- while (s < bufend) {
+ while (s < PL_bufend) {
if (*s == '\r') {
*d++ = '\n';
if (*++s == '\n')
*d++ = *s++;
}
*d = '\0';
- bufend = d;
- SvCUR_set(linestr, bufend - SvPVX(linestr));
+ PL_bufend = d;
+ SvCUR_set(PL_linestr, PL_bufend - SvPVX(PL_linestr));
s = olds;
}
#endif
d = "\n";
- if (outer || !(d=ninstr(s,bufend,d,d+1)))
- herewas = newSVpv(s,bufend-s);
+ if (outer || !(d=ninstr(s,PL_bufend,d,d+1)))
+ herewas = newSVpv(s,PL_bufend-s);
else
s--, herewas = newSVpv(s,d-s);
s += SvCUR(herewas);
}
CLINE;
- multi_start = curcop->cop_line;
- multi_open = multi_close = '<';
- term = *tokenbuf;
+ PL_multi_start = PL_curcop->cop_line;
+ PL_multi_open = PL_multi_close = '<';
+ term = *PL_tokenbuf;
if (!outer) {
d = s;
- while (s < bufend &&
- (*s != term || memNE(s,tokenbuf,len)) ) {
+ while (s < PL_bufend &&
+ (*s != term || memNE(s,PL_tokenbuf,len)) ) {
if (*s++ == '\n')
- curcop->cop_line++;
+ PL_curcop->cop_line++;
}
- if (s >= bufend) {
- curcop->cop_line = multi_start;
- missingterm(tokenbuf);
+ if (s >= PL_bufend) {
+ PL_curcop->cop_line = PL_multi_start;
+ missingterm(PL_tokenbuf);
}
sv_setpvn(tmpstr,d+1,s-d);
s += len - 1;
- curcop->cop_line++; /* the preceding stmt passes a newline */
+ PL_curcop->cop_line++; /* the preceding stmt passes a newline */
- sv_catpvn(herewas,s,bufend-s);
- sv_setsv(linestr,herewas);
- oldoldbufptr = oldbufptr = bufptr = s = linestart = SvPVX(linestr);
- bufend = SvPVX(linestr) + SvCUR(linestr);
+ sv_catpvn(herewas,s,PL_bufend-s);
+ sv_setsv(PL_linestr,herewas);
+ PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = s = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
}
else
sv_setpvn(tmpstr,"",0); /* avoid "uninitialized" warning */
- while (s >= bufend) { /* multiple line string? */
+ while (s >= PL_bufend) { /* multiple line string? */
if (!outer ||
- !(oldoldbufptr = oldbufptr = s = linestart = filter_gets(linestr, rsfp, 0))) {
- curcop->cop_line = multi_start;
- missingterm(tokenbuf);
+ !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = filter_gets(PL_linestr, PL_rsfp, 0))) {
+ PL_curcop->cop_line = PL_multi_start;
+ missingterm(PL_tokenbuf);
}
- curcop->cop_line++;
- bufend = SvPVX(linestr) + SvCUR(linestr);
+ PL_curcop->cop_line++;
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
#ifdef TMP_CRLF_PATCH
- if (bufend - linestart >= 2) {
- if (bufend[-2] == '\r' || bufend[-2] == '\n') {
- bufend[-2] = '\n';
- bufend--;
- SvCUR_set(linestr, bufend - SvPVX(linestr));
+ if (PL_bufend - PL_linestart >= 2) {
+ if (PL_bufend[-2] == '\r' || PL_bufend[-2] == '\n') {
+ PL_bufend[-2] = '\n';
+ PL_bufend--;
+ SvCUR_set(PL_linestr, PL_bufend - SvPVX(PL_linestr));
}
- else if (bufend[-1] == '\r')
- bufend[-1] = '\n';
+ else if (PL_bufend[-1] == '\r')
+ PL_bufend[-1] = '\n';
}
- else if (bufend - linestart == 1 && bufend[-1] == '\r')
- bufend[-1] = '\n';
+ else if (PL_bufend - PL_linestart == 1 && PL_bufend[-1] == '\r')
+ PL_bufend[-1] = '\n';
#endif
- if (PERLDB_LINE && curstash != debstash) {
+ if (PERLDB_LINE && PL_curstash != PL_debstash) {
SV *sv = NEWSV(88,0);
sv_upgrade(sv, SVt_PVMG);
- sv_setsv(sv,linestr);
- av_store(GvAV(curcop->cop_filegv),
- (I32)curcop->cop_line,sv);
+ sv_setsv(sv,PL_linestr);
+ av_store(GvAV(PL_curcop->cop_filegv),
+ (I32)PL_curcop->cop_line,sv);
}
- if (*s == term && memEQ(s,tokenbuf,len)) {
- s = bufend - 1;
+ if (*s == term && memEQ(s,PL_tokenbuf,len)) {
+ s = PL_bufend - 1;
*s = ' ';
- sv_catsv(linestr,herewas);
- bufend = SvPVX(linestr) + SvCUR(linestr);
+ sv_catsv(PL_linestr,herewas);
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
}
else {
- s = bufend;
- sv_catsv(tmpstr,linestr);
+ s = PL_bufend;
+ sv_catsv(tmpstr,PL_linestr);
}
}
- multi_end = curcop->cop_line;
+ PL_multi_end = PL_curcop->cop_line;
s++;
if (SvCUR(tmpstr) + 5 < SvLEN(tmpstr)) {
SvLEN_set(tmpstr, SvCUR(tmpstr) + 1);
Renew(SvPVX(tmpstr), SvLEN(tmpstr), char);
}
SvREFCNT_dec(herewas);
- lex_stuff = tmpstr;
+ PL_lex_stuff = tmpstr;
yylval.ival = op_type;
return s;
}
register char *e;
I32 len;
- d = tokenbuf; /* start of temp holding space */
- e = tokenbuf + sizeof tokenbuf; /* end of temp holding space */
- s = delimcpy(d, e, s + 1, bufend, '>', &len); /* extract until > */
+ d = PL_tokenbuf; /* start of temp holding space */
+ e = PL_tokenbuf + sizeof PL_tokenbuf; /* end of temp holding space */
+ s = delimcpy(d, e, s + 1, PL_bufend, '>', &len); /* extract until > */
/* die if we didn't have space for the contents of the <>,
or if it didn't end
*/
- if (len >= sizeof tokenbuf)
+ if (len >= sizeof PL_tokenbuf)
croak("Excessively long <> operator");
- if (s >= bufend)
+ if (s >= PL_bufend)
croak("Unterminated <> operator");
s++;
as nothing more than a string.
*/
- if (d - tokenbuf != len) {
+ if (d - PL_tokenbuf != len) {
yylval.ival = OP_GLOB;
set_csh();
s = scan_str(start);
}
else {
/* we're in a filehandle read situation */
- d = tokenbuf;
+ d = PL_tokenbuf;
/* turn <> into <ARGV> */
if (!len)
if ((tmp = pad_findmy(d)) != NOT_IN_PAD) {
OP *o = newOP(OP_PADSV, 0);
o->op_targ = tmp;
- lex_op = (OP*)newUNOP(OP_READLINE, 0, newUNOP(OP_RV2GV, 0, o));
+ PL_lex_op = (OP*)newUNOP(OP_READLINE, 0, newUNOP(OP_RV2GV, 0, o));
}
else {
GV *gv = gv_fetchpv(d+1,TRUE, SVt_PV);
- lex_op = (OP*)newUNOP(OP_READLINE, 0,
+ PL_lex_op = (OP*)newUNOP(OP_READLINE, 0,
newUNOP(OP_RV2GV, 0,
newUNOP(OP_RV2SV, 0,
newGVOP(OP_GV, 0, gv))));
(<Foo::BAR> or <FOO>) so build a simple readline OP */
else {
GV *gv = gv_fetchpv(d,TRUE, SVt_PVIO);
- lex_op = (OP*)newUNOP(OP_READLINE, 0, newGVOP(OP_GV, 0, gv));
+ PL_lex_op = (OP*)newUNOP(OP_READLINE, 0, newGVOP(OP_GV, 0, gv));
yylval.ival = OP_NULL;
}
}
/* after skipping whitespace, the next character is the terminator */
term = *s;
/* mark where we are */
- multi_start = curcop->cop_line;
- multi_open = term;
+ PL_multi_start = PL_curcop->cop_line;
+ PL_multi_open = term;
/* find corresponding closing delimiter */
if (term && (tmps = strchr("([{< )]}> )]}>",term)))
term = tmps[5];
- multi_close = term;
+ PL_multi_close = term;
/* create a new SV to hold the contents. 87 is leak category, I'm
assuming. 79 is the SV's initial length. What a random number. */
s++;
for (;;) {
/* extend sv if need be */
- SvGROW(sv, SvCUR(sv) + (bufend - s) + 1);
+ SvGROW(sv, SvCUR(sv) + (PL_bufend - s) + 1);
/* set 'to' to the next character in the sv's string */
to = SvPVX(sv)+SvCUR(sv);
/* if open delimiter is the close delimiter read unbridle */
- if (multi_open == multi_close) {
- for (; s < bufend; s++,to++) {
+ if (PL_multi_open == PL_multi_close) {
+ for (; s < PL_bufend; s++,to++) {
/* embedded newlines increment the current line number */
- if (*s == '\n' && !rsfp)
- curcop->cop_line++;
+ if (*s == '\n' && !PL_rsfp)
+ PL_curcop->cop_line++;
/* handle quoted delimiters */
- if (*s == '\\' && s+1 < bufend && term != '\\') {
+ if (*s == '\\' && s+1 < PL_bufend && term != '\\') {
if (s[1] == term)
s++;
/* any other quotes are simply copied straight through */
*/
else {
/* read until we run out of string, or we find the terminator */
- for (; s < bufend; s++,to++) {
+ for (; s < PL_bufend; s++,to++) {
/* embedded newlines increment the line count */
- if (*s == '\n' && !rsfp)
- curcop->cop_line++;
+ if (*s == '\n' && !PL_rsfp)
+ PL_curcop->cop_line++;
/* backslashes can escape the open or closing characters */
- if (*s == '\\' && s+1 < bufend) {
- if ((s[1] == multi_open) || (s[1] == multi_close))
+ if (*s == '\\' && s+1 < PL_bufend) {
+ if ((s[1] == PL_multi_open) || (s[1] == PL_multi_close))
s++;
else
*to++ = *s++;
}
/* allow nested opens and closes */
- else if (*s == multi_close && --brackets <= 0)
+ else if (*s == PL_multi_close && --brackets <= 0)
break;
- else if (*s == multi_open)
+ else if (*s == PL_multi_open)
brackets++;
*to = *s;
}
* this next chunk reads more into the buffer if we're not done yet
*/
- if (s < bufend) break; /* handle case where we are done yet :-) */
+ if (s < PL_bufend) break; /* handle case where we are done yet :-) */
#ifdef TMP_CRLF_PATCH
if (to - SvPVX(sv) >= 2) {
/* if we're out of file, or a read fails, bail and reset the current
line marker so we can report where the unterminated string began
*/
- if (!rsfp ||
- !(oldoldbufptr = oldbufptr = s = linestart = filter_gets(linestr, rsfp, 0))) {
+ if (!PL_rsfp ||
+ !(PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = filter_gets(PL_linestr, PL_rsfp, 0))) {
sv_free(sv);
- curcop->cop_line = multi_start;
+ PL_curcop->cop_line = PL_multi_start;
return Nullch;
}
/* we read a line, so increment our line counter */
- curcop->cop_line++;
+ PL_curcop->cop_line++;
/* update debugger info */
- if (PERLDB_LINE && curstash != debstash) {
+ if (PERLDB_LINE && PL_curstash != PL_debstash) {
SV *sv = NEWSV(88,0);
sv_upgrade(sv, SVt_PVMG);
- sv_setsv(sv,linestr);
- av_store(GvAV(curcop->cop_filegv),
- (I32)curcop->cop_line, sv);
+ sv_setsv(sv,PL_linestr);
+ av_store(GvAV(PL_curcop->cop_filegv),
+ (I32)PL_curcop->cop_line, sv);
}
- /* having changed the buffer, we must update bufend */
- bufend = SvPVX(linestr) + SvCUR(linestr);
+ /* having changed the buffer, we must update PL_bufend */
+ PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
}
/* at this point, we have successfully read the delimited string */
- multi_end = curcop->cop_line;
+ PL_multi_end = PL_curcop->cop_line;
s++;
/* if we allocated too much space, give some back */
for this op
*/
- if (lex_stuff)
- lex_repl = sv;
+ if (PL_lex_stuff)
+ PL_lex_repl = sv;
else
- lex_stuff = sv;
+ PL_lex_stuff = sv;
return s;
}
Underbars (_) are allowed in decimal numbers. If -w is on,
underbars before a decimal point must be at three digit intervals.
- Like most scan_ routines, it uses the tokenbuf buffer to hold the
+ Like most scan_ routines, it uses the PL_tokenbuf buffer to hold the
thing it reads.
If it reads a number without a decimal point or an exponent, it will
digit:
n = u << shift; /* make room for the digit */
if (!overflowed && (n >> shift) != u
- && !(hints & HINT_NEW_BINARY)) {
+ && !(PL_hints & HINT_NEW_BINARY)) {
warn("Integer overflow in %s number",
(shift == 4) ? "hex" : "octal");
overflowed = TRUE;
out:
sv = NEWSV(92,0);
sv_setuv(sv, u);
- if ( hints & HINT_NEW_BINARY)
+ if ( PL_hints & HINT_NEW_BINARY)
sv = new_constant(start, s - start, "binary", sv, Nullsv, NULL);
}
break;
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case '.':
decimal:
- d = tokenbuf;
- e = tokenbuf + sizeof tokenbuf - 6; /* room for various punctuation */
+ d = PL_tokenbuf;
+ e = PL_tokenbuf + sizeof PL_tokenbuf - 6; /* room for various punctuation */
floatit = FALSE;
/* read next group of digits and _ and copy into d */
if -w is on
*/
if (*s == '_') {
- if (dowarn && lastub && s - lastub != 3)
+ if (PL_dowarn && lastub && s - lastub != 3)
warn("Misplaced _ in number");
lastub = ++s;
}
}
/* final misplaced underbar check */
- if (dowarn && lastub && s - lastub != 3)
+ if (PL_dowarn && lastub && s - lastub != 3)
warn("Misplaced _ in number");
/* read a decimal portion if there is one. avoid
sv = NEWSV(92,0);
/* reset numeric locale in case we were earlier left in Swaziland */
SET_NUMERIC_STANDARD();
- value = atof(tokenbuf);
+ value = atof(PL_tokenbuf);
/*
See if we can make do with an integer value without loss of
sv_setiv(sv, tryiv);
else
sv_setnv(sv, value);
- if ( floatit ? (hints & HINT_NEW_FLOAT) : (hints & HINT_NEW_INTEGER) )
- sv = new_constant(tokenbuf, d - tokenbuf,
+ if ( floatit ? (PL_hints & HINT_NEW_FLOAT) : (PL_hints & HINT_NEW_INTEGER) )
+ sv = new_constant(PL_tokenbuf, d - PL_tokenbuf,
(floatit ? "float" : "integer"), sv, Nullsv, NULL);
break;
}
if (*t == '\n')
break;
}
- if (in_eval && !rsfp) {
+ if (PL_in_eval && !PL_rsfp) {
eol = strchr(s,'\n');
if (!eol++)
- eol = bufend;
+ eol = PL_bufend;
}
else
- eol = bufend = SvPVX(linestr) + SvCUR(linestr);
+ eol = PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
if (*s != '#') {
for (t = s; t < eol; t++) {
if (*t == '~' && t[1] == '~' && SvCUR(stuff)) {
sv_catpvn(stuff, s, eol-s);
}
s = eol;
- if (rsfp) {
- s = filter_gets(linestr, rsfp, 0);
- oldoldbufptr = oldbufptr = bufptr = linestart = SvPVX(linestr);
- bufend = bufptr + SvCUR(linestr);
+ if (PL_rsfp) {
+ s = filter_gets(PL_linestr, PL_rsfp, 0);
+ PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr);
+ PL_bufend = PL_bufptr + SvCUR(PL_linestr);
if (!s) {
- s = bufptr;
+ s = PL_bufptr;
yyerror("Format not terminated");
break;
}
}
enough:
if (SvCUR(stuff)) {
- expect = XTERM;
+ PL_expect = XTERM;
if (needargs) {
- lex_state = LEX_NORMAL;
- nextval[nexttoke].ival = 0;
+ PL_lex_state = LEX_NORMAL;
+ PL_nextval[PL_nexttoke].ival = 0;
force_next(',');
}
else
- lex_state = LEX_FORMLINE;
- nextval[nexttoke].opval = (OP*)newSVOP(OP_CONST, 0, stuff);
+ PL_lex_state = LEX_FORMLINE;
+ PL_nextval[PL_nexttoke].opval = (OP*)newSVOP(OP_CONST, 0, stuff);
force_next(THING);
- nextval[nexttoke].ival = OP_FORMLINE;
+ PL_nextval[PL_nexttoke].ival = OP_FORMLINE;
force_next(LSTOP);
}
else {
SvREFCNT_dec(stuff);
- lex_formbrack = 0;
- bufptr = s;
+ PL_lex_formbrack = 0;
+ PL_bufptr = s;
}
return s;
}
set_csh(void)
{
#ifdef CSH
- if (!cshlen)
- cshlen = strlen(cshname);
+ if (!PL_cshlen)
+ PL_cshlen = strlen(PL_cshname);
#endif
}
start_subparse(I32 is_format, U32 flags)
{
dTHR;
- I32 oldsavestack_ix = savestack_ix;
- CV* outsidecv = compcv;
+ I32 oldsavestack_ix = PL_savestack_ix;
+ CV* outsidecv = PL_compcv;
AV* comppadlist;
- if (compcv) {
- assert(SvTYPE(compcv) == SVt_PVCV);
+ if (PL_compcv) {
+ assert(SvTYPE(PL_compcv) == SVt_PVCV);
}
- save_I32(&subline);
- save_item(subname);
- SAVEI32(padix);
- SAVESPTR(curpad);
- SAVESPTR(comppad);
- SAVESPTR(comppad_name);
- SAVESPTR(compcv);
- SAVEI32(comppad_name_fill);
- SAVEI32(min_intro_pending);
- SAVEI32(max_intro_pending);
- SAVEI32(pad_reset_pending);
-
- compcv = (CV*)NEWSV(1104,0);
- sv_upgrade((SV *)compcv, is_format ? SVt_PVFM : SVt_PVCV);
- CvFLAGS(compcv) |= flags;
-
- comppad = newAV();
- av_push(comppad, Nullsv);
- curpad = AvARRAY(comppad);
- comppad_name = newAV();
- comppad_name_fill = 0;
- min_intro_pending = 0;
- padix = 0;
- subline = curcop->cop_line;
+ save_I32(&PL_subline);
+ save_item(PL_subname);
+ SAVEI32(PL_padix);
+ SAVESPTR(PL_curpad);
+ SAVESPTR(PL_comppad);
+ SAVESPTR(PL_comppad_name);
+ SAVESPTR(PL_compcv);
+ SAVEI32(PL_comppad_name_fill);
+ SAVEI32(PL_min_intro_pending);
+ SAVEI32(PL_max_intro_pending);
+ SAVEI32(PL_pad_reset_pending);
+
+ PL_compcv = (CV*)NEWSV(1104,0);
+ sv_upgrade((SV *)PL_compcv, is_format ? SVt_PVFM : SVt_PVCV);
+ CvFLAGS(PL_compcv) |= flags;
+
+ PL_comppad = newAV();
+ av_push(PL_comppad, Nullsv);
+ PL_curpad = AvARRAY(PL_comppad);
+ PL_comppad_name = newAV();
+ PL_comppad_name_fill = 0;
+ PL_min_intro_pending = 0;
+ PL_padix = 0;
+ PL_subline = PL_curcop->cop_line;
#ifdef USE_THREADS
av_store(comppad_name, 0, newSVpv("@_", 2));
curpad[0] = (SV*)newAV();
comppadlist = newAV();
AvREAL_off(comppadlist);
- av_store(comppadlist, 0, (SV*)comppad_name);
- av_store(comppadlist, 1, (SV*)comppad);
+ av_store(comppadlist, 0, (SV*)PL_comppad_name);
+ av_store(comppadlist, 1, (SV*)PL_comppad);
- CvPADLIST(compcv) = comppadlist;
- CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc(outsidecv);
+ CvPADLIST(PL_compcv) = comppadlist;
+ CvOUTSIDE(PL_compcv) = (CV*)SvREFCNT_inc(outsidecv);
#ifdef USE_THREADS
CvOWNER(compcv) = 0;
New(666, CvMUTEXP(compcv), 1, perl_mutex);
yywarn(char *s)
{
dTHR;
- --error_count;
- in_eval |= 2;
+ --PL_error_count;
+ PL_in_eval |= 2;
yyerror(s);
- in_eval &= ~2;
+ PL_in_eval &= ~2;
return 0;
}
int contlen = -1;
SV *msg;
- if (!yychar || (yychar == ';' && !rsfp))
+ if (!yychar || (yychar == ';' && !PL_rsfp))
where = "at EOF";
- else if (bufptr > oldoldbufptr && bufptr - oldoldbufptr < 200 &&
- oldoldbufptr != oldbufptr && oldbufptr != bufptr) {
- while (isSPACE(*oldoldbufptr))
- oldoldbufptr++;
- context = oldoldbufptr;
- contlen = bufptr - oldoldbufptr;
+ else if (PL_bufptr > PL_oldoldbufptr && PL_bufptr - PL_oldoldbufptr < 200 &&
+ PL_oldoldbufptr != PL_oldbufptr && PL_oldbufptr != PL_bufptr) {
+ while (isSPACE(*PL_oldoldbufptr))
+ PL_oldoldbufptr++;
+ context = PL_oldoldbufptr;
+ contlen = PL_bufptr - PL_oldoldbufptr;
}
- else if (bufptr > oldbufptr && bufptr - oldbufptr < 200 &&
- oldbufptr != bufptr) {
- while (isSPACE(*oldbufptr))
- oldbufptr++;
- context = oldbufptr;
- contlen = bufptr - oldbufptr;
+ else if (PL_bufptr > PL_oldbufptr && PL_bufptr - PL_oldbufptr < 200 &&
+ PL_oldbufptr != PL_bufptr) {
+ while (isSPACE(*PL_oldbufptr))
+ PL_oldbufptr++;
+ context = PL_oldbufptr;
+ contlen = PL_bufptr - PL_oldbufptr;
}
else if (yychar > 255)
where = "next token ???";
else if ((yychar & 127) == 127) {
- if (lex_state == LEX_NORMAL ||
- (lex_state == LEX_KNOWNEXT && lex_defer == LEX_NORMAL))
+ if (PL_lex_state == LEX_NORMAL ||
+ (PL_lex_state == LEX_KNOWNEXT && PL_lex_defer == LEX_NORMAL))
where = "at end of line";
- else if (lex_inpat)
+ else if (PL_lex_inpat)
where = "within pattern";
else
where = "within string";
}
msg = sv_2mortal(newSVpv(s, 0));
sv_catpvf(msg, " at %_ line %ld, ",
- GvSV(curcop->cop_filegv), (long)curcop->cop_line);
+ GvSV(PL_curcop->cop_filegv), (long)PL_curcop->cop_line);
if (context)
sv_catpvf(msg, "near \"%.*s\"\n", contlen, context);
else
sv_catpvf(msg, "%s\n", where);
- if (multi_start < multi_end && (U32)(curcop->cop_line - multi_end) <= 1) {
+ if (PL_multi_start < PL_multi_end && (U32)(PL_curcop->cop_line - PL_multi_end) <= 1) {
sv_catpvf(msg,
" (Might be a runaway multi-line %c%c string starting on line %ld)\n",
- (int)multi_open,(int)multi_close,(long)multi_start);
- multi_end = 0;
+ (int)PL_multi_open,(int)PL_multi_close,(long)PL_multi_start);
+ PL_multi_end = 0;
}
- if (in_eval & 2)
+ if (PL_in_eval & 2)
warn("%_", msg);
- else if (in_eval)
+ else if (PL_in_eval)
sv_catsv(ERRSV, msg);
else
PerlIO_write(PerlIO_stderr(), SvPVX(msg), SvCUR(msg));
- if (++error_count >= 10)
- croak("%_ has too many errors.\n", GvSV(curcop->cop_filegv));
- in_my = 0;
- in_my_stash = Nullhv;
+ if (++PL_error_count >= 10)
+ croak("%_ has too many errors.\n", GvSV(PL_curcop->cop_filegv));
+ PL_in_my = 0;
+ PL_in_my_stash = Nullhv;
return 0;
}
HV* hv = Nullhv;
if (!stash)
- return &sv_undef;
+ return &PL_sv_undef;
if(strEQ(HvNAME(stash), name))
- return &sv_yes;
+ return &PL_sv_yes;
if (level > 100)
croak("Recursive inheritance detected in package '%s'", HvNAME(stash));
gvp = (GV**)hv_fetch(stash, "::ISA::CACHE::", 14, FALSE);
- if (gvp && (gv = *gvp) != (GV*)&sv_undef && (hv = GvHV(gv))) {
+ if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (hv = GvHV(gv))) {
SV* sv;
SV** svp = (SV**)hv_fetch(hv, name, len, FALSE);
- if (svp && (sv = *svp) != (SV*)&sv_undef)
+ if (svp && (sv = *svp) != (SV*)&PL_sv_undef)
return sv;
}
gvp = (GV**)hv_fetch(stash,"ISA",3,FALSE);
- if (gvp && (gv = *gvp) != (GV*)&sv_undef && (av = GvAV(gv))) {
+ if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (av = GvAV(gv))) {
if(!hv) {
gvp = (GV**)hv_fetch(stash, "::ISA::CACHE::", 14, TRUE);
SV* sv = *svp++;
HV* basestash = gv_stashsv(sv, FALSE);
if (!basestash) {
- if (dowarn)
+ if (PL_dowarn)
warn("Can't locate package %s for @%s::ISA",
SvPVX(sv), HvNAME(stash));
continue;
}
- if(&sv_yes == isa_lookup(basestash, name, len, level + 1)) {
- (void)hv_store(hv,name,len,&sv_yes,0);
- return &sv_yes;
+ if(&PL_sv_yes == isa_lookup(basestash, name, len, level + 1)) {
+ (void)hv_store(hv,name,len,&PL_sv_yes,0);
+ return &PL_sv_yes;
}
}
- (void)hv_store(hv,name,len,&sv_no,0);
+ (void)hv_store(hv,name,len,&PL_sv_no,0);
}
}
}
return (type && strEQ(type,name)) ||
- (stash && isa_lookup(stash, name, strlen(name), 0) == &sv_yes)
+ (stash && isa_lookup(stash, name, strlen(name), 0) == &PL_sv_yes)
? TRUE
: FALSE ;
croak("Usage: UNIVERSAL::isa(reference, kind)");
sv = ST(0);
- name = (char *)SvPV(ST(1),na);
+ name = (char *)SvPV(ST(1),PL_na);
ST(0) = boolSV(sv_derived_from(sv, name));
XSRETURN(1);
croak("Usage: UNIVERSAL::can(object-ref, method)");
sv = ST(0);
- name = (char *)SvPV(ST(1),na);
- rv = &sv_undef;
+ name = (char *)SvPV(ST(1),PL_na);
+ rv = &PL_sv_undef;
if(SvROK(sv)) {
sv = (SV*)SvRV(sv);
gvp = pkg ? (GV**)hv_fetch(pkg,"VERSION",7,FALSE) : Null(GV**);
- if (gvp && (gv = *gvp) != (GV*)&sv_undef && (sv = GvSV(gv))) {
+ if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (sv = GvSV(gv))) {
SV *nsv = sv_newmortal();
sv_setsv(nsv, sv);
sv = nsv;
undef = Nullch;
}
else {
- sv = (SV*)&sv_undef;
+ sv = (SV*)&PL_sv_undef;
undef = "(undef)";
}
if (items > 1 && (undef || (req = SvNV(ST(1)), req > SvNV(sv))))
croak("%s version %s required--this is only version %s",
- HvNAME(pkg), SvPV(ST(1),na), undef ? undef : SvPV(sv,na));
+ HvNAME(pkg), SvPV(ST(1),PL_na), undef ? undef : SvPV(sv,PL_na));
ST(0) = sv;
#endif
ptr = PerlMem_malloc(size?size:1); /* malloc(0) is NASTY on our system */
#if !(defined(I286) || defined(atarist))
- DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%x: (%05d) malloc %ld bytes\n",ptr,an++,(long)size));
+ DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%x: (%05d) malloc %ld bytes\n",ptr,PL_an++,(long)size));
#else
DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) malloc %ld bytes\n",ptr,an++,(long)size));
#endif
if (ptr != Nullch)
return ptr;
- else if (nomemok)
+ else if (PL_nomemok)
return Nullch;
else {
PerlIO_puts(PerlIO_stderr(),no_mem) FLUSH;
#if !(defined(I286) || defined(atarist))
DEBUG_m( {
- PerlIO_printf(Perl_debug_log, "0x%x: (%05d) rfree\n",where,an++);
- PerlIO_printf(Perl_debug_log, "0x%x: (%05d) realloc %ld bytes\n",ptr,an++,(long)size);
+ PerlIO_printf(Perl_debug_log, "0x%x: (%05d) rfree\n",where,PL_an++);
+ PerlIO_printf(Perl_debug_log, "0x%x: (%05d) realloc %ld bytes\n",ptr,PL_an++,(long)size);
} )
#else
DEBUG_m( {
if (ptr != Nullch)
return ptr;
- else if (nomemok)
+ else if (PL_nomemok)
return Nullch;
else {
PerlIO_puts(PerlIO_stderr(),no_mem) FLUSH;
safefree(Malloc_t where)
{
#if !(defined(I286) || defined(atarist))
- DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%x: (%05d) free\n",(char *) where,an++));
+ DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%x: (%05d) free\n",(char *) where,PL_an++));
#else
DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) free\n",(char *) where,an++));
#endif
size *= count;
ptr = PerlMem_malloc(size?size:1); /* malloc(0) is NASTY on our system */
#if !(defined(I286) || defined(atarist))
- DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%x: (%05d) calloc %ld x %ld bytes\n",ptr,an++,(long)count,(long)size));
+ DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%x: (%05d) calloc %ld x %ld bytes\n",ptr,PL_an++,(long)count,(long)size));
#else
DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) calloc %ld x %ld bytes\n",ptr,an++,(long)count,(long)size));
#endif
memset((void*)ptr, 0, size);
return ptr;
}
- else if (nomemok)
+ else if (PL_nomemok)
return Nullch;
else {
PerlIO_puts(PerlIO_stderr(),no_mem) FLUSH;
#ifdef USE_LOCALE_COLLATE
if (! newcoll) {
- if (collation_name) {
- ++collation_ix;
- Safefree(collation_name);
- collation_name = NULL;
- collation_standard = TRUE;
- collxfrm_base = 0;
- collxfrm_mult = 2;
+ if (PL_collation_name) {
+ ++PL_collation_ix;
+ Safefree(PL_collation_name);
+ PL_collation_name = NULL;
+ PL_collation_standard = TRUE;
+ PL_collxfrm_base = 0;
+ PL_collxfrm_mult = 2;
}
return;
}
- if (! collation_name || strNE(collation_name, newcoll)) {
- ++collation_ix;
- Safefree(collation_name);
- collation_name = savepv(newcoll);
- collation_standard = (strEQ(newcoll, "C") || strEQ(newcoll, "POSIX"));
+ if (! PL_collation_name || strNE(PL_collation_name, newcoll)) {
+ ++PL_collation_ix;
+ Safefree(PL_collation_name);
+ PL_collation_name = savepv(newcoll);
+ PL_collation_standard = (strEQ(newcoll, "C") || strEQ(newcoll, "POSIX"));
{
/* 2: at most so many chars ('a', 'b'). */
SSize_t mult = fb - fa;
if (mult < 1)
croak("strxfrm() gets absurd");
- collxfrm_base = (fa > mult) ? (fa - mult) : 0;
- collxfrm_mult = mult;
+ PL_collxfrm_base = (fa > mult) ? (fa - mult) : 0;
+ PL_collxfrm_mult = mult;
}
}
#ifdef USE_LOCALE_NUMERIC
if (! newnum) {
- if (numeric_name) {
- Safefree(numeric_name);
- numeric_name = NULL;
- numeric_standard = TRUE;
- numeric_local = TRUE;
+ if (PL_numeric_name) {
+ Safefree(PL_numeric_name);
+ PL_numeric_name = NULL;
+ PL_numeric_standard = TRUE;
+ PL_numeric_local = TRUE;
}
return;
}
- if (! numeric_name || strNE(numeric_name, newnum)) {
- Safefree(numeric_name);
- numeric_name = savepv(newnum);
- numeric_standard = (strEQ(newnum, "C") || strEQ(newnum, "POSIX"));
- numeric_local = TRUE;
+ if (! PL_numeric_name || strNE(PL_numeric_name, newnum)) {
+ Safefree(PL_numeric_name);
+ PL_numeric_name = savepv(newnum);
+ PL_numeric_standard = (strEQ(newnum, "C") || strEQ(newnum, "POSIX"));
+ PL_numeric_local = TRUE;
}
#endif /* USE_LOCALE_NUMERIC */
{
#ifdef USE_LOCALE_NUMERIC
- if (! numeric_standard) {
+ if (! PL_numeric_standard) {
setlocale(LC_NUMERIC, "C");
- numeric_standard = TRUE;
- numeric_local = FALSE;
+ PL_numeric_standard = TRUE;
+ PL_numeric_local = FALSE;
}
#endif /* USE_LOCALE_NUMERIC */
{
#ifdef USE_LOCALE_NUMERIC
- if (! numeric_local) {
- setlocale(LC_NUMERIC, numeric_name);
- numeric_standard = FALSE;
- numeric_local = TRUE;
+ if (! PL_numeric_local) {
+ setlocale(LC_NUMERIC, PL_numeric_name);
+ PL_numeric_standard = FALSE;
+ PL_numeric_local = TRUE;
}
#endif /* USE_LOCALE_NUMERIC */
/* the first sizeof(collationix) bytes are used by sv_collxfrm(). */
/* the +1 is for the terminating NUL. */
- xAlloc = sizeof(collation_ix) + collxfrm_base + (collxfrm_mult * len) + 1;
+ xAlloc = sizeof(PL_collation_ix) + PL_collxfrm_base + (PL_collxfrm_mult * len) + 1;
New(171, xbuf, xAlloc, char);
if (! xbuf)
goto bad;
- *(U32*)xbuf = collation_ix;
- xout = sizeof(collation_ix);
+ *(U32*)xbuf = PL_collation_ix;
+ xout = sizeof(PL_collation_ix);
for (xin = 0; xin < len; ) {
SSize_t xused;
}
xbuf[xout] = '\0';
- *xlen = xout - sizeof(collation_ix);
+ *xlen = xout - sizeof(PL_collation_ix);
return xbuf;
bad:
if (!len) {
if (SvTAIL(littlestr)) { /* Can be only 0-len constant
substr => we can ignore SvVALID */
- if (multiline) {
+ if (PL_multiline) {
char *t = "\n";
if ((s = (unsigned char*)ninstr((char*)big, (char*)bigend,
t, t + len))) {
}
littlelen = SvCUR(littlestr);
- if (SvTAIL(littlestr) && !multiline) { /* tail anchored? */
+ if (SvTAIL(littlestr) && !PL_multiline) { /* tail anchored? */
if (littlelen > bigend - big)
return Nullch;
little = (unsigned char*)SvPVX(littlestr);
I32 found = 0;
if (*old_posp == -1
- ? (pos = screamfirst[BmRARE(littlestr)]) < 0
- : (((pos = *old_posp), pos += screamnext[pos]) == 0))
+ ? (pos = PL_screamfirst[BmRARE(littlestr)]) < 0
+ : (((pos = *old_posp), pos += PL_screamnext[pos]) == 0))
return Nullch;
little = (unsigned char *)(SvPVX(littlestr));
littleend = little + SvCUR(littlestr);
stop_pos = SvCUR(bigstr) - end_shift - (SvCUR(littlestr) - 1 - previous);
if (previous + start_shift > stop_pos) return Nullch;
while (pos < previous + start_shift) {
- if (!(pos += screamnext[pos]))
+ if (!(pos += PL_screamnext[pos]))
return Nullch;
}
#ifdef POINTERRIGOR
if (!last) return (char *)(big+pos);
found = 1;
}
- } while ( pos += screamnext[pos] );
+ } while ( pos += PL_screamnext[pos] );
return (last && found) ? (char *)(big+(*old_posp)) : Nullch;
#endif /* POINTERRIGOR */
}
{
va_list args;
va_start(args, pat);
- if (!mess_sv)
- mess_sv = mess_alloc();
- sv_vsetpvfn(mess_sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
+ if (!PL_mess_sv)
+ PL_mess_sv = mess_alloc();
+ sv_vsetpvfn(PL_mess_sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*));
va_end(args);
- return SvPVX(mess_sv);
+ return SvPVX(PL_mess_sv);
}
char *
SV *sv;
static char dgd[] = " during global destruction.\n";
- if (!mess_sv)
- mess_sv = mess_alloc();
- sv = mess_sv;
+ if (!PL_mess_sv)
+ PL_mess_sv = mess_alloc();
+ sv = PL_mess_sv;
sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*));
if (!SvCUR(sv) || *(SvEND(sv) - 1) != '\n') {
dTHR;
- if (dirty)
+ if (PL_dirty)
sv_catpv(sv, dgd);
else {
- if (curcop->cop_line)
+ if (PL_curcop->cop_line)
sv_catpvf(sv, " at %_ line %ld",
- GvSV(curcop->cop_filegv), (long)curcop->cop_line);
- if (GvIO(last_in_gv) && IoLINES(GvIOp(last_in_gv))) {
- bool line_mode = (RsSIMPLE(rs) &&
- SvLEN(rs) == 1 && *SvPVX(rs) == '\n');
+ GvSV(PL_curcop->cop_filegv), (long)PL_curcop->cop_line);
+ if (GvIO(PL_last_in_gv) && IoLINES(GvIOp(PL_last_in_gv))) {
+ bool line_mode = (RsSIMPLE(PL_rs) &&
+ SvLEN(PL_rs) == 1 && *SvPVX(PL_rs) == '\n');
sv_catpvf(sv, ", <%s> %s %ld",
- last_in_gv == argvgv ? "" : GvNAME(last_in_gv),
+ PL_last_in_gv == PL_argvgv ? "" : GvNAME(PL_last_in_gv),
line_mode ? "line" : "chunk",
- (long)IoLINES(GvIOp(last_in_gv)));
+ (long)IoLINES(GvIOp(PL_last_in_gv)));
}
sv_catpv(sv, ".\n");
}
dTHR;
va_list args;
char *message;
- int was_in_eval = in_eval;
+ int was_in_eval = PL_in_eval;
HV *stash;
GV *gv;
CV *cv;
"%p: die: message = %s\ndiehook = %p\n",
thr, message, diehook));
#endif /* USE_THREADS */
- if (diehook) {
+ if (PL_diehook) {
/* sv_2cv might call croak() */
- SV *olddiehook = diehook;
+ SV *olddiehook = PL_diehook;
ENTER;
- SAVESPTR(diehook);
- diehook = Nullsv;
+ SAVESPTR(PL_diehook);
+ PL_diehook = Nullsv;
cv = sv_2cv(olddiehook, &stash, &gv, 0);
LEAVE;
if (cv && !CvDEPTH(cv) && (CvROOT(cv) || CvXSUB(cv))) {
}
}
- restartop = die_where(message);
+ PL_restartop = die_where(message);
#ifdef USE_THREADS
DEBUG_L(PerlIO_printf(PerlIO_stderr(),
"%p: die: restartop = %p, was_in_eval = %d, top_env = %p\n",
thr, restartop, was_in_eval, top_env));
#endif /* USE_THREADS */
- if ((!restartop && was_in_eval) || top_env->je_prev)
+ if ((!PL_restartop && was_in_eval) || PL_top_env->je_prev)
JMPENV_JUMP(3);
- return restartop;
+ return PL_restartop;
}
void
#ifdef USE_THREADS
DEBUG_L(PerlIO_printf(PerlIO_stderr(), "croak: 0x%lx %s", (unsigned long) thr, message));
#endif /* USE_THREADS */
- if (diehook) {
+ if (PL_diehook) {
/* sv_2cv might call croak() */
- SV *olddiehook = diehook;
+ SV *olddiehook = PL_diehook;
ENTER;
- SAVESPTR(diehook);
- diehook = Nullsv;
+ SAVESPTR(PL_diehook);
+ PL_diehook = Nullsv;
cv = sv_2cv(olddiehook, &stash, &gv, 0);
LEAVE;
if (cv && !CvDEPTH(cv) && (CvROOT(cv) || CvXSUB(cv))) {
LEAVE;
}
}
- if (in_eval) {
- restartop = die_where(message);
+ if (PL_in_eval) {
+ PL_restartop = die_where(message);
JMPENV_JUMP(3);
}
PerlIO_puts(PerlIO_stderr(),message);
message = mess(pat, &args);
va_end(args);
- if (warnhook) {
+ if (PL_warnhook) {
/* sv_2cv might call warn() */
dTHR;
- SV *oldwarnhook = warnhook;
+ SV *oldwarnhook = PL_warnhook;
ENTER;
- SAVESPTR(warnhook);
- warnhook = Nullsv;
+ SAVESPTR(PL_warnhook);
+ PL_warnhook = Nullsv;
cv = sv_2cv(oldwarnhook, &stash, &gv, 0);
LEAVE;
if (cv && !CvDEPTH(cv) && (CvROOT(cv) || CvXSUB(cv))) {
{
register I32 i=setenv_getix(nam); /* where does it go? */
- if (environ == origenviron) { /* need we copy environment? */
+ if (environ == PL_origenviron) { /* need we copy environment? */
I32 j;
I32 max;
char **tmpenv;
#endif
This = (*mode == 'w');
that = !This;
- if (doexec && tainting) {
+ if (doexec && PL_tainting) {
taint_env();
taint_proper("Insecure %s%s", "EXEC");
}
/*SUPPRESS 560*/
if (tmpgv = gv_fetchpv("$",TRUE, SVt_PV))
sv_setiv(GvSV(tmpgv), (IV)getpid());
- forkprocess = 0;
- hv_clear(pidstatus); /* we have no children */
+ PL_forkprocess = 0;
+ hv_clear(PL_pidstatus); /* we have no children */
return Nullfp;
#undef THIS
#undef THAT
PerlLIO_close(p[This]);
p[This] = p[that];
}
- sv = *av_fetch(fdpid,p[This],TRUE);
+ sv = *av_fetch(PL_fdpid,p[This],TRUE);
(void)SvUPGRADE(sv,SVt_IV);
SvIVX(sv) = pid;
- forkprocess = pid;
+ PL_forkprocess = pid;
return PerlIO_fdopen(p[This], mode);
}
#else
int saved_win32_errno;
#endif
- svp = av_fetch(fdpid,PerlIO_fileno(ptr),TRUE);
+ svp = av_fetch(PL_fdpid,PerlIO_fileno(ptr),TRUE);
pid = (int)SvIVX(*svp);
SvREFCNT_dec(*svp);
- *svp = &sv_undef;
+ *svp = &PL_sv_undef;
#ifdef OS2
if (pid == -1) { /* Opened by popen. */
return my_syspclose(ptr);
return -1;
if (pid > 0) {
sprintf(spid, "%d", pid);
- svp = hv_fetch(pidstatus,spid,strlen(spid),FALSE);
- if (svp && *svp != &sv_undef) {
+ svp = hv_fetch(PL_pidstatus,spid,strlen(spid),FALSE);
+ if (svp && *svp != &PL_sv_undef) {
*statusp = SvIVX(*svp);
- (void)hv_delete(pidstatus,spid,strlen(spid),G_DISCARD);
+ (void)hv_delete(PL_pidstatus,spid,strlen(spid),G_DISCARD);
return pid;
}
}
else {
HE *entry;
- hv_iterinit(pidstatus);
- if (entry = hv_iternext(pidstatus)) {
+ hv_iterinit(PL_pidstatus);
+ if (entry = hv_iternext(PL_pidstatus)) {
pid = atoi(hv_iterkey(entry,(I32*)statusp));
- sv = hv_iterval(pidstatus,entry);
+ sv = hv_iterval(PL_pidstatus,entry);
*statusp = SvIVX(sv);
sprintf(spid, "%d", pid);
- (void)hv_delete(pidstatus,spid,strlen(spid),G_DISCARD);
+ (void)hv_delete(PL_pidstatus,spid,strlen(spid),G_DISCARD);
return pid;
}
}
char spid[TYPE_CHARS(int)];
sprintf(spid, "%d", pid);
- sv = *hv_fetch(pidstatus,spid,strlen(spid),TRUE);
+ sv = *hv_fetch(PL_pidstatus,spid,strlen(spid),TRUE);
(void)SvUPGRADE(sv,SVt_IV);
SvIVX(sv) = status;
return;
retval = n | (*s++ - '0');
len--;
}
- if (dowarn && len && (*s == '8' || *s == '9'))
+ if (PL_dowarn && len && (*s == '8' || *s == '9'))
warn("Illegal octal digit ignored");
*retlen = s - start;
return retval;
bool overflowed = FALSE;
char *tmp = s;
- while (len-- && *s && (tmp = strchr((char *) hexdigit, *s))) {
+ while (len-- && *s && (tmp = strchr((char *) PL_hexdigit, *s))) {
register UV n = retval << 4;
if (!overflowed && (n >> 4) != retval) {
warn("Integer overflow in hex number");
overflowed = TRUE;
}
- retval = n | ((tmp - hexdigit) & 15);
+ retval = n | ((tmp - PL_hexdigit) & 15);
s++;
}
- if (dowarn && !tmp) {
+ if (PL_dowarn && !tmp) {
warn("Illegal hex digit ignored");
}
*retlen = s - start;
&& (s = PerlEnv_getenv("PATH"))) {
bool seen_dot = 0;
- bufend = s + strlen(s);
- while (s < bufend) {
+ PL_bufend = s + strlen(s);
+ while (s < PL_bufend) {
#if defined(atarist) || defined(DOSISH)
for (len = 0; *s
# ifdef atarist
if (len < sizeof tmpbuf)
tmpbuf[len] = '\0';
#else /* ! (atarist || DOSISH) */
- s = delimcpy(tmpbuf, tmpbuf + sizeof tmpbuf, s, bufend,
+ s = delimcpy(tmpbuf, tmpbuf + sizeof tmpbuf, s, PL_bufend,
':',
&len);
#endif /* ! (atarist || DOSISH) */
- if (s < bufend)
+ if (s < PL_bufend)
s++;
if (len + 1 + strlen(scriptname) + MAX_EXT_LEN >= sizeof tmpbuf)
continue; /* don't search dir with too-long name */
do {
#endif
DEBUG_p(PerlIO_printf(Perl_debug_log, "Looking for %s\n",tmpbuf));
- retval = PerlLIO_stat(tmpbuf,&statbuf);
+ retval = PerlLIO_stat(tmpbuf,&PL_statbuf);
#ifdef SEARCH_EXTS
} while ( retval < 0 /* not there */
&& extidx>=0 && ext[extidx] /* try an extension? */
#endif
if (retval < 0)
continue;
- if (S_ISREG(statbuf.st_mode)
- && cando(S_IRUSR,TRUE,&statbuf)
+ if (S_ISREG(PL_statbuf.st_mode)
+ && cando(S_IRUSR,TRUE,&PL_statbuf)
#ifndef DOSISH
- && cando(S_IXUSR,TRUE,&statbuf)
+ && cando(S_IXUSR,TRUE,&PL_statbuf)
#endif
)
{
xfailed = savepv(tmpbuf);
}
#ifndef DOSISH
- if (!xfound && !seen_dot && !xfailed && (PerlLIO_stat(scriptname,&statbuf) < 0))
+ if (!xfound && !seen_dot && !xfailed && (PerlLIO_stat(scriptname,&PL_statbuf) < 0))
#endif
seen_dot = 1; /* Disable message. */
if (!xfound) {
SV **
get_specialsv_list(void)
{
- return specialsv_list;
+ return PL_specialsv_list;
}