document what chdir() without an argument does (from Mark-Jason
[p5sagit/p5-mst-13.2.git] / intrpvar.h
1 /***********************************************/
2 /* Global only to current interpreter instance */
3 /***********************************************/
4
5 /* Don't forget to re-run embed.pl to propagate changes! */
6
7 /* The 'I' prefix is only needed for vars that need appropriate #defines
8  * generated when built with or without MULTIPLICITY.  It is also used
9  * to generate the appropriate export list for win32.
10  *
11  * When building without MULTIPLICITY, these variables will be truly global.
12  *
13  * Avoid build-specific #ifdefs here, like DEBUGGING.  That way,
14  * we can keep binary compatibility of the curinterp structure */
15
16 /* pseudo environmental stuff */
17 PERLVAR(Iorigargc,      int)
18 PERLVAR(Iorigargv,      char **)
19 PERLVAR(Ienvgv,         GV *)
20 PERLVAR(Iincgv,         GV *)
21 PERLVAR(Ihintgv,        GV *)
22 PERLVAR(Iorigfilename,  char *)
23 PERLVAR(Idiehook,       SV *)
24 PERLVAR(Iwarnhook,      SV *)
25
26 /* switches */
27 PERLVAR(Iminus_c,       bool)
28 PERLVAR(Ipatchlevel,    SV *)
29 PERLVAR(Ilocalpatches,  char **)
30 PERLVARI(Isplitstr,     char *, " ")
31 PERLVAR(Ipreprocess,    bool)
32 PERLVAR(Iminus_n,       bool)
33 PERLVAR(Iminus_p,       bool)
34 PERLVAR(Iminus_l,       bool)
35 PERLVAR(Iminus_a,       bool)
36 PERLVAR(Iminus_F,       bool)
37 PERLVAR(Idoswitches,    bool)
38
39 /*
40 =for apidoc Amn|bool|PL_dowarn
41
42 The C variable which corresponds to Perl's $^W warning variable.
43
44 =cut
45 */
46
47 PERLVAR(Idowarn,        bool)
48 PERLVAR(Idoextract,     bool)
49 PERLVAR(Isawampersand,  bool)           /* must save all match strings */
50 PERLVAR(Iunsafe,        bool)
51 PERLVAR(Iinplace,       char *)
52 PERLVAR(Ie_script,      SV *)
53 PERLVAR(Iperldb,        U32)
54
55 /* This value may be set when embedding for full cleanup  */
56 /* 0=none, 1=full, 2=full with checks */
57 PERLVARI(Iperl_destruct_level,  int,    0)
58
59 /* magical thingies */
60 PERLVAR(Ibasetime,      Time_t)         /* $^T */
61 PERLVAR(Iformfeed,      SV *)           /* $^L */
62
63
64 PERLVARI(Imaxsysfd,     I32,    MAXSYSFD)
65                                         /* top fd to pass to subprocesses */
66 PERLVAR(Imultiline,     int)            /* $*--do strings hold >1 line? */
67 PERLVAR(Istatusvalue,   I32)            /* $? */
68 PERLVAR(Iexit_flags,    U8)             /* was exit() unexpected, etc. */
69 #ifdef VMS
70 PERLVAR(Istatusvalue_vms,U32)
71 #endif
72
73 /* shortcuts to various I/O objects */
74 PERLVAR(Istdingv,       GV *)
75 PERLVAR(Istderrgv,      GV *)
76 PERLVAR(Idefgv,         GV *)
77 PERLVAR(Iargvgv,        GV *)
78 PERLVAR(Iargvoutgv,     GV *)
79 PERLVAR(Iargvout_stack, AV *)
80
81 /* shortcuts to regexp stuff */
82 /* this one needs to be moved to thrdvar.h and accessed via
83  * find_threadsv() when USE_THREADS */
84 PERLVAR(Ireplgv,        GV *)
85
86 /* shortcuts to misc objects */
87 PERLVAR(Ierrgv,         GV *)
88
89 /* shortcuts to debugging objects */
90 PERLVAR(IDBgv,          GV *)
91 PERLVAR(IDBline,        GV *)
92
93 /*
94 =for apidoc Amn|GV *|PL_DBsub
95 When Perl is run in debugging mode, with the B<-d> switch, this GV contains
96 the SV which holds the name of the sub being debugged.  This is the C
97 variable which corresponds to Perl's $DB::sub variable.  See
98 C<PL_DBsingle>.
99
100 =for apidoc Amn|SV *|PL_DBsingle
101 When Perl is run in debugging mode, with the B<-d> switch, this SV is a
102 boolean which indicates whether subs are being single-stepped. 
103 Single-stepping is automatically turned on after every step.  This is the C
104 variable which corresponds to Perl's $DB::single variable.  See
105 C<PL_DBsub>.
106
107 =for apidoc Amn|SV *|PL_DBtrace
108 Trace variable used when Perl is run in debugging mode, with the B<-d>
109 switch.  This is the C variable which corresponds to Perl's $DB::trace
110 variable.  See C<PL_DBsingle>.
111
112 =cut
113 */
114
115 PERLVAR(IDBsub,         GV *)
116 PERLVAR(IDBsingle,      SV *)
117 PERLVAR(IDBtrace,       SV *)
118 PERLVAR(IDBsignal,      SV *)
119 PERLVAR(Ilineary,       AV *)           /* lines of script for debugger */
120 PERLVAR(Idbargs,        AV *)           /* args to call listed by caller function */
121
122 /* symbol tables */
123 PERLVAR(Idebstash,      HV *)           /* symbol table for perldb package */
124 PERLVAR(Iglobalstash,   HV *)           /* global keyword overrides imported here */
125 PERLVAR(Icurstname,     SV *)           /* name of current package */
126 PERLVAR(Ibeginav,       AV *)           /* names of BEGIN subroutines */
127 PERLVAR(Iendav,         AV *)           /* names of END subroutines */
128 PERLVAR(Icheckav,       AV *)           /* names of CHECK subroutines */
129 PERLVAR(Iinitav,        AV *)           /* names of INIT subroutines */
130 PERLVAR(Istrtab,        HV *)           /* shared string table */
131 PERLVARI(Isub_generation,U32,1)         /* incr to invalidate method cache */
132
133 /* memory management */
134 PERLVAR(Isv_count,      I32)            /* how many SV* are currently allocated */
135 PERLVAR(Isv_objcount,   I32)            /* how many objects are currently allocated */
136 PERLVAR(Isv_root,       SV*)            /* storage for SVs belonging to interp */
137 PERLVAR(Isv_arenaroot,  SV*)            /* list of areas for garbage collection */
138
139 /* funky return mechanisms */
140 PERLVAR(Iforkprocess,   int)            /* so do_open |- can return proc# */
141
142 /* subprocess state */
143 PERLVAR(Ifdpid,         AV *)           /* keep fd-to-pid mappings for my_popen */
144
145 /* internal state */
146 PERLVAR(Itainting,      bool)           /* doing taint checks */
147 PERLVARI(Iop_mask,      char *, NULL)   /* masked operations for safe evals */
148
149 /* current interpreter roots */
150 PERLVAR(Imain_cv,       CV *)
151 PERLVAR(Imain_root,     OP *)
152 PERLVAR(Imain_start,    OP *)
153 PERLVAR(Ieval_root,     OP *)
154 PERLVAR(Ieval_start,    OP *)
155
156 /* runtime control stuff */
157 PERLVARI(Icurcopdb,     COP *,  NULL)
158 PERLVARI(Icopline,      line_t, NOLINE)
159
160 /* statics moved here for shared library purposes */
161 PERLVAR(Ifilemode,      int)            /* so nextargv() can preserve mode */
162 PERLVAR(Ilastfd,        int)            /* what to preserve mode on */
163 PERLVAR(Ioldname,       char *)         /* what to preserve mode on */
164 PERLVAR(IArgv,          char **)        /* stuff to free from do_aexec, vfork safe */
165 PERLVAR(ICmd,           char *)         /* stuff to free from do_aexec, vfork safe */
166 PERLVAR(Igensym,        I32)            /* next symbol for getsym() to define */
167 PERLVAR(Ipreambled,     bool)
168 PERLVAR(Ipreambleav,    AV *)
169 PERLVARI(Ilaststatval,  int,    -1)
170 PERLVARI(Ilaststype,    I32,    OP_STAT)
171 PERLVAR(Imess_sv,       SV *)
172
173 /* XXX shouldn't these be per-thread? --GSAR */
174 PERLVAR(Iors,           char *)         /* output record separator $\ */
175 PERLVAR(Iorslen,        STRLEN)
176 PERLVAR(Iofmt,          char *)         /* output format for numbers $# */
177
178 /* interpreter atexit processing */
179 PERLVARI(Iexitlist,     PerlExitListEntry *, NULL)
180                                         /* list of exit functions */
181 PERLVARI(Iexitlistlen,  I32, 0)         /* length of same */
182
183 /*
184 =for apidoc Amn|HV*|PL_modglobal
185
186 C<PL_modglobal> is a general purpose, interpreter global HV for use by 
187 extensions that need to keep information on a per-interpreter basis.
188 In a pinch, it can also be used as a symbol table for extensions 
189 to share data among each other.  It is a good idea to use keys 
190 prefixed by the package name of the extension that owns the data.
191
192 =cut
193 */
194
195 PERLVAR(Imodglobal,     HV *)           /* per-interp module data */
196
197 /* these used to be in global before 5.004_68 */
198 PERLVARI(Iprofiledata,  U32 *,  NULL)   /* table of ops, counts */
199 PERLVARI(Irsfp, PerlIO * VOL,   Nullfp) /* current source file pointer */
200 PERLVARI(Irsfp_filters, AV *,   Nullav) /* keeps active source filters */
201
202 PERLVAR(Icompiling,     COP)            /* compiling/done executing marker */
203
204 PERLVAR(Icompcv,        CV *)           /* currently compiling subroutine */
205 PERLVAR(Icomppad,       AV *)           /* storage for lexically scoped temporaries */
206 PERLVAR(Icomppad_name,  AV *)           /* variable names for "my" variables */
207 PERLVAR(Icomppad_name_fill,     I32)    /* last "introduced" variable offset */
208 PERLVAR(Icomppad_name_floor,    I32)    /* start of vars in innermost block */
209
210 #ifdef HAVE_INTERP_INTERN
211 PERLVAR(Isys_intern,    struct interp_intern)
212                                         /* platform internals */
213 #endif
214
215 /* more statics moved here */
216 PERLVARI(Igeneration,   int,    100)    /* from op.c */
217 PERLVAR(IDBcv,          CV *)           /* from perl.c */
218
219 PERLVARI(Iin_clean_objs,bool,    FALSE) /* from sv.c */
220 PERLVARI(Iin_clean_all, bool,    FALSE) /* from sv.c */
221
222 PERLVAR(Ilinestart,     char *)         /* beg. of most recently read line */
223 PERLVAR(Ipending_ident, char)           /* pending identifier lookup */
224 PERLVAR(Isublex_info,   SUBLEXINFO)     /* from toke.c */
225
226 #ifdef USE_THREADS
227 PERLVAR(Ithrsv,         SV *)           /* struct perl_thread for main thread */
228 PERLVARI(Ithreadnum,    U32,    0)      /* incremented each thread creation */
229 PERLVAR(Istrtab_mutex,  perl_mutex)     /* Mutex for string table access */
230 #endif /* USE_THREADS */
231
232 PERLVAR(Iuid,           Uid_t)          /* current real user id */
233 PERLVAR(Ieuid,          Uid_t)          /* current effective user id */
234 PERLVAR(Igid,           Gid_t)          /* current real group id */
235 PERLVAR(Iegid,          Gid_t)          /* current effective group id */
236 PERLVAR(Inomemok,       bool)           /* let malloc context handle nomem */
237 PERLVAR(Ian,            U32)            /* malloc sequence number */
238 PERLVAR(Icop_seqmax,    U32)            /* statement sequence number */
239 PERLVAR(Iop_seqmax,     U16)            /* op sequence number */
240 PERLVAR(Ievalseq,       U32)            /* eval sequence number */
241 PERLVAR(Iorigenviron,   char **)
242 PERLVAR(Iorigalen,      U32)
243 PERLVAR(Ipidstatus,     HV *)           /* pid-to-status mappings for waitpid */
244 PERLVARI(Imaxo, int,    MAXO)           /* maximum number of ops */
245 PERLVAR(Iosname,        char *)         /* operating system */
246 PERLVARI(Ish_path,      char *, SH_PATH)/* full path of shell */
247 PERLVAR(Isighandlerp,   Sighandler_t)
248
249 PERLVAR(Ixiv_arenaroot, XPV*)           /* list of allocated xiv areas */
250 PERLVAR(Ixiv_root,      IV *)           /* free xiv list--shared by interpreters */
251 PERLVAR(Ixnv_root,      NV *)           /* free xnv list--shared by interpreters */
252 PERLVAR(Ixrv_root,      XRV *)          /* free xrv list--shared by interpreters */
253 PERLVAR(Ixpv_root,      XPV *)          /* free xpv list--shared by interpreters */
254 PERLVAR(Ixpviv_root,    XPVIV *)        /* free xpviv list--shared by interpreters */
255 PERLVAR(Ixpvnv_root,    XPVNV *)        /* free xpvnv list--shared by interpreters */
256 PERLVAR(Ixpvcv_root,    XPVCV *)        /* free xpvcv list--shared by interpreters */
257 PERLVAR(Ixpvav_root,    XPVAV *)        /* free xpvav list--shared by interpreters */
258 PERLVAR(Ixpvhv_root,    XPVHV *)        /* free xpvhv list--shared by interpreters */
259 PERLVAR(Ixpvmg_root,    XPVMG *)        /* free xpvmg list--shared by interpreters */
260 PERLVAR(Ixpvlv_root,    XPVLV *)        /* free xpvlv list--shared by interpreters */
261 PERLVAR(Ixpvbm_root,    XPVBM *)        /* free xpvbm list--shared by interpreters */
262 PERLVAR(Ihe_root,       HE *)           /* free he list--shared by interpreters */
263 PERLVAR(Inice_chunk,    char *)         /* a nice chunk of memory to reuse */
264 PERLVAR(Inice_chunk_size,       U32)    /* how nice the chunk of memory is */
265
266 PERLVARI(Irunops,       runops_proc_t,  MEMBER_TO_FPTR(RUNOPS_DEFAULT))
267
268 PERLVARA(Itokenbuf,256, char)
269
270 /*
271 =for apidoc Amn|SV|PL_sv_undef
272 This is the C<undef> SV.  Always refer to this as C<&PL_sv_undef>.
273
274 =for apidoc Amn|SV|PL_sv_no
275 This is the C<false> SV.  See C<PL_sv_yes>.  Always refer to this as
276 C<&PL_sv_no>.
277
278 =for apidoc Amn|SV|PL_sv_yes
279 This is the C<true> SV.  See C<PL_sv_no>.  Always refer to this as
280 C<&PL_sv_yes>.
281
282 =cut
283 */
284
285 PERLVAR(Isv_undef,      SV)
286 PERLVAR(Isv_no,         SV)
287 PERLVAR(Isv_yes,        SV)
288
289 #ifdef CSH
290 PERLVARI(Icshname,      char *, CSH)
291 PERLVAR(Icshlen,        I32)
292 #endif
293
294 PERLVAR(Ilex_state,     U32)            /* next token is determined */
295 PERLVAR(Ilex_defer,     U32)            /* state after determined token */
296 PERLVAR(Ilex_expect,    int)            /* expect after determined token */
297 PERLVAR(Ilex_brackets,  I32)            /* bracket count */
298 PERLVAR(Ilex_formbrack, I32)            /* bracket count at outer format level */
299 PERLVAR(Ilex_casemods,  I32)            /* casemod count */
300 PERLVAR(Ilex_dojoin,    I32)            /* doing an array interpolation */
301 PERLVAR(Ilex_starts,    I32)            /* how many interps done on level */
302 PERLVAR(Ilex_stuff,     SV *)           /* runtime pattern from m// or s/// */
303 PERLVAR(Ilex_repl,      SV *)           /* runtime replacement from s/// */
304 PERLVAR(Ilex_op,        OP *)           /* extra info to pass back on op */
305 PERLVAR(Ilex_inpat,     OP *)           /* in pattern $) and $| are special */
306 PERLVAR(Ilex_inwhat,    I32)            /* what kind of quoting are we in */
307 PERLVAR(Ilex_brackstack,char *)         /* what kind of brackets to pop */
308 PERLVAR(Ilex_casestack, char *)         /* what kind of case mods in effect */
309
310 /* What we know when we're in LEX_KNOWNEXT state. */
311 PERLVARA(Inextval,5,    YYSTYPE)        /* value of next token, if any */
312 PERLVARA(Inexttype,5,   I32)            /* type of next token */
313 PERLVAR(Inexttoke,      I32)
314
315 PERLVAR(Ilinestr,       SV *)
316 PERLVAR(Ibufptr,        char *)
317 PERLVAR(Ioldbufptr,     char *)
318 PERLVAR(Ioldoldbufptr,  char *)
319 PERLVAR(Ibufend,        char *)
320 PERLVARI(Iexpect,int,   XSTATE)         /* how to interpret ambiguous tokens */
321
322 PERLVAR(Imulti_start,   I32)            /* 1st line of multi-line string */
323 PERLVAR(Imulti_end,     I32)            /* last line of multi-line string */
324 PERLVAR(Imulti_open,    I32)            /* delimiter of said string */
325 PERLVAR(Imulti_close,   I32)            /* delimiter of said string */
326
327 PERLVAR(Ierror_count,   I32)            /* how many errors so far, max 10 */
328 PERLVAR(Isubline,       I32)            /* line this subroutine began on */
329 PERLVAR(Isubname,       SV *)           /* name of current subroutine */
330
331 PERLVAR(Imin_intro_pending,     I32)    /* start of vars to introduce */
332 PERLVAR(Imax_intro_pending,     I32)    /* end of vars to introduce */
333 PERLVAR(Ipadix,         I32)            /* max used index in current "register" pad */
334 PERLVAR(Ipadix_floor,   I32)            /* how low may inner block reset padix */
335 PERLVAR(Ipad_reset_pending,     I32)    /* reset pad on next attempted alloc */
336
337 PERLVAR(Ilast_uni,      char *)         /* position of last named-unary op */
338 PERLVAR(Ilast_lop,      char *)         /* position of last list operator */
339 PERLVAR(Ilast_lop_op,   OPCODE)         /* last list operator */
340 PERLVAR(Iin_my,         I32)            /* we're compiling a "my" (or "our") declaration */
341 PERLVAR(Iin_my_stash,   HV *)           /* declared class of this "my" declaration */
342 #ifdef FCRYPT
343 PERLVAR(Icryptseen,     bool)           /* has fast crypt() been initialized? */
344 #endif
345
346 PERLVAR(Ihints,         U32)            /* pragma-tic compile-time flags */
347
348 PERLVAR(Idebug,         VOL U32)        /* flags given to -D switch */
349
350 PERLVAR(Iamagic_generation,     long)
351
352 #ifdef USE_LOCALE_COLLATE
353 PERLVAR(Icollation_ix,  U32)            /* Collation generation index */
354 PERLVAR(Icollation_name,char *)         /* Name of current collation */
355 PERLVARI(Icollation_standard, bool,     TRUE)
356                                         /* Assume simple collation */
357 PERLVAR(Icollxfrm_base, Size_t)         /* Basic overhead in *xfrm() */
358 PERLVARI(Icollxfrm_mult,Size_t, 2)      /* Expansion factor in *xfrm() */
359 #endif /* USE_LOCALE_COLLATE */
360
361 #ifdef USE_LOCALE_NUMERIC
362
363 PERLVAR(Inumeric_name,  char *)         /* Name of current numeric locale */
364 PERLVARI(Inumeric_standard,     bool,   TRUE)
365                                         /* Assume simple numerics */
366 PERLVARI(Inumeric_local,        bool,   TRUE)
367                                         /* Assume local numerics */
368 PERLVAR(Inumeric_radix,         char)
369                                         /* The radix character if not '.' */
370
371 #endif /* !USE_LOCALE_NUMERIC */
372
373 /* utf8 character classes */
374 PERLVAR(Iutf8_alnum,    SV *)
375 PERLVAR(Iutf8_alnumc,   SV *)
376 PERLVAR(Iutf8_ascii,    SV *)
377 PERLVAR(Iutf8_alpha,    SV *)
378 PERLVAR(Iutf8_space,    SV *)
379 PERLVAR(Iutf8_cntrl,    SV *)
380 PERLVAR(Iutf8_graph,    SV *)
381 PERLVAR(Iutf8_digit,    SV *)
382 PERLVAR(Iutf8_upper,    SV *)
383 PERLVAR(Iutf8_lower,    SV *)
384 PERLVAR(Iutf8_print,    SV *)
385 PERLVAR(Iutf8_punct,    SV *)
386 PERLVAR(Iutf8_xdigit,   SV *)
387 PERLVAR(Iutf8_mark,     SV *)
388 PERLVAR(Iutf8_toupper,  SV *)
389 PERLVAR(Iutf8_totitle,  SV *)
390 PERLVAR(Iutf8_tolower,  SV *)
391 PERLVAR(Ilast_swash_hv, HV *)
392 PERLVAR(Ilast_swash_klen,       U32)
393 PERLVARA(Ilast_swash_key,10,    U8)
394 PERLVAR(Ilast_swash_tmps,       U8 *)
395 PERLVAR(Ilast_swash_slen,       STRLEN)
396
397 /* perly.c globals */
398 PERLVAR(Iyydebug,       int)
399 PERLVAR(Iyynerrs,       int)
400 PERLVAR(Iyyerrflag,     int)
401 PERLVAR(Iyychar,        int)
402 PERLVAR(Iyyval,         YYSTYPE)
403 PERLVAR(Iyylval,        YYSTYPE)
404
405 PERLVAR(Iglob_index,    int)
406 PERLVAR(Isrand_called,  bool)
407 PERLVARA(Iuudmap,256,   char)
408 PERLVAR(Ibitcount,      char *)
409
410 #ifdef USE_THREADS
411 PERLVAR(Ithr_key,       perl_key)       /* For per-thread struct perl_thread* */
412 PERLVAR(Isv_mutex,      perl_mutex)     /* Mutex for allocating SVs in sv.c */
413 PERLVAR(Ieval_mutex,    perl_mutex)     /* Mutex for doeval */
414 PERLVAR(Ieval_cond,     perl_cond)      /* Condition variable for doeval */
415 PERLVAR(Ieval_owner,    struct perl_thread *)
416                                         /* Owner thread for doeval */
417 PERLVAR(Inthreads,      int)            /* Number of threads currently */
418 PERLVAR(Ithreads_mutex, perl_mutex)     /* Mutex for nthreads and thread list */
419 PERLVAR(Inthreads_cond, perl_cond)      /* Condition variable for nthreads */
420 PERLVAR(Isvref_mutex,   perl_mutex)     /* Mutex for SvREFCNT_{inc,dec} */
421 PERLVARI(Ithreadsv_names,char *,        THREADSV_NAMES)
422 #ifdef FAKE_THREADS
423 PERLVAR(Icurthr,        struct perl_thread *)
424                                         /* Currently executing (fake) thread */
425 #endif
426
427 PERLVAR(Icred_mutex,    perl_mutex)     /* altered credentials in effect */
428
429 #endif /* USE_THREADS */
430
431 PERLVAR(Ipsig_ptr, SV**)
432 PERLVAR(Ipsig_name, SV**)
433
434 #if defined(PERL_IMPLICIT_SYS)
435 PERLVAR(IMem,           struct IPerlMem*)
436 PERLVAR(IMemShared,     struct IPerlMem*)
437 PERLVAR(IMemParse,      struct IPerlMem*)
438 PERLVAR(IEnv,           struct IPerlEnv*)
439 PERLVAR(IStdIO,         struct IPerlStdIO*)
440 PERLVAR(ILIO,           struct IPerlLIO*)
441 PERLVAR(IDir,           struct IPerlDir*)
442 PERLVAR(ISock,          struct IPerlSock*)
443 PERLVAR(IProc,          struct IPerlProc*)
444 #endif
445
446 #if defined(USE_ITHREADS)
447 PERLVAR(Iptr_table,     PTR_TBL_t*)
448 #endif