From 9cd64d946cb126319332bcab24a332ec23c46c24 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 14 Jul 2006 06:47:51 +0000 Subject: [PATCH] public functions can now be passed as arguments, with the tag 'Function:' --HG-- branch : dvander extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/dvander%4015 --- compiler-init/sc3.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/compiler-init/sc3.c b/compiler-init/sc3.c index f4ede2aa..ddb0acc3 100644 --- a/compiler-init/sc3.c +++ b/compiler-init/sc3.c @@ -1670,13 +1670,29 @@ restart: if (sc_allowproccall) { callfunction(sym,lval1,FALSE); } else { - lval1->sym=NULL; - lval1->ident=iEXPRESSION; - lval1->constval=0; - lval1->tag=0; - error(76); /* invalid function call, or syntax error */ - } /* if */ - return FALSE; + int n=-1,iter=0; + for (sym=glbtab.next; sym!=NULL; sym=sym->next) { + if (sym->ident==iFUNCTN + && (sym->usage & uPUBLIC)!=0 && (sym->usage & uDEFINE)!=0) + { + assert(sym->vclass==sGLOBAL); + if (strcmp(sym->name, lval1->sym->name)==0) { + n = iter; + break; + } + iter++; + } + } + if (n!=-1) { + lval1->sym=NULL; + lval1->ident=iCONSTEXPR; + lval1->constval=n; + lval1->tag=pc_addtag("Function"); + } else { + error(76); /* invalid function call, or syntax error */ + } /* if */ + return FALSE; + } } /* if */ return lvalue; }