Stole the magical any: tag from sourcemod

This commit is contained in:
Steve Dudenhoeffer 2007-04-24 13:36:36 +00:00
parent 8e1f54465d
commit ea912f794c
3 changed files with 9 additions and 2 deletions

View File

@ -785,6 +785,8 @@ SC_VDECL short sc_is_utf8; /* is this source file in UTF-8 encoding */
SC_VDECL constvalue sc_automaton_tab; /* automaton table */ SC_VDECL constvalue sc_automaton_tab; /* automaton table */
SC_VDECL constvalue sc_state_tab; /* state table */ SC_VDECL constvalue sc_state_tab; /* state table */
SC_VDECL int pc_anytag;
SC_VDECL FILE *inpf; /* file read from (source or include) */ SC_VDECL FILE *inpf; /* file read from (source or include) */
SC_VDECL FILE *inpf_org; /* main source file */ SC_VDECL FILE *inpf_org; /* main source file */
SC_VDECL FILE *outf; /* file written to */ SC_VDECL FILE *outf; /* file written to */

View File

@ -67,6 +67,8 @@
#define VERSION_STR "3.0.3367-amxx" #define VERSION_STR "3.0.3367-amxx"
#define VERSION_INT 0x300 #define VERSION_INT 0x300
int pc_anytag;
static void resetglobals(void); static void resetglobals(void);
static void initglobals(void); static void initglobals(void);
static void setopt(int argc,char **argv,char *oname,char *ename,char *pname, static void setopt(int argc,char **argv,char *oname,char *ename,char *pname,
@ -1403,6 +1405,8 @@ static void setconstants(void)
add_constant("__Pawn",VERSION_INT,sGLOBAL,0); add_constant("__Pawn",VERSION_INT,sGLOBAL,0);
pc_anytag=pc_addtag("any");
debug=0; debug=0;
if ((sc_debug & (sCHKBOUNDS | sSYMBOLIC))==(sCHKBOUNDS | sSYMBOLIC)) if ((sc_debug & (sCHKBOUNDS | sSYMBOLIC))==(sCHKBOUNDS | sSYMBOLIC))
debug=2; debug=2;

View File

@ -284,12 +284,13 @@ static void (*unopers[])(void) = { lneg, neg, user_inc, user_dec };
SC_FUNC int matchtag(int formaltag,int actualtag,int allowcoerce) SC_FUNC int matchtag(int formaltag,int actualtag,int allowcoerce)
{ {
if (formaltag!=actualtag) { if (formaltag!=actualtag && formaltag!=pc_anytag) {
/* if the formal tag is zero and the actual tag is not "fixed", the actual /* if the formal tag is zero and the actual tag is not "fixed", the actual
* tag is "coerced" to zero * tag is "coerced" to zero
*/ */
if (!allowcoerce || formaltag!=0 || (actualtag & FIXEDTAG)!=0) if (!allowcoerce || formaltag!=0 || (actualtag & FIXEDTAG)!=0)
return FALSE; return FALSE;
} /* if */ } /* if */
return TRUE; return TRUE;
} }