file: exception_stderr.h
1
#include <stdio.h>
2
#include <errno.h>
3
4
#ifdef raise
5
#undef raise
6
#endif
7
#define /*X*/ raise(action, error_no, fmt, args...) { \
8
if ( (error_no) ) { \
9
errno = (EXCP_MOD) | (error_no); \
10
fprintf(stderr,"error:%s:%d:%s:", __FILE__,__LINE__,__FUNCTION__); \
11
fprintf(stderr, fmt, ##args); fprintf(stderr, "\n"); \
12
action; \
13
} }
14
15
#ifdef relay
16
#undef relay
17
#endif
18
#define /*X*/ relay(action, fmt, args...) { \
19
if ( errno ) { \
20
fprintf(stderr,"error:%s:%d:%s:", __FILE__,__LINE__,__FUNCTION__); \
21
fprintf(stderr, fmt, ##args); fprintf(stderr, "\n"); \
22
action; \
23
} }
24
#ifdef excp_assert
25
#undef excp_assert
26
#endif
27
#define /*X*/ excp_assert(action, error_no, expression) { \
28
if ( !(expression) ) { \
29
(errno = (EXCP_MOD) | (error_no));\
30
fprintf(stderr,"error:%s:%d:%s:assert failled for %s\n", __FILE__,__LINE__,__FUNCTION__, #expression); \
31
action; \
32
} \
33
}
34
C to HTML Conversion by ctoohtml