Added .DEFINEDMACRO psuedo function

Fixed typo/fomatting

Formatting fix

Refactor the code to test for a macro

Remove .FEATURE requirement for .DEFINEDMACRO
This commit is contained in:
JT
2015-05-10 20:25:40 -04:00
parent fe0b7570dc
commit e7fca18798
6 changed files with 223 additions and 173 deletions

View File

@@ -435,13 +435,34 @@ static ExprNode* FuncIsMnemonic (void)
/* Macros and symbols may NOT use the names of instructions, so just check for the instruction */
Instr = FindInstruction (&CurTok.SVal);
}
}
else {
Error ("Identifier expected.");
}
/* Skip the name */
NextTok();
return GenLiteralExpr (Instr > 0);
}
static ExprNode* FuncDefinedMacro (void)
/* Handle the .DEFINEDMACRO builtin function */
{
Macro* Mac = 0;
/* Check if the identifier is a macro */
if (CurTok.Tok == TOK_IDENT) {
Mac = FindMacro (&CurTok.SVal);
} else {
Error ("Identifier expected.");
}
/* Skip the name */
NextTok ();
return GenLiteralExpr (Instr > 0);
return GenLiteralExpr (Mac != 0);
}
@@ -1094,8 +1115,8 @@ static ExprNode* Factor (void)
N = Function (FuncDefined);
break;
case TOK_ISMNEMONIC:
N = Function (FuncIsMnemonic);
case TOK_DEFINEDMACRO:
N = Function (FuncDefinedMacro);
break;
case TOK_HIBYTE:
@@ -1106,6 +1127,10 @@ static ExprNode* Factor (void)
N = Function (FuncHiWord);
break;
case TOK_ISMNEMONIC:
N = Function (FuncIsMnemonic);
break;
case TOK_LOBYTE:
N = Function (FuncLoByte);
break;