This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Calling cv_undef() on the CV created by newCONSTSUB() would leak like
[perl5.git] / perlvars.h
CommitLineData
eb1102fc
NIS
1/* perlvars.h
2 *
54ca4ee7
NC
3 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
4 * by Larry Wall and others
eb1102fc
NIS
5 *
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
8 *
9 */
10
49f531da
NIS
11/****************/
12/* Truly global */
13/****************/
14
cb68f92d
GS
15/* Don't forget to re-run embed.pl to propagate changes! */
16
17/* This file describes the "global" variables used by perl
18 * This used to be in perl.h directly but we want to abstract out into
19 * distinct files which are per-thread, per-interpreter or really global,
20 * and how they're initialized.
21 *
22 * The 'G' prefix is only needed for vars that need appropriate #defines
22c35a8c 23 * generated in embed*.h. Such symbols are also used to generate
14dd3ad8 24 * the appropriate export list for win32. */
cb68f92d 25
49f531da 26/* global state */
cb68f92d 27PERLVAR(Gcurinterp, PerlInterpreter *)
43165c05 28 /* currently running interpreter
ba869deb
GS
29 * (initial parent interpreter under
30 * useithreads) */
3db8f154 31#if defined(USE_ITHREADS)
ba869deb
GS
32PERLVAR(Gthr_key, perl_key) /* key to retrieve per-thread struct */
33#endif
a0ed51b3 34
27da23d5
JH
35/* constants (these are not literals to facilitate pointer comparisons)
36 * (PERLVARISC really does create variables, despite its looks) */
37PERLVARISC(GYes, "1")
38PERLVARISC(GNo, "")
39PERLVARISC(Ghexdigit, "0123456789abcdef0123456789ABCDEF")
40PERLVARISC(Gpatleave, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}")
43165c05
GS
41
42/* XXX does anyone even use this? */
43PERLVARI(Gdo_undump, bool, FALSE) /* -u or dump seen? */
b363f7ed 44
3db8f154 45#if defined(MYMALLOC) && defined(USE_ITHREADS)
b363f7ed
GS
46PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */
47#endif
534825c4
GS
48
49#if defined(USE_ITHREADS)
50PERLVAR(Gop_mutex, perl_mutex) /* Mutex for op refcounting */
51#endif
60e4ec2e 52
d90a703e
JH
53#ifdef USE_ITHREADS
54PERLVAR(Gdollarzero_mutex, perl_mutex) /* Modifying $0 */
55#endif
5c728af0
IZ
56
57/* This is constant on most architectures, a global on OS/2 */
e1ec3a88 58PERLVARI(Gsh_path, const char *, SH_PATH)/* full path of shell */
af419de7 59
2f42fcb0 60#ifndef PERL_MICRO
b35112e7
CS
61/* If Perl has to ignore SIGPFE, this is its saved state.
62 * See perl.h macros PERL_FPU_INIT and PERL_FPU_{PRE,POST}_EXEC. */
63PERLVAR(Gsigfpe_saved, Sighandler_t)
2f42fcb0 64#endif
b35112e7 65
643157af
JH
66/* Restricted hashes placeholder value.
67 * The contents are never used, only the address. */
68PERLVAR(Gsv_placeholder, SV)
69
2f42fcb0 70#ifndef PERL_MICRO
1c127fab 71PERLVARI(Gcsighandlerp, Sighandler_t, Perl_csighandler) /* Pointer to C-level sighandler */
2f42fcb0 72#endif
5c1546dc 73
50acdf95
MS
74#ifndef PERL_USE_SAFE_PUTENV
75PERLVARI(Guse_safe_putenv, int, 1)
76#endif
27da23d5
JH
77
78#ifdef USE_PERLIO
22c96fc1
NC
79PERLVARI(Gperlio_fd_refcnt, int*, 0) /* Pointer to array of fd refcounts. */
80PERLVARI(Gperlio_fd_refcnt_size, int, 0) /* Size of the array */
27da23d5
JH
81PERLVARI(Gperlio_debug_fd, int, 0) /* the fd to write perlio debug into, 0 means not set yet */
82#endif
83
84#ifdef HAS_MMAP
85PERLVARI(Gmmap_page_size, IV, 0)
86#endif
87
88#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
89PERLVARI(Gsig_handlers_initted, int, 0)
90#endif
91#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS
92PERLVARA(Gsig_ignoring, SIG_SIZE, int) /* which signals we are ignoring */
93#endif
94#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
aadb217d 95PERLVARA(Gsig_defaulting, SIG_SIZE, int)
27da23d5
JH
96#endif
97
98#ifndef PERL_IMPLICIT_CONTEXT
99PERLVAR(Gsig_sv, SV*)
100#endif
101
102/* XXX signals are process-wide anyway, so we
103 * ignore the implications of this for threading */
104#ifndef HAS_SIGACTION
105PERLVARI(Gsig_trapped, int, 0)
106#endif
107
108#ifdef DEBUGGING
109PERLVAR(Gwatch_pvx, char*)
110#endif
111
112#ifdef PERL_GLOBAL_STRUCT
113PERLVAR(Gppaddr, Perl_ppaddr_t*) /* or opcode.h */
114PERLVAR(Gcheck, Perl_check_t *) /* or opcode.h */
115PERLVARA(Gfold_locale, 256, unsigned char) /* or perl.h */
116#endif
117
118#ifdef PERL_NEED_APPCTX
119PERLVAR(Gappctx, void*) /* the application context */
120#endif
121
122PERLVAR(Gop_sequence, HV*) /* dump.c */
123PERLVARI(Gop_seq, UV, 0) /* dump.c */
124
125#if defined(HAS_TIMES) && defined(PERL_NEED_TIMESBASE)
126PERLVAR(Gtimesbase, struct tms)
127#endif
128
f16dd614 129/* allocate a unique index to every module that calls MY_CXT_INIT */
27da23d5 130
f16dd614 131#ifdef PERL_IMPLICIT_CONTEXT
97aff369 132# ifdef USE_ITHREADS
f16dd614 133PERLVAR(Gmy_ctx_mutex, perl_mutex)
97aff369 134# endif
f16dd614
DM
135PERLVARI(Gmy_cxt_index, int, 0)
136#endif
71ad1b0c
NC
137
138#if defined(USE_ITHREADS)
139PERLVAR(Ghints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */
140#endif