summaryrefslogtreecommitdiff
path: root/legacy/edje
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-05-08 10:35:57 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-05-08 10:35:57 +0000
commitdd9c491c5beea4975877d50c00dcd78d3dc37798 (patch)
tree32d87a403e9958f5462f8bf5d39ffa7f9f686bb4 /legacy/edje
parentf0a9acefa0c333651c959eefd980d227a56c475b (diff)
edje: add edje_watch.
edje_watch call edje_cc and monitor all the source file (edc, font image, sound). If any of them change, it call edje_cc, update its watching list and so on. edje_watch as the same command line as edje_cc. Still a little bit rought, but it's the beginning of an interesting experiment. SVN revision: 70872
Diffstat (limited to 'legacy/edje')
-rw-r--r--legacy/edje/ChangeLog4
-rw-r--r--legacy/edje/NEWS3
-rw-r--r--legacy/edje/configure.ac17
-rw-r--r--legacy/edje/src/bin/Makefile.am24
-rw-r--r--legacy/edje/src/bin/edje_cc.c8
-rw-r--r--legacy/edje/src/bin/edje_cc.h3
-rw-r--r--legacy/edje/src/bin/edje_cc_out.c22
-rw-r--r--legacy/edje/src/bin/edje_cc_parse.c4
-rw-r--r--legacy/edje/src/bin/edje_watch.c127
-rw-r--r--legacy/edje/src/bin/epp/cpplib.c36
-rw-r--r--legacy/edje/src/bin/epp/cpplib.h5
11 files changed, 242 insertions, 11 deletions
diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog
index 2d9cb5f6bd..ed36acc0c2 100644
--- a/legacy/edje/ChangeLog
+++ b/legacy/edje/ChangeLog
@@ -423,3 +423,7 @@
4232012-05-02 Cedric Bail 4232012-05-02 Cedric Bail
424 424
425 * Doing less allocation and reuse Evas_Map does help. 425 * Doing less allocation and reuse Evas_Map does help.
426
4272012-05-08 Cedric Bail
428
429 * Add edje_watch tools to automatically rebuild edc.
diff --git a/legacy/edje/NEWS b/legacy/edje/NEWS
index 88c69a631e..87c57ba2e4 100644
--- a/legacy/edje/NEWS
+++ b/legacy/edje/NEWS
@@ -3,6 +3,9 @@ Edje 1.3.0
3Changes since Edje 1.2.0: 3Changes since Edje 1.2.0:
4------------------------- 4-------------------------
5 5
6Additions:
7 * Add edje_watch to monitore change on edje source.
8
6Improvements: 9Improvements:
7 * Allocate once and reuse Evas_Map. 10 * Allocate once and reuse Evas_Map.
8 11
diff --git a/legacy/edje/configure.ac b/legacy/edje/configure.ac
index 5198f36dc9..c173bb082a 100644
--- a/legacy/edje/configure.ac
+++ b/legacy/edje/configure.ac
@@ -104,6 +104,7 @@ EFL_ENABLE_BIN([edje-recc])
104EFL_ENABLE_BIN([edje-player]) 104EFL_ENABLE_BIN([edje-player])
105EFL_ENABLE_BIN([edje-inspector]) 105EFL_ENABLE_BIN([edje-inspector])
106EFL_ENABLE_BIN([edje-external-inspector]) 106EFL_ENABLE_BIN([edje-external-inspector])
107EFL_ENABLE_BIN([edje-watch])
107 108
108# Optional EDJE_PROGRAM_CACHE (use much more ram, but increase speed in some cases) 109# Optional EDJE_PROGRAM_CACHE (use much more ram, but increase speed in some cases)
109want_edje_program_cache="no" 110want_edje_program_cache="no"
@@ -292,6 +293,18 @@ PKG_CHECK_MODULES([ECORE_IMF],
292 ], 293 ],
293 [have_ecore_imf="no"]) 294 [have_ecore_imf="no"])
294 295
296have_eio="no"
297PKG_CHECK_MODULES([EIO],
298 [
299 eio >= 1.0.0
300 ],
301 [
302 AC_DEFINE([HAVE_EIO], [1], [Eio is available for monitoring file assynchronously])
303 have_eio="yes"
304 requirement_edje="eio >= 1.0.0 ${requirement_edje}"
305 ],
306 [have_eio="no"])
307
295# Enable Multisense use 308# Enable Multisense use
296want_multisense="yes" 309want_multisense="yes"
297AC_ARG_ENABLE([multisense], 310AC_ARG_ENABLE([multisense],
@@ -467,6 +480,9 @@ if test "x$have_edje_external_inspector" = "xyes"; then
467 PKG_CHECK_MODULES([EDJE_EXTERNAL_INSPECTOR], [ecore >= 1.2.0 evas >= 1.2.0 eina >= 1.2.0]) 480 PKG_CHECK_MODULES([EDJE_EXTERNAL_INSPECTOR], [ecore >= 1.2.0 evas >= 1.2.0 eina >= 1.2.0])
468fi 481fi
469 482
483if test "x$have_edje_watch" = "xyes"; then
484 PKG_CHECK_MODULES([EDJE_WATCH], [ecore >= 1.2.0 eina >= 1.2.0 eio >= 1.0.0])
485fi
470 486
471### Checks for header files 487### Checks for header files
472AC_CHECK_HEADERS([locale.h sys/resource.h]) 488AC_CHECK_HEADERS([locale.h sys/resource.h])
@@ -614,6 +630,7 @@ echo " Build edje_recc..............: $have_edje_recc"
614echo " Build edje_player............: $have_edje_player" 630echo " Build edje_player............: $have_edje_player"
615echo " Build edje_inspector.........: $have_edje_inspector" 631echo " Build edje_inspector.........: $have_edje_inspector"
616echo " Build edje_external_inspector: $have_edje_external_inspector" 632echo " Build edje_external_inspector: $have_edje_external_inspector"
633echo " Build edje_watch.............: $have_edje_watch"
617echo 634echo
618echo "Compilation............: make (or gmake)" 635echo "Compilation............: make (or gmake)"
619echo " CPPFLAGS.............: $CPPFLAGS" 636echo " CPPFLAGS.............: $CPPFLAGS"
diff --git a/legacy/edje/src/bin/Makefile.am b/legacy/edje/src/bin/Makefile.am
index a936d5a82c..85458b3f63 100644
--- a/legacy/edje/src/bin/Makefile.am
+++ b/legacy/edje/src/bin/Makefile.am
@@ -6,9 +6,9 @@ endif
6 6
7bin_SCRIPTS = @EDJE_RECC_PRG@ 7bin_SCRIPTS = @EDJE_RECC_PRG@
8 8
9bin_PROGRAMS = @EDJE_CC_PRG@ @EDJE_DECC_PRG@ @EDJE_PLAYER_PRG@ @EDJE_INSPECTOR_PRG@ @EDJE_EXTERNAL_INSPECTOR_PRG@ 9bin_PROGRAMS = @EDJE_CC_PRG@ @EDJE_DECC_PRG@ @EDJE_PLAYER_PRG@ @EDJE_INSPECTOR_PRG@ @EDJE_EXTERNAL_INSPECTOR_PRG@ @EDJE_WATCH_PRG@
10 10
11EXTRA_PROGRAMS = edje_cc edje_decc edje_player edje_inspector edje_external_inspector 11EXTRA_PROGRAMS = edje_cc edje_decc edje_player edje_inspector edje_external_inspector edje_watch
12 12
13edje_cc_SOURCES = \ 13edje_cc_SOURCES = \
14edje_cc.c \ 14edje_cc.c \
@@ -26,10 +26,20 @@ edje_cc_CPPFLAGS = \
26-DPACKAGE_LIB_DIR=\"$(libdir)\" \ 26-DPACKAGE_LIB_DIR=\"$(libdir)\" \
27-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ 27-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
28-DEPP_DIR=\"$(libdir)/$(PACKAGE)/utils\" \ 28-DEPP_DIR=\"$(libdir)/$(PACKAGE)/utils\" \
29@EDJE_CFLAGS@ @EDJE_CC_CFLAGS@ @EVIL_CFLAGS@ @SNDFILE_CFLAGS@ 29@EDJE_CFLAGS@ @EDJE_CC_CFLAGS@ @EIO_CFLAGS@ @EVIL_CFLAGS@ @SNDFILE_CFLAGS@
30edje_cc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_CC_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ -lm 30edje_cc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_CC_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ -lm
31edje_cc_LDFLAGS = @lt_enable_auto_import@ 31edje_cc_LDFLAGS = @lt_enable_auto_import@
32 32
33edje_watch_SOURCES = \
34edje_watch.c
35
36edje_watch_CPPFLAGS = \
37-I$(top_srcdir)/src/bin \
38-I$(top_srcdir)/src/lib \
39-DPACKAGE_BIN_DIR=\"$(bindir)\" \
40@EDJE_CFLAGS@ @EDJE_CC_CFLAGS@ @EIO_CFLAGS@ @EVIL_CFLAGS@ @EDJE_WATCH_CFLAGS@
41edje_watch_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_WATCH_LIBS@
42edje_watch_LDFLAGS = @lt_enable_auto_import@
33 43
34edje_decc_SOURCES = \ 44edje_decc_SOURCES = \
35edje_decc.c \ 45edje_decc.c \
@@ -40,7 +50,7 @@ edje_cc_sources.c
40edje_decc_CPPFLAGS = \ 50edje_decc_CPPFLAGS = \
41-I$(top_srcdir)/src/bin \ 51-I$(top_srcdir)/src/bin \
42-I$(top_srcdir)/src/lib \ 52-I$(top_srcdir)/src/lib \
43@EDJE_CFLAGS@ @EDJE_DECC_CFLAGS@ @EVIL_CFLAGS@ 53@EDJE_CFLAGS@ @EDJE_DECC_CFLAGS@ @EIO_CFLAGS@ @EVIL_CFLAGS@
44edje_decc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_DECC_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ 54edje_decc_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_DECC_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
45edje_decc_LDFLAGS = @lt_enable_auto_import@ 55edje_decc_LDFLAGS = @lt_enable_auto_import@
46 56
@@ -48,7 +58,7 @@ edje_player_SOURCES = edje_player.c
48edje_player_CPPFLAGS = \ 58edje_player_CPPFLAGS = \
49-I$(top_srcdir)/src/bin \ 59-I$(top_srcdir)/src/bin \
50-I$(top_srcdir)/src/lib \ 60-I$(top_srcdir)/src/lib \
51@EDJE_PLAYER_CFLAGS@ @EVIL_CFLAGS@ 61@EDJE_PLAYER_CFLAGS@ @EVIL_CFLAGS@ @EIO_CFLAGS@
52edje_player_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_PLAYER_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ 62edje_player_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_PLAYER_LIBS@ @EVIL_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
53edje_player_LDFLAGS = @lt_enable_auto_import@ 63edje_player_LDFLAGS = @lt_enable_auto_import@
54 64
@@ -56,7 +66,7 @@ edje_inspector_SOURCES = edje_inspector.c
56edje_inspector_CPPFLAGS = \ 66edje_inspector_CPPFLAGS = \
57-I$(top_srcdir)/src/bin \ 67-I$(top_srcdir)/src/bin \
58-I$(top_srcdir)/src/lib \ 68-I$(top_srcdir)/src/lib \
59@EDJE_INSPECTOR_CFLAGS@ 69@EDJE_INSPECTOR_CFLAGS@ @EIO_CFLAGS@
60edje_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ 70edje_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@
61edje_inspector_LDFLAGS = @lt_enable_auto_import@ 71edje_inspector_LDFLAGS = @lt_enable_auto_import@
62 72
@@ -64,7 +74,7 @@ edje_external_inspector_SOURCES = edje_external_inspector.c
64edje_external_inspector_CPPFLAGS = \ 74edje_external_inspector_CPPFLAGS = \
65-I$(top_srcdir)/src/bin \ 75-I$(top_srcdir)/src/bin \
66-I$(top_srcdir)/src/lib \ 76-I$(top_srcdir)/src/lib \
67@EDJE_EXTERNAL_INSPECTOR_CFLAGS@ 77@EDJE_EXTERNAL_INSPECTOR_CFLAGS@ @EIO_CFLAGS@
68edje_external_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_EXTERNAL_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@ 78edje_external_inspector_LDADD = $(top_builddir)/src/lib/libedje.la @EDJE_EXTERNAL_INSPECTOR_LIBS@ @VORBISENC_LIBS@ @FLAC_LIBS@ @SNDFILE_LIBS@
69edje_external_inspector_LDFLAGS = @lt_enable_auto_import@ 79edje_external_inspector_LDFLAGS = @lt_enable_auto_import@
70 80
diff --git a/legacy/edje/src/bin/edje_cc.c b/legacy/edje/src/bin/edje_cc.c
index b564fe5f5d..ff2708cb4c 100644
--- a/legacy/edje/src/bin/edje_cc.c
+++ b/legacy/edje/src/bin/edje_cc.c
@@ -20,6 +20,7 @@ char *file_in = NULL;
20char *tmp_dir = NULL; 20char *tmp_dir = NULL;
21char *file_out = NULL; 21char *file_out = NULL;
22char *progname = NULL; 22char *progname = NULL;
23char *watchfile = NULL;
23int verbose = 0; 24int verbose = 0;
24 25
25int no_lossy = 0; 26int no_lossy = 0;
@@ -38,6 +39,7 @@ main_help(void)
38 "\n" 39 "\n"
39 "Where OPTIONS is one or more of:\n" 40 "Where OPTIONS is one or more of:\n"
40 "\n" 41 "\n"
42 "-w files.txt Dump all sources files path into files.txt\n"
41 "-id image/directory Add a directory to look in for relative path images\n" 43 "-id image/directory Add a directory to look in for relative path images\n"
42 "-fd font/directory Add a directory to look in for relative path fonts\n" 44 "-fd font/directory Add a directory to look in for relative path fonts\n"
43 "-sd sound/directory Add a directory to look in for relative path sounds samples\n" 45 "-sd sound/directory Add a directory to look in for relative path sounds samples\n"
@@ -151,6 +153,12 @@ main(int argc, char **argv)
151 i++; 153 i++;
152 file_out = argv[i]; 154 file_out = argv[i];
153 } 155 }
156 else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1)))
157 {
158 i++;
159 watchfile = argv[i];
160 unlink(watchfile);
161 }
154 else if (!file_in) 162 else if (!file_in)
155 file_in = argv[i]; 163 file_in = argv[i];
156 else if (!file_out) 164 else if (!file_out)
diff --git a/legacy/edje/src/bin/edje_cc.h b/legacy/edje/src/bin/edje_cc.h
index 0291f29ea3..56b5449286 100644
--- a/legacy/edje/src/bin/edje_cc.h
+++ b/legacy/edje/src/bin/edje_cc.h
@@ -194,6 +194,8 @@ void *mem_alloc(size_t size);
194char *mem_strdup(const char *s); 194char *mem_strdup(const char *s);
195#define SZ sizeof 195#define SZ sizeof
196 196
197void using_file(const char *filename);
198
197void error_and_abort(Eet_File *ef, const char *fmt, ...); 199void error_and_abort(Eet_File *ef, const char *fmt, ...);
198 200
199/* global vars */ 201/* global vars */
@@ -205,6 +207,7 @@ extern char *file_in;
205extern char *tmp_dir; 207extern char *tmp_dir;
206extern char *file_out; 208extern char *file_out;
207extern char *progname; 209extern char *progname;
210extern char *watchfile;
208extern int verbose; 211extern int verbose;
209extern int no_lossy; 212extern int no_lossy;
210extern int no_comp; 213extern int no_comp;
diff --git a/legacy/edje/src/bin/edje_cc_out.c b/legacy/edje/src/bin/edje_cc_out.c
index d195d78f78..f3b4358e32 100644
--- a/legacy/edje/src/bin/edje_cc_out.c
+++ b/legacy/edje/src/bin/edje_cc_out.c
@@ -323,6 +323,7 @@ data_write_fonts(Eet_File *ef, int *font_num, int *input_bytes, int *input_raw_b
323 { 323 {
324 long pos; 324 long pos;
325 325
326 using_file(fn->file);
326 fseek(f, 0, SEEK_END); 327 fseek(f, 0, SEEK_END);
327 pos = ftell(f); 328 pos = ftell(f);
328 rewind(f); 329 rewind(f);
@@ -350,6 +351,7 @@ data_write_fonts(Eet_File *ef, int *font_num, int *input_bytes, int *input_raw_b
350 { 351 {
351 long pos; 352 long pos;
352 353
354 using_file(buf);
353 fseek(f, 0, SEEK_END); 355 fseek(f, 0, SEEK_END);
354 pos = ftell(f); 356 pos = ftell(f);
355 rewind(f); 357 rewind(f);
@@ -533,7 +535,10 @@ data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw
533 evas_object_image_file_set(im, buf, NULL); 535 evas_object_image_file_set(im, buf, NULL);
534 load_err = evas_object_image_load_error_get(im); 536 load_err = evas_object_image_load_error_get(im);
535 if (load_err == EVAS_LOAD_ERROR_NONE) 537 if (load_err == EVAS_LOAD_ERROR_NONE)
536 break; 538 {
539 using_file(buf);
540 break;
541 }
537 evas_object_del(im); 542 evas_object_del(im);
538 im = NULL; 543 im = NULL;
539 if (load_err != EVAS_LOAD_ERROR_DOES_NOT_EXIST) 544 if (load_err != EVAS_LOAD_ERROR_DOES_NOT_EXIST)
@@ -552,6 +557,7 @@ data_write_images(Eet_File *ef, int *image_num, int *input_bytes, int *input_raw
552 evas_object_del(im); 557 evas_object_del(im);
553 im = NULL; 558 im = NULL;
554 } 559 }
560 if (im) using_file(img->entry);
555 } 561 }
556 } 562 }
557 if (im) 563 if (im)
@@ -716,8 +722,10 @@ data_write_sounds(Eet_File * ef, int *sound_num, int *input_bytes, int *input_ra
716 stat(enc_info->file, &st); 722 stat(enc_info->file, &st);
717 size = st.st_size; 723 size = st.st_size;
718 fp = fopen(enc_info->file, "rb"); 724 fp = fopen(enc_info->file, "rb");
725 if (fp) using_file(enc_info->file);
719#else 726#else
720 fp = fopen(snd_path, "rb"); 727 fp = fopen(snd_path, "rb");
728 if (fp) using_file(snd_path);
721#endif 729#endif
722 if (!fp) 730 if (!fp)
723 { 731 {
@@ -2167,3 +2175,15 @@ data_process_script_lookups(void)
2167 strncpy(cl->ptr, buf, n); 2175 strncpy(cl->ptr, buf, n);
2168 } 2176 }
2169} 2177}
2178
2179void
2180using_file(const char *filename)
2181{
2182 FILE *f;
2183
2184 f = fopen(watchfile, "a");
2185 if (!f) return ;
2186 fputs(filename, f);
2187 fputc('\n', f);
2188 fclose(f);
2189}
diff --git a/legacy/edje/src/bin/edje_cc_parse.c b/legacy/edje/src/bin/edje_cc_parse.c
index adc08d3ed5..816197730e 100644
--- a/legacy/edje/src/bin/edje_cc_parse.c
+++ b/legacy/edje/src/bin/edje_cc_parse.c
@@ -739,8 +739,8 @@ compile(void)
739 eina_prefix_lib_get(pfx)); 739 eina_prefix_lib_get(pfx));
740 if (ecore_file_exists(buf2)) 740 if (ecore_file_exists(buf2))
741 { 741 {
742 snprintf(buf, sizeof(buf), "%s %s -I%s %s -o %s", 742 snprintf(buf, sizeof(buf), "%s -a %s %s -I%s %s -o %s",
743 buf2, file_in, inc, def, tmpn); 743 buf2, watchfile ? watchfile : "/dev/null", file_in, inc, def, tmpn);
744 ret = system(buf); 744 ret = system(buf);
745 } 745 }
746 else 746 else
diff --git a/legacy/edje/src/bin/edje_watch.c b/legacy/edje/src/bin/edje_watch.c
new file mode 100644
index 0000000000..f85029145e
--- /dev/null
+++ b/legacy/edje/src/bin/edje_watch.c
@@ -0,0 +1,127 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <Eina.h>
6#include <Ecore.h>
7#include <Eio.h>
8#ifdef HAVE_EVIL
9# include <Evil.h>
10#endif
11
12char watchfile[PATH_MAX];
13char *edje_cc_command = NULL;
14Eina_List *watching = NULL;
15Ecore_Timer *timeout = NULL;
16
17static void
18read_watch_file(const char *file)
19{
20 Eina_File *f;
21 Eina_Iterator *it;
22 Eina_File_Lines *ln;
23 Eio_Monitor *mon;
24 Eina_List *r = NULL;
25
26 f = eina_file_open(file, EINA_FALSE);
27 if (!f) return ;
28
29 it = eina_file_map_lines(f);
30 if (!it) goto err;
31
32 EINA_ITERATOR_FOREACH(it, ln)
33 {
34 const char *path;
35
36 path = eina_stringshare_add_length(ln->line.start, ln->length);
37 r = eina_list_append(r, eio_monitor_add(path));
38 eina_stringshare_del(path);
39 }
40 eina_iterator_free(it);
41
42 EINA_LIST_FREE(watching, mon)
43 eio_monitor_del(mon);
44 watching = r;
45
46 err:
47 eina_file_close(f);
48}
49
50Eina_Bool
51rebuild(void *data __UNUSED__)
52{
53 fprintf(stderr, "SYSTEM('%s')\n", edje_cc_command);
54 if (system(edje_cc_command) == 0)
55 read_watch_file(watchfile);
56 fprintf(stderr, "DONE\n");
57
58 timeout = NULL;
59 return EINA_FALSE;
60}
61
62Eina_Bool
63some_change(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
64{
65 Eio_Monitor_Event *ev = event;
66
67 fprintf(stderr, "EVENT %i on [%s]\n", type, ev->filename);
68 if (timeout) ecore_timer_del(timeout);
69 timeout = ecore_timer_add(0.5, rebuild, NULL);
70
71 return ECORE_CALLBACK_PASS_ON;
72}
73
74int
75main(int argc, char **argv)
76{
77 char *watchout;
78 Eina_Strbuf *buf;
79 int tfd;
80 int i;
81
82 eina_init();
83 ecore_init();
84 eio_init();
85
86 if (argc < 2) return -1;
87
88 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, some_change, NULL);
89 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, some_change, NULL);
90 ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, some_change, NULL);
91 ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, some_change, NULL);
92
93#ifdef HAVE_EVIL
94 watchout = (char *)evil_tmpdir_get();
95#else
96 watchout = "/tmp";
97#endif
98
99 snprintf(watchfile, PATH_MAX, "%s/edje_watch-tmp-XXXXXX", watchout);
100
101 tfd = mkstemp(watchfile);
102 if (tfd < 0) return -1;
103 close(tfd);
104
105 buf = eina_strbuf_new();
106 if (!buf) return -1;
107
108 eina_strbuf_append_printf(buf, "%s/edje_cc -w %s ", PACKAGE_BIN_DIR, watchfile);
109 for (i = 1; i < argc; ++i)
110 eina_strbuf_append_printf(buf, "%s ", argv[i]);
111
112 edje_cc_command = eina_strbuf_string_steal(buf);
113
114 eina_strbuf_free(buf);
115
116 fprintf(stderr, "SYSTEM('%s')\n", edje_cc_command);
117 system(edje_cc_command);
118 read_watch_file(watchfile);
119
120 ecore_main_loop_begin();
121
122 eio_shutdown();
123 ecore_shutdown();
124 eina_shutdown();
125
126 return 1;
127}
diff --git a/legacy/edje/src/bin/epp/cpplib.c b/legacy/edje/src/bin/epp/cpplib.c
index 132d2a9ca8..30c7f0182a 100644
--- a/legacy/edje/src/bin/epp/cpplib.c
+++ b/legacy/edje/src/bin/epp/cpplib.c
@@ -5489,6 +5489,7 @@ open_include_file(cpp_reader * pfile, char *filename,
5489 && !strncmp(searchptr->fname, filename, p - filename)) 5489 && !strncmp(searchptr->fname, filename, p - filename))
5490 { 5490 {
5491 /* FILENAME is in SEARCHPTR, which we've already checked. */ 5491 /* FILENAME is in SEARCHPTR, which we've already checked. */
5492 using_file(filename);
5492 return open(filename, O_RDONLY | O_BINARY, 0666); 5493 return open(filename, O_RDONLY | O_BINARY, 0666);
5493 } 5494 }
5494 if (p == filename) 5495 if (p == filename)
@@ -5508,8 +5509,12 @@ open_include_file(cpp_reader * pfile, char *filename,
5508 } 5509 }
5509 for (map = read_name_map(pfile, dir); map; map = map->map_next) 5510 for (map = read_name_map(pfile, dir); map; map = map->map_next)
5510 if (!strcmp(map->map_from, from)) 5511 if (!strcmp(map->map_from, from))
5511 return open(map->map_to, O_RDONLY | O_BINARY, 0666); 5512 {
5513 using_file(map->map_to);
5514 return open(map->map_to, O_RDONLY | O_BINARY, 0666);
5515 }
5512 5516
5517 using_file(filename);
5513 return open(filename, O_RDONLY | O_BINARY, 0666); 5518 return open(filename, O_RDONLY | O_BINARY, 0666);
5514} 5519}
5515 5520
@@ -5519,6 +5524,7 @@ static int
5519open_include_file(cpp_reader * pfile __UNUSED__, char *filename, 5524open_include_file(cpp_reader * pfile __UNUSED__, char *filename,
5520 file_name_list * searchptr __UNUSED__) 5525 file_name_list * searchptr __UNUSED__)
5521{ 5526{
5527 using_file(filename);
5522 return open(filename, O_RDONLY | O_BINARY, 0666); 5528 return open(filename, O_RDONLY | O_BINARY, 0666);
5523} 5529}
5524 5530
@@ -6561,6 +6567,20 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
6561 i++, push_pending(pfile, "-D", argv[i]); 6567 i++, push_pending(pfile, "-D", argv[i]);
6562 break; 6568 break;
6563 6569
6570 case 'a':
6571 {
6572 if (!strcmp(argv[i], "-a"))
6573 {
6574 if (i + 1 == argc)
6575 cpp_fatal("Filename missing after `-a` option");
6576 else if (strcmp(argv[++i], "/dev/null"))
6577 {
6578 opts->watchfile = argv[i];
6579 }
6580 }
6581 break;
6582 }
6583
6564 case 'A': 6584 case 'A':
6565 { 6585 {
6566 char *p = NULL; 6586 char *p = NULL;
@@ -7425,3 +7445,17 @@ cpp_perror_with_name(cpp_reader * pfile, const char *name)
7425 * 7445 *
7426 * Support for_lint flag. 7446 * Support for_lint flag.
7427 */ 7447 */
7448
7449extern cpp_options options;
7450
7451void
7452using_file(const char *filename)
7453{
7454 FILE *f;
7455
7456 f = fopen(options.watchfile, "a");
7457 if (!f) return ;
7458 fputs(filename, f);
7459 fputc('\n', f);
7460 fclose(f);
7461}
diff --git a/legacy/edje/src/bin/epp/cpplib.h b/legacy/edje/src/bin/epp/cpplib.h
index 5653dd2f56..a34a7652bb 100644
--- a/legacy/edje/src/bin/epp/cpplib.h
+++ b/legacy/edje/src/bin/epp/cpplib.h
@@ -473,6 +473,9 @@ struct cpp_options {
473 473
474 /* Target-name to write with the dependency information. */ 474 /* Target-name to write with the dependency information. */
475 char *deps_target; 475 char *deps_target;
476
477 /* Target file to write all include file */
478 const char *watchfile;
476}; 479};
477 480
478#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional) 481#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional)
@@ -636,6 +639,8 @@ void *xmalloc(unsigned size);
636void *xrealloc(void *old, unsigned size); 639void *xrealloc(void *old, unsigned size);
637void *xcalloc(unsigned number, unsigned size); 640void *xcalloc(unsigned number, unsigned size);
638 641
642void using_file(const char *filename);
643
639#ifdef __EMX__ 644#ifdef __EMX__
640#define PATH_SEPARATOR ';' 645#define PATH_SEPARATOR ';'
641#endif 646#endif