2012-08-30 Cedric Bail
* Check the number of parameter for image in edc.
+
+2012-09-04 Cedric Bail
+
+ * Report type of file when listing file used by an edc.
-------------------------
Additions:
+ * Report type of file when listing file used by an edc.
Improvements:
* Check the number of parameter for image in edc.
int max_quality = 100;
int compress_mode = EET_COMPRESSION_DEFAULT;
int threads = 0;
+int anotate = 0;
static void
_edje_cc_log_cb(const Eina_Log_Domain *d,
"Where OPTIONS is one or more of:\n"
"\n"
"-w files.txt Dump all sources files path into files.txt\n"
+ "-anotate Anotate the dumped files.\n"
"-id image/directory Add a directory to look in for relative path images\n"
"-fd font/directory Add a directory to look in for relative path fonts\n"
"-sd sound/directory Add a directory to look in for relative path sounds samples\n"
watchfile = argv[i];
unlink(watchfile);
}
+ else if (!strcmp(argv[i], "-anotate"))
+ {
+ anotate = 1;
+ }
else if (!file_in)
file_in = argv[i];
else if (!file_out)
exit(-1);
}
- using_file(file_in);
+ using_file(file_in, 'E');
+ if (anotate) using_file(file_out, 'O');
if (!edje_init())
exit(-1);
char *mem_strdup(const char *s);
#define SZ sizeof
-void using_file(const char *filename);
+void using_file(const char *filename, const char type);
void error_and_abort(Eet_File *ef, const char *fmt, ...);
extern New_Statement_Handler statement_handlers[];
extern int compress_mode;
extern int threads;
+extern int anotate;
#endif
f = eina_file_open(fc->fn->file, 0);
if (f)
{
- using_file(fc->fn->file);
+ using_file(fc->fn->file, 'F');
m = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
}
else
f = eina_file_open(buf, 0);
if (f)
{
- using_file(buf);
+ using_file(buf, 'F');
m = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
if (m) break;
eina_file_close(f);
pending_threads++;
if (threads)
evas_object_image_preload(im, 0);
- using_file(buf);
+ using_file(buf, 'I');
if (!threads)
data_image_preload_done(iw, evas, im, NULL);
break;
pending_threads++;
if (threads)
evas_object_image_preload(im, 0);
- using_file(img->entry);
+ using_file(img->entry, 'I');
if (!threads)
data_image_preload_done(iw, evas, im, NULL);
}
enc_info = _edje_multisense_encode(snd_path, sw->sample,
sw->sample->quality);
f = eina_file_open(enc_info->file, 0);
- if (f) using_file(enc_info->file);
+ if (f) using_file(enc_info->file, 'S');
#else
- if (f) using_file(snd_path);
+ if (f) using_file(snd_path, 'S');
#endif
if (!f)
{
}
void
-using_file(const char *filename)
+using_file(const char *filename, const char type)
{
FILE *f;
if (!watchfile) return;
f = fopen(watchfile, "ab");
if (!f) return ;
- fputs(filename, f);
- fputc('\n', f);
+ if (anotate)
+ {
+ fprintf(f, "%c: %s\n", type, filename);
+ }
+ else
+ {
+ fputs(filename, f);
+ fputc('\n', f);
+ }
fclose(f);
}
eina_prefix_lib_get(pfx));
if (ecore_file_exists(buf2))
{
- snprintf(buf, sizeof(buf), "%s -a %s %s -I%s %s -o %s",
- buf2, watchfile ? watchfile : "/dev/null", file_in, inc, def, tmpn);
+ if (anotate)
+ snprintf(buf, sizeof(buf), "%s -anotate -a %s %s -I%s %s -o %s",
+ buf2, watchfile ? watchfile : "/dev/null", file_in, inc, def, tmpn);
+ else
+ snprintf(buf, sizeof(buf), "%s -a %s %s -I%s %s -o %s",
+ buf2, watchfile ? watchfile : "/dev/null", file_in, inc, def, tmpn);
ret = system(buf);
}
else
{
const char *path;
- path = eina_stringshare_add_length(ln->start, ln->length);
- r = eina_list_append(r, eio_monitor_add(path));
+ if (ln->length < 4) continue ;
+ path = eina_stringshare_add_length(ln->start + 3, ln->length);
+ fprintf(stderr, "%c: %s\n", *ln->start, path);
+ if (*ln->start != 'O')
+ r = eina_list_append(r, eio_monitor_add(path));
eina_stringshare_del(path);
}
eina_iterator_free(it);
double start, end;
start = ecore_time_get();
- fprintf(stderr, "SYSTEM('%s')\n", edje_cc_command);
+ fprintf(stderr, "* SYSTEM('%s')\n", edje_cc_command);
if (system(edje_cc_command) == 0)
read_watch_file(watchfile);
end = ecore_time_get();
- fprintf(stderr, "DONE IN %f\n", end - start);
+ fprintf(stderr, "* DONE IN %f\n", end - start);
timeout = NULL;
return EINA_FALSE;
Eina_Bool
some_change(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
- Eio_Monitor_Event *ev = event;
-
- fprintf(stderr, "EVENT %i on [%s]\n", type, ev->filename);
if (timeout) ecore_timer_del(timeout);
timeout = ecore_timer_add(0.5, rebuild, NULL);
eio_init();
if (argc < 2) return -1;
-
+
ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, some_change, NULL);
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, some_change, NULL);
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, some_change, NULL);
buf = eina_strbuf_new();
if (!buf) return -1;
- eina_strbuf_append_printf(buf, "%s/edje_cc -threads -fastcomp -w %s ", PACKAGE_BIN_DIR, watchfile);
+ eina_strbuf_append_printf(buf, "%s/edje_cc -anotate -threads -fastcomp -w %s ", PACKAGE_BIN_DIR, watchfile);
for (i = 1; i < argc; ++i)
eina_strbuf_append_printf(buf, "%s ", argv[i]);
/* table to tell if c is horizontal or vertical space. */
static unsigned char is_space[256];
+static int anotate = 0;
+
/* Initialize syntactic classifications of characters. */
static void
&& !strncmp(searchptr->fname, filename, p - filename))
{
/* FILENAME is in SEARCHPTR, which we've already checked. */
- using_file(filename);
+ using_file(filename, 'E');
return open(filename, O_RDONLY | O_BINARY, 0666);
}
if (p == filename)
for (map = read_name_map(pfile, dir); map; map = map->map_next)
if (!strcmp(map->map_from, from))
{
- using_file(map->map_to);
+ using_file(map->map_to, 'E');
return open(map->map_to, O_RDONLY | O_BINARY, 0666);
}
- using_file(filename);
+ using_file(filename, 'E');
return open(filename, O_RDONLY | O_BINARY, 0666);
}
open_include_file(cpp_reader * pfile __UNUSED__, char *filename,
file_name_list * searchptr __UNUSED__)
{
- using_file(filename);
+ using_file(filename, 'E');
return open(filename, O_RDONLY | O_BINARY, 0666);
}
opts->watchfile = argv[i];
}
}
+ else if (!strcmp(argv[i], "-anotate"))
+ {
+ anotate = 1;
+ }
break;
}
extern cpp_options options;
void
-using_file(const char *filename)
+using_file(const char *filename, const char type)
{
FILE *f;
f = fopen(options.watchfile, "a");
if (!f) return ;
- fputs(filename, f);
- fputc('\n', f);
+ if (anotate)
+ {
+ fprintf(f, "%c: %s\n", type, filename);
+ }
+ else
+ {
+ fputs(filename, f);
+ fputc('\n', f);
+ }
fclose(f);
}
void *xrealloc(void *old, unsigned size);
void *xcalloc(unsigned number, unsigned size);
-void using_file(const char *filename);
+void using_file(const char *filename, const char type);
#ifdef __EMX__
#define PATH_SEPARATOR ';'