From 43af1a130e4d303c5aaaaeb6b1f1c35d0f9794b0 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Fri, 16 Mar 2007 20:10:26 +0000 Subject: [PATCH] Added experimental "any" tag to compiler... --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40638 --- sourcepawn/compiler/sc.h | 1 + sourcepawn/compiler/sc1.c | 3 +++ sourcepawn/compiler/sc3.c | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/sourcepawn/compiler/sc.h b/sourcepawn/compiler/sc.h index 2b3783ac..c479e5bf 100644 --- a/sourcepawn/compiler/sc.h +++ b/sourcepawn/compiler/sc.h @@ -823,6 +823,7 @@ SC_VDECL int pc_optimize; /* (peephole) optimization level */ SC_VDECL int pc_memflags; /* special flags for the stack/heap usage */ SC_VDECL int pc_functag; /* global function tag */ SC_VDECL int pc_tag_string; /* global string tag */ +SC_VDECL int pc_anytag; /* global any tag */ SC_VDECL int glbstringread; /* last global string read */ SC_VDECL constvalue sc_automaton_tab; /* automaton table */ diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index 5c22032a..10ad99b7 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -70,6 +70,7 @@ #define VERSION_STR "3.2.3636" #define VERSION_INT 0x0302 +int pc_anytag = 0; int pc_functag = 0; int pc_tag_string = 0; @@ -1256,6 +1257,8 @@ static void setconstants(void) assert(sc_status==statIDLE); append_constval(&tagname_tab,"_",0,0);/* "untagged" */ append_constval(&tagname_tab,"bool",1,0); + + pc_anytag = pc_addtag("any"); pc_functag = pc_addfunctag("Function"); pc_tag_string = pc_addtag("String"); diff --git a/sourcepawn/compiler/sc3.c b/sourcepawn/compiler/sc3.c index de5620ad..ce8182d3 100644 --- a/sourcepawn/compiler/sc3.c +++ b/sourcepawn/compiler/sc3.c @@ -327,6 +327,11 @@ SC_FUNC int matchtag(int formaltag,int actualtag,int allowcoerce) * tag is "coerced" to zero */ if (!allowcoerce || formaltag!=0 || (actualtag & FIXEDTAG)!=0) { + if (formaltag == pc_anytag) + { + return TRUE; + } + if (formaltag & FUNCTAG) { if (actualtag == pc_functag || (formaltag == pc_functag && actualtag & FUNCTAG))