mirror of
https://github.com/lexborisov/Modest
synced 2024-11-21 21:31:25 +03:00
This commit is contained in:
parent
5d39ca65f9
commit
c476946ddd
@ -34,13 +34,13 @@ extern "C" {
|
||||
|
||||
struct modest_node_serialization_context {
|
||||
modest_t* modest;
|
||||
mycss_callback_serialization_f callback;
|
||||
mycore_callback_serialize_f callback;
|
||||
void* context;
|
||||
bool is_use;
|
||||
}
|
||||
typedef modest_node_serialization_context_t;
|
||||
|
||||
bool modest_node_raw_serialization(modest_t* modest, modest_node_t* mnode, mycss_callback_serialization_f callback, void* context);
|
||||
bool modest_node_raw_serialization(modest_t* modest, modest_node_t* mnode, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -42,7 +42,7 @@ void modest_render_tree_clean_all(modest_render_tree_t* render_tree);
|
||||
modest_render_tree_t * modest_render_tree_destroy(modest_render_tree_t* render_tree, bool self_destroy);
|
||||
|
||||
void modest_render_tree_serialization(myhtml_tree_t* html_tree, modest_render_tree_t* tree,
|
||||
modest_render_tree_node_t* scope_node, mycss_callback_serialization_f callback, void* context);
|
||||
modest_render_tree_node_t* scope_node, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -62,7 +62,7 @@ void modest_render_tree_node_remove(modest_render_tree_node_t* node);
|
||||
void modest_render_tree_node_append_after(modest_render_tree_node_t* target, modest_render_tree_node_t* node);
|
||||
void modest_render_tree_node_append_before(modest_render_tree_node_t* target, modest_render_tree_node_t* node);
|
||||
|
||||
void modest_render_tree_node_serialization(myhtml_tree_t* html_tree, modest_render_tree_node_t* node, mycss_callback_serialization_f callback, void* context);
|
||||
void modest_render_tree_node_serialization(myhtml_tree_t* html_tree, modest_render_tree_node_t* node, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -138,7 +138,7 @@ typedef struct mycore_string mycore_string_t;
|
||||
typedef struct mycore_incoming_buffer mycore_incoming_buffer_t;
|
||||
|
||||
/* callbacks */
|
||||
typedef void (*mycore_callback_serialize_f)(const char* buffer, size_t size, void* ctx);
|
||||
typedef mystatus_t (*mycore_callback_serialize_f)(const char* buffer, size_t size, void* ctx);
|
||||
|
||||
void * mycore_malloc(size_t size);
|
||||
void * mycore_realloc(void* dst, size_t size);
|
||||
|
@ -53,7 +53,7 @@ mycss_an_plus_b_entry_t * mycss_an_plus_b_entry_create(mycss_entry_t* entry);
|
||||
void mycss_an_plus_b_entry_clean_all(mycss_an_plus_b_entry_t* anb_entry);
|
||||
mycss_an_plus_b_entry_t * mycss_an_plus_b_entry_destroy(mycss_entry_t* entry, mycss_an_plus_b_entry_t* anb_entry, bool self_destroy);
|
||||
|
||||
void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
void mycss_an_plus_b_parser_expectations_error(mycss_entry_t* entry);
|
||||
|
||||
|
@ -32,31 +32,31 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef bool (*mycss_declaration_serialization_f)(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context);
|
||||
mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_type_list(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_line(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_skip(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font_family(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_type_list(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_line(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_skip(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font_family(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -263,7 +263,6 @@ typedef mycss_token_t * (*mycss_token_ready_callback_f)(mycss_entry_t* entry, my
|
||||
typedef size_t (*mycss_string_process_state_f)(mycore_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
typedef bool (*mycss_parser_token_f)(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
typedef bool (*mycss_an_plus_b_state_f)(mycss_entry_t* entry, mycss_an_plus_b_t* anb, mycss_an_plus_b_entry_t* anb_entry, mycss_token_t* token);
|
||||
typedef void (*mycss_callback_serialization_f)(const char* buffer, size_t size, void* ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -29,8 +29,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void mycss_namespace_serialization_stylesheet(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_namespace_serialization_entry(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry, mycss_callback_serialization_f callback, void* context, bool with_vbar);
|
||||
void mycss_namespace_serialization_stylesheet(mycss_namespace_stylesheet_t* ns_stylesheet, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_namespace_serialization_entry(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry, mycore_callback_serialize_f callback, void* context, bool with_vbar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -30,8 +30,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void mycss_property_serialization_type_name(mycss_property_type_t prop_type, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_property_serialization_value(unsigned int value_type, void* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_property_serialization_type_name(mycss_property_type_t prop_type, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_property_serialization_value(unsigned int value_type, void* value, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -30,9 +30,9 @@ extern "C" {
|
||||
#include <mycss/namespace/serialization.h>
|
||||
#include <mycss/declaration/serialization.h>
|
||||
|
||||
void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_selectors_serialization_selector(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_selectors_serialization_selector(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -49,7 +49,7 @@ mystatus_t mycss_stylesheet_init(mycss_stylesheet_t* stylesheet, mycss_entry_t*
|
||||
mystatus_t mycss_stylesheet_clean_all(mycss_stylesheet_t* stylesheet);
|
||||
mycss_stylesheet_t * mycss_stylesheet_destroy(mycss_stylesheet_t* stylesheet, bool self_destroy);
|
||||
|
||||
void mycss_stylesheet_serialization(mycss_stylesheet_t* stylesheet, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_stylesheet_serialization(mycss_stylesheet_t* stylesheet, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -30,21 +30,21 @@ extern "C" {
|
||||
#include <mycss/values/color.h>
|
||||
#include <mycss/property/const.h>
|
||||
|
||||
void mycss_values_serialization_string(mycore_string_t* str, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_length(mycss_values_length_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_angle(mycss_values_angle_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_resolution(mycss_values_resolution_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_percentage(mycss_values_percentage_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_type_length_percentage(mycss_values_type_length_percentage_entry_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_line(mycss_values_text_decoration_line_t value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoration_skip_t value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_url(mycss_values_url_t* url, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_border(mycss_values_border_t* border, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_string(mycore_string_t* str, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_number(mycss_values_number_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_length(mycss_values_length_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_angle(mycss_values_angle_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_resolution(mycss_values_resolution_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_percentage(mycss_values_percentage_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_type_length_percentage(mycss_values_type_length_percentage_entry_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_color(mycss_values_color_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_line(mycss_values_text_decoration_line_t value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoration_skip_t value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_url(mycss_values_url_t* url, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_image(mycss_values_image_t* image, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_border(mycss_values_border_t* border, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -2471,14 +2471,14 @@ mycore_strncasecmp(const char* str1, const char* str2, size_t size);
|
||||
* Tree fragment serialization
|
||||
* The same as myhtml_serialization_tree_buffer function
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
* Only one tree node serialization
|
||||
* The same as myhtml_serialization_node_buffer function
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
@ -2490,7 +2490,7 @@ myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
@ -2502,7 +2502,7 @@ myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_r
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
@ -2515,7 +2515,7 @@ myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t*
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node,
|
||||
mycore_callback_serialize_f callback, void* ptr);
|
||||
|
||||
@ -2529,7 +2529,7 @@ myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node,
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_node_callback(myhtml_tree_node_t* node,
|
||||
mycore_callback_serialize_f callback, void* ptr);
|
||||
|
||||
|
@ -31,15 +31,15 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// the serialization functions
|
||||
bool myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
bool myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
bool myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node, mycore_callback_serialize_f callback, void* ptr);
|
||||
bool myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr);
|
||||
mystatus_t myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node, mycore_callback_serialize_f callback, void* ptr);
|
||||
mystatus_t myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr);
|
||||
|
||||
// in versuon 1.0.3 this is in public api.
|
||||
// Need to set deprecated?
|
||||
bool myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
bool myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "modest/node/serialization.h"
|
||||
|
||||
void modest_node_raw_serialization_declaration(mycss_entry_t* mycss_entry, mycss_declaration_entry_t* decl, mycss_property_type_t property_type, mycss_callback_serialization_f callback, void* context, bool* is_use)
|
||||
void modest_node_raw_serialization_declaration(mycss_entry_t* mycss_entry, mycss_declaration_entry_t* decl, mycss_property_type_t property_type, mycore_callback_serialize_f callback, void* context, bool* is_use)
|
||||
{
|
||||
if(decl == NULL)
|
||||
return;
|
||||
@ -36,7 +36,7 @@ void modest_node_raw_serialization_declaration(mycss_entry_t* mycss_entry, mycss
|
||||
}
|
||||
}
|
||||
|
||||
//bool modest_node_raw_serialization(mycss_entry_t* mycss_entry, modest_node_t* mnode, mycss_callback_serialization_f callback, void* context)
|
||||
//bool modest_node_raw_serialization(mycss_entry_t* mycss_entry, modest_node_t* mnode, mycore_callback_serialize_f callback, void* context)
|
||||
//{
|
||||
// bool is_use = false;
|
||||
//
|
||||
@ -56,7 +56,7 @@ void modest_node_raw_serialization_callback(mycore_utils_avl_tree_node_t* node,
|
||||
modest_node_raw_serialization_declaration(ctx->modest->mycss_entry, raw_declr->declaration, (mycss_property_type_t)node->type, ctx->callback, ctx->context, &ctx->is_use);
|
||||
}
|
||||
|
||||
bool modest_node_raw_serialization(modest_t* modest, modest_node_t* mnode, mycss_callback_serialization_f callback, void* context)
|
||||
bool modest_node_raw_serialization(modest_t* modest, modest_node_t* mnode, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
modest_node_serialization_context_t ctx = {modest, callback, context, 0};
|
||||
|
||||
|
@ -34,13 +34,13 @@ extern "C" {
|
||||
|
||||
struct modest_node_serialization_context {
|
||||
modest_t* modest;
|
||||
mycss_callback_serialization_f callback;
|
||||
mycore_callback_serialize_f callback;
|
||||
void* context;
|
||||
bool is_use;
|
||||
}
|
||||
typedef modest_node_serialization_context_t;
|
||||
|
||||
bool modest_node_raw_serialization(modest_t* modest, modest_node_t* mnode, mycss_callback_serialization_f callback, void* context);
|
||||
bool modest_node_raw_serialization(modest_t* modest, modest_node_t* mnode, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -59,7 +59,7 @@ modest_render_tree_t * modest_render_tree_destroy(modest_render_tree_t* render_t
|
||||
}
|
||||
|
||||
void modest_render_tree_serialization(myhtml_tree_t* html_tree, modest_render_tree_t* tree,
|
||||
modest_render_tree_node_t* scope_node, mycss_callback_serialization_f callback, void* context)
|
||||
modest_render_tree_node_t* scope_node, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
modest_render_tree_node_t* node = scope_node;
|
||||
size_t depth = 0;
|
||||
|
@ -42,7 +42,7 @@ void modest_render_tree_clean_all(modest_render_tree_t* render_tree);
|
||||
modest_render_tree_t * modest_render_tree_destroy(modest_render_tree_t* render_tree, bool self_destroy);
|
||||
|
||||
void modest_render_tree_serialization(myhtml_tree_t* html_tree, modest_render_tree_t* tree,
|
||||
modest_render_tree_node_t* scope_node, mycss_callback_serialization_f callback, void* context);
|
||||
modest_render_tree_node_t* scope_node, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -122,7 +122,7 @@ void modest_render_tree_node_append_before(modest_render_tree_node_t* target, mo
|
||||
target->prev = node;
|
||||
}
|
||||
|
||||
void modest_render_tree_node_serialization(myhtml_tree_t* html_tree, modest_render_tree_node_t* node, mycss_callback_serialization_f callback, void* context)
|
||||
void modest_render_tree_node_serialization(myhtml_tree_t* html_tree, modest_render_tree_node_t* node, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
callback("<", 1, context);
|
||||
|
||||
|
@ -62,7 +62,7 @@ void modest_render_tree_node_remove(modest_render_tree_node_t* node);
|
||||
void modest_render_tree_node_append_after(modest_render_tree_node_t* target, modest_render_tree_node_t* node);
|
||||
void modest_render_tree_node_append_before(modest_render_tree_node_t* target, modest_render_tree_node_t* node);
|
||||
|
||||
void modest_render_tree_node_serialization(myhtml_tree_t* html_tree, modest_render_tree_node_t* node, mycss_callback_serialization_f callback, void* context);
|
||||
void modest_render_tree_node_serialization(myhtml_tree_t* html_tree, modest_render_tree_node_t* node, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -138,7 +138,7 @@ typedef struct mycore_string mycore_string_t;
|
||||
typedef struct mycore_incoming_buffer mycore_incoming_buffer_t;
|
||||
|
||||
/* callbacks */
|
||||
typedef void (*mycore_callback_serialize_f)(const char* buffer, size_t size, void* ctx);
|
||||
typedef mystatus_t (*mycore_callback_serialize_f)(const char* buffer, size_t size, void* ctx);
|
||||
|
||||
void * mycore_malloc(size_t size);
|
||||
void * mycore_realloc(void* dst, size_t size);
|
||||
|
@ -91,7 +91,7 @@ void mycss_an_plus_b_parser_expectations_error(mycss_entry_t* entry)
|
||||
//// An+B Serialization
|
||||
////
|
||||
/////////////////////////////////////////////////////////
|
||||
void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
char data[512];
|
||||
|
||||
|
@ -53,7 +53,7 @@ mycss_an_plus_b_entry_t * mycss_an_plus_b_entry_create(mycss_entry_t* entry);
|
||||
void mycss_an_plus_b_entry_clean_all(mycss_an_plus_b_entry_t* anb_entry);
|
||||
mycss_an_plus_b_entry_t * mycss_an_plus_b_entry_destroy(mycss_entry_t* entry, mycss_an_plus_b_entry_t* anb_entry, bool self_destroy);
|
||||
|
||||
void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
void mycss_an_plus_b_parser_expectations_error(mycss_entry_t* entry);
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "mycss/declaration/serialization.h"
|
||||
#include "mycss/declaration/serialization_resources.h"
|
||||
|
||||
static void mycss_declaration_serialization_important_if_need(mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context)
|
||||
static void mycss_declaration_serialization_important_if_need(mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry->is_important) {
|
||||
callback(" !important", 11, context);
|
||||
@ -29,7 +29,7 @@ static void mycss_declaration_serialization_important_if_need(mycss_declaration_
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -42,7 +42,7 @@ bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declarati
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -52,7 +52,7 @@ bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycs
|
||||
|
||||
bool mycss_declaration_serialization_entry_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_property_type_t property_type,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL || property_type >= MyCSS_PROPERTY_TYPE_LAST_ENTRY)
|
||||
return false;
|
||||
@ -66,7 +66,7 @@ bool mycss_declaration_serialization_entry_by_type(mycss_entry_t* entry, mycss_d
|
||||
|
||||
bool mycss_declaration_serialization_entry_only_value_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_property_type_t property_type,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL || property_type >= MyCSS_PROPERTY_TYPE_LAST_ENTRY)
|
||||
return false;
|
||||
@ -76,7 +76,7 @@ bool mycss_declaration_serialization_entry_only_value_by_type(mycss_entry_t* ent
|
||||
|
||||
|
||||
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(first_dec_entry == NULL)
|
||||
return;
|
||||
@ -94,7 +94,7 @@ void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declara
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -106,7 +106,7 @@ bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declarati
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL || dec_entry->value == NULL)
|
||||
return false;
|
||||
@ -146,7 +146,7 @@ bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_shorthand_two(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL || dec_entry->value == NULL)
|
||||
return false;
|
||||
@ -172,7 +172,7 @@ bool mycss_declaration_serialization_shorthand_two(mycss_entry_t* entry, mycss_d
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_shorthand_two_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL || dec_entry->value == NULL)
|
||||
return false;
|
||||
@ -195,7 +195,7 @@ bool mycss_declaration_serialization_shorthand_two_type(mycss_entry_t* entry, my
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_type_list(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -218,7 +218,7 @@ bool mycss_declaration_serialization_type_list(mycss_entry_t* entry, mycss_decla
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_text_decoration(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -255,7 +255,7 @@ bool mycss_declaration_serialization_text_decoration(mycss_entry_t* entry, mycss
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_font_family(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -286,7 +286,7 @@ bool mycss_declaration_serialization_font_family(mycss_entry_t* entry, mycss_dec
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_font(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -345,7 +345,7 @@ bool mycss_declaration_serialization_font(mycss_entry_t* entry, mycss_declaratio
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -427,7 +427,7 @@ bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_d
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_text_decoration_line(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -442,7 +442,7 @@ bool mycss_declaration_serialization_text_decoration_line(mycss_entry_t* entry,
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_text_decoration_skip(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -457,7 +457,7 @@ bool mycss_declaration_serialization_text_decoration_skip(mycss_entry_t* entry,
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_background(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -521,7 +521,7 @@ bool mycss_declaration_serialization_background(mycss_entry_t* entry, mycss_decl
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -544,7 +544,7 @@ bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycs
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -574,7 +574,7 @@ bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, myc
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -612,7 +612,7 @@ bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, m
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
@ -635,7 +635,7 @@ bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss
|
||||
}
|
||||
|
||||
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(dec_entry == NULL)
|
||||
return false;
|
||||
|
@ -32,31 +32,31 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef bool (*mycss_declaration_serialization_f)(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,
|
||||
mycss_callback_serialization_f callback, void* context);
|
||||
mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_declaration_serialization_entries(mycss_entry_t* entry, mycss_declaration_entry_t* first_dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry,mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_entry_only_value_by_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_property_type_t property_type, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_type_list(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_line(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_skip(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font_family(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_declaration_serialization_undef(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_four(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_shorthand_two_type(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_type_list(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_radius(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_line(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_text_decoration_skip(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font_family(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_font(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_image(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_repeat(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_background_size(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_declaration_serialization_border_x(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -263,7 +263,6 @@ typedef mycss_token_t * (*mycss_token_ready_callback_f)(mycss_entry_t* entry, my
|
||||
typedef size_t (*mycss_string_process_state_f)(mycore_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
typedef bool (*mycss_parser_token_f)(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
typedef bool (*mycss_an_plus_b_state_f)(mycss_entry_t* entry, mycss_an_plus_b_t* anb, mycss_an_plus_b_entry_t* anb_entry, mycss_token_t* token);
|
||||
typedef void (*mycss_callback_serialization_f)(const char* buffer, size_t size, void* ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "mycss/namespace/serialization.h"
|
||||
|
||||
void mycss_namespace_serialization_stylesheet(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_namespace_serialization_stylesheet(mycss_namespace_stylesheet_t* ns_stylesheet, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
mycss_namespace_entry_t* ns_entry = ns_stylesheet->entry_first;
|
||||
|
||||
@ -43,7 +43,7 @@ void mycss_namespace_serialization_stylesheet(mycss_namespace_stylesheet_t* ns_s
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_namespace_serialization_entry(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry, mycss_callback_serialization_f callback, void* context, bool with_vbar)
|
||||
void mycss_namespace_serialization_entry(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry, mycore_callback_serialize_f callback, void* context, bool with_vbar)
|
||||
{
|
||||
if(ns_entry->name && ns_entry->name->length) {
|
||||
callback(ns_entry->name->data, ns_entry->name->length, context);
|
||||
|
@ -29,8 +29,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void mycss_namespace_serialization_stylesheet(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_namespace_serialization_entry(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry, mycss_callback_serialization_f callback, void* context, bool with_vbar);
|
||||
void mycss_namespace_serialization_stylesheet(mycss_namespace_stylesheet_t* ns_stylesheet, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_namespace_serialization_entry(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry, mycore_callback_serialize_f callback, void* context, bool with_vbar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "mycss/property/serialization.h"
|
||||
#include "mycss/property/resources_name.h"
|
||||
|
||||
void mycss_property_serialization_type_name(mycss_property_type_t prop_type, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_property_serialization_type_name(mycss_property_type_t prop_type, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(prop_type >= MyCSS_PROPERTY_TYPE_LAST_ENTRY)
|
||||
return;
|
||||
@ -30,7 +30,7 @@ void mycss_property_serialization_type_name(mycss_property_type_t prop_type, myc
|
||||
callback(name, strlen(name), context);
|
||||
}
|
||||
|
||||
void mycss_property_serialization_value(unsigned int value_type, void* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_property_serialization_value(unsigned int value_type, void* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL) {
|
||||
if(value_type < MyCSS_PROPERTY_VALUE_LAST_ENTRY) {
|
||||
|
@ -30,8 +30,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void mycss_property_serialization_type_name(mycss_property_type_t prop_type, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_property_serialization_value(unsigned int value_type, void* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_property_serialization_type_name(mycss_property_type_t prop_type, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_property_serialization_value(unsigned int value_type, void* value, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "mycss/selectors/myosi_resource.h"
|
||||
|
||||
void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
while(selector) {
|
||||
if(selector->combinator == MyCSS_SELECTORS_COMBINATOR_DESCENDANT)
|
||||
@ -46,7 +46,7 @@ void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_sel
|
||||
}
|
||||
|
||||
bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
while(selectors_list) {
|
||||
for(size_t i = 0; i < selectors_list->entries_list_length; i++)
|
||||
@ -78,7 +78,7 @@ bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_sele
|
||||
}
|
||||
|
||||
bool mycss_selectors_serialization_selector(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector,
|
||||
mycss_callback_serialization_f callback, void* context)
|
||||
mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
switch(selector->type) {
|
||||
case MyCSS_SELECTORS_TYPE_ELEMENT: {
|
||||
|
@ -30,9 +30,9 @@ extern "C" {
|
||||
#include "mycss/namespace/serialization.h"
|
||||
#include "mycss/declaration/serialization.h"
|
||||
|
||||
void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list, mycss_callback_serialization_f callback, void* context);
|
||||
bool mycss_selectors_serialization_selector(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list, mycore_callback_serialize_f callback, void* context);
|
||||
bool mycss_selectors_serialization_selector(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -60,7 +60,7 @@ mycss_stylesheet_t * mycss_stylesheet_destroy(mycss_stylesheet_t* stylesheet, bo
|
||||
}
|
||||
|
||||
/* print */
|
||||
void mycss_stylesheet_serialization(mycss_stylesheet_t* stylesheet, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_stylesheet_serialization(mycss_stylesheet_t* stylesheet, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
mycss_selectors_serialization_list(stylesheet->entry->selectors, stylesheet->sel_list_first, callback, context);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ mystatus_t mycss_stylesheet_init(mycss_stylesheet_t* stylesheet, mycss_entry_t*
|
||||
mystatus_t mycss_stylesheet_clean_all(mycss_stylesheet_t* stylesheet);
|
||||
mycss_stylesheet_t * mycss_stylesheet_destroy(mycss_stylesheet_t* stylesheet, bool self_destroy);
|
||||
|
||||
void mycss_stylesheet_serialization(mycss_stylesheet_t* stylesheet, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_stylesheet_serialization(mycss_stylesheet_t* stylesheet, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -23,18 +23,18 @@
|
||||
#include "mycss/property/resources_name.h"
|
||||
#include "mycore/utils/resources.h"
|
||||
|
||||
static void mycss_values_serialization_to_callback(const char* data, size_t len, mycss_callback_serialization_f callback, void* context)
|
||||
static void mycss_values_serialization_to_callback(const char* data, size_t len, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(len > 0)
|
||||
callback(data, len, context);
|
||||
}
|
||||
|
||||
void mycss_values_serialization_string(mycore_string_t* str, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_string(mycore_string_t* str, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
callback(str->data, str->length, context);
|
||||
}
|
||||
|
||||
void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_number(mycss_values_number_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL)
|
||||
return;
|
||||
@ -51,7 +51,7 @@ void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callb
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_length(mycss_values_length_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_length(mycss_values_length_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL)
|
||||
return;
|
||||
@ -73,7 +73,7 @@ void mycss_values_serialization_length(mycss_values_length_t* value, mycss_callb
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_angle(mycss_values_angle_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_angle(mycss_values_angle_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL)
|
||||
return;
|
||||
@ -95,7 +95,7 @@ void mycss_values_serialization_angle(mycss_values_angle_t* value, mycss_callbac
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_resolution(mycss_values_resolution_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_resolution(mycss_values_resolution_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL)
|
||||
return;
|
||||
@ -117,7 +117,7 @@ void mycss_values_serialization_resolution(mycss_values_resolution_t* value, myc
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_percentage(mycss_values_percentage_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_percentage(mycss_values_percentage_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL)
|
||||
return;
|
||||
@ -134,7 +134,7 @@ void mycss_values_serialization_percentage(mycss_values_percentage_t* value, myc
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_type_length_percentage(mycss_values_type_length_percentage_entry_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_type_length_percentage(mycss_values_type_length_percentage_entry_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
switch (value->type) {
|
||||
case MyCSS_PROPERTY_VALUE__LENGTH:
|
||||
@ -165,7 +165,7 @@ static void mycss_values_serialization_color_hex_two_value(int value, unsigned c
|
||||
data[1] = mycore_string_hex_to_char_map[ (unsigned int)((value) ^ ((value >> 4) << 4)) ];
|
||||
}
|
||||
|
||||
void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_color(mycss_values_color_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL)
|
||||
return;
|
||||
@ -332,7 +332,7 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(value == NULL)
|
||||
return;
|
||||
@ -347,7 +347,7 @@ void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* va
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_text_decoration_line(mycss_values_text_decoration_line_t value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_text_decoration_line(mycss_values_text_decoration_line_t value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
const char *text_value = NULL;
|
||||
|
||||
@ -381,7 +381,7 @@ void mycss_values_serialization_text_decoration_line(mycss_values_text_decoratio
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoration_skip_t value, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoration_skip_t value, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
const char *text_value = NULL;
|
||||
|
||||
@ -423,14 +423,14 @@ void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoratio
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_url(mycss_values_url_t* url, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_url(mycss_values_url_t* url, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
callback("url(", 4, context);
|
||||
callback(url->str.data, url->str.length, context);
|
||||
callback(")", 1, context);
|
||||
}
|
||||
|
||||
void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_image(mycss_values_image_t* image, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
switch (image->type) {
|
||||
case MyCSS_PROPERTY_VALUE__URL:
|
||||
@ -552,7 +552,7 @@ void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callbac
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
if(bg_size_entry->scale) {
|
||||
const char* text_value = mycss_property_index_type_value[bg_size_entry->scale];
|
||||
@ -571,7 +571,7 @@ void mycss_values_serialization_background_size_entry(mycss_values_background_si
|
||||
}
|
||||
}
|
||||
|
||||
void mycss_values_serialization_border(mycss_values_border_t* border, mycss_callback_serialization_f callback, void* context)
|
||||
void mycss_values_serialization_border(mycss_values_border_t* border, mycore_callback_serialize_f callback, void* context)
|
||||
{
|
||||
bool o_e = false;
|
||||
|
||||
|
@ -30,21 +30,21 @@ extern "C" {
|
||||
#include "mycss/values/color.h"
|
||||
#include "mycss/property/const.h"
|
||||
|
||||
void mycss_values_serialization_string(mycore_string_t* str, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_length(mycss_values_length_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_angle(mycss_values_angle_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_resolution(mycss_values_resolution_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_percentage(mycss_values_percentage_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_type_length_percentage(mycss_values_type_length_percentage_entry_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_line(mycss_values_text_decoration_line_t value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoration_skip_t value, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_url(mycss_values_url_t* url, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_border(mycss_values_border_t* border, mycss_callback_serialization_f callback, void* context);
|
||||
void mycss_values_serialization_string(mycore_string_t* str, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_number(mycss_values_number_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_length(mycss_values_length_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_angle(mycss_values_angle_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_resolution(mycss_values_resolution_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_percentage(mycss_values_percentage_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_type_length_percentage(mycss_values_type_length_percentage_entry_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_color(mycss_values_color_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_line(mycss_values_text_decoration_line_t value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_text_decoration_skip(mycss_values_text_decoration_skip_t value, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_url(mycss_values_url_t* url, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_image(mycss_values_image_t* image, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_background_size_entry(mycss_values_background_size_entry_t* bg_size_entry, mycore_callback_serialize_f callback, void* context);
|
||||
void mycss_values_serialization_border(mycss_values_border_t* border, mycore_callback_serialize_f callback, void* context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -2471,14 +2471,14 @@ mycore_strncasecmp(const char* str1, const char* str2, size_t size);
|
||||
* Tree fragment serialization
|
||||
* The same as myhtml_serialization_tree_buffer function
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
* Only one tree node serialization
|
||||
* The same as myhtml_serialization_node_buffer function
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
@ -2490,7 +2490,7 @@ myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
@ -2502,7 +2502,7 @@ myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_r
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
|
||||
/**
|
||||
@ -2515,7 +2515,7 @@ myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t*
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node,
|
||||
mycore_callback_serialize_f callback, void* ptr);
|
||||
|
||||
@ -2529,7 +2529,7 @@ myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node,
|
||||
*
|
||||
* @return true if successful, otherwise false
|
||||
*/
|
||||
bool
|
||||
mystatus_t
|
||||
myhtml_serialization_node_callback(myhtml_tree_node_t* node,
|
||||
mycore_callback_serialize_f callback, void* ptr);
|
||||
|
||||
|
@ -19,22 +19,21 @@
|
||||
Author: https://github.com/EmielBruijntjes (Emiel Bruijntjes)
|
||||
*/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include "myhtml/serialization.h"
|
||||
|
||||
/**
|
||||
* Forward declaration of all the functions that are used inside this module
|
||||
*/
|
||||
static void myhtml_serialization_append(const char* str, size_t size, mycore_callback_serialize_f callback, void *ptr);
|
||||
static void myhtml_serialization_append_attr(const char* str, size_t length, mycore_callback_serialize_f callback, void *ptr);
|
||||
static void myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* attr, mycore_callback_serialize_f callback, void *ptr);
|
||||
static void myhtml_serialization_node_append_text_node(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void *ptr);
|
||||
static void myhtml_serialization_node_append_close(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void *ptr);
|
||||
static mystatus_t myhtml_serialization_append(const char* str, size_t size, mycore_callback_serialize_f callback, void *ptr);
|
||||
static mystatus_t myhtml_serialization_append_attr(const char* str, size_t length, mycore_callback_serialize_f callback, void *ptr);
|
||||
static mystatus_t myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* attr, mycore_callback_serialize_f callback, void *ptr);
|
||||
static mystatus_t myhtml_serialization_node_append_text_node(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void *ptr);
|
||||
static mystatus_t myhtml_serialization_node_append_close(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void *ptr);
|
||||
|
||||
/**
|
||||
* See the function myhtml_serialization_tree_buffer
|
||||
*/
|
||||
bool myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str)
|
||||
mystatus_t myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str)
|
||||
{
|
||||
return myhtml_serialization_tree_buffer(scope_node, str);
|
||||
}
|
||||
@ -42,7 +41,7 @@ bool myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* s
|
||||
/**
|
||||
* See the function myhtml_serialization_node_buffer
|
||||
*/
|
||||
bool myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str)
|
||||
mystatus_t myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str)
|
||||
{
|
||||
return myhtml_serialization_node_buffer(node, str);
|
||||
}
|
||||
@ -55,32 +54,41 @@ bool myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* st
|
||||
* @param ptr user-supplied pointer
|
||||
* @return bool
|
||||
*/
|
||||
bool myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node, mycore_callback_serialize_f callback, void *ptr)
|
||||
mystatus_t myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node, mycore_callback_serialize_f callback, void *ptr)
|
||||
{
|
||||
myhtml_tree_node_t* node = scope_node;
|
||||
|
||||
while(node) {
|
||||
if(!myhtml_serialization_node_callback(node, callback, ptr)) return false;
|
||||
if(myhtml_serialization_node_callback(node, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(node->child)
|
||||
node = node->child;
|
||||
else {
|
||||
while(node != scope_node && node->next == NULL) {
|
||||
myhtml_serialization_node_append_close(node, callback, ptr);
|
||||
if(myhtml_serialization_node_append_close(node, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
node = node->parent;
|
||||
}
|
||||
|
||||
if(node == scope_node) {
|
||||
if(node != node->tree->document) myhtml_serialization_node_append_close(node, callback, ptr);
|
||||
if(node != node->tree->document) {
|
||||
if(myhtml_serialization_node_append_close(node, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
myhtml_serialization_node_append_close(node, callback, ptr);
|
||||
if(myhtml_serialization_node_append_close(node, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,46 +99,73 @@ bool myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node, mycore_c
|
||||
* @param ptr user-supplied pointer
|
||||
* @return bool
|
||||
*/
|
||||
bool myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void *ptr)
|
||||
mystatus_t myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void *ptr)
|
||||
{
|
||||
switch (node->tag_id) {
|
||||
case MyHTML_TAG__TEXT: {
|
||||
myhtml_serialization_node_append_text_node(node, callback, ptr);
|
||||
if(myhtml_serialization_node_append_text_node(node, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
break;
|
||||
}
|
||||
case MyHTML_TAG__COMMENT: {
|
||||
callback("<!--", 4, ptr);
|
||||
if(node->token && node->token->str.data) callback(node->token->str.data, node->token->str.length, ptr);
|
||||
callback("-->", 3, ptr);
|
||||
if(callback("<!--", 4, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(node->token && node->token->str.data) {
|
||||
if(callback(node->token->str.data, node->token->str.length, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback("-->", 3, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
break;
|
||||
}
|
||||
case MyHTML_TAG__DOCTYPE: {
|
||||
callback("<!DOCTYPE", 9, ptr);
|
||||
if(callback("<!DOCTYPE", 9, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(node->token) {
|
||||
myhtml_tree_attr_t* attr = node->token->attr_first;
|
||||
|
||||
if(attr->key.data && attr->key.length) {
|
||||
callback(" ", 1, ptr);
|
||||
callback(attr->key.data, attr->key.length, ptr);
|
||||
if(callback(" ", 1, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(callback(attr->key.data, attr->key.length, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
}
|
||||
callback(">", 1, ptr);
|
||||
|
||||
if(callback(">", 1, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
size_t length;
|
||||
const char *tag = myhtml_tag_name_by_id(node->tree, node->tag_id, &length);
|
||||
|
||||
callback("<", 1, ptr);
|
||||
callback(tag, length, ptr);
|
||||
if(node->token) myhtml_serialization_attributes(node->tree, node->token->attr_first, callback, ptr);
|
||||
callback(">", 1, ptr);
|
||||
if(callback("<", 1, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(callback(tag, length, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(node->token) {
|
||||
if(myhtml_serialization_attributes(node->tree, node->token->attr_first, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback(">", 1, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,14 +175,17 @@ bool myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_callbac
|
||||
* @param callback
|
||||
* @param ptr
|
||||
*/
|
||||
void myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* attr, mycore_callback_serialize_f callback, void* ptr)
|
||||
mystatus_t myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* attr, mycore_callback_serialize_f callback, void* ptr)
|
||||
{
|
||||
while(attr) {
|
||||
callback(" ", 1, ptr);
|
||||
if(callback(" ", 1, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
switch (attr->ns) {
|
||||
case MyHTML_NAMESPACE_XML:
|
||||
callback("xml:", 4, ptr);
|
||||
if(callback("xml:", 4, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
break;
|
||||
case MyHTML_NAMESPACE_XMLNS: {
|
||||
/*
|
||||
@ -155,13 +193,15 @@ void myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* at
|
||||
The attribute's serialized name is the string "xmlns:" followed by the attribute's local name.
|
||||
*/
|
||||
if(attr->key.data && attr->key.length == 5 && mycore_strcmp(attr->key.data, "xmlns")) {
|
||||
callback("xmlns:", 6, ptr);
|
||||
if(callback("xmlns:", 6, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case MyHTML_NAMESPACE_XLINK: {
|
||||
callback("xlink:", 6, ptr);
|
||||
if(callback("xlink:", 6, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
break;
|
||||
}
|
||||
@ -172,14 +212,25 @@ void myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* at
|
||||
|
||||
size_t length;
|
||||
const char *data = myhtml_attribute_key(attr, &length);
|
||||
if(data) callback(data, length, ptr);
|
||||
callback("=\"", 2, ptr);
|
||||
if(data) {
|
||||
if(callback(data, length, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
if(callback("=\"", 2, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
data = myhtml_attribute_value(attr, &length);
|
||||
if(data) myhtml_serialization_append_attr(data, length, callback, ptr);
|
||||
callback("\"", 1, ptr);
|
||||
if(data) {
|
||||
if(myhtml_serialization_append_attr(data, length, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
if(callback("\"", 1, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,7 +240,7 @@ void myhtml_serialization_attributes(myhtml_tree_t* tree, myhtml_tree_attr_t* at
|
||||
* @param callback
|
||||
* @param ptr
|
||||
*/
|
||||
void myhtml_serialization_node_append_close(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr)
|
||||
mystatus_t myhtml_serialization_node_append_close(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr)
|
||||
{
|
||||
if(node->tag_id != MyHTML_TAG__TEXT &&
|
||||
node->tag_id != MyHTML_TAG__COMMENT &&
|
||||
@ -198,10 +249,17 @@ void myhtml_serialization_node_append_close(myhtml_tree_node_t* node, mycore_cal
|
||||
size_t length;
|
||||
const char *tag = myhtml_tag_name_by_id(node->tree, node->tag_id, &length);
|
||||
|
||||
callback("</", 2, ptr);
|
||||
callback(tag, length, ptr);
|
||||
callback(">", 1, ptr);
|
||||
if(callback("</", 2, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(callback(tag, length, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
if(callback(">", 1, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,13 +269,15 @@ void myhtml_serialization_node_append_close(myhtml_tree_node_t* node, mycore_cal
|
||||
* @param callback
|
||||
* @param ptr
|
||||
*/
|
||||
void myhtml_serialization_node_append_text_node(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr)
|
||||
mystatus_t myhtml_serialization_node_append_text_node(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr)
|
||||
{
|
||||
if(node->token == NULL || node->token->str.data == NULL) return;
|
||||
if(node->token == NULL || node->token->str.data == NULL) return MyCORE_STATUS_OK;
|
||||
|
||||
if(node->parent == NULL) {
|
||||
myhtml_serialization_append(node->token->str.data, node->token->str.length, callback, ptr);
|
||||
return;
|
||||
if(myhtml_serialization_append(node->token->str.data, node->token->str.length, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
switch (node->parent->tag_id) {
|
||||
@ -228,12 +288,17 @@ void myhtml_serialization_node_append_text_node(myhtml_tree_node_t* node, mycore
|
||||
case MyHTML_TAG_NOEMBED:
|
||||
case MyHTML_TAG_NOFRAMES:
|
||||
case MyHTML_TAG_PLAINTEXT:
|
||||
callback(node->token->str.data, node->token->str.length, ptr);
|
||||
if(callback(node->token->str.data, node->token->str.length, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
break;
|
||||
default:
|
||||
myhtml_serialization_append(node->token->str.data, node->token->str.length, callback, ptr);
|
||||
if(myhtml_serialization_append(node->token->str.data, node->token->str.length, callback, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,7 +308,7 @@ void myhtml_serialization_node_append_text_node(myhtml_tree_node_t* node, mycore
|
||||
* @param callback
|
||||
* @param ptr
|
||||
*/
|
||||
void myhtml_serialization_append(const char *data, size_t size, mycore_callback_serialize_f callback, void* ptr)
|
||||
mystatus_t myhtml_serialization_append(const char *data, size_t size, mycore_callback_serialize_f callback, void* ptr)
|
||||
{
|
||||
// number of chars not yet displayed
|
||||
size_t notwritten = 0;
|
||||
@ -252,24 +317,48 @@ void myhtml_serialization_append(const char *data, size_t size, mycore_callback_
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
switch ((unsigned char)data[i]) {
|
||||
case '&':
|
||||
if (notwritten) callback(data + i - notwritten, notwritten, ptr);
|
||||
callback("&", 5, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + i - notwritten, notwritten, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback("&", 5, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
notwritten = 0;
|
||||
break;
|
||||
case '<':
|
||||
if (notwritten) callback(data + i - notwritten, notwritten, ptr);
|
||||
callback("<", 4, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + i - notwritten, notwritten, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback("<", 4, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
notwritten = 0;
|
||||
break;
|
||||
case '>':
|
||||
if (notwritten) callback(data + i - notwritten, notwritten, ptr);
|
||||
callback(">", 4, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + i - notwritten, notwritten, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback(">", 4, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
notwritten = 0;
|
||||
break;
|
||||
case 0xA0:
|
||||
if(i > 0 && (unsigned char)(data[(i - 1)]) == 0xC2) {
|
||||
if (notwritten) callback(data + i - notwritten, (notwritten - 1), ptr);
|
||||
callback(" ", 6, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + i - notwritten, (notwritten - 1), ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback(" ", 6, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
notwritten = 0;
|
||||
}
|
||||
else {
|
||||
@ -283,7 +372,11 @@ void myhtml_serialization_append(const char *data, size_t size, mycore_callback_
|
||||
}
|
||||
}
|
||||
|
||||
if (notwritten) callback(data + size - notwritten, notwritten, ptr);
|
||||
if(notwritten)
|
||||
if(callback(data + size - notwritten, notwritten, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -293,7 +386,7 @@ void myhtml_serialization_append(const char *data, size_t size, mycore_callback_
|
||||
* @param callback
|
||||
* @param ptr
|
||||
*/
|
||||
void myhtml_serialization_append_attr(const char* data, size_t size, mycore_callback_serialize_f callback, void* ptr)
|
||||
mystatus_t myhtml_serialization_append_attr(const char* data, size_t size, mycore_callback_serialize_f callback, void* ptr)
|
||||
{
|
||||
// number of chars not yet displayed
|
||||
size_t notwritten = 0;
|
||||
@ -302,19 +395,37 @@ void myhtml_serialization_append_attr(const char* data, size_t size, mycore_call
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
switch ((unsigned char)data[i]) {
|
||||
case '&':
|
||||
if (notwritten) callback(data + i - notwritten, notwritten, ptr);
|
||||
callback("&", 5, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + i - notwritten, notwritten, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback("&", 5, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
notwritten = 0;
|
||||
break;
|
||||
case '"':
|
||||
if (notwritten) callback(data + i - notwritten, notwritten, ptr);
|
||||
callback(""", 6, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + i - notwritten, notwritten, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback(""", 6, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
notwritten = 0;
|
||||
break;
|
||||
case 0xA0:
|
||||
if(i > 0 && (unsigned char)(data[(i - 1)]) == 0xC2) {
|
||||
if (notwritten) callback(data + i - notwritten, (notwritten - 1), ptr);
|
||||
callback(" ", 6, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + i - notwritten, (notwritten - 1), ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
if(callback(" ", 6, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
|
||||
notwritten = 0;
|
||||
}
|
||||
else {
|
||||
@ -328,42 +439,36 @@ void myhtml_serialization_append_attr(const char* data, size_t size, mycore_call
|
||||
}
|
||||
}
|
||||
|
||||
if (notwritten) callback(data + size - notwritten, notwritten, ptr);
|
||||
if(notwritten) {
|
||||
if(callback(data + size - notwritten, notwritten, ptr))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Because we want to leap out of the algorithm if we're halfway through
|
||||
* serializing, we use a longjmp() call to jump back to the public APP
|
||||
* @var jmp_buf
|
||||
*/
|
||||
static jmp_buf leap;
|
||||
|
||||
/**
|
||||
* Reallocate the buffer
|
||||
* @param str the buffer to reallocate
|
||||
* @param size new size
|
||||
*/
|
||||
void myhtml_serialization_reallocate(mycore_string_raw_t *str, size_t size)
|
||||
mystatus_t myhtml_serialization_reallocate(mycore_string_raw_t *str, size_t size)
|
||||
{
|
||||
// construct a buffer
|
||||
char *data = (char*)mycore_realloc(str->data, size * sizeof(char));
|
||||
|
||||
// was it ok?
|
||||
if (data == NULL) {
|
||||
|
||||
// allocation failed, reset the string object
|
||||
mycore_free(str->data);
|
||||
if(data == NULL) {
|
||||
memset(str, 0, sizeof(mycore_string_raw_t));
|
||||
|
||||
// leap back to the source of the serialization algorithm
|
||||
longjmp(leap, 1);
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
else {
|
||||
|
||||
// reallocation succeeded
|
||||
str->data = data;
|
||||
str->size = size;
|
||||
}
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -372,13 +477,15 @@ void myhtml_serialization_reallocate(mycore_string_raw_t *str, size_t size)
|
||||
* @param data
|
||||
* @param size
|
||||
*/
|
||||
void myhtml_serialization_concatenate(const char* data, size_t length, void *ptr)
|
||||
mystatus_t myhtml_serialization_concatenate(const char* data, size_t length, void *ptr)
|
||||
{
|
||||
// get the string back
|
||||
mycore_string_raw_t* str = (mycore_string_raw_t *)ptr;
|
||||
mycore_string_raw_t *str = (mycore_string_raw_t*)ptr;
|
||||
|
||||
// do we still have enough size in the output buffer?
|
||||
if ((length + str->length) >= str->size) myhtml_serialization_reallocate(str, length + str->length + 4096);
|
||||
if ((length + str->length) >= str->size) {
|
||||
if(myhtml_serialization_reallocate(str, length + str->length + 4096))
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
|
||||
// copy data
|
||||
strncpy(&str->data[ str->length ], data, length);
|
||||
@ -386,6 +493,8 @@ void myhtml_serialization_concatenate(const char* data, size_t length, void *ptr
|
||||
// update counters
|
||||
str->length += length;
|
||||
str->data[ str->length ] = '\0';
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -395,7 +504,7 @@ void myhtml_serialization_concatenate(const char* data, size_t length, void *ptr
|
||||
* @param str
|
||||
* @return bool
|
||||
*/
|
||||
bool myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str) {
|
||||
mystatus_t myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str) {
|
||||
|
||||
// we need an output variable
|
||||
if(str == NULL) return false;
|
||||
@ -408,21 +517,11 @@ bool myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_str
|
||||
|
||||
if(str->data == NULL) {
|
||||
str->size = 0;
|
||||
return false;
|
||||
return MyCORE_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||
}
|
||||
}
|
||||
|
||||
// if allocation halfway the algorithm fails, we want to leap back
|
||||
if (setjmp(leap) == 0)
|
||||
{
|
||||
// serialize the entire tree
|
||||
return myhtml_serialization_tree_callback(scope_node, myhtml_serialization_concatenate, str);
|
||||
}
|
||||
else
|
||||
{
|
||||
// the serialization algorithm failed because of a memory-allocation failure
|
||||
return false;
|
||||
}
|
||||
return myhtml_serialization_tree_callback(scope_node, myhtml_serialization_concatenate, str);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -432,7 +531,7 @@ bool myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_str
|
||||
* @param str
|
||||
* @return bool
|
||||
*/
|
||||
bool myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str) {
|
||||
mystatus_t myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str) {
|
||||
|
||||
// we need an output variable
|
||||
if(str == NULL) return false;
|
||||
@ -448,17 +547,7 @@ bool myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_ra
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if allocation halfway the algorithm fails, we want to leap back
|
||||
if (setjmp(leap) == 0)
|
||||
{
|
||||
// pass on
|
||||
return myhtml_serialization_node_callback(node, myhtml_serialization_concatenate, str);
|
||||
}
|
||||
else
|
||||
{
|
||||
// the serialization algorithm failed because of a memory-allocation failure
|
||||
return false;
|
||||
}
|
||||
|
||||
return myhtml_serialization_node_callback(node, myhtml_serialization_concatenate, str);
|
||||
}
|
||||
|
||||
|
@ -31,15 +31,15 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// the serialization functions
|
||||
bool myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
bool myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
bool myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node, mycore_callback_serialize_f callback, void* ptr);
|
||||
bool myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr);
|
||||
mystatus_t myhtml_serialization_tree_buffer(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization_node_buffer(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization_tree_callback(myhtml_tree_node_t* scope_node, mycore_callback_serialize_f callback, void* ptr);
|
||||
mystatus_t myhtml_serialization_node_callback(myhtml_tree_node_t* node, mycore_callback_serialize_f callback, void* ptr);
|
||||
|
||||
// in versuon 1.0.3 this is in public api.
|
||||
// Need to set deprecated?
|
||||
bool myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
bool myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization(myhtml_tree_node_t* scope_node, mycore_string_raw_t* str);
|
||||
mystatus_t myhtml_serialization_node(myhtml_tree_node_t* node, mycore_string_raw_t* str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
@ -170,12 +170,12 @@ void * myurl_callback_memory_context(myurl_t* url)
|
||||
|
||||
/* api entry */
|
||||
/* callback for as_string */
|
||||
static void myurl_entry_host_callback_for_as_string(const char* data, size_t len, void* ctx)
|
||||
static mystatus_t myurl_entry_host_callback_for_as_string(const char* data, size_t len, void* ctx)
|
||||
{
|
||||
myurl_utils_serialization_ctx_t *obj_ctx = ctx;
|
||||
|
||||
if(obj_ctx->error)
|
||||
return;
|
||||
return MyCORE_STATUS_ERROR;
|
||||
|
||||
if((obj_ctx->length + len + 1) >= obj_ctx->size) {
|
||||
size_t new_size = obj_ctx->length + len + 128;
|
||||
@ -193,6 +193,8 @@ static void myurl_entry_host_callback_for_as_string(const char* data, size_t len
|
||||
|
||||
memcpy(&obj_ctx->data[ obj_ctx->length ], data, sizeof(char) * len);
|
||||
obj_ctx->length += len;
|
||||
|
||||
return MyCORE_STATUS_OK;
|
||||
}
|
||||
|
||||
static char * myurl_as_string(myurl_entry_t* url_entry, size_t *length, myurl_callback_serialization_func_f func)
|
||||
|
Loading…
Reference in New Issue
Block a user