From 0effd20c4118021b9d56051c55d8e6589e89014f Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Wed, 13 Jan 2016 11:55:46 +0900 Subject: [PATCH] Edje: enhance embryo stack broken error message Summary: Enhance embry stack broken error message Test Plan: Make a run_program run a script Reviewers: raster, zmike, jpeg Reviewed By: jpeg Subscribers: cedric, seoz, jpeg Differential Revision: https://phab.enlightenment.org/D3528 Change-Id: I26fa61b420ee40956323bf5ee526fbeb3238351f --- src/lib/edje/edje_embryo.c | 18 ++++++++++++------ src/lib/edje/edje_private.h | 2 +- src/lib/edje/edje_program.c | 5 +---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/lib/edje/edje_embryo.c b/src/lib/edje/edje_embryo.c index 2595603..c20b2e4 100644 --- a/src/lib/edje/edje_embryo.c +++ b/src/lib/edje/edje_embryo.c @@ -4440,8 +4440,9 @@ _edje_embryo_script_reset(Edje *ed) /* this may change in future - thus "test_run" is its name */ void -_edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char *src) +_edje_embryo_test_run(Edje *ed, Edje_Program *pr, const char *sig, const char *src) { + char fname[128]; Embryo_Function fn; if (!ed) return; @@ -4451,6 +4452,7 @@ _edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char * _edje_embryo_globals_init(ed); // _edje_embryo_script_reset(ed); + snprintf(fname, sizeof(fname), "_p%i", pr->id); fn = embryo_program_function_find(ed->collection->script, (char *)fname); if (fn != EMBRYO_FUNCTION_NONE) { @@ -4474,20 +4476,24 @@ _edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char * /* like 0.03 - 0.05 seconds or even more */ embryo_program_max_cycle_run_set(ed->collection->script, 5000000); if (embryo_program_recursion_get(ed->collection->script) && (!ed->collection->script_recursion)) - ERR("You are running Embryo->EDC->Embryo with script program '%s';\nBy the power of Grayskull, your previous Embryo stack is now broken!", fname); + ERR("You are running Embryo->EDC->Embryo with script program '%s';\n" + "A run_program runs the '%d'th program '%s' in the group '%s' of file %s;\n" + "By the power of Grayskull, your previous Embryo stack is now broken!", + fname, (fn + 1), pr->name, ed->group, ed->path); + ret = embryo_program_run(ed->collection->script, fn); if (ret == EMBRYO_PROGRAM_FAIL) { ERR("ERROR with embryo script. " "OBJECT NAME: '%s', " "OBJECT FILE: '%s', " - "ENTRY POINT: '%s', " + "ENTRY POINT: '%s (%s)', " "SIGNAL: '%s', " "SOURCE: '%s', " "ERROR: '%s'", ed->collection->part, ed->file->path, - fname, + fname, pr->name, sig, src, embryo_error_string_get(embryo_program_error_get(ed->collection->script))); } @@ -4496,13 +4502,13 @@ _edje_embryo_test_run(Edje *ed, const char *fname, const char *sig, const char * ERR("ERROR with embryo script. " "OBJECT NAME: '%s', " "OBJECT FILE: '%s', " - "ENTRY POINT: '%s', " + "ENTRY POINT: '%s (%s)', " "SIGNAL: '%s', " "SOURCE: '%s', " "ERROR: 'Script exceeded maximum allowed cycle count of %i'", ed->collection->part, ed->file->path, - fname, + fname, pr->name, sig, src, embryo_program_max_cycle_run_get(ed->collection->script)); } diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 13e7143..494fade 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2433,7 +2433,7 @@ char *_edje_text_unescape(const char *text); void _edje_embryo_script_init (Edje_Part_Collection *edc); void _edje_embryo_script_shutdown (Edje_Part_Collection *edc); void _edje_embryo_script_reset (Edje *ed); -void _edje_embryo_test_run (Edje *ed, const char *fname, const char *sig, const char *src); +void _edje_embryo_test_run (Edje *ed, Edje_Program *pr, const char *sig, const char *src); Edje_Var *_edje_var_new (void); void _edje_var_free (Edje_Var *var); void _edje_var_init (Edje *ed); diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c index b8d6675..944d5ad 100644 --- a/src/lib/edje/edje_program.c +++ b/src/lib/edje/edje_program.c @@ -927,12 +927,9 @@ low_mem_current: case EDJE_ACTION_TYPE_SCRIPT: { - char fname[128]; - // _edje_emit(ed, "program,start", pr->name); if (_edje_block_break(ed)) goto break_prog; - snprintf(fname, sizeof(fname), "_p%i", pr->id); - _edje_embryo_test_run(ed, fname, ssig, ssrc); + _edje_embryo_test_run(ed, pr, ssig, ssrc); // _edje_emit(ed, "program,stop", pr->name); if (_edje_block_break(ed)) goto break_prog; _edje_recalc_do(ed); -- 2.7.4