Make edje_cc store script source snippets (only embryo now) in the generated file.
authorsachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 30 Nov 2010 15:37:20 +0000 (15:37 +0000)
committersachiel <sachiel@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 30 Nov 2010 15:37:20 +0000 (15:37 +0000)
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

src/bin/edje_cc.h
src/bin/edje_cc_handlers.c
src/bin/edje_cc_out.c

index c767958..5245448 100644 (file)
@@ -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
index 558b3a7..30f06e9 100644 (file)
@@ -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",
index ecaaa40..bd332dc 100644 (file)
@@ -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);
+          }
      }
 }