From: sachiel Date: Tue, 30 Nov 2010 15:37:20 +0000 (+0000) Subject: Make edje_cc store script source snippets (only embryo now) in the generated file. X-Git-Tag: submit/2.0alpha-wayland/20121127.221958~955 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1be88bc20b23041da49b43fce261c545dcc7c316;p=profile%2Fivi%2Fedje.git Make edje_cc store script source snippets (only embryo now) in the generated file. Yeah... yeah... we are on a freeze and we aren't supposed to be doing things like this, but it's not change anything other than allow edje_edit to know about scripts in order to not screw them up when modifying a file. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@55088 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/edje_cc.h b/src/bin/edje_cc.h index c767958..5245448 100644 --- a/src/bin/edje_cc.h +++ b/src/bin/edje_cc.h @@ -78,6 +78,7 @@ struct _Code { int l1, l2; char *shared; + char *original; Eina_List *programs; int is_lua; }; @@ -87,6 +88,7 @@ struct _Code_Program int l1, l2; int id; char *script; + char *original; }; struct _SrcFile diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index 558b3a7..30f06e9 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -1937,6 +1937,7 @@ ob_collections_group_script(void) exit(-1); } cd->shared = s; + cd->original = strdup(s); cd->is_lua = 0; set_verbatim(NULL, 0, 0); } @@ -7026,6 +7027,7 @@ ob_collections_group_programs_program_script(void) cp->l1 = get_verbatim_line1(); cp->l2 = get_verbatim_line2(); cp->script = s; + cp->original = strdup(s); if (cd->shared && cd->is_lua) { ERR("%s: Error. parse error %s:%i. You're trying to mix Embryo and Lua scripting in the same group", diff --git a/src/bin/edje_cc_out.c b/src/bin/edje_cc_out.c index ecaaa40..bd332dc 100644 --- a/src/bin/edje_cc_out.c +++ b/src/bin/edje_cc_out.c @@ -848,8 +848,11 @@ data_write_scripts(Eet_File *ef) { char tmpn[PATH_MAX]; char tmpo[PATH_MAX]; + char buf[PATH_MAX]; int fd; Code *cd = eina_list_data_get(l); + Eina_List *ll; + Code_Program *cp; if (cd->is_lua) continue; @@ -879,6 +882,20 @@ data_write_scripts(Eet_File *ef) unlink(tmpn); unlink(tmpo); + + if (cd->original) + { + snprintf(buf, PATH_MAX, "edje/scripts/embryo/source/%i", i); + eet_write(ef, buf, cd->original, strlen(cd->original) + 1, 1); + } + EINA_LIST_FOREACH(cd->programs, ll, cp) + { + if (!cp->original) + continue; + snprintf(buf, PATH_MAX, "edje/scripts/embryo/source/%i/%i", i, + cp->id); + eet_write(ef, buf, cp->original, strlen(cp->original) + 1, 1); + } } }