addressed a very unfortunate issue, the compiler's multipass system is garbage

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40348
This commit is contained in:
David Anderson 2007-01-25 04:25:40 +00:00
parent c31ca9f079
commit dbf105cc71
3 changed files with 19 additions and 3 deletions

View File

@ -39,6 +39,9 @@ jmp_buf brkout;
int main(int argc, char *argv[])
{
#if defined _DEBUG
getchar();
#endif
if (pc_compile(argc,argv) == 0)
{
AMX_HEADER *hdr;

View File

@ -3024,13 +3024,25 @@ static void dofuncenum(int listmode)
memset(&func, 0, sizeof(func));
func.ret_tag = pc_addtag(NULL); /* Get the return tag */
l = lex(&val, &str);
if (l == tSTOCK)
/* :TODO:
* Right now, there is a problem. We can't pass non-public function pointer addresses around,
* because the address isn't known until the final reparse. Unfortunately, you can write code
* before the address is known, because Pawn's compiler isn't truly multipass.
*
* When you call a function, there's no problem, because it does not write the address.
* The assembly looks like this:
* call MyFunction
* Then, only at assembly time (once all passes are done), does it know the address.
* I do not see any solution to this because there is no way I know to inject the function name
* rather than the constant value. And even if we could, we'd have to change the assembler recognize that.
*/
/*if (l == tSTOCK)
{
func.type = uSTOCK;
} else if (l == tPUBLIC) {
} else */if (l == tPUBLIC) {
func.type = uPUBLIC;
} else {
error(1, "-stock,public-", str);
error(1, "-public-", str);
}
needtoken('(');
do

View File

@ -2028,6 +2028,7 @@ restart:
}
lval1->tag=pc_addfunctag(faketag);
oldsym->usage |= uREAD;
sym->usage |= uREAD;
} else {
error(76); /* invalid function call, or syntax error */
} /* if */