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