Index: trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- trunk/psLib/src/sysUtils/psTrace.c	(revision 1406)
+++ trunk/psLib/src/sysUtils/psTrace.c	(revision 1407)
@@ -1,2 +1,3 @@
+
 /** @file psTrace.c
  *  \brief basic run-time trace facilities
@@ -9,9 +10,10 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-06 22:34:05 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-07 00:06:06 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  */
+
 /*****************************************************************************
     NOTES:
@@ -34,27 +36,27 @@
 #ifndef PS_NO_TRACE
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include "psMemory.h"
-#include "psTrace.h"
-#include "psString.h"
-#include "psError.h"
-
-static p_psComponent *p_psCroot = NULL;       // The root of the trace component
-static FILE *p_psTraceFP = NULL;          // File destination for messages.
-
-static void componentFree(p_psComponent *comp);
-static p_psComponent *componentAlloc(const char *name,int level);
+#    include <stdlib.h>
+#    include <stdio.h>
+#    include <string.h>
+#    include <stdarg.h>
+#    include "psMemory.h"
+#    include "psTrace.h"
+#    include "psString.h"
+#    include "psError.h"
+
+static p_psComponent *p_psCroot = NULL; // The root of the trace component
+static FILE *p_psTraceFP = NULL;        // File destination for messages.
+
+static void componentFree(p_psComponent * comp);
+static p_psComponent *componentAlloc(const char *name, int level);
 
 /*****************************************************************************
 componentAlloc(): allocate memory for a new node, and initialize members.
  *****************************************************************************/
-static p_psComponent *componentAlloc(const char *name,
-                                     int level)
+static p_psComponent *componentAlloc(const char *name, int level)
 {
     p_psComponent *comp = psAlloc(sizeof(p_psComponent));
-    p_psMemSetDeallocator(comp,(psFreeFcn)componentFree);
+
+    p_psMemSetDeallocator(comp, (psFreeFcn) componentFree);
     comp->name = psStringCopy(name);
     comp->level = level;
@@ -64,10 +66,9 @@
 }
 
-
 /*****************************************************************************
 componentFree(): free the current node in the root tree, and all children
 nodes as well.
  *****************************************************************************/
-static void componentFree(p_psComponent *comp)
+static void componentFree(p_psComponent * comp)
 {
     if (comp == NULL) {
@@ -85,5 +86,4 @@
 }
 
-
 /*****************************************************************************
 initTrace(): simply initialize the component root tree.
@@ -96,9 +96,8 @@
 }
 
-
 /*****************************************************************************
 Set all trace levels to zero.
  *****************************************************************************/
-void p_psTraceReset(p_psComponent *currentNode)
+void p_psTraceReset(p_psComponent * currentNode)
 {
     int i = 0;
@@ -109,9 +108,8 @@
 
     currentNode->level = 0;
-    for (i=0;i<currentNode->n;i++) {
+    for (i = 0; i < currentNode->n; i++) {
         if (NULL == currentNode->subcomp[i]) {
             psError(__func__,
-                    "Sub-component %d of node %s in the trace tree is NULL.\n",
-                    i, currentNode->name);
+                    "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name);
         } else {
             p_psTraceReset(currentNode->subcomp[i]);
@@ -129,5 +127,4 @@
 }
 
-
 /*****************************************************************************
 Free all nodes in the component tree.
@@ -137,5 +134,4 @@
     psFree(p_psCroot);
 }
-
 
 /*****************************************************************************
@@ -145,15 +141,14 @@
 to ANSI-C.
  *****************************************************************************/
-static void componentAdd(const char *addNodeName,
-                         int         level)
-{
-    int        i = 0;                         // Loop index variable.
-    char       name[strlen(addNodeName) + 1]; // buffer for writeable copy.
-    char      *pname=name;
-    char      *firstComponent = NULL;       // first component of name
+static void componentAdd(const char *addNodeName, int level)
+{
+    int i = 0;                  // Loop index variable.
+    char name[strlen(addNodeName) + 1]; // buffer for writeable copy.
+    char *pname = name;
+    char *firstComponent = NULL;        // first component of name
     p_psComponent *currentNode = p_psCroot;
-    int        nodeExists = 0;
-
-    // Is this the root node?  If so, simply set level and return.
+    int nodeExists = 0;
+
+    // Is this the root node? If so, simply set level and return.
     if (strcmp(".", addNodeName) == 0) {
         p_psCroot->level = level;
@@ -162,6 +157,5 @@
 
     if (addNodeName[0] != '.') {
-        printf("ERROR: failed to add %s to the root component tree.\n",
-               addNodeName);
+        printf("ERROR: failed to add %s to the root component tree.\n", addNodeName);
         exit(1);
     }
@@ -188,13 +182,11 @@
         if (nodeExists == 0) {
             currentNode->subcomp = psRealloc(currentNode->subcomp,
-                                             (currentNode->n + 1) * sizeof(p_psComponent*));
-            currentNode->n = (currentNode->n)+1;
-
-            currentNode->subcomp[(currentNode->n)-1] =
-                componentAlloc(firstComponent, level);
-        }
-    }
-}
-
+                                             (currentNode->n + 1) * sizeof(p_psComponent *));
+            currentNode->n = (currentNode->n) + 1;
+
+            currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, level);
+        }
+    }
+}
 
 /*****************************************************************************
@@ -210,5 +202,5 @@
 *****************************************************************************/
 int psTraceSetLevel(const char *comp,   // component of interest
-                    int level)          // desired trace level
+                    int level)  // desired trace level
 {
     // If the root component tree does not exist, then initialize it.
@@ -216,5 +208,4 @@
         initTrace();
     }
