[asperl] various tweaks
[p5sagit/p5-mst-13.2.git] / perlvars.h
CommitLineData
49f531da 1/* This file describes the "global" variables used by perl */
2/* This used to be in perl.h directly but we want to */
3/* abstract out which are per-thread per-interpreter really */
4/* global and how initialized into one file */
5
6/****************/
7/* Truly global */
8/****************/
9
10/* global state */
22239a37 11PERLVAR(Gcurinterp, PerlInterpreter *) /* currently running interpreter */
49f531da 12#ifdef USE_THREADS
22239a37 13PERLVAR(Gthr_key, perl_key) /* For per-thread struct perl_thread* */
14PERLVAR(Gsv_mutex, perl_mutex) /* Mutex for allocating SVs in sv.c */
15PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */
16PERLVAR(Geval_mutex, perl_mutex) /* Mutex for doeval */
17PERLVAR(Geval_cond, perl_cond) /* Condition variable for doeval */
18PERLVAR(Geval_owner, struct perl_thread *) /* Owner thread for doeval */
19PERLVAR(Gnthreads, int) /* Number of threads currently */
20PERLVAR(Gthreads_mutex, perl_mutex) /* Mutex for nthreads and thread list */
21PERLVAR(Gnthreads_cond, perl_cond) /* Condition variable for nthreads */
22PERLVARI(Gthreadsv_names, char *, THREADSV_NAMES)
49f531da 23#ifdef FAKE_THREADS
22239a37 24PERLVAR(Gcurthr, struct perl_thread *) /* Currently executing (fake) thread */
49f531da 25#endif
26#endif /* USE_THREADS */
76e3520e 27#ifdef PERL_OBJECT
28/* TODO: move into thread section */
29PERLVAR(Gsort_mutex, CRITICAL_SECTION) /* Mutex for qsort */
30#ifdef WIN32
31PERLVAR(Gerror_no, int) /* errno for each interpreter */
32#endif
33#endif
49f531da 34
22239a37 35PERLVAR(Guid, int) /* current real user id */
36PERLVAR(Geuid, int) /* current effective user id */
37PERLVAR(Ggid, int) /* current real group id */
38PERLVAR(Gegid, int) /* current effective group id */
39PERLVAR(Gnomemok, bool) /* let malloc context handle nomem */
40PERLVAR(Gan, U32) /* malloc sequence number */
41PERLVAR(Gcop_seqmax, U32) /* statement sequence number */
42PERLVAR(Gop_seqmax, U16) /* op sequence number */
43PERLVAR(Gevalseq, U32) /* eval sequence number */
44PERLVAR(Gsub_generation, U32) /* inc to force methods to be looked up again */
45PERLVAR(Gorigenviron, char **)
46PERLVAR(Gorigalen, U32)
47PERLVAR(Gpidstatus, HV *) /* pid-to-status mappings for waitpid */
48PERLVAR(Gprofiledata, U32 *)
49PERLVARI(Gmaxo, int, MAXO) /* Number of ops */
50PERLVAR(Gosname, char *) /* operating system */
51PERLVARI(Gsh_path, char *, SH_PATH) /* full path of shell */
52PERLVAR(Gsighandlerp, Sighandler_t)
53
54PERLVAR(Gxiv_arenaroot, XPV*) /* list of allocated xiv areas */
55PERLVAR(Gxiv_root, IV **) /* free xiv list--shared by interpreters */
56PERLVAR(Gxnv_root, double *) /* free xnv list--shared by interpreters */
57PERLVAR(Gxrv_root, XRV *) /* free xrv list--shared by interpreters */
58PERLVAR(Gxpv_root, XPV *) /* free xpv list--shared by interpreters */
59PERLVAR(Ghe_root, HE *) /* free he list--shared by interpreters */
60PERLVAR(Gnice_chunk, char *) /* a nice chunk of memory to reuse */
61PERLVAR(Gnice_chunk_size, U32) /* how nice the chunk of memory is */
62
76e3520e 63#ifdef PERL_OBJECT
64PERLVAR(Grunops, runops_proc_t)
65#else
22239a37 66PERLVARI(Grunops, runops_proc_t *, RUNOPS_DEFAULT)
76e3520e 67#endif
22239a37 68
69PERLVAR(Gtokenbuf[256], char)
70PERLVAR(Gna, STRLEN) /* for use in SvPV when length is Not Applicable */
71
72PERLVAR(Gsv_undef, SV)
73PERLVAR(Gsv_no, SV)
74PERLVAR(Gsv_yes, SV)
49f531da 75#ifdef CSH
22239a37 76PERLVARI(Gcshname, char *, CSH)
77PERLVAR(Gcshlen, I32)
49f531da 78#endif
79
22239a37 80PERLVAR(Glex_state, U32) /* next token is determined */
81PERLVAR(Glex_defer, U32) /* state after determined token */
82PERLVAR(Glex_expect, expectation) /* expect after determined token */
83PERLVAR(Glex_brackets, I32) /* bracket count */
84PERLVAR(Glex_formbrack, I32) /* bracket count at outer format level */
85PERLVAR(Glex_fakebrack, I32) /* outer bracket is mere delimiter */
86PERLVAR(Glex_casemods, I32) /* casemod count */
87PERLVAR(Glex_dojoin, I32) /* doing an array interpolation */
88PERLVAR(Glex_starts, I32) /* how many interps done on level */
89PERLVAR(Glex_stuff, SV *) /* runtime pattern from m// or s/// */
90PERLVAR(Glex_repl, SV *) /* runtime replacement from s/// */
91PERLVAR(Glex_op, OP *) /* extra info to pass back on op */
92PERLVAR(Glex_inpat, OP *) /* in pattern $) and $| are special */
93PERLVAR(Glex_inwhat, I32) /* what kind of quoting are we in */
94PERLVAR(Glex_brackstack, char *) /* what kind of brackets to pop */
95PERLVAR(Glex_casestack, char *) /* what kind of case mods in effect */
49f531da 96
97/* What we know when we're in LEX_KNOWNEXT state. */
22239a37 98PERLVAR(Gnextval[5], YYSTYPE) /* value of next token, if any */
99PERLVAR(Gnexttype[5], I32) /* type of next token */
100PERLVAR(Gnexttoke, I32)
101
102PERLVARI(Grsfp, PerlIO * VOL, Nullfp)
103PERLVAR(Glinestr, SV *)
104PERLVAR(Gbufptr, char *)
105PERLVAR(Goldbufptr, char *)
106PERLVAR(Goldoldbufptr, char *)
107PERLVAR(Gbufend, char *)
108PERLVARI(Gexpect, expectation, XSTATE) /* how to interpret ambiguous tokens */
109PERLVAR(Grsfp_filters, AV *)
110
111PERLVAR(Gmulti_start, I32) /* 1st line of multi-line string */
112PERLVAR(Gmulti_end, I32) /* last line of multi-line string */
113PERLVAR(Gmulti_open, I32) /* delimiter of said string */
114PERLVAR(Gmulti_close, I32) /* delimiter of said string */
115
116PERLVAR(Gscrgv, GV *)
117PERLVAR(Gerror_count, I32) /* how many errors so far, max 10 */
118PERLVAR(Gsubline, I32) /* line this subroutine began on */
119PERLVAR(Gsubname, SV *) /* name of current subroutine */
120
121PERLVAR(Gcompcv, CV *) /* currently compiling subroutine */
122PERLVAR(Gcomppad, AV *) /* storage for lexically scoped temporaries */
123PERLVAR(Gcomppad_name, AV *) /* variable names for "my" variables */
124PERLVAR(Gcomppad_name_fill, I32) /* last "introduced" variable offset */
125PERLVAR(Gcomppad_name_floor, I32) /* start of vars in innermost block */
126PERLVAR(Gmin_intro_pending, I32) /* start of vars to introduce */
127PERLVAR(Gmax_intro_pending, I32) /* end of vars to introduce */
128PERLVAR(Gpadix, I32) /* max used index in current "register" pad */
129PERLVAR(Gpadix_floor, I32) /* how low may inner block reset padix */
130PERLVAR(Gpad_reset_pending, I32) /* reset pad on next attempted alloc */
131PERLVAR(Gcompiling, COP)
132
133PERLVAR(Gthisexpr, I32) /* name id for nothing_in_common() */
134PERLVAR(Glast_uni, char *) /* position of last named-unary operator */
135PERLVAR(Glast_lop, char *) /* position of last list operator */
136PERLVAR(Glast_lop_op, OPCODE) /* last list operator */
137PERLVAR(Gin_my, bool) /* we're compiling a "my" declaration */
138PERLVAR(Gin_my_stash, HV *) /* declared class of this "my" declaration */
49f531da 139#ifdef FCRYPT
22239a37 140PERLVAR(Gcryptseen, I32) /* has fast crypt() been initialized? */
49f531da 141#endif
142
22239a37 143PERLVAR(Ghints, U32) /* various compilation flags */
49f531da 144
22239a37 145PERLVAR(Gdo_undump, bool) /* -u or dump seen? */
146PERLVAR(Gdebug, VOL U32)
49f531da 147
148
149#ifdef OVERLOAD
150
22239a37 151PERLVAR(Gamagic_generation, long)
49f531da 152
153#endif
154
155#ifdef USE_LOCALE_COLLATE
22239a37 156PERLVAR(Gcollation_ix, U32) /* Collation generation index */
157PERLVAR(Gcollation_name, char *) /* Name of current collation */
158PERLVARI(Gcollation_standard, bool, TRUE) /* Assume simple collation */
159PERLVAR(Gcollxfrm_base, Size_t) /* Basic overhead in *xfrm() */
160PERLVARI(Gcollxfrm_mult, Size_t, 2) /* Expansion factor in *xfrm() */
49f531da 161#endif /* USE_LOCALE_COLLATE */
162
163#ifdef USE_LOCALE_NUMERIC
164
22239a37 165PERLVAR(Gnumeric_name, char *) /* Name of current numeric locale */
166PERLVARI(Gnumeric_standard, bool, TRUE) /* Assume simple numerics */
167PERLVARI(Gnumeric_local, bool, TRUE) /* Assume local numerics */
49f531da 168
169#endif /* !USE_LOCALE_NUMERIC */
170
3fe35a81 171/* constants (these are not literals to facilitate pointer comparisons) */
3fe6f2dc 172PERLVARIC(GYes, char *, "1")
173PERLVARIC(GNo, char *, "")
174PERLVARIC(Ghexdigit, char *, "0123456789abcdef0123456789ABCDEFx")
175PERLVARIC(Gpatleave, char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}")
3fe35a81 176