This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Benchmark.pm suggestion
[perl5.git] / perlvars.h
CommitLineData
49f531da
NIS
1/****************/
2/* Truly global */
3/****************/
4
cb68f92d
GS
5/* Don't forget to re-run embed.pl to propagate changes! */
6
7/* This file describes the "global" variables used by perl
8 * This used to be in perl.h directly but we want to abstract out into
9 * distinct files which are per-thread, per-interpreter or really global,
10 * and how they're initialized.
11 *
12 * The 'G' prefix is only needed for vars that need appropriate #defines
22c35a8c 13 * generated in embed*.h. Such symbols are also used to generate
cb68f92d
GS
14 * the appropriate export list for win32.
15 *
16 * Avoid build-specific #ifdefs here, like DEBUGGING. That way,
17 * we can keep binary compatibility of the curinterp structure */
18
19
49f531da 20/* global state */
cb68f92d
GS
21PERLVAR(Gcurinterp, PerlInterpreter *)
22 /* currently running interpreter */
49f531da 23#ifdef USE_THREADS
cb68f92d
GS
24PERLVAR(Gthr_key, perl_key) /* For per-thread struct perl_thread* */
25PERLVAR(Gsv_mutex, perl_mutex) /* Mutex for allocating SVs in sv.c */
26PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */
27PERLVAR(Geval_mutex, perl_mutex) /* Mutex for doeval */
28PERLVAR(Geval_cond, perl_cond) /* Condition variable for doeval */
29PERLVAR(Geval_owner, struct perl_thread *)
30 /* Owner thread for doeval */
22239a37 31PERLVAR(Gnthreads, int) /* Number of threads currently */
cb68f92d
GS
32PERLVAR(Gthreads_mutex, perl_mutex) /* Mutex for nthreads and thread list */
33PERLVAR(Gnthreads_cond, perl_cond) /* Condition variable for nthreads */
34PERLVAR(Gsvref_mutex, perl_mutex) /* Mutex for SvREFCNT_{inc,dec} */
35PERLVARI(Gthreadsv_names,char *, THREADSV_NAMES)
49f531da 36#ifdef FAKE_THREADS
cb68f92d
GS
37PERLVAR(Gcurthr, struct perl_thread *)
38 /* Currently executing (fake) thread */
49f531da 39#endif
5ff3f7a4
GS
40
41PERLVAR(Gcred_mutex, perl_mutex) /* altered credentials in effect */
42
49f531da
NIS
43#endif /* USE_THREADS */
44
cb68f92d
GS
45PERLVAR(Gninterps, int) /* number of active interpreters */
46
47PERLVAR(Guid, int) /* current real user id */
48PERLVAR(Geuid, int) /* current effective user id */
49PERLVAR(Ggid, int) /* current real group id */
50PERLVAR(Gegid, int) /* current effective group id */
22239a37 51PERLVAR(Gnomemok, bool) /* let malloc context handle nomem */
cb68f92d 52PERLVAR(Gan, U32) /* malloc sequence number */
22239a37
NIS
53PERLVAR(Gcop_seqmax, U32) /* statement sequence number */
54PERLVAR(Gop_seqmax, U16) /* op sequence number */
55PERLVAR(Gevalseq, U32) /* eval sequence number */
cb68f92d
GS
56PERLVAR(Gorigenviron, char **)
57PERLVAR(Gorigalen, U32)
22239a37 58PERLVAR(Gpidstatus, HV *) /* pid-to-status mappings for waitpid */
cb68f92d 59PERLVARI(Gmaxo, int, MAXO) /* maximum number of ops */
22239a37 60PERLVAR(Gosname, char *) /* operating system */
cb68f92d
GS
61PERLVARI(Gsh_path, char *, SH_PATH)/* full path of shell */
62PERLVAR(Gsighandlerp, Sighandler_t)
22239a37
NIS
63
64PERLVAR(Gxiv_arenaroot, XPV*) /* list of allocated xiv areas */
ea7c11a3 65PERLVAR(Gxiv_root, IV *) /* free xiv list--shared by interpreters */
cb68f92d 66PERLVAR(Gxnv_root, double *) /* free xnv list--shared by interpreters */
22239a37
NIS
67PERLVAR(Gxrv_root, XRV *) /* free xrv list--shared by interpreters */
68PERLVAR(Gxpv_root, XPV *) /* free xpv list--shared by interpreters */
69PERLVAR(Ghe_root, HE *) /* free he list--shared by interpreters */
70PERLVAR(Gnice_chunk, char *) /* a nice chunk of memory to reuse */
cb68f92d 71PERLVAR(Gnice_chunk_size, U32) /* how nice the chunk of memory is */
22239a37 72
cb68f92d 73PERLVARI(Grunops, runops_proc_t, FUNC_NAME_TO_PTR(RUNOPS_DEFAULT))
22239a37 74
cb68f92d
GS
75PERLVAR(Gtokenbuf[256], char)
76PERLVAR(Gna, STRLEN) /* for use in SvPV when length is
77 Not Applicable */
22239a37 78
cb68f92d
GS
79PERLVAR(Gsv_undef, SV)
80PERLVAR(Gsv_no, SV)
81PERLVAR(Gsv_yes, SV)
49f531da 82#ifdef CSH
cb68f92d
GS
83PERLVARI(Gcshname, char *, CSH)
84PERLVAR(Gcshlen, I32)
49f531da
NIS
85#endif
86
22239a37
NIS
87PERLVAR(Glex_state, U32) /* next token is determined */
88PERLVAR(Glex_defer, U32) /* state after determined token */
cb68f92d 89PERLVAR(Glex_expect, expectation) /* expect after determined token */
22239a37
NIS
90PERLVAR(Glex_brackets, I32) /* bracket count */
91PERLVAR(Glex_formbrack, I32) /* bracket count at outer format level */
92PERLVAR(Glex_fakebrack, I32) /* outer bracket is mere delimiter */
93PERLVAR(Glex_casemods, I32) /* casemod count */
94PERLVAR(Glex_dojoin, I32) /* doing an array interpolation */
95PERLVAR(Glex_starts, I32) /* how many interps done on level */
96PERLVAR(Glex_stuff, SV *) /* runtime pattern from m// or s/// */
97PERLVAR(Glex_repl, SV *) /* runtime replacement from s/// */
98PERLVAR(Glex_op, OP *) /* extra info to pass back on op */
99PERLVAR(Glex_inpat, OP *) /* in pattern $) and $| are special */
100PERLVAR(Glex_inwhat, I32) /* what kind of quoting are we in */
cb68f92d 101PERLVAR(Glex_brackstack,char *) /* what kind of brackets to pop */
22239a37 102PERLVAR(Glex_casestack, char *) /* what kind of case mods in effect */
49f531da
NIS
103
104/* What we know when we're in LEX_KNOWNEXT state. */
cb68f92d 105PERLVAR(Gnextval[5], YYSTYPE) /* value of next token, if any */
22239a37 106PERLVAR(Gnexttype[5], I32) /* type of next token */
cb68f92d 107PERLVAR(Gnexttoke, I32)
22239a37 108
cb68f92d
GS
109PERLVAR(Glinestr, SV *)
110PERLVAR(Gbufptr, char *)
111PERLVAR(Goldbufptr, char *)
112PERLVAR(Goldoldbufptr, char *)
113PERLVAR(Gbufend, char *)
114PERLVARI(Gexpect,expectation, XSTATE) /* how to interpret ambiguous tokens */
22239a37
NIS
115
116PERLVAR(Gmulti_start, I32) /* 1st line of multi-line string */
117PERLVAR(Gmulti_end, I32) /* last line of multi-line string */
118PERLVAR(Gmulti_open, I32) /* delimiter of said string */
119PERLVAR(Gmulti_close, I32) /* delimiter of said string */
120
22239a37
NIS
121PERLVAR(Gerror_count, I32) /* how many errors so far, max 10 */
122PERLVAR(Gsubline, I32) /* line this subroutine began on */
123PERLVAR(Gsubname, SV *) /* name of current subroutine */
124
cb68f92d
GS
125PERLVAR(Gmin_intro_pending, I32) /* start of vars to introduce */
126PERLVAR(Gmax_intro_pending, I32) /* end of vars to introduce */
127PERLVAR(Gpadix, I32) /* max used index in current "register" pad */
22239a37 128PERLVAR(Gpadix_floor, I32) /* how low may inner block reset padix */
cb68f92d 129PERLVAR(Gpad_reset_pending, I32) /* reset pad on next attempted alloc */
22239a37
NIS
130
131PERLVAR(Gthisexpr, I32) /* name id for nothing_in_common() */
cb68f92d 132PERLVAR(Glast_uni, char *) /* position of last named-unary op */
22239a37
NIS
133PERLVAR(Glast_lop, char *) /* position of last list operator */
134PERLVAR(Glast_lop_op, OPCODE) /* last list operator */
cb68f92d 135PERLVAR(Gin_my, bool) /* we're compiling a "my" declaration */
22239a37 136PERLVAR(Gin_my_stash, HV *) /* declared class of this "my" declaration */
49f531da 137#ifdef FCRYPT
22239a37 138PERLVAR(Gcryptseen, I32) /* has fast crypt() been initialized? */
49f531da
NIS
139#endif
140
cb68f92d 141PERLVAR(Ghints, U32) /* pragma-tic compile-time flags */
49f531da 142
22239a37 143PERLVAR(Gdo_undump, bool) /* -u or dump seen? */
cb68f92d 144PERLVAR(Gdebug, VOL U32) /* flags given to -D switch */
49f531da
NIS
145
146
147#ifdef OVERLOAD
148
cb68f92d 149PERLVAR(Gamagic_generation, long)
49f531da
NIS
150
151#endif
152
153#ifdef USE_LOCALE_COLLATE
22239a37 154PERLVAR(Gcollation_ix, U32) /* Collation generation index */
cb68f92d
GS
155PERLVAR(Gcollation_name,char *) /* Name of current collation */
156PERLVARI(Gcollation_standard, bool, TRUE)
157 /* Assume simple collation */
22239a37 158PERLVAR(Gcollxfrm_base, Size_t) /* Basic overhead in *xfrm() */
cb68f92d 159PERLVARI(Gcollxfrm_mult,Size_t, 2) /* Expansion factor in *xfrm() */
49f531da
NIS
160#endif /* USE_LOCALE_COLLATE */
161
162#ifdef USE_LOCALE_NUMERIC
163
22239a37 164PERLVAR(Gnumeric_name, char *) /* Name of current numeric locale */
cb68f92d
GS
165PERLVARI(Gnumeric_standard, bool, TRUE)
166 /* Assume simple numerics */
167PERLVARI(Gnumeric_local, bool, TRUE)
168 /* Assume local numerics */
49f531da
NIS
169
170#endif /* !USE_LOCALE_NUMERIC */
171
a0ed51b3 172/* utf8 character classes */
d3b6f988
GS
173PERLVAR(Gutf8_alnum, SV *)
174PERLVAR(Gutf8_alpha, SV *)
175PERLVAR(Gutf8_space, SV *)
176PERLVAR(Gutf8_digit, SV *)
177PERLVAR(Gutf8_upper, SV *)
178PERLVAR(Gutf8_lower, SV *)
179PERLVAR(Gutf8_print, SV *)
180PERLVAR(Gutf8_mark, SV *)
181PERLVAR(Gutf8_toupper, SV *)
182PERLVAR(Gutf8_totitle, SV *)
183PERLVAR(Gutf8_tolower, SV *)
184PERLVAR(Glast_swash_hv, HV *)
185PERLVAR(Glast_swash_klen, U32)
186PERLVAR(Glast_swash_key[10], U8)
187PERLVAR(Glast_swash_tmps, U8 *)
188PERLVAR(Glast_swash_slen, STRLEN)
a0ed51b3 189
3fe35a81 190/* constants (these are not literals to facilitate pointer comparisons) */
3fe6f2dc
MB
191PERLVARIC(GYes, char *, "1")
192PERLVARIC(GNo, char *, "")
e3fdf988 193PERLVARIC(Ghexdigit, char *, "0123456789abcdef0123456789ABCDEF")
3fe6f2dc 194PERLVARIC(Gpatleave, char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}")
3fe35a81 195
cb68f92d 196PERLVAR(Gspecialsv_list[4],SV *) /* from byterun.h */
e2d46a1d 197
d3b6f988
GS
198/* perly.c globals */
199PERLVAR(Gyydebug, int)
200PERLVAR(Gyynerrs, int)
201PERLVAR(Gyyerrflag, int)
202PERLVAR(Gyychar, int)
d3b6f988
GS
203PERLVAR(Gyyval, YYSTYPE)
204PERLVAR(Gyylval, YYSTYPE)