1 | /* $Id: wpsdebug.h 7 2000-10-27 21:27:02Z umoeller $ */
|
---|
2 |
|
---|
3 | /*---------------------------------------------------------------------------+
|
---|
4 | |
|
---|
5 | | (C)opyright Dennis Bareis (developed at home, in own time) 1996 - ALL RIGHTS RESERVED
|
---|
6 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---|
7 | |
|
---|
8 | | MODULE NAME: WPSDEBUG.H
|
---|
9 | |
|
---|
10 | |
|
---|
11 | | $Author: umoeller $
|
---|
12 | | $Revision: 7 $
|
---|
13 | | $Date: 2000-10-27 21:27:02 +0000 (Fri, 27 Oct 2000) $
|
---|
14 | | $Logfile: V:/SUEPVCS/SUPPORT/TEMPLATE.H_V $
|
---|
15 | |
|
---|
16 | | DESCRIPTION: Note that any items that begin with an "I_" are for
|
---|
17 | | internal use, not for general debugging.
|
---|
18 | |
|
---|
19 | | This header file is for SOM/WPS debugging and uses
|
---|
20 | | the PMPRINTF.EXE program to display the output. Use
|
---|
21 | | of this API instead of my PMPRINTF API ensures that
|
---|
22 | | SOM/WPS messages other than those you put out (for
|
---|
23 | | example base OS/2 errors) should and will be mingled
|
---|
24 | | with your messages and hopefully being of some use!
|
---|
25 | |
|
---|
26 | | CONTACT: If you have any problems to report or better yet
|
---|
27 | | suggestions, you may email me
|
---|
28 | | at "dbareis@ozemail.com.au"...
|
---|
29 | +---------------------------------------------------------------------------*/
|
---|
30 | #ifndef HEADER_WPSDEBUG_H
|
---|
31 | #define HEADER_WPSDEBUG_H
|
---|
32 |
|
---|
33 | /*--- Need access to "PMPRINTF" ---------------------------------------------*/
|
---|
34 | #ifndef HEADER_PMPRINTF_H
|
---|
35 | #include "PMPRINTF.H"
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /*--- If C++ declare header as 'C' ------------------------------------------*/
|
---|
39 | #ifdef __cplusplus
|
---|
40 | extern "C"
|
---|
41 | {
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | /*--- Define version number -------------------------------------------------*/
|
---|
45 | #define WPSDEBUG_VERSION "96.175"
|
---|
46 |
|
---|
47 | /*--- Make sure the "__FUNCTION__" macro exists -----------------------------*/
|
---|
48 | #ifndef __FUNCTION__
|
---|
49 | #define __FUNCTION__ "FunctionUnknown(?)" //IBM CSET 2.01 and onwards support this
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | /*--- Define the maximum line length ----------------------------------------*/
|
---|
53 | #define WPSDEBUG_MAX_LINE_CHARS PMPRINTF_MAX_LINE_CHARS
|
---|
54 |
|
---|
55 |
|
---|
56 | /*--- Use this macro to turn on/off tracing ---------------------------------*/
|
---|
57 | #define WpsDebugHigh() \
|
---|
58 | WpsDebugInstall(WPSDEBUG_TLEVEL_CORE_AND_USER, PMPRINTF_ALL_HEADER_FIELDS_EXCEPT_TIME)
|
---|
59 | #define WpsDebugInstall(TraceLevel, PmprintfMode) \
|
---|
60 | I_WpsDebugInstall(TraceLevel, PmprintfMode, (void *)&SOMOutCharRoutine, &SOM_TraceLevel)
|
---|
61 |
|
---|
62 |
|
---|
63 | /*--- Better debug macro ----------------------------------------------------*/
|
---|
64 | #define WpsDebug(FmtAndVariableParmsInBrackets) \
|
---|
65 | do \
|
---|
66 | { \
|
---|
67 | /*--- Don't do anything if debugging is not turned on -----------*/ \
|
---|
68 | if (SOM_TraceLevel != 0) \
|
---|
69 | { \
|
---|
70 | /*--- Output a header ---------------------------------------*/ \
|
---|
71 | I_WpsDebugOutputModuleIdHeader(__FILE__, __LINE__, NULL); \
|
---|
72 | \
|
---|
73 | /*--- Output the message ------------------------------------*/ \
|
---|
74 | somPrintf FmtAndVariableParmsInBrackets; \
|
---|
75 | } \
|
---|
76 | } \
|
---|
77 | while (0)
|
---|
78 | #define WpsDebugF(FmtAndVariableParmsInBrackets) \
|
---|
79 | do \
|
---|
80 | { \
|
---|
81 | /*--- Don't do anything if debugging is not turned on -----------*/ \
|
---|
82 | if (SOM_TraceLevel != 0) \
|
---|
83 | { \
|
---|
84 | /*--- Output a header ---------------------------------------*/ \
|
---|
85 | I_WpsDebugOutputModuleIdHeader(__FILE__, __LINE__, __FUNCTION__);\
|
---|
86 | \
|
---|
87 | /*--- Output the message ------------------------------------*/ \
|
---|
88 | somPrintf FmtAndVariableParmsInBrackets; \
|
---|
89 | } \
|
---|
90 | } \
|
---|
91 | while (0)
|
---|
92 |
|
---|
93 | /*--- Simple to use "Here I am" macros --------------------------------------*/
|
---|
94 | #ifndef WPSDEBUG_HERE_I_AM_MSG
|
---|
95 | #define WPSDEBUG_HERE_I_AM_MSG " Here I am"
|
---|
96 | #endif
|
---|
97 | #define WpsDebugHereIAm() WpsDebugF((WPSDEBUG_HERE_I_AM_MSG "\n"))
|
---|
98 |
|
---|
99 |
|
---|
100 | /*--- Method starting & stopping macros -------------------------------------*/
|
---|
101 | #define WpsDebugMethodStart() WpsDebugF(("Method Starting" "\n"))
|
---|
102 | #define WpsDebugMethodEnd() WpsDebugF(("Method ending" "\n"))
|
---|
103 |
|
---|
104 |
|
---|
105 | /*--- The following macros allow you to conditionly include debug code ------*/
|
---|
106 | #ifdef _WPSDEBUG_
|
---|
107 | /*--- The user wants to include these debug lines -------------------*/
|
---|
108 | #define _WpsDebugHigh() WpsDebugHigh()
|
---|
109 | #define _WpsDebugInstall(TraceLevel, PmprintfMode) WpsDebugInstall(TraceLevel, PmprintfMode)
|
---|
110 | #define _WpsDebug(FmtAndVariableParmsInBrackets) WpsDebug(FmtAndVariableParmsInBrackets)
|
---|
111 | #define _WpsDebugF(FmtAndVariableParmsInBrackets) WpsDebugF(FmtAndVariableParmsInBrackets)
|
---|
112 | #define _WpsDebugHereIAm() WpsDebugHereIAm()
|
---|
113 | #define _WpsDebugMethodStart() WpsDebugMethodStart()
|
---|
114 | #define _WpsDebugMethodEnd() WpsDebugMethodEnd()
|
---|
115 | #else
|
---|
116 | /*--- The user does not wish to include the debug stuff -------------*/
|
---|
117 | #define _WpsDebugHigh()
|
---|
118 | #define _WpsDebugInstall(TraceLevel, PmprintfMode)
|
---|
119 | #define _WpsDebug(FmtAndVariableParmsInBrackets)
|
---|
120 | #define _WpsDebugF(FmtAndVariableParmsInBrackets)
|
---|
121 | #define _WpsDebugHereIAm()
|
---|
122 | #define _WpsDebugMethodStart()
|
---|
123 | #define _WpsDebugMethodEnd()
|
---|
124 | #endif
|
---|
125 |
|
---|
126 |
|
---|
127 | /*--- Definitions for "WPSDEBUG.C" ------------------------------------------*/
|
---|
128 | void _Optlink I_WpsDebugOutputModuleIdHeader(UCHAR *SourceModule, int LineNumber, UCHAR *Function);
|
---|
129 | void _Optlink I_WpsDebugInstall( int TraceLevel,
|
---|
130 | #define WPSDEBUG_TLEVEL_NONE 0
|
---|
131 | #define WPSDEBUG_TLEVEL_USER 1
|
---|
132 | #define WPSDEBUG_TLEVEL_CORE_AND_USER 2
|
---|
133 | PMPRINTF_MODE PmprintfMode,
|
---|
134 | void * *AddressOfSOMOutCharRoutine,
|
---|
135 | int * AddressOfSOM_TraceLevel
|
---|
136 | );
|
---|
137 | void _Optlink WpsDebugPmMsgBox( UCHAR * Title,
|
---|
138 | UCHAR * Format,
|
---|
139 | ...
|
---|
140 | );
|
---|
141 |
|
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 | /*--- Override the default "SOMMethodDebug()" macro -------------------------*/
|
---|
146 | #define WPSDEBUG_SOMMETHODDEBUG(ClassName, MethodName) \
|
---|
147 | _WpsDebugF(("Class = \"%s\"\n", ClassName)) /* Default action */
|
---|
148 | #ifdef SOMMethodDebug
|
---|
149 | #undef SOMMethodDebug
|
---|
150 | #endif
|
---|
151 | #define SOMMethodDebug(ClassName, MethodName) \
|
---|
152 | WPSDEBUG_SOMMETHODDEBUG(ClassName, MethodName);
|
---|
153 |
|
---|
154 |
|
---|
155 | /*--- If C++ end declaration of header as 'C' -------------------------------*/
|
---|
156 | #ifdef __cplusplus
|
---|
157 | }
|
---|
158 | #endif
|
---|
159 | #endif
|
---|
160 |
|
---|
161 |
|
---|