This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
applied suggested patch, modulo already applied parts
[perl5.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(Isiggv,         GV *)
21 PERLVAR(Iincgv,         GV *)
22 PERLVAR(Ihintgv,        GV *)
23 PERLVAR(Iorigfilename,  char *)
24 PERLVAR(Idiehook,       SV *)
25 PERLVAR(Iwarnhook,      SV *)
26 PERLVAR(Iparsehook,     SV *)
27 PERLVAR(Icddir,         char *)         /* switches */
28 PERLVAR(Iminus_c,       bool)
29 PERLVAR(Ipatchlevel[10],char)
30 PERLVAR(Ilocalpatches,  char **)
31 PERLVARI(Isplitstr,     char *, " ")
32 PERLVAR(Ipreprocess,    bool)
33 PERLVAR(Iminus_n,       bool)
34 PERLVAR(Iminus_p,       bool)
35 PERLVAR(Iminus_l,       bool)
36 PERLVAR(Iminus_a,       bool)
37 PERLVAR(Iminus_F,       bool)
38 PERLVAR(Idoswitches,    bool)
39 PERLVAR(Idowarn,        bool)
40 PERLVAR(Idoextract,     bool)
41 PERLVAR(Isawampersand,  bool)           /* must save all match strings */
42 PERLVAR(Isawstudy,      bool)           /* do fbm_instr on all strings */
43 PERLVAR(Isawvec,        bool)
44 PERLVAR(Iunsafe,        bool)
45 PERLVAR(Iinplace,       char *)
46 PERLVAR(Ie_script,      SV *)
47 PERLVAR(Iperldb,        U32)
48
49 /* This value may be raised by extensions for testing purposes */
50 /* 0=none, 1=full, 2=full with checks */
51 PERLVARI(Iperl_destruct_level,  int,    0)
52
53 /* magical thingies */
54 PERLVAR(Ibasetime,      Time_t)         /* $^T */
55 PERLVAR(Iformfeed,      SV *)           /* $^L */
56
57
58 PERLVARI(Imaxsysfd,     I32,    MAXSYSFD)
59                                         /* top fd to pass to subprocesses */
60 PERLVAR(Imultiline,     int)            /* $*--do strings hold >1 line? */
61 PERLVAR(Istatusvalue,   I32)            /* $? */
62 #ifdef VMS
63 PERLVAR(Istatusvalue_vms,U32)
64 #endif
65
66 /* shortcuts to various I/O objects */
67 PERLVAR(Istdingv,       GV *)
68 PERLVAR(Idefgv,         GV *)
69 PERLVAR(Iargvgv,        GV *)
70 PERLVAR(Iargvoutgv,     GV *)
71
72 /* shortcuts to regexp stuff */
73 /* XXX these three aren't used anywhere */
74 PERLVAR(Ileftgv,        GV *)
75 PERLVAR(Iampergv,       GV *)
76 PERLVAR(Irightgv,       GV *)
77
78 /* this one needs to be moved to thrdvar.h and accessed via
79  * find_threadsv() when USE_THREADS */
80 PERLVAR(Ireplgv,        GV *)
81
82 /* shortcuts to misc objects */
83 PERLVAR(Ierrgv,         GV *)
84
85 /* shortcuts to debugging objects */
86 PERLVAR(IDBgv,          GV *)
87 PERLVAR(IDBline,        GV *)
88 PERLVAR(IDBsub,         GV *)
89 PERLVAR(IDBsingle,      SV *)
90 PERLVAR(IDBtrace,       SV *)
91 PERLVAR(IDBsignal,      SV *)
92 PERLVAR(Ilineary,       AV *)           /* lines of script for debugger */
93 PERLVAR(Idbargs,        AV *)           /* args to call listed by caller function */
94
95 /* symbol tables */
96 PERLVAR(Idebstash,      HV *)           /* symbol table for perldb package */
97 PERLVAR(Iglobalstash,   HV *)           /* global keyword overrides imported here */
98 PERLVAR(Icurstname,     SV *)           /* name of current package */
99 PERLVAR(Ibeginav,       AV *)           /* names of BEGIN subroutines */
100 PERLVAR(Iendav,         AV *)           /* names of END subroutines */
101 PERLVAR(Iinitav,        AV *)           /* names of INIT subroutines */
102 PERLVAR(Istrtab,        HV *)           /* shared string table */
103 PERLVARI(Isub_generation,U32,1)         /* incr to invalidate method cache */
104
105 /* memory management */
106 PERLVAR(Isv_count,      I32)            /* how many SV* are currently allocated */
107 PERLVAR(Isv_objcount,   I32)            /* how many objects are currently allocated */
108 PERLVAR(Isv_root,       SV*)            /* storage for SVs belonging to interp */
109 PERLVAR(Isv_arenaroot,  SV*)            /* list of areas for garbage collection */
110
111 /* funky return mechanisms */
112 PERLVAR(Ilastspbase,    I32)
113 PERLVAR(Ilastsize,      I32)
114 PERLVAR(Iforkprocess,   int)            /* so do_open |- can return proc# */
115
116 /* subprocess state */
117 PERLVAR(Ifdpid,         AV *)           /* keep fd-to-pid mappings for my_popen */
118
119 /* internal state */
120 PERLVAR(Itainting,      bool)           /* doing taint checks */
121 PERLVARI(Iop_mask,      char *, NULL)   /* masked operations for safe evals */
122 PERLVAR(Ilast_proto, char *)            /* Prototype of last sub seen. */
123
124 /* trace state */
125 PERLVAR(Idlevel,        I32)
126 PERLVARI(Idlmax,        I32,    128)
127 PERLVAR(Idebname,       char *)
128 PERLVAR(Idebdelim,      char *)
129
130 /* current interpreter roots */
131 PERLVAR(Imain_cv,       CV *)
132 PERLVAR(Imain_root,     OP *)
133 PERLVAR(Imain_start,    OP *)
134 PERLVAR(Ieval_root,     OP *)
135 PERLVAR(Ieval_start,    OP *)
136
137 /* runtime control stuff */
138 PERLVARI(Icurcopdb,     COP *,  NULL)
139 PERLVARI(Icopline,      line_t, NOLINE)
140
141 /* statics moved here for shared library purposes */
142 PERLVAR(Istrchop,       SV)             /* return value from chop */
143 PERLVAR(Ifilemode,      int)            /* so nextargv() can preserve mode */
144 PERLVAR(Ilastfd,        int)            /* what to preserve mode on */
145 PERLVAR(Ioldname,       char *)         /* what to preserve mode on */
146 PERLVAR(IArgv,          char **)        /* stuff to free from do_aexec, vfork safe */
147 PERLVAR(ICmd,           char *)         /* stuff to free from do_aexec, vfork safe */
148 PERLVAR(Imystrk,        SV *)           /* temp key string for do_each() */
149 PERLVAR(Ioldlastpm,     PMOP *)         /* for saving regexp context in debugger */
150 PERLVAR(Igensym,        I32)            /* next symbol for getsym() to define */
151 PERLVAR(Ipreambled,     bool)
152 PERLVAR(Ipreambleav,    AV *)
153 PERLVARI(Ilaststatval,  int,    -1)
154 PERLVARI(Ilaststype,    I32,    OP_STAT)
155 PERLVAR(Imess_sv,       SV *)
156
157 /* XXX shouldn't these be per-thread? --GSAR */
158 PERLVAR(Iors,           char *)         /* output record separator $\ */
159 PERLVAR(Iorslen,        STRLEN)
160 PERLVAR(Iofmt,          char *)         /* output format for numbers $# */
161
162 /* interpreter atexit processing */
163 PERLVARI(Iexitlist,     PerlExitListEntry *, NULL)
164                                         /* list of exit functions */
165 PERLVARI(Iexitlistlen,  I32, 0)         /* length of same */
166 PERLVAR(Imodglobal,     HV *)           /* per-interp module data */
167
168 /* these used to be in global before 5.004_68 */
169 PERLVARI(Iprofiledata,  U32 *,  NULL)   /* table of ops, counts */
170 PERLVARI(Irsfp, PerlIO * VOL,   Nullfp) /* current source file pointer */
171 PERLVARI(Irsfp_filters, AV *,   Nullav) /* keeps active source filters */
172
173 PERLVAR(Icompiling,     COP)            /* compiling/done executing marker */
174
175 PERLVAR(Icompcv,        CV *)           /* currently compiling subroutine */
176 PERLVAR(Icomppad,       AV *)           /* storage for lexically scoped temporaries */
177 PERLVAR(Icomppad_name,  AV *)           /* variable names for "my" variables */
178 PERLVAR(Icomppad_name_fill,     I32)    /* last "introduced" variable offset */
179 PERLVAR(Icomppad_name_floor,    I32)    /* start of vars in innermost block */
180
181 #ifdef HAVE_INTERP_INTERN
182 PERLVAR(Isys_intern,    struct interp_intern)
183                                         /* platform internals */
184 #endif
185
186 /* more statics moved here */
187 PERLVARI(Igeneration,   int,    100)    /* from op.c */
188 PERLVAR(IDBcv,          CV *)           /* from perl.c */
189 PERLVAR(Iarchpat_auto,  char*)          /* from perl.c */
190
191 PERLVARI(Iin_clean_objs,bool,    FALSE) /* from sv.c */
192 PERLVARI(Iin_clean_all, bool,    FALSE) /* from sv.c */
193
194 PERLVAR(Ilinestart,     char *)         /* beg. of most recently read line */
195 PERLVAR(Ipending_ident, char)           /* pending identifier lookup */
196 PERLVAR(Isublex_info,   SUBLEXINFO)     /* from toke.c */
197
198 #ifdef USE_THREADS
199 PERLVAR(Ithrsv,         SV *)           /* struct perl_thread for main thread */
200 PERLVARI(Ithreadnum,    U32,    0)      /* incremented each thread creation */
201 PERLVAR(Istrtab_mutex,  perl_mutex)     /* Mutex for string table access */
202 #endif /* USE_THREADS */
203
204 PERLVARI(Ibytecode_iv_overflows,int,    0)      /* from bytecode.h */
205 PERLVAR(Ibytecode_sv,   SV *)
206 PERLVAR(Ibytecode_pv,   XPV)
207 PERLVAR(Ibytecode_obj_list,     void **)
208 PERLVARI(Ibytecode_obj_list_fill, I32,  -1)
209
210 #ifdef PERL_OBJECT
211 PERLVARI(piMem,         IPerlMem*,  NULL)
212 PERLVARI(piENV,         IPerlEnv*,  NULL)
213 PERLVARI(piStdIO,       IPerlStdIO*, NULL)
214 PERLVARI(piLIO,         IPerlLIO*,  NULL)
215 PERLVARI(piDir,         IPerlDir*,  NULL)
216 PERLVARI(piSock,        IPerlSock*, NULL)
217 PERLVARI(piProc,        IPerlProc*, NULL)
218 #endif