00001 #ifndef PA_LOG_H
00002 #define PA_LOG_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00043 #ifdef __cplusplus
00044 extern "C"
00045 {
00046 #endif
00047
00048
00049
00050 void PaUtil_DebugPrint( const char *format, ... );
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00096 #ifdef PA_ENABLE_DEBUG_OUTPUT
00097 #define PA_DEBUG(x) PaUtil_DebugPrint x ;
00098 #else
00099 #define PA_DEBUG(x)
00100 #endif
00101
00102
00103 #ifdef PA_LOG_API_CALLS
00104 #define PA_LOGAPI(x) PaUtil_DebugPrint x
00105
00106 #define PA_LOGAPI_ENTER(functionName) PaUtil_DebugPrint( functionName " called.\n" )
00107
00108 #define PA_LOGAPI_ENTER_PARAMS(functionName) PaUtil_DebugPrint( functionName " called:\n" )
00109
00110 #define PA_LOGAPI_EXIT(functionName) PaUtil_DebugPrint( functionName " returned.\n" )
00111
00112 #define PA_LOGAPI_EXIT_PAERROR( functionName, result ) \
00113 PaUtil_DebugPrint( functionName " returned:\n" ); \
00114 PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
00115
00116 #define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result ) \
00117 PaUtil_DebugPrint( functionName " returned:\n" ); \
00118 PaUtil_DebugPrint("\t" resultFormatString "\n", result )
00119
00120 #define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result ) \
00121 PaUtil_DebugPrint( functionName " returned:\n" ); \
00122 if( result > 0 ) \
00123 PaUtil_DebugPrint("\t" positiveResultFormatString "\n", result ); \
00124 else \
00125 PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
00126 #else
00127 #define PA_LOGAPI(x)
00128 #define PA_LOGAPI_ENTER(functionName)
00129 #define PA_LOGAPI_ENTER_PARAMS(functionName)
00130 #define PA_LOGAPI_EXIT(functionName)
00131 #define PA_LOGAPI_EXIT_PAERROR( functionName, result )
00132 #define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result )
00133 #define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result )
00134 #endif
00135
00136
00137 typedef void (*PaUtilLogCallback ) (const char *log);
00138
00142 void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb);
00143
00144
00145
00146 #ifdef __cplusplus
00147 }
00148 #endif
00149 #endif