Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

rtxCommon.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2006 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  *****************************************************************************/
00024 /*The following is the text for the main C Runtime index page.*/
00068 #ifndef _RTXCOMMON_H_
00069 #define _RTXCOMMON_H_
00070 
00071 #include "rtxsrc/rtxCommonDefs.h"
00072 #include "rtxsrc/rtxContext.h"
00073 
00074 #ifdef __cplusplus
00075 extern "C" {
00076 #endif
00077 
00078 typedef struct OSEnumItem {
00079    const OSUTF8CHAR* name;
00080    OSUINT16          length;
00081    OSUINT16          id;
00082    OSUINT16          transid;
00083 } OSEnumItem;
00084 
00085 typedef struct OSNumericEnumItem {
00086    OSINT32           start;
00087    OSINT32           end;
00088 } OSNumericEnumItem;
00089 
00090 /* Context management */
00091 
00115 EXTERNRTX int rtxInitContext (OSCTXT* pctxt);
00116 
00135 EXTERNRTX int rtxInitContextBuffer (OSCTXT* pctxt, 
00136                                     OSOCTET* bufaddr, 
00137                                     size_t bufsiz);
00138 
00148 EXTERNRTX void rtxFreeContext (OSCTXT* pctxt);
00149 
00150 /*
00151  * This function creates a copy of a context structure. The copy is a "shallow
00152  * copy" (i.e. new copies of dynamic memory blocks held within the context are
00153  * not made, only the pointers are transferred to the new context structure).
00154  * This function is mainly for use from within compiler-generated code.
00155  *
00156  * @param pdest        - Context structure to which data is to be copied.
00157  * @param psrc         - Context structure from which data is to be copied.
00158  */
00159 EXTERNRTX void rtxCopyContext (OSCTXT* pdest, OSCTXT* psrc);
00160 
00167 EXTERNRTX void rtxCtxtSetFlag (OSCTXT* pctxt, OSUINT16 mask);
00168 
00176 EXTERNRTX void rtxCtxtClearFlag (OSCTXT* pctxt, OSUINT16 mask);
00177 
00178 EXTERNRTX void rtxResetContext (OSCTXT* pctxt);
00179 
00184 /* UTF-8 string functions */
00207 EXTERNRTX long rtxUTF8ToUnicode (OSCTXT* pctxt, const OSUTF8CHAR* inbuf, 
00208                                  OSUNICHAR* outbuf, size_t outbufsiz);
00209 
00220 EXTERNRTX int rtxValidateUTF8 (OSCTXT* pctxt, const OSUTF8CHAR* inbuf);
00221 
00231 EXTERNRTX size_t rtxUTF8Len (const OSUTF8CHAR* inbuf); 
00232 EXTERNRTX size_t rtxCalcUTF8Len (const OSUTF8CHAR* inbuf, size_t inbufBytes);
00233 
00241 EXTERNRTX size_t rtxUTF8LenBytes (const OSUTF8CHAR* inbuf); 
00242 
00250 EXTERNRTX int rtxUTF8CharSize (OS32BITCHAR wc);
00251 
00263 EXTERNRTX int rtxUTF8EncodeChar (OS32BITCHAR wc, OSOCTET* buf, size_t bufsiz);
00264 
00275 EXTERNRTX int rtxUTF8DecodeChar 
00276 (OSCTXT* pctxt, const OSUTF8CHAR* pinbuf, int* pInsize);
00277 
00287 EXTERNRTX OS32BITCHAR rtxUTF8CharToWC (const OSUTF8CHAR* buf, OSUINT32* len);
00288 
00298 EXTERNRTX OSUTF8CHAR* rtxUTF8StrChr (OSUTF8CHAR* utf8str, 
00299                                      OS32BITCHAR utf8char);
00300 
00310 EXTERNRTX OSUTF8CHAR* rtxUTF8Strdup (OSCTXT* pctxt, const OSUTF8CHAR* utf8str);
00311 
00323 EXTERNRTX OSUTF8CHAR* rtxUTF8Strndup (OSCTXT* pctxt, 
00324                                       const OSUTF8CHAR* utf8str, 
00325                                       size_t nbytes);
00326 
00334 EXTERNRTX OSBOOL rtxUTF8StrEqual (const OSUTF8CHAR* utf8str1, 
00335                                   const OSUTF8CHAR* utf8str2);
00336 
00347 EXTERNRTX OSBOOL rtxUTF8StrnEqual (const OSUTF8CHAR* utf8str1, 
00348                                    const OSUTF8CHAR* utf8str2,
00349                                    size_t count);
00350 
00362 EXTERNRTX int rtxUTF8Strcmp (const OSUTF8CHAR* utf8str1, 
00363                              const OSUTF8CHAR* utf8str2);
00364 
00378 EXTERNRTX int rtxUTF8Strncmp (const OSUTF8CHAR* utf8str1, 
00379                               const OSUTF8CHAR* utf8str2,
00380                               size_t count);
00393 EXTERNRTX int rtxUTF8StrToInt (const OSUTF8CHAR* utf8str, OSINT32* pvalue);
00394 
00409 EXTERNRTX int rtxUTF8StrnToInt 
00410    (const OSUTF8CHAR* utf8str, size_t nbytes, OSINT32* pvalue);
00415 /* Error handling */
00416 
00434 #ifndef _COMPACT
00435 #define LOG_RTERR(pctxt,stat) \
00436 rtxErrSetData(pctxt,stat,__FILE__,__LINE__)
00437 
00438 #define LOG_RTERRNEW(pctxt,stat) \
00439 rtxErrSetNewData(pctxt,stat,__FILE__,__LINE__)
00440 
00450 #define OSRTASSERT(condition) \
00451 if (!(condition)) { rtxErrAssertionFailed(#condition,__LINE__,__FILE__); }
00452 #else
00453 #define LOG_RTERR(pctxt,stat) \
00454 rtxErrSetData(pctxt,stat,0,0)
00455 
00456 #define LOG_RTERRNEW(pctxt,stat) \
00457 rtxErrSetNewData(pctxt,stat,0,0)
00458 
00459 #define OSRTASSERT(condition)
00460 #endif /* _COMPACT */
00461 
00462 #define LOG_RTERR1(pctxt,stat,a) \
00463 (LOG_RTERR (pctxt, stat),a,stat)
00464 
00465 #define LOG_RTERRNEW1(pctxt,stat,a) \
00466 (LOG_RTERRNEW (pctxt, stat),a,stat)
00467 
00468 
00469 #define LOG_RTERR2(pctxt,stat,a,b) \
00470 (LOG_RTERR (pctxt, stat),a,b,stat)
00471 
00472 #define LOG_RTERRNEW2(pctxt,stat,a,b) \
00473 (LOG_RTERRNEW (pctxt, stat),a,b,stat)
00474 
00475 
00476 typedef int (*OSErrCbFunc) (const char* ptext, void* cbArg_p);
00477 
00487 EXTERNRTX OSBOOL rtxErrAddDoubleParm (OSCTXT* pctxt, double errParm);
00488 
00501 EXTERNRTX OSBOOL rtxErrAddIntParm (OSCTXT* pctxt, int errParm);
00502 
00516 EXTERNRTX OSBOOL rtxErrAddInt64Parm (OSCTXT* pctxt, OSINT64 errParm);
00517 
00527 EXTERNRTX OSBOOL rtxErrAddStrParm (OSCTXT* pctxt, const char* pErrParm);
00528 
00539 EXTERNRTX OSBOOL rtxErrAddStrnParm 
00540    (OSCTXT* pctxt, const char* pErrParm, size_t nchars);
00541 
00551 EXTERNRTX OSBOOL rtxErrAddUniStrParm (OSCTXT* pctxt, 
00552                                       const OSUNICHAR* pErrParm);
00553 
00563 EXTERNRTX OSBOOL rtxErrAddUIntParm (OSCTXT* pctxt, unsigned int errParm);
00564 
00574 EXTERNRTX OSBOOL rtxErrAddUInt64Parm (OSCTXT* pctxt, OSUINT64 errParm);
00575 
00586 EXTERNRTX void rtxErrAssertionFailed (const char* conditionText, 
00587                                       int lineNo, const char* fileName);
00588 
00596 EXTERNRTX void rtxErrFreeParms (OSCTXT* pctxt);
00597 
00617 EXTERNRTX char* rtxErrGetText (OSCTXT* pctxt, char* pBuf, size_t* pBufSize);
00618 
00628 EXTERNRTX OSErrInfo* rtxErrNewNode (OSCTXT* pctxt);
00629 
00637 EXTERNRTX int rtxErrReset (OSCTXT* pctxt);
00638 
00656 EXTERNRTX void rtxErrLogUsingCB (OSCTXT* pctxt, OSErrCbFunc cb, void* cbArg_p);
00657 
00665 EXTERNRTX void rtxErrPrint (OSCTXT* pctxt);
00666 
00674 EXTERNRTX void rtxErrPrintElement (OSErrInfo* pErrInfo);
00675 
00687 EXTERNRTX int rtxErrSetData (OSCTXT* pctxt, int status, 
00688                              const char* module, int lineno);
00689 
00701 EXTERNRTX int rtxErrSetNewData (OSCTXT* pctxt, int status,
00702                                 const char* module, int lineno);
00709 EXTERNRTX int rtxErrGetFirstError (const OSCTXT* pctxt);
00710 
00717 EXTERNRTX int rtxErrGetLastError (const OSCTXT* pctxt);
00718 
00725 EXTERNRTX OSUINT32 rtxErrGetErrorsCnt (const OSCTXT* pctxt);
00726 
00737 EXTERNRTX int rtxErrResetLastErrors (OSCTXT* pctxt, int errorsToReset);
00738 
00759 EXTERNRTX OSBOOL rtxMatchPattern (OSCTXT* pctxt, 
00760                                   const OSUTF8CHAR* text, 
00761                                   const OSUTF8CHAR* pattern);
00762 
00763 EXTERNRTX OSBOOL rtxMatchPattern2 (OSCTXT* pctxt, 
00764                                    const OSUTF8CHAR* pattern);
00769 /* Utility functions */
00770 
00771 EXTERNRTX int rtxCheckBuffer (OSCTXT* pctxt, size_t nbytes);
00772 
00773 EXTERNRTX int rtxCopyAsciiText (OSCTXT* pctxt, const char* text);
00774 
00775 EXTERNRTX int rtxCopyUTF8Text (OSCTXT* pctxt, const OSUTF8CHAR* text);
00776 
00777 EXTERNRTX int rtxCopyUnicodeText (OSCTXT* pctxt, const OSUNICHAR* text);
00778 
00779 EXTERNRTX int rtxGetIdentByteCount (OSUINT32 ident);
00780 
00781 EXTERNRTX int rtxGetIdent64ByteCount (OSUINT64 ident);
00782 
00783 EXTERNRTX unsigned int rtxIntByteCount (OSINT32 val);
00784 
00785 EXTERNRTX OSINT32 rtxLookupEnum
00786 (const OSUTF8CHAR* strValue, size_t strValueSize, 
00787  const OSEnumItem enumTable[], OSUINT16 enumTableSize);
00788 
00789 EXTERNRTX int rtxOctetBitLen (OSOCTET w);
00790 
00791 EXTERNRTX int rtxTestNumericEnum (OSINT32 ivalue,
00792                                   const OSNumericEnumItem enumTable[], 
00793                                   OSUINT16 enumTableSize);
00794 
00795 /* Real helper functions */
00796 
00797 EXTERNRTX OSREAL rtxGetMinusInfinity ();
00798 EXTERNRTX OSREAL rtxGetMinusZero ();
00799 EXTERNRTX OSREAL rtxGetNaN ();
00800 EXTERNRTX OSREAL rtxGetPlusInfinity ();
00801 EXTERNRTX OSBOOL rtxIsMinusInfinity (OSREAL value);
00802 EXTERNRTX OSBOOL rtxIsMinusZero (OSREAL value);
00803 EXTERNRTX OSBOOL rtxIsNaN (OSREAL value);
00804 EXTERNRTX OSBOOL rtxIsPlusInfinity (OSREAL value);
00805 
00806 EXTERNRTX int rtxWriteBytes (OSCTXT* pctxt, 
00807                              const OSOCTET* pdata, 
00808                              size_t nocts);
00809 
00810 /* Diagnostic trace functions */
00823 #ifdef _TRACE
00824 #define RTDIAG1(pctxt,msg)              rtxDiagPrint(pctxt,msg)
00825 #define RTDIAG2(pctxt,msg,a)            rtxDiagPrint(pctxt,msg,a)
00826 #define RTDIAG3(pctxt,msg,a,b)          rtxDiagPrint(pctxt,msg,a,b)
00827 #define RTDIAG4(pctxt,msg,a,b,c)        rtxDiagPrint(pctxt,msg,a,b,c)
00828 #define RTDIAG5(pctxt,msg,a,b,c,d)      rtxDiagPrint(pctxt,msg,a,b,c,d)
00829 #define RTDIAGU(pctxt,ucstr)            rtxDiagPrintUCS(pctxt,ucstr)
00830 #define RTHEXDUMP(buffer,numocts)       rtDiagHexDump(buffer,numocts)
00831 #else
00832 #define RTDIAG1(pctxt,msg)
00833 #define RTDIAG2(pctxt,msg,a)
00834 #define RTDIAG3(pctxt,msg,a,b)
00835 #define RTDIAG4(pctxt,msg,a,b,c)
00836 #define RTDIAG5(pctxt,msg,a,b,c,d)
00837 #define RTDIAGU(pctxt,ucstr)
00838 #define RTHEXDUMP(buffer,numocts)
00839 #endif
00840 
00849 EXTERNRTX OSBOOL rtxDiagEnabled (OSCTXT* pctxt);
00850 
00861 EXTERNRTX OSBOOL rtxSetDiag (OSCTXT* pctxt, OSBOOL value);
00862 
00876 EXTERNRTX void rtxDiagPrint (OSCTXT* pctxt, const char* fmtspec, ...);
00877 
00886 EXTERNRTX void rtxDiagHexDump 
00887 (OSCTXT* pctxt, const OSOCTET* data, OSUINT32 numocts);
00888 
00917 EXTERNRTX int rtxDateToString 
00918    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
00919 
00935 EXTERNRTX int rtxTimeToString 
00936    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
00937 
00953 EXTERNRTX int rtxDateTimeToString 
00954    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
00955 
00970 EXTERNRTX int rtxGYearToString 
00971    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
00972 
00988 EXTERNRTX int rtxGYearMonthToString 
00989    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
00990 
01005 EXTERNRTX int rtxGMonthToString 
01006    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
01007 
01023 EXTERNRTX int rtxGMonthDayToString 
01024    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
01025 
01040 EXTERNRTX int rtxGDayToString 
01041    (const OSXSDDateTime* pvalue, OSUTF8CHAR* buffer, size_t bufsize);
01042 
01052 EXTERNRTX int rtxGetCurrDateTime (OSXSDDateTime* pvalue);
01053 
01065 EXTERNRTX int rtxCmpDate 
01066    (const OSXSDDateTime* pvalue1, const OSXSDDateTime* pvalue2);
01067 
01083 EXTERNRTX int rtxCmpDate2 
01084    (const OSXSDDateTime* pvalue,  
01085     OSINT32 year, OSUINT8 mon, OSUINT8 day, OSBOOL tzflag, OSINT32 tzo);
01086 
01098 EXTERNRTX int rtxCmpTime 
01099    (const OSXSDDateTime* pvalue1, const OSXSDDateTime* pvalue2);
01100 
01116 EXTERNRTX int rtxCmpTime2 
01117    (const OSXSDDateTime* pvalue,  
01118     OSUINT8 hour, OSUINT8 min, OSREAL sec, OSBOOL tzflag, OSINT32 tzo);
01119 
01131 EXTERNRTX int rtxCmpDateTime 
01132    (const OSXSDDateTime* pvalue1, const OSXSDDateTime* pvalue2);
01133 
01152 EXTERNRTX int rtxCmpDateTime2 
01153    (const OSXSDDateTime* pvalue,  
01154     OSINT32 year, OSUINT8 mon, OSUINT8 day,
01155     OSUINT8 hour, OSUINT8 min, OSREAL sec, OSBOOL tzflag, OSINT32 tzo);
01156 
01181 EXTERNRTX int rtxParseDateString
01182 (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01183 
01219 EXTERNRTX int rtxParseTimeString
01220 (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01221 
01222 
01238 EXTERNRTX int rtxParseDateTimeString
01239    (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01240 
01256 EXTERNRTX int rtxParseGYearString
01257    (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01258 
01275 EXTERNRTX int rtxParseGYearMonthString
01276    (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01277 
01294 EXTERNRTX int rtxParseGMonthString
01295    (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01296 
01313 EXTERNRTX int rtxParseGMonthDayString
01314    (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01315 
01332 EXTERNRTX int rtxParseGDayString
01333    (const OSUTF8CHAR* inpdata, size_t inpdatalen, OSXSDDateTime* pvalue);
01334 
01346 EXTERNRTX int rtxMSecsToDuration
01347 (OSINT32 msecs, OSUTF8CHAR* buf, OSUINT32 bufsize);
01348 
01363 EXTERNRTX int rtxDurationToMSecs 
01364 (OSUTF8CHAR* buf, OSUINT32 bufsize, OSINT32* msecs);
01365 
01377 EXTERNRTX int rtxSetDateTime (OSXSDDateTime* pvalue, struct tm* timeStruct);
01378 
01390 EXTERNRTX int rtxSetLocalDateTime (OSXSDDateTime* pvalue, time_t timeMs);
01391 
01406 EXTERNRTX int rtxSetUtcDateTime (OSXSDDateTime* pvalue, time_t timeMs);
01407 
01419 EXTERNRTX int rtxGetDateTime (const OSXSDDateTime* pvalue, time_t* timeMs);
01420 
01425 #ifdef __cplusplus
01426 }
01427 #endif
01428 
01429 #include "rtxsrc/rtxMemory.h"
01430 
01431 #endif /* _RTXCOMMON_H_ */

This file was last modified on 8 Jan 2007.
XBinder, Version 1.1.9