mirror of
https://github.com/cc65/cc65.git
synced 2025-01-24 20:30:08 +00:00
Allow more flexible numeric flag pragma arguments
git-svn-id: svn://svn.cc65.org/cc65/trunk@1423 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
65fa99f65e
commit
980c17daef
@ -224,14 +224,9 @@ static void FlagPragma (StrBuf* B, unsigned char* Flag)
|
||||
/* Handle a pragma that expects a boolean paramater */
|
||||
{
|
||||
ident Ident;
|
||||
long Val;
|
||||
|
||||
if (SB_Peek (B) == '0') {
|
||||
SB_Skip (B);
|
||||
*Flag = 0;
|
||||
} else if (SB_Peek (B) == '1') {
|
||||
SB_Skip (B);
|
||||
*Flag = 1;
|
||||
} else if (SB_GetSym (B, Ident)) {
|
||||
if (SB_GetSym (B, Ident)) {
|
||||
if (strcmp (Ident, "true") == 0 || strcmp (Ident, "on") == 0) {
|
||||
*Flag = 1;
|
||||
} else if (strcmp (Ident, "false") == 0 || strcmp (Ident, "off") == 0) {
|
||||
@ -239,6 +234,8 @@ static void FlagPragma (StrBuf* B, unsigned char* Flag)
|
||||
} else {
|
||||
Error ("Pragma argument must be one of `on', `off', `true' or `false'");
|
||||
}
|
||||
} else if (SB_GetNumber (B, &Val)) {
|
||||
*Flag = (Val != 0);
|
||||
} else {
|
||||
Error ("Invalid pragma argument");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user