Index: trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- trunk/psLib/src/sysUtils/psTrace.c	(revision 1718)
+++ trunk/psLib/src/sysUtils/psTrace.c	(revision 1731)
@@ -9,6 +9,6 @@
  *  @author George Gusciora, MHPCC
  *
- *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-09-08 05:59:41 $
+ *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-09-08 21:22:47 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -48,5 +48,7 @@
 #include "psString.h"
 #include "psError.h"
-#include "psAbort.h"
+#include "psLogMsg.h"
+
+#include "psSysUtilsErrors.h"
 
 static p_psComponent* cRoot = NULL; // The root of the trace component
@@ -117,6 +119,7 @@
     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);
+            psLogMsg(PS_ERRORNAME_DOMAIN "p_psTraceReset", PS_LOG_WARN,
+                     PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
+                     i, currentNode->name);
         } else {
             p_psTraceReset(currentNode->subcomp[i]);
@@ -141,5 +144,5 @@
 to ANSI-C.
  *****************************************************************************/
-static void componentAdd(const char *addNodeName, int level)
+static bool componentAdd(const char *addNodeName, int level)
 {
     int i = 0;                  // Loop index variable.
@@ -152,5 +155,7 @@
     // XXX: Verify that this is the correct behavior.
     if (strcmp("", addNodeName) == 0) {
-        psAbort(__func__, "Failed to add null component to trace tree.\n");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "componentAdd",PS_ERR_BAD_PARAMETER_NULL,true,
+                   PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT);
+        return false;
     }
 
@@ -158,10 +163,12 @@
     if (strcmp(".", addNodeName) == 0) {
         cRoot->level = level;
-        return;
+        return true;
     }
 
     if (addNodeName[0] != '.') {
-        printf("ERROR: failed to add %s to the root component tree.\n", addNodeName);
-        exit(1);
+        psErrorMsg(PS_ERRORNAME_DOMAIN "componentAdd",PS_ERR_BAD_PARAMETER_VALUE,true,
+                   PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME,
+                   addNodeName);
+        return false;
     }
 
@@ -205,4 +212,6 @@
         }
     }
+
+    return true;
 }
 
@@ -218,6 +227,6 @@
  zero
 *****************************************************************************/
-int psTraceSetLevel(const char *comp,   // component of interest
-                    int level)  // desired trace level
+bool psTraceSetLevel(const char *comp,   // component of interest
+                     int level)  // desired trace level
 {
     // If the root component tree does not exist, then initialize it.
@@ -226,8 +235,10 @@
     }
     // Add the new component to the component tree.
-    componentAdd(comp, level);
-
-    // return 0 on success.
-    return 0;
+    if ( !componentAdd(comp, level) ) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psTraceSetLevel", PS_ERR_UNKNOWN, false,
+                   PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT,level,comp);
+        return false;
+    }
+    return true;
 }
 
@@ -274,6 +285,7 @@
         for (i = 0; i < currentNode->n; i++) {
             if (NULL == currentNode->subcomp[i]) {
-                psError(__func__,
-                        "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
+                psLogMsg(PS_ERRORNAME_DOMAIN "p_psTraceReset", PS_LOG_WARN,
+                         PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
+                         i, currentNode->name);
             }
 
@@ -321,37 +333,4 @@
 
 /*****************************************************************************
-    doPrintTraceLevelsOld()
- This function recursively searches the component tree supplied by the
- parameter "comp" and prints the name and level of each component.
-    Inputs:
- comp: a node in the component tree.
- level: the level of that node
-    Outputs:
- none
-    Returns:
- null
- *****************************************************************************/
-static void doPrintTraceLevelsOld(const p_psComponent* comp, int depth)
-{
-    int i = 0;
-
-    if (comp->name[0] == '\0') {
-        printf("%*s%-*s %d\n", depth, "", 20 - depth,
-               "(root)", (comp->level == PS_DEFAULT_TRACE_LEVEL) ? 0 : comp->level);
-    } else {
-        if (comp->level == PS_DEFAULT_TRACE_LEVEL) {
-            printf("%*s%-*s %s\n", depth, "", 20 - depth, comp->name, ".");
-        } else {
-            printf("%*s%-*s %d\n", depth, "", 20 - depth, comp->name,
-                   comp->level);
-        }
-    }
-
-    for (i = 0; i < comp->n; i++) {
-        doPrintTraceLevelsOld(comp->subcomp[i], depth + 1);
-    }
-}
-
-/*****************************************************************************
     doPrintTraceLevels()
  This function recursively searches the component tree supplied by the
@@ -372,5 +351,5 @@
 
     if (comp->name[0] == '\0') {
-        psAbort(__func__, "component name is NULL\n");
+        return;
     } else {
         if (comp->level == PS_DEFAULT_TRACE_LEVEL) {
@@ -435,5 +414,8 @@
 
     if (NULL == comp) {
-        psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psTrace", PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psTrace_NULL_TRACETREE,
+                   __func__);
+        return;
     }
     // Only display this message if it's trace level is less than the level
