[project @ 2006-01-09 14:38:01 by simonmar]
[ghc-hetmet.git] / ghc / utils / prof / cgprof / daVinci.c
index fc30b6b..0a59d1c 100644 (file)
@@ -1,5 +1,5 @@
 /* ------------------------------------------------------------------------
- * $Id: daVinci.c,v 1.2 2003/08/01 14:50:50 panne Exp $
+ * $Id: daVinci.c,v 1.5 2006/01/09 14:38:01 simonmar Exp $
  *                                                                     
  *     Copyright (C) 1995-2000 University of Oxford
  *                                                                     
@@ -20,6 +20,7 @@
 #include "daVinci.h"
 #include <stdarg.h>
 #include <string.h>
+#include <ctype.h>
 
 static char* extra_space(int);
 static void recur_graphToDaVinci(int,Matrix *, Matrix *,char*,int);
@@ -40,7 +41,6 @@ char *lastDavinciCmd;
  * -------------------------------------------------------------------------- */
 
 void cmdDaVinci(char* format,...) {
-  static char xs[MAX_PROFILE_LINE_LENGTH];
   va_list args;
 
   va_start(args, format);
@@ -254,7 +254,7 @@ static char *printCompressNode(int node, object_cost *ptr) {
   static char res[(MAX_FUNNAME+20)*4];
   char tempstring[MAX_FUNNAME+20];
   char *padding;
-  int width=0,x;
+  int x;
   char delimiter[] = "&";
 
   if (symbol_table[node].type==CG_SSTEP) 
@@ -293,7 +293,6 @@ static char *printUncompressNode(int node, object_cost *ptr) {
   char name   [MAX_FUNNAME+40];
   char module [MAX_FUNNAME+40];
   char group  [MAX_FUNNAME+40];
-  char syncs[MAX_FUNNAME+40];
   char head [MAX_FUNNAME+40];
   char comp [MAX_FUNNAME+40];
   char comm [MAX_FUNNAME+40];
@@ -326,7 +325,6 @@ static char *printUncompressNode(int node, object_cost *ptr) {
     sprintf(group,"%s",tempstring3+1);
   }
 
-  sprintf(syncs,"");
   if (NodeviewTime) {
 
     sprintf(head, "Metric   Total  \\n");
@@ -358,9 +356,6 @@ static char *printUncompressNode(int node, object_cost *ptr) {
   strcat(res,group);
   strcat(res,"\\n\\n");
  
-  /* padding = extra_space((width-strlen(syncs)+3)/2); */
-  //strcat(res,padding);
-  strcat(res,syncs);
   strcat(res,head);
   strcat(res,comp);
   strcat(res,comm);
@@ -462,8 +457,8 @@ int percentToColour(double colour) {
 
 static void recur_graphToDaVinci(int node,Matrix *graph,Matrix *costs,char* p_zeronodes, int mode){
   object_cost *ptr;
-  int i,j,no_children=0,*children,colour,small;
-  char line[MAX_FUNNAME], *node_str;
+  int i,j,no_children=0,*children=NULL,colour;
+  char *node_str;
   char tempnode[MAX_FUNNAME];
   if (Mat(int,*graph,node,node)<0) {
     printf("r(\"%d\") ",node);
@@ -533,8 +528,8 @@ static void recur_graphToDaVinci(int node,Matrix *graph,Matrix *costs,char* p_ze
 
 static void recur_graphToDaVinci_old(int node,Matrix *graph, Matrix *costs) {
   object_cost *ptr;
-  int i,j,no_children=0,*children,colour,small;
-  char line[MAX_FUNNAME], *node_str;
+  int i,j,no_children=0,*children=NULL,colour;
+  char *node_str;
   if (Mat(int,*graph,node,node)<0) {
     fprintf(logFile,"r(\"%d\") ",node);
     printf("r(\"%d\") ",node);
@@ -609,7 +604,6 @@ static void recur_graphToDaVinci_old(int node,Matrix *graph, Matrix *costs) {
 
 void updateColours(int root, Matrix *graph, Matrix *costs) {
   int i,colour,last;
-  object_cost *ptr;
 
   printf("graph(change_attr([");
   for(last=costs->rows-1;last>=0;last--)
@@ -633,10 +627,11 @@ void updateColours(int root, Matrix *graph, Matrix *costs) {
 davinciCmd parseDaVinciCmd(char *input) {
   davinciCmd result;
   char *crp;
-  char *word,*label;
+  char *word;
   int i;
   
   result.size=1;
+  result.list=NULL;
   for(crp=input;*crp;crp++)
     if (*crp==',') result.size++;