Index: /trunk/psLib/src/sys/psTrace.c
===================================================================
--- /trunk/psLib/src/sys/psTrace.c	(revision 1639)
+++ /trunk/psLib/src/sys/psTrace.c	(revision 1640)
@@ -1,3 +1,2 @@
-
 /** @file psTrace.c
  *  \brief basic run-time trace facilities
@@ -10,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-09 23:40:55 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-27 21:45:01 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -44,7 +43,8 @@
 #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.
+#include "psAbort.h"
+
+static p_psComponent* cRoot = NULL; // The root of the trace component
+static FILE *traceFP = NULL;        // File destination for messages.
 
 static void componentFree(p_psComponent* comp);
@@ -91,6 +91,6 @@
 static void initTrace(void)
 {
-    if (p_psCroot == NULL) {
-        p_psCroot = componentAlloc(".", PS_DEFAULT_TRACE_LEVEL);
+    if (cRoot == NULL) {
+        cRoot = componentAlloc(".", PS_DEFAULT_TRACE_LEVEL);
     }
 }
@@ -124,5 +124,6 @@
 void psTraceReset()
 {
-    p_psTraceReset(p_psCroot);
+    componentFree(cRoot);
+    cRoot = NULL;
 }
 
@@ -132,5 +133,5 @@
 void psTraceFree()
 {
-    psFree(p_psCroot);
+    psTraceReset();
 }
 
@@ -147,10 +148,15 @@
     char *pname = name;
     char *firstComponent = NULL;        // first component of name
-    p_psComponent* currentNode = p_psCroot;
+    p_psComponent* currentNode = cRoot;
     int nodeExists = 0;
+
+    // XXX: Verify that this is the correct behavior.
+    if (strcmp("", addNodeName) == 0) {
+        psAbort(__func__, "Failed to add null component to trace tree.\n");
+    }
 
     // Is this the root node? If so, simply set level and return.
     if (strcmp(".", addNodeName) == 0) {
-        p_psCroot->level = level;
+        cRoot->level = level;
         return;
     }
@@ -185,5 +191,10 @@
             currentNode->n = (currentNode->n) + 1;
 
-            currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, level);
+            if (pname == NULL) {
+                currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, level);
+            } else {
+                currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, currentNode->level);
+            }
+            currentNode = currentNode->subcomp[(currentNode->n) - 1];
         }
     }
@@ -205,5 +216,5 @@
 {
     // If the root component tree does not exist, then initialize it.
-    if (p_psCroot == NULL) {
+    if (cRoot == NULL) {
         initTrace();
     }
@@ -234,5 +245,5 @@
     char *pname = name;
     char *firstComponent = NULL;        // first component of name
-    p_psComponent* currentNode = p_psCroot;
+    p_psComponent* currentNode = cRoot;
     int i = 0;
 
@@ -242,5 +253,5 @@
 
     if (strcmp(".", aname) == 0) {
-        return (p_psCroot->level);
+        return (cRoot->level);
     }
 
@@ -284,5 +295,5 @@
 int psTraceGetLevel(const char *name)
 {
-    if (p_psCroot == NULL) {
+    if (cRoot == NULL) {
         return (PS_UNKNOWN_TRACE_LEVEL);
     }
@@ -335,9 +346,9 @@
 void psTracePrintLevels(void)
 {
-    if (p_psCroot == NULL) {
+    if (cRoot == NULL) {
         return;
     }
 
-    doPrintTraceLevels(p_psCroot, 0);
+    doPrintTraceLevels(cRoot, 0);
 }
 
@@ -377,10 +388,10 @@
         fmt = va_arg(ap, char *);
 
-        if (p_psTraceFP != NULL) {
+        if (traceFP != NULL) {
             // We indent each message one space for each level of the message.
             for (i = 0; i < level; i++) {
-                fprintf(p_psTraceFP, " ");
-            }
-            vfprintf(p_psTraceFP, fmt, ap);
+                fprintf(traceFP, " ");
+            }
+            vfprintf(traceFP, fmt, ap);
         } else {
             // We indent each message one space for each level of the message.
@@ -397,5 +408,5 @@
 void psTraceSetDestination(FILE * fp)
 {
-    p_psTraceFP = fp;
+    traceFP = fp;
 }
 
Index: /trunk/psLib/src/sys/psTrace.h
===================================================================
--- /trunk/psLib/src/sys/psTrace.h	(revision 1639)
+++ /trunk/psLib/src/sys/psTrace.h	(revision 1640)
@@ -10,6 +10,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-09 23:40:55 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-27 21:45:01 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Index: /trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- /trunk/psLib/src/sysUtils/psTrace.c	(revision 1639)
+++ /trunk/psLib/src/sysUtils/psTrace.c	(revision 1640)
@@ -1,3 +1,2 @@
-
 /** @file psTrace.c
  *  \brief basic run-time trace facilities
@@ -10,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-08-09 23:40:55 $
+ *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-08-27 21:45:01 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -44,7 +43,8 @@
 #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.
+#include "psAbort.h"
+
+static p_psComponent* cRoot = NULL; // The root of the trace component
+static FILE *traceFP = NULL;        // File destination for messages.
 
 static void componentFree(p_psComponent* comp);
@@ -91,6 +91,6 @@
 static void initTrace(void)
 {
-    if (p_psCroot == NULL) {
-        p_psCroot = componentAlloc(".", PS_DEFAULT_TRACE_LEVEL);
+    if (cRoot == NULL) {
+        cRoot = componentAlloc(".", PS_DEFAULT_TRACE_LEVEL);
     }
 }
@@ -124,5 +124,6 @@
 void psTraceReset()
 {
-    p_psTraceReset(p_psCroot);
+    componentFree(cRoot);
+    cRoot = NULL;
 }
 
@@ -132,5 +133,5 @@
 void psTraceFree()
 {
-    psFree(p_psCroot);
+    psTraceReset();
 }
 
@@ -147,10 +148,15 @@
     char *pname = name;
     char *firstComponent = NULL;        // first component of name
-    p_psComponent* currentNode = p_psCroot;
+    p_psComponent* currentNode = cRoot;
     int nodeExists = 0;
+
+    // XXX: Verify that this is the correct behavior.
+    if (strcmp("", addNodeName) == 0) {
+        psAbort(__func__, "Failed to add null component to trace tree.\n");
+    }
 
     // Is this the root node? If so, simply set level and return.
     if (strcmp(".", addNodeName) == 0) {
-        p_psCroot->level = level;
+        cRoot->level = level;
         return;
     }
@@ -185,5 +191,10 @@
             currentNode->n = (currentNode->n) + 1;
 
-            currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, level);
+            if (pname == NULL) {
+                currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, level);
+            } else {
+                currentNode->subcomp[(currentNode->n) - 1] = componentAlloc(firstComponent, currentNode->level);
+            }
+            currentNode = currentNode->subcomp[(currentNode->n) - 1];
         }
     }
@@ -205,5 +216,5 @@
 {
     // If the root component tree does not exist, then initialize it.
-    if (p_psCroot == NULL) {
+    if (cRoot == NULL) {
         initTrace();
     }
@@ -234,5 +245,5 @@
     char *pname = name;
     char *firstComponent = NULL;        // first component of name
-    p_psComponent* currentNode = p_psCroot;
+    p_psComponent* currentNode = cRoot;
     int i = 0;
 
@@ -242,5 +253,5 @@
 
     if (strcmp(".", aname) == 0) {
-        return (p_psCroot->level);
+        return (cRoot->level);
     }
 
@@ -284,5 +295,5 @@
 int psTraceGetLevel(const char *name)
 {
-    if (p_psCroot == NULL) {
+    if (cRoot == NULL) {
         return (PS_UNKNOWN_TRACE_LEVEL);
     }
@@ -335,9 +346,9 @@
 void psTracePrintLevels(void)
 {
-    if (p_psCroot == NULL) {
+    if (cRoot == NULL) {
         return;
     }
 
-    doPrintTraceLevels(p_psCroot, 0);
+    doPrintTraceLevels(cRoot, 0);
 }
 
@@ -377,10 +388,10 @@
         fmt = va_arg(ap, char *);
 
-        if (p_psTraceFP != NULL) {
+        if (traceFP != NULL) {
             // We indent each message one space for each level of the message.
             for (i = 0; i < level; i++) {
-                fprintf(p_psTraceFP, " ");
-            }
-            vfprintf(p_psTraceFP, fmt, ap);
+                fprintf(traceFP, " ");
+            }
+            vfprintf(traceFP, fmt, ap);
         } else {
             // We indent each message one space for each level of the message.
@@ -397,5 +408,5 @@
 void psTraceSetDestination(FILE * fp)
 {
-    p_psTraceFP = fp;
+    traceFP = fp;
 }
 
Index: /trunk/psLib/test/sysUtils/tst_psTrace03.c
===================================================================
--- /trunk/psLib/test/sysUtils/tst_psTrace03.c	(revision 1639)
+++ /trunk/psLib/test/sysUtils/tst_psTrace03.c	(revision 1640)
@@ -9,11 +9,4 @@
 int main()
 {
-    (void)psTraceSetLevel(".A.B.C.D.E", 2);
-    psTracePrintLevels();
-    (void)psTraceSetLevel(".A.B", 5);
-    psTracePrintLevels();
-    psTraceReset();
-
-
     printPositiveTestHeader(stdout,
                             "psTrace functions",
Index: /trunk/psLib/test/sysUtils/tst_psTrace04.c
===================================================================
--- /trunk/psLib/test/sysUtils/tst_psTrace04.c	(revision 1639)
+++ /trunk/psLib/test/sysUtils/tst_psTrace04.c	(revision 1640)
@@ -29,15 +29,15 @@
     psTraceReset();
 
-    if (psTraceGetLevel(".") ||
-            psTraceGetLevel(".a") ||
-            psTraceGetLevel(".b") ||
-            psTraceGetLevel(".c") ||
-            psTraceGetLevel(".a.a") ||
-            psTraceGetLevel(".a.b") ||
-            psTraceGetLevel(".b.a") ||
-            psTraceGetLevel(".b.b") ||
-            psTraceGetLevel(".c.a") ||
-            psTraceGetLevel(".c.b") ||
-            psTraceGetLevel(".c.c")) {
+    if ((psTraceGetLevel(".")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".a")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".b")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".c")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".a.a")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".a.b")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".b.a")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".b.b")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".c.a")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".c.b")!=PS_DEFAULT_TRACE_LEVEL) ||
+            (psTraceGetLevel(".c.c")!=PS_DEFAULT_TRACE_LEVEL)) {
         printFooter(stdout,
                     "psTrace functions",
