-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibex_debug.h
More file actions
executable file
·62 lines (49 loc) · 2.65 KB
/
Copy pathlibex_debug.h
File metadata and controls
executable file
·62 lines (49 loc) · 2.65 KB
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
/* -------------------------------------------------------------------------- */
/* (c) ali@balarabe.com [libex_debug.h] */
/* -------------------------------------------------------------------------- */
/* Don't include this in projects directly. Instead, include libex.h */
#if !defined INCLUDED_LIBEX_DEBUG_H
#define INCLUDED_LIBEX_DEBUG_H
#include "libex.h"
/* -------------------------------------------------------------------------- */
LX_NAMESPACE(lx_c)
/* -------------------------------------------------------------------------- */
/* Debugging: */
#undef LX_DEBUG_BREAK
#if defined _MSC_VER && (defined DEBUG || defined _DEBUG)
#define LX_DEBUG_BREAK __debugbreak();
#else
#define LX_DEBUG_BREAK ;
#endif
#if !defined LX_DEBUG_WARN
#if (defined DEBUG || defined _DEBUG) || defined LX_DEBUG
#define LX_DEBUG_WARN( MESSAGE_, SRC_UID_ ) LX_DEBUG_BREAK
#else
#define LX_DEBUG_WARN( MESSAGE_, SRC_UID_ )
#endif
#endif /* !LX_DEBUG_WARN */
#if LX_PLATFORM_LINUX
#define LX_DEBUG_LOG_FILE "./libex_debug.log"
#endif
#if LX_PLATFORM_WIN32
#define LX_DEBUG_LOG_FILE "X:\\libex_debug.log"
#endif
#if LX_PLATFORM_LINUX
#define LX_DUMP_OPEN /*F*/\
{ \
FILE* debug_log_file = FOPEN(LX_DEBUG_LOG_FILE, "a+"); /*#*/
#endif /* LX_PLATFORM_WIN32 */
#if LX_PLATFORM_WIN32
#define LX_DUMP_OPEN /*F*/\
{ \
FILE* debug_log_file \
= lx_fsopen(LX_DEBUG_LOG_FILE, "a+", _SH_DENYNO); /*#*/
#endif /* LX_PLATFORM_WIN32 */
#define LX_DUMP( FORMAT_, ... ) /*F*/\
PRINTF_T(FORMAT_, ## __VA_ARGS__); \
FPRINTF_T(debug_log_file, FORMAT_, ## __VA_ARGS__); /*#*/
#define LX_DUMP_CLOSE /*F*/\
fclose(debug_log_file); \
} /*#*/
LX_END_NAMESPACE /*lx_c*/
#endif /*eof*/