| 1 |
/* exception.h: facility to handle error in autotrace */ |
| 2 |
|
| 3 |
#ifndef AT_EXCEPTION_H |
| 4 |
#define AT_EXCEPTION_H |
| 5 |
|
| 6 |
#include "autotrace.h" |
| 7 |
|
| 8 |
#ifdef __cplusplus |
| 9 |
extern "C" { |
| 10 |
#endif /* __cplusplus */ |
| 11 |
|
| 12 |
/* Protocol: |
| 13 |
If a function raises a FATAL(including propagation), |
| 14 |
the function must release resources allocated by the |
| 15 |
function itself. |
| 16 |
*/ |
| 17 |
typedef struct _at_exception_type at_exception_type; |
| 18 |
struct _at_exception_type { |
| 19 |
at_msg_type msg_type; |
| 20 |
at_msg_func client_func; |
| 21 |
void ** client_data; |
| 22 |
}; |
| 23 |
|
| 24 |
at_exception_type |
| 25 |
at_exception_new(at_msg_func client_func, |
| 26 |
void * const client_data); |
| 27 |
|
| 28 |
bool |
| 29 |
at_exception_got_fatal(at_exception_type * const exception); |
| 30 |
|
| 31 |
void |
| 32 |
at_exception_fatal(at_exception_type * const exception, |
| 33 |
const char * const message); |
| 34 |
|
| 35 |
void |
| 36 |
at_exception_warning(at_exception_type * const exception, |
| 37 |
const char * const message); |
| 38 |
|
| 39 |
#ifdef __cplusplus |
| 40 |
} |
| 41 |
#endif |
| 42 |
|
| 43 |
#endif |