1 /* |
|
2 * Copyright (c) 2000 - 2001 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /***************************************************************** |
|
20 ** File: parseI.h |
|
21 ** |
|
22 ** Description: definitions internal to WBXML parser component |
|
23 *****************************************************************/ |
|
24 |
|
25 #ifndef NW_PARSER_WBXML_PARSE_I_H |
|
26 #define NW_PARSER_WBXML_PARSE_I_H |
|
27 |
|
28 #include <xml/cxml/cxml_proj.h> |
|
29 #include <xml/cxml/nw_wbxml_parse.h> |
|
30 |
|
31 #ifdef __cplusplus |
|
32 extern "C" { |
|
33 #endif /* __cplusplus */ |
|
34 |
|
35 |
|
36 /* |
|
37 * Parser states, shared by reader and parser |
|
38 */ |
|
39 |
|
40 #define NW_WBXML_PARSER_S_MASK 0x0F |
|
41 #define NW_WBXML_PARSER_S_START 0x00 |
|
42 #define NW_WBXML_PARSER_S_HEADER 0x01 |
|
43 #define NW_WBXML_REGISTRY_INIT 0x10 |
|
44 |
|
45 |
|
46 /* |
|
47 * Parser internal status codes, shared by reader and parser |
|
48 */ |
|
49 |
|
50 #define NW_WBXML_PARSER_OK 0x0 |
|
51 #define NW_WBXML_PARSER_NOMEMORY 0x1 |
|
52 #define NW_WBXML_PARSER_BYTECODEERROR 0x2 |
|
53 #define NW_WBXML_PARSER_CHARSET_UNSUPPORTED 0x4 |
|
54 #define NW_WBXML_PARSER_UNKNOWN_ERROR 0x8 |
|
55 |
|
56 /* Parse exceptions */ |
|
57 |
|
58 #define NW_WBXML_EXCEPTION_MEMORY 1 |
|
59 #define NW_WBXML_EXCEPTION_BYTECODE 2 |
|
60 |
|
61 /* |
|
62 * WBXML token components |
|
63 * |
|
64 * The wbxml parser stores tokens as 32 bits. The meaning |
|
65 * of each token is determined as a 4-tuple: |
|
66 * the token itself (8 bits), the code page (8 bits), |
|
67 * the dictionary in which it is defined (for which we |
|
68 * allocate 15 bits) and a state flag that indicates whether |
|
69 * the token is in attribute or tag code space. |
|
70 * |
|
71 * Within the lowest 8 bits (the token component) the |
|
72 * wbxml spec defines further subsets of bits for tags |
|
73 * and attributes. The parser itself only int32erprets |
|
74 * the lowest 8 bits. The remaining bits are used for |
|
75 * token value lookups in dictionaries. |
|
76 */ |
|
77 |
|
78 /* TODO: export some of these definitions? */ |
|
79 |
|
80 #define NW_WBXML_MASK_TOKEN 0x000000FF |
|
81 #define NW_WBXML_MASK_CODEPAGE 0x0000FF00 |
|
82 #define NW_WBXML_MASK_DICTIONARY 0x7FFF0000 |
|
83 #define NW_WBXML_MASK_CPSTATE 0x80000000 |
|
84 |
|
85 #define NW_WBXML_CP_STATE_TAG 0x00000000 |
|
86 #define NW_WBXML_CP_STATE_ATTR 0x80000000 |
|
87 |
|
88 void |
|
89 NW_WBXML_CPRegistry_getCodePages(NW_WBXML_CP_Registry_t* registry, |
|
90 NW_Uint32 offset, |
|
91 NW_Uint8 *tag_code_page, |
|
92 NW_Uint8 *attribute_code_page); |
|
93 |
|
94 NW_Status_t |
|
95 NW_WBXML_Parser_docHeaderParse(NW_WBXML_Parser_t * parser, |
|
96 NW_WBXML_Document_t * doc); |
|
97 |
|
98 NW_Status_t |
|
99 NW_WBXML_Parser_bodyParse(NW_WBXML_Parser_t * parser); |
|
100 |
|
101 void |
|
102 NW_WBXML_Parser_bytecodeError (NW_WBXML_Parser_t * parser); |
|
103 |
|
104 |
|
105 #ifdef __cplusplus |
|
106 } // extern "C" { |
|
107 #endif /* __cplusplus */ |
|
108 |
|
109 #endif /* NW_PARSER_WBXML_PARSE_I_H */ |
|