Start anew
[git/jnareb-git.git] / lib / perl5 / 5.6.1 / msys / CORE / gv.h
blob07a04b67cb6f02ed68d93d0b0f67791313ab1e72
1 /* gv.h
3 * Copyright (c) 1991-2001, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
8 */
10 struct gp {
11 SV * gp_sv; /* scalar value */
12 U32 gp_refcnt; /* how many globs point to this? */
13 struct io * gp_io; /* filehandle value */
14 CV * gp_form; /* format value */
15 AV * gp_av; /* array value */
16 HV * gp_hv; /* hash value */
17 GV * gp_egv; /* effective gv, if *glob */
18 CV * gp_cv; /* subroutine value */
19 U32 gp_cvgen; /* generational validity of cached gv_cv */
20 U32 gp_flags; /* XXX unused */
21 line_t gp_line; /* line first declared at (for -w) */
22 char * gp_file; /* file first declared in (for -w) */
25 #if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
26 #define MICROPORT
27 #endif
29 #define GvXPVGV(gv) ((XPVGV*)SvANY(gv))
31 #define GvGP(gv) (GvXPVGV(gv)->xgv_gp)
32 #define GvNAME(gv) (GvXPVGV(gv)->xgv_name)
33 #define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen)
34 #define GvSTASH(gv) (GvXPVGV(gv)->xgv_stash)
35 #define GvFLAGS(gv) (GvXPVGV(gv)->xgv_flags)
38 =for apidoc Am|SV*|GvSV|GV* gv
40 Return the SV from the GV.
42 =cut
45 #define GvSV(gv) (GvGP(gv)->gp_sv)
46 #define GvREFCNT(gv) (GvGP(gv)->gp_refcnt)
47 #define GvIO(gv) ((gv) && SvTYPE((SV*)gv) == SVt_PVGV ? GvIOp(gv) : 0)
48 #define GvIOp(gv) (GvGP(gv)->gp_io)
49 #define GvIOn(gv) (GvIO(gv) ? GvIOp(gv) : GvIOp(gv_IOadd(gv)))
51 #define GvFORM(gv) (GvGP(gv)->gp_form)
52 #define GvAV(gv) (GvGP(gv)->gp_av)
54 /* This macro is deprecated. Do not use! */
55 #define GvREFCNT_inc(gv) ((GV*)SvREFCNT_inc(gv)) /* DO NOT USE */
57 #ifdef MICROPORT /* Microport 2.4 hack */
58 AV *GvAVn();
59 #else
60 #define GvAVn(gv) (GvGP(gv)->gp_av ? \
61 GvGP(gv)->gp_av : \
62 GvGP(gv_AVadd(gv))->gp_av)
63 #endif
64 #define GvHV(gv) ((GvGP(gv))->gp_hv)
66 #ifdef MICROPORT /* Microport 2.4 hack */
67 HV *GvHVn();
68 #else
69 #define GvHVn(gv) (GvGP(gv)->gp_hv ? \
70 GvGP(gv)->gp_hv : \
71 GvGP(gv_HVadd(gv))->gp_hv)
72 #endif /* Microport 2.4 hack */
74 #define GvCV(gv) (GvGP(gv)->gp_cv)
75 #define GvCVGEN(gv) (GvGP(gv)->gp_cvgen)
76 #define GvCVu(gv) (GvGP(gv)->gp_cvgen ? Nullcv : GvGP(gv)->gp_cv)
78 #define GvGPFLAGS(gv) (GvGP(gv)->gp_flags)
80 #define GvLINE(gv) (GvGP(gv)->gp_line)
81 #define GvFILE(gv) (GvGP(gv)->gp_file)
82 #define GvFILEGV(gv) (gv_fetchfile(GvFILE(gv)))
84 #define GvEGV(gv) (GvGP(gv)->gp_egv)
85 #define GvENAME(gv) GvNAME(GvEGV(gv) ? GvEGV(gv) : gv)
86 #define GvESTASH(gv) GvSTASH(GvEGV(gv) ? GvEGV(gv) : gv)
88 #define GVf_INTRO 0x01
89 #define GVf_MULTI 0x02
90 #define GVf_ASSUMECV 0x04
91 #define GVf_IN_PAD 0x08
92 #define GVf_IMPORTED 0xF0
93 #define GVf_IMPORTED_SV 0x10
94 #define GVf_IMPORTED_AV 0x20
95 #define GVf_IMPORTED_HV 0x40
96 #define GVf_IMPORTED_CV 0x80
98 #define GvINTRO(gv) (GvFLAGS(gv) & GVf_INTRO)
99 #define GvINTRO_on(gv) (GvFLAGS(gv) |= GVf_INTRO)
100 #define GvINTRO_off(gv) (GvFLAGS(gv) &= ~GVf_INTRO)
102 #define GvMULTI(gv) (GvFLAGS(gv) & GVf_MULTI)
103 #define GvMULTI_on(gv) (GvFLAGS(gv) |= GVf_MULTI)
104 #define GvMULTI_off(gv) (GvFLAGS(gv) &= ~GVf_MULTI)
106 #define GvASSUMECV(gv) (GvFLAGS(gv) & GVf_ASSUMECV)
107 #define GvASSUMECV_on(gv) (GvFLAGS(gv) |= GVf_ASSUMECV)
108 #define GvASSUMECV_off(gv) (GvFLAGS(gv) &= ~GVf_ASSUMECV)
110 #define GvIMPORTED(gv) (GvFLAGS(gv) & GVf_IMPORTED)
111 #define GvIMPORTED_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED)
112 #define GvIMPORTED_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED)
114 #define GvIMPORTED_SV(gv) (GvFLAGS(gv) & GVf_IMPORTED_SV)
115 #define GvIMPORTED_SV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_SV)
116 #define GvIMPORTED_SV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_SV)
118 #define GvIMPORTED_AV(gv) (GvFLAGS(gv) & GVf_IMPORTED_AV)
119 #define GvIMPORTED_AV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_AV)
120 #define GvIMPORTED_AV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_AV)
122 #define GvIMPORTED_HV(gv) (GvFLAGS(gv) & GVf_IMPORTED_HV)
123 #define GvIMPORTED_HV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_HV)
124 #define GvIMPORTED_HV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_HV)
126 #define GvIMPORTED_CV(gv) (GvFLAGS(gv) & GVf_IMPORTED_CV)
127 #define GvIMPORTED_CV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_CV)
128 #define GvIMPORTED_CV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_CV)
130 #define GvIN_PAD(gv) (GvFLAGS(gv) & GVf_IN_PAD)
131 #define GvIN_PAD_on(gv) (GvFLAGS(gv) |= GVf_IN_PAD)
132 #define GvIN_PAD_off(gv) (GvFLAGS(gv) &= ~GVf_IN_PAD)
134 #define Nullgv Null(GV*)
136 #define DM_UID 0x003
137 #define DM_RUID 0x001
138 #define DM_EUID 0x002
139 #define DM_GID 0x030
140 #define DM_RGID 0x010
141 #define DM_EGID 0x020
142 #define DM_DELAY 0x100
145 * symbol creation flags, for use in gv_fetchpv() and get_*v()
147 #define GV_ADD 0x01 /* add, if symbol not already there */
148 #define GV_ADDMULTI 0x02 /* add, pretending it has been added already */
149 #define GV_ADDWARN 0x04 /* add, but warn if symbol wasn't already there */
150 #define GV_ADDINEVAL 0x08 /* add, as though we're doing so within an eval */
151 #define GV_NOINIT 0x10 /* add, but don't init symbol, if type != PVGV */