This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
applied patch after demunging headers with appropriate paths
[perl5.git] / thrdvar.h
CommitLineData
cb68f92d
GS
1/***********************************************/
2/* Global only to current thread */
3/***********************************************/
4
8b3be1d1
JP
5/* Don't forget to re-run embed.pl to propagate changes! */
6
cb68f92d
GS
7/* The 'T' prefix is only needed for vars that need appropriate #defines
8 * generated when built with or without USE_THREADS. It is also used
9 * to generate the appropriate export list for win32.
10 *
11 * When building without USE_THREADS, these variables will be truly global.
12 * When building without USE_THREADS but with MULTIPLICITY, these variables
13 * will be global per-interpreter.
14 *
15 * Avoid build-specific #ifdefs here, like DEBUGGING. That way,
16 * we can keep binary compatibility of the curinterp structure */
8b3be1d1 17
49f531da 18/* Important ones in the first cache line (if alignment is done right) */
d4cce5f1 19
cb68f92d 20PERLVAR(Tstack_sp, SV **) /* top of the stack */
49f531da 21#ifdef OP_IN_REGISTER
cb68f92d 22PERLVAR(Topsave, OP *)
49f531da 23#else
cb68f92d 24PERLVAR(Top, OP *) /* currently executing op */
49f531da 25#endif
cb68f92d
GS
26PERLVAR(Tcurpad, SV **) /* active pad (lexicals+tmps) */
27
28PERLVAR(Tstack_base, SV **)
29PERLVAR(Tstack_max, SV **)
30
31PERLVAR(Tscopestack, I32 *) /* scopes we've ENTERed */
32PERLVAR(Tscopestack_ix, I32)
33PERLVAR(Tscopestack_max,I32)
49f531da 34
cb68f92d
GS
35PERLVAR(Tsavestack, ANY *) /* items that need to be restored
36 when LEAVEing scopes we've ENTERed */
37PERLVAR(Tsavestack_ix, I32)
38PERLVAR(Tsavestack_max, I32)
49f531da 39
cb68f92d
GS
40PERLVAR(Ttmps_stack, SV **) /* mortals we've made */
41PERLVARI(Ttmps_ix, I32, -1)
42PERLVARI(Ttmps_floor, I32, -1)
43PERLVAR(Ttmps_max, I32)
49f531da 44
cb68f92d
GS
45PERLVAR(Tmarkstack, I32 *) /* stack_sp locations we're remembering */
46PERLVAR(Tmarkstack_ptr, I32 *)
47PERLVAR(Tmarkstack_max, I32 *)
49f531da 48
cb68f92d
GS
49PERLVAR(Tretstack, OP **) /* OPs we have postponed executing */
50PERLVAR(Tretstack_ix, I32)
51PERLVAR(Tretstack_max, I32)
49f531da 52
cb68f92d
GS
53PERLVAR(TSv, SV *) /* used to hold temporary values */
54PERLVAR(TXpv, XPV *) /* used to hold temporary values */
b099ddc0
GS
55PERLVAR(Tna, STRLEN) /* for use in SvPV when length is
56 Not Applicable */
49f531da 57
5c0ca799 58/* stat stuff */
cb68f92d 59PERLVAR(Tstatbuf, Stat_t)
5c0ca799
GS
60PERLVAR(Tstatcache, Stat_t) /* _ */
61PERLVAR(Tstatgv, GV *)
62PERLVARI(Tstatname, SV *, Nullsv)
63
49f531da 64#ifdef HAS_TIMES
cb68f92d 65PERLVAR(Ttimesbuf, struct tms)
49f531da 66#endif
49f531da
NIS
67
68/* Fields used by magic variables such as $@, $/ and so on */
d4cce5f1 69PERLVAR(Ttainted, bool) /* using variables controlled by $< */
cb68f92d
GS
70PERLVAR(Tcurpm, PMOP *) /* what to do \ interps in REs from */
71PERLVAR(Tnrs, SV *)
72PERLVAR(Trs, SV *) /* input record separator $/ */
73PERLVAR(Tlast_in_gv, GV *) /* GV used in last <FH> */
74PERLVAR(Tofs, char *) /* output field separator $, */
75PERLVAR(Tofslen, STRLEN)
76PERLVAR(Tdefoutgv, GV *) /* default FH for output */
d4cce5f1 77PERLVARI(Tchopset, char *, " \n-") /* $: */
cb68f92d
GS
78PERLVAR(Tformtarget, SV *)
79PERLVAR(Tbodytarget, SV *)
80PERLVAR(Ttoptarget, SV *)
49f531da 81
d4cce5f1
NIS
82/* Stashes */
83PERLVAR(Tdefstash, HV *) /* main symbol table */
84PERLVAR(Tcurstash, HV *) /* symbol table for current package */
49f531da 85
cb68f92d 86PERLVAR(Trestartop, OP *) /* propagating an error from croak? */
3280af22 87PERLVARI(Tcurcop, COP * VOL, &PL_compiling)
d4cce5f1
NIS
88PERLVAR(Tin_eval, VOL int) /* trap "fatal" errors? */
89PERLVAR(Tdelaymagic, int) /* ($<,$>) = ... */
24d3c518 90PERLVARI(Tdirty, bool, FALSE) /* in the middle of tearing things down? */
61bb5906 91PERLVAR(Tlocalizing, int) /* are we processing a local() list? */
49f531da 92
cb68f92d
GS
93PERLVAR(Tcurstack, AV *) /* THE STACK */
94PERLVAR(Tcurstackinfo, PERL_SI *) /* current stack + context */
95PERLVAR(Tmainstack, AV *) /* the stack when nothing funny is happening */
312caa8e 96
cb68f92d
GS
97PERLVAR(Ttop_env, JMPENV *) /* ptr. to current sigjmp() environment */
98PERLVAR(Tstart_env, JMPENV) /* empty startup sigjmp() environment */
cea2e8a9 99PERLVARI(Tprotect, protect_proc_t, FUNC_NAME_TO_PTR(Perl_default_protect))
49f531da 100
4e4c362e 101/* statics "owned" by various functions */
cb68f92d
GS
102PERLVAR(Tav_fetch_sv, SV *) /* owned by av_fetch() */
103PERLVAR(Thv_fetch_sv, SV *) /* owned by hv_fetch() */
104PERLVAR(Thv_fetch_ent_mh, HE) /* owned by hv_fetch_ent() */
105
106PERLVAR(Tmodcount, I32) /* how much mod()ification in assignment? */
4e4c362e 107
5c0ca799 108PERLVAR(Tlastgotoprobe, OP*) /* from pp_ctl.c */
3967c732 109PERLVARI(Tdumpindent, I32, 4) /* # of blanks per dump indentation level */
5c0ca799
GS
110
111/* sort stuff */
112PERLVAR(Tsortcop, OP *) /* user defined sort routine */
113PERLVAR(Tsortstash, HV *) /* which is in some package or other */
114PERLVAR(Tfirstgv, GV *) /* $a */
115PERLVAR(Tsecondgv, GV *) /* $b */
116PERLVAR(Tsortcxix, I32) /* from pp_ctl.c */
117
118/* regex stuff */
119
120PERLVAR(Tscreamfirst, I32 *)
121PERLVAR(Tscreamnext, I32 *)
122PERLVARI(Tmaxscream, I32, -1)
123PERLVAR(Tlastscream, SV *)
124
125PERLVAR(Tregdummy, regnode) /* from regcomp.c */
126PERLVAR(Tregcomp_parse, char*) /* Input-scan pointer. */
127PERLVAR(Tregxend, char*) /* End of input for compile */
128PERLVAR(Tregcode, regnode*) /* Code-emit pointer; &regdummy = don't */
129PERLVAR(Tregnaughty, I32) /* How bad is this pattern? */
130PERLVAR(Tregsawback, I32) /* Did we see \1, ...? */
131PERLVAR(Tregprecomp, char *) /* uncompiled string. */
132PERLVAR(Tregnpar, I32) /* () count. */
133PERLVAR(Tregsize, I32) /* Code size. */
134PERLVAR(Tregflags, U16) /* are we folding, multilining? */
135PERLVAR(Tregseen, U32) /* from regcomp.c */
136PERLVAR(Tseen_zerolen, I32) /* from regcomp.c */
137PERLVAR(Tseen_evals, I32) /* from regcomp.c */
138PERLVAR(Tregcomp_rx, regexp *) /* from regcomp.c */
139PERLVAR(Textralen, I32) /* from regcomp.c */
140PERLVAR(Tcolorset, int) /* from regcomp.c */
8d300b32 141PERLVAR(Tcolors[6], char *) /* from regcomp.c */
5c0ca799
GS
142PERLVAR(Treginput, char *) /* String-input pointer. */
143PERLVAR(Tregbol, char *) /* Beginning of input, for ^ check. */
144PERLVAR(Tregeol, char *) /* End of input, for $ check. */
cf93c79d
IZ
145PERLVAR(Tregstartp, I32 *) /* Pointer to startp array. */
146PERLVAR(Tregendp, I32 *) /* Ditto for endp. */
5c0ca799
GS
147PERLVAR(Treglastparen, U32 *) /* Similarly for lastparen. */
148PERLVAR(Tregtill, char *) /* How far we are required to go. */
149PERLVAR(Tregprev, char) /* char before regbol, \n if none */
150PERLVAR(Treg_start_tmp, char **) /* from regexec.c */
151PERLVAR(Treg_start_tmpl,U32) /* from regexec.c */
152PERLVAR(Tregdata, struct reg_data *)
153 /* from regexec.c renamed was data */
154PERLVAR(Tbostr, char *) /* from regexec.c */
155PERLVAR(Treg_flags, U32) /* from regexec.c */
156PERLVAR(Treg_eval_set, I32) /* from regexec.c */
157PERLVAR(Tregnarrate, I32) /* from regexec.c */
158PERLVAR(Tregprogram, regnode *) /* from regexec.c */
159PERLVARI(Tregindent, int, 0) /* from regexec.c */
160PERLVAR(Tregcc, CURCUR *) /* from regexec.c */
0f5d15d6
IZ
161PERLVAR(Treg_call_cc, struct re_cc_state *) /* from regexec.c */
162PERLVAR(Treg_re, regexp *) /* from regexec.c */
22e551b9
IZ
163PERLVAR(Treg_ganch, char *) /* position of \G */
164PERLVAR(Treg_sv, SV *) /* what we match against */
9661b544
IZ
165PERLVAR(Treg_magic, MAGIC *) /* pos-magic of what we match */
166PERLVAR(Treg_oldpos, I32) /* old pos of what we match */
5c5e4c24
IZ
167PERLVARI(Treg_oldcurpm, PMOP*, NULL) /* curpm before match */
168PERLVARI(Treg_curpm, PMOP*, NULL) /* curpm during match */
cf93c79d
IZ
169PERLVAR(Treg_oldsaved, char*) /* old saved substr during match */
170PERLVAR(Treg_oldsavedlen, STRLEN) /* old length of saved substr during match */
5c0ca799 171
cea2e8a9 172PERLVARI(Tregcompp, regcomp_t, FUNC_NAME_TO_PTR(Perl_pregcomp))
f722798b 173 /* Pointer to REx compiler */
cea2e8a9 174PERLVARI(Tregexecp, regexec_t, FUNC_NAME_TO_PTR(Perl_regexec_flags))
f722798b
IZ
175 /* Pointer to REx executer */
176PERLVARI(Tregint_start, re_intuit_start_t, FUNC_NAME_TO_PTR(Perl_re_intuit_start))
177 /* Pointer to optimized REx executer */
178PERLVARI(Tregint_string,re_intuit_string_t, FUNC_NAME_TO_PTR(Perl_re_intuit_string))
179 /* Pointer to optimized REx string */
180PERLVARI(Tregfree, regfree_t, FUNC_NAME_TO_PTR(Perl_pregfree))
181 /* Pointer to REx free()er */
182
57668c4d 183PERLVARI(Treginterp_cnt,int, 0) /* Whether `Regexp'
5c0ca799 184 was interpolated. */
364723c2 185PERLVARI(Treg_starttry, char *, 0) /* -Dr: where regtry was called. */
22c35a8c
GS
186#ifdef DEBUGGING
187PERLVARI(Twatchaddr, char **, 0)
188PERLVAR(Twatchok, char *)
189#endif
d4cce5f1 190
8b3be1d1 191/* Note that the variables below are all explicitly referenced in the code
cb68f92d 192 * as thr->whatever and therefore don't need the 'T' prefix. */
8b3be1d1 193
d4cce5f1 194#ifdef USE_THREADS
49f531da 195
cb68f92d
GS
196PERLVAR(oursv, SV *)
197PERLVAR(cvcache, HV *)
198PERLVAR(self, perl_os_thread) /* Underlying thread object */
199PERLVAR(flags, U32)
200PERLVAR(threadsv, AV *) /* Per-thread SVs ($_, $@ etc.) */
201PERLVAR(threadsvp, SV **) /* AvARRAY(threadsv) */
202PERLVAR(specific, AV *) /* Thread-specific user data */
203PERLVAR(errsv, SV *) /* Backing SV for $@ */
204PERLVAR(errhv, HV *) /* HV for what was %@ in pp_ctl.c */
205PERLVAR(mutex, perl_mutex) /* For the fields others can change */
206PERLVAR(tid, U32)
49f531da 207PERLVAR(prev, struct perl_thread *)
cb68f92d
GS
208PERLVAR(next, struct perl_thread *)
209 /* Circular linked list of threads */
49f531da
NIS
210
211#ifdef HAVE_THREAD_INTERN
cb68f92d
GS
212PERLVAR(i, struct thread_intern)
213 /* Platform-dependent internals */
49f531da
NIS
214#endif
215
cb68f92d 216PERLVAR(trailing_nul, char) /* For the sake of thrsv and oursv */
49f531da 217
d4cce5f1 218#endif /* USE_THREADS */