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