forked from enlightenment/efl
edje_cc supports -Ddefine=val style stuff - via cpp and like cpp
SVN revision: 12015
This commit is contained in:
parent
3634ee5b91
commit
b6d25d31f4
|
@ -8,6 +8,7 @@ static void main_help(void);
|
|||
|
||||
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 @@ main_help(void)
|
|||
"-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 @@ main(int argc, char **argv)
|
|||
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)
|
||||
|
|
|
@ -150,6 +150,7 @@ extern Edje_File *edje_file;
|
|||
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[];
|
||||
|
||||
|
|
|
@ -552,18 +552,40 @@ compile(void)
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue