| 1 | /****************/ |
| 2 | /* Truly global */ |
| 3 | /****************/ |
| 4 | |
| 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 in embed*.h. Such symbols are 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 | |
| 20 | /* global state */ |
| 21 | PERLVAR(Gcurinterp, PerlInterpreter *) |
| 22 | /* currently running interpreter */ |
| 23 | #ifdef USE_THREADS |
| 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 */ |
| 31 | PERLVAR(Gnthreads, int) /* Number of threads currently */ |
| 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) |
| 36 | #ifdef FAKE_THREADS |
| 37 | PERLVAR(Gcurthr, struct perl_thread *) |
| 38 | /* Currently executing (fake) thread */ |
| 39 | #endif |
| 40 | |
| 41 | PERLVAR(Gcred_mutex, perl_mutex) /* altered credentials in effect */ |
| 42 | |
| 43 | #endif /* USE_THREADS */ |
| 44 | |
| 45 | PERLVAR(Gninterps, int) /* number of active interpreters */ |
| 46 | |
| 47 | PERLVAR(Guid, int) /* current real user id */ |
| 48 | PERLVAR(Geuid, int) /* current effective user id */ |
| 49 | PERLVAR(Ggid, int) /* current real group id */ |
| 50 | PERLVAR(Gegid, int) /* current effective group id */ |
| 51 | PERLVAR(Gnomemok, bool) /* let malloc context handle nomem */ |
| 52 | PERLVAR(Gan, U32) /* malloc sequence number */ |
| 53 | PERLVAR(Gcop_seqmax, U32) /* statement sequence number */ |
| 54 | PERLVAR(Gop_seqmax, U16) /* op sequence number */ |
| 55 | PERLVAR(Gevalseq, U32) /* eval sequence number */ |
| 56 | PERLVAR(Gorigenviron, char **) |
| 57 | PERLVAR(Gorigalen, U32) |
| 58 | PERLVAR(Gpidstatus, HV *) /* pid-to-status mappings for waitpid */ |
| 59 | PERLVARI(Gmaxo, int, MAXO) /* maximum number of ops */ |
| 60 | PERLVAR(Gosname, char *) /* operating system */ |
| 61 | PERLVARI(Gsh_path, char *, SH_PATH)/* full path of shell */ |
| 62 | PERLVAR(Gsighandlerp, Sighandler_t) |
| 63 | |
| 64 | PERLVAR(Gxiv_arenaroot, XPV*) /* list of allocated xiv areas */ |
| 65 | PERLVAR(Gxiv_root, IV *) /* free xiv list--shared by interpreters */ |
| 66 | PERLVAR(Gxnv_root, double *) /* free xnv list--shared by interpreters */ |
| 67 | PERLVAR(Gxrv_root, XRV *) /* free xrv list--shared by interpreters */ |
| 68 | PERLVAR(Gxpv_root, XPV *) /* free xpv list--shared by interpreters */ |
| 69 | PERLVAR(Ghe_root, HE *) /* free he list--shared by interpreters */ |
| 70 | PERLVAR(Gnice_chunk, char *) /* a nice chunk of memory to reuse */ |
| 71 | PERLVAR(Gnice_chunk_size, U32) /* how nice the chunk of memory is */ |
| 72 | |
| 73 | PERLVARI(Grunops, runops_proc_t, FUNC_NAME_TO_PTR(RUNOPS_DEFAULT)) |
| 74 | |
| 75 | PERLVAR(Gtokenbuf[256], char) |
| 76 | |
| 77 | PERLVAR(Gsv_undef, SV) |
| 78 | PERLVAR(Gsv_no, SV) |
| 79 | PERLVAR(Gsv_yes, SV) |
| 80 | #ifdef CSH |
| 81 | PERLVARI(Gcshname, char *, CSH) |
| 82 | PERLVAR(Gcshlen, I32) |
| 83 | #endif |
| 84 | |
| 85 | PERLVAR(Glex_state, U32) /* next token is determined */ |
| 86 | PERLVAR(Glex_defer, U32) /* state after determined token */ |
| 87 | PERLVAR(Glex_expect, expectation) /* expect after determined token */ |
| 88 | PERLVAR(Glex_brackets, I32) /* bracket count */ |
| 89 | PERLVAR(Glex_formbrack, I32) /* bracket count at outer format level */ |
| 90 | PERLVAR(Glex_fakebrack, I32) /* outer bracket is mere delimiter */ |
| 91 | PERLVAR(Glex_casemods, I32) /* casemod count */ |
| 92 | PERLVAR(Glex_dojoin, I32) /* doing an array interpolation */ |
| 93 | PERLVAR(Glex_starts, I32) /* how many interps done on level */ |
| 94 | PERLVAR(Glex_stuff, SV *) /* runtime pattern from m// or s/// */ |
| 95 | PERLVAR(Glex_repl, SV *) /* runtime replacement from s/// */ |
| 96 | PERLVAR(Glex_op, OP *) /* extra info to pass back on op */ |
| 97 | PERLVAR(Glex_inpat, OP *) /* in pattern $) and $| are special */ |
| 98 | PERLVAR(Glex_inwhat, I32) /* what kind of quoting are we in */ |
| 99 | PERLVAR(Glex_brackstack,char *) /* what kind of brackets to pop */ |
| 100 | PERLVAR(Glex_casestack, char *) /* what kind of case mods in effect */ |
| 101 | |
| 102 | /* What we know when we're in LEX_KNOWNEXT state. */ |
| 103 | PERLVAR(Gnextval[5], YYSTYPE) /* value of next token, if any */ |
| 104 | PERLVAR(Gnexttype[5], I32) /* type of next token */ |
| 105 | PERLVAR(Gnexttoke, I32) |
| 106 | |
| 107 | PERLVAR(Glinestr, SV *) |
| 108 | PERLVAR(Gbufptr, char *) |
| 109 | PERLVAR(Goldbufptr, char *) |
| 110 | PERLVAR(Goldoldbufptr, char *) |
| 111 | PERLVAR(Gbufend, char *) |
| 112 | PERLVARI(Gexpect,expectation, XSTATE) /* how to interpret ambiguous tokens */ |
| 113 | |
| 114 | PERLVAR(Gmulti_start, I32) /* 1st line of multi-line string */ |
| 115 | PERLVAR(Gmulti_end, I32) /* last line of multi-line string */ |
| 116 | PERLVAR(Gmulti_open, I32) /* delimiter of said string */ |
| 117 | PERLVAR(Gmulti_close, I32) /* delimiter of said string */ |
| 118 | |
| 119 | PERLVAR(Gerror_count, I32) /* how many errors so far, max 10 */ |
| 120 | PERLVAR(Gsubline, I32) /* line this subroutine began on */ |
| 121 | PERLVAR(Gsubname, SV *) /* name of current subroutine */ |
| 122 | |
| 123 | PERLVAR(Gmin_intro_pending, I32) /* start of vars to introduce */ |
| 124 | PERLVAR(Gmax_intro_pending, I32) /* end of vars to introduce */ |
| 125 | PERLVAR(Gpadix, I32) /* max used index in current "register" pad */ |
| 126 | PERLVAR(Gpadix_floor, I32) /* how low may inner block reset padix */ |
| 127 | PERLVAR(Gpad_reset_pending, I32) /* reset pad on next attempted alloc */ |
| 128 | |
| 129 | PERLVAR(Gthisexpr, I32) /* name id for nothing_in_common() */ |
| 130 | PERLVAR(Glast_uni, char *) /* position of last named-unary op */ |
| 131 | PERLVAR(Glast_lop, char *) /* position of last list operator */ |
| 132 | PERLVAR(Glast_lop_op, OPCODE) /* last list operator */ |
| 133 | PERLVAR(Gin_my, bool) /* we're compiling a "my" declaration */ |
| 134 | PERLVAR(Gin_my_stash, HV *) /* declared class of this "my" declaration */ |
| 135 | #ifdef FCRYPT |
| 136 | PERLVAR(Gcryptseen, I32) /* has fast crypt() been initialized? */ |
| 137 | #endif |
| 138 | |
| 139 | PERLVAR(Ghints, U32) /* pragma-tic compile-time flags */ |
| 140 | |
| 141 | PERLVARI(Gdo_undump, bool, FALSE) /* -u or dump seen? */ |
| 142 | PERLVAR(Gdebug, VOL U32) /* flags given to -D switch */ |
| 143 | |
| 144 | PERLVAR(Gamagic_generation, long) |
| 145 | |
| 146 | #ifdef USE_LOCALE_COLLATE |
| 147 | PERLVAR(Gcollation_ix, U32) /* Collation generation index */ |
| 148 | PERLVAR(Gcollation_name,char *) /* Name of current collation */ |
| 149 | PERLVARI(Gcollation_standard, bool, TRUE) |
| 150 | /* Assume simple collation */ |
| 151 | PERLVAR(Gcollxfrm_base, Size_t) /* Basic overhead in *xfrm() */ |
| 152 | PERLVARI(Gcollxfrm_mult,Size_t, 2) /* Expansion factor in *xfrm() */ |
| 153 | #endif /* USE_LOCALE_COLLATE */ |
| 154 | |
| 155 | #ifdef USE_LOCALE_NUMERIC |
| 156 | |
| 157 | PERLVAR(Gnumeric_name, char *) /* Name of current numeric locale */ |
| 158 | PERLVARI(Gnumeric_standard, bool, TRUE) |
| 159 | /* Assume simple numerics */ |
| 160 | PERLVARI(Gnumeric_local, bool, TRUE) |
| 161 | /* Assume local numerics */ |
| 162 | |
| 163 | #endif /* !USE_LOCALE_NUMERIC */ |
| 164 | |
| 165 | /* utf8 character classes */ |
| 166 | PERLVAR(Gutf8_alnum, SV *) |
| 167 | PERLVAR(Gutf8_alpha, SV *) |
| 168 | PERLVAR(Gutf8_space, SV *) |
| 169 | PERLVAR(Gutf8_digit, SV *) |
| 170 | PERLVAR(Gutf8_upper, SV *) |
| 171 | PERLVAR(Gutf8_lower, SV *) |
| 172 | PERLVAR(Gutf8_print, SV *) |
| 173 | PERLVAR(Gutf8_mark, SV *) |
| 174 | PERLVAR(Gutf8_toupper, SV *) |
| 175 | PERLVAR(Gutf8_totitle, SV *) |
| 176 | PERLVAR(Gutf8_tolower, SV *) |
| 177 | PERLVAR(Glast_swash_hv, HV *) |
| 178 | PERLVAR(Glast_swash_klen, U32) |
| 179 | PERLVAR(Glast_swash_key[10], U8) |
| 180 | PERLVAR(Glast_swash_tmps, U8 *) |
| 181 | PERLVAR(Glast_swash_slen, STRLEN) |
| 182 | |
| 183 | /* constants (these are not literals to facilitate pointer comparisons) */ |
| 184 | PERLVARIC(GYes, char *, "1") |
| 185 | PERLVARIC(GNo, char *, "") |
| 186 | PERLVARIC(Ghexdigit, char *, "0123456789abcdef0123456789ABCDEF") |
| 187 | PERLVARIC(Gpatleave, char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}") |
| 188 | |
| 189 | PERLVAR(Gspecialsv_list[4],SV *) /* from byterun.h */ |
| 190 | |
| 191 | /* perly.c globals */ |
| 192 | PERLVAR(Gyydebug, int) |
| 193 | PERLVAR(Gyynerrs, int) |
| 194 | PERLVAR(Gyyerrflag, int) |
| 195 | PERLVAR(Gyychar, int) |
| 196 | PERLVAR(Gyyval, YYSTYPE) |
| 197 | PERLVAR(Gyylval, YYSTYPE) |
| 198 | |
| 199 | PERLVAR(Gglob_index, int) |
| 200 | PERLVAR(Gefloatbuf, char*) |
| 201 | PERLVAR(Gefloatsize, STRLEN) |
| 202 | PERLVAR(Gsrand_called, bool) |
| 203 | PERLVAR(Guudmap[256], char) |
| 204 | PERLVAR(Gbitcount, char *) |
| 205 | PERLVAR(Gfilter_debug, int) |
| 206 | |