rtxDiag.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2010 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00028 #ifndef _RTXDIAG_H_
00029 #define _RTXDIAG_H_
00030 
00031 #include <stdarg.h>
00032 #include "rtxsrc/rtxContext.h"
00033 #include "rtxsrc/rtxPrintToStream.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 /* Diagnostic trace functions */
00052 #ifdef _TRACE
00053 #define RTDIAG1(pctxt,msg)              rtxDiagPrint(pctxt,msg)
00054 #define RTDIAG2(pctxt,msg,a)            rtxDiagPrint(pctxt,msg,a)
00055 #define RTDIAG3(pctxt,msg,a,b)          rtxDiagPrint(pctxt,msg,a,b)
00056 #define RTDIAG4(pctxt,msg,a,b,c)        rtxDiagPrint(pctxt,msg,a,b,c)
00057 #define RTDIAG5(pctxt,msg,a,b,c,d)      rtxDiagPrint(pctxt,msg,a,b,c,d)
00058 #define RTDIAGU(pctxt,ucstr)            rtxDiagPrintUCS(pctxt,ucstr)
00059 #define RTHEXDUMP(pctxt,buffer,numocts) rtxDiagHexDump(pctxt,buffer,numocts)
00060 #define RTDIAGCHARS(pctxt,buf,nchars)   rtxDiagPrintChars(pctxt,buf,nchars)
00061 
00062 #ifndef _NO_STREAM
00063 
00064 #define RTDIAGSTRM2(pctxt,msg)          rtxDiagStream(pctxt,msg)
00065 #define RTDIAGSTRM3(pctxt,msg,a)        rtxDiagStream(pctxt,msg,a)
00066 #define RTDIAGSTRM4(pctxt,msg,a,b)      rtxDiagStream(pctxt,msg,a,b)
00067 #define RTDIAGSTRM5(pctxt,msg,a,b,c)    rtxDiagStream(pctxt,msg,a,b,c)
00068 #define RTHEXDUMPSTRM(pctxt,buffer,numocts) \
00069 rtxDiagStreamHexDump(pctxt,buffer,numocts)
00070 #define RTDIAGSCHARS(pctxt,buf,nchars) \
00071 rtxDiagStreamPrintChars(pctxt,buf,nchars)
00072 
00073 #else /* _NO_STREAM */
00074 
00075 #define RTDIAGSTRM2(pctxt,msg)          rtxDiagPrint(pctxt,msg)
00076 #define RTDIAGSTRM3(pctxt,msg,a)        rtxDiagPrint(pctxt,msg,a)
00077 #define RTDIAGSTRM4(pctxt,msg,a,b)      rtxDiagPrint(pctxt,msg,a,b)
00078 #define RTDIAGSTRM5(pctxt,msg,a,b,c)    rtxDiagPrint(pctxt,msg,a,b,c)
00079 #define RTHEXDUMPSTRM(pctxt,buffer,numocts) rtxDiagHexDump(pctxt,buffer,numocts)
00080 #define RTDIAGSCHARS(pctxt,buf,nchars)  rtxDiagPrintChars(pctxt,buf,nchars)
00081 
00082 #endif /* _NO_STREAM */
00083 
00084 #else /* _TRACE */
00085 
00086 #define RTDIAG1(pctxt,msg)
00087 #define RTDIAG2(pctxt,msg,a)
00088 #define RTDIAG3(pctxt,msg,a,b)
00089 #define RTDIAG4(pctxt,msg,a,b,c)
00090 #define RTDIAG5(pctxt,msg,a,b,c,d)
00091 #define RTDIAGU(pctxt,ucstr)
00092 #define RTHEXDUMP(pctxt,buffer,numocts)
00093 #define RTDIAGCHARS(pctxt,buf,nchars)
00094 
00095 #define RTDIAGSTRM2(pctxt,msg)
00096 #define RTDIAGSTRM3(pctxt,msg,a)
00097 #define RTDIAGSTRM4(pctxt,msg,a,b)
00098 #define RTDIAGSTRM5(pctxt,msg,a,b,c)
00099 #define RTHEXDUMPSTRM(pctxt,buffer,numocts)
00100 #define RTDIAGSCHARS(pctxt,buf,nchars)
00101 
00102 #endif /* _TRACE */
00103 
00104 typedef enum {
00105    OSRTDiagError,
00106    OSRTDiagWarning,
00107    OSRTDiagInfo,
00108    OSRTDiagDebug
00109 } OSRTDiagTraceLevel;
00110 
00119 EXTERNRT OSBOOL rtxDiagEnabled (OSCTXT* pctxt);
00120 
00133 EXTERNRT OSBOOL rtxSetDiag (OSCTXT* pctxt, OSBOOL value);
00134 
00135 #ifndef __SYMBIAN32__
00136 
00145 EXTERNRT OSBOOL rtxSetGlobalDiag (OSBOOL value);
00146 #endif
00147 
00166 EXTERNRT void rtxDiagPrint (OSCTXT* pctxt, const char* fmtspec, ...);
00167 
00168 #ifndef _NO_STREAM
00169 
00178 EXTERNRT void rtxDiagStream (OSCTXT* pctxt, const char* fmtspec, ...);
00179 #endif /* _NO_STREAM */
00180 
00189 EXTERNRT void rtxDiagHexDump
00190 (OSCTXT* pctxt, const OSOCTET* data, OSUINT32 numocts);
00191 
00192 #ifndef _NO_STREAM
00193 
00201 EXTERNRT void rtxDiagStreamHexDump
00202 (OSCTXT* pctxt, const OSOCTET* data, OSUINT32 numocts);
00203 #endif /* _NO_STREAM */
00204 
00215 EXTERNRT void rtxDiagPrintChars
00216 (OSCTXT* pctxt, const char* data, OSUINT32 nchars);
00217 
00218 #ifndef _NO_STREAM
00219 
00229 EXTERNRT void rtxDiagStreamPrintChars
00230 (OSCTXT* pctxt, const char* data, OSUINT32 nchars);
00231 #endif /* _NO_STREAM */
00232 
00243 EXTERNRT void rtxDiagSetTraceLevel (OSCTXT* pctxt, OSRTDiagTraceLevel level);
00244 
00249 #ifdef __cplusplus
00250 }
00251 #endif
00252 
00253 #endif