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 #include "types.h"
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif /* __cplusplus */
12 
13 /* Protocol:
14    If a function raises a FATAL(including propagation),
15    the function must release resources allocated by the
16    function itself. */
17 typedef struct _at_exception_type at_exception_type;
18 struct _at_exception_type
19 {
20   at_msg_type msg_type;
21   at_msg_func client_func;
22   at_address * client_data;
23 };
24 
25 at_exception_type at_exception_new(at_msg_func client_func,
26 				   at_address client_data);
27 at_bool at_exception_got_fatal(at_exception_type * exception);
28 void at_exception_fatal(at_exception_type * exception,
29 			const at_string message);
30 void at_exception_warning(at_exception_type * exception,
31 			  const at_string message);
32 
33 #ifdef __cplusplus
34 }
35 #endif /* __cplusplus */
36 
37 #endif /* Not def: AT_EXCEPTION_H */
38