X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=gv.h;h=b58d235711e505c4183318a611a71044d262b91e;hb=f0c5aa00eeb992584d6996af147c4c51fe7a6540;hp=cbc68403e9372be9c938639d75b3b5e2297e258e;hpb=780a5241a93925d81e932db73df46ee749b203b9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/gv.h b/gv.h index cbc6840..b58d235 100644 --- a/gv.h +++ b/gv.h @@ -1,7 +1,7 @@ /* gv.h * - * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others + * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + * 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -10,14 +10,14 @@ struct gp { SV * gp_sv; /* scalar value */ - U32 gp_refcnt; /* how many globs point to this? */ struct io * gp_io; /* filehandle value */ - CV * gp_form; /* format value */ - AV * gp_av; /* array value */ - HV * gp_hv; /* hash value */ - GV * gp_egv; /* effective gv, if *glob */ CV * gp_cv; /* subroutine value */ U32 gp_cvgen; /* generational validity of cached gv_cv */ + U32 gp_refcnt; /* how many globs point to this? */ + HV * gp_hv; /* hash value */ + AV * gp_av; /* array value */ + CV * gp_form; /* format value */ + GV * gp_egv; /* effective gv, if *glob */ line_t gp_line; /* line first declared at (for -w) */ HEK * gp_file_hek; /* file first declared in (for -w) */ }; @@ -27,27 +27,27 @@ struct gp { #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__INTEL_COMPILER) # define GvGP(gv) \ - (*({GV *const shplep = (GV *) (gv); \ - assert(SvTYPE(shplep) == SVt_PVGV || SvTYPE(shplep) == SVt_PVLV); \ - assert(isGV_with_GP(shplep)); \ - &((shplep)->sv_u.svu_gp);})) + (*({GV *const _gvgp = (GV *) (gv); \ + assert(SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV); \ + assert(isGV_with_GP(_gvgp)); \ + &((_gvgp)->sv_u.svu_gp);})) # define GvFLAGS(gv) \ - (*({GV *const yaah = (GV *) (gv); \ - assert(SvTYPE(yaah) == SVt_PVGV || SvTYPE(yaah) == SVt_PVLV); \ - assert(isGV_with_GP(yaah)); \ - &(GvXPVGV(yaah)->xpv_cur);})) + (*({GV *const _gvflags = (GV *) (gv); \ + assert(SvTYPE(_gvflags) == SVt_PVGV || SvTYPE(_gvflags) == SVt_PVLV); \ + assert(isGV_with_GP(_gvflags)); \ + &(GvXPVGV(_gvflags)->xpv_cur);})) # define GvSTASH(gv) \ - (*({ GV * const _gv = (GV *) (gv); \ - assert(isGV_with_GP(_gv)); \ - assert(SvTYPE(_gv) == SVt_PVGV || SvTYPE(_gv) >= SVt_PVLV); \ - &(GvXPVGV(_gv)->xnv_u.xgv_stash); \ + (*({ GV * const _gvstash = (GV *) (gv); \ + assert(isGV_with_GP(_gvstash)); \ + assert(SvTYPE(_gvstash) == SVt_PVGV || SvTYPE(_gvstash) >= SVt_PVLV); \ + &(GvXPVGV(_gvstash)->xnv_u.xgv_stash); \ })) # define GvNAME_HEK(gv) \ - (*({ GV * const zzzz = (GV *) (gv); \ - assert(isGV_with_GP(zzzz)); \ - assert(SvTYPE(zzzz) == SVt_PVGV || SvTYPE(zzzz) >= SVt_PVLV); \ - assert(!SvVALID(zzzz)); \ - &(GvXPVGV(zzzz)->xiv_u.xivu_namehek); \ + (*({ GV * const _gvname_hek = (GV *) (gv); \ + assert(isGV_with_GP(_gvname_hek)); \ + assert(SvTYPE(_gvname_hek) == SVt_PVGV || SvTYPE(_gvname_hek) >= SVt_PVLV); \ + assert(!SvVALID(_gvname_hek)); \ + &(GvXPVGV(_gvname_hek)->xiv_u.xivu_namehek); \ })) # define GvNAME_get(gv) ({ assert(GvNAME_HEK(gv)); HEK_KEY(GvNAME_HEK(gv)); }) # define GvNAMELEN_get(gv) ({ assert(GvNAME_HEK(gv)); HEK_LEN(GvNAME_HEK(gv)); }) @@ -88,7 +88,7 @@ Return the SV from the GV. #endif #define GvREFCNT(gv) (GvGP(gv)->gp_refcnt) -#define GvIO(gv) ((gv) && SvTYPE((SV*)gv) == SVt_PVGV && GvGP(gv) ? GvIOp(gv) : 0) +#define GvIO(gv) ((gv) && SvTYPE((const SV*)gv) == SVt_PVGV && GvGP(gv) ? GvIOp(gv) : NULL) #define GvIOp(gv) (GvGP(gv)->gp_io) #define GvIOn(gv) (GvIO(gv) ? GvIOp(gv) : GvIOp(gv_IOadd(gv))) @@ -113,7 +113,7 @@ Return the SV from the GV. #define GvLINE(gv) (GvGP(gv)->gp_line) #define GvFILE_HEK(gv) (GvGP(gv)->gp_file_hek) -#define GvFILE(gv) HEK_KEY(GvFILE_HEK(gv)) +#define GvFILE(gv) (GvFILE_HEK(gv) ? HEK_KEY(GvFILE_HEK(gv)) : NULL) #define GvFILEGV(gv) (gv_fetchfile(GvFILE(gv))) #define GvEGV(gv) (GvGP(gv)->gp_egv) @@ -166,21 +166,14 @@ Return the SV from the GV. #define GvIN_PAD_on(gv) (GvFLAGS(gv) |= GVf_IN_PAD) #define GvIN_PAD_off(gv) (GvFLAGS(gv) &= ~GVf_IN_PAD) -#define GvUNIQUE(gv) 0 -#define GvUNIQUE_on(gv) NOOP -#define GvUNIQUE_off(gv) NOOP - -#ifdef USE_ITHREADS -#define GV_UNIQUE_CHECK -#else -#undef GV_UNIQUE_CHECK +#ifndef PERL_CORE +# define Nullgv Null(GV*) #endif -#define Nullgv Null(GV*) - #define DM_UID 0x003 #define DM_RUID 0x001 #define DM_EUID 0x002 +#define DM_ARRAY 0x004 #define DM_GID 0x030 #define DM_RGID 0x010 #define DM_EGID 0x020 @@ -203,6 +196,8 @@ Return the SV from the GV. #define GV_NOEXPAND 0x40 /* Don't expand SvOK() entries to PVGV */ #define GV_NOTQUAL 0x80 /* A plain symbol name, not qualified with a package (so skip checks for :: and ') */ +#define GV_AUTOLOAD 0x100 /* gv_fetchmethod_flags() should AUTOLOAD */ +#define GV_CROAK 0x200 /* gv_fetchmethod_flags() should croak */ /* SVf_UTF8 (more accurately the return value from SvUTF8) is also valid as a flag to gv_fetch_pvn_flags, so ensure it lies outside this range.