X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=gv.h;h=4b410e860b7cb65ec98429868da969ffe54da1c9;hb=81f61c1a1801c3f63576c7bdd2b7e2b2f91cd51d;hp=99d534eeba79f1829e414e9a66a327cd22e5eac7;hpb=b195d4879f55e1610299cb9b1b55356940c2a577;p=p5sagit%2Fp5-mst-13.2.git diff --git a/gv.h b/gv.h index 99d534e..4b410e8 100644 --- a/gv.h +++ b/gv.h @@ -1,6 +1,7 @@ /* gv.h * - * Copyright (c) 1991-1999, Larry Wall + * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + * 2000, 2001, 2002, 2003, 2004, 2005, 2006, 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. @@ -17,26 +18,52 @@ struct gp { GV * gp_egv; /* effective gv, if *glob */ CV * gp_cv; /* subroutine value */ U32 gp_cvgen; /* generational validity of cached gv_cv */ - U32 gp_flags; /* XXX unused */ line_t gp_line; /* line first declared at (for -w) */ char * gp_file; /* file first declared in (for -w) */ }; -#if defined(CRIPPLED_CC) && (defined(iAPX286) || defined(M_I286) || defined(I80286)) -#define MICROPORT -#endif - #define GvXPVGV(gv) ((XPVGV*)SvANY(gv)) -#define GvGP(gv) (GvXPVGV(gv)->xgv_gp) +/* MSVC++ 6.0 (_MSC_VER == 1200) can't compile pp_hot.c with DEBUGGING enabled + * if we include the following assert(). Must be a compiler bug because it + * works fine with MSVC++ 7.0. Borland (5.5.1) has the same problem. And MinGW + * (gcc-3.4.2) has a different problem when compiling win32/perllib.c! */ +#if defined(DEBUGGING) && \ + ((!defined(_MSC_VER) || _MSC_VER > 1200) && \ + !defined(__BORLANDC__) && !defined(__MINGW32__)) +# define GvGP(gv) (*(assert(SvTYPE(gv) == SVt_PVGV || \ + SvTYPE(gv) == SVt_PVLV), \ + &(GvXPVGV(gv)->xgv_gp))) +#else +# define GvGP(gv) (GvXPVGV(gv)->xgv_gp) +#endif + #define GvNAME(gv) (GvXPVGV(gv)->xgv_name) #define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen) #define GvSTASH(gv) (GvXPVGV(gv)->xgv_stash) #define GvFLAGS(gv) (GvXPVGV(gv)->xgv_flags) +/* +=head1 GV Functions + +=for apidoc Am|SV*|GvSV|GV* gv + +Return the SV from the GV. + +=cut +*/ + #define GvSV(gv) (GvGP(gv)->gp_sv) +#ifdef PERL_DONT_CREATE_GVSV +#define GvSVn(gv) (*(GvGP(gv)->gp_sv ? \ + &(GvGP(gv)->gp_sv) : \ + &(GvGP(gv_SVadd(gv))->gp_sv))) +#else +#define GvSVn(gv) GvSV(gv) +#endif + #define GvREFCNT(gv) (GvGP(gv)->gp_refcnt) -#define GvIO(gv) ((gv) && SvTYPE((SV*)gv) == SVt_PVGV ? GvIOp(gv) : 0) +#define GvIO(gv) ((gv) && SvTYPE((SV*)gv) == SVt_PVGV && GvGP(gv) ? GvIOp(gv) : 0) #define GvIOp(gv) (GvGP(gv)->gp_io) #define GvIOn(gv) (GvIO(gv) ? GvIOp(gv) : GvIOp(gv_IOadd(gv))) @@ -46,32 +73,22 @@ struct gp { /* This macro is deprecated. Do not use! */ #define GvREFCNT_inc(gv) ((GV*)SvREFCNT_inc(gv)) /* DO NOT USE */ -#ifdef MICROPORT /* Microport 2.4 hack */ -AV *GvAVn(); -#else #define GvAVn(gv) (GvGP(gv)->gp_av ? \ GvGP(gv)->gp_av : \ GvGP(gv_AVadd(gv))->gp_av) -#endif #define GvHV(gv) ((GvGP(gv))->gp_hv) -#ifdef MICROPORT /* Microport 2.4 hack */ -HV *GvHVn(); -#else #define GvHVn(gv) (GvGP(gv)->gp_hv ? \ GvGP(gv)->gp_hv : \ GvGP(gv_HVadd(gv))->gp_hv) -#endif /* Microport 2.4 hack */ #define GvCV(gv) (GvGP(gv)->gp_cv) #define GvCVGEN(gv) (GvGP(gv)->gp_cvgen) #define GvCVu(gv) (GvGP(gv)->gp_cvgen ? Nullcv : GvGP(gv)->gp_cv) -#define GvGPFLAGS(gv) (GvGP(gv)->gp_flags) - #define GvLINE(gv) (GvGP(gv)->gp_line) #define GvFILE(gv) (GvGP(gv)->gp_file) -#define GvFILEGV(gv) (gv_fetchfile(GvGP(gv)->gp_file)) +#define GvFILEGV(gv) (gv_fetchfile(GvFILE(gv))) #define GvEGV(gv) (GvGP(gv)->gp_egv) #define GvENAME(gv) GvNAME(GvEGV(gv) ? GvEGV(gv) : gv) @@ -80,6 +97,7 @@ HV *GvHVn(); #define GVf_INTRO 0x01 #define GVf_MULTI 0x02 #define GVf_ASSUMECV 0x04 +#define GVf_IN_PAD 0x08 #define GVf_IMPORTED 0xF0 #define GVf_IMPORTED_SV 0x10 #define GVf_IMPORTED_AV 0x20 @@ -118,6 +136,20 @@ HV *GvHVn(); #define GvIMPORTED_CV_on(gv) (GvFLAGS(gv) |= GVf_IMPORTED_CV) #define GvIMPORTED_CV_off(gv) (GvFLAGS(gv) &= ~GVf_IMPORTED_CV) +#define GvIN_PAD(gv) (GvFLAGS(gv) & GVf_IN_PAD) +#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) +#define GvUNIQUE_off(gv) + +#ifdef USE_ITHREADS +#define GV_UNIQUE_CHECK +#else +#undef GV_UNIQUE_CHECK +#endif + #define Nullgv Null(GV*) #define DM_UID 0x003 @@ -136,4 +168,15 @@ HV *GvHVn(); #define GV_ADDWARN 0x04 /* add, but warn if symbol wasn't already there */ #define GV_ADDINEVAL 0x08 /* add, as though we're doing so within an eval */ #define GV_NOINIT 0x10 /* add, but don't init symbol, if type != PVGV */ -#define GV_ADDOUR 0x20 /* add "our" variable */ +/* This is used by toke.c to avoid turing placeholder constants in the symbol + table into full PVGVs with attached constant subroutines. */ +#define GV_NOADD_NOINIT 0x20 /* Don't add the symbol if it's not there. + Don't init it if it is there but ! PVGV */ +#define GV_NOEXPAND 0x40 /* Don't expand SvOK() entries to PVGV */ + +/* 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. +*/ +#define gv_fullname3(sv,gv,prefix) gv_fullname4(sv,gv,prefix,TRUE) +#define gv_efullname3(sv,gv,prefix) gv_efullname4(sv,gv,prefix,TRUE) +#define gv_fetchmethod(stash, name) gv_fetchmethod_autoload(stash, name, TRUE)