added .ascii and .asciz directives

tcc-xref
bellard 2004-10-23 22:52:42 +00:00
parent 59c3563827
commit eb79471184
1 changed files with 20 additions and 7 deletions

View File

@ -466,17 +466,30 @@ static void asm_parse_directive(TCCState *s1)
} }
break; break;
case TOK_ASM_string: case TOK_ASM_string:
case TOK_ASM_ascii:
case TOK_ASM_asciz:
{ {
const uint8_t *p; const uint8_t *p;
int i; int i, size, t;
t = tok;
next(); next();
if (tok != TOK_STR) for(;;) {
expect("string constant"); if (tok != TOK_STR)
p = tokc.cstr->data; expect("string constant");
for(i = 0; i < tokc.cstr->size; i++) p = tokc.cstr->data;
g(p[i]); size = tokc.cstr->size;
next(); if (t == TOK_ASM_ascii && size > 0)
size--;
for(i = 0; i < size; i++)
g(p[i]);
next();
if (tok == ',') {
next();
} else if (tok != TOK_STR) {
break;
}
}
} }
break; break;
case TOK_ASM_text: case TOK_ASM_text: