IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1713


Ignore:
Timestamp:
Sep 7, 2004, 2:09:06 PM (22 years ago)
Author:
desonia
Message:

converted files to new psError style (psErrorMsg). Removed any psAborts
from non-memory allocation code.

Location:
trunk/psLib/src
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psErrorCodes.c

    r1696 r1713  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-07 19:05:07 $
     9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-08 00:09:06 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434            {PS_ERR_UNKNOWN,"unknown error"},
    3535            {PS_ERR_IO,"I/O error"},
     36            {PS_ERR_LOCATION_INVALID,"specified location is unknown"},
    3637            {PS_ERR_MEMORY_CORRUPTION,"memory corruption detected"},
    3738            {PS_ERR_MEMORY_DEREF_USAGE,"dereferenced memory still used"},
    38             {PS_ERR_LOCATION_INVALID,"specified location is unknown"},
    39             {PS_ERR_BAD_VALUE,"value is out-of-range"},
    40             {PS_ERR_BAD_LENGTH,"string value is too lon"},
     39            {PS_ERR_BAD_PARAMETER_VALUE,"parameter is out-of-range"},
     40            {PS_ERR_BAD_PARAMETER_NULL,"parameter is null"},
     41            {PS_ERR_BAD_PARAMETER_LENGTH,"parameter string is too long"},
     42            {PS_ERR_UNEXPECTED_NULL,"unexpected NULL foun"},
    4143            //~End
    4244            {PS_ERR_N_ERR_CLASSES,"error classes end marker"}
  • trunk/psLib/src/sys/psErrorCodes.h

    r1696 r1713  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-07 19:05:07 $
     9 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-08 00:09:06 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4343    PS_ERR_UNKNOWN,   ///< unknown error
    4444    PS_ERR_IO,   ///< I/O error
     45    PS_ERR_LOCATION_INVALID,   ///< specified location is unknown
    4546    PS_ERR_MEMORY_CORRUPTION,   ///< memory corruption detected
    4647    PS_ERR_MEMORY_DEREF_USAGE,   ///< dereferenced memory still used
    47     PS_ERR_LOCATION_INVALID,   ///< specified location is unknown
    48     PS_ERR_BAD_VALUE,   ///< value is out-of-range
    49     PS_ERR_BAD_LENGTH,   ///< string value is too lon
     48    PS_ERR_BAD_PARAMETER_VALUE,   ///< parameter is out-of-range
     49    PS_ERR_BAD_PARAMETER_NULL,   ///< parameter is null
     50    PS_ERR_BAD_PARAMETER_LENGTH,   ///< parameter string is too long
     51    PS_ERR_UNEXPECTED_NULL,   ///< unexpected NULL foun
    5052    //~End
    5153    PS_ERR_N_ERR_CLASSES               ///< end marker - should not be used as a true error
  • trunk/psLib/src/sys/psLogMsg.c

    r1696 r1713  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-07 19:05:07 $
     14 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-09-08 00:09:06 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    218218            break;
    219219        default:
    220             psErrorMsg(ERRORNAME_PREFIX "psLogSetFormat", true, PS_ERR_BAD_VALUE,
     220            psErrorMsg(ERRORNAME_PREFIX "psLogSetFormat", true, PS_ERR_BAD_PARAMETER_VALUE,
    221221                       PS_ERRORTEXT_psLogSetFormat_UNKNOWN_KEY, *ptr);
    222222            break;
  • trunk/psLib/src/sys/psString.c

    r1407 r1713  
    99 *  @author Eric Van Alst, MHPCC
    1010 *   
    11  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-07 00:06:06 $
     11 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-08 00:09:06 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1515 */
    1616
    17 /******************************************************************************/
    18 
    19 /*  INCLUDE FILES                                                             */
    20 
    21 /******************************************************************************/
    2217#include <stdlib.h>
    2318#include <string.h>
     
    2621#include "psError.h"
    2722
    28 /******************************************************************************/
    29 
    30 /*  DEFINE STATEMENTS                                                         */
    31 
    32 /******************************************************************************/
    33 
    34 // None
    35 
    36 /******************************************************************************/
    37 
    38 /*  TYPE DEFINITIONS                                                          */
    39 
    40 /******************************************************************************/
    41 
    42 // None
    43 
    44 /*****************************************************************************/
    45 
    46 /*  GLOBAL VARIABLES                                                         */
    47 
    48 /*****************************************************************************/
    49 
    50 // None
    51 
    52 /*****************************************************************************/
    53 
    54 /*  FILE STATIC VARIABLES                                                    */
    55 
    56 /*****************************************************************************/
    57 
    58 // None
    59 
    60 /*****************************************************************************/
    61 
    62 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    63 
    64 /*****************************************************************************/
    65 
    66 // None
    67 
    68 /*****************************************************************************/
    69 
    70 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    71 
    72 /*****************************************************************************/
     23#include "psSysUtilsErrors.h"
     24#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psString."
    7325
    7426char *psStringCopy(const char *str)
     
    8739    if (nChar < 0) {
    8840        // Log error message and return NULL
    89         psError(__FILE__, "psStringNCopy with negative count specified %d", nChar);
     41        psErrorMsg(ERRORNAME_PREFIX "psStringNCopy", PS_ERR_BAD_PARAMETER_VALUE, true,
     42                   PS_ERRORTEXT_psStringNCopy_NCHAR_NEGATIVE,
     43                   nChar);
    9044        return NULL;
    9145    }
  • trunk/psLib/src/sys/psTrace.c

    r1700 r1713  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-07 19:58:06 $
     11 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-08 00:09:06 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040#include "psString.h"
    4141#include "psError.h"
    42 #include "psAbort.h"
     42#include "psLogMsg.h"
     43
     44#include "psSysUtilsErrors.h"
     45#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psTrace."
    4346
    4447static p_psComponent* cRoot = NULL; // The root of the trace component
     
    107110    for (i = 0; i < currentNode->n; i++) {
    108111        if (NULL == currentNode->subcomp[i]) {
    109             psError(__func__,
    110                     "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name);
     112            psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN,
     113                     PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     114                     i, currentNode->name);
    111115        } else {
    112116            p_psTraceReset(currentNode->subcomp[i]);
     
    131135to ANSI-C.
    132136 *****************************************************************************/
    133 static void componentAdd(const char *addNodeName, int level)
     137static bool componentAdd(const char *addNodeName, int level)
    134138{
    135139    int i = 0;                  // Loop index variable.
     
    142146    // XXX: Verify that this is the correct behavior.
    143147    if (strcmp("", addNodeName) == 0) {
    144         psAbort(__func__, "Failed to add null component to trace tree.\n");
     148        psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_NULL,true,
     149                   PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT);
     150        return false;
    145151    }
    146152
     
    148154    if (strcmp(".", addNodeName) == 0) {
    149155        cRoot->level = level;
    150         return;
     156        return true;
    151157    }
    152158
    153159    if (addNodeName[0] != '.') {
    154         psAbort(__func__,"Failed to add %s to the root component tree.\n",
    155                 addNodeName);
     160        psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_VALUE,true,
     161                   PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME,
     162                   addNodeName);
     163        return false;
    156164    }
    157165
     
    188196        }
    189197    }
     198
     199    return true;
    190200}
    191201
     
    201211 zero
    202212*****************************************************************************/
    203 int psTraceSetLevel(const char *comp,   // component of interest
    204                     int level)  // desired trace level
     213bool psTraceSetLevel(const char *comp,   // component of interest
     214                     int level)  // desired trace level
    205215{
    206216    // If the root component tree does not exist, then initialize it.
     
    209219    }
    210220    // Add the new component to the component tree.
    211     componentAdd(comp, level);
    212 
     221    if ( !componentAdd(comp, level) ) {
     222        psErrorMsg(ERRORNAME_PREFIX "psTraceSetLevel", PS_ERR_UNKNOWN, false,
     223                   PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT,level,comp);
     224        return false;
     225    }
    213226    // return 0 on success.
    214     return 0;
     227    return true;
    215228}
    216229
     
    255268        for (i = 0; i < currentNode->n; i++) {
    256269            if (NULL == currentNode->subcomp[i]) {
    257                 psError(__func__,
    258                         "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
     270                psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN,
     271                         PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     272                         i, currentNode->name);
    259273            }
    260274
     
    365379
    366380    if (NULL == comp) {
    367         psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
     381        psErrorMsg(ERRORNAME_PREFIX "psTrace", PS_ERR_BAD_PARAMETER_NULL, true,
     382                   PS_ERRORTEXT_psTrace_NULL_TRACETREE,
     383                   __func__);
     384        return;
    368385    }
    369386    // Only display this message if it's trace level is less than the level
  • trunk/psLib/src/sys/psTrace.h

    r1640 r1713  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-27 21:45:01 $
     12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-08 00:09:06 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6666
    6767/// Set trace level
    68 int psTraceSetLevel(const char *facil,     ///< facilty of interest
    69                     int level)     ///< desired trace level
     68bool psTraceSetLevel(const char *facil,     ///< facilty of interest
     69                     int level)     ///< desired trace level
    7070;
    7171
  • trunk/psLib/src/sysUtils/parseErrorCodes.pl

    r1696 r1713  
    3434    }
    3535    else {
    36         /^\s*(\w+)\s+(\w.*)/;
     36        /^\s*(\w+)\s+([\%\w].*)/;
    3737        my $ErrorCode        = $1;
    3838        my $ErrorDescription = $2;
  • trunk/psLib/src/sysUtils/psErrorCodes.c

    r1696 r1713  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-07 19:05:07 $
     9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-08 00:09:06 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434            {PS_ERR_UNKNOWN,"unknown error"},
    3535            {PS_ERR_IO,"I/O error"},
     36            {PS_ERR_LOCATION_INVALID,"specified location is unknown"},
    3637            {PS_ERR_MEMORY_CORRUPTION,"memory corruption detected"},
    3738            {PS_ERR_MEMORY_DEREF_USAGE,"dereferenced memory still used"},
    38             {PS_ERR_LOCATION_INVALID,"specified location is unknown"},
    39             {PS_ERR_BAD_VALUE,"value is out-of-range"},
    40             {PS_ERR_BAD_LENGTH,"string value is too lon"},
     39            {PS_ERR_BAD_PARAMETER_VALUE,"parameter is out-of-range"},
     40            {PS_ERR_BAD_PARAMETER_NULL,"parameter is null"},
     41            {PS_ERR_BAD_PARAMETER_LENGTH,"parameter string is too long"},
     42            {PS_ERR_UNEXPECTED_NULL,"unexpected NULL foun"},
    4143            //~End
    4244            {PS_ERR_N_ERR_CLASSES,"error classes end marker"}
  • trunk/psLib/src/sysUtils/psErrorCodes.dat

    r1696 r1713  
    99UNKNOWN                        unknown error
    1010IO                             I/O error
     11LOCATION_INVALID               specified location is unknown
    1112MEMORY_CORRUPTION              memory corruption detected
    1213MEMORY_DEREF_USAGE             dereferenced memory still used
    13 LOCATION_INVALID               specified location is unknown
    14 BAD_VALUE                      value is out-of-range
    15 BAD_LENGTH                     string value is too long
     14BAD_PARAMETER_VALUE            parameter is out-of-range
     15BAD_PARAMETER_NULL             parameter is null
     16BAD_PARAMETER_LENGTH           parameter string is too long
     17UNEXPECTED_NULL                unexpected NULL found
  • trunk/psLib/src/sysUtils/psErrorCodes.h

    r1696 r1713  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-07 19:05:07 $
     9 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-08 00:09:06 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4343    PS_ERR_UNKNOWN,   ///< unknown error
    4444    PS_ERR_IO,   ///< I/O error
     45    PS_ERR_LOCATION_INVALID,   ///< specified location is unknown
    4546    PS_ERR_MEMORY_CORRUPTION,   ///< memory corruption detected
    4647    PS_ERR_MEMORY_DEREF_USAGE,   ///< dereferenced memory still used
    47     PS_ERR_LOCATION_INVALID,   ///< specified location is unknown
    48     PS_ERR_BAD_VALUE,   ///< value is out-of-range
    49     PS_ERR_BAD_LENGTH,   ///< string value is too lon
     48    PS_ERR_BAD_PARAMETER_VALUE,   ///< parameter is out-of-range
     49    PS_ERR_BAD_PARAMETER_NULL,   ///< parameter is null
     50    PS_ERR_BAD_PARAMETER_LENGTH,   ///< parameter string is too long
     51    PS_ERR_UNEXPECTED_NULL,   ///< unexpected NULL foun
    5052    //~End
    5153    PS_ERR_N_ERR_CLASSES               ///< end marker - should not be used as a true error
  • trunk/psLib/src/sysUtils/psLogMsg.c

    r1696 r1713  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-07 19:05:07 $
     14 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-09-08 00:09:06 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    218218            break;
    219219        default:
    220             psErrorMsg(ERRORNAME_PREFIX "psLogSetFormat", true, PS_ERR_BAD_VALUE,
     220            psErrorMsg(ERRORNAME_PREFIX "psLogSetFormat", true, PS_ERR_BAD_PARAMETER_VALUE,
    221221                       PS_ERRORTEXT_psLogSetFormat_UNKNOWN_KEY, *ptr);
    222222            break;
  • trunk/psLib/src/sysUtils/psString.c

    r1407 r1713  
    99 *  @author Eric Van Alst, MHPCC
    1010 *   
    11  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-08-07 00:06:06 $
     11 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-08 00:09:06 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1515 */
    1616
    17 /******************************************************************************/
    18 
    19 /*  INCLUDE FILES                                                             */
    20 
    21 /******************************************************************************/
    2217#include <stdlib.h>
    2318#include <string.h>
     
    2621#include "psError.h"
    2722
    28 /******************************************************************************/
    29 
    30 /*  DEFINE STATEMENTS                                                         */
    31 
    32 /******************************************************************************/
    33 
    34 // None
    35 
    36 /******************************************************************************/
    37 
    38 /*  TYPE DEFINITIONS                                                          */
    39 
    40 /******************************************************************************/
    41 
    42 // None
    43 
    44 /*****************************************************************************/
    45 
    46 /*  GLOBAL VARIABLES                                                         */
    47 
    48 /*****************************************************************************/
    49 
    50 // None
    51 
    52 /*****************************************************************************/
    53 
    54 /*  FILE STATIC VARIABLES                                                    */
    55 
    56 /*****************************************************************************/
    57 
    58 // None
    59 
    60 /*****************************************************************************/
    61 
    62 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    63 
    64 /*****************************************************************************/
    65 
    66 // None
    67 
    68 /*****************************************************************************/
    69 
    70 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    71 
    72 /*****************************************************************************/
     23#include "psSysUtilsErrors.h"
     24#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psString."
    7325
    7426char *psStringCopy(const char *str)
     
    8739    if (nChar < 0) {
    8840        // Log error message and return NULL
    89         psError(__FILE__, "psStringNCopy with negative count specified %d", nChar);
     41        psErrorMsg(ERRORNAME_PREFIX "psStringNCopy", PS_ERR_BAD_PARAMETER_VALUE, true,
     42                   PS_ERRORTEXT_psStringNCopy_NCHAR_NEGATIVE,
     43                   nChar);
    9044        return NULL;
    9145    }
  • trunk/psLib/src/sysUtils/psSysUtilsErrors.dat

    r1696 r1713  
    2222checkMemBlock_OVERFLOW                         Memory block %ld is corrupted; buffer overflow detected.
    2323memProblemCallbackDefault_MULTIPLE_FREE        Block %ld allocated at %s:%d freed more than once at %s:%d.
     24#
     25# Error Messages from psString.c:
     26#
     27psString_NCHAR_NEGATIVE                        Can not copy a negative number of characters (%d).
     28#
     29# Error Messages from psTrace.c:
     30#
     31psTrace_NULL_SUBCOMPONENT                      Sub-component %d of node %s in trace tree is NULL.
     32psTrace_NULL_TRACETREE                         Function %s called on a NULL trace level tree.
     33psTrace_ADD_NULL_COMPONENT                     Failed to add null component to trace tree.
     34psTrace_MALFORMED_COMPONENT_NAME               Failed to add '%s' to the root component tree; component must start with '.'.
     35psTrace_FAILED_TO_ADD_COMPONENT                Failed to set trace level (%d) to '%s'.
  • trunk/psLib/src/sysUtils/psSysUtilsErrors.h

    r1696 r1713  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-07 19:05:07 $
     9 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-08 00:09:06 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3939#define PS_ERRORTEXT_checkMemBlock_UNDERFLOW "Memory block %ld is corrupted; buffer underflow detected."
    4040#define PS_ERRORTEXT_checkMemBlock_OVERFLOW "Memory block %ld is corrupted; buffer overflow detected."
    41 #define PS_ERRORTEXT_memProblemCallbackDefault_MULTIPLE_FREE "Block %ld allocated at %s:%d freed more than once at %s:%d"
     41#define PS_ERRORTEXT_memProblemCallbackDefault_MULTIPLE_FREE "Block %ld allocated at %s:%d freed more than once at %s:%d."
     42#define PS_ERRORTEXT_psString_NCHAR_NEGATIVE "Can not copy a negative number of characters (%d)."
     43#define PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT "Sub-component %d of node %s in trace tree is NULL."
     44#define PS_ERRORTEXT_psTrace_NULL_TRACETREE "Function %s called on a NULL trace level tree."
     45#define PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT "Failed to add null component to trace tree."
     46#define PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME "Failed to add '%s' to the root component tree; component must start with '.'."
     47#define PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT "Failed to set trace level (%d) to '%s'"
    4248//~End
    4349
  • trunk/psLib/src/sysUtils/psTrace.c

    r1700 r1713  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-07 19:58:06 $
     11 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-08 00:09:06 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040#include "psString.h"
    4141#include "psError.h"
    42 #include "psAbort.h"
     42#include "psLogMsg.h"
     43
     44#include "psSysUtilsErrors.h"
     45#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psTrace."
    4346
    4447static p_psComponent* cRoot = NULL; // The root of the trace component
     
    107110    for (i = 0; i < currentNode->n; i++) {
    108111        if (NULL == currentNode->subcomp[i]) {
    109             psError(__func__,
    110                     "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name);
     112            psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN,
     113                     PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     114                     i, currentNode->name);
    111115        } else {
    112116            p_psTraceReset(currentNode->subcomp[i]);
     
    131135to ANSI-C.
    132136 *****************************************************************************/
    133 static void componentAdd(const char *addNodeName, int level)
     137static bool componentAdd(const char *addNodeName, int level)
    134138{
    135139    int i = 0;                  // Loop index variable.
     
    142146    // XXX: Verify that this is the correct behavior.
    143147    if (strcmp("", addNodeName) == 0) {
    144         psAbort(__func__, "Failed to add null component to trace tree.\n");
     148        psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_NULL,true,
     149                   PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT);
     150        return false;
    145151    }
    146152
     
    148154    if (strcmp(".", addNodeName) == 0) {
    149155        cRoot->level = level;
    150         return;
     156        return true;
    151157    }
    152158
    153159    if (addNodeName[0] != '.') {
    154         psAbort(__func__,"Failed to add %s to the root component tree.\n",
    155                 addNodeName);
     160        psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_VALUE,true,
     161                   PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME,
     162                   addNodeName);
     163        return false;
    156164    }
    157165
     
    188196        }
    189197    }
     198
     199    return true;
    190200}
    191201
     
    201211 zero
    202212*****************************************************************************/
    203 int psTraceSetLevel(const char *comp,   // component of interest
    204                     int level)  // desired trace level
     213bool psTraceSetLevel(const char *comp,   // component of interest
     214                     int level)  // desired trace level
    205215{
    206216    // If the root component tree does not exist, then initialize it.
     
    209219    }
    210220    // Add the new component to the component tree.
    211     componentAdd(comp, level);
    212 
     221    if ( !componentAdd(comp, level) ) {
     222        psErrorMsg(ERRORNAME_PREFIX "psTraceSetLevel", PS_ERR_UNKNOWN, false,
     223                   PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT,level,comp);
     224        return false;
     225    }
    213226    // return 0 on success.
    214     return 0;
     227    return true;
    215228}
    216229
     
    255268        for (i = 0; i < currentNode->n; i++) {
    256269            if (NULL == currentNode->subcomp[i]) {
    257                 psError(__func__,
    258                         "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
     270                psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN,
     271                         PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     272                         i, currentNode->name);
    259273            }
    260274
     
    365379
    366380    if (NULL == comp) {
    367         psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
     381        psErrorMsg(ERRORNAME_PREFIX "psTrace", PS_ERR_BAD_PARAMETER_NULL, true,
     382                   PS_ERRORTEXT_psTrace_NULL_TRACETREE,
     383                   __func__);
     384        return;
    368385    }
    369386    // Only display this message if it's trace level is less than the level
  • trunk/psLib/src/sysUtils/psTrace.h

    r1641 r1713  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-27 21:45:01 $
     12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-08 00:09:06 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6666
    6767/// Set trace level
    68 int psTraceSetLevel(const char *facil,     ///< facilty of interest
    69                     int level)     ///< desired trace level
     68bool psTraceSetLevel(const char *facil,     ///< facilty of interest
     69                     int level)     ///< desired trace level
    7070;
    7171
Note: See TracChangeset for help on using the changeset viewer.