⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wbxmldef.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 2 页
字号:
	Input: Element
	Output: First Content in the Element or NULL
==========================================================================*/
typedef 
pELEMENTTYPE DTD_GetContentFunc (pELEMENTTYPE pElement);



/*========================================================================
	DTD_AppSpecParseModFunc
==========================================================================
	A function of this type is used to do application specific modifi-
	cations to the element. 

	NOTE! The Element may be removed!

	Input: pWBXMLDECODESTR (not NULL)
	Output: -
==========================================================================*/
typedef 
void DTD_AppSpecParseModFunc (pDECSTR pDecStr);


/*========================================================================
	DTD_StoreAttributeValueFunc
==========================================================================
	The function stores the specified attribute value (ppAttrVal) in the 
	element under the specified attribute (iAttribute). The ppAttrVal is
	a list of elements ( Type_Text, Type_Literal, or Type_Ext ) that 
	should be stored in the element. The iAttribute is an UINT16 identi-
	fying the attribute including code page changes.

	The function returns TRUE if the attribute and the attribute value
	is legal in the element, FALSE otherwise. The function SHOULD con-
	sider the version attribute in the Decode Struct when the decision is 
	made. If the function returns FALSE, the calling function will set 
	the	Illegal Attribute Warning in the Decode Struct.
	
	NOTE! If the value is stored, the ppAttrVal pointer MUST be set to 
	NULL.

	Input: pWBXMLDECODESTR (not NULL), Element, Attribute, and attribute
		   value (list of ELEMENTTYPE*)
	Output: TRUE/FALSE
==========================================================================*/
typedef 
BOOL DTD_StoreAttributeValueFunc (pDECSTR pDecStr, pELEMENTTYPE pElement,
                                  UINT16 iAttribute, pELEMENTTYPE* ppAttrVal);


/*========================================================================
	DTD_GetAttributeValueFunc
==========================================================================
	Returns the corresponding string to the specified attribute value. If 
	a matching value is not found, NULL is returned.
	
	Input: Attribute value (UINT16)
	Output: Null-terminated string (WCHAR*)
==========================================================================*/
typedef 
WCHAR* DTD_GetAttributeValueFunc (UINT16 iToken);


/*========================================================================
	DTD_LiteralAttributeToTokenFunc
==========================================================================
	Returns the corresponding attribute token to the specified string. If 
	a matching value is not found, Type_Literal is returned.

	NOTE! The string MUST be left unchanged.
	
	Input: Null terminated WCHAR*.
	Output: UINT16
==========================================================================*/
typedef 
UINT16 DTD_LiteralAttributeToTokenFunc (WCHAR* pwchToken);


/*========================================================================
    DTD_LiteralTagToTokenFunc
==========================================================================
    Returns the corresponding tag token to the specified string. If a 
    matching value is not found, Type_Literal is returned.

    NOTE! The string MUST be left unchanged.

    Input: Null terminated WCHAR*.
    Output: UINT16
==========================================================================*/
typedef 
UINT16 DTD_LiteralTagToTokenFunc (WCHAR* pwchToken);


/*========================================================================
    DTD_CheckPublicIDFunc
==========================================================================
    Examines the PublicID and verifies it. If the function returns TRUE
    the public id is accepted. The value in the piPId is stored in the 
    iVersion attribute in the Decode Struct. If the function returns 
    FALSE, the decoding is terminated.

    NOTE! If the pwchPId parameter is specified, this will be used, other-
    wise the piPId will be used for the check. 

    If the function returns TRUE, the correct integer MUST be stored in 
    the piPId parameter. This value will then be stored in the attribute 
    iVersion in the pWBXMLDECODESTR.

    Input: pWBXMLDECODESTR (not NULL), WCHAR*, and UINT8
    Output: TRUE if valid ID, FALSE otherwise.
==========================================================================*/
typedef 
BOOL DTD_CheckPublicIDFunc (pDECSTR pDecStr, WCHAR* pwchPId, UINT8* piPId);


/*========================================================================

    Decode Structure

=========================================================================*/

/*  String Table Element

    When the prolog in the WBXML document is decoded, a list of all
    strings in the WBXML string table is created. The list consists of
    elements of the following type and is stored in the pStrTab attribute
    in the tWBXMLDECODESTR. The string table is used during the decoding 
    of the WBXML document and AS LONG AS THE WBXML STRUCTURE IS USED. 
    The string table is discarded in the WBXML_DeleteWBXMLDecStr function.
*/
typedef struct tSTRINGTABSTR
{
    WCHAR *pwchString;              /* The string                   */
    UINT32 iOffset;                 /* Offset from the first byte   */
    struct tSTRINGTABSTR *pNext;    /* Next string in the list      */
} STRINGTABSTR, *pSTRINGTABSTR;

