Added a more generic way to push sources that deliver a token stream

independent of the actual input from the file. Change macro handling
to use the new input stack.
Fixed an error in FreeIf: If an unexpected .ENDIF was reached, the
assembler started an endless loop printing error messages.


git-svn-id: svn://svn.cc65.org/cc65/trunk@24 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2000-06-03 11:15:11 +00:00
parent 5e561a0f40
commit 522c7e8c46
21 changed files with 880 additions and 300 deletions

View File

@@ -35,7 +35,7 @@
#include "error.h"
#include "expr.h"
#include "scanner.h"
#include "nexttok.h"
#include "symtab.h"
#include "condasm.h"
@@ -124,6 +124,7 @@ static void FreeIf (void)
IfDesc* D = GetCurrentIf();
if (D == 0) {
Error (ERR_UNEXPECTED, ".ENDIF");
Done = 1;
} else {
Done = (D->Flags & ifNeedTerm) != 0;
--IfCount;
@@ -402,7 +403,7 @@ void CheckOpenIfs (void)
/* There are no open .IFs */
break;
}
if (D->Pos.Name != CurPos.Name) {
/* The .if is from another file, bail out */
break;
@@ -416,3 +417,21 @@ void CheckOpenIfs (void)
unsigned GetIfStack (void)
/* Get the current .IF stack pointer */
{
return IfCount;
}
void CleanupIfStack (unsigned SP)
/* Cleanup the .IF stack, remove anything above the given stack pointer */
{
while (IfCount > SP) {
FreeIf ();
}
}