-
Notifications
You must be signed in to change notification settings - Fork 0
/
libex_call.h
executable file
·73 lines (54 loc) · 3.49 KB
/
libex_call.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* -------------------------------------------------------------------------- */
/* (c) ali@balarabe.com [libex_call.h] */
/* -------------------------------------------------------------------------- */
/* Call Tracing and Definitions and Declarations: */
#if !defined INCLUDED_LIBEX_CALL_H
#define INCLUDED_LIBEX_CALL_H
/* -------------------------------------------------------------------------- */
#if defined LX_CALL_TRACE && LX_CALL_TRACE == 2
#define LX_GO( SRC_UID_ ) \
int src_uid = LX_CL lx_fn_call_entry(SRC_UID_, LX_FN_NAME_A, \
__FILE__, __LINE__); /*#*/
#define LX_RETURN( RETURN_VAL_ ) \
{ \
LX_CL lx_fn_call_exit(src_uid, LX_FN_NAME_A, __FILE__, __LINE__); \
return RETURN_VAL_; \
} /*#*/
/* -------------------------------------------------------------------------- */
#elif defined LX_CALL_TRACE && LX_CALL_TRACE == 1
#define LX_GO( SRC_UID_ ) \
int src_uid = SRC_UID_; \
printf("--> %s\n", LX_FN_NAME_A) /*#*/
#define LX_RETURN( RETURN_VAL_ ) \
{ src_uid--; printf("<-- %s\n", LX_FN_NAME_A); return RETURN_VAL_; } /*#*/
/* -------------------------------------------------------------------------- */
#else /* LX_CALL_TRACE == 0 */
#if defined __GNUC__ || defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#define LX_GO( SRC_UID_ ) int src_uid = SRC_UID_
#define LX_RETURN( RETURN_VAL_ ) { src_uid--; return RETURN_VAL_; }
#if defined __GNUC__ || defined __clang__
#pragma GCC diagnostic pop
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#endif /* !LX_CALL_TRACE */
/* -------------------------------------------------------------------------- */
/* Call-Tracing Function Declarations: */
#if defined LX_CALL_TRACE && LX_CALL_TRACE == 2
LX_NAMESPACE(lx_c)
LX_PUBLIC uint32_t lx_fn_call_entry( /*F*/
const uint32_t src_uid_, /*-*/
const char* source_func_, /*-*/
const char* source_file_, /*-*/
const int source_line_ ); /*-*/
LX_PUBLIC void lx_fn_call_exit( /*F*/
const uint32_t src_uid_, /*-*/
const char* source_func_, /*-*/
const char* source_file_, /*-*/
const int source_line_ ); /*-*/
LX_PUBLIC void lx_fn_call_report( void ); /*F*/
LX_END_NAMESPACE /*lx_c*/
#endif /* LX_CALL_TRACE && LX_CALL_TRACE == 2 */
#endif /*eof*/