Debian Codegraph @

converter/other/pamtosvg/exception.c

raw
1 #include "exception.h"
2
3 at_exception_type
4 at_exception_new(at_msg_func client_func,
5 void * const client_data) {
6
7 at_exception_type e;
8
9 e.msg_type = 0;
10 e.client_func = client_func;
11 e.client_data = client_data;
12
13 return e;
14 }
15
16
17
18 bool
19 at_exception_got_fatal(at_exception_type * const exception) {
20
21 return (exception->msg_type == AT_MSG_FATAL);
22 }
23
24
25
26 void
27 at_exception_fatal(at_exception_type * const exception,
28 const char * const message) {
29
30 if (exception) {
31 exception->msg_type = AT_MSG_FATAL;
32 if (exception->client_func) {
33 exception->client_func(message,
34 AT_MSG_FATAL,
35 exception->client_data);
36 }
37 }
38 }
39
40
41
42 void
43 at_exception_warning(at_exception_type * const exception,
44 const char * const message) {
45
46 if (exception) {
47 exception->msg_type = AT_MSG_WARNING;
48 if (exception->client_func) {
49 exception->client_func(message,
50 AT_MSG_WARNING,
51 exception->client_data);
52 }
53 }
54 }
55
56
57