1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-15 06:27:36 +00:00

Fix macro output in the listing

git-svn-id: svn://svn.cc65.org/cc65/trunk@141 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2000-07-09 13:19:25 +00:00
parent c4cf60b521
commit 0e460243fd
3 changed files with 43 additions and 32 deletions

View File

@@ -136,6 +136,14 @@ int InputFromStack (void)
int HavePushedInput (void)
/* Return true if we have stacked input available, return false if not */
{
return (IStack != 0);
}
void CheckInputStack (void) void CheckInputStack (void)
/* Called from the scanner before closing an input file. Will check for any /* Called from the scanner before closing an input file. Will check for any
* stuff on the input stack. * stuff on the input stack.

View File

@@ -55,6 +55,9 @@ int InputFromStack (void);
* return false otherwise. * return false otherwise.
*/ */
int HavePushedInput (void);
/* Return true if we have stacked input available, return false if not */
void CheckInputStack (void); void CheckInputStack (void);
/* Called from the scanner before closing an input file. Will check for any /* Called from the scanner before closing an input file. Will check for any
* stuff on the input stack. * stuff on the input stack.

View File

@@ -47,6 +47,7 @@
#include "global.h" #include "global.h"
#include "incpath.h" #include "incpath.h"
#include "instr.h" #include "instr.h"
#include "istack.h"
#include "listing.h" #include "listing.h"
#include "macro.h" #include "macro.h"
#include "nexttok.h" #include "nexttok.h"
@@ -299,8 +300,12 @@ static void OneLine (void)
char Ident [MAX_STR_LEN+1]; char Ident [MAX_STR_LEN+1];
int Done = 0; int Done = 0;
/* Initialize the listing line */ /* Initialize the new listing line if we are actually reading from file
InitListingLine (); * and not from internally pushed input.
*/
if (!HavePushedInput ()) {
InitListingLine ();
}
if (Tok == TOK_COLON) { if (Tok == TOK_COLON) {
/* An unnamed label */ /* An unnamed label */
@@ -342,41 +347,36 @@ static void OneLine (void)
* without a colon if there is no whitespace before the * without a colon if there is no whitespace before the
* identifier. * identifier.
*/ */
if (Tok != TOK_COLON) { if (Tok != TOK_COLON) {
if (HadWS || !NoColonLabels) { if (HadWS || !NoColonLabels) {
Error (ERR_COLON_EXPECTED); Error (ERR_COLON_EXPECTED);
} }
if (Tok == TOK_NAMESPACE) { if (Tok == TOK_NAMESPACE) {
/* Smart :: handling */ /* Smart :: handling */
NextTok (); NextTok ();
} }
} else { } else {
/* Skip the colon */ /* Skip the colon */
NextTok (); NextTok ();
} }
} }
} }
} }
if (!Done) { if (!Done) {
if (TokIsPseudo (Tok)) { if (TokIsPseudo (Tok)) {
/* A control command, IVal is index into table */ /* A control command, IVal is index into table */
HandlePseudo (); HandlePseudo ();
} else if (Tok == TOK_MNEMO) { } else if (Tok == TOK_MNEMO) {
/* A mnemonic - assemble one instruction */ /* A mnemonic - assemble one instruction */
HandleInstruction (IVal); HandleInstruction (IVal);
} else if (Tok == TOK_IDENT && IsMacro (SVal)) { } else if (Tok == TOK_IDENT && IsMacro (SVal)) {
/* A macro expansion */ /* A macro expansion */
MacExpandStart (); MacExpandStart ();
} }
} }
/* Calling InitListingLine again here is part of a hack that introduces
* enough magic to make the PC output in the listing work.
*/
InitListingLine ();
/* Line separator must come here */ /* Line separator must come here */
ConsumeSep (); ConsumeSep ();
} }