/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/portaudio/src/common/pa_debugprint.h
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/portaudio/src/common/pa_debugprint.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 4887 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 #ifndef PA_LOG_H
2 #define PA_LOG_H
3 /*
4 * Log file redirector function
5 * Copyright (c) 1999-2006 Ross Bencina, Phil Burk
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files
9 * (the "Software"), to deal in the Software without restriction,
10 * including without limitation the rights to use, copy, modify, merge,
11 * publish, distribute, sublicense, and/or sell copies of the Software,
12 * and to permit persons to whom the Software is furnished to do so,
13 * subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27 /*
28 * The text above constitutes the entire PortAudio license; however,
29 * the PortAudio community also makes the following non-binding requests:
30 *
31 * Any person wishing to distribute modifications to the Software is
32 * requested to send the modifications to the original developer so that
33 * they can be incorporated into the canonical version. It is also
34 * requested that these non-binding requests be included along with the
35 * license above.
36 */
37
38 /** @file
39 @ingroup common_src
40 */
41
42
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif /* __cplusplus */
47
48
49
50 void PaUtil_DebugPrint( const char *format, ... );
51
52
53 /*
54 The basic format for log messages is described below. If you need to
55 add any log messages, please follow this format.
56
57 Function entry (void function):
58
59 "FunctionName called.\n"
60
61 Function entry (non void function):
62
63 "FunctionName called:\n"
64 "\tParam1Type param1: param1Value\n"
65 "\tParam2Type param2: param2Value\n" (etc...)
66
67
68 Function exit (no return value):
69
70 "FunctionName returned.\n"
71
72 Function exit (simple return value):
73
74 "FunctionName returned:\n"
75 "\tReturnType: returnValue\n"
76
77 If the return type is an error code, the error text is displayed in ()
78
79 If the return type is not an error code, but has taken a special value
80 because an error occurred, then the reason for the error is shown in []
81
82 If the return type is a struct ptr, the struct is dumped.
83
84 See the code below for examples
85 */
86
87 /** PA_DEBUG() provides a simple debug message printing facility. The macro
88 passes it's argument to a printf-like function called PaUtil_DebugPrint()
89 which prints to stderr and always flushes the stream after printing.
90 Because preprocessor macros cannot directly accept variable length argument
91 lists, calls to the macro must include an additional set of parenthesis, eg:
92 PA_DEBUG(("errorno: %d", 1001 ));
93 */
94
95
96 #ifdef PA_ENABLE_DEBUG_OUTPUT
97 #define PA_DEBUG(x) PaUtil_DebugPrint x ;
98 #else
99 #define PA_DEBUG(x)
100 #endif
101
102
103 #ifdef PA_LOG_API_CALLS
104 #define PA_LOGAPI(x) PaUtil_DebugPrint x
105
106 #define PA_LOGAPI_ENTER(functionName) PaUtil_DebugPrint( functionName " called.\n" )
107
108 #define PA_LOGAPI_ENTER_PARAMS(functionName) PaUtil_DebugPrint( functionName " called:\n" )
109
110 #define PA_LOGAPI_EXIT(functionName) PaUtil_DebugPrint( functionName " returned.\n" )
111
112 #define PA_LOGAPI_EXIT_PAERROR( functionName, result ) \
113 PaUtil_DebugPrint( functionName " returned:\n" ); \
114 PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
115
116 #define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result ) \
117 PaUtil_DebugPrint( functionName " returned:\n" ); \
118 PaUtil_DebugPrint("\t" resultFormatString "\n", result )
119
120 #define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result ) \
121 PaUtil_DebugPrint( functionName " returned:\n" ); \
122 if( result > 0 ) \
123 PaUtil_DebugPrint("\t" positiveResultFormatString "\n", result ); \
124 else \
125 PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
126 #else
127 #define PA_LOGAPI(x)
128 #define PA_LOGAPI_ENTER(functionName)
129 #define PA_LOGAPI_ENTER_PARAMS(functionName)
130 #define PA_LOGAPI_EXIT(functionName)
131 #define PA_LOGAPI_EXIT_PAERROR( functionName, result )
132 #define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result )
133 #define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result )
134 #endif
135
136
137 typedef void (*PaUtilLogCallback ) (const char *log);
138
139 /**
140 Install user provided log function
141 */
142 void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb);
143
144
145
146 #ifdef __cplusplus
147 }
148 #endif /* __cplusplus */
149 #endif /* PA_LOG_H */

  ViewVC Help
Powered by ViewVC 1.1.22