mescc: Tinycc support: Compound strings as function argument.
* module/language/c99/compiler.mes (expr->accu): Handle compound strings as function argument. * module/mes/M1.mes (object->M1): Call error when string not found. * scaffold/tests/t.c: Test it.
This commit is contained in:
parent
209f9cc599
commit
345d0d8413
|
@ -942,6 +942,12 @@
|
|||
(info (clone info #:globals globals)))
|
||||
(append-text info (list (i386:label->accu `(#:string ,string))))))
|
||||
|
||||
((p-expr (string . ,strings))
|
||||
(let* ((string (apply string-append strings))
|
||||
(globals ((globals:add-string globals) string))
|
||||
(info (clone info #:globals globals)))
|
||||
(append-text info (list (i386:label->accu `(#:string ,string))))))
|
||||
|
||||
((p-expr (fixed ,value))
|
||||
(let ((value (cstring->number value)))
|
||||
(append-text info (wrap-as (i386:value->accu value)))))
|
||||
|
@ -954,9 +960,6 @@
|
|||
(let ((char (char->integer (car (string->list char)))))
|
||||
(append-text info (wrap-as (i386:value->accu char)))))
|
||||
|
||||
((p-expr (string . ,strings))
|
||||
(append-text info (list (i386:label->accu `(#:string ,(apply string-append strings))))))
|
||||
|
||||
(,char (guard (char? char)) (append-text info (wrap-as (i386:value->accu char))))
|
||||
|
||||
((p-expr (ident ,name))
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
(let ((index (list-index (lambda (s) (equal? s o)) strings)))
|
||||
(if index
|
||||
(string-append "_string_" file-name "_" (number->string index))
|
||||
"")))
|
||||
(error "no such string:" o))))
|
||||
(define (text->M1 o)
|
||||
(cond
|
||||
((char? o) (text->M1 (char->integer o)))
|
||||
|
|
|
@ -153,6 +153,8 @@ main (int argc, char* argv[])
|
|||
if (lst[i+1] != i)
|
||||
return 30 + i;
|
||||
}
|
||||
puts ("foo"
|
||||
"bar");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue