ASN1C C/C++ Common Runtime  ASN1C v7.2.x
rtxError.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2018 Objective Systems, Inc.
3  *
4  * This software is furnished under a license and may be used and copied
5  * only in accordance with the terms of such license and with the
6  * inclusion of the above copyright notice. This software or any other
7  * copies thereof may not be provided or otherwise made available to any
8  * other person. No title to and ownership of the software is hereby
9  * transferred.
10  *
11  * The information in this software is subject to change without notice
12  * and should not be construed as a commitment by Objective Systems, Inc.
13  *
14  * PROPRIETARY NOTICE
15  *
16  * This software is an unpublished work subject to a confidentiality agreement
17  * and is protected by copyright and trade secret law. Unauthorized copying,
18  * redistribution or other use of this work is prohibited.
19  *
20  * The above notice of copyright on this source code product does not indicate
21  * any actual or intended publication of such source code.
22  *
23  *****************************************************************************/
28 #ifndef __RTXERROR_H__
29 #define __RTXERROR_H__
30 
31 #include "rtxsrc/rtxContext.h"
32 #include "rtxsrc/rtxErrCodes.h"
33 
34 /* errno.h is supported on both windows and UNIX, though the values in UNIX
35  * systems are usually extended. The VC++ compiler has its own thread-safe
36  * version when building the DLLs, so we avoid defining errno in this case;
37  * see http://cygwin.com/ml/pthreads-win32/2001/msg00047.html; also, WinCE
38  * has its own version, apparently. */
39 #if !defined(_DLL) && !defined(_MT) && !defined(_WIN32_WCE)
40 #include <errno.h>
41 /* extern int errno; //okay for older UNIXes but not for newer */
42 #endif
43 
44 /* Define a cross-platform way to get the error number. */
45 #if defined(_WIN32) || defined(_WIN64)
46 #define ERRNO WSAGetLastError()
47 #elif !defined (_WIN32_WCE)
48 #define ERRNO errno
49 #else
50 #define ERRNO -1 /* must be an int */
51 #endif
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /* Error handling */
58 
76 #ifndef _COMPACT
77 
78 #ifndef __MODULE__
79 #define LOG_RTERR(pctxt,stat) \
80 rtxErrSetData(pctxt,stat,__FILE__,__LINE__)
81 
82 #define LOG_RTERRNEW(pctxt,stat) \
83 rtxErrSetNewData(pctxt,stat,__FILE__,__LINE__)
84 
85 #else /* Should significantly decrease use of RAM in ARM systems */
86 #define LOG_RTERR(pctxt,stat) \
87 rtxErrSetData(pctxt,stat,__MODULE__,__LINE__)
88 
89 #define LOG_RTERRNEW(pctxt,stat) \
90 rtxErrSetNewData(pctxt,stat,__MODULE__,__LINE__)
91 #endif /* not defined __MODULE__ */
92 
93 
102 #define OSRTASSERT(condition) \
103 if (!(condition)) { rtxErrAssertionFailed(#condition,__LINE__,__FILE__); }
104 
111 #define OSRTCHECKPARAM(condition) if (condition) { /* do nothing */ }
112 #else
113 #define LOG_RTERR(pctxt,stat) \
114 rtxErrSetData(pctxt,stat,0,0)
115 
116 #define LOG_RTERRNEW(pctxt,stat) \
117 rtxErrSetNewData(pctxt,stat,0,0)
118 
119 #define OSRTASSERT(condition)
120 #define OSRTCHECKPARAM(condition)
121 #endif /* _COMPACT */
122 
123 #define LOG_RTERR1(pctxt,stat,a) \
124 (a,LOG_RTERR (pctxt, stat),stat)
125 
126 #define LOG_RTERRNEW1(pctxt,stat,a) \
127 (a,LOG_RTERRNEW (pctxt, stat),stat)
128 
129 #define LOG_RTERR2(pctxt,stat,a,b) \
130 (a,b,LOG_RTERR (pctxt, stat),stat)
131 
132 #define LOG_RTERRNEW2(pctxt,stat,a,b) \
133 (a,b,LOG_RTERRNEW (pctxt, stat),stat)
134 
145 #define LOG_RTERR_AND_FREE_MEM(ctxt_p,stat,mem_p) \
146 rtxMemFreePtr ((ctxt_p),(mem_p)), LOG_RTERR(ctxt_p, stat)
147 
148 typedef int (*OSErrCbFunc) (const char* ptext, void* cbArg_p);
149 
159 EXTERNRT OSBOOL rtxErrAddCtxtBufParm (OSCTXT* pctxt);
160 
170 EXTERNRT OSBOOL rtxErrAddDoubleParm (OSCTXT* pctxt, double errParm);
171 
184 EXTERNRT OSBOOL rtxErrAddErrorTableEntry
185 #if !defined(_ARMTCC) && !defined(__SYMBIAN32__)
186 (const char* const* ppStatusText, OSINT32 minErrCode, OSINT32 maxErrCode);
187 #else
188 (OSVOIDARG);
189 #endif
190 
201 EXTERNRT OSBOOL rtxErrAddElemNameParm (OSCTXT* pctxt);
202 
215 EXTERNRT OSBOOL rtxErrAddIntParm (OSCTXT* pctxt, int errParm);
216 
217 #if !defined(_NO_INT64_SUPPORT)
218 
231 EXTERNRT OSBOOL rtxErrAddInt64Parm (OSCTXT* pctxt, OSINT64 errParm);
232 #endif /* !defined(_NO_INT64_SUPPORT) */
233 
246 EXTERNRT OSBOOL rtxErrAddSizeParm (OSCTXT* pctxt, OSSIZE errParm);
247 
257 EXTERNRT OSBOOL rtxErrAddStrParm (OSCTXT* pctxt, const char* pErrParm);
258 
269 EXTERNRT OSBOOL rtxErrAddStrnParm
270  (OSCTXT* pctxt, const char* pErrParm, size_t nchars);
271 
281 EXTERNRT OSBOOL rtxErrAddUIntParm (OSCTXT* pctxt, unsigned int errParm);
282 
283 #if !defined(_NO_INT64_SUPPORT)
284 
293 EXTERNRT OSBOOL rtxErrAddUInt64Parm (OSCTXT* pctxt, OSUINT64 errParm);
294 #endif /* !defined(_NO_INT64_SUPPORT) */
295 
306 EXTERNRT void rtxErrAssertionFailed
307 (const char* conditionText, int lineNo, const char* fileName);
308 
318 EXTERNRT const char* rtxErrFmtMsg
319 (OSRTErrInfo* pErrInfo, char* bufp, size_t bufsiz);
320 
328 EXTERNRT void rtxErrFreeParms (OSCTXT* pctxt);
329 
351 EXTERNRT char* rtxErrGetText (OSCTXT* pctxt, char* pBuf, size_t* pBufSize);
352 
362 EXTERNRT char* rtxErrGetTextBuf (OSCTXT* pctxt, char* pbuf, size_t bufsiz);
363 
376 EXTERNRT char* rtxErrGetMsgText (OSCTXT* pctxt);
377 
389 EXTERNRT char* rtxErrGetMsgTextBuf (OSCTXT* pctxt, char* pbuf, size_t bufsiz);
390 
400 EXTERNRT OSRTErrInfo* rtxErrNewNode (OSCTXT* pctxt);
401 
408 EXTERNRT void rtxErrInit (OSVOIDARG);
409 
417 EXTERNRT int rtxErrReset (OSCTXT* pctxt);
418 
440 EXTERNRT void rtxErrLogUsingCB (OSCTXT* pctxt, OSErrCbFunc cb, void* cbArg_p);
441 
449 EXTERNRT void rtxErrPrint (OSCTXT* pctxt);
450 
458 EXTERNRT void rtxErrPrintElement (OSRTErrInfo* pErrInfo);
459 
471 EXTERNRT int rtxErrSetData (OSCTXT* pctxt, int status,
472  const char* module, int lineno);
473 
485 EXTERNRT int rtxErrSetNewData (OSCTXT* pctxt, int status,
486  const char* module, int lineno);
493 EXTERNRT int rtxErrGetFirstError (const OSCTXT* pctxt);
494 
501 EXTERNRT int rtxErrGetLastError (const OSCTXT* pctxt);
502 
509 EXTERNRT OSSIZE rtxErrGetErrorCnt (const OSCTXT* pctxt);
510 
521 EXTERNRT int rtxErrGetStatus (const OSCTXT* pctxt);
522 
533 EXTERNRT int rtxErrResetLastErrors (OSCTXT* pctxt, int errorsToReset);
534 
548 EXTERNRT int rtxErrCopy (OSCTXT* pDestCtxt, const OSCTXT* pSrcCtxt);
549 
563 EXTERNRT int rtxErrAppend (OSCTXT* pDestCtxt, const OSCTXT* pSrcCtxt);
564 
572 EXTERNRT int rtxErrInvUIntOpt (OSCTXT* pctxt, OSUINT32 ident);
573 
578 #ifdef __cplusplus
579 }
580 #endif
581 
582 #endif
void rtxErrFreeParms(OSCTXT *pctxt)
OSBOOL rtxErrAddInt64Parm(OSCTXT *pctxt, OSINT64 errParm)
int rtxErrCopy(OSCTXT *pDestCtxt, const OSCTXT *pSrcCtxt)
void rtxErrAssertionFailed(const char *conditionText, int lineNo, const char *fileName)
char * rtxErrGetTextBuf(OSCTXT *pctxt, char *pbuf, size_t bufsiz)
void rtxErrInit(OSVOIDARG)
int rtxErrGetFirstError(const OSCTXT *pctxt)
int rtxErrGetStatus(const OSCTXT *pctxt)
OSBOOL rtxErrAddErrorTableEntry(const char *const *ppStatusText, OSINT32 minErrCode, OSINT32 maxErrCode)
const char * rtxErrFmtMsg(OSRTErrInfo *pErrInfo, char *bufp, size_t bufsiz)
int rtxErrInvUIntOpt(OSCTXT *pctxt, OSUINT32 ident)
OSBOOL rtxErrAddStrParm(OSCTXT *pctxt, const char *pErrParm)
int rtxErrSetData(OSCTXT *pctxt, int status, const char *module, int lineno)
OSSIZE rtxErrGetErrorCnt(const OSCTXT *pctxt)
void rtxErrPrint(OSCTXT *pctxt)
char * rtxErrGetMsgTextBuf(OSCTXT *pctxt, char *pbuf, size_t bufsiz)
char * rtxErrGetMsgText(OSCTXT *pctxt)
OSBOOL rtxErrAddDoubleParm(OSCTXT *pctxt, double errParm)
OSBOOL rtxErrAddUInt64Parm(OSCTXT *pctxt, OSUINT64 errParm)
int rtxErrGetLastError(const OSCTXT *pctxt)
OSBOOL rtxErrAddSizeParm(OSCTXT *pctxt, OSSIZE errParm)
int rtxErrSetNewData(OSCTXT *pctxt, int status, const char *module, int lineno)
int rtxErrResetLastErrors(OSCTXT *pctxt, int errorsToReset)
Definition: rtxContext.h:67
int rtxErrReset(OSCTXT *pctxt)
OSRTErrInfo * rtxErrNewNode(OSCTXT *pctxt)
void rtxErrLogUsingCB(OSCTXT *pctxt, OSErrCbFunc cb, void *cbArg_p)
OSBOOL rtxErrAddIntParm(OSCTXT *pctxt, int errParm)
OSBOOL rtxErrAddUIntParm(OSCTXT *pctxt, unsigned int errParm)
Definition: rtxContext.h:185
void rtxErrPrintElement(OSRTErrInfo *pErrInfo)
OSBOOL rtxErrAddElemNameParm(OSCTXT *pctxt)
char * rtxErrGetText(OSCTXT *pctxt, char *pBuf, size_t *pBufSize)
OSBOOL rtxErrAddStrnParm(OSCTXT *pctxt, const char *pErrParm, size_t nchars)
int rtxErrAppend(OSCTXT *pDestCtxt, const OSCTXT *pSrcCtxt)
OSBOOL rtxErrAddCtxtBufParm(OSCTXT *pctxt)