/[ascend]/trunk/base/generic/utilities/error.c
ViewVC logotype

Diff of /trunk/base/generic/utilities/error.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 189 by johnpye, Mon Jan 16 07:47:02 2006 UTC revision 190 by johnpye, Mon Jan 16 08:53:30 2006 UTC
# Line 38  static error_reporter_callback_t g_error Line 38  static error_reporter_callback_t g_error
38  */  */
39  static error_reporter_meta_t g_error_reporter_cache;  static error_reporter_meta_t g_error_reporter_cache;
40    
41  /**  /**
42      Default error reporter. To use this error reporter, set      Default error reporter. To use this error reporter, set
43      the callback pointer to NULL.      the callback pointer to NULL.
44  */  */
# Line 56  int error_reporter_default_callback(ERRO Line 56  int error_reporter_default_callback(ERRO
56          case ASC_USER_NOTE:     sevmsg = "NOTE: "; break;          case ASC_USER_NOTE:     sevmsg = "NOTE: "; break;
57          case ASC_USER_SUCCESS:  sevmsg = ERR_GRN "SUCCESS: " ERR_NORM; break;          case ASC_USER_SUCCESS:  sevmsg = ERR_GRN "SUCCESS: " ERR_NORM; break;
58      }      }
59        
60      res = ASC_FPRINTF(ASCERR,sevmsg);      res = ASC_FPRINTF(ASCERR,sevmsg);
61      if(filename!=NULL){      if(filename!=NULL){
62          res += ASC_FPRINTF(ASCERR,"%s:%d: ",filename,line);          res += ASC_FPRINTF(ASCERR,"%s:%d: ",filename,line);
63      }      }
64      res += ASC_VFPRINTF(ASCERR,fmt,args);      res += ASC_VFPRINTF(ASCERR,fmt,args);
65      res += ASC_FPRINTF(ASCERR,endtxt);      res += ASC_FPRINTF(ASCERR,endtxt);
66        
67      return res;      return res;
68  }  }
69    
# Line 87  va_error_reporter( Line 87  va_error_reporter(
87          /* fprintf(stderr,"CALLING G_ERROR_REPORTER_CALLBACK\n"); */          /* fprintf(stderr,"CALLING G_ERROR_REPORTER_CALLBACK\n"); */
88          res = g_error_reporter_callback(sev,errfile,errline,fmt,args);          res = g_error_reporter_callback(sev,errfile,errline,fmt,args);
89      }      }
90        
91      return res;      return res;
92  }  }
93    
# Line 159  fflush_error_reporter(FILE *file){ Line 159  fflush_error_reporter(FILE *file){
159    
160  int  int
161  error_reporter_start(const error_severity_t sev, const char *filename, const int line){  error_reporter_start(const error_severity_t sev, const char *filename, const int line){
162        
163      extern error_reporter_meta_t g_error_reporter_cache;      extern error_reporter_meta_t g_error_reporter_cache;
164      if(g_error_reporter_cache.iscaching){      if(g_error_reporter_cache.iscaching){
165          error_reporter_end_flush();          error_reporter_end_flush();
# Line 221  int error_reporter_note_no_line(const ch Line 221  int error_reporter_note_no_line(const ch
221      return res;      return res;
222  }  }
223    
224  /**  /**
225      Error reporter 'here' function for compilers not supporting      Error reporter 'here' function for compilers not supporting
226      variadic macros.      variadic macros.
227  */  */
# Line 234  int error_reporter_here(const error_seve Line 234  int error_reporter_here(const error_seve
234      va_end(args);      va_end(args);
235    
236      return res;      return res;
237    }
238    
239    
240    /**
241        Error reporter 'no line' function for compilers not supporting
242        variadic macros.
243    */
244    int error_reporter_noline(const error_severity_t sev, const char *fmt,...){
245        int res;
246        va_list args;
247    
248        va_start(args,fmt);
249        res = va_error_reporter(sev,NULL,0,fmt,args);
250        va_end(args);
251    
252        return res;
253  }  }
254    
255  int console_debug(const char *fmt,...){  int console_debug(const char *fmt,...){

Legend:
Removed from v.189  
changed lines
  Added in v.190

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22