From 980c17daef5a37752826beea117aecf275fa0c34 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 1 Oct 2002 08:13:04 +0000 Subject: [PATCH] Allow more flexible numeric flag pragma arguments git-svn-id: svn://svn.cc65.org/cc65/trunk@1423 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/pragma.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cc65/pragma.c b/src/cc65/pragma.c index 602ce7a7e..9c452a855 100644 --- a/src/cc65/pragma.c +++ b/src/cc65/pragma.c @@ -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"); }