80 {2,
"-//WAPFORUM//DTD WML 1.0//EN\"\n" 81 "\"http://www.wapforum.org/DTD/wml.xml"},
82 {3,
"-//WAPFORUM//DTD WTA 1.0//EN"},
83 {4,
"-//WAPFORUM//DTD WML 1.1//EN\"\n" 84 "\"http://www.wapforum.org/DTD/wml_1.1.xml"},
85 {5,
"-//WAPFORUM//DTD SI 1.0//EN\"\n" 86 "\"http://www.wapforum.org/DTD/si.dtd"},
87 {6,
"-//WAPFORUM//DTD SL 1.0//EN\"\n" 88 "\"http://www.wapforum.org/DTD/sl.dtd"},
89 {7,
"-//WAPFORUM//DTD CO 1.0//EN"},
90 {8,
"-//WAPFORUM//DTD CHANNEL 1.1//EN"},
91 {9,
"-//WAPFORUM//DTD WML 1.2//EN\"\n" 92 "\"http://www.wapforum.org/DTD/wml12.dtd"},
104 {4,
"anchor", 0, 0x22},
105 {4,
"access", 0, 0x23},
109 {4,
"card", 0, 0x27},
112 {4,
"fieldset", 0, 0x2a},
114 {4,
"head", 0, 0x2c},
117 {4,
"input", 0, 0x2f},
118 {4,
"meta", 0, 0x30},
119 {4,
"noop", 0, 0x31},
121 {4,
"postfield", 0, 0x21},
123 {4,
"prev", 0, 0x32},
124 {4,
"onevent", 0, 0x33},
125 {4,
"optgroup", 0, 0x34},
126 {4,
"option", 0, 0x35},
127 {4,
"refresh", 0, 0x36},
128 {4,
"select", 0, 0x37},
129 {4,
"setvar", 0, 0x3e},
130 {4,
"small", 0, 0x38},
131 {4,
"strong", 0, 0x39},
132 {4,
"table", 0, 0x1f},
134 {4,
"template", 0, 0x3b},
135 {4,
"timer", 0, 0x3c},
140 {6,
"TAG_05", 1, 0x05},
141 {6,
"TAG_06", 1, 0x06},
142 {6,
"TAG_07", 1, 0x07},
149 {4,
"accept-charset", NULL, 0, 0x05},
150 {4,
"accesskey", NULL, 0, 0x5e},
151 {4,
"align", NULL, 0, 0x52},
152 {4,
"align",
"bottom", 0, 0x06},
153 {4,
"align",
"center", 0, 0x07},
154 {4,
"align",
"left", 0, 0x08},
155 {4,
"align",
"middle", 0, 0x09},
156 {4,
"align",
"right", 0, 0x0a},
157 {4,
"align",
"top", 0, 0x0b},
158 {4,
"alt", NULL, 0, 0x0c},
159 {4,
"class", NULL, 0, 0x54},
160 {4,
"columns", NULL, 0, 0x53},
161 {4,
"content", NULL, 0, 0x0d},
162 {4,
"content",
"application/vnd.wap.wmlc;charset=", 0, 0x5c},
163 {4,
"domain", NULL, 0, 0x0f},
164 {4,
"emptyok",
"false", 0, 0x10},
165 {4,
"emptyok",
"true", 0, 0x11},
166 {4,
"enctype", NULL, 0, 0x5f},
167 {4,
"enctype",
"application/x-www-form-urlencoded", 0, 0x60},
168 {4,
"enctype",
"multipart/form-data", 0, 0x61},
169 {4,
"format", NULL, 0, 0x12},
170 {4,
"forua",
"false", 0, 0x56},
171 {4,
"forua",
"true", 0, 0x57},
172 {4,
"height", NULL, 0, 0x13},
173 {4,
"href", NULL, 0, 0x4a},
174 {4,
"href",
"http://", 0, 0x4b},
175 {4,
"href",
"https://", 0, 0x4c},
176 {4,
"hspace", NULL, 0, 0x14},
177 {4,
"http-equiv", NULL, 0, 0x5a},
178 {4,
"http-equiv",
"Content-Type", 0, 0x5b},
179 {4,
"http-equiv",
"Expires", 0, 0x5d},
180 {4,
"id", NULL, 0, 0x55},
181 {4,
"ivalue", NULL, 0, 0x15},
182 {4,
"iname", NULL, 0, 0x16},
183 {4,
"label", NULL, 0, 0x18},
184 {4,
"localsrc", NULL, 0, 0x19},
185 {4,
"maxlength", NULL, 0, 0x1a},
186 {4,
"method",
"get", 0, 0x1b},
187 {4,
"method",
"post", 0, 0x1c},
188 {4,
"mode",
"nowrap", 0, 0x1d},
189 {4,
"mode",
"wrap", 0, 0x1e},
190 {4,
"multiple",
"false", 0, 0x1f},
191 {4,
"multiple",
"true", 0, 0x20},
192 {4,
"name", NULL, 0, 0x21},
193 {4,
"newcontext",
"false", 0, 0x22},
194 {4,
"newcontext",
"true", 0, 0x23},
195 {4,
"onenterbackward", NULL, 0, 0x25},
196 {4,
"onenterforward", NULL, 0, 0x26},
197 {4,
"onpick", NULL, 0, 0x24},
198 {4,
"ontimer", NULL, 0, 0x27},
199 {4,
"optional",
"false", 0, 0x28},
200 {4,
"optional",
"true", 0, 0x29},
201 {4,
"path", NULL, 0, 0x2a},
202 {4,
"scheme", NULL, 0, 0x2e},
203 {4,
"sendreferer",
"false", 0, 0x2f},
204 {4,
"sendreferer",
"true", 0, 0x30},
205 {4,
"size", NULL, 0, 0x31},
206 {4,
"src", NULL, 0, 0x32},
207 {4,
"src",
"http://", 0, 0x58},
208 {4,
"src",
"https://", 0, 0x59},
209 {4,
"ordered",
"true", 0, 0x33},
210 {4,
"ordered",
"false", 0, 0x34},
211 {4,
"tabindex", NULL, 0, 0x35},
212 {4,
"title", NULL, 0, 0x36},
213 {4,
"type", NULL, 0, 0x37},
214 {4,
"type",
"accept", 0, 0x38},
215 {4,
"type",
"delete", 0, 0x39},
216 {4,
"type",
"help", 0, 0x3a},
217 {4,
"type",
"password", 0, 0x3b},
218 {4,
"type",
"onpick", 0, 0x3c},
219 {4,
"type",
"onenterbackward", 0, 0x3d},
220 {4,
"type",
"onenterforward", 0, 0x3e},
221 {4,
"type",
"ontimer", 0, 0x3f},
222 {4,
"type",
"options", 0, 0x45},
223 {4,
"type",
"prev", 0, 0x46},
224 {4,
"type",
"reset", 0, 0x47},
225 {4,
"type",
"text", 0, 0x48},
226 {4,
"type",
"vnd.", 0, 0x49},
227 {4,
"value", NULL, 0, 0x4d},
228 {4,
"vspace", NULL, 0, 0x4e},
229 {4,
"width", NULL, 0, 0x4f},
230 {4,
"xml:lang", NULL, 0, 0x50},
232 {6,
"ATTR_06", NULL, 1, 0x06},
233 {6,
"ATTR_07", NULL, 1, 0x07},
234 {6,
"ATTR_08", NULL, 1, 0x08},
235 {6,
"ATTR_11", NULL, 1, 0x11},
236 {6,
"ATTR_12", NULL, 1, 0x12},
237 {6,
"ATTR_13", NULL, 1, 0x13},
238 {6,
"ATTR_14", NULL, 1, 0x14},
239 {6,
"ATTR_15", NULL, 1, 0x15},
240 {6,
"ATTR_21", NULL, 1, 0x21},
241 {6,
"ATTR_22", NULL, 1, 0x22},
242 {6,
"ATTR_23", NULL, 1, 0x23},
243 {6,
"ATTR_24", NULL, 1, 0x24},
244 {6,
"ATTR_28", NULL, 1, 0x28},
245 {6,
"ATTR_29", NULL, 1, 0x29},
246 {6,
"ATTR_45", NULL, 1, 0x45},
247 {6,
"ATTR_61", NULL, 1, 0x61},
248 {6,
"ATTR_62", NULL, 1, 0x62},
249 {6,
"ATTR_63", NULL, 1, 0x63},
250 {6,
"ATTR_64", NULL, 1, 0x64},
251 {6,
"ATTR_6A", NULL, 1, 0x6A},
252 {6,
"ATTR_6B", NULL, 1, 0x6B},
253 {6,
"ATTR_6C", NULL, 1, 0x6C},
254 {6,
"ATTR_70", NULL, 1, 0x70},
255 {6,
"ATTR_71", NULL, 1, 0x71},
256 {6,
"ATTR_73", NULL, 1, 0x73},
257 {6,
"ATTR_74", NULL, 1, 0x74},
259 {0, NULL, NULL, 0, 0}
264 {4,
".com/", 0, 0x85},
265 {4,
".edu/", 0, 0x86},
266 {4,
".net/", 0, 0x87},
267 {4,
".org/", 0, 0x88},
268 {4,
"accept", 0, 0x89},
269 {4,
"bottom", 0, 0x8a},
270 {4,
"clear", 0, 0x8b},
271 {4,
"delete", 0, 0x8c},
272 {4,
"help", 0, 0x8d},
273 {4,
"http://", 0, 0x8e},
274 {4,
"http://www.", 0, 0x8f},
275 {4,
"https://", 0, 0x90},
276 {4,
"https://www.", 0, 0x91},
277 {4,
"middle", 0, 0x93},
278 {4,
"nowrap", 0, 0x94},
279 {4,
"onenterbackward", 0, 0x96},
280 {4,
"onenterforward", 0, 0x97},
281 {4,
"onpick", 0, 0x95},
282 {4,
"ontimer", 0, 0x98},
283 {4,
"options", 0, 0x99},
284 {4,
"password", 0, 0x9a},
285 {4,
"reset", 0, 0x9b},
286 {4,
"text", 0, 0x9d},
288 {4,
"unknown", 0, 0x9f},
289 {4,
"wrap", 0, 0xa0},
290 {4,
"www.", 0, 0xa1},
413 dtd_id = (long) dtdnum[0];
495 Message(
"Input stream is incomplete (EOF).");
499 Message(
"Internal error: Bad parameter.");
531 Message(
"Token EXT_0 encountered. This token is reserved for future expansion.");
535 Message(
"Token EXT_1 encountered. This token is reserved for future expansion.");
539 Message(
"Token EXT_2 encountered. This token is reserved for future expansion.");
559 return (buffer->
m_length - bytesRead);
604 return ((result & 0x80) != 0x80);
606 return ((result & 0x80) == 0x80);
615 memcpy(&tmpbuffer, buffer,
sizeof(
WBXML_INFO));
630 memcpy(&tmpbuffer, buffer,
sizeof(
WBXML_INFO));
698 result = ((*buffer->
m_curpos) == 0);
720 if (buffer && result)
740 if (buffer && result)
750 if ( !( (*result)[i] & 0x80 ) )
767 if (buffer && result)
772 memcpy(*result, buffer->
m_curpos, length);
829 if ((tag & 0x80) != 0x80)
840 if ((tag & 0x80) == 0x80)
883 result |= ((*value)[i] & 0x7f);
885 if ( !( (*value)[i] & 0x80 ) )
902 if ((*str < 0x20) || (*str > 0x7F))
905 printf(
"&#x%02x;", *str);
917 printf(
"&#x%2x", *str);
955 while (
Is_pi(buffer))
962 while (
Is_pi(buffer))
1025 else if (
Is_pi(buffer))
1344 #define STRING_BLOCK_SIZE 256 1347 char* strbuf = (
char*)
malloc(buflen);
1359 strbuf =
realloc(strbuf, buflen);
1367 if (doubled ==
TRUE)
1389 char* strbuf = NULL;
1464 long curpos = ftell(
file);
1466 fseek(
file, 0, SEEK_END);
1467 endpos = ftell(
file);
1468 fseek(
file, curpos, SEEK_SET);
1505 while ((n = fread(buf, 1,
sizeof(buf),
file)) > 0)
1508 memcpy(buffer->
m_start + (
sizeof(buf) * (m - 1)), buf,
sizeof(buf));
1646 pStringsNode = pStringsNode->
m_parent;
1649 while (pStringsNode->
m_next)
1651 pStringsNode = pStringsNode->
m_next;
1656 pStringsNode = pStringsNode->
m_prev;
1661 return "!!NO STRING TABLE!!";
1672 return "!!STRING TABLE INDEX TOO LARGE!!";
1690 for (i=0; i<indent; i++)
1710 printf(
"<?xml version=\"1.0\"?>\n<!DOCTYPE wml PUBLIC ");
1739 bAttributesFollow =
TRUE;
1781 *value =
realloc(*value, strlen(*value) + strlen((
char*) node->
m_data) + 1);
1782 strcat(*value, (
char*) node->
m_data);
1820 DumpNode(curnode, indent, &bAttributesFollow, bHasContent, value);
1821 curnode = curnode->
m_prev;
1830 for (i=0; i<indent; i++)
1864 curnode = curnode->
m_prev;
1880 file = fopen(argv[1],
"r");
WBXML_MB_U_INT32 m_length
static P_WBXML_NODE NewNode(P_WBXML_INFO buffer, WBXML_NODE_TYPE type)
void error(int err, const char *fmt,...)
static const char * GetStringTableString(P_WBXML_NODE node, long index)
WBXML_MB_U_INT32 * P_WBXML_MB_U_INT32
BOOL IsCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
void Read_termstr_rtn(P_WBXML_INFO buffer, char **result)
unsigned long WBXML_LENGTH
BOOL Is_tableref(P_WBXML_INFO buffer)
enum tagWBXML_PARSE_ERROR WBXML_PARSE_ERROR
unsigned char WBXML_CODEPAGE
WBXML_NODE * P_WBXML_NODE
static size_t BufferLength(P_WBXML_INFO buffer)
CODEPAGE_TAG_NAME_LIST CodepageTagNames[]
void Read_entity(P_WBXML_INFO buffer)
void Read_extension(P_WBXML_INFO buffer)
BOOL Is_extension(P_WBXML_INFO buffer)
enum tagCP_TYPES CP_TAG_TYPE
void Read_content(P_WBXML_INFO buffer)
WBXML_BYTES * P_WBXML_BYTES
unsigned char WBXML_MB_U_INT32[MAX_MB_U_INT32_BYTES]
long mb_u_int32_to_long(P_WBXML_MB_U_INT32 value)
void Read_index(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
WBXML_U_INT8 * P_WBXML_U_INT8
BOOL Is_zero(P_WBXML_INFO buffer)
static const char * CodepageAttrstartName(WBXML_CODEPAGE page, WBXML_TAG tag, char **value)
BOOL Is_switchPage(P_WBXML_INFO buffer)
static const char * CodepageTagName(WBXML_CODEPAGE page, WBXML_TAG tag)
void Read_pageindex(P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
void Read_publicid(P_WBXML_INFO buffer)
static void AddDTDNode(P_WBXML_INFO buffer, const WBXML_DTD_TYPE dtdnum, const WBXML_MB_U_INT32 index)
void Read_length(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
WBXML_STRING_TABLE * P_WBXML_STRING_TABLE
BOOL Is_opaque(P_WBXML_INFO buffer)
void Read_switchPage(P_WBXML_INFO buffer)
static void DumpNode(P_WBXML_NODE node, int indent, BOOL *inattrs, BOOL hascontent, char **value)
void Read_tableref(P_WBXML_INFO buffer)
void Read_element(P_WBXML_INFO buffer)
void Read_mb_u_int32(P_WBXML_INFO buffer, P_WBXML_MB_U_INT32 result)
static void DumpNodes(P_WBXML_INFO buffer)
static void AddAttrStartLiteralNode(P_WBXML_INFO buffer, WBXML_MB_U_INT32 index)
static void AddAttrStartNode(P_WBXML_INFO buffer, WBXML_TAG tag)
CODEPAGE_ATTRVALUE_NAME_LIST CodepageAttrvalueNames[]
#define STRING_BLOCK_SIZE
CODEPAGE_ATTRSTART_NAME_LIST CodepageAttrstartNames[]
#define CODEPAGE_TAG_MASK
static const char * DTDTypeName(long dtdnum)
BOOL Is_attrValue(P_WBXML_INFO buffer)
void Read_attribute(P_WBXML_INFO buffer)
static void AddVariableStringNode(P_WBXML_INFO buffer, char *string, WBXML_VARIABLE_TYPE type)
unsigned char WBXML_U_INT8
DTD_TYPE_LIST DTDTypeList[]
BOOL Is_pi(P_WBXML_INFO buffer)
void Read_u_int8(P_WBXML_INFO buffer, P_WBXML_U_INT8 result)
void Read_version(P_WBXML_INFO buffer)
#define CODEPAGE_TAG_HAS_CONTENT
#define MAX_MB_U_INT32_BYTES
void ParseError(WBXML_PARSE_ERROR error)
void Read_entcode(P_WBXML_INFO buffer)
void ParseWarning(WBXML_PARSE_WARNING warning)
void warning(int err, const char *fmt,...)
BOOL Is_string(P_WBXML_INFO buffer)
WBXML_MB_U_INT32 WBXML_DTD_TYPE
static void AddVariableIndexNode(P_WBXML_INFO buffer, char *string, WBXML_VARIABLE_TYPE type)
void Read_attrStart(P_WBXML_INFO buffer)
void Read_bytes(P_WBXML_INFO buffer, WBXML_LENGTH length, P_WBXML_BYTES result)
enum tagWBXML_PARSE_WARNING WBXML_PARSE_WARNING
WBXML_LENGTH BytesLeft(P_WBXML_INFO buffer)
static void FreeNode(P_WBXML_NODE node)
static void OutputEncodedString(const unsigned char *str)
static void AddCodepageLiteralTagNode(P_WBXML_INFO buffer, WBXML_MB_U_INT32 index)
static void ReadBinary(P_WBXML_INFO buffer, FILE *file)
void Read_pi(P_WBXML_INFO buffer)
BOOL Is_entity(P_WBXML_INFO buffer)
void Read_strtbl(P_WBXML_INFO buffer)
static void CodepageAttrvalueName(WBXML_CODEPAGE page, WBXML_TAG tag, char **value)
static void AddAttrValueNode(P_WBXML_INFO buffer, WBXML_TAG tag)
unsigned char * WBXML_BYTES
void Read_termstr(P_WBXML_INFO buffer)
void Read_start(P_WBXML_INFO buffer)
static void AddStringTableNode(P_WBXML_INFO buffer, const P_WBXML_STRING_TABLE strings)
void Read_charset(P_WBXML_INFO buffer)
static long FileSize(FILE *file)
void Read_opaque(P_WBXML_INFO buffer)
static void Free(P_WBXML_INFO buffer)
static void Init(P_WBXML_INFO buffer)
void Read_string(P_WBXML_INFO buffer)
static void AddAttrEndNode(P_WBXML_INFO buffer)
BOOL Is_inline(P_WBXML_INFO buffer)
int main(int argc, char **argv)
const WBXML_MB_U_INT32 ZERO_WBXML_MB_U_INT32
BOOL IsTag(P_WBXML_INFO buffer, WBXML_TAG tag)
static void AddStringNode(P_WBXML_INFO buffer, char *string)
void ReadFixedTag(P_WBXML_INFO buffer, WBXML_TAG tag)
WBXML_TAG Read_stag(P_WBXML_INFO buffer)
static void AddCodepageTagNode(P_WBXML_INFO buffer, WBXML_TAG tag)
static XMLRPCDocument * msg
void Read_attrValue(P_WBXML_INFO buffer)
void Read_inline(P_WBXML_INFO buffer)
void Read_zero(P_WBXML_INFO buffer)
void Read_body(P_WBXML_INFO buffer)
WBXML_TAG ReadCodepageTag(P_WBXML_INFO buffer, CP_TAG_TYPE type)
#define CODEPAGE_TAG_HAS_ATTRS