00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00048 #ifndef _OSRTEXI_H_
00049 #define _OSRTEXI_H_
00050
00051 #include "rtxsrc/rtxContext.h"
00052 #include "rtxsrc/rtxStack.h"
00053 #include "rtexisrc/rtEXIEncAutomaton.h"
00054 #include "rtexisrc/rtEXIEncStringTables.h"
00055 #include "rtexisrc/rtEXIDecStringTables.h"
00056 #include "rtexisrc/rtEXIStateTable.h"
00057 #include "rtxsrc/rtxDiagBitTrace.h"
00058
00059 #ifdef __cplusplus
00060 extern "C" {
00061 #endif
00062
00063
00064 #define OSEXI_OK_EOC 1
00065
00066 #define OSEXINULLINDEX OSUINT32_MAX
00067
00068 #define OSEXI_PRESERVE_DTD 0x80000000
00069 #define OSEXI_PRESERVE_PIS 0x40000000
00070 #define OSEXI_PRESERVE_COMMENTS 0x20000000
00071 #define OSEXI_PRESERVE_PREFIXES 0x10000000
00072 #define OSEXI_PRESERVE_LEXICAL 0x08000000
00073 #define OSEXI_FRAGMENT 0x04000000
00074 #define OSEXI_COMPRESSED 0x02000000
00075 #define OSEXI_ALIGNED 0x01000000
00076 #define OSEXI_PRECOMPRESSED 0x00800000
00077 #define OSEXI_SCHEMA 0x00400000
00078 #define OSEXI_NOWHITESPACE 0x00200000
00079 #define OSEXI_NOHEADEROPTIONS 0x00100000
00080 #define OSEXI_STRICT 0x00080000
00081 #define OSEXI_SELFCONTAINED 0x00040000
00082
00083
00084 typedef struct OSEXIFullQName {
00085 const OSUTF8CHAR* nsURI;
00086 const OSUTF8CHAR* nsPrefix;
00087 const OSUTF8CHAR* localName;
00088 OSUINT32 uriIdx;
00089 } OSEXIFullQName;
00090
00091 typedef struct OSEXICtxtSavedState {
00092 struct OSEXICtxtSavedState* savedState;
00093
00094 OSEXIAutomaton* pCurrAtm;
00095 OSRTStack atmStack;
00096 OSRTStack dynAtmStack;
00097 OSEXIEncStringTables encStrTabs;
00098 OSRTHashMap automataMap;
00099
00100 OSEXIDecStringTables decStrTabs;
00101
00102 int selfContainedLevel;
00103 const OSUTF8CHAR* selfContainedElemName;
00104
00105 } OSEXICtxtSavedState;
00106
00107 typedef struct OSEXIPrefixRec {
00108 OSUINT32 level;
00109 OSUINT32 prevIdx;
00110 const OSUTF8CHAR* prefix;
00111 } OSEXIPrefixRec;
00112
00113 typedef struct OSEXIUri2Prefix {
00114 const OSUTF8CHAR* uri;
00115 const OSUTF8CHAR* prefix;
00116 } OSEXIUri2Prefix;
00117
00118 typedef struct {
00119 OSFreeCtxtAppInfoPtr pFreeFunc;
00120 OSResetCtxtAppInfoPtr pResetFunc;
00121 OSUINT32 options;
00122 OSEXIAutomaton* pCurrAtm;
00123 OSEXIAutomaton* pEncDocAtm;
00124 OSEXIAutomaton* pEncSTypeAtm;
00125 OSEXIAutomaton* pDecDocAtm;
00126 OSRTStack atmStack;
00127 OSRTStack dynAtmStack;
00128 OSEXIEncStringTables encStrTabs;
00129 OSRTHashMap automataMap;
00130
00138 OSEXIEvent* pDecState;
00139
00143 OSXMLFullQName* pDecQName;
00144
00148 const OSUTF8CHAR* pDecValue;
00149
00153 const OSUTF8CHAR* pDecPrefix;
00154
00158 const OSUTF8CHAR* pDecNamespaceURI;
00159
00160 OSEXIDecStringTables decStrTabs;
00161
00162 OSRTDiagBitFieldList bitFieldList;
00163
00168 OSUINT32 blockSize;
00169 OSUINT32 valueCnt;
00170 OSUINT32 firstChannel;
00171 OSUINT32 nmChannels;
00172 void* valuesInChannel;
00173 OSUINT32 allocatedValueCnts;
00174 OSRTHashMap attrChannelMap;
00175 size_t lastValuePos;
00176 size_t firstValuePos;
00177
00178 OSRTBuffer savedBuffer;
00179 OSRTFLAGS savedFlags;
00180 OSOCTET* shadowBuff;
00181 size_t shadowBuffSize;
00182 size_t shadowBuffEnd;
00183
00184 OSUINT32 firstGlobalIdx;
00185 OSBOOL strValue;
00186 OSRTSListNode* pLastDiagNode;
00187
00191 OSUINT32 curChannelId;
00192 const OSUTF8CHAR* curUri;
00193 const OSUTF8CHAR* curLocalName;
00194 OSUINT32* id2channel;
00195 OSUINT32 nmChannelIds;
00196
00197
00201 OSEXIStateTable* pStateTable;
00202 OSRTStack stateTableStack;
00203
00207 OSEXICtxtSavedState* savedState;
00208 int selfContainedLevel;
00209 const OSUTF8CHAR* selfContainedElemName;
00210
00214 OSBOOL xsiTypeOrNilAttr;
00215 OSBOOL xsiTypeAttr;
00216
00220 OSUINT32 curLevel;
00221 OSUINT32 uriStackTop;
00222 OSUINT32 lastUriIdx;
00223 OSUINT32 nsPrefixCnt;
00224
00225 OSUINT32 prefixTableSz;
00226 OSUINT32 nmPrefixes;
00227 OSEXIPrefixRec* prefixTable;
00228
00229 OSUINT32 declPrefixTableSz;
00230 OSUINT32 nmDeclPrefixes;
00231 OSEXIUri2Prefix* declPrefixTable;
00232
00237 const OSUTF8CHAR** initialEntries;
00238
00239 } OSEXICtxtInfo;
00240
00241 #define EXICTXT(pctxt) ((OSEXICtxtInfo*)((pctxt)->pEXIInfo))
00242
00243 #define EXIPUSHSTATEIDX(pctxt) \
00244 ((OSEXICtxtInfo*)((pctxt)->pEXIInfo))->pStateTable->pushedIdx = \
00245 ((OSEXICtxtInfo*)((pctxt)->pEXIInfo))->pStateTable->currIdx
00246
00247 #define EXICLEAREVENTID(pctxt) \
00248 if (0 != EXICTXT(pctxt)->pStateTable) \
00249 EXICTXT(pctxt)->pStateTable->currEvtId = OSEXINULLEVENTID
00250
00251 typedef struct {
00252 OSBOOL mbOptionsPresent;
00253 OSBOOL mbPreview;
00254 OSUINT32 version;
00255
00256
00257
00258 } OSEXIHeader;
00259
00269 EXTERNEXI int rtEXIInitContext (OSCTXT* pctxt);
00270
00280 EXTERNEXI int rtEXIInitCtxtAppInfo (OSCTXT* pctxt);
00281
00292 EXTERNEXI int rtEXICtxtSetStateTable
00293 (OSCTXT* pctxt, const OSEXIStateTableRecord* statetab, OSINT16 nrows);
00294
00295 EXTERNEXI void rtEXICtxtPushStateTable (OSCTXT* pctxt);
00296 EXTERNEXI void rtEXICtxtPopStateTable (OSCTXT* pctxt);
00297
00304 EXTERNEXI void rtEXIEnableBitFieldTrace (OSCTXT* pctxt);
00305
00316 EXTERNEXI int rtEXISetUriPrefix
00317 (OSCTXT* pctxt, const OSUTF8CHAR* prefix, const OSUTF8CHAR* uri);
00318
00341 #define rtEXISetBufPtr(pctxt,bufaddr,bufsiz) \
00342 rtxCtxtSetBufPtr (pctxt, bufaddr, bufsiz)
00343
00352 #define rtEXIGetMsgPtr(pctxt) (pctxt)->buffer.data
00353
00359 #define rtEXIGetMsgLen(pctxt) (pctxt)->buffer.byteIndex
00360
00372 #define rtEXISetOption(pctxt,option) \
00373 EXICTXT(pctxt)->options |= option;
00374
00386 #define rtEXIClearOption(pctxt,option) \
00387 EXICTXT(pctxt)->options &= ~option;
00388
00402 #define rtEXITestOption(pctxt,option) \
00403 ((EXICTXT(pctxt)->options & option) != 0)
00404
00411 #define rtEXISetValueChannelId(pctxt,channelId) \
00412 EXICTXT(pctxt)->curChannelId = channelId
00413
00420 #define rtEXISetFragmentLevel(pctxt,fraglevel) \
00421 EXICTXT(pctxt)->selfContainedLevel = fraglevel
00422
00429 #define rtEXISetFragmentElement(pctxt,fragelement) \
00430 EXICTXT(pctxt)->selfContainedElemName = (const OSUTF8CHAR*) (fragelement)
00431
00432 #ifdef __cplusplus
00433 }
00434 #endif
00435
00438 #endif