Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/bin


Modified Files:
        edje_cc.c edje_cc.h edje_cc_parse.c 


Log Message:


edje_cc supports -Ddefine=val style stuff - via cpp  and like cpp

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- edje_cc.c   20 Oct 2004 16:48:58 -0000      1.21
+++ edje_cc.c   24 Oct 2004 13:47:55 -0000      1.22
@@ -8,6 +8,7 @@
 
 Evas_List *img_dirs = NULL;
 Evas_List *fnt_dirs = NULL;
+Evas_List *defines = NULL;
 char      *file_in = NULL;
 char      *file_out = NULL;
 char      *progname = NULL;
@@ -42,6 +43,7 @@
       "-scale-lossy VAL         Scale lossy image pixels by this percentage factor (0 
- 100)\n"
       "-scale-comp VAL          Scale lossless compressed image pixels by this 
percentage factor (0 - 100)\n"
       "-scale-raw VAL           Scale uncompressed (raw) image pixels by this 
percentage factor (0 - 100)\n"
+      "-Ddefine_val=to          CPP style define to define input macro definitions to 
the .edc source\n"
       ,progname);
 }
 
@@ -123,6 +125,10 @@
             if (scale_raw < 0) scale_raw = 0;
             if (scale_raw > 100) scale_raw = 100;
          }
+       else if (!strncmp(argv[i], "-D", 2))
+         {
+            defines = evas_list_append(defines, mem_strdup(argv[i]));
+         }
        else if (!file_in)
          file_in = argv[i];
        else if (!file_out)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- edje_cc.h   23 Oct 2004 20:12:20 -0000      1.22
+++ edje_cc.h   24 Oct 2004 13:47:55 -0000      1.23
@@ -150,6 +150,7 @@
 extern Evas_List             *edje_collections;
 extern Evas_List             *fonts;
 extern Evas_List             *codes;
+extern Evas_List             *defines;
 extern New_Object_Handler     object_handlers[];
 extern New_Statement_Handler  statement_handlers[];
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/bin/edje_cc_parse.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -3 -r1.29 -r1.30
--- edje_cc_parse.c     24 Oct 2004 06:43:45 -0000      1.29
+++ edje_cc_parse.c     24 Oct 2004 13:47:55 -0000      1.30
@@ -552,18 +552,40 @@
    if (fd >= 0)
      {
        int ret;
+       char *def;
         
        clean_file = tmpn;
        close(fd);
        atexit(clean_tmp_file);
-       snprintf(buf, sizeof(buf), "cat %s | cpp -E -o %s", file_in, tmpn);
+       if (!defines)
+         def = mem_strdup("");
+       else
+         {
+            Evas_List *l;
+            int len;
+            
+            len = 0;
+            for (l = defines; l; l = l->next)
+              {
+                 len += strlen(l->data) + 1;
+              }
+            def = mem_alloc(len + 1);
+            def[0] = 0;
+            for (l = defines; l; l = l->next)
+              {
+                 strcat(def, l->data);
+                 strcat(def, " ");
+              }
+         }
+       snprintf(buf, sizeof(buf), "cat %s | cpp %s -E -o %s", file_in, def, tmpn);
        ret = system(buf);
        if (ret < 0)
          {
-            snprintf(buf, sizeof(buf), "gcc -E -o %s %s", tmpn, file_in);
+            snprintf(buf, sizeof(buf), "gcc %s -E -o %s %s", def, tmpn, file_in);
             ret = system(buf);
          }
        if (ret >= 0) file_in = tmpn;
+       free(def);
      }
    fd = open(file_in, O_RDONLY);
    if (fd < 0)




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to