--- /dev/null
+/***********************************************/
+/* Global only to current interpreter instance */
+/***********************************************/
+
+/* pseudo environmental stuff */
+PERLVAR(Iorigargc, int)
+PERLVAR(Iorigargv, char **)
+PERLVAR(Ienvgv, GV *)
+PERLVAR(Isiggv, GV *)
+PERLVAR(Iincgv, GV *)
+PERLVAR(Iorigfilename, char *)
+PERLVAR(Idiehook, SV *)
+PERLVAR(Iwarnhook, SV *)
+PERLVAR(Iparsehook, SV *)
+/* switches */
+PERLVAR(Icddir, char *)
+PERLVAR(Iminus_c, bool)
+PERLVAR(Ipatchlevel[10], char)
+PERLVAR(Ilocalpatches, char **)
+PERLVAR(Inrs, SV *)
+PERLVARI(Isplitstr, char *, " ")
+PERLVAR(Ipreprocess, bool)
+PERLVAR(Iminus_n, bool)
+PERLVAR(Iminus_p, bool)
+PERLVAR(Iminus_l, bool)
+PERLVAR(Iminus_a, bool)
+PERLVAR(Iminus_F, bool)
+PERLVAR(Idoswitches, bool)
+PERLVAR(Idowarn, bool)
+PERLVAR(Idoextract, bool)
+PERLVAR(Isawampersand, bool) /* must save all match strings */
+PERLVAR(Isawstudy, bool) /* do fbm_instr on all strings */
+PERLVAR(Isawvec, bool)
+PERLVAR(Iunsafe, bool)
+PERLVAR(Iinplace, char *)
+PERLVAR(Ie_tmpname, char *)
+PERLVAR(Ie_fp, PerlIO *)
+PERLVAR(Iperldb, U32)
+ /* This value may be raised by extensions for testing purposes */
+PERLVARI(Iperl_destruct_level, int, 0) /* 0=none, 1=full, 2=full with checks */
+
+/* magical thingies */
+PERLVAR(Ibasetime, Time_t) /* $^T */
+PERLVAR(Iformfeed, SV *) /* $^L */
+PERLVARI(Ichopset, char *, " \n-") /* $: */
+PERLVAR(Irs, SV *) /* $/ */
+PERLVAR(Iofs, char *) /* $, */
+PERLVAR(Iofslen, STRLEN)
+PERLVAR(Iors, char *) /* $\ */
+PERLVAR(Iorslen, STRLEN)
+PERLVAR(Iofmt, char *) /* $# */
+PERLVARI(Imaxsysfd, I32, MAXSYSFD) /* top fd to pass to subprocesses */
+PERLVAR(Imultiline, int) /* $*--do strings hold >1 line? */
+PERLVAR(Istatusvalue, I32) /* $? */
+#ifdef VMS
+PERLVAR(Istatusvalue_vms, U32)
+#endif
+
+PERLVAR(Istatcache, struct stat) /* _ */
+PERLVAR(Istatgv, GV *)
+PERLVARI(Istatname, SV *, Nullsv)
+
+/* shortcuts to various I/O objects */
+PERLVAR(Istdingv, GV *)
+PERLVAR(Ilast_in_gv, GV *)
+PERLVAR(Idefgv, GV *)
+PERLVAR(Iargvgv, GV *)
+PERLVAR(Idefoutgv, GV *)
+PERLVAR(Iargvoutgv, GV *)
+
+/* shortcuts to regexp stuff */
+PERLVAR(Ileftgv, GV *)
+PERLVAR(Iampergv, GV *)
+PERLVAR(Irightgv, GV *)
+PERLVAR(Icurpm, PMOP *) /* what to do \ interps from */
+PERLVAR(Iscreamfirst, I32 *)
+PERLVAR(Iscreamnext, I32 *)
+PERLVARI(Imaxscream, I32, -1)
+PERLVAR(Ilastscream, SV *)
+
+/* shortcuts to misc objects */
+PERLVAR(Ierrgv, GV *)
+
+/* shortcuts to debugging objects */
+PERLVAR(IDBgv, GV *)
+PERLVAR(IDBline, GV *)
+PERLVAR(IDBsub, GV *)
+PERLVAR(IDBsingle, SV *)
+PERLVAR(IDBtrace, SV *)
+PERLVAR(IDBsignal, SV *)
+PERLVAR(Ilineary, AV *) /* lines of script for debugger */
+PERLVAR(Idbargs, AV *) /* args to call listed by caller function */
+
+/* symbol tables */
+PERLVAR(Idefstash, HV *) /* main symbol table */
+PERLVAR(Icurstash, HV *) /* symbol table for current package */
+PERLVAR(Idebstash, HV *) /* symbol table for perldb package */
+PERLVAR(Iglobalstash, HV *) /* global keyword overrides imported here */
+PERLVAR(Icurstname, SV *) /* name of current package */
+PERLVAR(Ibeginav, AV *) /* names of BEGIN subroutines */
+PERLVAR(Iendav, AV *) /* names of END subroutines */
+PERLVAR(Iinitav, AV *) /* names of INIT subroutines */
+PERLVAR(Istrtab, HV *) /* shared string table */
+
+/* memory management */
+PERLVAR(Itmps_stack, SV **)
+PERLVARI(Itmps_ix, I32, -1)
+PERLVARI(Itmps_floor, I32, -1)
+PERLVAR(Itmps_max, I32)
+PERLVAR(Isv_count, I32) /* how many SV* are currently allocated */
+PERLVAR(Isv_objcount, I32) /* how many objects are currently allocated */
+PERLVAR(Isv_root, SV*) /* storage for SVs belonging to interp */
+PERLVAR(Isv_arenaroot, SV*) /* list of areas for garbage collection */
+
+/* funky return mechanisms */
+PERLVAR(Ilastspbase, I32)
+PERLVAR(Ilastsize, I32)
+PERLVAR(Iforkprocess, int) /* so do_open |- can return proc# */
+
+/* subprocess state */
+PERLVAR(Ifdpid, AV *) /* keep fd-to-pid mappings for my_popen */
+
+/* internal state */
+PERLVAR(Iin_eval, VOL int) /* trap "fatal" errors? */
+PERLVAR(Irestartop, OP *) /* Are we propagating an error from croak? */
+PERLVAR(Idelaymagic, int) /* ($<,$>) = ... */
+PERLVAR(Idirty, bool) /* In the middle of tearing things down? */
+PERLVAR(Ilocalizing, U8) /* are we processing a local() list? */
+PERLVAR(Itainted, bool) /* using variables controlled by $< */
+PERLVAR(Itainting, bool) /* doing taint checks */
+PERLVARI(Iop_mask, char *, NULL) /* masked operations for safe evals */
+
+/* trace state */
+PERLVAR(Idlevel, I32)
+PERLVARI(Idlmax, I32, 128)
+PERLVAR(Idebname, char *)
+PERLVAR(Idebdelim, char *)
+
+/* current interpreter roots */
+PERLVAR(Imain_cv, CV *)
+PERLVAR(Imain_root, OP *)
+PERLVAR(Imain_start, OP *)
+PERLVAR(Ieval_root, OP *)
+PERLVAR(Ieval_start, OP *)
+
+/* runtime control stuff */
+PERLVARI(Icurcop, COP * VOL, &compiling)
+PERLVARI(Icurcopdb, COP *, NULL)
+PERLVARI(Icopline, line_t, NOLINE)
+PERLVAR(Icxstack, PERL_CONTEXT *)
+PERLVARI(Icxstack_ix, I32, -1)
+PERLVARI(Icxstack_max, I32, 128)
+PERLVAR(Istart_env, JMPENV) /* empty startup sigjmp() environment */
+PERLVAR(Itop_env, JMPENV *) /* ptr. to current sigjmp() environment */
+
+/* stack stuff */
+PERLVAR(Icurstack, AV *) /* THE STACK */
+PERLVAR(Imainstack, AV *) /* the stack when nothing funny is happening */
+
+/* format accumulators */
+PERLVAR(Iformtarget, SV *)
+PERLVAR(Ibodytarget, SV *)
+PERLVAR(Itoptarget, SV *)
+
+/* statics moved here for shared library purposes */
+PERLVAR(Istrchop, SV) /* return value from chop */
+PERLVAR(Ifilemode, int) /* so nextargv() can preserve mode */
+PERLVAR(Ilastfd, int) /* what to preserve mode on */
+PERLVAR(Ioldname, char *) /* what to preserve mode on */
+PERLVAR(IArgv, char **) /* stuff to free from do_aexec, vfork safe */
+PERLVAR(ICmd, char *) /* stuff to free from do_aexec, vfork safe */
+PERLVAR(Isortcop, OP *) /* user defined sort routine */
+PERLVAR(Isortstash, HV *) /* which is in some package or other */
+PERLVAR(Ifirstgv, GV *) /* $a */
+PERLVAR(Isecondgv, GV *) /* $b */
+PERLVAR(Isortstack, AV *) /* temp stack during pp_sort() */
+PERLVAR(Isignalstack, AV *) /* temp stack during sighandler() */
+PERLVAR(Imystrk, SV *) /* temp key string for do_each() */
+PERLVAR(Idumplvl, I32) /* indentation level on syntax tree dump */
+PERLVAR(Ioldlastpm, PMOP *) /* for saving regexp context during debugger */
+PERLVAR(Igensym, I32) /* next symbol for getsym() to define */
+PERLVAR(Ipreambled, bool)
+PERLVAR(Ipreambleav, AV *)
+PERLVARI(Ilaststatval, int, -1)
+PERLVARI(Ilaststype, I32, OP_STAT)
+PERLVAR(Imess_sv, SV *)
+
+#ifdef USE_THREADS
+/* threads stuff */
+PERLVAR(Ithrsv, SV *) /* holds struct perl_thread for main thread */
+#endif /* USE_THREADS */
+
+
* included until after runops is initialised.
*/
+typedef int runops_proc_t _((void));
int runops_standard _((void));
#ifdef DEBUGGING
int runops_debug _((void));
#define THREADSV_NAMES "_123456789&`'+/.,\\\";^-%=|~:\001\005!@"
-/****************/
-/* Truly global */
-/****************/
-
-/* global state */
-EXT PerlInterpreter * curinterp; /* currently running interpreter */
-#ifdef USE_THREADS
-EXT perl_key thr_key; /* For per-thread struct perl_thread* */
-EXT perl_mutex sv_mutex; /* Mutex for allocating SVs in sv.c */
-EXT perl_mutex malloc_mutex; /* Mutex for malloc */
-EXT perl_mutex eval_mutex; /* Mutex for doeval */
-EXT perl_cond eval_cond; /* Condition variable for doeval */
-EXT struct perl_thread * eval_owner; /* Owner thread for doeval */
-EXT int nthreads; /* Number of threads currently */
-EXT perl_mutex threads_mutex; /* Mutex for nthreads and thread list */
-EXT perl_cond nthreads_cond; /* Condition variable for nthreads */
-EXT char * threadsv_names INIT(THREADSV_NAMES);
-#ifdef FAKE_THREADS
-EXT struct perl_thread * thr; /* Currently executing (fake) thread */
-#endif
-#endif /* USE_THREADS */
-
/* VMS doesn't use environ array and NeXT has problems with crt0.o globals */
#if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__))
#if !defined(DONT_DECLARE_STD) || (defined(__svr4__) && defined(__GNUC__) && defined(sun)) || defined(__sgi)
# endif
#endif /* environ processing */
-EXT int uid; /* current real user id */
-EXT int euid; /* current effective user id */
-EXT int gid; /* current real group id */
-EXT int egid; /* current effective group id */
-EXT bool nomemok; /* let malloc context handle nomem */
-EXT U32 an; /* malloc sequence number */
-EXT U32 cop_seqmax; /* statement sequence number */
-EXT U16 op_seqmax; /* op sequence number */
-EXT U32 evalseq; /* eval sequence number */
-EXT U32 sub_generation; /* inc to force methods to be looked up again */
-EXT char ** origenviron;
-EXT U32 origalen;
-EXT HV * pidstatus; /* pid-to-status mappings for waitpid */
-EXT U32 * profiledata;
-EXT int maxo INIT(MAXO);/* Number of ops */
-EXT char * osname; /* operating system */
-EXT char * sh_path INIT(SH_PATH); /* full path of shell */
-EXT Sighandler_t sighandlerp;
-
-EXT XPV* xiv_arenaroot; /* list of allocated xiv areas */
-EXT IV ** xiv_root; /* free xiv list--shared by interpreters */
-EXT double * xnv_root; /* free xnv list--shared by interpreters */
-EXT XRV * xrv_root; /* free xrv list--shared by interpreters */
-EXT XPV * xpv_root; /* free xpv list--shared by interpreters */
-EXT HE * he_root; /* free he list--shared by interpreters */
-EXT char * nice_chunk; /* a nice chunk of memory to reuse */
-EXT U32 nice_chunk_size;/* how nice the chunk of memory is */
-
-/* Stack for currently executing thread--context switch must handle this. */
-EXT SV ** stack_base; /* stack->array_ary */
-EXT SV ** stack_sp; /* stack pointer now */
-EXT SV ** stack_max; /* stack->array_ary + stack->array_max */
-
-/* likewise for these */
-
-#ifdef OP_IN_REGISTER
-EXT OP * opsave; /* save current op register across longjmps */
-#else
-EXT OP * op; /* current op--when not in a global register */
-#endif
-EXT int (*runops) _((void)) INIT(RUNOPS_DEFAULT);
-EXT I32 * scopestack; /* blocks we've entered */
-EXT I32 scopestack_ix;
-EXT I32 scopestack_max;
-
-EXT ANY* savestack; /* to save non-local values on */
-EXT I32 savestack_ix;
-EXT I32 savestack_max;
-
-EXT OP ** retstack; /* returns we've pushed */
-EXT I32 retstack_ix;
-EXT I32 retstack_max;
-
-EXT I32 * markstack; /* stackmarks we're remembering */
-EXT I32 * markstack_ptr; /* stackmarks we're remembering */
-EXT I32 * markstack_max; /* stackmarks we're remembering */
-
-EXT SV ** curpad;
-
-/* temp space */
-EXT SV * Sv;
-EXT XPV * Xpv;
-EXT char tokenbuf[256];
-EXT struct stat statbuf;
-#ifdef HAS_TIMES
-EXT struct tms timesbuf;
-#endif
-#if defined(WIN32) && defined(__GNUC__)
-static STRLEN na;
-#else
-EXT STRLEN na; /* for use in SvPV when length is Not Applicable */
-#endif
/* for tmp use in stupid debuggers */
EXT int * di;
EXTCONST char no_myglob[]
INIT("\"my\" variable %s can't be in a package");
-EXT SV sv_undef;
-EXT SV sv_no;
-EXT SV sv_yes;
-#ifdef CSH
- EXT char * cshname INIT(CSH);
- EXT I32 cshlen;
-#endif
-
#ifdef DOINIT
EXT char *sig_name[] = { SIG_NAME };
EXT int sig_num[] = { SIG_NUM };
XTERMBLOCK
} expectation;
-EXT U32 lex_state; /* next token is determined */
-EXT U32 lex_defer; /* state after determined token */
-EXT expectation lex_expect; /* expect after determined token */
-EXT I32 lex_brackets; /* bracket count */
-EXT I32 lex_formbrack; /* bracket count at outer format level */
-EXT I32 lex_fakebrack; /* outer bracket is mere delimiter */
-EXT I32 lex_casemods; /* casemod count */
-EXT I32 lex_dojoin; /* doing an array interpolation */
-EXT I32 lex_starts; /* how many interps done on level */
-EXT SV * lex_stuff; /* runtime pattern from m// or s/// */
-EXT SV * lex_repl; /* runtime replacement from s/// */
-EXT OP * lex_op; /* extra info to pass back on op */
-EXT OP * lex_inpat; /* in pattern $) and $| are special */
-EXT I32 lex_inwhat; /* what kind of quoting are we in */
-EXT char * lex_brackstack; /* what kind of brackets to pop */
-EXT char * lex_casestack; /* what kind of case mods in effect */
-
-/* What we know when we're in LEX_KNOWNEXT state. */
-EXT YYSTYPE nextval[5]; /* value of next token, if any */
-EXT I32 nexttype[5]; /* type of next token */
-EXT I32 nexttoke;
-
-EXT PerlIO * VOL rsfp INIT(Nullfp);
-EXT SV * linestr;
-EXT char * bufptr;
-EXT char * oldbufptr;
-EXT char * oldoldbufptr;
-EXT char * bufend;
-EXT expectation expect INIT(XSTATE); /* how to interpret ambiguous tokens */
-EXT AV * rsfp_filters;
-
-EXT I32 multi_start; /* 1st line of multi-line string */
-EXT I32 multi_end; /* last line of multi-line string */
-EXT I32 multi_open; /* delimiter of said string */
-EXT I32 multi_close; /* delimiter of said string */
-
-EXT GV * scrgv;
-EXT I32 error_count; /* how many errors so far, max 10 */
-EXT I32 subline; /* line this subroutine began on */
-EXT SV * subname; /* name of current subroutine */
-
-EXT CV * compcv; /* currently compiling subroutine */
-EXT AV * comppad; /* storage for lexically scoped temporaries */
-EXT AV * comppad_name; /* variable names for "my" variables */
-EXT I32 comppad_name_fill;/* last "introduced" variable offset */
-EXT I32 comppad_name_floor;/* start of vars in innermost block */
-EXT I32 min_intro_pending;/* start of vars to introduce */
-EXT I32 max_intro_pending;/* end of vars to introduce */
-EXT I32 padix; /* max used index in current "register" pad */
-EXT I32 padix_floor; /* how low may inner block reset padix */
-EXT I32 pad_reset_pending; /* reset pad on next attempted alloc */
-EXT COP compiling;
-
-EXT I32 thisexpr; /* name id for nothing_in_common() */
-EXT char * last_uni; /* position of last named-unary operator */
-EXT char * last_lop; /* position of last list operator */
-EXT OPCODE last_lop_op; /* last list operator */
-EXT bool in_my; /* we're compiling a "my" declaration */
-EXT HV * in_my_stash; /* declared class of this "my" declaration */
-#ifdef FCRYPT
-EXT I32 cryptseen; /* has fast crypt() been initialized? */
-#endif
-
-EXT U32 hints; /* various compilation flags */
/* Note: the lowest 8 bits are reserved for
stuffing into op->op_private */
#define HINT_STRICT_VARS 0x00000400
#define HINT_LOCALE 0x00000800
-EXT bool do_undump; /* -u or dump seen? */
-EXT VOL U32 debug;
/***********************************************/
/* Global only to current interpreter instance */
#define IEXT
#define IINIT(x)
struct interpreter {
+#include "interpvar.h"
+};
+#undef IEXT
+#undef IINIT
#else
-#define IEXT EXT
-#define IINIT(x) INIT(x)
+struct interpreter {
+ char broiled;
+};
#endif
-/* pseudo environmental stuff */
-IEXT int Iorigargc;
-IEXT char ** Iorigargv;
-IEXT GV * Ienvgv;
-IEXT GV * Isiggv;
-IEXT GV * Iincgv;
-IEXT char * Iorigfilename;
-IEXT SV * Idiehook;
-IEXT SV * Iwarnhook;
-IEXT SV * Iparsehook;
/* Various states of an input record separator SV (rs, nrs) */
#define RsSNARF(sv) (! SvOK(sv))
#define RsSIMPLE(sv) (SvOK(sv) && SvCUR(sv))
#define RsPARA(sv) (SvOK(sv) && ! SvCUR(sv))
-/* switches */
-IEXT char * Icddir;
-IEXT bool Iminus_c;
-IEXT char Ipatchlevel[10];
-IEXT char ** Ilocalpatches;
-IEXT SV * Inrs;
-IEXT char * Isplitstr IINIT(" ");
-IEXT bool Ipreprocess;
-IEXT bool Iminus_n;
-IEXT bool Iminus_p;
-IEXT bool Iminus_l;
-IEXT bool Iminus_a;
-IEXT bool Iminus_F;
-IEXT bool Idoswitches;
-IEXT bool Idowarn;
-IEXT bool Idoextract;
-IEXT bool Isawampersand; /* must save all match strings */
-IEXT bool Isawstudy; /* do fbm_instr on all strings */
-IEXT bool Isawvec;
-IEXT bool Iunsafe;
-IEXT char * Iinplace;
-IEXT char * Ie_tmpname;
-IEXT PerlIO * Ie_fp;
-IEXT U32 Iperldb;
- /* This value may be raised by extensions for testing purposes */
-IEXT int Iperl_destruct_level IINIT(0); /* 0=none, 1=full, 2=full with checks */
-
-/* magical thingies */
-IEXT Time_t Ibasetime; /* $^T */
-IEXT SV * Iformfeed; /* $^L */
-IEXT char * Ichopset IINIT(" \n-"); /* $: */
-IEXT SV * Irs; /* $/ */
-IEXT char * Iofs; /* $, */
-IEXT STRLEN Iofslen;
-IEXT char * Iors; /* $\ */
-IEXT STRLEN Iorslen;
-IEXT char * Iofmt; /* $# */
-IEXT I32 Imaxsysfd IINIT(MAXSYSFD); /* top fd to pass to subprocesses */
-IEXT int Imultiline; /* $*--do strings hold >1 line? */
-IEXT I32 Istatusvalue; /* $? */
-#ifdef VMS
-IEXT U32 Istatusvalue_vms;
-#endif
-
-IEXT struct stat Istatcache; /* _ */
-IEXT GV * Istatgv;
-IEXT SV * Istatname IINIT(Nullsv);
-
-/* shortcuts to various I/O objects */
-IEXT GV * Istdingv;
-IEXT GV * Ilast_in_gv;
-IEXT GV * Idefgv;
-IEXT GV * Iargvgv;
-IEXT GV * Idefoutgv;
-IEXT GV * Iargvoutgv;
-
-/* shortcuts to regexp stuff */
-IEXT GV * Ileftgv;
-IEXT GV * Iampergv;
-IEXT GV * Irightgv;
-IEXT PMOP * Icurpm; /* what to do \ interps from */
-IEXT I32 * Iscreamfirst;
-IEXT I32 * Iscreamnext;
-IEXT I32 Imaxscream IINIT(-1);
-IEXT SV * Ilastscream;
-
-/* shortcuts to misc objects */
-IEXT GV * Ierrgv;
-
-/* shortcuts to debugging objects */
-IEXT GV * IDBgv;
-IEXT GV * IDBline;
-IEXT GV * IDBsub;
-IEXT SV * IDBsingle;
-IEXT SV * IDBtrace;
-IEXT SV * IDBsignal;
-IEXT AV * Ilineary; /* lines of script for debugger */
-IEXT AV * Idbargs; /* args to call listed by caller function */
-
-/* symbol tables */
-IEXT HV * Idefstash; /* main symbol table */
-IEXT HV * Icurstash; /* symbol table for current package */
-IEXT HV * Idebstash; /* symbol table for perldb package */
-IEXT HV * Iglobalstash; /* global keyword overrides imported here */
-IEXT SV * Icurstname; /* name of current package */
-IEXT AV * Ibeginav; /* names of BEGIN subroutines */
-IEXT AV * Iendav; /* names of END subroutines */
-IEXT AV * Iinitav; /* names of INIT subroutines */
-IEXT HV * Istrtab; /* shared string table */
-
-/* memory management */
-IEXT SV ** Itmps_stack;
-IEXT I32 Itmps_ix IINIT(-1);
-IEXT I32 Itmps_floor IINIT(-1);
-IEXT I32 Itmps_max;
-IEXT I32 Isv_count; /* how many SV* are currently allocated */
-IEXT I32 Isv_objcount; /* how many objects are currently allocated */
-IEXT SV* Isv_root; /* storage for SVs belonging to interp */
-IEXT SV* Isv_arenaroot; /* list of areas for garbage collection */
-
-/* funky return mechanisms */
-IEXT I32 Ilastspbase;
-IEXT I32 Ilastsize;
-IEXT int Iforkprocess; /* so do_open |- can return proc# */
-
-/* subprocess state */
-IEXT AV * Ifdpid; /* keep fd-to-pid mappings for my_popen */
-
-/* internal state */
-IEXT VOL int Iin_eval; /* trap "fatal" errors? */
-IEXT OP * Irestartop; /* Are we propagating an error from croak? */
-IEXT int Idelaymagic; /* ($<,$>) = ... */
-IEXT bool Idirty; /* In the middle of tearing things down? */
-IEXT U8 Ilocalizing; /* are we processing a local() list? */
-IEXT bool Itainted; /* using variables controlled by $< */
-IEXT bool Itainting; /* doing taint checks */
-IEXT char * Iop_mask IINIT(NULL); /* masked operations for safe evals */
-
-/* trace state */
-IEXT I32 Idlevel;
-IEXT I32 Idlmax IINIT(128);
-IEXT char * Idebname;
-IEXT char * Idebdelim;
-
-/* current interpreter roots */
-IEXT CV * Imain_cv;
-IEXT OP * Imain_root;
-IEXT OP * Imain_start;
-IEXT OP * Ieval_root;
-IEXT OP * Ieval_start;
-
-/* runtime control stuff */
-IEXT COP * VOL Icurcop IINIT(&compiling);
-IEXT COP * Icurcopdb IINIT(NULL);
-IEXT line_t Icopline IINIT(NOLINE);
-IEXT PERL_CONTEXT * Icxstack;
-IEXT I32 Icxstack_ix IINIT(-1);
-IEXT I32 Icxstack_max IINIT(128);
-IEXT JMPENV Istart_env; /* empty startup sigjmp() environment */
-IEXT JMPENV * Itop_env; /* ptr. to current sigjmp() environment */
-
-/* stack stuff */
-IEXT AV * Icurstack; /* THE STACK */
-IEXT AV * Imainstack; /* the stack when nothing funny is happening */
-
-/* format accumulators */
-IEXT SV * Iformtarget;
-IEXT SV * Ibodytarget;
-IEXT SV * Itoptarget;
-
-/* statics moved here for shared library purposes */
-IEXT SV Istrchop; /* return value from chop */
-IEXT int Ifilemode; /* so nextargv() can preserve mode */
-IEXT int Ilastfd; /* what to preserve mode on */
-IEXT char * Ioldname; /* what to preserve mode on */
-IEXT char ** IArgv; /* stuff to free from do_aexec, vfork safe */
-IEXT char * ICmd; /* stuff to free from do_aexec, vfork safe */
-IEXT OP * Isortcop; /* user defined sort routine */
-IEXT HV * Isortstash; /* which is in some package or other */
-IEXT GV * Ifirstgv; /* $a */
-IEXT GV * Isecondgv; /* $b */
-IEXT AV * Isortstack; /* temp stack during pp_sort() */
-IEXT AV * Isignalstack; /* temp stack during sighandler() */
-IEXT SV * Imystrk; /* temp key string for do_each() */
-IEXT I32 Idumplvl; /* indentation level on syntax tree dump */
-IEXT PMOP * Ioldlastpm; /* for saving regexp context during debugger */
-IEXT I32 Igensym; /* next symbol for getsym() to define */
-IEXT bool Ipreambled;
-IEXT AV * Ipreambleav;
-IEXT int Ilaststatval IINIT(-1);
-IEXT I32 Ilaststype IINIT(OP_STAT);
-IEXT SV * Imess_sv;
-
-#ifdef USE_THREADS
-/* threads stuff */
-IEXT SV * Ithrsv; /* holds struct perl_thread for main thread */
-#endif /* USE_THREADS */
+/* perlvars needs to be before thread.h until we sort out
+ thread.h's #define stuff
+ */
+#define PERLVAR(var,type) EXT type var;
+#define PERLVARI(var,type,init) EXT type var INIT(init);
+#include "perlvars.h"
+#undef PERLVAR
+#undef PERLVARI
-#undef IEXT
-#undef IINIT
+typedef struct perl_thread *Thread;
+#include "thread.h"
-#ifdef MULTIPLICITY
-};
-#else
-struct interpreter {
- char broiled;
+#ifdef USE_THREADS
+struct perl_thread {
+#define PERLVAR(var,type) type var;
+#include "thrdvar.h"
+#undef PERLVAR
};
#endif
-#include "thread.h"
#include "pp.h"
START_EXTERN_C
#include "proto.h"
+END_EXTERN_C
#ifdef EMBED
#define Perl_sv_setptrobj(rv,ptr,name) Perl_sv_setref_iv(rv,name,(IV)ptr)
#define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr)
#endif
-END_EXTERN_C
-
/* The following must follow proto.h */
#if defined(HASATTRIBUTE) && defined(WIN32)
# include <win32iop.h>
#endif /* WIN32 */
-
-#if defined(HASATTRIBUTE) && defined(WIN32)
-/*
- * This provides a layer of functions and macros to ensure extensions will
- * get to use the same RTL functions as the core.
- * It has to go here or #define of printf messes up __attribute__
- * stuff in proto.h
- */
-# include <win32iop.h>
-#endif /* WIN32 */
-
-
#ifdef DOINIT
EXT MGVTBL vtbl_sv = {magic_get,
#ifdef OVERLOAD
-EXT long amagic_generation;
-
#define NofAMmeth 58
#ifdef DOINIT
EXTCONST char * AMG_names[NofAMmeth] = {
#define PERLDB_SUBLINE (perldb && (perldb & PERLDBf_SUBLINE))
#define PERLDB_SINGLE (perldb && (perldb & PERLDBf_SINGLE))
-#ifdef USE_LOCALE_COLLATE
-EXT U32 collation_ix; /* Collation generation index */
-EXT char * collation_name; /* Name of current collation */
-EXT bool collation_standard INIT(TRUE); /* Assume simple collation */
-EXT Size_t collxfrm_base; /* Basic overhead in *xfrm() */
-EXT Size_t collxfrm_mult INIT(2); /* Expansion factor in *xfrm() */
-#endif /* USE_LOCALE_COLLATE */
#ifdef USE_LOCALE_NUMERIC
-EXT char * numeric_name; /* Name of current numeric locale */
-EXT bool numeric_standard INIT(TRUE); /* Assume simple numerics */
-EXT bool numeric_local INIT(TRUE); /* Assume local numerics */
-
#define SET_NUMERIC_STANDARD() \
STMT_START { \
if (! numeric_standard) \
#define PERL_SCRIPT_MODE "r"
#endif
-#ifndef PERL_SCRIPT_MODE
-#define PERL_SCRIPT_MODE "r"
-#endif
-
/*
* nice_chunk and nice_chunk size need to be set
* and queried under the protection of sv_mutex
MUTEX_UNLOCK(&sv_mutex); \
} while (0)
+
#endif /* Include guard */
--- /dev/null
+/* This file describes the "global" variables used by perl */
+/* This used to be in perl.h directly but we want to */
+/* abstract out which are per-thread per-interpreter really */
+/* global and how initialized into one file */
+
+/****************/
+/* Truly global */
+/****************/
+
+/* global state */
+PERLVAR(curinterp, PerlInterpreter *) /* currently running interpreter */
+#ifdef USE_THREADS
+PERLVAR(thr_key, perl_key) /* For per-thread struct perl_thread* */
+PERLVAR(sv_mutex, perl_mutex) /* Mutex for allocating SVs in sv.c */
+PERLVAR(malloc_mutex, perl_mutex) /* Mutex for malloc */
+PERLVAR(eval_mutex, perl_mutex) /* Mutex for doeval */
+PERLVAR(eval_cond, perl_cond) /* Condition variable for doeval */
+PERLVAR(eval_owner, struct perl_thread *) /* Owner thread for doeval */
+PERLVAR(nthreads, int) /* Number of threads currently */
+PERLVAR(threads_mutex, perl_mutex) /* Mutex for nthreads and thread list */
+PERLVAR(nthreads_cond, perl_cond) /* Condition variable for nthreads */
+PERLVARI(threadsv_names, char *, THREADSV_NAMES)
+#ifdef FAKE_THREADS
+PERLVAR(thr, struct perl_thread *) /* Currently executing (fake) thread */
+#endif
+#endif /* USE_THREADS */
+
+PERLVAR(uid, int) /* current real user id */
+PERLVAR(euid, int) /* current effective user id */
+PERLVAR(gid, int) /* current real group id */
+PERLVAR(egid, int) /* current effective group id */
+PERLVAR(nomemok, bool) /* let malloc context handle nomem */
+PERLVAR(an, U32) /* malloc sequence number */
+PERLVAR(cop_seqmax, U32) /* statement sequence number */
+PERLVAR(op_seqmax, U16) /* op sequence number */
+PERLVAR(evalseq, U32) /* eval sequence number */
+PERLVAR(sub_generation, U32) /* inc to force methods to be looked up again */
+PERLVAR(origenviron, char **)
+PERLVAR(origalen, U32)
+PERLVAR(pidstatus, HV *) /* pid-to-status mappings for waitpid */
+PERLVAR(profiledata, U32 *)
+PERLVARI(maxo, int, MAXO) /* Number of ops */
+PERLVAR(osname, char *) /* operating system */
+PERLVARI(sh_path, char *, SH_PATH) /* full path of shell */
+PERLVAR(sighandlerp, Sighandler_t)
+
+PERLVAR(xiv_arenaroot, XPV*) /* list of allocated xiv areas */
+PERLVAR(xiv_root, IV **) /* free xiv list--shared by interpreters */
+PERLVAR(xnv_root, double *) /* free xnv list--shared by interpreters */
+PERLVAR(xrv_root, XRV *) /* free xrv list--shared by interpreters */
+PERLVAR(xpv_root, XPV *) /* free xpv list--shared by interpreters */
+PERLVAR(he_root, HE *) /* free he list--shared by interpreters */
+PERLVAR(nice_chunk, char *) /* a nice chunk of memory to reuse */
+PERLVAR(nice_chunk_size, U32) /* how nice the chunk of memory is */
+
+/* Stack for currently executing thread--context switch must handle this. */
+PERLVAR(stack_base, SV **) /* stack->array_ary */
+PERLVAR(stack_sp, SV **) /* stack pointer now */
+PERLVAR(stack_max, SV **) /* stack->array_ary + stack->array_max */
+
+/* likewise for these */
+
+#ifdef OP_IN_REGISTER
+PERLVAR(opsave, OP *) /* save current op register across longjmps */
+#else
+PERLVAR(op, OP *) /* current op--when not in a global register */
+#endif
+PERLVARI(runops, runops_proc_t *, RUNOPS_DEFAULT)
+PERLVAR(scopestack, I32 *) /* blocks we've entered */
+PERLVAR(scopestack_ix, I32)
+PERLVAR(scopestack_max, I32)
+
+PERLVAR(savestack, ANY*) /* to save non-local values on */
+PERLVAR(savestack_ix, I32)
+PERLVAR(savestack_max, I32)
+
+PERLVAR(retstack, OP **) /* returns we've pushed */
+PERLVAR(retstack_ix, I32)
+PERLVAR(retstack_max, I32)
+
+PERLVAR(markstack, I32 *) /* stackmarks we're remembering */
+PERLVAR(markstack_ptr, I32 *) /* stackmarks we're remembering */
+PERLVAR(markstack_max, I32 *) /* stackmarks we're remembering */
+
+PERLVAR(curpad, SV **)
+
+/* temp space */
+PERLVAR(Sv, SV *)
+PERLVAR(Xpv, XPV *)
+PERLVAR(tokenbuf[256], char)
+PERLVAR(statbuf, struct stat)
+#ifdef HAS_TIMES
+PERLVAR(timesbuf, struct tms)
+#endif
+#if defined(WIN32) && defined(__GNUC__)
+PERLVAR(na, static STRLEN)
+#else
+PERLVAR(na, STRLEN) /* for use in SvPV when length is Not Applicable */
+#endif
+
+PERLVAR(sv_undef, SV)
+PERLVAR(sv_no, SV)
+PERLVAR(sv_yes, SV)
+#ifdef CSH
+PERLVARI(cshname, char *, CSH)
+PERLVAR(cshlen, I32)
+#endif
+
+PERLVAR(lex_state, U32) /* next token is determined */
+PERLVAR(lex_defer, U32) /* state after determined token */
+PERLVAR(lex_expect, expectation) /* expect after determined token */
+PERLVAR(lex_brackets, I32) /* bracket count */
+PERLVAR(lex_formbrack, I32) /* bracket count at outer format level */
+PERLVAR(lex_fakebrack, I32) /* outer bracket is mere delimiter */
+PERLVAR(lex_casemods, I32) /* casemod count */
+PERLVAR(lex_dojoin, I32) /* doing an array interpolation */
+PERLVAR(lex_starts, I32) /* how many interps done on level */
+PERLVAR(lex_stuff, SV *) /* runtime pattern from m// or s/// */
+PERLVAR(lex_repl, SV *) /* runtime replacement from s/// */
+PERLVAR(lex_op, OP *) /* extra info to pass back on op */
+PERLVAR(lex_inpat, OP *) /* in pattern $) and $| are special */
+PERLVAR(lex_inwhat, I32) /* what kind of quoting are we in */
+PERLVAR(lex_brackstack, char *) /* what kind of brackets to pop */
+PERLVAR(lex_casestack, char *) /* what kind of case mods in effect */
+
+/* What we know when we're in LEX_KNOWNEXT state. */
+PERLVAR(nextval[5], YYSTYPE) /* value of next token, if any */
+PERLVAR(nexttype[5], I32) /* type of next token */
+PERLVAR(nexttoke, I32)
+
+PERLVARI(rsfp, PerlIO * VOL, Nullfp)
+PERLVAR(linestr, SV *)
+PERLVAR(bufptr, char *)
+PERLVAR(oldbufptr, char *)
+PERLVAR(oldoldbufptr, char *)
+PERLVAR(bufend, char *)
+PERLVARI(expect, expectation, XSTATE) /* how to interpret ambiguous tokens */
+PERLVAR(rsfp_filters, AV *)
+
+PERLVAR(multi_start, I32) /* 1st line of multi-line string */
+PERLVAR(multi_end, I32) /* last line of multi-line string */
+PERLVAR(multi_open, I32) /* delimiter of said string */
+PERLVAR(multi_close, I32) /* delimiter of said string */
+
+PERLVAR(scrgv, GV *)
+PERLVAR(error_count, I32) /* how many errors so far, max 10 */
+PERLVAR(subline, I32) /* line this subroutine began on */
+PERLVAR(subname, SV *) /* name of current subroutine */
+
+PERLVAR(compcv, CV *) /* currently compiling subroutine */
+PERLVAR(comppad, AV *) /* storage for lexically scoped temporaries */
+PERLVAR(comppad_name, AV *) /* variable names for "my" variables */
+PERLVAR(comppad_name_fill, I32) /* last "introduced" variable offset */
+PERLVAR(comppad_name_floor, I32) /* start of vars in innermost block */
+PERLVAR(min_intro_pending, I32) /* start of vars to introduce */
+PERLVAR(max_intro_pending, I32) /* end of vars to introduce */
+PERLVAR(padix, I32) /* max used index in current "register" pad */
+PERLVAR(padix_floor, I32) /* how low may inner block reset padix */
+PERLVAR(pad_reset_pending, I32) /* reset pad on next attempted alloc */
+PERLVAR(compiling, COP)
+
+PERLVAR(thisexpr, I32) /* name id for nothing_in_common() */
+PERLVAR(last_uni, char *) /* position of last named-unary operator */
+PERLVAR(last_lop, char *) /* position of last list operator */
+PERLVAR(last_lop_op, OPCODE) /* last list operator */
+PERLVAR(in_my, bool) /* we're compiling a "my" declaration */
+PERLVAR(in_my_stash, HV *) /* declared class of this "my" declaration */
+#ifdef FCRYPT
+PERLVAR(cryptseen, I32) /* has fast crypt() been initialized? */
+#endif
+
+PERLVAR(hints, U32) /* various compilation flags */
+
+PERLVAR(do_undump, bool) /* -u or dump seen? */
+PERLVAR(debug, VOL U32)
+
+
+#ifdef OVERLOAD
+
+PERLVAR(amagic_generation, long)
+
+#endif
+
+#ifdef USE_LOCALE_COLLATE
+PERLVAR(collation_ix, U32) /* Collation generation index */
+PERLVAR(collation_name, char *) /* Name of current collation */
+PERLVARI(collation_standard, bool, TRUE) /* Assume simple collation */
+PERLVAR(collxfrm_base, Size_t) /* Basic overhead in *xfrm() */
+PERLVARI(collxfrm_mult, Size_t, 2) /* Expansion factor in *xfrm() */
+#endif /* USE_LOCALE_COLLATE */
+
+#ifdef USE_LOCALE_NUMERIC
+
+PERLVAR(numeric_name, char *) /* Name of current numeric locale */
+PERLVARI(numeric_standard, bool, TRUE) /* Assume simple numerics */
+PERLVARI(numeric_local, bool, TRUE) /* Assume local numerics */
+
+#endif /* !USE_LOCALE_NUMERIC */
+
+#ifndef MULTIPLICITY
+#define IEXT EXT
+#define IINIT(x) INIT(x)
+#include "intrpvar.h"
+#undef IEXT
+#undef IINIT
+#endif
\ No newline at end of file
--- /dev/null
+/* Per-thread variables */
+/* Important ones in the first cache line (if alignment is done right) */
+PERLVAR(Tstack_sp, SV **)
+#ifdef OP_IN_REGISTER
+PERLVAR(Topsave, OP *)
+#else
+PERLVAR(Top, OP *)
+#endif
+PERLVAR(Tcurpad, SV **)
+PERLVAR(Tstack_base, SV **)
+
+PERLVAR(Tstack_max, SV **)
+
+PERLVAR(Tscopestack, I32 *)
+PERLVAR(Tscopestack_ix, I32)
+PERLVAR(Tscopestack_max,I32)
+
+PERLVAR(Tsavestack, ANY *)
+PERLVAR(Tsavestack_ix, I32)
+PERLVAR(Tsavestack_max, I32)
+
+PERLVAR(Tretstack, OP **)
+PERLVAR(Tretstack_ix, I32)
+PERLVAR(Tretstack_max, I32)
+
+PERLVAR(Tmarkstack, I32 *)
+PERLVAR(Tmarkstack_ptr, I32 *)
+PERLVAR(Tmarkstack_max, I32 *)
+
+PERLVAR(TSv, SV *)
+PERLVAR(TXpv, XPV *)
+PERLVAR(Tstatbuf, struct stat)
+#ifdef HAS_TIMES
+PERLVAR(Ttimesbuf, struct tms)
+#endif
+
+/* XXX What about regexp stuff? */
+
+/* Now the fields that used to be "per interpreter" (even when global) */
+
+/* Fields used by magic variables such as $@, $/ and so on */
+PERLVAR(Ttainted, bool)
+PERLVAR(Tcurpm, PMOP *)
+PERLVAR(Tnrs, SV *)
+PERLVAR(Trs, SV *)
+PERLVAR(Tlast_in_gv, GV *)
+PERLVAR(Tofs, char *)
+PERLVAR(Tofslen, STRLEN)
+PERLVAR(Tdefoutgv, GV *)
+PERLVAR(Tchopset, char *)
+PERLVAR(Tformtarget, SV *)
+PERLVAR(Tbodytarget, SV *)
+PERLVAR(Ttoptarget, SV *)
+
+ /* Stashes */
+PERLVAR(Tdefstash, HV *)
+PERLVAR(Tcurstash, HV *)
+
+ /* Stacks */
+PERLVAR(Ttmps_stack, SV **)
+PERLVAR(Ttmps_ix, I32)
+PERLVAR(Ttmps_floor, I32)
+PERLVAR(Ttmps_max, I32)
+
+PERLVAR(Tin_eval, int)
+PERLVAR(Trestartop, OP *)
+PERLVAR(Tdelaymagic, int)
+PERLVAR(Tdirty, bool)
+PERLVAR(Tlocalizing, U8)
+PERLVAR(Tcurcop, COP *)
+
+PERLVAR(Tcxstack, PERL_CONTEXT *)
+PERLVAR(Tcxstack_ix, I32)
+PERLVAR(Tcxstack_max, I32)
+
+PERLVAR(Tcurstack, AV *)
+PERLVAR(Tmainstack, AV *)
+PERLVAR(Ttop_env, JMPENV *)
+PERLVAR(Tstart_env, JMPENV) /* Top of top_env longjmp() chain */
+
+/* XXX Sort stuff, firstgv secongv and so on? */
+
+PERLVAR(oursv, SV *)
+PERLVAR(cvcache, HV *)
+PERLVAR(self, perl_os_thread) /* Underlying thread object */
+PERLVAR(flags, U32)
+PERLVAR(threadsv, AV *) /* Per-thread SVs ($_, $@ etc.) */
+PERLVAR(specific, AV *) /* Thread-specific user data */
+PERLVAR(errsv, SV *) /* Backing SV for $@ */
+PERLVAR(errhv, HV *) /* HV for what was %@ in pp_ctl.c */
+PERLVAR(mutex, perl_mutex) /* For the fields others can change */
+PERLVAR(tid, U32)
+PERLVAR(prev, struct perl_thread *)
+PERLVAR(next, struct perl_thread *) /* Circular linked list of threads */
+
+#ifdef HAVE_THREAD_INTERN
+PERLVAR(i, struct thread_intern) /* Platform-dependent internals */
+#endif
+
+PERLVAR(trailing_nul, char) /* For the sake of thrsv and oursv */
+
# define THREAD_RET_CAST(p) ((void *)(p))
#endif /* THREAD_RET */
-struct perl_thread {
- /* The fields that used to be global */
- /* Important ones in the first cache line (if alignment is done right) */
- SV ** Tstack_sp;
-#ifdef OP_IN_REGISTER
- OP * Topsave;
-#else
- OP * Top;
-#endif
- SV ** Tcurpad;
- SV ** Tstack_base;
-
- SV ** Tstack_max;
-
- I32 * Tscopestack;
- I32 Tscopestack_ix;
- I32 Tscopestack_max;
-
- ANY * Tsavestack;
- I32 Tsavestack_ix;
- I32 Tsavestack_max;
-
- OP ** Tretstack;
- I32 Tretstack_ix;
- I32 Tretstack_max;
-
- I32 * Tmarkstack;
- I32 * Tmarkstack_ptr;
- I32 * Tmarkstack_max;
-
- SV * TSv;
- XPV * TXpv;
- struct stat Tstatbuf;
-#ifdef HAS_TIMES
- struct tms Ttimesbuf;
-#endif
-
- /* XXX What about regexp stuff? */
-
- /* Now the fields that used to be "per interpreter" (even when global) */
-
- /* Fields used by magic variables such as $@, $/ and so on */
- bool Ttainted;
- PMOP * Tcurpm;
- SV * Tnrs;
- SV * Trs;
- GV * Tlast_in_gv;
- char * Tofs;
- STRLEN Tofslen;
- GV * Tdefoutgv;
- char * Tchopset;
- SV * Tformtarget;
- SV * Tbodytarget;
- SV * Ttoptarget;
-
- /* Stashes */
- HV * Tdefstash;
- HV * Tcurstash;
-
- /* Stacks */
- SV ** Ttmps_stack;
- I32 Ttmps_ix;
- I32 Ttmps_floor;
- I32 Ttmps_max;
-
- int Tin_eval;
- OP * Trestartop;
- int Tdelaymagic;
- bool Tdirty;
- U8 Tlocalizing;
- COP * Tcurcop;
-
- PERL_CONTEXT * Tcxstack;
- I32 Tcxstack_ix;
- I32 Tcxstack_max;
-
- AV * Tcurstack;
- AV * Tmainstack;
- JMPENV * Ttop_env;
-
- /* XXX Sort stuff, firstgv, secongv and so on? */
-
- SV * oursv;
- HV * cvcache;
- perl_os_thread self; /* Underlying thread object */
- U32 flags;
- AV * threadsv; /* Per-thread SVs ($_, $@ etc.) */
- AV * specific; /* Thread-specific user data */
- SV * errsv; /* Backing SV for $@ */
- HV * errhv; /* HV for what was %@ in pp_ctl.c */
- perl_mutex mutex; /* For the fields others can change */
- U32 tid;
- struct perl_thread *next, *prev; /* Circular linked list of threads */
- JMPENV Tstart_env; /* Top of top_env longjmp() chain */
-#ifdef HAVE_THREAD_INTERN
- struct thread_intern i; /* Platform-dependent internals */
-#endif
- char trailing_nul; /* For the sake of thrsv and oursv */
-};
-
-typedef struct perl_thread *Thread;
/* Values and macros for thr->flags */
#define THRf_STATE_MASK 7
..\XSUB.h \
.\config.h \
..\EXTERN.h \
+ ..\perlvars.h \
+ ..\intrpvar.h \
.\include\dirent.h \
.\include\netdb.h \
.\include\sys\socket.h \