From: johanknol Date: Thu, 1 Nov 2001 15:23:52 +0000 (+0000) Subject: some small dumptree enhancements X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0a2ebf328e32106b38b6b64ae5411425eb8f6737;p=fw%2Fsdcc some small dumptree enhancements git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1482 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCast.c b/src/SDCCast.c index 41eb8313..0277d7ff 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -4265,27 +4265,40 @@ void ast_print (ast * tree, FILE *outfile, int indent) } if (tree->opval.op == FUNCTION) { - fprintf(outfile,"FUNCTION (%p) type (",tree); + int arg=0; + value *args=FUNC_ARGS(tree->left->opval.val->type); + fprintf(outfile,"FUNCTION (%s=%p) type (", + tree->left->opval.val->name, tree); printTypeChain (tree->ftype,outfile); + fprintf(outfile,") args ("); + do { + if (arg) { + fprintf (outfile, ", "); + } + printTypeChain (args->type, outfile); + arg++; + args=args->next; + } while (args); fprintf(outfile,")\n"); - ast_print(tree->left,outfile,indent+4); - ast_print(tree->right,outfile,indent+4); + ast_print(tree->left,outfile,indent); + ast_print(tree->right,outfile,indent); return ; } if (tree->opval.op == BLOCK) { symbol *decls = tree->values.sym; - INDENT(indent+4,outfile); + INDENT(indent,outfile); fprintf(outfile,"{\n"); while (decls) { INDENT(indent+4,outfile); - fprintf(outfile,"DECLARE SYMBOL %s, type(",decls->name); + fprintf(outfile,"DECLARE SYMBOL (%s=%p) type (", + decls->name, decls); printTypeChain(decls->type,outfile); fprintf(outfile,")\n"); decls = decls->next; } ast_print(tree->right,outfile,indent+4); - INDENT(indent+4,outfile); + INDENT(indent,outfile); fprintf(outfile,"}\n"); return; } @@ -4318,7 +4331,8 @@ void ast_print (ast * tree, FILE *outfile, int indent) } else { fprintf(outfile,"SYMBOL "); } - fprintf(outfile,"(%p) name= %s ",tree,tree->opval.val->sym->name); + fprintf(outfile,"(%s=%p)", + tree->opval.val->sym->name,tree); } if (tree->ftype) { fprintf(outfile," type ("); @@ -4591,7 +4605,9 @@ void ast_print (ast * tree, FILE *outfile, int indent) /* casting */ /*----------------------------*/ case CAST: /* change the type */ - fprintf(outfile,"CAST (%p) type (",tree); + fprintf(outfile,"CAST (%p) from type (",tree); + printTypeChain(tree->right->ftype,outfile); + fprintf(outfile,") to type ("); printTypeChain(tree->ftype,outfile); fprintf(outfile,")\n"); ast_print(tree->right,outfile,indent+4); @@ -4888,5 +4904,5 @@ void ast_print (ast * tree, FILE *outfile, int indent) void PA(ast *t) { - ast_print(t,stdout,1); + ast_print(t,stdout,0); } diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index a2efff79..cf620057 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -1912,7 +1912,7 @@ printTypeChain (sym_link * start, FILE * of) } if (start==NULL) { - fprintf (of, "**err**"); + fprintf (of, "void"); return; }