From: Gurusamy Sarathy Date: Sun, 5 Jul 1998 20:26:43 +0000 (+0000) Subject: add comments on GV_FOO constants, s/8/GV_ADDINEVAL/ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0f303493c65bc7de97980f1ff363e7d45c736c65;p=p5sagit%2Fp5-mst-13.2.git add comments on GV_FOO constants, s/8/GV_ADDINEVAL/ p4raw-id: //depot/perl@1322 --- diff --git a/gv.c b/gv.c index 9358ba3..035f22c 100644 --- a/gv.c +++ b/gv.c @@ -460,7 +460,7 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type) gv = gvp ? *gvp : Nullgv; if (gv && gv != (GV*)&sv_undef) { if (SvTYPE(gv) != SVt_PVGV) - gv_init(gv, stash, tmpbuf, len, (add & 2)); + gv_init(gv, stash, tmpbuf, len, (add & GV_ADDMULTI)); else GvMULTI_on(gv); } @@ -563,7 +563,7 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type) if (!stash) { if (!add) return Nullgv; - if (add & ~2) { + if (add & ~GV_ADDMULTI) { char sv_type_char = ((sv_type == SVt_PV) ? '$' : (sv_type == SVt_PVAV) ? '@' : (sv_type == SVt_PVHV) ? '%' diff --git a/gv.h b/gv.h index 2cb2438..8d987ed 100644 --- a/gv.h +++ b/gv.h @@ -127,7 +127,11 @@ HV *GvHVn(); #define DM_EGID 0x020 #define DM_DELAY 0x100 -#define GV_ADD 0x01 -#define GV_ADDMULTI 0x02 -#define GV_ADDWARN 0x04 -#define GV_NOINIT 0x10 /* 8 is used without a symbolic constant */ +/* + * symbol creation flags, for use in gv_fetchpv() and perl_get_*v() + */ +#define GV_ADD 0x01 /* add, if symbol not already there */ +#define GV_ADDMULTI 0x02 /* add, pretending it has been added already */ +#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 */ diff --git a/toke.c b/toke.c index 7020572..8d495f6 100644 --- a/toke.c +++ b/toke.c @@ -544,7 +544,7 @@ force_ident(register char *s, int kind) /* XXX see note in pp_entereval() for why we forgo typo warnings if the symbol must be introduced in an eval. GSAR 96-10-12 */ - gv_fetchpv(s, in_eval ? (GV_ADDMULTI | 8) : TRUE, + gv_fetchpv(s, in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : TRUE, kind == '$' ? SVt_PV : kind == '@' ? SVt_PVAV : kind == '%' ? SVt_PVHV : @@ -1522,7 +1522,7 @@ yylex(void) /* build ops for a bareword */ yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(tokenbuf+1, 0)); yylval.opval->op_private = OPpCONST_ENTERED; - gv_fetchpv(tokenbuf+1, in_eval ? (GV_ADDMULTI | 8) : TRUE, + gv_fetchpv(tokenbuf+1, in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : TRUE, ((tokenbuf[0] == '$') ? SVt_PV : (tokenbuf[0] == '@') ? SVt_PVAV : SVt_PVHV));