From 4c7b823274980642d38b5541970e6c133a4fe45a Mon Sep 17 00:00:00 2001 From: lexborisov Date: Fri, 10 Mar 2017 15:11:35 +0300 Subject: [PATCH] Changes for io functions --- source/mycss/an_plus_b.c | 4 +-- source/mycss/namespace/serialization.c | 2 +- source/mycss/selectors/serialization.c | 2 +- source/mycss/values/serialization.c | 20 ++++++------- source/myfont/myfont.c | 2 +- source/myhtml/tag.c | 4 +-- source/myhtml/token.c | 40 +++++++++++++------------- source/myhtml/tree.c | 36 +++++++++++------------ source/myport/posix/mycore/perf.c | 8 +++--- 9 files changed, 59 insertions(+), 59 deletions(-) diff --git a/source/mycss/an_plus_b.c b/source/mycss/an_plus_b.c index 5409b29..bd57d5d 100644 --- a/source/mycss/an_plus_b.c +++ b/source/mycss/an_plus_b.c @@ -96,7 +96,7 @@ void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycss_cal char data[512]; if(anb_entry->a != 0) { - int len = snprintf(data, 512, "%ld", anb_entry->a); + int len = mycore_snprintf(data, 512, "%ld", anb_entry->a); if(len > 0) callback(data, (size_t)len, context); @@ -108,7 +108,7 @@ void mycss_an_plus_b_serialization(mycss_an_plus_b_entry_t* anb_entry, mycss_cal if(anb_entry->b >= 0) callback("+", 1, context); - int len = snprintf(data, 512, "%ld", anb_entry->b); + int len = mycore_snprintf(data, 512, "%ld", anb_entry->b); if(len > 0) callback(data, (size_t)len, context); diff --git a/source/mycss/namespace/serialization.c b/source/mycss/namespace/serialization.c index 1dc60d1..6b76ff4 100644 --- a/source/mycss/namespace/serialization.c +++ b/source/mycss/namespace/serialization.c @@ -49,7 +49,7 @@ void mycss_namespace_serialization_entry(mycss_namespace_t* ns, mycss_namespace_ callback(ns_entry->name->data, ns_entry->name->length, context); } else if(ns_entry->ns_id == MyHTML_NAMESPACE_ANY) - return; //fprintf(fh, "*"); + return; //mycore_fprintf(fh, "*"); else if(ns_entry->ns_id == MyHTML_NAMESPACE_UNDEF) { /* some print */ } diff --git a/source/mycss/selectors/serialization.c b/source/mycss/selectors/serialization.c index 418a2be..080c5e2 100644 --- a/source/mycss/selectors/serialization.c +++ b/source/mycss/selectors/serialization.c @@ -28,7 +28,7 @@ void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_sel if(selector->combinator == MyCSS_SELECTORS_COMBINATOR_DESCENDANT) callback(" ", 1, context); else if(selector->combinator == MyCSS_SELECTORS_COMBINATOR_UNDEF) { - /* fprintf(fh, "") */ + /* mycore_fprintf(fh, "") */ } else { callback(" ", 1, context); diff --git a/source/mycss/values/serialization.c b/source/mycss/values/serialization.c index 60ad72d..7fcd14d 100644 --- a/source/mycss/values/serialization.c +++ b/source/mycss/values/serialization.c @@ -42,11 +42,11 @@ void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callb char buff[512]; if(value->is_float) { - int len = snprintf(buff, 512, "%0.4f", value->f); + int len = mycore_snprintf(buff, 512, "%0.4f", value->f); mycss_values_serialization_to_callback(buff, len, callback, context); } else { - int len = snprintf(buff, 512, "%d", value->i); + int len = mycore_snprintf(buff, 512, "%d", value->i); mycss_values_serialization_to_callback(buff, len, callback, context); } } @@ -59,11 +59,11 @@ void mycss_values_serialization_length(mycss_values_length_t* value, mycss_callb char buff[512]; if(value->is_float) { - int len = snprintf(buff, 512, "%0.4f", value->f); + int len = mycore_snprintf(buff, 512, "%0.4f", value->f); mycss_values_serialization_to_callback(buff, len, callback, context); } else { - int len = snprintf(buff, 512, "%d", value->i); + int len = mycore_snprintf(buff, 512, "%d", value->i); mycss_values_serialization_to_callback(buff, len, callback, context); } @@ -81,11 +81,11 @@ void mycss_values_serialization_angle(mycss_values_angle_t* value, mycss_callbac char buff[512]; if(value->is_float) { - int len = snprintf(buff, 512, "%0.4f", value->f); + int len = mycore_snprintf(buff, 512, "%0.4f", value->f); mycss_values_serialization_to_callback(buff, len, callback, context); } else { - int len = snprintf(buff, 512, "%d", value->i); + int len = mycore_snprintf(buff, 512, "%d", value->i); mycss_values_serialization_to_callback(buff, len, callback, context); } @@ -103,11 +103,11 @@ void mycss_values_serialization_resolution(mycss_values_resolution_t* value, myc char buff[512]; if(value->is_float) { - int len = snprintf(buff, 512, "%0.4f", value->f); + int len = mycore_snprintf(buff, 512, "%0.4f", value->f); mycss_values_serialization_to_callback(buff, len, callback, context); } else { - int len = snprintf(buff, 512, "%d", value->i); + int len = mycore_snprintf(buff, 512, "%d", value->i); mycss_values_serialization_to_callback(buff, len, callback, context); } @@ -125,11 +125,11 @@ void mycss_values_serialization_percentage(mycss_values_percentage_t* value, myc char buff[512]; if(value->is_float) { - int len = snprintf(buff, 512, "%0.4f%%", value->f); + int len = mycore_snprintf(buff, 512, "%0.4f%%", value->f); mycss_values_serialization_to_callback(buff, len, callback, context); } else { - int len = snprintf(buff, 512, "%d%%", value->i); + int len = mycore_snprintf(buff, 512, "%d%%", value->i); mycss_values_serialization_to_callback(buff, len, callback, context); } } diff --git a/source/myfont/myfont.c b/source/myfont/myfont.c index 1a91b05..a6b4be6 100644 --- a/source/myfont/myfont.c +++ b/source/myfont/myfont.c @@ -304,7 +304,7 @@ void myfont_font_print_exists_table(myfont_font_t *mf, FILE *file) for(i = 0; i < MyFONT_TKEY_LAST_KEY; i++) { if(mf->cache.tables_offset[i]) { - fprintf(file, "%s = %u\n", myfont_table_name[i], mf->cache.tables_offset[i]); + mycore_fprintf(file, "%s = %u\n", myfont_table_name[i], mf->cache.tables_offset[i]); } } } diff --git a/source/myhtml/tag.c b/source/myhtml/tag.c index 7a761f9..55de2f3 100755 --- a/source/myhtml/tag.c +++ b/source/myhtml/tag.c @@ -150,14 +150,14 @@ void myhtml_tag_print(myhtml_tag_t* tags, FILE* fh) { const myhtml_tag_context_t *ctx = myhtml_tag_get_by_id(tags, i); - fprintf(fh, "<%s id=\"" MyCORE_FMT_Z "\">\n", ctx->name, i); + mycore_fprintf(fh, "<%s id=\"" MyCORE_FMT_Z "\">\n", ctx->name, i); } for(i = (MyHTML_TAG_LAST_ENTRY + 1); i < tags->tags_count; i++) { const myhtml_tag_context_t *ctx = myhtml_tag_get_by_id(tags, i); - fprintf(fh, "<%s id=\"" MyCORE_FMT_Z "\">\n", ctx->name, i); + mycore_fprintf(fh, "<%s id=\"" MyCORE_FMT_Z "\">\n", ctx->name, i); } } diff --git a/source/myhtml/token.c b/source/myhtml/token.c index db0d911..561ecac 100644 --- a/source/myhtml/token.c +++ b/source/myhtml/token.c @@ -870,21 +870,21 @@ void myhtml_token_set_replacement_character_for_null_token(myhtml_tree_t* tree, void myhtml_token_print_param_by_idx(myhtml_tree_t* myhtml_tree, myhtml_token_node_t* node, FILE* out) { if(node->type & MyHTML_TOKEN_TYPE_CLOSE) { - fprintf(out, "tag_id, node->raw_begin, node->raw_length, node->attr_first, node->attr_last); if(node->type & MyHTML_TOKEN_TYPE_CLOSE_SELF) { - fprintf(out, " />\n"); + mycore_fprintf(out, " />\n"); } else { - fprintf(out, ">\n"); + mycore_fprintf(out, ">\n"); } } @@ -896,31 +896,31 @@ void myhtml_token_print_by_idx(myhtml_tree_t* tree, myhtml_token_node_t* node, F node->tag_id == MyHTML_TAG__COMMENT) { if(node->str.length) { - fprintf(out, "%.*s: %.*s\n", (int)ctx->name_length, ctx->name, + mycore_fprintf(out, "%.*s: %.*s\n", (int)ctx->name_length, ctx->name, (int)node->str.length, node->str.data); } else { - fprintf(out, "%.*s is empty\n", (int)ctx->name_length, ctx->name); + mycore_fprintf(out, "%.*s is empty\n", (int)ctx->name_length, ctx->name); } } else { if(node->type & MyHTML_TOKEN_TYPE_CLOSE) { - fprintf(out, "name_length, ctx->name, node->tag_id); + mycore_fprintf(out, "%.*s tagid=\"" MyCORE_FMT_Z "\"", (int)ctx->name_length, ctx->name, node->tag_id); myhtml_token_print_attr(tree, node, out); if(node->type & MyHTML_TOKEN_TYPE_CLOSE_SELF) { - fprintf(out, " />\n"); + mycore_fprintf(out, " />\n"); } else { - fprintf(out, ">\n"); + mycore_fprintf(out, ">\n"); } } } @@ -931,34 +931,34 @@ void myhtml_token_print_attr(myhtml_tree_t* tree, myhtml_token_node_t* node, FIL while(attr) { - fprintf(out, " %s", attr->key.data); + mycore_fprintf(out, " %s", attr->key.data); if(attr->ns != MyHTML_NAMESPACE_HTML) { switch (attr->ns) { case MyHTML_NAMESPACE_SVG: - fprintf(out, ":svg"); + mycore_fprintf(out, ":svg"); break; case MyHTML_NAMESPACE_MATHML: - fprintf(out, ":math"); + mycore_fprintf(out, ":math"); break; case MyHTML_NAMESPACE_XLINK: - fprintf(out, ":xlink"); + mycore_fprintf(out, ":xlink"); break; case MyHTML_NAMESPACE_XML: - fprintf(out, ":xml"); + mycore_fprintf(out, ":xml"); break; case MyHTML_NAMESPACE_XMLNS: - fprintf(out, ":xmlns"); + mycore_fprintf(out, ":xmlns"); break; default: - fprintf(out, ":UNDEF"); + mycore_fprintf(out, ":UNDEF"); break; } } if(attr->value.length) { - fprintf(out, "=\"%s\"", attr->value.data); + mycore_fprintf(out, "=\"%s\"", attr->value.data); } attr = attr->next; diff --git a/source/myhtml/tree.c b/source/myhtml/tree.c index f39835d..79eef24 100644 --- a/source/myhtml/tree.c +++ b/source/myhtml/tree.c @@ -1681,7 +1681,7 @@ bool myhtml_tree_adoption_agency_algorithm(myhtml_tree_t* tree, myhtml_token_nod // step 8 //if(afe_last != list[i]) - // fprintf(stderr, "oh"); + // mycore_fprintf(stderr, "oh"); // step 9 myhtml_tree_node_t* current_node = myhtml_tree_current_node(tree); @@ -1763,7 +1763,7 @@ bool myhtml_tree_adoption_agency_algorithm(myhtml_tree_t* tree, myhtml_token_nod if(node_index > 0) node_index--; else { - fprintf(stderr, "ERROR: adoption agency algorithm; decrement node_index, node_index is null"); + mycore_fprintf(stderr, "ERROR: adoption agency algorithm; decrement node_index, node_index is null"); return false; } @@ -2161,54 +2161,54 @@ void myhtml_tree_print_node(myhtml_tree_t* tree, myhtml_tree_node_t* node, FILE* node->tag_id == MyHTML_TAG__COMMENT) { if(node->token) - fprintf(out, "<%.*s>: %.*s\n", (int)ctx->name_length, ctx->name, + mycore_fprintf(out, "<%.*s>: %.*s\n", (int)ctx->name_length, ctx->name, (int)node->token->str.length, node->token->str.data); else - fprintf(out, "<%.*s>\n", (int)ctx->name_length, ctx->name); + mycore_fprintf(out, "<%.*s>\n", (int)ctx->name_length, ctx->name); } else if(node->tag_id == MyHTML_TAG__DOCTYPE) { - fprintf(out, "doctype.attr_name) { - fprintf(out, " %s", tree->doctype.attr_name); + mycore_fprintf(out, " %s", tree->doctype.attr_name); } if(tree->doctype.attr_public) { - fprintf(out, " %s", tree->doctype.attr_public); + mycore_fprintf(out, " %s", tree->doctype.attr_public); } if(tree->doctype.attr_system) { - fprintf(out, " %s", tree->doctype.attr_system); + mycore_fprintf(out, " %s", tree->doctype.attr_system); } - fprintf(out, ">\n"); + mycore_fprintf(out, ">\n"); } else { if(node->token && node->token->type & MyHTML_TOKEN_TYPE_CLOSE) { - fprintf(out, "name_length, ctx->name); + mycore_fprintf(out, "name_length, ctx->name); } else { - fprintf(out, "<%.*s", (int)ctx->name_length, ctx->name); + mycore_fprintf(out, "<%.*s", (int)ctx->name_length, ctx->name); } if(node->ns != MyHTML_NAMESPACE_HTML) { switch (node->ns) { case MyHTML_NAMESPACE_SVG: - fprintf(out, ":svg"); + mycore_fprintf(out, ":svg"); break; case MyHTML_NAMESPACE_MATHML: - fprintf(out, ":math"); + mycore_fprintf(out, ":math"); break; case MyHTML_NAMESPACE_XLINK: - fprintf(out, ":xlink"); + mycore_fprintf(out, ":xlink"); break; case MyHTML_NAMESPACE_XML: - fprintf(out, ":xml"); + mycore_fprintf(out, ":xml"); break; case MyHTML_NAMESPACE_XMLNS: - fprintf(out, ":xmlns"); + mycore_fprintf(out, ":xmlns"); break; default: break; @@ -2218,7 +2218,7 @@ void myhtml_tree_print_node(myhtml_tree_t* tree, myhtml_tree_node_t* node, FILE* if(node->token) myhtml_token_print_attr(tree, node->token, out); - fprintf(out, ">\n"); + mycore_fprintf(out, ">\n"); } } @@ -2232,7 +2232,7 @@ void _myhtml_tree_print_node_children(myhtml_tree_t* tree, myhtml_tree_node_t* n while(node) { for(i = 0; i < inc; i++) - fprintf(out, "\t"); + mycore_fprintf(out, "\t"); myhtml_tree_print_node(tree, node, out); _myhtml_tree_print_node_children(tree, node->child, out, (inc + 1)); diff --git a/source/myport/posix/mycore/perf.c b/source/myport/posix/mycore/perf.c index 38c397b..fcb8142 100644 --- a/source/myport/posix/mycore/perf.c +++ b/source/myport/posix/mycore/perf.c @@ -250,10 +250,10 @@ uint64_t mycore_hperf_clock(mystatus_t *status) #define _MyCORE_CHECK_STATUS_AND_PRINT_ERROR \ if(status == MyCORE_STATUS_PERF_ERROR_COMPILED_WITHOUT_PERF) { \ - fprintf(fh, "MyCORE: Library compiled without perf source. Please, build library with -DMyCORE_WITH_PERF flag\n"); \ + mycore_fprintf(fh, "MyCORE: Library compiled without perf source. Please, build library with -DMyCORE_WITH_PERF flag\n"); \ } \ else if(status) { \ - fprintf(fh, "MyCORE: Something wrong! Perhaps, your platform does not support the measurement of performance\n"); \ + mycore_fprintf(fh, "MyCORE: Something wrong! Perhaps, your platform does not support the measurement of performance\n"); \ } \ else @@ -264,7 +264,7 @@ mystatus_t mycore_hperf_print(const char *name, uint64_t x, uint64_t y, FILE *fh if(freq) { _MyCORE_CHECK_STATUS_AND_PRINT_ERROR { - fprintf(fh, "%s: %0.5f\n", name, (((float)(y - x) / (float)freq))); + mycore_fprintf(fh, "%s: %0.5f\n", name, (((float)(y - x) / (float)freq))); } } @@ -278,7 +278,7 @@ mystatus_t mycore_hperf_print_by_val(const char *name, uint64_t x, FILE *fh) { if(freq) { _MyCORE_CHECK_STATUS_AND_PRINT_ERROR { - fprintf(fh, "%s: %0.5f\n", name, ((float)x / (float)freq)); + mycore_fprintf(fh, "%s: %0.5f\n", name, ((float)x / (float)freq)); } }