/[ascend]/branches/relerrorlist/ascend/utilities/error.c
ViewVC logotype

Diff of /branches/relerrorlist/ascend/utilities/error.c

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

revision 585 by johnpye, Wed Apr 19 14:18:05 2006 UTC revision 586 by johnpye, Thu May 11 00:47:54 2006 UTC
# Line 15  static error_reporter_callback_t g_error Line 15  static error_reporter_callback_t g_error
15  static error_reporter_meta_t g_error_reporter_cache;  static error_reporter_meta_t g_error_reporter_cache;
16    
17  /**  /**
18        XTERM colour codes used to distinguish between errors of different types.
19    */
20    #  define ERR_RED "31;1"
21    #  define ERR_GRN "32;2"
22    #  define ERR_BLU "34;1"
23    #  define ERR_BRN "33;1"
24    #  define ERR_BOLD "1"
25    
26    /**
27      Default error reporter. To use this error reporter, set      Default error reporter. To use this error reporter, set
28      the callback pointer to NULL.      the callback pointer to NULL.
29  */  */
30  int error_reporter_default_callback(ERROR_REPORTER_CALLBACK_ARGS){  int error_reporter_default_callback(ERROR_REPORTER_CALLBACK_ARGS){
31      char *sevmsg="";      char *sevmsg="";
32        char *color=NULL;
33      char *endtxt="\n";      char *endtxt="\n";
34      int res=0;      int res=0;
35      switch(sev){      switch(sev){
36          case ASC_PROG_FATAL:    sevmsg = ERR_RED "PROGRAM FATAL ERROR: " ERR_NORM; break;          case ASC_PROG_FATAL:    color=ERR_RED; sevmsg = "PROGRAM FATAL ERROR: "; break;
37          case ASC_PROG_ERROR:    sevmsg = ERR_RED "PROGRAM ERROR: " ERR_NORM; break;          case ASC_PROG_ERROR:    color=ERR_RED; sevmsg = "PROGRAM ERROR: "; break;
38          case ASC_PROG_WARNING:  sevmsg = "PROGRAM WARNING: "; break;          case ASC_PROG_WARNING:  color=ERR_BOLD;sevmsg = "PROGRAM WARNING: "; break;
39          case ASC_PROG_NOTE:     sevmsg = ERR_GRN; endtxt=ERR_NORM; break; /* default, keep unembellished for now */          case ASC_PROG_NOTE:     color=ERR_GRN; endtxt=""; break; /* default, keep unembellished for now */
40          case ASC_USER_ERROR:    sevmsg = ERR_RED "ERROR: " ERR_NORM; break;          case ASC_USER_ERROR:    color=ERR_RED; sevmsg = "ERROR: "; break;
41          case ASC_USER_WARNING:  sevmsg = ERR_BRN "WARNING: " ERR_NORM; break;          case ASC_USER_WARNING:  color=ERR_BRN; sevmsg = "WARNING: "; break;
42          case ASC_USER_NOTE:     sevmsg = "NOTE: "; break;          case ASC_USER_NOTE:     sevmsg = "NOTE: "; break;
43          case ASC_USER_SUCCESS:  sevmsg = ERR_GRN "SUCCESS: " ERR_NORM; break;          case ASC_USER_SUCCESS:  color=ERR_GRN; sevmsg = "SUCCESS: "; break;
44      }      }
45    
46        color_on(ASCERR,color);
47      res = ASC_FPRINTF(ASCERR,sevmsg);      res = ASC_FPRINTF(ASCERR,sevmsg);
48        color_off(ASCERR);
49    
50      if(filename!=NULL){      if(filename!=NULL){
51          res += ASC_FPRINTF(ASCERR,"%s:",filename);          res += ASC_FPRINTF(ASCERR,"%s:",filename);
52      }      }

Legend:
Removed from v.585  
changed lines
  Added in v.586

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