Add documentation for default UNIVERSAL methods
[p5sagit/p5-mst-13.2.git] / gv.h
CommitLineData
a0d0e21e 1/* gv.h
79072805 2 *
a0d0e21e 3 * Copyright (c) 1991-1994, Larry Wall
79072805 4 *
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.
7 *
79072805 8 */
9
10struct 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; /* associative array value */
17 GV * gp_egv; /* effective gv, if *glob */
18 CV * gp_cv; /* subroutine value */
463ee0b2 19 U32 gp_cvgen; /* generational validity of cached gv_cv */
79072805 20 I32 gp_lastexpr; /* used by nothing_in_common() */
21 line_t gp_line; /* line first declared at (for -w) */
8990e307 22 GV * gp_filegv; /* file first declared in (for -w) */
79072805 23};
24
25#if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286))
26#define MICROPORT
27#endif
28
29#define GvXPVGV(gv) ((XPVGV*)SvANY(gv))
30
a5f75d66 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)
36
79072805 37#define GvSV(gv) (GvGP(gv)->gp_sv)
38#define GvREFCNT(gv) (GvGP(gv)->gp_refcnt)
a0d0e21e 39#define GvIO(gv) ((gv) && SvTYPE((SV*)gv) == SVt_PVGV ? GvIOp(gv) : 0)
40#define GvIOp(gv) (GvGP(gv)->gp_io)
41#define GvIOn(gv) (GvIO(gv) ? GvIOp(gv) : GvIOp(gv_IOadd(gv)))
79072805 42
43#define GvFORM(gv) (GvGP(gv)->gp_form)
44#define GvAV(gv) (GvGP(gv)->gp_av)
1090b3e7 45#define GvREFCNT_inc(gv) ((GV*)SvREFCNT_inc(gv))
79072805 46
47#ifdef MICROPORT /* Microport 2.4 hack */
48AV *GvAVn();
49#else
50#define GvAVn(gv) (GvGP(gv)->gp_av ? \
51 GvGP(gv)->gp_av : \
52 GvGP(gv_AVadd(gv))->gp_av)
53#endif
54#define GvHV(gv) ((GvGP(gv))->gp_hv)
55
56#ifdef MICROPORT /* Microport 2.4 hack */
57HV *GvHVn();
58#else
59#define GvHVn(gv) (GvGP(gv)->gp_hv ? \
60 GvGP(gv)->gp_hv : \
61 GvGP(gv_HVadd(gv))->gp_hv)
62#endif /* Microport 2.4 hack */
63
64#define GvCV(gv) (GvGP(gv)->gp_cv)
463ee0b2 65#define GvCVGEN(gv) (GvGP(gv)->gp_cvgen)
79072805 66
67#define GvLASTEXPR(gv) (GvGP(gv)->gp_lastexpr)
68
69#define GvLINE(gv) (GvGP(gv)->gp_line)
8990e307 70#define GvFILEGV(gv) (GvGP(gv)->gp_filegv)
79072805 71
79072805 72#define GvEGV(gv) (GvGP(gv)->gp_egv)
748a9306 73#define GvENAME(gv) GvNAME(GvEGV(gv) ? GvEGV(gv) : gv)
748a9306 74#define GvESTASH(gv) GvSTASH(GvEGV(gv) ? GvEGV(gv) : gv)
79072805 75
a5f75d66 76#define GVf_INTRO 0x01
77#define GVf_MULTI 0x02
78#define GVf_ASSUMECV 0x04
79#define GVf_IMPORTED 0xF0
80#define GVf_IMPORTED_SV 0x10
81#define GVf_IMPORTED_AV 0x20
82#define GVf_IMPORTED_HV 0x40
83#define GVf_IMPORTED_CV 0x80
84
85#define GvINTRO(gv) (GvFLAGS(gv) & GVf_INTRO)
86#define GvINTRO_on(gv) (GvFLAGS(gv) |= GVf_INTRO)
87#define GvINTRO_off(gv) (GvFLAGS(gv) &= ~GVf_INTRO)
88
89#define GvMULTI(gv) (GvFLAGS(gv) & GVf_MULTI)
90#define GvMULTI_on(gv) (GvFLAGS(gv) |= GVf_MULTI)
91#define GvMULTI_off(gv) (GvFLAGS(gv) &= ~GVf_MULTI)
92
93#define GvASSUMECV(gv) (GvFLAGS(gv) & GVf_ASSUMECV)
94#define GvASSUMECV_on(gv) (GvFLAGS(gv) |= GVf_ASSUMECV)
95#define GvASSUMECV_off(gv) (GvFLAGS(gv) &= ~GVf_ASSUMECV)
96
97#define GvIMPORTED(gv) (GvFLAGS(gv) & GVf_IMPORTED)
98#define GvIMPORTED_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED)
99#define GvIMPORTED_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED)
100
101#define GvIMPORTED_SV(gv) (GvFLAGS(gv) & GVf_IMPORTED_SV)
102#define GvIMPORTED_SV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_SV)
103#define GvIMPORTED_SV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_SV)
104
105#define GvIMPORTED_AV(gv) (GvFLAGS(gv) & GVf_IMPORTED_AV)
106#define GvIMPORTED_AV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_AV)
107#define GvIMPORTED_AV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_AV)
108
109#define GvIMPORTED_HV(gv) (GvFLAGS(gv) & GVf_IMPORTED_HV)
110#define GvIMPORTED_HV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_HV)
111#define GvIMPORTED_HV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_HV)
112
113#define GvIMPORTED_CV(gv) (GvFLAGS(gv) & GVf_IMPORTED_CV)
114#define GvIMPORTED_CV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_CV)
115#define GvIMPORTED_CV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_CV)
116
79072805 117#define Nullgv Null(GV*)
118
119#define DM_UID 0x003
120#define DM_RUID 0x001
121#define DM_EUID 0x002
122#define DM_GID 0x030
123#define DM_RGID 0x010
124#define DM_EGID 0x020
125#define DM_DELAY 0x100
126
a0d0e21e 127#define GV_ADD 0x01
128#define GV_ADDMULTI 0x02
129#define GV_ADDWARN 0x04