diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index f275fb99..ea41b362 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -1767,10 +1767,10 @@ (define (ast->name o) (pmatch o ((ident ,name) name) - ((ptr-declr ,pointer (ident ,name)) name) ((array-of ,array . ,_) (ast->name array)) - ((ftn-declr (scope (ptr-declr ,pointer (ident ,name)))) name) + ((ftn-declr (scope (ptr-declr ,pointer (ident ,name))) . _) name) ((ptr-declr ,pointer ,decl . ,_) (ast->name decl)) + ((ptr-declr ,pointer (ident ,name)) name) (_ (error "ast->name not supported: " o)))) (define (init-declr->count info o) diff --git a/module/language/c99/info.scm b/module/language/c99/info.scm index 1d387ced..a0427610 100644 --- a/module/language/c99/info.scm +++ b/module/language/c99/info.scm @@ -96,6 +96,7 @@ function:name function:type function:text + function->string ->type ->rank @@ -196,6 +197,9 @@ (type function:type) (text function:text)) +(define (function->string o) + (function:name o)) + (define (structured-type? o) (cond ((type? o) (memq (type:type o) '(struct union))) ((global? o) ((compose structured-type? global:type) o)) diff --git a/module/mes/M1.mes b/module/mes/M1.mes index e515d425..3280cd58 100644 --- a/module/mes/M1.mes +++ b/module/mes/M1.mes @@ -129,6 +129,10 @@ (hex2:address address)) ((#:address (#:address ,global)) (guard (global? global)) (hex2:address (global->string global))) + ((#:address ,function) (guard (function? function)) + (hex2:address (function->string function))) + ((#:address ,number) (guard (number? number)) + (string-join (map text->M1 (int->bv32 number)))) ((#:string ,string) (hex2:address (string->label o))) ((#:address ,address) (guard (string? address)) (hex2:address address)) @@ -137,7 +141,8 @@ ((#:offset ,offset) (hex2:offset offset)) ((#:offset1 ,offset1) (hex2:offset1 offset1)) ((#:immediate ,immediate) (hex2:immediate immediate)) - ((#:immediate1 ,immediate1) (hex2:immediate1 immediate1)))) + ((#:immediate1 ,immediate1) (hex2:immediate1 immediate1)) + (_ (error "text->M1 no match o" o)))) ((pair? o) (string-join (map text->M1 o))))) (define (write-function o) (let ((name (car o))