1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

Use the new AddrSizeFromStr function.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4051 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-08-27 14:19:47 +00:00
parent 6f39a15eff
commit 2b15f40424

View File

@ -1373,12 +1373,7 @@ unsigned char ParseAddrSize (void)
* error message and return ADDR_SIZE_DEFAULT. * error message and return ADDR_SIZE_DEFAULT.
*/ */
{ {
static const char* Keys[] = { unsigned char AddrSize;
"DIRECT", "ZEROPAGE", "ZP",
"ABSOLUTE", "ABS", "NEAR",
"FAR",
"LONG", "DWORD",
};
/* Check for an identifier */ /* Check for an identifier */
if (Tok != TOK_IDENT) { if (Tok != TOK_IDENT) {
@ -1386,21 +1381,15 @@ unsigned char ParseAddrSize (void)
return ADDR_SIZE_DEFAULT; return ADDR_SIZE_DEFAULT;
} }
/* Search for the attribute */ /* Convert the attribute */
switch (GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0]))) { AddrSize = AddrSizeFromStr (SB_GetConstBuf (&SVal));
case 0: if (AddrSize == ADDR_SIZE_INVALID) {
case 1:
case 2: return ADDR_SIZE_ZP;
case 3:
case 4:
case 5: return ADDR_SIZE_ABS;
case 6: return ADDR_SIZE_FAR;
case 7:
case 8: return ADDR_SIZE_LONG;
default:
Error ("Address size specifier expected"); Error ("Address size specifier expected");
return ADDR_SIZE_DEFAULT; AddrSize = ADDR_SIZE_DEFAULT;
} }
/* Done */
return AddrSize;
} }