rtxError.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 __RTXERROR_H__
00029 #define __RTXERROR_H__
00030 
00031 #include "rtxsrc/rtxContext.h"
00032 #include "rtxsrc/rtxErrCodes.h"
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 /* Error handling */
00039 
00057 #ifndef _COMPACT
00058 
00059 #ifndef __MODULE__
00060 #define LOG_RTERR(pctxt,stat) \
00061 rtxErrSetData(pctxt,stat,__FILE__,__LINE__)
00062 
00063 #define LOG_RTERRNEW(pctxt,stat) \
00064 rtxErrSetNewData(pctxt,stat,__FILE__,__LINE__)
00065 
00066 #else /* Should significantly decrease use of RAM in ARM systems */
00067 #define LOG_RTERR(pctxt,stat) \
00068 rtxErrSetData(pctxt,stat,__MODULE__,__LINE__)
00069 
00070 #define LOG_RTERRNEW(pctxt,stat) \
00071 rtxErrSetNewData(pctxt,stat,__MODULE__,__LINE__)
00072 #endif /* not defined __MODULE__ */
00073 
00082 #define OSRTASSERT(condition) \
00083 if (!(condition)) { rtxErrAssertionFailed(#condition,__LINE__,__FILE__); }
00084 
00091 #define OSRTCHECKPARAM(condition) if (condition) { /* do nothing */ }
00092 #else
00093 #define LOG_RTERR(pctxt,stat) \
00094 rtxErrSetData(pctxt,stat,0,0)
00095 
00096 #define LOG_RTERRNEW(pctxt,stat) \
00097 rtxErrSetNewData(pctxt,stat,0,0)
00098 
00099 #define OSRTASSERT(condition)
00100 #define OSRTCHECKPARAM(condition)
00101 #endif /* _COMPACT */
00102 
00103 #define LOG_RTERR1(pctxt,stat,a) \
00104 (a,LOG_RTERR (pctxt, stat),stat)
00105 
00106 #define LOG_RTERRNEW1(pctxt,stat,a) \
00107 (a,LOG_RTERRNEW (pctxt, stat),stat)
00108 
00109 #define LOG_RTERR2(pctxt,stat,a,b) \
00110 (a,b,LOG_RTERR (pctxt, stat),stat)
00111 
00112 #define LOG_RTERRNEW2(pctxt,stat,a,b) \
00113 (a,b,LOG_RTERRNEW (pctxt, stat),stat)
00114 
00115 
00116 typedef int (*OSErrCbFunc) (const char* ptext, void* cbArg_p);
00117 
00127 EXTERNRT OSBOOL rtxErrAddCtxtBufParm (OSCTXT* pctxt);
00128 
00138 EXTERNRT OSBOOL rtxErrAddDoubleParm (OSCTXT* pctxt, double errParm);
00139 
00152 EXTERNRT OSBOOL rtxErrAddErrorTableEntry
00153 #if !defined(_ARMTCC) && !defined(__SYMBIAN32__)
00154 (const char* const* ppStatusText, OSINT32 minErrCode, OSINT32 maxErrCode);
00155 #else
00156 ();
00157 #endif
00158 
00169 EXTERNRT OSBOOL rtxErrAddElemNameParm (OSCTXT* pctxt);
00170 
00183 EXTERNRT OSBOOL rtxErrAddIntParm (OSCTXT* pctxt, int errParm);
00184 
00185 #if !defined(_NO_INT64_SUPPORT)
00186 
00199 EXTERNRT OSBOOL rtxErrAddInt64Parm (OSCTXT* pctxt, OSINT64 errParm);
00200 #endif /* !defined(_NO_INT64_SUPPORT) */
00201 
00211 EXTERNRT OSBOOL rtxErrAddStrParm (OSCTXT* pctxt, const char* pErrParm);
00212 
00223 EXTERNRT OSBOOL rtxErrAddStrnParm
00224    (OSCTXT* pctxt, const char* pErrParm, size_t nchars);
00225 
00235 EXTERNRT OSBOOL rtxErrAddUniStrParm (OSCTXT* pctxt,
00236                                       const OSUNICHAR* pErrParm);
00237 
00247 EXTERNRT OSBOOL rtxErrAddUIntParm (OSCTXT* pctxt, unsigned int errParm);
00248 
00249 #if !defined(_NO_INT64_SUPPORT)
00250 
00259 EXTERNRT OSBOOL rtxErrAddUInt64Parm (OSCTXT* pctxt, OSUINT64 errParm);
00260 #endif /* !defined(_NO_INT64_SUPPORT) */
00261 
00272 EXTERNRT void rtxErrAssertionFailed
00273 (const char* conditionText, int lineNo, const char* fileName);
00274 
00284 EXTERNRT const char* rtxErrFmtMsg
00285 (OSRTErrInfo* pErrInfo, char* bufp, size_t bufsiz);
00286 
00294 EXTERNRT void rtxErrFreeParms (OSCTXT* pctxt);
00295 
00315 EXTERNRT char* rtxErrGetText (OSCTXT* pctxt, char* pBuf, size_t* pBufSize);
00316 
00326 EXTERNRT char* rtxErrGetTextBuf (OSCTXT* pctxt, char* pbuf, size_t bufsiz);
00327 
00337 EXTERNRT OSRTErrInfo* rtxErrNewNode (OSCTXT* pctxt);
00338 
00345 EXTERNRT void rtxErrInit ();
00346 
00354 EXTERNRT int rtxErrReset (OSCTXT* pctxt);
00355 
00373 EXTERNRT void rtxErrLogUsingCB (OSCTXT* pctxt, OSErrCbFunc cb, void* cbArg_p);
00374 
00382 EXTERNRT void rtxErrPrint (OSCTXT* pctxt);
00383 
00391 EXTERNRT void rtxErrPrintElement (OSRTErrInfo* pErrInfo);
00392 
00404 EXTERNRT int rtxErrSetData (OSCTXT* pctxt, int status,
00405                              const char* module, int lineno);
00406 
00418 EXTERNRT int rtxErrSetNewData (OSCTXT* pctxt, int status,
00419                                 const char* module, int lineno);
00426 EXTERNRT int rtxErrGetFirstError (const OSCTXT* pctxt);
00427 
00434 EXTERNRT int rtxErrGetLastError (const OSCTXT* pctxt);
00435 
00442 EXTERNRT OSUINT32 rtxErrGetErrorCnt (const OSCTXT* pctxt);
00443 
00454 EXTERNRT int rtxErrGetStatus (const OSCTXT* pctxt);
00455 
00466 EXTERNRT int rtxErrResetLastErrors (OSCTXT* pctxt, int errorsToReset);
00467 
00472 #ifdef __cplusplus
00473 }
00474 #endif
00475 
00476 #endif