edje: report type of file when listing files used by an edc.
SVN revision: 76095
This commit is contained in:
parent
509a28a47c
commit
8ad4e0c02e
|
@ -581,3 +581,7 @@
|
|||
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.
|
||||
|
|
|
@ -4,6 +4,7 @@ Changes since Edje 1.8.0:
|
|||
-------------------------
|
||||
|
||||
Additions:
|
||||
* Report type of file when listing file used by an edc.
|
||||
|
||||
Improvements:
|
||||
* Check the number of parameter for image in edc.
|
||||
|
|
|
@ -31,6 +31,7 @@ int min_quality = 0;
|
|||
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,
|
||||
|
@ -82,6 +83,7 @@ main_help(void)
|
|||
"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"
|
||||
|
@ -226,6 +228,10 @@ main(int argc, char **argv)
|
|||
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)
|
||||
|
@ -296,7 +302,8 @@ main(int argc, char **argv)
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
using_file(file_in);
|
||||
using_file(file_in, 'E');
|
||||
if (anotate) using_file(file_out, 'O');
|
||||
|
||||
if (!edje_init())
|
||||
exit(-1);
|
||||
|
|
|
@ -202,7 +202,7 @@ void *mem_alloc(size_t size);
|
|||
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, ...);
|
||||
|
||||
|
@ -235,5 +235,6 @@ extern New_Object_Handler object_handlers[];
|
|||
extern New_Statement_Handler statement_handlers[];
|
||||
extern int compress_mode;
|
||||
extern int threads;
|
||||
extern int anotate;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -425,7 +425,7 @@ data_thread_fonts(void *data, Ecore_Thread *thread __UNUSED__)
|
|||
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
|
||||
|
@ -438,7 +438,7 @@ data_thread_fonts(void *data, Ecore_Thread *thread __UNUSED__)
|
|||
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);
|
||||
|
@ -805,7 +805,7 @@ data_write_images(Eet_File *ef, int *image_num)
|
|||
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;
|
||||
|
@ -822,7 +822,7 @@ data_write_images(Eet_File *ef, int *image_num)
|
|||
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);
|
||||
}
|
||||
|
@ -868,9 +868,9 @@ data_thread_sounds(void *data, Ecore_Thread *thread __UNUSED__)
|
|||
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)
|
||||
{
|
||||
|
@ -2569,14 +2569,21 @@ data_process_script_lookups(void)
|
|||
}
|
||||
|
||||
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 ;
|
||||
if (anotate)
|
||||
{
|
||||
fprintf(f, "%c: %s\n", type, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs(filename, f);
|
||||
fputc('\n', f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
|
|
@ -738,6 +738,10 @@ compile(void)
|
|||
eina_prefix_lib_get(pfx));
|
||||
if (ecore_file_exists(buf2))
|
||||
{
|
||||
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);
|
||||
|
|
|
@ -33,7 +33,10 @@ read_watch_file(const char *file)
|
|||
{
|
||||
const char *path;
|
||||
|
||||
path = eina_stringshare_add_length(ln->start, ln->length);
|
||||
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);
|
||||
}
|
||||
|
@ -53,11 +56,11 @@ rebuild(void *data __UNUSED__)
|
|||
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;
|
||||
|
@ -66,9 +69,6 @@ rebuild(void *data __UNUSED__)
|
|||
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);
|
||||
|
||||
|
@ -110,7 +110,7 @@ main(int argc, char **argv)
|
|||
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]);
|
||||
|
||||
|
|
|
@ -513,6 +513,8 @@ unsigned char is_hor_space[256];
|
|||
/* 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
|
||||
|
@ -5489,7 +5491,7 @@ open_include_file(cpp_reader * pfile, char *filename,
|
|||
&& !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)
|
||||
|
@ -5510,11 +5512,11 @@ open_include_file(cpp_reader * pfile, char *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);
|
||||
}
|
||||
|
||||
|
@ -5524,7 +5526,7 @@ static int
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -6578,6 +6580,10 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
|
|||
opts->watchfile = argv[i];
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[i], "-anotate"))
|
||||
{
|
||||
anotate = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7449,13 +7455,20 @@ cpp_perror_with_name(cpp_reader * pfile, const char *name)
|
|||
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 ;
|
||||
if (anotate)
|
||||
{
|
||||
fprintf(f, "%c: %s\n", type, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs(filename, f);
|
||||
fputc('\n', f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
|
|
@ -639,7 +639,7 @@ void *xmalloc(unsigned size);
|
|||
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 ';'
|
||||
|
|
Loading…
Reference in New Issue