File: exception.c

package info (click to toggle)
autotrace 0.31.1-13
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 2,496 kB
  • ctags: 1,202
  • sloc: ansic: 12,595; sh: 8,311; makefile: 204
file content (49 lines) | stat: -rw-r--r-- 968 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* Def: HAVE_CONFIG_H */

#include "exception.h"

at_exception_type
at_exception_new(at_msg_func client_func,
		 at_address client_data)
{
  at_exception_type e = {0, client_func, client_data};
  return e;
}

at_bool
at_exception_got_fatal(at_exception_type * exception)
{
  return (exception->msg_type == AT_MSG_FATAL);
}

void
at_exception_fatal(at_exception_type * exception,
		   const at_string message)
{
  if (!exception)
    return;
  exception->msg_type = AT_MSG_FATAL;
  if (exception->client_func)
    {
      exception->client_func(message, 
			     AT_MSG_FATAL,
			     exception->client_data);
    }
}

void 
at_exception_warning(at_exception_type * exception,
		     const at_string message)
{
  if (!exception)
    return;
  exception->msg_type = AT_MSG_WARNING;
  if (exception->client_func)
    {
      exception->client_func(message, 
			     AT_MSG_WARNING,
			     exception->client_data);
    }
}