/* 
    The Decode Struct

    This structure is created with a call to the WBXML_DeleteWBXMLDecStr 
    function. After this, the attributes in the struct MUST be set to
    correct values BEFORE the decoding is started. 

    NOTE! All of the function pointers must have a value other than NULL.

    DO NOT DELETE UNTIL THE USE OF THE WBXML STRUCTURE IS FINISHED!
*/
typedef struct tWBXMLDECODESTR
{
    BYTE*         pbCurByte;        /* Pointer to data */
    BYTE*         pbEnd;            /* Pointer to first byte AFTER the data */
    pSTRINGTABSTR pStrTab;
    void*         pAppSpec;         /* Pointer to application specific data */
    UINT32        iDecodeResult;    /* Errors and Warnings set during the decode */
    INT16         iCharset;         /* IANA code */
    BYTE          bContentType;     /* WSP well-known content type */
    UINT8         iContentLevel;
    UINT8         iVersion;         /* The version; set in DTD_CheckPublicID */
    UINT8         iAttrCodePage;    /* Starts at 0 */
    UINT8         iTagCodePage;     /* Starts at 0 */

    /* Used while building the structure */
    pELEMENTTYPE  currentElement;
    pELEMENTTYPE  parentElement;
    pELEMENTTYPE  topElement;
    pELEMENTTYPE  deletePtr;
    UINT16        timer;
    BYTE          state;
	BOOL          scheduled;


    /* Application specific functions */
    DTD_CreateElementFunc           *DTD_CreateElement;
    DTD_DeleteElementFunc           *DTD_DeleteElement;
    DTD_ValidContentFunc            *DTD_ValidContent;
    DTD_GetContentFunc              *DTD_GetContent;
    DTD_AppSpecParseModFunc         *DTD_AppSpecParseMod;
    DTD_StoreAttributeValueFunc     *DTD_StoreAttributeValue;
    DTD_GetAttributeValueFunc       *DTD_GetAttributeValue;
    DTD_LiteralAttributeToTokenFunc *DTD_LiteralAttributeToToken;
    DTD_LiteralTagToTokenFunc       *DTD_LiteralTagToToken;
    DTD_CheckPublicIDFunc           *DTD_CheckPublicID;

} WBXMLDECODESTR, *pWBXMLDECODESTR;



/*========================================================================

    Global WBXML Token Definitions 

=========================================================================*/

/* Special tokens. Filters etc.
    ATTR - Token has attribute (bit 7)
    CONT - Token has content (bit 6)
    BOTH - Token has ATTR and CONT
    MASK - The first 6 bits set to 1
*/
#define ATTR        (unsigned char) '\x80'
#define CONT        (unsigned char) '\x40'
#define BOTH        (unsigned char) '\xC0'
#define MASK        (unsigned char) '\x3F'

/* Global tokens */
#define GLOBAL_SWITCH_PAGE  (unsigned char) '\x00'
#define GLOBAL_END          (unsigned char) '\x01'
#define GLOBAL_ENTITY       (unsigned char) '\x02'
#define GLOBAL_STR_I        (unsigned char) '\x03'
#define GLOBAL_LITERAL      (unsigned char) '\x04'
#define GLOBAL_EXT_I_0      (unsigned char) '\x40'
#define GLOBAL_EXT_I_1      (unsigned char) '\x41'
#define GLOBAL_EXT_I_2      (unsigned char) '\x42'
#define GLOBAL_PI           (unsigned char) '\x43'
#define GLOBAL_LITERAL_C    (unsigned char) '\x44'
#define GLOBAL_EXT_T_0      (unsigned char) '\x80'
#define GLOBAL_EXT_T_1      (unsigned char) '\x81'
#define GLOBAL_EXT_T_2      (unsigned char) '\x82'
#define GLOBAL_STR_T        (unsigned char) '\x83'
#define GLOBAL_LITERAL_A    (unsigned char) '\x84'
#define GLOBAL_EXT_0        (unsigned char) '\xC0'
#define GLOBAL_EXT_1        (unsigned char) '\xC1'
#define GLOBAL_EXT_2        (unsigned char) '\xC2'
#define GLOBAL_OPAQUE       (unsigned char) '\xC3'
#define GLOBAL_LITERAL_AC   (unsigned char) '\xC4'


/*========================================================================

    WBXML Decoder Errors and Warnings

=========================================================================*/

/* 
 Warnings. 
 
    If any of the following should occur during the decoding of the data,
    the corresponding bit in the DecodeResult-variable in the decode
    struct is set. Warnings are not fatal, i.e., the decoding will 
    continue.

    (Warnings are defined to be the 16 least significant bits in the 
    DecodeResult-variable)
*/
#define WBXML_Warning_UnknownToken          (UINT32)    0x1
#define WBXML_Warning_UnknownAttribute      (UINT32)    0x2
#define WBXML_Warning_UnknownAttributeValue (UINT32)    0x4
#define WBXML_Warning_IllegalAttribute      (UINT32)    0x8
#define WBXML_Warning_IllegalElement        (UINT32)    0x10
#define WBXML_Warning_Version               (UINT32)    0x20
#define WBXML_Warning_UnknownCharset        (UINT32)    0x40

/* 
    Errors. 

    If any of the following should occur during the decoding of the data,
    the corresponding bit in the DecodeResult-variable in the decode
    struct is set. Errors are fatal, i.e., the decoding will terminate.

    (Errors are defined to be the 16 most significant bits in the 
     DecodeResult-variable)
*/
#define WBXML_Error_OutOfMemory             (UINT32)    0x10000
#define WBXML_Error_DataStream              (UINT32)    0x20000
#define WBXML_Error_StringTable             (UINT32)    0x40000
#define WBXML_Error_MbuintEncoding          (UINT32)    0x80000
#define WBXML_Error_CharsetEncoding         (UINT32)    0x100000
#define WBXML_Error_Encoding                (UINT32)    0x200000
#define WBXML_Error_PublicID                (UINT32)    0x400000
#define WBXML_Error_Unknown                 (UINT32)    0x800000

/* If the DecodeResult is greater than 0xFFFF, the decoding is terminated */
#define WBXML_FatalError                    (UINT32)    0xFFFF


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -