From 018a9dad668bb522b036603626d3784075d9c553 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 22 Dec 2009 13:46:00 +0000 Subject: [PATCH] * edje: Use Eina_Log. Patch from Mathieu Taillefumier. SVN revision: 44655 --- legacy/edje/AUTHORS | 1 + legacy/edje/src/bin/edje_cc.c | 13 +- legacy/edje/src/bin/edje_cc.h | 17 ++ legacy/edje/src/bin/edje_cc_handlers.c | 338 ++++++++++++------------- legacy/edje/src/bin/edje_cc_mem.c | 8 +- legacy/edje/src/bin/edje_cc_out.c | 30 +-- legacy/edje/src/bin/edje_cc_parse.c | 162 ++++++------ legacy/edje/src/bin/edje_cc_sources.c | 6 +- legacy/edje/src/bin/edje_decc.c | 58 +++-- legacy/edje/src/bin/edje_decc.h | 16 ++ legacy/edje/src/bin/edje_prefix.c | 9 +- legacy/edje/src/lib/edje_cache.c | 12 +- legacy/edje/src/lib/edje_calc.c | 44 ++-- legacy/edje/src/lib/edje_edit.c | 98 ++++--- legacy/edje/src/lib/edje_embryo.c | 20 +- legacy/edje/src/lib/edje_external.c | 8 +- legacy/edje/src/lib/edje_load.c | 28 +- legacy/edje/src/lib/edje_lua.c | 9 +- legacy/edje/src/lib/edje_main.c | 22 +- legacy/edje/src/lib/edje_match.c | 2 +- legacy/edje/src/lib/edje_private.h | 21 ++ legacy/edje/src/lib/edje_program.c | 4 +- legacy/edje/src/lib/edje_script_only.c | 14 +- legacy/edje/src/lib/edje_util.c | 17 +- 24 files changed, 508 insertions(+), 449 deletions(-) diff --git a/legacy/edje/AUTHORS b/legacy/edje/AUTHORS index 63cdedea18..bbca60fb9d 100644 --- a/legacy/edje/AUTHORS +++ b/legacy/edje/AUTHORS @@ -3,3 +3,4 @@ Tilman Sauerbeck (tilman at code-monkey de) ZigsMcKenzie Cedric BAIL Brian Mattern +Mathieu Taillefumier diff --git a/legacy/edje/src/bin/edje_cc.c b/legacy/edje/src/bin/edje_cc.c index 92b740aea1..883e2f2d2d 100644 --- a/legacy/edje/src/bin/edje_cc.c +++ b/legacy/edje/src/bin/edje_cc.c @@ -13,7 +13,7 @@ #include "edje_cc.h" #include "edje_prefix.h" - +int _edje_cc_log_dom = -1; static void main_help(void); Eina_List *img_dirs = NULL; @@ -63,10 +63,15 @@ main(int argc, char **argv) setlocale(LC_NUMERIC, "C"); eina_init(); - + _edje_cc_log_dom = eina_log_domain_register("EDJE_CC", EDJE_DEFAULT_LOG_COLOR); + if(_edje_cc_log_dom<0) + { + EINA_LOG_ERR("Enable to create a log domain."); + exit(1); + } tmp_dir = getenv("TMPDIR"); - + progname = argv[0]; for (i = 1; i < argc; i++) { @@ -210,7 +215,7 @@ main(int argc, char **argv) data_write(); edje_shutdown(); - + eina_log_domain_unregister(_edje_cc_log_dom); eina_shutdown(); return 0; diff --git a/legacy/edje/src/bin/edje_cc.h b/legacy/edje/src/bin/edje_cc.h index dd37f6e5d0..828c6cdda6 100644 --- a/legacy/edje/src/bin/edje_cc.h +++ b/legacy/edje/src/bin/edje_cc.h @@ -12,6 +12,23 @@ # define O_BINARY 0 #endif +/* logging variables */ +extern int _edje_cc_log_dom ; +#define EDJE_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_edje_cc_log_dom, __VA_ARGS__) +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_edje_cc_log_dom, __VA_ARGS__) +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_edje_cc_log_dom, __VA_ARGS__) + + /* types */ typedef struct _New_Object_Handler New_Object_Handler; typedef struct _New_Statement_Handler New_Statement_Handler; diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c index 12719b4f8e..28a362fb69 100644 --- a/legacy/edje/src/bin/edje_cc_handlers.c +++ b/legacy/edje/src/bin/edje_cc_handlers.c @@ -928,23 +928,23 @@ st_data_file(void) fd = open(filename, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR); if (fd < 0) { - fprintf(stderr, "%s: Error. %s:%i when opening file \"%s\": \"%s\"\n", - progname, file_in, line, filename, strerror(errno)); + ERR("%s: Error. %s:%i when opening file \"%s\": \"%s\"", + progname, file_in, line, filename, strerror(errno)); exit(-1); } if (fstat(fd, &buf)) { - fprintf(stderr, "%s: Error. %s:%i when stating file \"%s\": \"%s\"\n", - progname, file_in, line, filename, strerror(errno)); + ERR("%s: Error. %s:%i when stating file \"%s\": \"%s\"", + progname, file_in, line, filename, strerror(errno)); exit(-1); } data = mmap(NULL, buf.st_size, PROT_READ, MAP_SHARED, fd, 0); if (data == MAP_FAILED) { - fprintf(stderr, "%s: Error. %s:%i when mapping file \"%s\": \"%s\"\n", - progname, file_in, line, filename, strerror(errno)); + ERR("%s: Error. %s:%i when mapping file \"%s\": \"%s\"", + progname, file_in, line, filename, strerror(errno)); exit(-1); } @@ -952,7 +952,7 @@ st_data_file(void) for (i = 0; i < buf.st_size; ++i, ++over) if (*over == '\0') { - fprintf(stderr, "%s: Error. %s:%i file \"%s\" is a binary file.\n", + ERR("%s: Error. %s:%i file \"%s\" is a binary file.", progname, file_in, line, filename); exit(-1); } @@ -1251,8 +1251,8 @@ st_styles_style_name(void) { if ((stl != tstl) && (!strcmp(stl->name, tstl->name))) { - fprintf(stderr, "%s: Error. parse error %s:%i. There is already a style named \"%s\"\n", - progname, file_in, line - 1, stl->name); + ERR("%s: Error. parse error %s:%i. There is already a style named \"%s\"", + progname, file_in, line - 1, stl->name); exit(-1); } } @@ -1278,8 +1278,8 @@ st_styles_style_base(void) stl = eina_list_data_get(eina_list_last(edje_file->styles)); if (stl->tags) { - fprintf(stderr, "%s: Error. parse error %s:%i. There is already a basic format for the style\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. There is already a basic format for the style", + progname, file_in, line - 1); exit(-1); } tag = mem_alloc(SZ(Edje_Style_Tag)); @@ -1596,8 +1596,8 @@ ob_collections_group_script(void) cd->l2 = get_verbatim_line2(); if (cd->shared) { - fprintf(stderr, "%s: Error. parse error %s:%i. There is already an existing script section for the group\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. There is already an existing script section for the group", + progname, file_in, line - 1); exit(-1); } cd->shared = s; @@ -1628,8 +1628,8 @@ ob_collections_group_lua_script(void) cd->l2 = get_verbatim_line2(); if (cd->shared) { - fprintf(stderr, "%s: Error. parse error %s:%i. There is already an existing script section for the group\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. There is already an existing script section for the group", + progname, file_in, line - 1); exit(-1); } cd->shared = s; @@ -1742,8 +1742,8 @@ st_collections_group_parts_part_name(void) { if ((lep != ep) && (lep->name) && (!strcmp(lep->name, ep->name))) { - fprintf(stderr, "%s: Error. parse error %s:%i. There is already a part of the name %s\n", - progname, file_in, line - 1, ep->name); + ERR("%s: Error. parse error %s:%i. There is already a part of the name %s", + progname, file_in, line - 1, ep->name); exit(-1); } } @@ -2505,9 +2505,9 @@ static void ob_collections_group_parts_part_box_items_item(void) if ((ep->type != EDJE_PART_TYPE_BOX) && (ep->type != EDJE_PART_TYPE_TABLE)) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "box attributes in non-BOX or TABLE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "box attributes in non-BOX or TABLE part.", + progname, file_in, line - 1); exit(-1); } @@ -2569,9 +2569,9 @@ static void st_collections_group_parts_part_box_items_item_type(void) s = parse_str(0); if (strcmp(s, "GROUP")) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "token %s not one of: GROUP.\n", - progname, file_in, line - 1, s); + ERR("%s: Error. parse error %s:%i. " + "token %s not one of: GROUP.", + progname, file_in, line - 1, s); exit(-1); } /* FIXME: handle the enum, once everything else is supported */ @@ -2892,12 +2892,12 @@ static void st_collections_group_parts_part_table_items_item_position(void) if (ep->type != EDJE_PART_TYPE_TABLE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "table attributes in non-TABLE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "table attributes in non-TABLE part.", + progname, file_in, line - 1); exit(-1); } - + item = eina_list_data_get(eina_list_last(ep->items)); item->col = parse_int_range(0, 0, 0xffff); item->row = parse_int_range(1, 0, 0xffff); @@ -2927,9 +2927,9 @@ static void st_collections_group_parts_part_table_items_item_span(void) if (ep->type != EDJE_PART_TYPE_TABLE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "table attributes in non-TABLE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "table attributes in non-TABLE part.", + progname, file_in, line - 1); exit(-1); } @@ -3088,9 +3088,9 @@ st_collections_group_parts_part_description_inherit(void) /* inherit may not be used in the default description */ if (!ep->other_desc) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "inherit may not be used in the default description\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "inherit may not be used in the default description", + progname, file_in, line - 1); exit(-1); } @@ -3098,9 +3098,9 @@ st_collections_group_parts_part_description_inherit(void) if (!ed->state.name) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "inherit may only be used after state\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "inherit may only be used after state", + progname, file_in, line - 1); exit(-1); } @@ -3139,9 +3139,9 @@ st_collections_group_parts_part_description_inherit(void) if (!parent) { - fprintf (stderr, "%s: Error. parse error %s:%i. " - "cannot find referenced part state %s %lf\n", - ep->name, file_in, line - 1, parent_name, parent_val); + ERR("%s: Error. parse error %s:%i. " + "cannot find referenced part state %s %lf", + ep->name, file_in, line - 1, parent_name, parent_val); exit(-1); } @@ -3235,9 +3235,9 @@ st_collections_group_parts_part_description_state(void) s = parse_str(0); if (!strcmp (s, "custom")) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "invalid state name: '%s'.\n", - progname, file_in, line - 1, s); + ERR("%s: Error. parse error %s:%i. " + "invalid state name: '%s'.", + progname, file_in, line - 1, s); exit(-1); } @@ -3914,9 +3914,9 @@ st_collections_group_parts_part_description_image_normal(void) if (ep->type != EDJE_PART_TYPE_IMAGE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "image attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "image attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -3957,9 +3957,9 @@ st_collections_group_parts_part_description_image_tween(void) if (ep->type != EDJE_PART_TYPE_IMAGE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "image attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "image attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4003,9 +4003,9 @@ st_collections_group_parts_part_description_image_border(void) if (ep->type != EDJE_PART_TYPE_IMAGE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "image attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "image attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4043,9 +4043,9 @@ st_collections_group_parts_part_description_image_middle(void) if (ep->type != EDJE_PART_TYPE_IMAGE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "image attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "image attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4085,9 +4085,9 @@ st_collections_group_parts_part_description_image_scale_hint(void) if (ep->type != EDJE_PART_TYPE_IMAGE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "image attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "image attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4149,9 +4149,9 @@ st_collections_group_parts_part_description_fill_smooth(void) if (ep->type != EDJE_PART_TYPE_IMAGE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "fill.type attribute in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "fill.type attribute in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4224,9 +4224,9 @@ st_collections_group_parts_part_description_fill_angle(void) /* XXX this will need to include IMAGES when angle support is added to evas images */ if (ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "gradient attributes in non-GRADIENT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "gradient attributes in non-GRADIENT part.", + progname, file_in, line - 1); exit(-1); } @@ -4262,9 +4262,9 @@ st_collections_group_parts_part_description_fill_type(void) if (ep->type != EDJE_PART_TYPE_IMAGE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "fill attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "fill attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4319,9 +4319,9 @@ st_collections_group_parts_part_description_fill_origin_relative(void) if (ep->type != EDJE_PART_TYPE_IMAGE && ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "fill attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "fill attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4355,9 +4355,9 @@ st_collections_group_parts_part_description_fill_origin_offset(void) if (ep->type != EDJE_PART_TYPE_IMAGE && ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "fill attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "fill attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4416,9 +4416,9 @@ st_collections_group_parts_part_description_fill_size_relative(void) if (ep->type != EDJE_PART_TYPE_IMAGE && ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "fill attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "fill attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4452,9 +4452,9 @@ st_collections_group_parts_part_description_fill_size_offset(void) if (ep->type != EDJE_PART_TYPE_IMAGE && ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "fill attributes in non-IMAGE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "fill attributes in non-IMAGE part.", + progname, file_in, line - 1); exit(-1); } @@ -4515,9 +4515,9 @@ st_collections_group_parts_part_description_text_text(void) if ((ep->type != EDJE_PART_TYPE_TEXT) && (ep->type != EDJE_PART_TYPE_TEXTBLOCK)) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4567,9 +4567,9 @@ st_collections_group_parts_part_description_text_text_class(void) if ((ep->type != EDJE_PART_TYPE_TEXT) && (ep->type != EDJE_PART_TYPE_TEXTBLOCK)) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4604,9 +4604,9 @@ st_collections_group_parts_part_description_text_font(void) if (ep->type != EDJE_PART_TYPE_TEXT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4641,9 +4641,9 @@ st_collections_group_parts_part_description_text_style(void) if (ep->type != EDJE_PART_TYPE_TEXTBLOCK) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXTBLOCK part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXTBLOCK part.", + progname, file_in, line - 1); exit(-1); } @@ -4679,9 +4679,9 @@ st_collections_group_parts_part_description_text_repch(void) if (ep->type != EDJE_PART_TYPE_TEXTBLOCK) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXTBLOCK part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXTBLOCK part.", + progname, file_in, line - 1); exit(-1); } @@ -4716,9 +4716,9 @@ st_collections_group_parts_part_description_text_size(void) if (ep->type != EDJE_PART_TYPE_TEXT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4753,9 +4753,9 @@ st_collections_group_parts_part_description_text_fit(void) if (ep->type != EDJE_PART_TYPE_TEXT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4793,9 +4793,9 @@ st_collections_group_parts_part_description_text_min(void) if ((ep->type != EDJE_PART_TYPE_TEXT) && (ep->type != EDJE_PART_TYPE_TEXTBLOCK)) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4833,9 +4833,9 @@ st_collections_group_parts_part_description_text_max(void) if ((ep->type != EDJE_PART_TYPE_TEXT) && (ep->type != EDJE_PART_TYPE_TEXTBLOCK)) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4871,9 +4871,9 @@ st_collections_group_parts_part_description_text_align(void) if (ep->type != EDJE_PART_TYPE_TEXT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4910,9 +4910,9 @@ st_collections_group_parts_part_description_text_source(void) if ((ep->type != EDJE_PART_TYPE_TEXT) && (ep->type != EDJE_PART_TYPE_TEXTBLOCK)) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4954,9 +4954,9 @@ st_collections_group_parts_part_description_text_text_source(void) if ((ep->type != EDJE_PART_TYPE_TEXT) && (ep->type != EDJE_PART_TYPE_TEXTBLOCK)) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -4998,9 +4998,9 @@ st_collections_group_parts_part_description_text_elipsis(void) if (ep->type != EDJE_PART_TYPE_TEXT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "text attributes in non-TEXT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "text attributes in non-TEXT part.", + progname, file_in, line - 1); exit(-1); } @@ -5068,9 +5068,9 @@ st_collections_group_parts_part_description_gradient_type(void) if (ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "gradient attributes in non-GRADIENT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "gradient attributes in non-GRADIENT part.", + progname, file_in, line - 1); exit(-1); } @@ -5105,9 +5105,9 @@ st_collections_group_parts_part_description_gradient_spectrum(void) if (ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "gradient attributes in non-GRADIENT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "gradient attributes in non-GRADIENT part.", + progname, file_in, line - 1); exit(-1); } @@ -5150,9 +5150,9 @@ st_collections_group_parts_part_description_gradient_rel1_relative(void) if (ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "gradient attributes in non-GRADIENT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "gradient attributes in non-GRADIENT part.", + progname, file_in, line - 1); exit(-1); } @@ -5193,9 +5193,9 @@ st_collections_group_parts_part_description_gradient_rel1_offset(void) if (ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "gradient attributes in non-GRADIENT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "gradient attributes in non-GRADIENT part.", + progname, file_in, line - 1); exit(-1); } @@ -5223,12 +5223,12 @@ st_collections_group_parts_part_description_gradient_rel2_relative(void) if (ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "gradient attributes in non-GRADIENT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "gradient attributes in non-GRADIENT part.", + progname, file_in, line - 1); exit(-1); } - + ed = ep->default_desc; if (ep->other_desc) ed = eina_list_data_get(eina_list_last(ep->other_desc)); @@ -5253,9 +5253,9 @@ st_collections_group_parts_part_description_gradient_rel2_offset(void) if (ep->type != EDJE_PART_TYPE_GRADIENT) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "gradient attributes in non-GRADIENT part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "gradient attributes in non-GRADIENT part.", + progname, file_in, line - 1); exit(-1); } @@ -5354,9 +5354,9 @@ static void st_collections_group_parts_part_description_box_layout(void) if (ep->type != EDJE_PART_TYPE_BOX) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "box attributes in non-BOX part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "box attributes in non-BOX part.", + progname, file_in, line - 1); exit(-1); } @@ -5380,9 +5380,9 @@ static void st_collections_group_parts_part_description_box_align(void) if (ep->type != EDJE_PART_TYPE_BOX) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "box attributes in non-BOX part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "box attributes in non-BOX part.", + progname, file_in, line - 1); exit(-1); } @@ -5405,9 +5405,9 @@ static void st_collections_group_parts_part_description_box_padding(void) if (ep->type != EDJE_PART_TYPE_BOX) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "box attributes in non-BOX part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "box attributes in non-BOX part.", + progname, file_in, line - 1); exit(-1); } @@ -5431,9 +5431,9 @@ st_collections_group_parts_part_description_box_min(void) if (ep->type != EDJE_PART_TYPE_BOX) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "box attributes in non-BOX part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "box attributes in non-BOX part.", + progname, file_in, line - 1); exit(-1); } @@ -5507,9 +5507,9 @@ static void st_collections_group_parts_part_description_table_homogeneous(void) if (ep->type != EDJE_PART_TYPE_TABLE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "table attributes in non-TABLE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "table attributes in non-TABLE part.", + progname, file_in, line - 1); exit(-1); } @@ -5535,9 +5535,9 @@ static void st_collections_group_parts_part_description_table_align(void) if (ep->type != EDJE_PART_TYPE_TABLE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "table attributes in non-TABLE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "table attributes in non-TABLE part.", + progname, file_in, line - 1); exit(-1); } @@ -5560,9 +5560,9 @@ static void st_collections_group_parts_part_description_table_padding(void) if (ep->type != EDJE_PART_TYPE_TABLE) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "table attributes in non-TABLE part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "table attributes in non-TABLE part.", + progname, file_in, line - 1); exit(-1); } @@ -5590,9 +5590,9 @@ _st_collections_group_parts_part_description_params(Edje_External_Param_Type typ if (ep->type != EDJE_PART_TYPE_EXTERNAL) { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "params in non-EXTERNAL part.\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "params in non-EXTERNAL part.", + progname, file_in, line - 1); exit(-1); } @@ -5759,8 +5759,8 @@ st_collections_group_programs_program_name(void) { if ((lep != ep) && (lep->name) && (!strcmp(lep->name, ep->name))) { - fprintf(stderr, "%s: Error. parse error %s:%i. There is already a program of the name %s\n", - progname, file_in, line - 1, ep->name); + ERR("%s: Error. parse error %s:%i. There is already a program of the name %s\n", + progname, file_in, line - 1, ep->name); exit(-1); } } @@ -6002,9 +6002,9 @@ st_collections_group_programs_program_target(void) data_queue_part_lookup(pc, name, &(et->id)); else { - fprintf(stderr, "%s: Error. parse error %s:%i. " - "target may only be used after action\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. " + "target may only be used after action", + progname, file_in, line - 1); exit(-1); } free(name); @@ -6076,8 +6076,8 @@ ob_collections_group_programs_program_script(void) cp->script = s; if (cd->shared && cd->is_lua) { - fprintf(stderr, "%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group", + progname, file_in, line - 1); exit(-1); } cd->is_lua = 0; @@ -6116,8 +6116,8 @@ ob_collections_group_programs_program_lua_script(void) cp->script = s; if (cd->shared && !cd->is_lua) { - fprintf(stderr, "%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group", + progname, file_in, line - 1); exit(-1); } cd->is_lua = 1; diff --git a/legacy/edje/src/bin/edje_cc_mem.c b/legacy/edje/src/bin/edje_cc_mem.c index be611ce562..082d570abb 100644 --- a/legacy/edje/src/bin/edje_cc_mem.c +++ b/legacy/edje/src/bin/edje_cc_mem.c @@ -18,8 +18,8 @@ mem_alloc(size_t size) mem = calloc(1, size); if (mem) return mem; - fprintf(stderr, "%s: Error. %s:%i memory allocation of %i bytes failed. %s\n", - progname, file_in, line, size, strerror(errno)); + ERR("%s: Error. %s:%i memory allocation of %i bytes failed. %s", + progname, file_in, line, size, strerror(errno)); exit(-1); return NULL; } @@ -31,8 +31,8 @@ mem_strdup(const char *s) str = strdup(s); if (str) return str; - fprintf(stderr, "%s: Error. %s:%i memory allocation of %i bytes failed. %s. string being duplicated: \"%s\"\n", - progname, file_in, line, strlen(s) + 1, strerror(errno), s); + ERR("%s: Error. %s:%i memory allocation of %i bytes failed. %s. string being duplicated: \"%s\"", + progname, file_in, line, strlen(s) + 1, strerror(errno), s); exit(-1); return NULL; } diff --git a/legacy/edje/src/bin/edje_cc_out.c b/legacy/edje/src/bin/edje_cc_out.c index d894b8851f..c1f5516e20 100644 --- a/legacy/edje/src/bin/edje_cc_out.c +++ b/legacy/edje/src/bin/edje_cc_out.c @@ -133,7 +133,7 @@ error_and_abort(Eet_File *ef, const char *fmt, ...) { va_list ap; - fprintf(stderr, "%s: Error. ", progname); + ERR("%s: Error. ", progname); va_start(ap, fmt); vfprintf(stderr, fmt, ap); @@ -979,8 +979,8 @@ data_write(void) ef = eet_open(file_out, EET_FILE_MODE_WRITE); if (!ef) { - fprintf(stderr, "%s: Error. Unable to open \"%s\" for writing output\n", - progname, file_out); + ERR("%s: Error. Unable to open \"%s\" for writing output", + progname, file_out); exit(-1); } @@ -1169,8 +1169,8 @@ data_process_lookups(void) } if (!l) { - fprintf(stderr, "%s: Error. Unable to find part name \"%s\".\n", - progname, pl->name); + ERR("%s: Error. Unable to find part name \"%s\".", + progname, pl->name); exit(-1); } part_lookups = eina_list_remove(part_lookups, pl); @@ -1195,8 +1195,8 @@ data_process_lookups(void) } if (!l) { - fprintf(stderr, "%s: Error. Unable to find program name \"%s\".\n", - progname, pl->name); + ERR("%s: Error. Unable to find program name \"%s\".", + progname, pl->name); exit(-1); } program_lookups = eina_list_remove(program_lookups, pl); @@ -1220,8 +1220,8 @@ data_process_lookups(void) } if (!l) { - fprintf(stderr, "%s: Error. Unable to find group name \"%s\".\n", - progname, gl->name); + ERR("%s: Error. Unable to find group name \"%s\".", + progname, gl->name); exit(-1); } group_lookups = eina_list_remove(group_lookups, gl); @@ -1256,8 +1256,8 @@ data_process_lookups(void) if (!l) { - fprintf(stderr, "%s: Error. Unable to find image name \"%s\".\n", - progname, il->name); + ERR("%s: Error. Unable to find image name \"%s\".", + progname, il->name); exit(-1); } image_lookups = eina_list_remove(image_lookups, il); @@ -1290,8 +1290,8 @@ data_process_lookups(void) if (!l) { - fprintf(stderr, "%s: Error. unable to find spectrum name %s\n", - progname, il->name); + ERR("%s: Error. unable to find spectrum name %s", + progname, il->name); exit(-1); } spectrum_lookups = eina_list_remove(spectrum_lookups, il); @@ -1525,8 +1525,8 @@ data_process_script_lookups(void) n = eina_convert_itoa(cl->val, buf); if (n > cl->len) { - fprintf(stderr, "%s: Error. The unexpected happened. A numeric replacement string was larger than the original!\n", - progname); + ERR("%s: Error. The unexpected happened. A numeric replacement string was larger than the original!", + progname); exit(-1); } memset(cl->ptr, ' ', cl->len); diff --git a/legacy/edje/src/bin/edje_cc_parse.c b/legacy/edje/src/bin/edje_cc_parse.c index aa64dde668..e03ca76559 100644 --- a/legacy/edje/src/bin/edje_cc_parse.c +++ b/legacy/edje/src/bin/edje_cc_parse.c @@ -114,9 +114,9 @@ new_object(void) } if (!handled) { - fprintf(stderr, "%s: Error. %s:%i unhandled keyword %s\n", - progname, file_in, line - 1, - (char *)eina_list_data_get(eina_list_last(stack))); + ERR("%s: Error. %s:%i unhandled keyword %s", + progname, file_in, line - 1, + (char *)eina_list_data_get(eina_list_last(stack))); exit(-1); } free(id); @@ -144,9 +144,9 @@ new_statement(void) } if (!handled) { - fprintf(stderr, "%s: Error. %s:%i unhandled keyword %s\n", - progname, file_in, line - 1, - (char *)eina_list_data_get(eina_list_last(stack))); + ERR("%s: Error. %s:%i unhandled keyword %s", + progname, file_in, line - 1, + (char *)eina_list_data_get(eina_list_last(stack))); exit(-1); } free(id); @@ -247,8 +247,8 @@ next_token(char *p, char *end, char **new_p, int *delim) tmpstr = alloca(l + 1); if (!tmpstr) { - fprintf(stderr, "%s: Error. %s:%i malloc %i bytes failed\n", - progname, file_in, line - 1, l + 1); + ERR("%s: Error. %s:%i malloc %i bytes failed", + progname, file_in, line - 1, l + 1); exit(-1); } strncpy(tmpstr, p, l); @@ -424,8 +424,8 @@ stack_chop_top(void) } else { - fprintf(stderr, "%s: Error. parse error %s:%i. } marker without matching { marker\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. } marker without matching { marker", + progname, file_in, line - 1); exit(-1); } } @@ -439,8 +439,8 @@ parse(char *data, off_t size) if (verbose) { - printf("%s: Parsing input file\n", - progname); + INF("%s: Parsing input file", + progname); } p = data; end = data + size; @@ -452,8 +452,8 @@ parse(char *data, off_t size) */ if (do_params && delim && *token != ';') { - fprintf(stderr, "%s: Error. parse error %s:%i. %c marker before ; marker\n", - progname, file_in, line - 1, *token); + ERR("%s: Error. parse error %s:%i. %c marker before ; marker", + progname, file_in, line - 1, *token); exit(-1); } else if (delim) @@ -463,7 +463,7 @@ parse(char *data, off_t size) { if (do_params) { - fprintf(stderr, "%s: Error. parse error %s:%i. } marker before ; marker\n", + ERR("%s: Error. parse error %s:%i. } marker before ; marker", progname, file_in, line - 1); exit(-1); } @@ -490,8 +490,8 @@ parse(char *data, off_t size) { if (do_params) { - fprintf(stderr, "%s: Error. parse error %s:%i. { marker before ; marker\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. { marker before ; marker", + progname, file_in, line - 1); exit(-1); } } @@ -573,8 +573,8 @@ parse(char *data, off_t size) } else { - fprintf(stderr, "%s: Error. parse error %s:%i. { marker does not have matching } marker\n", - progname, file_in, line - 1); + ERR("%s: Error. parse error %s:%i. { marker does not have matching } marker", + progname, file_in, line - 1); exit(-1); } new_object(); @@ -585,7 +585,7 @@ parse(char *data, off_t size) } if (verbose) { - printf("%s: Parsing done\n", + INF("%s: Parsing done", progname); } } @@ -766,13 +766,13 @@ compile(void) fd = open(file_in, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR); if (fd < 0) { - fprintf(stderr, "%s: Error. cannot open file \"%s\" for input. %s\n", - progname, file_in, strerror(errno)); + ERR("%s: Error. cannot open file \"%s\" for input. %s", + progname, file_in, strerror(errno)); exit(-1); } if (verbose) { - printf("%s: Opening \"%s\" for input\n", + INF("%s: Opening \"%s\" for input", progname, file_in); } @@ -783,8 +783,8 @@ compile(void) parse(data, size); else { - fprintf(stderr, "%s: Error. cannot read file \"%s\". %s\n", - progname, file_in, strerror(errno)); + ERR("%s: Error. cannot read file \"%s\". %s", + progname, file_in, strerror(errno)); exit(-1); } free(data); @@ -811,7 +811,7 @@ is_num(int n) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", + ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); exit(-1); } @@ -831,8 +831,8 @@ parse_str(int n) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", - progname, file_in, line - 1, n + 1); + ERR("%s: Error. %s:%i no parameter supplied as argument %i", + progname, file_in, line - 1, n + 1); exit(-1); } s = mem_strdup(str); @@ -855,8 +855,8 @@ _parse_enum(char *str, va_list va) /* End of the list, nothing matched. */ if (!s) { - fprintf(stderr, "%s: Error. %s:%i token %s not one of:", - progname, file_in, line - 1, str); + fprintf(stderr, "%s: Error. %s:%i token %s not one of:", + progname, file_in, line - 1, str); s = va_arg(va2, char *); while (s) { @@ -894,7 +894,7 @@ parse_enum(int n, ...) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", + ERR("%s: Error. %s:%i no parameter supplied as argument %i", progname, file_in, line - 1, n + 1); exit(-1); } @@ -931,8 +931,8 @@ parse_int(int n) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", - progname, file_in, line - 1, n + 1); + ERR("%s: Error. %s:%i no parameter supplied as argument %i", + progname, file_in, line - 1, n + 1); exit(-1); } i = my_atoi(str); @@ -948,15 +948,15 @@ parse_int_range(int n, int f, int t) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", - progname, file_in, line - 1, n + 1); + ERR("%s: Error. %s:%i no parameter supplied as argument %i", + progname, file_in, line - 1, n + 1); exit(-1); } i = my_atoi(str); if ((i < f) || (i > t)) { - fprintf(stderr, "%s: Error. %s:%i integer %i out of range of %i to %i inclusive\n", - progname, file_in, line - 1, i, f, t); + ERR("%s: Error. %s:%i integer %i out of range of %i to %i inclusive", + progname, file_in, line - 1, i, f, t); exit(-1); } return i; @@ -971,15 +971,15 @@ parse_bool(int n) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", - progname, file_in, line - 1, n + 1); + ERR("%s: Error. %s:%i no parameter supplied as argument %i", + progname, file_in, line - 1, n + 1); exit(-1); } if (!strstrip(str, buf, sizeof (buf))) { - fprintf(stderr, "%s: Error. %s:%i expression is too long\n", - progname, file_in, line - 1); + ERR("%s: Error. %s:%i expression is too long", + progname, file_in, line - 1); return 0; } @@ -991,8 +991,8 @@ parse_bool(int n) i = my_atoi(str); if ((i < 0) || (i > 1)) { - fprintf(stderr, "%s: Error. %s:%i integer %i out of range of 0 to 1 inclusive\n", - progname, file_in, line - 1, i); + ERR("%s: Error. %s:%i integer %i out of range of 0 to 1 inclusive", + progname, file_in, line - 1, i); exit(-1); } return i; @@ -1007,8 +1007,8 @@ parse_float(int n) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", - progname, file_in, line - 1, n + 1); + ERR("%s: Error. %s:%i no parameter supplied as argument %i", + progname, file_in, line - 1, n + 1); exit(-1); } i = my_atof(str); @@ -1024,15 +1024,15 @@ parse_float_range(int n, double f, double t) str = eina_list_nth(params, n); if (!str) { - fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n", - progname, file_in, line - 1, n + 1); + ERR("%s: Error. %s:%i no parameter supplied as argument %i", + progname, file_in, line - 1, n + 1); exit(-1); } i = my_atof(str); if ((i < f) || (i > t)) { - fprintf(stderr, "%s: Error. %s:%i float %3.3f out of range of %3.3f to %3.3f inclusive\n", - progname, file_in, line - 1, i, f, t); + ERR("%s: Error. %s:%i float %3.3f out of range of %3.3f to %3.3f inclusive", + progname, file_in, line - 1, i, f, t); exit(-1); } return i; @@ -1045,8 +1045,8 @@ check_arg_count(int required_args) if (num_args != required_args) { - fprintf(stderr, "%s: Error. %s:%i got %i arguments, but expected %i\n", - progname, file_in, line - 1, num_args, required_args); + ERR("%s: Error. %s:%i got %i arguments, but expected %i", + progname, file_in, line - 1, num_args, required_args); exit(-1); } } @@ -1058,9 +1058,9 @@ check_min_arg_count(int min_required_args) if (num_args < min_required_args) { - fprintf(stderr, "%s: Error. %s:%i got %i arguments, " - "but expected at least %i\n", - progname, file_in, line - 1, num_args, min_required_args); + ERR("%s: Error. %s:%i got %i arguments, " + "but expected at least %i", + progname, file_in, line - 1, num_args, min_required_args); exit(-1); } } @@ -1086,8 +1086,8 @@ my_atoi(const char *s) if (!s) return 0; if (!strstrip(s, buf, sizeof(buf))) { - fprintf(stderr, "%s: Error. %s:%i expression is too long\n", - progname, file_in, line - 1); + ERR("%s: Error. %s:%i expression is too long\n", + progname, file_in, line - 1); return 0; } _alphai(buf, &res); @@ -1100,8 +1100,8 @@ _deltai(char *s, int *val) if (!val) return NULL; if ('(' != s[0]) { - fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n", - progname, file_in, line - 1, s); + ERR("%s: Error. %s:%i unexpected character at %s\n", + progname, file_in, line - 1, s); return s; } else @@ -1131,8 +1131,8 @@ _funci(char *s, int *val) } else { - fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n", - progname, file_in, line - 1, s); + ERR("%s: Error. %s:%i unexpected character at %s\n", + progname, file_in, line - 1, s); } return s; } @@ -1154,7 +1154,7 @@ _gammai(char *s, int *val) else { s = _funci(s, val); -// fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n", +// ERR("%s: Error. %s:%i unexpected character at %s\n", // progname, file_in, line - 1, s); } return s; @@ -1264,8 +1264,8 @@ _calci(char op, int a, int b) case '/': if (0 != b) a /= b; else - fprintf(stderr, "%s: Error. %s:%i divide by zero\n", - progname, file_in, line - 1); + ERR("%s: Error. %s:%i divide by zero\n", + progname, file_in, line - 1); return a; case '*': a *= b; @@ -1273,12 +1273,12 @@ _calci(char op, int a, int b) case '%': if (0 != b) a = a % b; else - fprintf(stderr, "%s: Error. %s:%i modula by zero\n", - progname, file_in, line - 1); + ERR("%s: Error. %s:%i modula by zero\n", + progname, file_in, line - 1); return a; default: - fprintf(stderr, "%s: Error. %s:%i unexpected character '%c'\n", - progname, file_in, line - 1, op); + ERR("%s: Error. %s:%i unexpected character '%c'\n", + progname, file_in, line - 1, op); return a; } } @@ -1295,8 +1295,8 @@ my_atof(const char *s) if (!strstrip(s, buf, sizeof (buf))) { - fprintf(stderr, "%s: Error. %s:%i expression is too long\n", - progname, file_in, line - 1); + ERR("%s: Error. %s:%i expression is too long", + progname, file_in, line - 1); return 0; } _alphaf(buf, &res); @@ -1309,8 +1309,8 @@ _deltaf(char *s, double *val) if (!val) return NULL; if ('(' != s[0]) { - fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n", - progname, file_in, line - 1, s); + ERR("%s: Error. %s:%i unexpected character at %s", + progname, file_in, line - 1, s); return s; } else @@ -1340,8 +1340,8 @@ _funcf(char *s, double *val) } else { - fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n", - progname, file_in, line - 1, s); + ERR("%s: Error. %s:%i unexpected character at %s\n", + progname, file_in, line - 1, s); } return s; } @@ -1364,7 +1364,7 @@ _gammaf(char *s, double *val) else { s = _funcf(s, val); -// fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n", +// ERR("%s: Error. %s:%i unexpected character at %s\n", // progname, file_in, line - 1, s); } return s; @@ -1479,8 +1479,8 @@ _calcf(char op, double a, double b) case '/': if (b != 0) a /= b; else - fprintf(stderr, "%s: Error. %s:%i divide by zero\n", - progname, file_in, line - 1); + ERR("%s: Error. %s:%i divide by zero\n", + progname, file_in, line - 1); return a; case '*': a *= b; @@ -1488,12 +1488,12 @@ _calcf(char op, double a, double b) case '%': if (0 != b) a = (double)((int)a % (int)b); else - fprintf(stderr, "%s: Error. %s:%i modula by zero\n", - progname, file_in, line - 1); + ERR("%s: Error. %s:%i modula by zero\n", + progname, file_in, line - 1); return a; default: - fprintf(stderr, "%s: Error. %s:%i unexpected character '%c'\n", - progname, file_in, line - 1, op); + ERR("%s: Error. %s:%i unexpected character '%c'\n", + progname, file_in, line - 1, op); return a; } } @@ -1503,7 +1503,7 @@ strstrip(const char *in, char *out, size_t size) { if ((size -1 ) < strlen(in)) { - fprintf(stderr, "%s: Error. %s:%i expression is too long\n", + ERR("%s: Error. %s:%i expression is too long", progname, file_in, line - 1); return 0; } diff --git a/legacy/edje/src/bin/edje_cc_sources.c b/legacy/edje/src/bin/edje_cc_sources.c index e060a9800e..ba88bc9e68 100644 --- a/legacy/edje/src/bin/edje_cc_sources.c +++ b/legacy/edje/src/bin/edje_cc_sources.c @@ -70,8 +70,8 @@ source_fetch_file(const char *fil, const char *filname) f = fopen(fil, "rb"); if (!f) { - fprintf(stderr, "%s: Warning. Cannot open file '%s'\n", - progname, fil); + ERR("%s: Warning. Cannot open file '%s'", + progname, fil); exit(-1); } @@ -86,7 +86,7 @@ source_fetch_file(const char *fil, const char *filname) tmp = fread(sf->file, sz, 1, f); if (tmp != 1) { - fprintf(stderr, "%s: Warning file length for (%s) doesn't match !\n", + ERR("%s: Warning file length for (%s) doesn't match !", progname, filname); exit(-1); } diff --git a/legacy/edje/src/bin/edje_decc.c b/legacy/edje/src/bin/edje_decc.c index e1402adcae..0189ab8718 100644 --- a/legacy/edje/src/bin/edje_decc.c +++ b/legacy/edje/src/bin/edje_decc.c @@ -21,6 +21,7 @@ #include "edje_decc.h" +int _edje_cc_log_dom = -1; char *progname = NULL; char *file_in = NULL; char *file_out = NULL; @@ -57,7 +58,15 @@ main(int argc, char **argv) int i; setlocale(LC_NUMERIC, "C"); - + eina_init(); + _edje_cc_log_dom = eina_log_domain_register("edje_decc", EDJE_CC_DEFAULT_LOG_COLOR); + if(_edje_cc_log_dom < 0) + { + EINA_LOG_ERR("Edje_decc: Impossible to create a log domain for edje_decc"); + eina_shutdown(); + exit(-1); + } + eina_log_level_set(EINA_LOG_LEVEL_INFO); progname = argv[0]; for (i = 1; i < argc; i++) { @@ -75,7 +84,7 @@ main(int argc, char **argv) } if (!file_in) { - fprintf(stderr, "%s: Error: no input file specified.\n", progname); + ERR("%s: Error: no input file specified.", progname); main_help(); exit(-1); } @@ -89,6 +98,9 @@ main(int argc, char **argv) eet_close(ef); eet_shutdown(); + eina_log_domain_unregister(_edje_cc_log_dom); + _edje_cc_log_dom = -1; + eina_shutdown(); return 0; } @@ -98,27 +110,27 @@ decomp(void) ef = eet_open(file_in, EET_FILE_MODE_READ); if (!ef) { - printf("ERROR: cannot open %s\n", file_in); + ERR("ERROR: cannot open %s", file_in); return 0; } srcfiles = source_load(ef); if (!srcfiles || !srcfiles->list) { - printf("ERROR: %s has no decompile information\n", file_in); + ERR("ERROR: %s has no decompile information", file_in); eet_close(ef); return 0; } if (!eina_list_data_get(srcfiles->list) || !root_filename_is_sane()) { - printf("ERROR: Invalid root filename: '%s'\n", (char *) eina_list_data_get(srcfiles->list)); + ERR("ERROR: Invalid root filename: '%s'", (char *) eina_list_data_get(srcfiles->list)); eet_close(ef); return 0; } edje_file = eet_data_read(ef, _edje_edd_edje_file, "edje_file"); if (!edje_file) { - printf("ERROR: %s does not appear to be an edje file\n", file_in); + ERR("ERROR: %s does not appear to be an edje file", file_in); eet_close(ef); return 0; } @@ -128,7 +140,7 @@ decomp(void) } else if (!compiler_cmd_is_sane()) { - printf("ERROR: invalid compiler executable: '%s'\n", edje_file->compiler); + ERR("ERROR: invalid compiler executable: '%s'", edje_file->compiler); eet_close(ef); return 0; } @@ -184,14 +196,14 @@ output(void) ee = ecore_evas_buffer_new(1, 1); if (!ee) { - fprintf(stderr, "Error. cannot create buffer engine canvas for image save.\n"); + ERR("Cannot create buffer engine canvas for image save."); exit(-1); } evas = ecore_evas_get(ee); im = evas_object_image_add(evas); if (!im) { - fprintf(stderr, "Error. cannot create image object for save.\n"); + ERR("Cannot create image object for save."); exit(-1); } snprintf(buf, sizeof(buf), "images/%i", ei->id); @@ -203,14 +215,14 @@ output(void) *p = 0; if (strstr(pp, "../")) { - printf("ERROR: potential security violation. attempt to write in parent dir.\n"); + ERR("Potential security violation. attempt to write in parent dir."); exit(-1); } ecore_file_mkpath(pp); free(pp); if (!evas_object_image_save(im, out, NULL, "quality=100 compress=9")) { - printf("ERROR: cannot write file %s. Perhaps missing JPEG or PNG saver modules for Evas.\n", out); + ERR("Cannot write file %s. Perhaps missing JPEG or PNG saver modules for Evas.", out); exit(-1); } evas_object_del(im); @@ -228,26 +240,26 @@ output(void) char *pp; snprintf(out, sizeof(out), "%s/%s", outdir, sf->name); - printf("Output Source File: %s\n", out); + INF("Output Source File: %s\n", out); pp = strdup(out); p = strrchr(pp, '/'); *p = 0; if (strstr(pp, "../")) { - printf("ERROR: potential security violation. attempt to write in parent dir.\n"); + ERR("Potential security violation. attempt to write in parent dir."); exit (-1); } ecore_file_mkpath(pp); free(pp); if (strstr(out, "../")) { - printf("ERROR: potential security violation. attempt to write in parent dir.\n"); + ERR("Potential security violation. attempt to write in parent dir."); exit (-1); } f = fopen(out, "wb"); if (!f) { - printf("ERROR: unable to write file (%s).\n", out); + ERR("Unable to write file (%s).", out); exit (-1); } @@ -275,20 +287,20 @@ output(void) char *pp; snprintf(out, sizeof(out), "%s/%s", outdir, fn->file); - printf("Output Font: %s\n", out); + INF("Output Font: %s", out); pp = strdup(out); p = strrchr(pp, '/'); *p = 0; if (strstr(pp, "../")) { - printf("ERROR: potential security violation. attempt to write in parent dir.\n"); + ERR("Potential security violation. attempt to write in parent dir."); exit (-1); } ecore_file_mkpath(pp); free(pp); if (strstr(out, "../")) { - printf("ERROR: potential security violation. attempt to write in parent dir.\n"); + ERR("Potential security violation. attempt to write in parent dir."); exit (-1); } f = fopen(out, "wb"); @@ -310,7 +322,7 @@ output(void) printf("Output Build Script: %s\n", out); if (strstr(out, "../")) { - printf("ERROR: potential security violation. attempt to write in parent dir.\n"); + ERR("potential security violation. attempt to write in parent dir.\n"); exit (-1); } f = fopen(out, "wb"); @@ -318,9 +330,9 @@ output(void) fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, sf->name, outdir); fclose(f); - printf("\n*** CAUTION ***\n" - "Please check the build script for anything malicious " - "before running it!\n\n"); + WRN("\n*** CAUTION ***\n" + "Please check the build script for anything malicious " + "before running it!\n\n"); } if (file_out) @@ -328,7 +340,7 @@ output(void) snprintf(out, sizeof(out), "%s/%s", outdir, file_out); if (symlink(sf->name, out) != 0) { - printf("ERROR: symlink %s -> %s failed\n", sf->name, out); + ERR("symlink %s -> %s failed\n", sf->name, out); } } diff --git a/legacy/edje/src/bin/edje_decc.h b/legacy/edje/src/bin/edje_decc.h index be0495ce87..43e988d70d 100644 --- a/legacy/edje/src/bin/edje_decc.h +++ b/legacy/edje/src/bin/edje_decc.h @@ -3,6 +3,22 @@ #include +/* logging variables */ +extern int _edje_cc_log_dom ; +#define EDJE_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_edje_cc_log_dom, __VA_ARGS__) +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_edje_cc_log_dom, __VA_ARGS__) +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_edje_cc_log_dom, __VA_ARGS__) + /* types */ typedef struct _Font Font; typedef struct _Font_List Font_List; diff --git a/legacy/edje/src/bin/edje_prefix.c b/legacy/edje/src/bin/edje_prefix.c index 9a8fb21c9f..0819ee1ad3 100644 --- a/legacy/edje/src/bin/edje_prefix.c +++ b/legacy/edje/src/bin/edje_prefix.c @@ -26,7 +26,7 @@ #endif #include "edje_prefix.h" - +#include "edje_cc.h" #ifdef _WIN32 # define EDJE_DIR_SEPARATOR '\\' # define EDJE_DIR_SEPARATOR_S "\\" @@ -301,7 +301,7 @@ _e_prefix_fallbacks(void) _prefix_path_bin = strdup(PACKAGE_BIN_DIR); _prefix_path_data = strdup(PACKAGE_DATA_DIR); _prefix_path_lib = strdup(PACKAGE_LIB_DIR); - printf("WARNING: Edje could not determine its installed prefix\n" + WRN("WARNING: Edje could not determine its installed prefix\n" " and is falling back on the compiled in default:\n" " %s\n" " You might like to try setting the following environment variables:\n" @@ -311,9 +311,8 @@ _e_prefix_fallbacks(void) " EDJE_LIB_DIR - optional in addition to E_PREFIX to provide\n" " a more specific library dir\n" " EDJE_DATA_DIR- optional in addition to E_PREFIX to provide\n" - " a more specific location for shared data\n" - , - _prefix_path); + " a more specific location for shared data", + _prefix_path); return 1; } diff --git a/legacy/edje/src/lib/edje_cache.c b/legacy/edje/src/lib/edje_cache.c index f235465c13..acc9551085 100644 --- a/legacy/edje/src/lib/edje_cache.c +++ b/legacy/edje/src/lib/edje_cache.c @@ -105,12 +105,12 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) if ((err_code = luaL_loadbuffer(edc->L, data, size, "edje_lua_script"))) { if (err_code == LUA_ERRSYNTAX) - printf("lua load syntax error: %s\n", lua_tostring(edc->L, -1)); + ERR("lua load syntax error: %s", lua_tostring(edc->L, -1)); else if (err_code == LUA_ERRMEM) - printf("lua load memory allocation error: %s\n", lua_tostring(edc->L, -1)); + ERR("lua load memory allocation error: %s", lua_tostring(edc->L, -1)); } if (lua_pcall(edc->L, 0, 0, 0)) - printf("lua call error: %s\n", lua_tostring(edc->L, -1)); + ERR("lua call error: %s", lua_tostring(edc->L, -1)); free(data); } @@ -315,7 +315,7 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E ep2 = eina_list_nth(edc->parts, ep2->dragable.confine_id); if (eina_list_data_find(hist, ep2)) { - printf("EDJE ERROR: confine_to loops. invalidating loop.\n"); + ERR("confine_to loops. invalidating loop."); ep2->dragable.confine_id = -1; break; } @@ -340,7 +340,7 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E if (eina_list_data_find(hist, ep2)) { - printf("EDJE ERROR: events_to loops. invalidating loop.\n"); + ERR("events_to loops. invalidating loop."); ep2->dragable.events_id = -1; break; } @@ -355,7 +355,7 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E ep2 = eina_list_nth(edc->parts, ep2->clip_to_id); if (eina_list_data_find(hist, ep2)) { - printf("EDJE ERROR: clip_to loops. invalidating loop.\n"); + ERR("clip_to loops. invalidating loop."); ep2->clip_to_id = -1; break; } diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c index 565271dcf9..0ce433ccf4 100644 --- a/legacy/edje/src/lib/edje_calc.c +++ b/legacy/edje/src/lib/edje_calc.c @@ -1452,8 +1452,8 @@ _edje_box_recalc_apply(Edje *ed __UNUSED__, Edje_Real_Part *ep, Edje_Calc_Params if ((!chosen_desc->box.alt_layout) || (!_edje_box_layout_find(chosen_desc->box.alt_layout, &layout, &data, &free_data))) { - fprintf(stderr, "ERROR: box layout '%s' (fallback '%s') not available, using horizontal.\n", - chosen_desc->box.layout, chosen_desc->box.alt_layout); + ERR("ERROR: box layout '%s' (fallback '%s') not available, using horizontal.", + chosen_desc->box.layout, chosen_desc->box.alt_layout); layout = evas_object_box_layout_horizontal; free_data = NULL; data = NULL; @@ -1547,11 +1547,11 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj } if (image_id < 0) { - printf("EDJE ERROR: part \"%s\" has description, " - "\"%s\" %3.3f with a missing image id!!!\n", - ep->part->name, - ep->param1.description->state.name, - ep->param1.description->state.value); + ERR("¨Part \"%s\" has description, " + "\"%s\" %3.3f with a missing image id!!!", + ep->part->name, + ep->param1.description->state.name, + ep->param1.description->state.value); } else { @@ -1565,28 +1565,28 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj evas_object_image_file_set(ep->object, ed->file->path, buf); if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE) { - printf("EDJE: Error loading image collection \"%s\" from " - "file \"%s\". Missing EET Evas loader module?\n", - buf, ed->file->path); + ERR("Error loading image collection \"%s\" from " + "file \"%s\". Missing EET Evas loader module?", + buf, ed->file->path); switch (evas_object_image_load_error_get(ep->object)) { case EVAS_LOAD_ERROR_GENERIC: - printf("Error type: EVAS_LOAD_ERROR_GENERIC\n"); + ERR("Error type: EVAS_LOAD_ERROR_GENERIC"); break; case EVAS_LOAD_ERROR_DOES_NOT_EXIST: - printf("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST\n"); + ERR("Error type: EVAS_LOAD_ERROR_DOES_NOT_EXIST"); break; case EVAS_LOAD_ERROR_PERMISSION_DENIED: - printf("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED\n"); + ERR("Error type: EVAS_LOAD_ERROR_PERMISSION_DENIED"); break; case EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED: - printf("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED\n"); + ERR("Error type: EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED"); break; case EVAS_LOAD_ERROR_CORRUPT_FILE: - printf("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE\n"); + ERR("Error type: EVAS_LOAD_ERROR_CORRUPT_FILE"); break; case EVAS_LOAD_ERROR_UNKNOWN_FORMAT: - printf("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT\n"); + ERR("Error type: EVAS_LOAD_ERROR_UNKNOWN_FORMAT"); break; } } @@ -1635,12 +1635,12 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) faxes = "X"; else if ((flags & FLAG_Y)) faxes = "Y"; - printf("EDJE ERROR: Circular dependency when calculating part \"%s\"\n" - " Already calculating %s [%02x] axes\n" - " Need to calculate %s [%02x] axes\n", - ep->part->name, - axes, ep->calculating, - faxes, flags); + ERR("Circular dependency when calculating part \"%s\"\n" + "Already calculating %s [%02x] axes\n" + "Need to calculate %s [%02x] axes", + ep->part->name, + axes, ep->calculating, + faxes, flags); #endif return; } diff --git a/legacy/edje/src/lib/edje_edit.c b/legacy/edje/src/lib/edje_edit.c index abb801ec23..650b496127 100644 --- a/legacy/edje/src/lib/edje_edit.c +++ b/legacy/edje/src/lib/edje_edit.c @@ -72,8 +72,8 @@ _alloc(size_t size) mem = calloc(1, size); if (mem) return mem; - fprintf(stderr, "Edje_Edit: Error. memory allocation of %i bytes failed. %s\n", - (int)size, strerror(errno)); + ERR("Edje_Edit: Error. memory allocation of %i bytes failed. %s", + (int)size, strerror(errno)); return NULL; } @@ -228,10 +228,10 @@ _edje_import_image_file(Edje *ed, const char *path, int id) evas_object_image_file_set(im, path, NULL); if (evas_object_image_load_error_get(im) != EVAS_LOAD_ERROR_NONE) { - fprintf(stderr, "Edje_Edit: Error. unable to load image \"%s\"." - "Missing PNG or JPEG loader modules for Evas or " - "file does not exist, or is not readable.\n", path); - evas_object_del(im); + ERR("Edje_Edit: unable to load image \"%s\"." + "Missing PNG or JPEG loader modules for Evas or " + "file does not exist, or is not readable.", path); + evas_object_del(im); im = NULL; return 0; } @@ -253,8 +253,7 @@ _edje_import_image_file(Edje *ed, const char *path, int id) eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - fprintf(stderr, - "Edje_Edit: Error. unable to open \"%s\" for writing output\n", + ERR("Edje_Edit: Error. unable to open \"%s\" for writing output", ed->path); evas_object_del(im); return 0; @@ -270,8 +269,8 @@ _edje_import_image_file(Edje *ed, const char *path, int id) 0, 100, 1); if (bytes <= 0) { - fprintf(stderr, "Edje_Edit: Error. unable to write image part \"%s\" " - "part entry to %s\n", buf, ed->path); + ERR("Edje_Edit: Error. unable to write image part \"%s\" " + "part entry to %s", buf, ed->path); evas_object_del(im); return 0; } @@ -283,8 +282,8 @@ _edje_import_image_file(Edje *ed, const char *path, int id) bytes = eet_data_write(eetf, _edje_edd_edje_file, "edje_file", ed->file, 1); if (bytes <= 0) { - fprintf(stderr, "Edje_Edit: Error. unable to write \"edje_file\" " - "entry to \"%s\" \n", ed->path); + ERR("Edje_Edit: Error. unable to write \"edje_file\" " + "entry to \"%s\"", ed->path); eet_close(eetf); return 0; } @@ -780,8 +779,8 @@ edje_edit_group_del(Evas_Object *obj) eetf = eet_open(ed->file->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - fprintf(stderr, "Edje_Edit: Error. unable to open \"%s\" " - "for writing output\n", ed->file->path); + ERR("Edje_Edit: Error. unable to open \"%s\" " + "for writing output", ed->file->path); return 0; } snprintf(buf, sizeof(buf), "collections/%d", g->id); @@ -3822,8 +3821,8 @@ edje_edit_font_add(Evas_Object *obj, const char* path) { if (fread(fdata, pos, 1, f) != 1) { - fprintf(stderr, "Edje_Edit: Error. unable to read all of font file \"%s\"\n", - path); + ERR("Edje_Edit: Error. unable to read all of font file \"%s\"", + path); return 0; } fsize = pos; @@ -3839,16 +3838,15 @@ edje_edit_font_add(Evas_Object *obj, const char* path) eetf = eet_open(ed->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - fprintf(stderr, - "Edje_Edit: Error. unable to open \"%s\" for writing output\n", - ed->path); + ERR("Edje_Edit: Error. unable to open \"%s\" for writing output", + ed->path); return 0; } if (eet_write(eetf, buf, fdata, fsize, 1) <= 0) { - fprintf(stderr, "Edje_Edit: Error. unable to write font part \"%s\" as \"%s\" part entry\n", - path, buf); + ERR("Edje_Edit: Error. unable to write font part \"%s\" as \"%s\" part entry", + path, buf); eet_close(eetf); free(fdata); return 0; @@ -5941,7 +5939,7 @@ _edje_generate_source(Evas_Object *obj) strcpy(tmpn, "/tmp/edje_edit.edc-tmp-XXXXXX"); #endif if (!(fd = mkstemp(tmpn))) return NULL; - printf("*** tmp file: %s\n", tmpn); + INF("*** tmp file: %s", tmpn); if (!(f = fdopen(fd, "wb"))) return NULL; /* Write edc into file */ @@ -6109,8 +6107,8 @@ edje_edit_save(Evas_Object *obj) ef = ed->file; if (!ef) return 0; - printf("*********** Saving file ******************\n"); - printf("** path: %s\n", ef->path); + INF("*********** Saving file ******************"); + INF("** path: %s", ef->path); /* Set compiler name */ if (strcmp(ef->compiler, "edje_edit")) @@ -6123,18 +6121,18 @@ edje_edit_save(Evas_Object *obj) eetf = eet_open(ef->path, EET_FILE_MODE_READ_WRITE); if (!eetf) { - fprintf(stderr, "Error. unable to open \"%s\" for writing output\n", - ef->path); + ERR("Error. unable to open \"%s\" for writing output", + ef->path); return 0; } /* Write Edje_File structure */ - printf("** Writing Edje_File* ed->file\n"); + INF("** Writing Edje_File* ed->file"); bytes = eet_data_write(eetf, _edje_edd_edje_file, "edje_file", ef, 1); if (bytes <= 0) { - fprintf(stderr, "Error. unable to write \"edje_file\" " - "entry to \"%s\" \n", ef->path); + ERR("Error. unable to write \"edje_file\" " + "entry to \"%s\"", ef->path); eet_close(eetf); return 0; } @@ -6142,8 +6140,8 @@ edje_edit_save(Evas_Object *obj) /* Write all the collections */ if (ed->collection) { - printf("** Writing Edje_Part_Collection* ed->collection " - "[id: %d]\n", ed->collection->id); + INF("** Writing Edje_Part_Collection* ed->collection " + "[id: %d]", ed->collection->id); snprintf(buf, sizeof(buf), "collections/%i", ed->collection->id); @@ -6151,8 +6149,8 @@ edje_edit_save(Evas_Object *obj) buf, ed->collection, 1); if (bytes <= 0) { - fprintf(stderr, "Error. unable to write \"%s\" part entry to %s \n", - buf, ef->path); + ERR("Error. unable to write \"%s\" part entry to %s", + buf, ef->path); eet_close(eetf); return 0; } @@ -6168,11 +6166,11 @@ edje_edit_save(Evas_Object *obj) source_file = _edje_generate_source(obj); if (!source_file) { - fprintf(stderr, "Error: can't create edc source\n"); + ERR("Error: can't create edc source"); eet_close(eetf); return 0; } - printf("** Writing EDC Source [from: %s]\n", source_file); + INF("** Writing EDC Source [from: %s]", source_file); //open the temp file and put the contents in SrcFile sf = _alloc(sizeof(SrcFile)); @@ -6182,8 +6180,8 @@ edje_edit_save(Evas_Object *obj) f = fopen(source_file, "rb"); if (!f) { - fprintf(stderr, "Error. unable to read the created edc source [%s]\n", - source_file); + ERR("Error. unable to read the created edc source [%s]", + source_file); eet_close(eetf); return 0; } @@ -6211,7 +6209,7 @@ edje_edit_save(Evas_Object *obj) bytes = eet_data_write(eetf, _srcfile_list_edd, "edje_sources", sfl, 1); if (bytes <= 0) { - fprintf(stderr, "Error. unable to write edc source\n"); + ERR("Error. unable to write edc source"); eet_close(eetf); return 0; } @@ -6220,7 +6218,7 @@ edje_edit_save(Evas_Object *obj) unlink(source_file); eina_stringshare_del(source_file); eet_close(eetf); - printf("*********** Saving DONE ******************\n"); + INF("*********** Saving DONE ******************"); return 1; } @@ -6236,15 +6234,15 @@ edje_edit_print_internal_status(Evas_Object *obj) _edje_generate_source(obj); return; - printf("\n****** CHECKIN' INTERNAL STRUCTS STATUS *********\n"); + INF("\n****** CHECKIN' INTERNAL STRUCTS STATUS *********"); - printf("*** Edje\n"); - printf(" path: '%s'\n", ed->path); - printf(" group: '%s'\n", ed->group); - printf(" parent: '%s'\n", ed->parent); + INF("*** Edje\n"); + INF(" path: '%s'", ed->path); + INF(" group: '%s'", ed->group); + INF(" parent: '%s'", ed->parent); - printf("\n*** Parts [table:%d list:%d]\n", ed->table_parts_size, - eina_list_count(ed->collection->parts)); + INF("*** Parts [table:%d list:%d]", ed->table_parts_size, + eina_list_count(ed->collection->parts)); EINA_LIST_FOREACH(ed->collection->parts, l, p) { Edje_Real_Part *rp; @@ -6254,10 +6252,10 @@ edje_edit_print_internal_status(Evas_Object *obj) if (p == rp->part) printf(" OK!\n"); else - printf(" WRONG (table[%id]->name = '%s')\n", p->id, rp->part->name); + WRN(" WRONG (table[%id]->name = '%s')", p->id, rp->part->name); } - printf("\n*** Programs [table:%d list:%d]\n", ed->table_programs_size, + INF("*** Programs [table:%d list:%d]", ed->table_programs_size, eina_list_count(ed->collection->programs)); EINA_LIST_FOREACH(ed->collection->programs, l, epr) { @@ -6268,10 +6266,10 @@ edje_edit_print_internal_status(Evas_Object *obj) if (epr == epr2) printf(" OK!\n"); else - printf(" WRONG (table[%id]->name = '%s')\n", epr->id, epr2->name); + WRN(" WRONG (table[%id]->name = '%s')", epr->id, epr2->name); } printf("\n"); - printf("****************** END ************************\n\n"); + INF("****************** END ************************\n"); } diff --git a/legacy/edje/src/lib/edje_embryo.c b/legacy/edje/src/lib/edje_embryo.c index c67a129b3c..c561740191 100644 --- a/legacy/edje/src/lib/edje_embryo.c +++ b/legacy/edje/src/lib/edje_embryo.c @@ -2363,19 +2363,19 @@ _edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char * ret = embryo_program_run(ed->collection->script, fn); if (ret == EMBRYO_PROGRAM_FAIL) { - printf("EDJE: ERROR with embryo script.\n" - "ENTRY POINT: %s\n" - "ERROR: %s\n", - fname, - embryo_error_string_get(embryo_program_error_get(ed->collection->script))); + ERR("ERROR with embryo script.\n" + "ENTRY POINT: %s\n" + "ERROR: %s", + fname, + embryo_error_string_get(embryo_program_error_get(ed->collection->script))); } else if (ret == EMBRYO_PROGRAM_TOOLONG) { - printf("EDJE: ERROR with embryo script.\n" - "ENTRY POINT: %s\n" - "ERROR: Script exceeded maximum allowed cycle count of %i\n", - fname, - embryo_program_max_cycle_run_get(ed->collection->script)); + ERR("ERROR with embryo script.\n" + "ENTRY POINT: %s\n" + "ERROR: Script exceeded maximum allowed cycle count of %i", + fname, + embryo_program_max_cycle_run_get(ed->collection->script)); } embryo_program_data_set(ed->collection->script, pdata); } diff --git a/legacy/edje/src/lib/edje_external.c b/legacy/edje/src/lib/edje_external.c index 87af6a4f73..6d9a8ffdc4 100644 --- a/legacy/edje/src/lib/edje_external.c +++ b/legacy/edje/src/lib/edje_external.c @@ -38,7 +38,7 @@ edje_external_type_register(const char *type_name, const Edje_External_Type *typ if (eina_hash_find(type_registry, type_name)) { - printf("EDJE ERROR: external type '%s' already registered\n", type_name); + ERR("External type '%s' already registered", type_name); return EINA_FALSE; } return eina_hash_add(type_registry, type_name, type_info); @@ -284,13 +284,13 @@ _edje_external_type_add(const char *type_name, Evas *evas, Evas_Object *parent, obj = type->add(type->data, evas, parent, params); if (!obj) { - printf("EDJE ERROR: external type '%s' returned NULL from constructor\n", type_name); + ERR("External type '%s' returned NULL from constructor", type_name); return NULL; } evas_object_data_set(obj, "Edje_External_Type", type); - printf("evas object: %p, external type: %p, data_get: %p\n", obj, type, evas_object_data_get(obj, "Edje_External_Type")); + ERR("Evas object: %p, external type: %p, data_get: %p", obj, type, evas_object_data_get(obj, "Edje_External_Type")); return obj; } @@ -302,7 +302,7 @@ _edje_external_signal_emit(Evas_Object *obj, const char *emission, const char *s type = evas_object_data_get(obj, "Edje_External_Type"); if (!type) { - printf("EDJE ERROR: external type data not found.\n"); + ERR("External type data not found."); return; } diff --git a/legacy/edje/src/lib/edje_load.c b/legacy/edje/src/lib/edje_load.c index f38b238c91..1397fe6728 100644 --- a/legacy/edje/src/lib/edje_load.c +++ b/legacy/edje/src/lib/edje_load.c @@ -393,7 +393,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g rp->param1.description = ep->default_desc; rp->chosen_description = rp->param1.description; if (!rp->param1.description) - printf("EDJE ERROR: no default part description!\n"); + ERR("no default part description!"); switch (ep->type) { @@ -1058,16 +1058,16 @@ _edje_file_free(Edje_File *edf) /* FIXME: free collection_hash and collection_cache */ if (edf->collection_hash) { - printf("EDJE ERROR:\n" - "\n" - "Naughty Programmer - spank spank!\n" - "\n" - "This program as probably called edje_shutdown() with active Edje objects\n" - "still around.\n This can cause problems as both Evas and Edje retain\n" - "references to the objects. you should shut down all canvases and objects\n" - "before calling edje_shutdown().\n" - "The following errors are the edje object files and parts that are still\n" - "hanging around, with their reference counts\n"); + ERR("EDJE ERROR:\n" + "\n" + "Naughty Programmer - spank spank!\n" + "\n" + "This program as probably called edje_shutdown() with active Edje objects\n" + "still around.\n This can cause problems as both Evas and Edje retain\n" + "references to the objects. you should shut down all canvases and objects\n" + "before calling edje_shutdown().\n" + "The following errors are the edje object files and parts that are still\n" + "hanging around, with their reference counts"); eina_hash_foreach(edf->collection_hash, _edje_file_collection_hash_foreach, edf); eina_hash_free(edf->collection_hash); @@ -1184,9 +1184,9 @@ _edje_file_collection_hash_foreach(const Eina_Hash *hash __UNUSED__, const void edf = fdata; coll = data; - printf("EEK: EDJE FILE: \"%s\" ref(%i) PART: \"%s\" ref(%i) \n", - edf->path, edf->references, - coll->part, coll->references); + ERR("EEK: EDJE FILE: \"%s\" ref(%i) PART: \"%s\" ref(%i) ", + edf->path, edf->references, + coll->part, coll->references); _edje_collection_free(edf, coll); return 1; diff --git a/legacy/edje/src/lib/edje_lua.c b/legacy/edje/src/lib/edje_lua.c index 7d4c2ac9bd..f7d16ed25e 100644 --- a/legacy/edje/src/lib/edje_lua.c +++ b/legacy/edje/src/lib/edje_lua.c @@ -163,7 +163,7 @@ _edje_lua_error(lua_State *L, int err_code) err_type = "unknown"; break; } - fprintf(stderr, "Lua %s error: %s\n", err_type, lua_tostring(L, -1)); + ERR("Lua %s error: %s", err_type, lua_tostring(L, -1)); // don't exit. this is BAD. lua script bugs will cause thngs like e to // exit mysteriously endig your x session. bad! // exit(-1); @@ -5029,9 +5029,8 @@ _edje_lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) ela->cur += nsize - osize; if (ela->cur > ela->max) { - fprintf(stderr, - "Edje Lua memory limit of %i bytes reached (%i allocated)\n", - ela->max, ela->cur); + ERR("Edje Lua memory limit of %i bytes reached (%i allocated)", + ela->max, ela->cur); return NULL; } if (nsize == 0) @@ -5055,7 +5054,7 @@ _edje_lua_init() Ledje = lua_newstate(_edje_lua_alloc, &ela); if (!Ledje) { - fprintf(stderr, "Lua error: Lua state could not be initialized\n"); + ERR("Lua error: Lua state could not be initialized"); exit(-1); } diff --git a/legacy/edje/src/lib/edje_main.c b/legacy/edje/src/lib/edje_main.c index c71a3567ba..f7061c3276 100644 --- a/legacy/edje/src/lib/edje_main.c +++ b/legacy/edje/src/lib/edje_main.c @@ -7,18 +7,10 @@ #include "edje_private.h" static int _edje_init_count = 0; -static int _edje_log_dom_global = -1; +int _edje_default_log_dom = -1; Eina_Mempool *_edje_real_part_mp = NULL; Eina_Mempool *_edje_real_part_state_mp = NULL; -#ifdef EDJE_DEFAULT_LOG_COLOR -# undef EDJE_DEFAULT_LOG_COLOR -#endif -#define EDJE_DEFAULT_LOG_COLOR EINA_COLOR_CYAN -#ifdef ERR -# undef ERR -#endif -#define ERR(...) EINA_LOG_DOM_ERR(_edje_log_dom_global, __VA_ARGS__) /*============================================================================* @@ -68,8 +60,8 @@ edje_init(void) return --_edje_init_count; } - _edje_log_dom_global = eina_log_domain_register("Edje", EDJE_DEFAULT_LOG_COLOR); - if (_edje_log_dom_global < 0) + _edje_default_log_dom = eina_log_domain_register("Edje", EDJE_DEFAULT_LOG_COLOR); + if (_edje_default_log_dom < 0) { EINA_LOG_ERR("Edje Can not create a general log domain."); goto shutdown_eina; @@ -142,8 +134,8 @@ edje_init(void) shutdown_ecore_job: ecore_job_shutdown(); unregister_log_domain: - eina_log_domain_unregister(_edje_log_dom_global); - _edje_log_dom_global = -1; + eina_log_domain_unregister(_edje_default_log_dom); + _edje_default_log_dom = -1; shutdown_eina: eina_shutdown(); return --_edje_init_count; @@ -199,8 +191,8 @@ edje_shutdown(void) eet_shutdown(); embryo_shutdown(); ecore_job_shutdown(); - eina_log_domain_unregister(_edje_log_dom_global); - _edje_log_dom_global = -1; + eina_log_domain_unregister(_edje_default_log_dom); + _edje_default_log_dom = -1; eina_shutdown(); return _edje_init_count; diff --git a/legacy/edje/src/lib/edje_match.c b/legacy/edje/src/lib/edje_match.c index 5775734164..57ad23f2b2 100644 --- a/legacy/edje/src/lib/edje_match.c +++ b/legacy/edje/src/lib/edje_match.c @@ -288,7 +288,7 @@ _edje_match_patterns_exec_init_states(Edje_States *states, r->patterns[i] = str; \ \ if (Show) \ - fprintf(stderr, "%i [%s]\n", i, str); \ + INF("%i [%s]", i, str); \ \ r->finals[i] = 0; \ for (j = 0; str[j]; ++j) \ diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 205aeb93c2..06bc7b2ccb 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -25,7 +25,28 @@ #include #include +EAPI extern int _edje_default_log_dom ; +#ifdef EDJE_DEFAULT_LOG_COLOR +# undef EDJE_DEFAULT_LOG_COLOR +#endif +#define EDJE_DEFAULT_LOG_COLOR EINA_COLOR_CYAN +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_edje_default_log_dom, __VA_ARGS__) +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_edje_default_log_dom, __VA_ARGS__) +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_edje_default_log_dom, __VA_ARGS__) +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_edje_default_log_dom, __VA_ARGS__) #ifdef __GNUC__ # if __GNUC__ >= 4 // BROKEN in gcc 4 on amd64 diff --git a/legacy/edje/src/lib/edje_program.c b/legacy/edje/src/lib/edje_program.c index ab51431c58..7b536d4810 100644 --- a/legacy/edje/src/lib/edje_program.c +++ b/legacy/edje/src/lib/edje_program.c @@ -615,8 +615,8 @@ _edje_program_run(Edje *ed, Edje_Program *pr, int force, const char *ssig, const } if ((recursions >= 64) || (recursion_limit)) { - printf("EDJE ERROR: programs recursing up to recursion limit of %i. Disabled.\n", - 64); + ERR("Programs recursing up to recursion limit of %i. Disabled.", + 64); recursion_limit = 1; return; } diff --git a/legacy/edje/src/lib/edje_script_only.c b/legacy/edje/src/lib/edje_script_only.c index 76c8a4a989..090626f3de 100644 --- a/legacy/edje/src/lib/edje_script_only.c +++ b/legacy/edje/src/lib/edje_script_only.c @@ -643,18 +643,18 @@ _call_fn(Edje * ed, const char *fname, Embryo_Function fn) ret = embryo_program_run(ed->collection->script, fn); if (ret == EMBRYO_PROGRAM_FAIL) { - printf("EDJE: ERROR with embryo script.\n" - "ENTRY POINT: %s\n" - "ERROR: %s\n", + ERR("ERROR with embryo script.\n" + "ENTRY POINT: %s\n" + "ERROR: %s", fname, embryo_error_string_get(embryo_program_error_get (ed->collection->script))); } else if (ret == EMBRYO_PROGRAM_TOOLONG) { - printf("EDJE: ERROR with embryo script.\n" - "ENTRY POINT: %s\n" - "ERROR: Script exceeded maximum allowed cycle count of %i\n", - fname, embryo_program_max_cycle_run_get(ed->collection->script)); + ERR("ERROR with embryo script.\n" + "ENTRY POINT: %s\n" + "ERROR: Script exceeded maximum allowed cycle count of %i", + fname, embryo_program_max_cycle_run_get(ed->collection->script)); } } diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index ff0a11f99b..3b9fc464de 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c @@ -61,7 +61,7 @@ edje_freeze(void) { #ifdef FASTFREEZE _edje_freeze_val++; - printf("fr ++ ->%i\n", _edje_freeze_val); + INF("fr ++ ->%i", _edje_freeze_val); #else // FIXME: could just have a global freeze instead of per object // above i tried.. but this broke some things. notable e17's menus. why? @@ -111,7 +111,7 @@ edje_thaw(void) #ifdef FASTFREEZE _edje_freeze_val--; - printf("fr -- ->%i\n", _edje_freeze_val); + INF("fr -- ->%i", _edje_freeze_val); if ((_edje_freeze_val <= 0) && (_edje_freeze_calc_count > 0)) { Eina_List *l; @@ -2348,9 +2348,8 @@ edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(* if (_edje_box_layout_builtin_find(name)) { - fprintf(stderr, - "ERROR: cannot register layout '%s': would override builtin!\n", - name); + ERR("Cannot register layout '%s': would override builtin!", + name); if (data && free_data) free_data(data); return; @@ -2703,11 +2702,11 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co } if ((ed->w > 4000) || (ed->h > 4000)) { - printf("EDJE ERROR: file %s, group %s has a non-fixed part. add fixed: 1 1; ???\n", + ERR("file %s, group %s has a non-fixed part. add fixed: 1 1; ???", ed->path, ed->group); if (pep) - printf(" Problem part is: %s\n", pep->part->name); - printf(" Will recalc min size not allowing broken parts to affect the result.\n"); + ERR(" Problem part is: %s", pep->part->name); + ERR(" Will recalc min size not allowing broken parts to affect the result."); if (reset_maxwh) { reset_maxwh = 0; @@ -2763,7 +2762,7 @@ edje_object_part_state_get(const Evas_Object *obj, const char *part, double *val if (!rp) { if (val_ret) *val_ret = 0; - printf("part not found\n"); + INF("part not found"); return ""; } if (rp->chosen_description)