some small dumptree enhancements
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 1 Nov 2001 15:23:52 +0000 (15:23 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 1 Nov 2001 15:23:52 +0000 (15:23 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1482 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c
src/SDCCsymt.c

index 41eb8313f58c4ac09e6492e85db1af8a8b15d579..0277d7ff20e9b64e0546af0a0dacefff012123f8 100644 (file)
@@ -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);
 }
index a2efff79d67dbb357fb085eb65a36944c27b38ab..cf62005782bb4e24cf566409bc3f815367c1fcfa 100644 (file)
@@ -1912,7 +1912,7 @@ printTypeChain (sym_link * start, FILE * of)
     }
 
   if (start==NULL) {
-    fprintf (of, "**err**");
+    fprintf (of, "void");
     return;
   }