IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1696


Ignore:
Timestamp:
Sep 7, 2004, 9:05:07 AM (22 years ago)
Author:
desonia
Message:

added error stack to sysUtils

Location:
trunk/psLib/src
Files:
2 added
15 edited

Legend:

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

    r1407 r1696  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *   
    12  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-07 19:05:07 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1616 */
    1717
    18 /******************************************************************************/
    19 
    20 /*  INCLUDE FILES                                                             */
    21 
    22 /******************************************************************************/
    2318#include <stdarg.h>
    2419#include <stdlib.h>
    2520#include "psAbort.h"
    2621#include "psLogMsg.h"
    27 
    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 /*****************************************************************************/
    7322
    7423void psAbort(const char *name, const char *fmt, ...)
  • trunk/psLib/src/sys/psError.c

    r1685 r1696  
    1 
    21/** @file  psError.c
    32 *
     
    1110 *  @author Eric Van Alst, MHPCC
    1211 *   
    13  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-03 20:39:50 $
     12 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-07 19:05:07 $
    1514 *
    1615 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/src/sys/psErrorCodes.c

    r1683 r1696  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-02 22:23:20 $
     9 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-07 19:05:07 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121 * the other lines by, for each error class in psErrorCodes.dat, the following
    2222 * substitutions are made:
    23  *     $ErrorCode        The error code name (first word in the psErrorCodes.dat lines)
    24  *     $ErrorDescription The error description (rest of the line in psErrorCodes.dat)
    25  *     $ErrorNumber      The order of the source line in psErrorCodes.dat (comments excluded)
     23 *     $1  The error code name (first word in the psErrorCodes.dat lines)
     24 *     $2 The error description (rest of the line in psErrorCodes.dat)
     25 *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
    2626 *
    2727 * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
     
    3131            {PS_ERR_NONE,"not an error"},
    3232            {PS_ERR_BASE,"base error"},
    33             //~Start    {PS_ERR_$ErrorCode,"$ErrorDescription"},
     33            //~Start    {PS_ERR_$1,"$2"},
    3434            {PS_ERR_UNKNOWN,"unknown error"},
    3535            {PS_ERR_IO,"I/O error"},
    3636            {PS_ERR_MEMORY_CORRUPTION,"memory corruption detected"},
     37            {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"},
    3741            //~End
    3842            {PS_ERR_N_ERR_CLASSES,"error classes end marker"}
  • trunk/psLib/src/sys/psErrorCodes.h

    r1683 r1696  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-02 22:23:20 $
     9 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-07 19:05:07 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020 * the other lines by, for each error class in psErrorCodes.dat, the following
    2121 * substitutions are made:
    22  *     $ErrorCode        The error code name (first word in the psErrorCodes.dat lines)
    23  *     $ErrorDescription The error description (rest of the line in psErrorCodes.dat)
    24  *     $ErrorNumber      The order of the source line in psErrorCodes.dat (comments excluded)
     22 *     $1  The error code name (first word in the psErrorCodes.dat lines)
     23 *     $2 The error description (rest of the line in psErrorCodes.dat)
     24 *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
    2525 *
    2626 * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
     
    4040     */
    4141
    42     //~Start     PS_ERR_$ErrorCode, ///< $ErrorDescription
    43     PS_ERR_UNKNOWN, ///< unknown error
    44     PS_ERR_IO, ///< I/O error
    45     PS_ERR_MEMORY_CORRUPTION, ///< memory corruption detected
     42    //~Start     PS_ERR_$1,   ///< $2
     43    PS_ERR_UNKNOWN,   ///< unknown error
     44    PS_ERR_IO,   ///< I/O error
     45    PS_ERR_MEMORY_CORRUPTION,   ///< memory corruption detected
     46    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
    4650    //~End
    4751    PS_ERR_N_ERR_CLASSES               ///< end marker - should not be used as a true error
  • trunk/psLib/src/sys/psLogMsg.c

    r1448 r1696  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-10 01:55:34 $
     14 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-09-07 19:05:07 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4141#include "psTrace.h"
    4242
     43#include "psSysUtilsErrors.h"
     44#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psLogMsg."
     45
    4346#define MIN_LOG_LEVEL 0
    4447#define MAX_LOG_LEVEL 9
    4548
    4649#define MAX_LOG_LINE_LENGTH 128
     50
     51
    4752static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
    4853static int globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
     
    108113
    109114    if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
    110         psError(__func__, "The specified destination, %s, is malformed.", dest);
     115        psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_LOCATION_INVALID,
     116                   PS_ERRORTEXT_psLogSetDestination_DESTINATION_MALFORMED,
     117                   dest);
    111118        return false;
    112119    }
     
    127134            return true;
    128135        }
    129         psError(__func__, "The location, %s, for protocol 'dest' is invalid.", location);
     136        psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_LOCATION_INVALID,
     137                   PS_ERRORTEXT_psLogSetDestination_DEST_LOCATION_INVALID,
     138                   location);
    130139        return 1;
    131140    } else if (strcmp(protocol, "file") == 0) {
     
    133142
    134143        if (file == NULL) {
    135             psError(__func__, "Could not open file '%s' for output.", location);
     144            psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_IO,
     145                       PS_ERRORTEXT_psLogSetDestination_OPEN_FILE_FAILED,
     146                       location);
    136147            return false;
    137148        }
     
    143154    }
    144155
    145     psError(__func__, "Do not know how to handle the protocol '%s'.", protocol);
     156    psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_LOCATION_INVALID,
     157               PS_ERRORTEXT_psLogSetDestination_UNSUPPORTED_PROTOCOL,
     158               protocol);
    146159    return false;
    147160}
     
    205218            break;
    206219        default:
    207             psError(__func__, "Unknown logging keyword %c", *ptr);
     220            psErrorMsg(ERRORNAME_PREFIX "psLogSetFormat", true, PS_ERR_BAD_VALUE,
     221                       PS_ERRORTEXT_psLogSetFormat_UNKNOWN_KEY, *ptr);
    208222            break;
    209223        }
  • trunk/psLib/src/sys/psMemory.c

    r1440 r1696  
    99*  @author Robert Lupton, Princeton University
    1010*
    11 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-09 23:34:58 $
     11*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-09-07 19:05:07 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727#include "psLogMsg.h"
    2828
     29#include "psSysUtilsErrors.h"
     30#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psMemory."
     31
    2932#define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
    3033
     
    100103{
    101104    if (ptr->refCounter < 1) {
    102         psError(__func__,
    103                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
    104                 ptr->id, ptr->file, ptr->lineno, file, lineno);
     105        psErrorMsg(ERRORNAME_PREFIX "memProblemCallbackDefault", false, PS_ERR_MEMORY_CORRUPTION,
     106                   PS_ERRORTEXT_memProblemCallbackDefault_MULTIPLE_FREE,
     107                   ptr->id, ptr->file, ptr->lineno, file, lineno);
    105108    }
    106109
     
    228231
    229232    if (m == NULL) {
    230         psError(funcName, "Memory Corruption: NULL memory block found.");
     233        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     234                   PS_ERRORTEXT_checkMemBlock_NULL_BLOCK);
    231235        return 1;
    232236    }
     
    234238    if (m->refCounter == 0) {
    235239        // using an unreferenced block of memory, are you?
    236         psError(__func__, "Memory Corruption: memory block %ld was freed but still used.", m->id);
     240        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     241                   PS_ERRORTEXT_checkMemBlock_DEREF_USE,
     242                   m->id);
    237243        return 1;
    238244    }
    239245
    240246    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
    241         psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)", m->id);
     247        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     248                   PS_ERRORTEXT_checkMemBlock_UNDERFLOW,
     249                   m->id);
    242250        return 1;
    243251    }
    244252    if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
    245         psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)", m->id);
     253        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     254                   PS_ERRORTEXT_checkMemBlock_OVERFLOW,
     255                   m->id);
    246256        return 1;
    247257    }
  • trunk/psLib/src/sysUtils/Makefile

    r1683 r1696  
    33##  Makefile:   sysUtils
    44##
    5 ##  $Revision: 1.19 $  $Name: not supported by cvs2svn $
    6 ##  $Date: 2004-09-02 22:23:20 $
     5##  $Revision: 1.20 $  $Name: not supported by cvs2svn $
     6##  $Date: 2004-09-07 19:05:07 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040OBJS = $(addprefix makedir/,$(SRC_OBJS))
    4141
     42HEADERS = $(SRC_OBJS:.o=.h) psType.h
     43
    4244# Define PHONY target "all" which will make all the necessary items
    4345
     
    4951psErrorCodes.c: psErrorCodes.dat
    5052        perl parseErrorCodes.pl --data=$? $@
     53
     54psSysUtilsErrors.h: psSysUtilsErrors.dat
     55        perl parseErrorCodes.pl --data=$? $@
     56
    5157
    5258# Rule to make static library
     
    6066
    6167install: $(TARGET_STATIC)
    62         install *.h $(includedir)
     68        install $(HEADERS) $(includedir)
    6369
    6470# Define PHONY target "distclean" which will cleanup the distribution
  • trunk/psLib/src/sysUtils/parseErrorCodes.pl

    r1683 r1696  
    6363            for ( $n = 0 ; $n < $found ; $n++ ) {
    6464                $_ = $line;
    65                 s/\$ErrorCode/$ErrorCodes[$n]/g;
    66                 s/\$ErrorDescription/$ErrorDescriptions[$n]/g;
    67                 s/\$ErrorNumber/$n/g;
     65                s/\$1/$ErrorCodes[$n]/g;
     66                s/\$2/$ErrorDescriptions[$n]/g;
     67                s/\$n/$n/g;
    6868                push( @result, $_ );
    6969                print "$_\n" if $verbose;
  • trunk/psLib/src/sysUtils/psAbort.c

    r1407 r1696  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *   
    12  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-07 00:06:06 $
     12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-07 19:05:07 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    1616 */
    1717
    18 /******************************************************************************/
    19 
    20 /*  INCLUDE FILES                                                             */
    21 
    22 /******************************************************************************/
    2318#include <stdarg.h>
    2419#include <stdlib.h>
    2520#include "psAbort.h"
    2621#include "psLogMsg.h"
    27 
    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 /*****************************************************************************/
    7322
    7423void psAbort(const char *name, const char *fmt, ...)
  • trunk/psLib/src/sysUtils/psError.c

    r1685 r1696  
    1 
    21/** @file  psError.c
    32 *
     
    1110 *  @author Eric Van Alst, MHPCC
    1211 *   
    13  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-09-03 20:39:50 $
     12 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-09-07 19:05:07 $
    1514 *
    1615 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/src/sysUtils/psErrorCodes.c

    r1683 r1696  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-02 22:23:20 $
     9 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-07 19:05:07 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2121 * the other lines by, for each error class in psErrorCodes.dat, the following
    2222 * substitutions are made:
    23  *     $ErrorCode        The error code name (first word in the psErrorCodes.dat lines)
    24  *     $ErrorDescription The error description (rest of the line in psErrorCodes.dat)
    25  *     $ErrorNumber      The order of the source line in psErrorCodes.dat (comments excluded)
     23 *     $1  The error code name (first word in the psErrorCodes.dat lines)
     24 *     $2 The error description (rest of the line in psErrorCodes.dat)
     25 *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
    2626 *
    2727 * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
     
    3131            {PS_ERR_NONE,"not an error"},
    3232            {PS_ERR_BASE,"base error"},
    33             //~Start    {PS_ERR_$ErrorCode,"$ErrorDescription"},
     33            //~Start    {PS_ERR_$1,"$2"},
    3434            {PS_ERR_UNKNOWN,"unknown error"},
    3535            {PS_ERR_IO,"I/O error"},
    3636            {PS_ERR_MEMORY_CORRUPTION,"memory corruption detected"},
     37            {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"},
    3741            //~End
    3842            {PS_ERR_N_ERR_CLASSES,"error classes end marker"}
  • trunk/psLib/src/sysUtils/psErrorCodes.dat

    r1683 r1696  
    22#  This file is used to generate psErrorCode.h content
    33#
    4 UNKNOWN                unknown error
    5 IO                     I/O error
    6 MEMORY_CORRUPTION      memory corruption detected
     4# Format:
     5#    ERROR_CLASS_NAME    ERROR_CLASS_DESCRIPTION
     6#
     7# Note: the ERROR_CLASS_NAME will appear in the code with a "PS_ERR_" prefix
     8#
     9UNKNOWN                        unknown error
     10IO                             I/O error
     11MEMORY_CORRUPTION              memory corruption detected
     12MEMORY_DEREF_USAGE             dereferenced memory still used
     13LOCATION_INVALID               specified location is unknown
     14BAD_VALUE                      value is out-of-range
     15BAD_LENGTH                     string value is too long
  • trunk/psLib/src/sysUtils/psErrorCodes.h

    r1683 r1696  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-02 22:23:20 $
     9 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-07 19:05:07 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020 * the other lines by, for each error class in psErrorCodes.dat, the following
    2121 * substitutions are made:
    22  *     $ErrorCode        The error code name (first word in the psErrorCodes.dat lines)
    23  *     $ErrorDescription The error description (rest of the line in psErrorCodes.dat)
    24  *     $ErrorNumber      The order of the source line in psErrorCodes.dat (comments excluded)
     22 *     $1  The error code name (first word in the psErrorCodes.dat lines)
     23 *     $2 The error description (rest of the line in psErrorCodes.dat)
     24 *     $n  The order of the source line in psErrorCodes.dat (comments excluded)
    2525 *
    2626 * DO NOT EDIT THE LINES BETWEEN //~Start and //~End!  ANY CHANGES WILL BE OVERWRITTEN.
     
    4040     */
    4141
    42     //~Start     PS_ERR_$ErrorCode, ///< $ErrorDescription
    43     PS_ERR_UNKNOWN, ///< unknown error
    44     PS_ERR_IO, ///< I/O error
    45     PS_ERR_MEMORY_CORRUPTION, ///< memory corruption detected
     42    //~Start     PS_ERR_$1,   ///< $2
     43    PS_ERR_UNKNOWN,   ///< unknown error
     44    PS_ERR_IO,   ///< I/O error
     45    PS_ERR_MEMORY_CORRUPTION,   ///< memory corruption detected
     46    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
    4650    //~End
    4751    PS_ERR_N_ERR_CLASSES               ///< end marker - should not be used as a true error
  • trunk/psLib/src/sysUtils/psLogMsg.c

    r1448 r1696  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-10 01:55:34 $
     14 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-09-07 19:05:07 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4141#include "psTrace.h"
    4242
     43#include "psSysUtilsErrors.h"
     44#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psLogMsg."
     45
    4346#define MIN_LOG_LEVEL 0
    4447#define MAX_LOG_LEVEL 9
    4548
    4649#define MAX_LOG_LINE_LENGTH 128
     50
     51
    4752static FILE *logDest = (FILE *) 1;      // flag to initialize to stderr before using.
    4853static int globalLogLevel = PS_LOG_INFO;        // log all messages at this or above
     
    108113
    109114    if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
    110         psError(__func__, "The specified destination, %s, is malformed.", dest);
     115        psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_LOCATION_INVALID,
     116                   PS_ERRORTEXT_psLogSetDestination_DESTINATION_MALFORMED,
     117                   dest);
    111118        return false;
    112119    }
     
    127134            return true;
    128135        }
    129         psError(__func__, "The location, %s, for protocol 'dest' is invalid.", location);
     136        psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_LOCATION_INVALID,
     137                   PS_ERRORTEXT_psLogSetDestination_DEST_LOCATION_INVALID,
     138                   location);
    130139        return 1;
    131140    } else if (strcmp(protocol, "file") == 0) {
     
    133142
    134143        if (file == NULL) {
    135             psError(__func__, "Could not open file '%s' for output.", location);
     144            psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_IO,
     145                       PS_ERRORTEXT_psLogSetDestination_OPEN_FILE_FAILED,
     146                       location);
    136147            return false;
    137148        }
     
    143154    }
    144155
    145     psError(__func__, "Do not know how to handle the protocol '%s'.", protocol);
     156    psErrorMsg(ERRORNAME_PREFIX "psLogSetDestination", true, PS_ERR_LOCATION_INVALID,
     157               PS_ERRORTEXT_psLogSetDestination_UNSUPPORTED_PROTOCOL,
     158               protocol);
    146159    return false;
    147160}
     
    205218            break;
    206219        default:
    207             psError(__func__, "Unknown logging keyword %c", *ptr);
     220            psErrorMsg(ERRORNAME_PREFIX "psLogSetFormat", true, PS_ERR_BAD_VALUE,
     221                       PS_ERRORTEXT_psLogSetFormat_UNKNOWN_KEY, *ptr);
    208222            break;
    209223        }
  • trunk/psLib/src/sysUtils/psMemory.c

    r1440 r1696  
    99*  @author Robert Lupton, Princeton University
    1010*
    11 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-08-09 23:34:58 $
     11*  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-09-07 19:05:07 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727#include "psLogMsg.h"
    2828
     29#include "psSysUtilsErrors.h"
     30#define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psMemory."
     31
    2932#define P_PS_MEMMAGIC (void *)0xdeadbeef   // Magic number in psMemBlock header
    3033
     
    100103{
    101104    if (ptr->refCounter < 1) {
    102         psError(__func__,
    103                 "Block %ld allocated at %s:%d freed more than once at %s:%d\n",
    104                 ptr->id, ptr->file, ptr->lineno, file, lineno);
     105        psErrorMsg(ERRORNAME_PREFIX "memProblemCallbackDefault", false, PS_ERR_MEMORY_CORRUPTION,
     106                   PS_ERRORTEXT_memProblemCallbackDefault_MULTIPLE_FREE,
     107                   ptr->id, ptr->file, ptr->lineno, file, lineno);
    105108    }
    106109
     
    228231
    229232    if (m == NULL) {
    230         psError(funcName, "Memory Corruption: NULL memory block found.");
     233        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     234                   PS_ERRORTEXT_checkMemBlock_NULL_BLOCK);
    231235        return 1;
    232236    }
     
    234238    if (m->refCounter == 0) {
    235239        // using an unreferenced block of memory, are you?
    236         psError(__func__, "Memory Corruption: memory block %ld was freed but still used.", m->id);
     240        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     241                   PS_ERRORTEXT_checkMemBlock_DEREF_USE,
     242                   m->id);
    237243        return 1;
    238244    }
    239245
    240246    if (m->startblock != P_PS_MEMMAGIC || m->endblock != P_PS_MEMMAGIC) {
    241         psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer underflow)", m->id);
     247        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     248                   PS_ERRORTEXT_checkMemBlock_UNDERFLOW,
     249                   m->id);
    242250        return 1;
    243251    }
    244252    if (*(void **)((int8_t *) (m + 1) + m->userMemorySize) != P_PS_MEMMAGIC) {
    245         psError(funcName, "Memory Corruption: memory block %ld is corrupted (buffer overflow)", m->id);
     253        psErrorMsg(ERRORNAME_PREFIX "checkMemBlock", true, PS_ERR_MEMORY_CORRUPTION,
     254                   PS_ERRORTEXT_checkMemBlock_OVERFLOW,
     255                   m->id);
    246256        return 1;
    247257    }
Note: See TracChangeset for help on using the changeset viewer.