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

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

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

revision 585 by johnpye, Sat Apr 22 07:52:30 2006 UTC revision 586 by johnpye, Thu May 11 00:47:54 2006 UTC
# Line 71  Line 71 
71      using xterm codes. But that brings its own problems on MinGW and Windows...      using xterm codes. But that brings its own problems on MinGW and Windows...
72  */  */
73    
 #ifdef USE_XTERM_COLOR_CODES  
 /** XTERM colour codes used to distinguish between errors of different types.  
   
     @TODO some runtime testing to determine if these should be used or not  
     depending on TERM env var.  
 */  
 #  define ERR_RED "\033[31;1m"  
 #  define ERR_GRN "\033[32;2m"  
 #  define ERR_BLU "\033[34;1m"  
 #  define ERR_BRN "\033[33;1m"  
 #  define ERR_NORM "\033[0m"  
 #  define ERR_BOLD "\033[1m"  
 #else  
 #  define ERR_RED ""  
 #  define ERR_GRN ""  
 #  define ERR_BLU ""  
 #  define ERR_BRN ""  
 #  define ERR_NORM ""  
 #  define ERR_BOLD ""  
 #endif  
   
74  /**  /**
75      Error severity codes. This will be used to visually      Error severity codes. This will be used to visually
76      the seriousness of errors. ASC_PROG_ERRORs for example      the seriousness of errors. ASC_PROG_ERRORs for example
# Line 120  typedef enum error_severity_enum{ Line 99  typedef enum error_severity_enum{
99  # define ERROR_REPORTER_DEBUG(args...) error_reporter(ASC_PROG_NOTE, __FILE__, __LINE__, __func__, ##args)  # define ERROR_REPORTER_DEBUG(args...) error_reporter(ASC_PROG_NOTE, __FILE__, __LINE__, __func__, ##args)
100  # define ERROR_REPORTER_HERE(SEV,args...) error_reporter(SEV,__FILE__, __LINE__, __func__, ##args)  # define ERROR_REPORTER_HERE(SEV,args...) error_reporter(SEV,__FILE__, __LINE__, __func__, ##args)
101  # define ERROR_REPORTER_NOLINE(SEV,args...) error_reporter(SEV, NULL, 0, NULL, ##args)  # define ERROR_REPORTER_NOLINE(SEV,args...) error_reporter(SEV, NULL, 0, NULL, ##args)
102  # define CONSOLE_DEBUG(args...) (fprintf(stderr, ERR_BOLD "%s:%d (%s): ", __FILE__,__LINE__,__func__) + \  # define CONSOLE_DEBUG(args...) (color_on(stderr,"1") + fprintf(stderr, "%s:%d (%s): ", __FILE__,__LINE__,__func__) + \
103                                   fprintf(stderr, ##args) + \                                   fprintf(stderr, ##args) + \
104                                   fprintf(stderr, ERR_NORM "\n"))                                   fprintf(stderr, "\n") + color_off(stderr))
105    
106  # define ERROR_REPORTER_START_HERE(SEV) error_reporter_start(SEV,__FILE__,__LINE__,__func__);  # define ERROR_REPORTER_START_HERE(SEV) error_reporter_start(SEV,__FILE__,__LINE__,__func__);
107    
# Line 130  typedef enum error_severity_enum{ Line 109  typedef enum error_severity_enum{
109  # define ERROR_REPORTER_DEBUG(...) error_reporter(ASC_PROG_NOTE,__FILE__,__LINE__,__func__,## __VA_ARGS__)  # define ERROR_REPORTER_DEBUG(...) error_reporter(ASC_PROG_NOTE,__FILE__,__LINE__,__func__,## __VA_ARGS__)
110  # define ERROR_REPORTER_HERE(SEV,...) error_reporter(SEV,__FILE__,__LINE__,__func__, ## __VA_ARGS__)  # define ERROR_REPORTER_HERE(SEV,...) error_reporter(SEV,__FILE__,__LINE__,__func__, ## __VA_ARGS__)
111  # define ERROR_REPORTER_NOLINE(SEV,...) error_reporter(SEV,NULL,0,NULL, ## __VA_ARGS__)  # define ERROR_REPORTER_NOLINE(SEV,...) error_reporter(SEV,NULL,0,NULL, ## __VA_ARGS__)
112  # define CONSOLE_DEBUG(...) (fprintf(stderr, ERR_BOLD "%s:%d (%s): ", __FILE__,__LINE__,__func__) + \  # define CONSOLE_DEBUG(...) (fprintf(stderr, "%s:%d (%s): ", __FILE__,__LINE__,__func__) + \
113                               fprintf(stderr, ##__VA_ARGS__) + \                               fprintf(stderr, ##__VA_ARGS__) + \
114                               fprintf(stderr, ERR_NORM "\n"))                               fprintf(stderr, "\n"))
115    
116  #elif defined(_MSC_VER) && _MSC_VER >= 1400 /* Microsoft Visual C++ 2005 or newer */  #elif defined(_MSC_VER) && _MSC_VER >= 1400 /* Microsoft Visual C++ 2005 or newer */
117  #  define ERROR_REPORTER_START_HERE(SEV) error_reporter_start(SEV,__FILE__,__LINE__,__FUNCTION__);  #  define ERROR_REPORTER_START_HERE(SEV) error_reporter_start(SEV,__FILE__,__LINE__,__FUNCTION__);
# Line 141  typedef enum error_severity_enum{ Line 120  typedef enum error_severity_enum{
120  #  define ERROR_REPORTER_NOLINE(SEV,...) error_reporter(SEV,NULL,0,NULL, __VA_ARGS__)  #  define ERROR_REPORTER_NOLINE(SEV,...) error_reporter(SEV,NULL,0,NULL, __VA_ARGS__)
121  #  define CONSOLE_DEBUG(...)   (fprintf(stderr, ERR_BOLD "%s:%d (%s): ", __FILE__,__LINE__,__FUNCTION__) + \  #  define CONSOLE_DEBUG(...)   (fprintf(stderr, ERR_BOLD "%s:%d (%s): ", __FILE__,__LINE__,__FUNCTION__) + \
122                                  fprintf(stderr, __VA_ARGS__) + \                                  fprintf(stderr, __VA_ARGS__) + \
123                                  fprintf(stderr, ERR_NORM "\n"))                                  fprintf(stderr, "\n"))
124  #else /* workaround for compilers without variadic macros: last resort */  #else /* workaround for compilers without variadic macros: last resort */
125  # define NO_VARIADIC_MACROS  # define NO_VARIADIC_MACROS
126  # define ERROR_REPORTER_DEBUG error_reporter_note_no_line  # define ERROR_REPORTER_DEBUG error_reporter_note_no_line

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

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