-
     // Add the new component to the component tree.
     componentAdd(comp, level);
@@ -223,5 +214,4 @@
     return 0;
 }
-
 
 /*****************************************************************************
@@ -241,20 +231,20 @@
 static int doGetTraceLevel(const char *aname)
 {
-    char       name[strlen(aname) + 1]; // need a writeable copy: for strsep()
-    char      *pname=name;
-    char      *firstComponent = NULL;   // first component of name
+    char name[strlen(aname) + 1];       // need a writeable copy: for strsep()
+    char *pname = name;
+    char *firstComponent = NULL;        // first component of name
     p_psComponent *currentNode = p_psCroot;
-    int        i = 0;
+    int i = 0;
 
     if (NULL == currentNode) {
-        return(PS_UNKNOWN_TRACE_LEVEL);
+        return (PS_UNKNOWN_TRACE_LEVEL);
     }
 
     if (strcmp(".", aname) == 0) {
-        return(p_psCroot->level);
+        return (p_psCroot->level);
     }
 
     if (aname[0] != '.') {
-        return(PS_UNKNOWN_TRACE_LEVEL);
+        return (PS_UNKNOWN_TRACE_LEVEL);
     }
 
@@ -266,6 +256,5 @@
             if (NULL == currentNode->subcomp[i]) {
                 psError(__func__,
-                        "Sub-component %d of node %s in trace tree is NULL.\n",
-                        i, currentNode->name);
+                        "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
             }
 
@@ -273,12 +262,11 @@
                 currentNode = currentNode->subcomp[i];
                 if (pname == NULL) {
-                    return(currentNode->level);
+                    return (currentNode->level);
                 }
             }
         }
     }
-    return(PS_UNKNOWN_TRACE_LEVEL);
-}
-
+    return (PS_UNKNOWN_TRACE_LEVEL);
+}
 
 /*****************************************************************************
@@ -297,11 +285,9 @@
 {
     if (p_psCroot == NULL) {
-        return(PS_UNKNOWN_TRACE_LEVEL);
-    }
-
+        return (PS_UNKNOWN_TRACE_LEVEL);
+    }
     // Search the component root tree, determine the trace level.
-    return(doGetTraceLevel(name));
-}
-
+    return (doGetTraceLevel(name));
+}
 
 /*****************************************************************************
@@ -317,6 +303,5 @@
  null
  *****************************************************************************/
-static void doPrintTraceLevels(const p_psComponent *comp,
-                               int depth)
+static void doPrintTraceLevels(const p_psComponent * comp, int depth)
 {
     int i = 0;
@@ -327,17 +312,14 @@
     } else {
         if (comp->level == PS_UNKNOWN_TRACE_LEVEL) {
-            printf("%*s%-*s %s\n", depth, "", 20 - depth,
-                   comp->name, ".");
+            printf("%*s%-*s %s\n", depth, "", 20 - depth, comp->name, ".");
         } else {
-            printf("%*s%-*s %d\n", depth, "", 20 - depth,
-                   comp->name, comp->level);
+            printf("%*s%-*s %d\n", depth, "", 20 - depth, comp->name, comp->level);
         }
     }
 
     for (i = 0; i < comp->n; i++) {
-        doPrintTraceLevels(comp->subcomp[i], depth+1);
-    }
-}
-
+        doPrintTraceLevels(comp->subcomp[i], depth + 1);
+    }
+}
 
 /*****************************************************************************
@@ -359,5 +341,4 @@
     doPrintTraceLevels(p_psCroot, 0);
 }
-
 
 /*****************************************************************************
@@ -376,6 +357,6 @@
  *****************************************************************************/
 void p_psTrace(const char *comp,        // component being traced
-               int level,               // desired trace level
-               ...)                     // arguments
+               int level,       // desired trace level
+               ...)             // arguments
 {
     char *fmt = NULL;
@@ -384,8 +365,6 @@
 
     if (NULL == comp) {
-        psError(__func__,
-                "p_psTrace() called on a NULL trace level tree\n");
-    }
-
+        psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
+    }
     // Only display this message if it's trace level is less than the level
     // of it's associatedcomponent.
@@ -413,9 +392,8 @@
         va_end(ap);
     }
-
-    // NOTE: should we free *fmt as well?  Read the man page.
-}
-
-void psTraceSetDestination(FILE *fp)
+    // NOTE: should we free *fmt as well? Read the man page.
+}
+
+void psTraceSetDestination(FILE * fp)
 {
     p_psTraceFP = fp;
