From ea912f794c20f52365e3438f40256a8346e06fd6 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Tue, 24 Apr 2007 13:36:36 +0000 Subject: [PATCH] Stole the magical any: tag from sourcemod --- compiler/libpc300/sc.h | 2 ++ compiler/libpc300/sc1.c | 4 ++++ compiler/libpc300/sc3.c | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/libpc300/sc.h b/compiler/libpc300/sc.h index ed3ce11f..a5928c94 100755 --- a/compiler/libpc300/sc.h +++ b/compiler/libpc300/sc.h @@ -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_state_tab; /* state table */ +SC_VDECL int pc_anytag; + SC_VDECL FILE *inpf; /* file read from (source or include) */ SC_VDECL FILE *inpf_org; /* main source file */ SC_VDECL FILE *outf; /* file written to */ diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index 390a7450..dde9c9d7 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -67,6 +67,8 @@ #define VERSION_STR "3.0.3367-amxx" #define VERSION_INT 0x300 +int pc_anytag; + static void resetglobals(void); static void initglobals(void); static void setopt(int argc,char **argv,char *oname,char *ename,char *pname, @@ -1402,6 +1404,8 @@ static void setconstants(void) add_constant("ucharmax",(1 << (sizeof(cell)-1)*8)-1,sGLOBAL,0); add_constant("__Pawn",VERSION_INT,sGLOBAL,0); + + pc_anytag=pc_addtag("any"); debug=0; if ((sc_debug & (sCHKBOUNDS | sSYMBOLIC))==(sCHKBOUNDS | sSYMBOLIC)) diff --git a/compiler/libpc300/sc3.c b/compiler/libpc300/sc3.c index c23f74a5..f563cdb9 100755 --- a/compiler/libpc300/sc3.c +++ b/compiler/libpc300/sc3.c @@ -284,12 +284,13 @@ static void (*unopers[])(void) = { lneg, neg, user_inc, user_dec }; 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 * tag is "coerced" to zero */ if (!allowcoerce || formaltag!=0 || (actualtag & FIXEDTAG)!=0) - return FALSE; + return FALSE; + } /* if */ return TRUE; }