1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Remove .FEATURE requirement and add documentation

This commit is contained in:
JT 2015-05-19 00:06:12 -04:00
parent 5ed3a1a6dc
commit 9ee5adc190
7 changed files with 25 additions and 18 deletions

View File

@ -2316,6 +2316,24 @@ Here's a list of all control commands and a description, what they do:
</verb></tscreen>
<sect1><tt>.DEFINEDINSTR</tt><label id=".DEFINEDINSTR"><p>
Builtin function. The function expects an identifier as argument in braces.
The argument is evaluated, and the function yields "true" if the identifier
is defined as an instruction mnemonic that is recognized by the assembler.
Example:
<tscreen><verb>
.if .not .definedinstr(ina)
.macro ina
clc
adc #$01
.endmacro
.endif
</verb></tscreen>
<sect1><tt>.DESTRUCTOR</tt><label id=".DESTRUCTOR"><p>
Export a symbol and mark it as a module destructor. This may be used

View File

@ -421,26 +421,27 @@ static ExprNode* FuncDefined (void)
static ExprNode* FuncDefinedInstr (void)
/* Handle the .DEFINEDINSTR builtin function */
{
int Instr = 0;
int Instr = 0;
/* Check for a macro or an instruction depending on UbiquitousIdents */
if (CurTok.Tok == TOK_IDENT) {
if (UbiquitousIdents) {
/* Macros CAN be instructions, so check for them first */
if (FindMacro(&CurTok.SVal) == 0) {
if (FindMacro (&CurTok.SVal) == 0) {
Instr = FindInstruction (&CurTok.SVal);
}
} else {
/* Macros and symbols may NOT use the names of instructions, so just check for the instruction */
Instr = FindInstruction(&CurTok.SVal);
Instr = FindInstruction (&CurTok.SVal);
}
NextTok();
} else {
Error("Idenitifier expected.");
Error ("Idenitifier expected.");
}
/* Skip the name */
NextTok ();
return GenLiteralExpr(Instr > 0);
return GenLiteralExpr (Instr > 0);
}

View File

@ -64,7 +64,6 @@ static const char* FeatureKeys[FEAT_COUNT] = {
"force_range",
"underline_in_numbers",
"addrsize",
"definedinstr",
};
@ -122,7 +121,6 @@ feature_t SetFeature (const StrBuf* Key)
case FEAT_FORCE_RANGE: ForceRange = 1; break;
case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break;
case FEAT_ADDRSIZE: AddrSize = 1; break;
case FEAT_DEFINEDINSTR: DefinedInstr = 1; break;
default: /* Keep gcc silent */ break;
}

View File

@ -66,7 +66,6 @@ typedef enum {
FEAT_FORCE_RANGE,
FEAT_UNDERLINE_IN_NUMBERS,
FEAT_ADDRSIZE,
FEAT_DEFINEDINSTR,
/* Special value: Number of features available */
FEAT_COUNT

View File

@ -83,4 +83,3 @@ unsigned char CComments = 0; /* Allow C like comments */
unsigned char ForceRange = 0; /* Force values into expected range */
unsigned char UnderlineInNumbers = 0; /* Allow underlines in numbers */
unsigned char AddrSize = 0; /* Allow .ADDRSIZE function */
unsigned char DefinedInstr = 0; /* Allow .DEFINEDINSTR function */

View File

@ -85,7 +85,6 @@ extern unsigned char CComments; /* Allow C like comments */
extern unsigned char ForceRange; /* Force values into expected range */
extern unsigned char UnderlineInNumbers; /* Allow underlines in numbers */
extern unsigned char AddrSize; /* Allow .ADDRSIZE function */
extern unsigned char DefinedInstr; /* Allow .DEFINEDINSTR function */

View File

@ -737,13 +737,6 @@ static token_t FindDotKeyword (void)
}
break;
case TOK_DEFINEDINSTR:
/* Disallow .DEFINEDINSTR function by default */
if (DefinedInstr == 0) {
return TOK_NONE;
}
break;
default:
break;
}