mirror of
https://github.com/cc65/cc65.git
synced 2025-08-13 08:25:28 +00:00
Remove .FEATURE requirement and add documentation
This commit is contained in:
@@ -2316,6 +2316,24 @@ Here's a list of all control commands and a description, what they do:
|
|||||||
</verb></tscreen>
|
</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>
|
<sect1><tt>.DESTRUCTOR</tt><label id=".DESTRUCTOR"><p>
|
||||||
|
|
||||||
Export a symbol and mark it as a module destructor. This may be used
|
Export a symbol and mark it as a module destructor. This may be used
|
||||||
|
@@ -421,26 +421,27 @@ static ExprNode* FuncDefined (void)
|
|||||||
static ExprNode* FuncDefinedInstr (void)
|
static ExprNode* FuncDefinedInstr (void)
|
||||||
/* Handle the .DEFINEDINSTR builtin function */
|
/* Handle the .DEFINEDINSTR builtin function */
|
||||||
{
|
{
|
||||||
int Instr = 0;
|
int Instr = 0;
|
||||||
|
|
||||||
/* Check for a macro or an instruction depending on UbiquitousIdents */
|
/* Check for a macro or an instruction depending on UbiquitousIdents */
|
||||||
|
|
||||||
if (CurTok.Tok == TOK_IDENT) {
|
if (CurTok.Tok == TOK_IDENT) {
|
||||||
if (UbiquitousIdents) {
|
if (UbiquitousIdents) {
|
||||||
/* Macros CAN be instructions, so check for them first */
|
/* Macros CAN be instructions, so check for them first */
|
||||||
if (FindMacro(&CurTok.SVal) == 0) {
|
if (FindMacro (&CurTok.SVal) == 0) {
|
||||||
Instr = FindInstruction (&CurTok.SVal);
|
Instr = FindInstruction (&CurTok.SVal);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Macros and symbols may NOT use the names of instructions, so just check for the instruction */
|
/* 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 {
|
} else {
|
||||||
Error("Idenitifier expected.");
|
Error ("Idenitifier expected.");
|
||||||
}
|
}
|
||||||
|
/* Skip the name */
|
||||||
|
NextTok ();
|
||||||
|
|
||||||
return GenLiteralExpr(Instr > 0);
|
return GenLiteralExpr (Instr > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -64,7 +64,6 @@ static const char* FeatureKeys[FEAT_COUNT] = {
|
|||||||
"force_range",
|
"force_range",
|
||||||
"underline_in_numbers",
|
"underline_in_numbers",
|
||||||
"addrsize",
|
"addrsize",
|
||||||
"definedinstr",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -122,7 +121,6 @@ feature_t SetFeature (const StrBuf* Key)
|
|||||||
case FEAT_FORCE_RANGE: ForceRange = 1; break;
|
case FEAT_FORCE_RANGE: ForceRange = 1; break;
|
||||||
case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break;
|
case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break;
|
||||||
case FEAT_ADDRSIZE: AddrSize = 1; break;
|
case FEAT_ADDRSIZE: AddrSize = 1; break;
|
||||||
case FEAT_DEFINEDINSTR: DefinedInstr = 1; break;
|
|
||||||
default: /* Keep gcc silent */ break;
|
default: /* Keep gcc silent */ break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,7 +66,6 @@ typedef enum {
|
|||||||
FEAT_FORCE_RANGE,
|
FEAT_FORCE_RANGE,
|
||||||
FEAT_UNDERLINE_IN_NUMBERS,
|
FEAT_UNDERLINE_IN_NUMBERS,
|
||||||
FEAT_ADDRSIZE,
|
FEAT_ADDRSIZE,
|
||||||
FEAT_DEFINEDINSTR,
|
|
||||||
|
|
||||||
/* Special value: Number of features available */
|
/* Special value: Number of features available */
|
||||||
FEAT_COUNT
|
FEAT_COUNT
|
||||||
|
@@ -83,4 +83,3 @@ unsigned char CComments = 0; /* Allow C like comments */
|
|||||||
unsigned char ForceRange = 0; /* Force values into expected range */
|
unsigned char ForceRange = 0; /* Force values into expected range */
|
||||||
unsigned char UnderlineInNumbers = 0; /* Allow underlines in numbers */
|
unsigned char UnderlineInNumbers = 0; /* Allow underlines in numbers */
|
||||||
unsigned char AddrSize = 0; /* Allow .ADDRSIZE function */
|
unsigned char AddrSize = 0; /* Allow .ADDRSIZE function */
|
||||||
unsigned char DefinedInstr = 0; /* Allow .DEFINEDINSTR function */
|
|
||||||
|
@@ -85,7 +85,6 @@ extern unsigned char CComments; /* Allow C like comments */
|
|||||||
extern unsigned char ForceRange; /* Force values into expected range */
|
extern unsigned char ForceRange; /* Force values into expected range */
|
||||||
extern unsigned char UnderlineInNumbers; /* Allow underlines in numbers */
|
extern unsigned char UnderlineInNumbers; /* Allow underlines in numbers */
|
||||||
extern unsigned char AddrSize; /* Allow .ADDRSIZE function */
|
extern unsigned char AddrSize; /* Allow .ADDRSIZE function */
|
||||||
extern unsigned char DefinedInstr; /* Allow .DEFINEDINSTR function */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -737,13 +737,6 @@ static token_t FindDotKeyword (void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_DEFINEDINSTR:
|
|
||||||
/* Disallow .DEFINEDINSTR function by default */
|
|
||||||
if (DefinedInstr == 0) {
|
|
||||||
return TOK_NONE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user