inc/errabort.h

Go to the documentation of this file.
00001 /* ErrAbort.h - our error handler. 
00002  *
00003  * This maintains two stacks - a warning message printer
00004  * stack, and a "abort handler" stack.
00005  *
00006  * By default the warnings will go to stderr, and
00007  * aborts will exit the program.  You can push a
00008  * function on to the appropriate stack to change
00009  * this behavior.  The top function on the stack
00010  * gets called.
00011  *
00012  * Most functions in this library will call errAbort()
00013  * if they run out of memory.  
00014  *
00015  * This file is copyright 2002 Jim Kent, but license is hereby
00016  * granted for all use - public, private or commercial. */
00017 
00018 #ifndef ERRABORT_H
00019 #define ERRABORT_H
00020 void errAbort(char *format, ...)
00021 /* Abort function, with optional (printf formatted) error message. */
00022 #if defined(__GNUC__) && defined(JK_WARN)
00023 __attribute__((format(printf, 1, 2)))
00024 #endif
00025 ;
00026 
00027 void vaErrAbort(char *format, va_list args);
00028 /* Abort function, with optional (vprintf formatted) error message. */
00029 
00030 void errnoAbort(char *format, ...)
00031 /* Prints error message from UNIX errno first, then does errAbort. */
00032 #if defined(__GNUC__) && defined(JK_WARN)
00033 __attribute__((format(printf, 1, 2)))
00034 #endif
00035 ;
00036 
00037 typedef void (*AbortHandler)();
00038 /* Function that can abort. */
00039 
00040 void pushAbortHandler(AbortHandler handler);
00041 /* Set abort handler */
00042 
00043 void popAbortHandler();
00044 /* Revert to old abort handler. */
00045 
00046 void noWarnAbort();
00047 /* Abort without message. */
00048 
00049 void pushDebugAbort();
00050 /* Push abort handler that will invoke debugger. */
00051 
00052 void vaWarn(char *format, va_list args);
00053 /* Call top of warning stack to issue warning. */
00054 
00055 void warn(char *format, ...)
00056 /* Issue a warning message. */
00057 #if defined(__GNUC__) && defined(JK_WARN)
00058 __attribute__((format(printf, 1, 2)))
00059 #endif
00060 ;
00061 
00062 void errnoWarn(char *format, ...)
00063 /* Prints error message from UNIX errno first, then does rest of warning. */
00064 #if defined(__GNUC__) && defined(JK_WARN)
00065 __attribute__((format(printf, 1, 2)))
00066 #endif
00067 ;
00068 
00069 typedef void (*WarnHandler)(char *format, va_list args);
00070 /* Function that can warn. */
00071 
00072 void pushWarnHandler(WarnHandler handler);
00073 /* Set warning handler */
00074 
00075 void popWarnHandler();
00076 /* Revert to old warn handler. */
00077 
00078 void pushWarnAbort();
00079 /* Push handler that will abort on warnings. */
00080 
00081 #endif /* ERRABORT_H */

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2