IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

File:
1 edited

Legend:

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

    r2204 r2273  
    1010 *  @author Eric Van Alst, MHPCC
    1111 *   
    12  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-10-27 00:57:31 $
     12 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-11-04 01:05:00 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767}
    6868
    69 void psError(const char *name, const char *fmt, ...)
     69psErrorCode p_psError(const char* file,
     70                      int lineno,
     71                      const char* func,
     72                      psErrorCode code,
     73                      psBool new,
     74                      const char* fmt,
     75                      ...)
    7076{
    71     va_list argPtr;             // variable list arguement pointer
     77    char errMsg[2048];
     78    psErr* err;
     79    char msgName[256];
    7280
    73     // Get the variable list parameters to pass to logging function
    74     va_start(argPtr, fmt);
    75 
    76     // Call logging function with PS_LOG_ERROR level
    77     psLogMsgV(name, PS_LOG_ERROR, fmt, argPtr);
    78 
    79     // Clean up stack after variable argument has been used
    80     va_end(argPtr);
    81 }
    82 
    83 void psErrorClear()
    84 {
    85     pthread_mutex_lock(&lockErrorStack);
    86     for (psS32 lcv=0;lcv<errorStackSize;lcv++) {
    87         p_psMemSetPersistent(errorStack[lcv]->msg,false);
    88         p_psMemSetPersistent(errorStack[lcv]->name,false);
    89         p_psMemSetPersistent(errorStack[lcv],false);
    90         psFree(errorStack[lcv]);
    91     }
    92     errorStackSize = 0;
    93     pthread_mutex_unlock(&lockErrorStack);
    94 }
    95 
    96 psErrorCode psErrorMsg(const char *name, psErrorCode code, psBool new, const char* fmt, ...)
    97 {
    98     char errMsg[1024];
    99     psErr* err;
    100     char* msgName;
    101 
    102     // Check for null pointer and if found set to empty string;
    103     if ( name == NULL ) {
    104         msgName = "";
    105     } else {
    106         msgName = (char*)name;
    107     }
     81    snprintf(msgName,256,"%s (%s:%d)",func,file,lineno);
    10882
    10983    va_list argPtr;             // variable list arguement pointer
     
    11690    va_start(argPtr, fmt);
    11791
    118     vsnprintf(errMsg,1024,fmt,argPtr);
     92    vsnprintf(errMsg,2048,fmt,argPtr);
    11993    err = psErrAlloc(msgName,code,errMsg);
    12094    pushErrorStack(err);
     
    160134}
    161135
     136void psErrorClear(void)
     137{
     138    pthread_mutex_lock(&lockErrorStack);
     139
     140    for (int lcv=0;lcv < errorStackSize; lcv++) {
     141        p_psMemSetPersistent(errorStack[lcv],false);
     142        p_psMemSetPersistent(errorStack[lcv]->msg,false);
     143        p_psMemSetPersistent(errorStack[lcv]->name,false);
     144        psFree(errorStack[lcv]);
     145    }
     146    errorStackSize = 0;
     147
     148    pthread_mutex_unlock(&lockErrorStack);
     149
     150}
    162151void psErrorStackPrint(FILE *fd, const char *fmt, ...)
    163152{
Note: See TracChangeset for help on using the changeset viewer.