Mercurial > hg > CbC > old > device
diff mc-tree.c @ 70:2e84590720a6
typedef name
author | kono |
---|---|
date | Mon, 24 Feb 2003 11:42:53 +0900 |
parents | dba8d111b7a0 |
children | 3b5d293cea36 |
line wrap: on
line diff
--- a/mc-tree.c Mon Feb 24 10:13:29 2003 +0900 +++ b/mc-tree.c Mon Feb 24 11:42:53 2003 +0900 @@ -284,11 +284,27 @@ fprintf(out,"%s",tn->tree_name); } +NMTBL * +typedef_search(type) +{ + int t = typedefed; + while(t) { + if (((NMTBL*)car(t))->ty==type) + return (NMTBL*)car(t); + t=cadr(t); + } + return 0; +} + void type_print(int type,NMTBL *n,FILE *out) { int t; tree_node_type *tn; - if (type<0) { + NMTBL *td; + + if(typedefed && (td=typedef_search(type))) { + fprintf(out,"%s ",td->nm); + } else if (type<0) { t=type; if (!(tn=find_node(t))) { error(-1); return; } fprintf(out,"%s ",tn->tree_name); @@ -306,7 +322,10 @@ return; } else if(t==ARRAY) { type_print(cadr(type),n,out); - fprintf(out,"[%d]",caddr(type)); + if (caddr(type)) + fprintf(out,"[%d]",caddr(type)); + else + fprintf(out,"[]"); return; } else if(t==POINTER) { t=cadr(type);