mirror of
https://github.com/cc65/cc65.git
synced 2024-07-05 21:29:03 +00:00
Use the new StrBuf features
git-svn-id: svn://svn.cc65.org/cc65/trunk@1414 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
ea50befaac
commit
e880ac6059
@ -273,8 +273,8 @@ static void ParseLVarArg (StrBuf* T, unsigned Arg)
|
|||||||
static void ParseAsm (void)
|
static void ParseAsm (void)
|
||||||
/* Parse the contents of the ASM statement */
|
/* Parse the contents of the ASM statement */
|
||||||
{
|
{
|
||||||
unsigned I;
|
|
||||||
unsigned Arg;
|
unsigned Arg;
|
||||||
|
char C;
|
||||||
|
|
||||||
/* Create a target string buffer */
|
/* Create a target string buffer */
|
||||||
StrBuf T = AUTO_STRBUF_INITIALIZER;
|
StrBuf T = AUTO_STRBUF_INITIALIZER;
|
||||||
@ -302,12 +302,8 @@ static void ParseAsm (void)
|
|||||||
* %o - Stack offset of a (local) variable
|
* %o - Stack offset of a (local) variable
|
||||||
* %% - The % sign
|
* %% - The % sign
|
||||||
*/
|
*/
|
||||||
I = 0;
|
|
||||||
Arg = 0;
|
Arg = 0;
|
||||||
while (I < SB_GetLen (&S)) {
|
while ((C = SB_Get (&S)) != '\0') {
|
||||||
|
|
||||||
/* Get the next character */
|
|
||||||
char C = SB_AtUnchecked (&S, I++);
|
|
||||||
|
|
||||||
/* If it is a newline, the current line is ready to go */
|
/* If it is a newline, the current line is ready to go */
|
||||||
if (C == '\n') {
|
if (C == '\n') {
|
||||||
@ -320,27 +316,19 @@ static void ParseAsm (void)
|
|||||||
|
|
||||||
/* Format specifier */
|
/* Format specifier */
|
||||||
++Arg;
|
++Arg;
|
||||||
|
C = SB_Get (&S);
|
||||||
/* Check if we have characters left */
|
switch (C) {
|
||||||
if (I >= SB_GetLen (&S)) {
|
case 'b': ParseByteArg (&T, Arg); break;
|
||||||
Error ("Error in __asm__ format specifier %u", Arg);
|
case 'w': ParseWordArg (&T, Arg); break;
|
||||||
AsmErrorSkip ();
|
case 'l': ParseLongArg (&T, Arg); break;
|
||||||
goto Done;
|
case 'v': ParseGVarArg (&T, Arg); break;
|
||||||
} else {
|
case 'o': ParseLVarArg (&T, Arg); break;
|
||||||
C = SB_AtUnchecked (&S, I++);
|
case '%': SB_AppendChar (&T, '%'); break;
|
||||||
switch (C) {
|
default:
|
||||||
case 'b': ParseByteArg (&T, Arg); break;
|
Error ("Error in __asm__ format specifier %u", Arg);
|
||||||
case 'w': ParseWordArg (&T, Arg); break;
|
AsmErrorSkip ();
|
||||||
case 'l': ParseLongArg (&T, Arg); break;
|
goto Done;
|
||||||
case 'v': ParseGVarArg (&T, Arg); break;
|
}
|
||||||
case 'o': ParseLVarArg (&T, Arg); break;
|
|
||||||
case '%': SB_AppendChar (&T, '%'); break;
|
|
||||||
default:
|
|
||||||
Error ("Error in __asm__ format specifier %u", Arg);
|
|
||||||
AsmErrorSkip ();
|
|
||||||
goto Done;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user