This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
don't installperl pods
[perl5.git] / thrdvar.h
1 /*
2 =head1 Global Variables
3 */
4
5 /***********************************************/
6 /* Global only to current thread               */
7 /***********************************************/
8
9 /* Don't forget to re-run embed.pl to propagate changes! */
10
11 /* The 'T' prefix is only needed for vars that need appropriate #defines
12  * generated when built with or without USE_5005THREADS.  It is also used
13  * to generate the appropriate export list for win32.
14  *
15  * When building without USE_5005THREADS, these variables will be truly global.
16  * When building without USE_5005THREADS but with MULTIPLICITY, these variables
17  * will be global per-interpreter. */
18
19 /* Important ones in the first cache line (if alignment is done right) */
20
21 #ifdef USE_5005THREADS
22 PERLVAR(interp,         PerlInterpreter*)       /* thread owner */
23 #endif
24
25 PERLVAR(Tstack_sp,      SV **)          /* top of the stack */
26 #ifdef OP_IN_REGISTER
27 PERLVAR(Topsave,        OP *)
28 #else
29 PERLVAR(Top,            OP *)           /* currently executing op */
30 #endif
31 PERLVAR(Tcurpad,        SV **)          /* active pad (lexicals+tmps) */
32
33 PERLVAR(Tstack_base,    SV **)
34 PERLVAR(Tstack_max,     SV **)
35
36 PERLVAR(Tscopestack,    I32 *)          /* scopes we've ENTERed */
37 PERLVAR(Tscopestack_ix, I32)
38 PERLVAR(Tscopestack_max,I32)
39
40 PERLVAR(Tsavestack,     ANY *)          /* items that need to be restored
41                                            when LEAVEing scopes we've ENTERed */
42 PERLVAR(Tsavestack_ix,  I32)
43 PERLVAR(Tsavestack_max, I32)
44
45 PERLVAR(Ttmps_stack,    SV **)          /* mortals we've made */
46 PERLVARI(Ttmps_ix,      I32,    -1)
47 PERLVARI(Ttmps_floor,   I32,    -1)
48 PERLVAR(Ttmps_max,      I32)
49
50 PERLVAR(Tmarkstack,     I32 *)          /* stack_sp locations we're remembering */
51 PERLVAR(Tmarkstack_ptr, I32 *)
52 PERLVAR(Tmarkstack_max, I32 *)
53
54 PERLVAR(Tretstack,      OP **)          /* OPs we have postponed executing */
55 PERLVAR(Tretstack_ix,   I32)
56 PERLVAR(Tretstack_max,  I32)
57
58 PERLVAR(TSv,            SV *)           /* used to hold temporary values */
59 PERLVAR(TXpv,           XPV *)          /* used to hold temporary values */
60
61 /*
62 =for apidoc Amn|STRLEN|PL_na
63
64 A convenience variable which is typically used with C<SvPV> when one
65 doesn't care about the length of the string.  It is usually more efficient
66 to either declare a local variable and use that instead or to use the
67 C<SvPV_nolen> macro.
68
69 =cut
70 */
71
72 PERLVAR(Tna,            STRLEN)         /* for use in SvPV when length is
73                                            Not Applicable */
74
75 /* stat stuff */
76 PERLVAR(Tstatbuf,       Stat_t)
77 PERLVAR(Tstatcache,     Stat_t)         /* _ */
78 PERLVAR(Tstatgv,        GV *)
79 PERLVARI(Tstatname,     SV *,   Nullsv)
80
81 #ifdef HAS_TIMES
82 PERLVAR(Ttimesbuf,      struct tms)
83 #endif
84
85 /* Fields used by magic variables such as $@, $/ and so on */
86 PERLVAR(Ttainted,       bool)           /* using variables controlled by $< */
87 PERLVAR(Tcurpm,         PMOP *)         /* what to do \ interps in REs from */
88 PERLVAR(Tnrs,           SV *)           /* placeholder: unused since 5.8.0 (5.7.2 patch #12027 for bug ID 20010815.012) */
89
90 /*
91 =for apidoc mn|SV*|PL_rs
92
93 The input record separator - C<$/> in Perl space.
94
95 =for apidoc mn|GV*|PL_last_in_gv
96
97 The GV which was last used for a filehandle input operation. (C<< <FH> >>)
98
99 =for apidoc mn|SV*|PL_ofs_sv
100
101 The output field separator - C<$,> in Perl space.
102
103 =cut
104 */
105
106 PERLVAR(Trs,            SV *)           /* input record separator $/ */
107 PERLVAR(Tlast_in_gv,    GV *)           /* GV used in last <FH> */
108 PERLVAR(Tofs_sv,        SV *)           /* output field separator $, */
109 PERLVAR(Tdefoutgv,      GV *)           /* default FH for output */
110 PERLVARI(Tchopset,      char *, " \n-") /* $: */
111 PERLVAR(Tformtarget,    SV *)
112 PERLVAR(Tbodytarget,    SV *)
113 PERLVAR(Ttoptarget,     SV *)
114
115 /* Stashes */
116 PERLVAR(Tdefstash,      HV *)           /* main symbol table */
117 PERLVAR(Tcurstash,      HV *)           /* symbol table for current package */
118
119 PERLVAR(Trestartop,     OP *)           /* propagating an error from croak? */
120 PERLVARI(Tcurcop,       COP * VOL,      &PL_compiling)
121 PERLVAR(Tin_eval,       VOL int)        /* trap "fatal" errors? */
122 PERLVAR(Tdelaymagic,    int)            /* ($<,$>) = ... */
123 PERLVARI(Tdirty,        bool, FALSE)    /* in the middle of tearing things down? */
124 PERLVAR(Tlocalizing,    int)            /* are we processing a local() list? */
125
126 PERLVAR(Tcurstack,      AV *)           /* THE STACK */
127 PERLVAR(Tcurstackinfo,  PERL_SI *)      /* current stack + context */
128 PERLVAR(Tmainstack,     AV *)           /* the stack when nothing funny is happening */
129
130 PERLVAR(Ttop_env,       JMPENV *)       /* ptr. to current sigjmp() environment */
131 PERLVAR(Tstart_env,     JMPENV)         /* empty startup sigjmp() environment */
132 #ifdef PERL_FLEXIBLE_EXCEPTIONS
133 PERLVARI(Tprotect,      protect_proc_t, MEMBER_TO_FPTR(Perl_default_protect))
134 #endif
135 PERLVARI(Terrors,       SV *, Nullsv)   /* outstanding queued errors */
136
137 /* statics "owned" by various functions */
138 PERLVAR(Tav_fetch_sv,   SV *)           /* owned by av_fetch() */
139 PERLVAR(Thv_fetch_sv,   SV *)           /* owned by hv_fetch() */
140 PERLVAR(Thv_fetch_ent_mh, HE)           /* owned by hv_fetch_ent() */
141
142 PERLVAR(Tmodcount,      I32)            /* how much mod()ification in assignment? */
143
144 PERLVAR(Tlastgotoprobe, OP*)            /* from pp_ctl.c */
145 PERLVARI(Tdumpindent,   I32, 4)         /* # of blanks per dump indentation level */
146
147 /* sort stuff */
148 PERLVAR(Tsortcop,       OP *)           /* user defined sort routine */
149 PERLVAR(Tsortstash,     HV *)           /* which is in some package or other */
150 PERLVAR(Tfirstgv,       GV *)           /* $a */
151 PERLVAR(Tsecondgv,      GV *)           /* $b */
152 PERLVAR(Tsortcxix,      I32)            /* from pp_ctl.c */
153
154 /* float buffer */
155 PERLVAR(Tefloatbuf,     char*)
156 PERLVAR(Tefloatsize,    STRLEN)
157
158 /* regex stuff */
159
160 PERLVAR(Tscreamfirst,   I32 *)
161 PERLVAR(Tscreamnext,    I32 *)
162 PERLVARI(Tmaxscream,    I32,    -1)
163 PERLVAR(Tlastscream,    SV *)
164
165 PERLVAR(Tregdummy,      regnode)        /* from regcomp.c */
166 PERLVAR(Tregcomp_parse, char*)          /* Input-scan pointer. */
167 PERLVAR(Tregxend,       char*)          /* End of input for compile */
168 PERLVAR(Tregcode,       regnode*)       /* Code-emit pointer; &regdummy = don't */
169 PERLVAR(Tregnaughty,    I32)            /* How bad is this pattern? */
170 PERLVAR(Tregsawback,    I32)            /* Did we see \1, ...? */
171 PERLVAR(Tregprecomp,    char *)         /* uncompiled string. */
172 PERLVAR(Tregnpar,       I32)            /* () count. */
173 PERLVAR(Tregsize,       I32)            /* Code size. */
174 PERLVAR(Tregflags,      U16)            /* are we folding, multilining? */
175 PERLVAR(Tregseen,       U32)            /* from regcomp.c */
176 PERLVAR(Tseen_zerolen,  I32)            /* from regcomp.c */
177 PERLVAR(Tseen_evals,    I32)            /* from regcomp.c */
178 PERLVAR(Tregcomp_rx,    regexp *)       /* from regcomp.c */
179 PERLVAR(Textralen,      I32)            /* from regcomp.c */
180 PERLVAR(Tcolorset,      int)            /* from regcomp.c */
181 PERLVARA(Tcolors,6,     char *)         /* from regcomp.c */
182 PERLVAR(Treg_whilem_seen, I32)          /* number of WHILEM in this expr */
183 PERLVAR(Treginput,      char *)         /* String-input pointer. */
184 PERLVAR(Tregbol,        char *)         /* Beginning of input, for ^ check. */
185 PERLVAR(Tregeol,        char *)         /* End of input, for $ check. */
186 PERLVAR(Tregstartp,     I32 *)          /* Pointer to startp array. */
187 PERLVAR(Tregendp,       I32 *)          /* Ditto for endp. */
188 PERLVAR(Treglastparen,  U32 *)          /* Similarly for lastparen. */
189 PERLVAR(Treglastcloseparen, U32 *)      /* Similarly for lastcloseparen. */
190 PERLVAR(Tregtill,       char *)         /* How far we are required to go. */
191 PERLVAR(Tregcompat1,    char)           /* used to be regprev1 */
192 PERLVAR(Treg_start_tmp, char **)        /* from regexec.c */
193 PERLVAR(Treg_start_tmpl,U32)            /* from regexec.c */
194 PERLVAR(Tregdata,       struct reg_data *)
195                                         /* from regexec.c renamed was data */
196 PERLVAR(Tbostr,         char *)         /* from regexec.c */
197 PERLVAR(Treg_flags,     U32)            /* from regexec.c */
198 PERLVAR(Treg_eval_set,  I32)            /* from regexec.c */
199 PERLVAR(Tregnarrate,    I32)            /* from regexec.c */
200 PERLVAR(Tregprogram,    regnode *)      /* from regexec.c */
201 PERLVARI(Tregindent,    int,        0)  /* from regexec.c */
202 PERLVAR(Tregcc,         CURCUR *)       /* from regexec.c */
203 PERLVAR(Treg_call_cc,   struct re_cc_state *)   /* from regexec.c */
204 PERLVAR(Treg_re,        regexp *)       /* from regexec.c */
205 PERLVAR(Treg_ganch,     char *)         /* position of \G */
206 PERLVAR(Treg_sv,        SV *)           /* what we match against */
207 PERLVAR(Treg_magic,     MAGIC *)        /* pos-magic of what we match */
208 PERLVAR(Treg_oldpos,    I32)            /* old pos of what we match */
209 PERLVARI(Treg_oldcurpm, PMOP*, NULL)    /* curpm before match */
210 PERLVARI(Treg_curpm,    PMOP*, NULL)    /* curpm during match */
211 PERLVAR(Treg_oldsaved,  char*)          /* old saved substr during match */
212 PERLVAR(Treg_oldsavedlen, STRLEN)       /* old length of saved substr during match */
213 PERLVAR(Treg_maxiter,   I32)            /* max wait until caching pos */
214 PERLVAR(Treg_leftiter,  I32)            /* wait until caching pos */
215 PERLVARI(Treg_poscache, char *, Nullch) /* cache of pos of WHILEM */
216 PERLVAR(Treg_poscache_size, STRLEN)     /* size of pos cache of WHILEM */
217
218 PERLVARI(Tpeepp,        peep_t, MEMBER_TO_FPTR(Perl_peep))
219                                         /* Pointer to peephole optimizer */
220 PERLVARI(Tregcompp,     regcomp_t, MEMBER_TO_FPTR(Perl_pregcomp))
221                                         /* Pointer to REx compiler */
222 PERLVARI(Tregexecp,     regexec_t, MEMBER_TO_FPTR(Perl_regexec_flags))
223                                         /* Pointer to REx executer */
224 PERLVARI(Tregint_start, re_intuit_start_t, MEMBER_TO_FPTR(Perl_re_intuit_start))
225                                         /* Pointer to optimized REx executer */
226 PERLVARI(Tregint_string,re_intuit_string_t, MEMBER_TO_FPTR(Perl_re_intuit_string))
227                                         /* Pointer to optimized REx string */
228 PERLVARI(Tregfree,      regfree_t, MEMBER_TO_FPTR(Perl_pregfree))
229                                         /* Pointer to REx free()er */
230
231 PERLVARI(Treginterp_cnt,int,        0)  /* Whether `Regexp'
232                                                    was interpolated. */
233 PERLVARI(Treg_starttry, char *,     0)  /* -Dr: where regtry was called. */
234 PERLVARI(Twatchaddr,    char **,    0)
235 PERLVAR(Twatchok,       char *)
236
237 /* Note that the variables below are all explicitly referenced in the code
238  * as thr->whatever and therefore don't need the 'T' prefix. */
239
240 #ifdef USE_5005THREADS
241
242 PERLVAR(oursv,          SV *)
243 PERLVAR(cvcache,        HV *)
244 PERLVAR(self,           perl_os_thread) /* Underlying thread object */
245 PERLVAR(flags,          U32)
246 PERLVAR(threadsv,       AV *)           /* Per-thread SVs ($_, $@ etc.) */
247 PERLVAR(threadsvp,      SV **)          /* AvARRAY(threadsv) */
248 PERLVAR(specific,       AV *)           /* Thread-specific user data */
249 PERLVAR(errsv,          SV *)           /* Backing SV for $@ */
250 PERLVAR(mutex,          perl_mutex)     /* For the fields others can change */
251 PERLVAR(tid,            U32)
252 PERLVAR(prev,           struct perl_thread *)
253 PERLVAR(next,           struct perl_thread *)
254                                         /* Circular linked list of threads */
255
256 #ifdef HAVE_THREAD_INTERN
257 PERLVAR(i,              struct thread_intern)
258                                         /* Platform-dependent internals */
259 #endif
260
261 PERLVAR(trailing_nul,   char)           /* For the sake of thrsv and oursv */
262 PERLVAR(thr_done,       bool)           /* True when the thread has finished */
263
264 #endif /* USE_5005THREADS */
265
266 PERLVAR(Treg_match_utf8,        bool)           /* was what we matched against utf8 */
267