aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard>2004-10-23 22:52:42 +0000
committerbellard <bellard>2004-10-23 22:52:42 +0000
commiteb79471184b9771f0638d022a093c1885652e3fb (patch)
tree70a6b9fefc0f1b230e252e31ff485263ce250037
parent59c35638276435872ef797e3241f8da439c66a44 (diff)
downloadtinycc-eb79471184b9771f0638d022a093c1885652e3fb.tar.gz
tinycc-eb79471184b9771f0638d022a093c1885652e3fb.tar.bz2
added .ascii and .asciz directives
-rw-r--r--tccasm.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/tccasm.c b/tccasm.c
index f781f20..26117ad 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -466,17 +466,30 @@ static void asm_parse_directive(TCCState *s1)
}
break;
case TOK_ASM_string:
+ case TOK_ASM_ascii:
+ case TOK_ASM_asciz:
{
const uint8_t *p;
- int i;
+ int i, size, t;
+ t = tok;
next();
- if (tok != TOK_STR)
- expect("string constant");
- p = tokc.cstr->data;
- for(i = 0; i < tokc.cstr->size; i++)
- g(p[i]);
- next();
+ for(;;) {
+ if (tok != TOK_STR)
+ expect("string constant");
+ p = tokc.cstr->data;
+ size = tokc.cstr->size;
+ 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;
case TOK_ASM_text: