/[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 221 by johnpye, Mon Jan 16 08:53:30 2006 UTC revision 222 by johnpye, Fri Jan 27 04:23:20 2006 UTC
# Line 59  int error_reporter_default_callback(ERRO Line 59  int error_reporter_default_callback(ERRO
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:",filename);
63      }      }
64        if(line!=0){
65            res += ASC_FPRINTF(ASCERR,"%d:",line);
66        }
67        if(funcname!=NULL){
68            res += ASC_FPRINTF(ASCERR,"%s:",funcname);
69        }
70        if ((filename!=NULL) || (line!=0) || (funcname!=NULL)){
71            res += ASC_FPRINTF(ASCERR," ");
72        }
73    
74      res += ASC_VFPRINTF(ASCERR,fmt,args);      res += ASC_VFPRINTF(ASCERR,fmt,args);
75      res += ASC_FPRINTF(ASCERR,endtxt);      res += ASC_FPRINTF(ASCERR,endtxt);
76    
# Line 72  int error_reporter_default_callback(ERRO Line 82  int error_reporter_default_callback(ERRO
82  */  */
83  int  int
84  va_error_reporter(  va_error_reporter(
85          const error_severity_t sev        const error_severity_t sev
86          , const char *errfile, const int errline      , const char *errfile
87          , const char *fmt      , const int errline
88          , const va_list args      , const char *errfunc
89        , const char *fmt
90        , const va_list args
91  ){  ){
92      extern error_reporter_callback_t g_error_reporter_callback;      extern error_reporter_callback_t g_error_reporter_callback;
93      int res;      int res;
94    
95      if(g_error_reporter_callback==NULL){      if(g_error_reporter_callback==NULL){
96          /* fprintf(stderr,"CALLING VFPRINTF\n"); */          /* fprintf(stderr,"CALLING VFPRINTF\n"); */
97          res = error_reporter_default_callback(sev,errfile,errline,fmt,args);          res = error_reporter_default_callback(sev,errfile,errline,errfunc,fmt,args);
98      }else{      }else{
99          /* fprintf(stderr,"CALLING G_ERROR_REPORTER_CALLBACK\n"); */          /* fprintf(stderr,"CALLING G_ERROR_REPORTER_CALLBACK\n"); */
100          res = g_error_reporter_callback(sev,errfile,errline,fmt,args);          res = g_error_reporter_callback(sev,errfile,errline,errfunc,fmt,args);
101      }      }
102    
103      return res;      return res;
# Line 122  fprintf_error_reporter(FILE *file, const Line 134  fprintf_error_reporter(FILE *file, const
134              }              }
135          }else{          }else{
136              /* Not caching: output all in one go as a ASC_PROG_NOTE */              /* Not caching: output all in one go as a ASC_PROG_NOTE */
137              res = va_error_reporter(ASC_PROG_NOTE,NULL,0,fmt,args);              res = va_error_reporter(ASC_PROG_NOTE,NULL,0,NULL,fmt,args);
138          }          }
139      }else{      }else{
140          res = ASC_VFPRINTF(file,fmt,args);          res = ASC_VFPRINTF(file,fmt,args);
# Line 158  fflush_error_reporter(FILE *file){ Line 170  fflush_error_reporter(FILE *file){
170  */  */
171    
172  int  int
173  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, const char *func){
174    
175      extern error_reporter_meta_t g_error_reporter_cache;      extern error_reporter_meta_t g_error_reporter_cache;
176      if(g_error_reporter_cache.iscaching){      if(g_error_reporter_cache.iscaching){
# Line 169  error_reporter_start(const error_severit Line 181  error_reporter_start(const error_severit
181      g_error_reporter_cache.sev = sev;      g_error_reporter_cache.sev = sev;
182      g_error_reporter_cache.filename = filename;      g_error_reporter_cache.filename = filename;
183      g_error_reporter_cache.line = line;      g_error_reporter_cache.line = line;
184        g_error_reporter_cache.func = func;
185    
186      return 1;      return 1;
187  }  }
# Line 181  error_reporter_end_flush(){ Line 194  error_reporter_end_flush(){
194          g_error_reporter_cache.sev          g_error_reporter_cache.sev
195          ,g_error_reporter_cache.filename          ,g_error_reporter_cache.filename
196          ,g_error_reporter_cache.line          ,g_error_reporter_cache.line
197            ,g_error_reporter_cache.func
198          ,g_error_reporter_cache.msg          ,g_error_reporter_cache.msg
199      );      );
200      g_error_reporter_cache.iscaching = 0;      g_error_reporter_cache.iscaching = 0;
# Line 193  error_reporter_end_flush(){ Line 207  error_reporter_end_flush(){
207  */  */
208  int  int
209  error_reporter(  error_reporter(
210          const error_severity_t sev        const error_severity_t sev
211          , const char *errfile, const int errline      , const char *errfile
212          , const char *fmt, ...      , const int errline
213        , const char *errfunc
214        , const char *fmt
215        , ...
216  ){  ){
217      int res;      int res;
218      va_list args;      va_list args;
219    
220      va_start(args,fmt);      va_start(args,fmt);
221      res = va_error_reporter(sev,errfile,errline,fmt,args);      res = va_error_reporter(sev,errfile,errline,errfunc,fmt,args);
222      va_end(args);      va_end(args);
223    
224      return res;      return res;

Legend:
Removed from v.221  
changed lines
  Added in v.222

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