This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| int | wml_compile (Octstr *wml_text, Octstr *charset, Octstr **wml_binary, Octstr *version) |
| void | wml_init (int wml_xml_strict) |
| void | wml_shutdown (void) |
|
||||||||||||||||||||
|
Definition at line 359 of file wml_compiler.c. References charset, debug(), error(), octstr_create, octstr_get_cstr, octstr_len(), octstr_search_char(), octstr_strip_blanks(), parse_document(), parse_entities(), size, wml_binary_create(), wml_binary_destroy(), wml_binary_output(), wml_xml_parser_opt, and xml_error(). Referenced by convert_wml_to_wmlc(), and main(). 00361 {
00362 int ret = 0;
00363 size_t size;
00364 xmlDocPtr pDoc = NULL;
00365 char *wml_c_text;
00366 wml_binary_t *wbxml = NULL;
00367
00368 *wml_binary = octstr_create("");
00369 wbxml = wml_binary_create();
00370
00371 /* Remove the extra space from start and the end of the WML Document. */
00372 octstr_strip_blanks(wml_text);
00373
00374 /* Check the WML-code for \0-characters and for WML entities. Fast patch.
00375 -- tuo */
00376 parse_entities(wml_text);
00377
00378 size = octstr_len(wml_text);
00379 wml_c_text = octstr_get_cstr(wml_text);
00380
00381 debug("wml_compile",0, "WML: Given charset: %s", octstr_get_cstr(charset));
00382
00383 if (octstr_search_char(wml_text, '\0', 0) != -1) {
00384 error(0, "WML compiler: Compiling error: "
00385 "\\0 character found in the middle of the WML source.");
00386 ret = -1;
00387 } else {
00388 /*
00389 * An empty octet string for the binary output is created, the wml
00390 * source is parsed into a parsing tree and the tree is then compiled
00391 * into binary.
00392 */
00393
00394 pDoc = xmlReadMemory(wml_c_text, size, NULL, octstr_get_cstr(charset),
00395 wml_xml_parser_opt);
00396
00397 if (pDoc != NULL) {
00398 /*
00399 * If we have a set internal encoding, then apply this information
00400 * to the XML parsing tree document for later transcoding ability.
00401 */
00402 if (charset)
00403 pDoc->charset = xmlParseCharEncoding(octstr_get_cstr(charset));
00404
00405 ret = parse_document(pDoc, charset, &wbxml, version);
00406 wml_binary_output(*wml_binary, wbxml);
00407 } else {
00408 error(0, "WML compiler: Compiling error: "
00409 "libxml2 returned a NULL pointer");
00410 xml_error();
00411 ret = -1;
00412 }
00413 }
00414
00415 wml_binary_destroy(wbxml);
00416
00417 if (pDoc)
00418 xmlFreeDoc(pDoc);
00419
00420 return ret;
00421 }
|
Here is the call graph for this function:

|
|
Definition at line 428 of file wml_compiler.c. References attr_dict_construct(), attribute_destroy(), dict_create(), dict_put(), gwlist_append(), gwlist_create, hash_create(), hash_destroy(), wml_hash_t::item, text, token, wml_attr_values_list, wml_attributes_dict, wml_elements_dict, wml_table3_len(), wml_table_len(), wml_URL_values_list, and wml_xml_parser_opt. Referenced by main(). 00429 {
00430 int i = 0, len = 0;
00431 wml_hash_t *temp = NULL;
00432
00433 /* The wml elements into a hash table. */
00434 len = wml_table_len(wml_elements);
00435 wml_elements_dict = dict_create(len, hash_destroy);
00436
00437 for (i = 0; i < len; i++) {
00438 temp = hash_create(wml_elements[i].text, wml_elements[i].token);
00439 dict_put(wml_elements_dict, temp->item, temp);
00440 }
00441
00442 /* Attributes. */
00443 len = wml_table3_len(wml_attributes);
00444 wml_attributes_dict = dict_create(len, attribute_destroy);
00445 attr_dict_construct(wml_attributes, wml_attributes_dict);
00446
00447 /* Attribute values. */
00448 len = wml_table_len(wml_attribute_values);
00449 wml_attr_values_list = gwlist_create();
00450
00451 for (i = 0; i < len; i++) {
00452 temp = hash_create(wml_attribute_values[i].text,
00453 wml_attribute_values[i].token);
00454 gwlist_append(wml_attr_values_list, temp);
00455 }
00456
00457 /* URL values. */
00458 len = wml_table_len(wml_URL_values);
00459 wml_URL_values_list = gwlist_create();
00460
00461 for (i = 0; i < len; i++) {
00462 temp = hash_create(wml_URL_values[i].text, wml_URL_values[i].token);
00463 gwlist_append(wml_URL_values_list, temp);
00464 }
00465
00466 /* Strict XML parsing. */
00467 wml_xml_parser_opt = wml_xml_strict ?
00468 (XML_PARSE_NOERROR | XML_PARSE_NONET) :
00469 (XML_PARSE_RECOVER | XML_PARSE_NOERROR | XML_PARSE_NONET);
00470 }
|
Here is the call graph for this function:

|
|
Definition at line 478 of file wml_compiler.c. References dict_destroy(), gwlist_destroy(), hash_destroy(), wml_attr_values_list, wml_attributes_dict, wml_elements_dict, and wml_URL_values_list. Referenced by main(). 00479 {
00480 dict_destroy(wml_elements_dict);
00481 dict_destroy(wml_attributes_dict);
00482 gwlist_destroy(wml_attr_values_list, hash_destroy);
00483 gwlist_destroy(wml_URL_values_list, hash_destroy);
00484 }
|
Here is the call graph for this function:
