Go to the documentation of this file.
18 #ifndef LIBCWD_MACRO_LIBCWD_MACROS_H
19 #define LIBCWD_MACRO_LIBCWD_MACROS_H
21 #ifndef LIBCWD_CONFIG_H
31 #define LIBCWD_ASSERT_NOT_INTERNAL LIBCWD_ASSERT(!__libcwd_tsd.internal)
33 #define LIBCWD_ASSERT_NOT_INTERNAL
48 #define LibcwDebug(dc_namespace, x) \
50 using namespace ::libcwd; \
51 using namespace dc_namespace; \
62 #ifndef LIBCWD_LibcwDoutScopeBegin_MARKER
63 #if CWDEBUG_DEBUGOUTPUT
64 #include <sys/types.h>
65 extern "C" ssize_t write(
int fd,
const void *buf,
size_t count);
66 #define LIBCWD_STR1(x) #x
67 #define LIBCWD_STR2(x) LIBCWD_STR1(x)
68 #define LIBCWD_STR3 "LibcwDout at " __FILE__ ":" LIBCWD_STR2(__LINE__) "\n"
69 #define LIBCWD_LibcwDoutScopeBegin_MARKER LibcwDebugThreads( ++__libcwd_tsd.internal_debugging_code ); ::write(2, LIBCWD_STR3, sizeof(LIBCWD_STR3) - 1); LibcwDebugThreads( --__libcwd_tsd.internal_debugging_code )
70 #else // !CWDEBUG_DEBUGOUTPUT
71 #define LIBCWD_LibcwDoutScopeBegin_MARKER
72 #endif // !CWDEBUG_DEBUGOUTPUT
73 #endif // !LIBCWD_LibcwDoutScopeBegin_MARKER
83 #define LibcwDout( dc_namespace, debug_obj, cntrl, data ) \
84 LibcwDoutScopeBegin(dc_namespace, debug_obj, cntrl) \
85 LibcwDoutStream << data; \
88 #define LibcwDoutScopeBegin( dc_namespace, debug_obj, cntrl ) \
91 LIBCWD_TSD_DECLARATION; \
92 LIBCWD_ASSERT_NOT_INTERNAL; \
93 LIBCWD_LibcwDoutScopeBegin_MARKER; \
94 if (LIBCWD_DO_TSD_MEMBER_OFF(debug_obj) < 0) \
96 using namespace ::libcwd; \
97 ::libcwd::channel_set_bootstrap_st __libcwd_channel_set(LIBCWD_DO_TSD(debug_obj) LIBCWD_COMMA_TSD); \
100 using namespace dc_namespace; \
101 on = (__libcwd_channel_set|cntrl).on; \
105 ::libcwd::debug_ct& __libcwd_debug_object(debug_obj); \
106 LIBCWD_DO_TSD(__libcwd_debug_object).start(__libcwd_debug_object, __libcwd_channel_set LIBCWD_COMMA_TSD);
109 #define LibcwDoutStream \
110 (*LIBCWD_DO_TSD_MEMBER(__libcwd_debug_object, current_bufferstream))
112 #define LibcwDoutScopeEnd \
113 LIBCWD_DO_TSD(__libcwd_debug_object).finish(__libcwd_debug_object, __libcwd_channel_set LIBCWD_COMMA_TSD); \
123 #ifndef LIBCWD_LibcwDoutFatalScopeBegin_MARKER
124 #if CWDEBUG_DEBUGOUTPUT
125 #define LIBCWD_STR4 "LibcwDoutFatal at " __FILE__ ":" LIBCWD_STR2(__LINE__) "\n"
126 #define LIBCWD_LibcwDoutFatalScopeBegin_MARKER LibcwDebugThreads( ++__libcwd_tsd.internal_debugging_code ); ::write(2, LIBCWD_STR4, sizeof(LIBCWD_STR4) - 1); LibcwDebugThreads( --__libcwd_tsd.internal_debugging_code )
128 #define LIBCWD_LibcwDoutFatalScopeBegin_MARKER
130 #endif // !LIBCWD_LibcwDoutFatalScopeBegin_MARKER
140 #define LibcwDoutFatal( dc_namespace, debug_obj, cntrl, data ) \
141 LibcwDoutFatalScopeBegin(dc_namespace, debug_obj, cntrl) \
142 LibcwDoutFatalStream << data; \
143 LibcwDoutFatalScopeEnd
145 #define LibcwDoutFatalScopeBegin( dc_namespace, debug_obj, cntrl ) \
148 LIBCWD_TSD_DECLARATION; \
149 LIBCWD_LibcwDoutFatalScopeBegin_MARKER; \
150 using namespace ::libcwd; \
151 ::libcwd::channel_set_bootstrap_fatal_st __libcwd_channel_set(LIBCWD_DO_TSD(debug_obj) LIBCWD_COMMA_TSD); \
153 using namespace dc_namespace; \
154 __libcwd_channel_set|cntrl; \
156 ::libcwd::debug_ct& __libcwd_debug_object(debug_obj); \
157 LIBCWD_DO_TSD(__libcwd_debug_object).start(__libcwd_debug_object, __libcwd_channel_set LIBCWD_COMMA_TSD);
159 #define LibcwDoutFatalStream LibcwDoutStream
161 #define LibcwDoutFatalScopeEnd \
162 LIBCWD_DO_TSD(__libcwd_debug_object).fatal_finish(__libcwd_debug_object, __libcwd_channel_set LIBCWD_COMMA_TSD); \
165 #endif // LIBCWD_MACRO_LIBCWD_MACROS_H
Copyright © 2001 - 2004 Carlo Wood. All rights reserved.