This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Globals and structs via macros - part 1 of N
[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 */
11PERLVAR(curinterp, PerlInterpreter *) /* currently running interpreter */
12#ifdef USE_THREADS
13PERLVAR(thr_key, perl_key) /* For per-thread struct perl_thread* */
14PERLVAR(sv_mutex, perl_mutex) /* Mutex for allocating SVs in sv.c */
15PERLVAR(malloc_mutex, perl_mutex) /* Mutex for malloc */
16PERLVAR(eval_mutex, perl_mutex) /* Mutex for doeval */
17PERLVAR(eval_cond, perl_cond) /* Condition variable for doeval */
18PERLVAR(eval_owner, struct perl_thread *) /* Owner thread for doeval */
19PERLVAR(nthreads, int) /* Number of threads currently */
20PERLVAR(threads_mutex, perl_mutex) /* Mutex for nthreads and thread list */
21PERLVAR(nthreads_cond, perl_cond) /* Condition variable for nthreads */
22PERLVARI(threadsv_names, char *, THREADSV_NAMES)
23#ifdef FAKE_THREADS
24PERLVAR(thr, struct perl_thread *) /* Currently executing (fake) thread */
25#endif
26#endif /* USE_THREADS */
27
28PERLVAR(uid, int) /* current real user id */
29PERLVAR(euid, int) /* current effective user id */
30PERLVAR(gid, int) /* current real group id */
31PERLVAR(egid, int) /* current effective group id */
32PERLVAR(nomemok, bool) /* let malloc context handle nomem */
33PERLVAR(an, U32) /* malloc sequence number */
34PERLVAR(cop_seqmax, U32) /* statement sequence number */
35PERLVAR(op_seqmax, U16) /* op sequence number */
36PERLVAR(evalseq, U32) /* eval sequence number */
37PERLVAR(sub_generation, U32) /* inc to force methods to be looked up again */
38PERLVAR(origenviron, char **)
39PERLVAR(origalen, U32)
40PERLVAR(pidstatus, HV *) /* pid-to-status mappings for waitpid */
41PERLVAR(profiledata, U32 *)
42PERLVARI(maxo, int, MAXO) /* Number of ops */
43PERLVAR(osname, char *) /* operating system */
44PERLVARI(sh_path, char *, SH_PATH) /* full path of shell */
45PERLVAR(sighandlerp, Sighandler_t)
46
47PERLVAR(xiv_arenaroot, XPV*) /* list of allocated xiv areas */
48PERLVAR(xiv_root, IV **) /* free xiv list--shared by interpreters */
49PERLVAR(xnv_root, double *) /* free xnv list--shared by interpreters */
50PERLVAR(xrv_root, XRV *) /* free xrv list--shared by interpreters */
51PERLVAR(xpv_root, XPV *) /* free xpv list--shared by interpreters */
52PERLVAR(he_root, HE *) /* free he list--shared by interpreters */
53PERLVAR(nice_chunk, char *) /* a nice chunk of memory to reuse */
54PERLVAR(nice_chunk_size, U32) /* how nice the chunk of memory is */
55
56/* Stack for currently executing thread--context switch must handle this. */
57PERLVAR(stack_base, SV **) /* stack->array_ary */
58PERLVAR(stack_sp, SV **) /* stack pointer now */
59PERLVAR(stack_max, SV **) /* stack->array_ary + stack->array_max */
60
61/* likewise for these */
62
63#ifdef OP_IN_REGISTER
64PERLVAR(opsave, OP *) /* save current op register across longjmps */
65#else
66PERLVAR(op, OP *) /* current op--when not in a global register */
67#endif
68PERLVARI(runops, runops_proc_t *, RUNOPS_DEFAULT)
69PERLVAR(scopestack, I32 *) /* blocks we've entered */
70PERLVAR(scopestack_ix, I32)
71PERLVAR(scopestack_max, I32)
72
73PERLVAR(savestack, ANY*) /* to save non-local values on */
74PERLVAR(savestack_ix, I32)
75PERLVAR(savestack_max, I32)
76
77PERLVAR(retstack, OP **) /* returns we've pushed */
78PERLVAR(retstack_ix, I32)
79PERLVAR(retstack_max, I32)
80
81PERLVAR(markstack, I32 *) /* stackmarks we're remembering */
82PERLVAR(markstack_ptr, I32 *) /* stackmarks we're remembering */
83PERLVAR(markstack_max, I32 *) /* stackmarks we're remembering */
84
85PERLVAR(curpad, SV **)
86
87/* temp space */
88PERLVAR(Sv, SV *)
89PERLVAR(Xpv, XPV *)
90PERLVAR(tokenbuf[256], char)
91PERLVAR(statbuf, struct stat)
92#ifdef HAS_TIMES
93PERLVAR(timesbuf, struct tms)
94#endif
95#if defined(WIN32) && defined(__GNUC__)
96PERLVAR(na, static STRLEN)
97#else
98PERLVAR(na, STRLEN) /* for use in SvPV when length is Not Applicable */
99#endif
100
101PERLVAR(sv_undef, SV)
102PERLVAR(sv_no, SV)
103PERLVAR(sv_yes, SV)
104#ifdef CSH
105PERLVARI(cshname, char *, CSH)
106PERLVAR(cshlen, I32)
107#endif
108
109PERLVAR(lex_state, U32) /* next token is determined */
110PERLVAR(lex_defer, U32) /* state after determined token */
111PERLVAR(lex_expect, expectation) /* expect after determined token */
112PERLVAR(lex_brackets, I32) /* bracket count */
113PERLVAR(lex_formbrack, I32) /* bracket count at outer format level */
114PERLVAR(lex_fakebrack, I32) /* outer bracket is mere delimiter */
115PERLVAR(lex_casemods, I32) /* casemod count */
116PERLVAR(lex_dojoin, I32) /* doing an array interpolation */
117PERLVAR(lex_starts, I32) /* how many interps done on level */
118PERLVAR(lex_stuff, SV *) /* runtime pattern from m// or s/// */
119PERLVAR(lex_repl, SV *) /* runtime replacement from s/// */
120PERLVAR(lex_op, OP *) /* extra info to pass back on op */
121PERLVAR(lex_inpat, OP *) /* in pattern $) and $| are special */
122PERLVAR(lex_inwhat, I32) /* what kind of quoting are we in */
123PERLVAR(lex_brackstack, char *) /* what kind of brackets to pop */
124PERLVAR(lex_casestack, char *) /* what kind of case mods in effect */
125
126/* What we know when we're in LEX_KNOWNEXT state. */
127PERLVAR(nextval[5], YYSTYPE) /* value of next token, if any */
128PERLVAR(nexttype[5], I32) /* type of next token */
129PERLVAR(nexttoke, I32)
130
131PERLVARI(rsfp, PerlIO * VOL, Nullfp)
132PERLVAR(linestr, SV *)
133PERLVAR(bufptr, char *)
134PERLVAR(oldbufptr, char *)
135PERLVAR(oldoldbufptr, char *)
136PERLVAR(bufend, char *)
137PERLVARI(expect, expectation, XSTATE) /* how to interpret ambiguous tokens */
138PERLVAR(rsfp_filters, AV *)
139
140PERLVAR(multi_start, I32) /* 1st line of multi-line string */
141PERLVAR(multi_end, I32) /* last line of multi-line string */
142PERLVAR(multi_open, I32) /* delimiter of said string */
143PERLVAR(multi_close, I32) /* delimiter of said string */
144
145PERLVAR(scrgv, GV *)
146PERLVAR(error_count, I32) /* how many errors so far, max 10 */
147PERLVAR(subline, I32) /* line this subroutine began on */
148PERLVAR(subname, SV *) /* name of current subroutine */
149
150PERLVAR(compcv, CV *) /* currently compiling subroutine */
151PERLVAR(comppad, AV *) /* storage for lexically scoped temporaries */
152PERLVAR(comppad_name, AV *) /* variable names for "my" variables */
153PERLVAR(comppad_name_fill, I32) /* last "introduced" variable offset */
154PERLVAR(comppad_name_floor, I32) /* start of vars in innermost block */
155PERLVAR(min_intro_pending, I32) /* start of vars to introduce */
156PERLVAR(max_intro_pending, I32) /* end of vars to introduce */
157PERLVAR(padix, I32) /* max used index in current "register" pad */
158PERLVAR(padix_floor, I32) /* how low may inner block reset padix */
159PERLVAR(pad_reset_pending, I32) /* reset pad on next attempted alloc */
160PERLVAR(compiling, COP)
161
162PERLVAR(thisexpr, I32) /* name id for nothing_in_common() */
163PERLVAR(last_uni, char *) /* position of last named-unary operator */
164PERLVAR(last_lop, char *) /* position of last list operator */
165PERLVAR(last_lop_op, OPCODE) /* last list operator */
166PERLVAR(in_my, bool) /* we're compiling a "my" declaration */
167PERLVAR(in_my_stash, HV *) /* declared class of this "my" declaration */
168#ifdef FCRYPT
169PERLVAR(cryptseen, I32) /* has fast crypt() been initialized? */
170#endif
171
172PERLVAR(hints, U32) /* various compilation flags */
173
174PERLVAR(do_undump, bool) /* -u or dump seen? */
175PERLVAR(debug, VOL U32)
176
177
178#ifdef OVERLOAD
179
180PERLVAR(amagic_generation, long)
181
182#endif
183
184#ifdef USE_LOCALE_COLLATE
185PERLVAR(collation_ix, U32) /* Collation generation index */
186PERLVAR(collation_name, char *) /* Name of current collation */
187PERLVARI(collation_standard, bool, TRUE) /* Assume simple collation */
188PERLVAR(collxfrm_base, Size_t) /* Basic overhead in *xfrm() */
189PERLVARI(collxfrm_mult, Size_t, 2) /* Expansion factor in *xfrm() */
190#endif /* USE_LOCALE_COLLATE */
191
192#ifdef USE_LOCALE_NUMERIC
193
194PERLVAR(numeric_name, char *) /* Name of current numeric locale */
195PERLVARI(numeric_standard, bool, TRUE) /* Assume simple numerics */
196PERLVARI(numeric_local, bool, TRUE) /* Assume local numerics */
197
198#endif /* !USE_LOCALE_NUMERIC */
199
200#ifndef MULTIPLICITY
201#define IEXT EXT
202#define IINIT(x) INIT(x)
203#include "intrpvar.h"
204#undef IEXT
205#undef IINIT
206#endif