forked from enlightenment/efl
edje: reformat bin/ c files
a lot of this was unreadable due to mixed tabs/spaces or just random formatting
This commit is contained in:
parent
645c573efb
commit
30378f26fa
|
@ -16,7 +16,7 @@
|
||||||
int _edje_cc_log_dom = -1;
|
int _edje_cc_log_dom = -1;
|
||||||
static void main_help(void);
|
static void main_help(void);
|
||||||
|
|
||||||
Eina_Prefix *pfx = NULL;
|
Eina_Prefix *pfx = NULL;
|
||||||
Eina_List *snd_dirs = NULL;
|
Eina_List *snd_dirs = NULL;
|
||||||
Eina_List *mo_dirs = NULL;
|
Eina_List *mo_dirs = NULL;
|
||||||
Eina_List *vibration_dirs = NULL;
|
Eina_List *vibration_dirs = NULL;
|
||||||
|
@ -25,29 +25,29 @@ Eina_List *model_dirs = NULL;
|
||||||
Eina_List *fnt_dirs = NULL;
|
Eina_List *fnt_dirs = NULL;
|
||||||
Eina_List *data_dirs = NULL;
|
Eina_List *data_dirs = NULL;
|
||||||
Eina_List *defines = NULL;
|
Eina_List *defines = NULL;
|
||||||
char *file_in = NULL;
|
char *file_in = NULL;
|
||||||
char *tmp_dir = NULL;
|
char *tmp_dir = NULL;
|
||||||
char *file_out = NULL;
|
char *file_out = NULL;
|
||||||
char *watchfile = NULL;
|
char *watchfile = NULL;
|
||||||
char *depfile = NULL;
|
char *depfile = NULL;
|
||||||
char *authors = NULL;
|
char *authors = NULL;
|
||||||
char *license = NULL;
|
char *license = NULL;
|
||||||
Eina_List *licenses = NULL;
|
Eina_List *licenses = NULL;
|
||||||
|
|
||||||
static const char *progname = NULL;
|
static const char *progname = NULL;
|
||||||
|
|
||||||
int no_lossy = 0;
|
int no_lossy = 0;
|
||||||
int no_comp = 0;
|
int no_comp = 0;
|
||||||
int no_raw = 0;
|
int no_raw = 0;
|
||||||
int no_save = 0;
|
int no_save = 0;
|
||||||
int min_quality = 0;
|
int min_quality = 0;
|
||||||
int max_quality = 100;
|
int max_quality = 100;
|
||||||
int compress_mode = EET_COMPRESSION_HI;
|
int compress_mode = EET_COMPRESSION_HI;
|
||||||
int threads = 0;
|
int threads = 0;
|
||||||
int annotate = 0;
|
int annotate = 0;
|
||||||
int no_etc1 = 0;
|
int no_etc1 = 0;
|
||||||
int no_etc2 = 0;
|
int no_etc2 = 0;
|
||||||
int beta = 0;
|
int beta = 0;
|
||||||
|
|
||||||
unsigned int max_open_files;
|
unsigned int max_open_files;
|
||||||
|
|
||||||
|
@ -70,16 +70,19 @@ _edje_cc_log_cb(const Eina_Log_Domain *d,
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case EINA_LOG_LEVEL_CRITICAL:
|
case EINA_LOG_LEVEL_CRITICAL:
|
||||||
prefix = "Critical. ";
|
prefix = "Critical. ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_ERR:
|
case EINA_LOG_LEVEL_ERR:
|
||||||
prefix = "Error. ";
|
prefix = "Error. ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_WARN:
|
case EINA_LOG_LEVEL_WARN:
|
||||||
prefix = "Warning. ";
|
prefix = "Warning. ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
fprintf(stderr, "%s: %s", progname, prefix);
|
fprintf(stderr, "%s: %s", progname, prefix);
|
||||||
eina_log_console_color_set(stderr, EINA_COLOR_RESET);
|
eina_log_console_color_set(stderr, EINA_COLOR_RESET);
|
||||||
|
@ -127,7 +130,7 @@ main_help(void)
|
||||||
"-threads Compile the edje file using multiple parallel threads (by default)\n"
|
"-threads Compile the edje file using multiple parallel threads (by default)\n"
|
||||||
"-nothreads Compile the edje file using only the main loop\n"
|
"-nothreads Compile the edje file using only the main loop\n"
|
||||||
"-V [--version] show program version\n"
|
"-V [--version] show program version\n"
|
||||||
,progname);
|
, progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -147,11 +150,11 @@ main(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
_edje_cc_log_dom = eina_log_domain_register
|
_edje_cc_log_dom = eina_log_domain_register
|
||||||
("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR);
|
("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR);
|
||||||
if (_edje_cc_log_dom < 0)
|
if (_edje_cc_log_dom < 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Enable to create a log domain.");
|
EINA_LOG_ERR("Enable to create a log domain.");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (!eina_log_domain_level_check(_edje_cc_log_dom, EINA_LOG_LEVEL_WARN))
|
if (!eina_log_domain_level_check(_edje_cc_log_dom, EINA_LOG_LEVEL_WARN))
|
||||||
eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_WARN);
|
eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_WARN);
|
||||||
|
@ -170,27 +173,27 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp(argv[i], "-h"))
|
if (!strcmp(argv[i], "-h"))
|
||||||
{
|
{
|
||||||
main_help();
|
main_help();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-V")) || (!strcmp(argv[i], "--version")))
|
else if ((!strcmp(argv[i], "-V")) || (!strcmp(argv[i], "--version")))
|
||||||
{
|
{
|
||||||
printf("Version: %s\n", PACKAGE_VERSION);
|
printf("Version: %s\n", PACKAGE_VERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-v"))
|
else if (!strcmp(argv[i], "-v"))
|
||||||
{
|
{
|
||||||
eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_INFO);
|
eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_INFO);
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-no-lossy"))
|
else if (!strcmp(argv[i], "-no-lossy"))
|
||||||
{
|
{
|
||||||
no_lossy = 1;
|
no_lossy = 1;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-no-comp"))
|
else if (!strcmp(argv[i], "-no-comp"))
|
||||||
{
|
{
|
||||||
no_comp = 1;
|
no_comp = 1;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-no-raw"))
|
else if (!strcmp(argv[i], "-no-raw"))
|
||||||
{
|
{
|
||||||
|
@ -204,25 +207,25 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
no_etc2 = 1;
|
no_etc2 = 1;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-no-save"))
|
else if (!strcmp(argv[i], "-no-save"))
|
||||||
{
|
{
|
||||||
no_save = 1;
|
no_save = 1;
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
img_dirs = eina_list_append(img_dirs, argv[i]);
|
img_dirs = eina_list_append(img_dirs, argv[i]);
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-mod") || !strcmp(argv[i], "--model_dir")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-mod") || !strcmp(argv[i], "--model_dir")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
model_dirs = eina_list_append(model_dirs, argv[i]);
|
model_dirs = eina_list_append(model_dirs, argv[i]);
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
|
fnt_dirs = eina_list_append(fnt_dirs, argv[i]);
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
|
@ -243,12 +246,12 @@ main(int argc, char **argv)
|
||||||
i++;
|
i++;
|
||||||
data_dirs = eina_list_append(data_dirs, argv[i]);
|
data_dirs = eina_list_append(data_dirs, argv[i]);
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
if (!tmp_dir)
|
if (!tmp_dir)
|
||||||
tmp_dir = argv[i];
|
tmp_dir = argv[i];
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
|
@ -263,88 +266,88 @@ main(int argc, char **argv)
|
||||||
if (!authors)
|
if (!authors)
|
||||||
authors = argv[i];
|
authors = argv[i];
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
min_quality = atoi(argv[i]);
|
min_quality = atoi(argv[i]);
|
||||||
if (min_quality < 0) min_quality = 0;
|
if (min_quality < 0) min_quality = 0;
|
||||||
if (min_quality > 100) min_quality = 100;
|
if (min_quality > 100) min_quality = 100;
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
max_quality = atoi(argv[i]);
|
max_quality = atoi(argv[i]);
|
||||||
if (max_quality < 0) max_quality = 0;
|
if (max_quality < 0) max_quality = 0;
|
||||||
if (max_quality > 100) max_quality = 100;
|
if (max_quality > 100) max_quality = 100;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-fastcomp"))
|
else if (!strcmp(argv[i], "-fastcomp"))
|
||||||
{
|
{
|
||||||
compress_mode = EET_COMPRESSION_SUPERFAST;
|
compress_mode = EET_COMPRESSION_SUPERFAST;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-fastdecomp"))
|
else if (!strcmp(argv[i], "-fastdecomp"))
|
||||||
{
|
{
|
||||||
compress_mode = EET_COMPRESSION_VERYFAST;
|
compress_mode = EET_COMPRESSION_VERYFAST;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-threads"))
|
else if (!strcmp(argv[i], "-threads"))
|
||||||
{
|
{
|
||||||
threads = 1;
|
threads = 1;
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-nothreads"))
|
else if (!strcmp(argv[i], "-nothreads"))
|
||||||
{
|
{
|
||||||
threads = 0;
|
threads = 0;
|
||||||
}
|
}
|
||||||
else if (!strncmp(argv[i], "-D", 2))
|
else if (!strncmp(argv[i], "-D", 2))
|
||||||
{
|
{
|
||||||
defines = eina_list_append(defines, mem_strdup(argv[i]));
|
defines = eina_list_append(defines, mem_strdup(argv[i]));
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
file_out = argv[i];
|
file_out = argv[i];
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
watchfile = argv[i];
|
watchfile = argv[i];
|
||||||
unlink(watchfile);
|
unlink(watchfile);
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-annotate"))
|
else if (!strcmp(argv[i], "-annotate"))
|
||||||
{
|
{
|
||||||
annotate = 1;
|
annotate = 1;
|
||||||
}
|
}
|
||||||
else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
depfile = argv[i];
|
depfile = argv[i];
|
||||||
unlink(depfile);
|
unlink(depfile);
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-beta"))
|
else if (!strcmp(argv[i], "-beta"))
|
||||||
{
|
{
|
||||||
beta = 1;
|
beta = 1;
|
||||||
}
|
}
|
||||||
else if (!file_in)
|
else if (!file_in)
|
||||||
file_in = argv[i];
|
file_in = argv[i];
|
||||||
else if (!file_out)
|
else if (!file_out)
|
||||||
file_out = argv[i];
|
file_out = argv[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_in)
|
if (!file_in)
|
||||||
{
|
{
|
||||||
ERR("no input file specified.");
|
ERR("no input file specified.");
|
||||||
main_help();
|
main_help();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */
|
pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */
|
||||||
main, /* an optional symbol to check path of */
|
main, /* an optional symbol to check path of */
|
||||||
"EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
|
"EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
|
||||||
"edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */
|
"edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */
|
||||||
"include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */
|
"include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */
|
||||||
PACKAGE_BIN_DIR, /* package bin dir @ compile time */
|
PACKAGE_BIN_DIR, /* package bin dir @ compile time */
|
||||||
PACKAGE_LIB_DIR, /* package lib dir @ compile time */
|
PACKAGE_LIB_DIR, /* package lib dir @ compile time */
|
||||||
PACKAGE_DATA_DIR, /* package data dir @ compile time */
|
PACKAGE_DATA_DIR, /* package data dir @ compile time */
|
||||||
PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */
|
PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* check whether file_in exists */
|
/* check whether file_in exists */
|
||||||
#ifdef HAVE_REALPATH
|
#ifdef HAVE_REALPATH
|
||||||
|
@ -353,41 +356,41 @@ main(int argc, char **argv)
|
||||||
if (stat(file_in, &st) || !S_ISREG(st.st_mode))
|
if (stat(file_in, &st) || !S_ISREG(st.st_mode))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ERR("file not found: %s.", file_in);
|
ERR("file not found: %s.", file_in);
|
||||||
main_help();
|
main_help();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_out)
|
if (!file_out)
|
||||||
{
|
{
|
||||||
char *suffix;
|
char *suffix;
|
||||||
|
|
||||||
if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0))
|
if ((suffix = strstr(file_in, ".edc")) && (suffix[4] == 0))
|
||||||
{
|
{
|
||||||
file_out = strdup(file_in);
|
file_out = strdup(file_in);
|
||||||
if (file_out)
|
if (file_out)
|
||||||
{
|
{
|
||||||
suffix = strstr(file_out,".edc");
|
suffix = strstr(file_out, ".edc");
|
||||||
strcpy(suffix,".edj");
|
strcpy(suffix, ".edj");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!file_out)
|
if (!file_out)
|
||||||
{
|
{
|
||||||
ERR("no output file specified.");
|
ERR("no output file specified.");
|
||||||
main_help();
|
main_help();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_REALPATH
|
#ifdef HAVE_REALPATH
|
||||||
if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2))
|
if (realpath(file_out, rpath2) && !strcmp(rpath, rpath2))
|
||||||
#else
|
#else
|
||||||
if (!strcmp (file_in, file_out))
|
if (!strcmp(file_in, file_out))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ERR("input file equals output file.");
|
ERR("input file equals output file.");
|
||||||
main_help();
|
main_help();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
using_file(file_in, 'E');
|
using_file(file_in, 'E');
|
||||||
|
@ -401,10 +404,10 @@ main(int argc, char **argv)
|
||||||
edje_file->version = EDJE_FILE_VERSION;
|
edje_file->version = EDJE_FILE_VERSION;
|
||||||
edje_file->minor = EDJE_FILE_MINOR;
|
edje_file->minor = EDJE_FILE_MINOR;
|
||||||
edje_file->feature_ver = 1; /* increment this every time we add a field
|
edje_file->feature_ver = 1; /* increment this every time we add a field
|
||||||
* or feature to the edje file format that
|
* or feature to the edje file format that
|
||||||
* does not load nicely as a NULL or 0 value
|
* does not load nicely as a NULL or 0 value
|
||||||
* and needs a special fallback initialization
|
* and needs a special fallback initialization
|
||||||
*/
|
*/
|
||||||
/* efl_version is used for specify efl's version
|
/* efl_version is used for specify efl's version
|
||||||
* which was used for developing a edje file.
|
* which was used for developing a edje file.
|
||||||
* It is useful if Edje(or other EFL libs) need to keep
|
* It is useful if Edje(or other EFL libs) need to keep
|
||||||
|
@ -441,10 +444,11 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
eina_prefix_free(pfx);
|
eina_prefix_free(pfx);
|
||||||
pfx = NULL;
|
pfx = NULL;
|
||||||
|
|
||||||
edje_shutdown();
|
edje_shutdown();
|
||||||
eina_log_domain_unregister(_edje_cc_log_dom);
|
eina_log_domain_unregister(_edje_cc_log_dom);
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,3 +32,4 @@ mem_strdup(const char *s)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,6 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -29,55 +28,54 @@
|
||||||
#define EDJE_1_21_SUPPORTED " -DEFL_VERSION_1_21=1 "
|
#define EDJE_1_21_SUPPORTED " -DEFL_VERSION_1_21=1 "
|
||||||
|
|
||||||
#define EDJE_CC_EFL_VERSION_SUPPORTED \
|
#define EDJE_CC_EFL_VERSION_SUPPORTED \
|
||||||
EDJE_1_18_SUPPORTED \
|
EDJE_1_18_SUPPORTED \
|
||||||
EDJE_1_19_SUPPORTED \
|
EDJE_1_19_SUPPORTED \
|
||||||
EDJE_1_20_SUPPORTED \
|
EDJE_1_20_SUPPORTED \
|
||||||
EDJE_1_21_SUPPORTED
|
EDJE_1_21_SUPPORTED
|
||||||
|
|
||||||
static void new_object(void);
|
static void new_object(void);
|
||||||
static void new_statement(void);
|
static void new_statement(void);
|
||||||
static char *perform_math (char *input);
|
static char *perform_math(char *input);
|
||||||
static int isdelim(char c);
|
static int isdelim(char c);
|
||||||
static char *next_token(char *p, char *end, char **new_p, int *delim);
|
static char *next_token(char *p, char *end, char **new_p, int *delim);
|
||||||
static const char *stack_id(void);
|
static const char *stack_id(void);
|
||||||
static void parse(char *data, off_t size);
|
static void parse(char *data, off_t size);
|
||||||
|
|
||||||
/* simple expression parsing protos */
|
/* simple expression parsing protos */
|
||||||
static int my_atoi(const char * s);
|
static int my_atoi(const char *s);
|
||||||
static char * _alphai(char *s, int * val);
|
static char *_alphai(char *s, int *val);
|
||||||
static char * _betai(char *s, int * val);
|
static char *_betai(char *s, int *val);
|
||||||
static char * _gammai(char *s, int * val);
|
static char *_gammai(char *s, int *val);
|
||||||
static char * _deltai(char *s, int * val);
|
static char *_deltai(char *s, int *val);
|
||||||
static char * _get_numi(char *s, int * val);
|
static char *_get_numi(char *s, int *val);
|
||||||
static int _is_numi(char c);
|
static int _is_numi(char c);
|
||||||
static int _is_op1i(char c);
|
static int _is_op1i(char c);
|
||||||
static int _is_op2i(char c);
|
static int _is_op2i(char c);
|
||||||
static int _calci(char op, int a, int b);
|
static int _calci(char op, int a, int b);
|
||||||
|
|
||||||
static double my_atof(const char * s);
|
static double my_atof(const char *s);
|
||||||
static char * _alphaf(char *s, double * val);
|
static char *_alphaf(char *s, double *val);
|
||||||
static char * _betaf(char *s, double * val);
|
static char *_betaf(char *s, double *val);
|
||||||
static char * _gammaf(char *s, double * val);
|
static char *_gammaf(char *s, double *val);
|
||||||
static char * _deltaf(char *s, double * val);
|
static char *_deltaf(char *s, double *val);
|
||||||
static char * _get_numf(char *s, double * val);
|
static char *_get_numf(char *s, double *val);
|
||||||
static int _is_numf(char c);
|
static int _is_numf(char c);
|
||||||
static int _is_op1f(char c);
|
static int _is_op1f(char c);
|
||||||
static int _is_op2f(char c);
|
static int _is_op2f(char c);
|
||||||
static double _calcf(char op, double a, double b);
|
static double _calcf(char op, double a, double b);
|
||||||
static int strstrip(const char *in, char *out, size_t size);
|
static int strstrip(const char *in, char *out, size_t size);
|
||||||
|
|
||||||
|
int line = 0;
|
||||||
int line = 0;
|
|
||||||
Eina_List *stack = NULL;
|
Eina_List *stack = NULL;
|
||||||
Eina_Array params;
|
Eina_Array params;
|
||||||
int had_quote = 0;
|
int had_quote = 0;
|
||||||
int params_quote = 0;
|
int params_quote = 0;
|
||||||
|
|
||||||
static char file_buf[4096];
|
static char file_buf[4096];
|
||||||
static int did_wildcard = 0;
|
static int did_wildcard = 0;
|
||||||
static int verbatim = 0;
|
static int verbatim = 0;
|
||||||
static int verbatim_line1 = 0;
|
static int verbatim_line1 = 0;
|
||||||
static int verbatim_line2 = 0;
|
static int verbatim_line2 = 0;
|
||||||
static char *verbatim_str = NULL;
|
static char *verbatim_str = NULL;
|
||||||
static Eina_Strbuf *stack_buf = NULL;
|
static Eina_Strbuf *stack_buf = NULL;
|
||||||
|
|
||||||
|
@ -102,9 +100,9 @@ err_show_params(void)
|
||||||
|
|
||||||
ERR("PARAMS:");
|
ERR("PARAMS:");
|
||||||
EINA_ARRAY_ITER_NEXT(¶ms, i, p, iterator)
|
EINA_ARRAY_ITER_NEXT(¶ms, i, p, iterator)
|
||||||
{
|
{
|
||||||
ERR(" %s", p);
|
ERR(" %s", p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -117,7 +115,7 @@ err_show(void)
|
||||||
static char *
|
static char *
|
||||||
_parse_param_get(int n)
|
_parse_param_get(int n)
|
||||||
{
|
{
|
||||||
if (n < (int) eina_array_count(¶ms))
|
if (n < (int)eina_array_count(¶ms))
|
||||||
return eina_array_data_get(¶ms, n);
|
return eina_array_data_get(¶ms, n);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +302,7 @@ new_statement_single(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
perform_math (char *input)
|
perform_math(char *input)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
double res;
|
double res;
|
||||||
|
@ -344,9 +342,9 @@ next_token(char *p, char *end, char **new_p, int *delim)
|
||||||
int in_tok = 0;
|
int in_tok = 0;
|
||||||
int in_quote = 0;
|
int in_quote = 0;
|
||||||
int in_parens = 0;
|
int in_parens = 0;
|
||||||
int in_comment_ss = 0;
|
int in_comment_ss = 0;
|
||||||
int in_comment_cpp = 0;
|
int in_comment_cpp = 0;
|
||||||
int in_comment_sa = 0;
|
int in_comment_sa = 0;
|
||||||
int is_escaped = 0;
|
int is_escaped = 0;
|
||||||
|
|
||||||
had_quote = 0;
|
had_quote = 0;
|
||||||
|
@ -377,7 +375,7 @@ next_token(char *p, char *end, char **new_p, int *delim)
|
||||||
{
|
{
|
||||||
char *pp, fl[4096];
|
char *pp, fl[4096];
|
||||||
char *tmpstr = NULL;
|
char *tmpstr = NULL;
|
||||||
int l, nm;
|
int l, nm;
|
||||||
|
|
||||||
/* handle cpp comments */
|
/* handle cpp comments */
|
||||||
/* their line format is
|
/* their line format is
|
||||||
|
@ -470,14 +468,14 @@ next_token(char *p, char *end, char **new_p, int *delim)
|
||||||
|
|
||||||
/* check for end-of-token */
|
/* check for end-of-token */
|
||||||
if (
|
if (
|
||||||
(isspace(*p)) ||
|
(isspace(*p)) ||
|
||||||
((*delim) && (!isdelim(*p))) ||
|
((*delim) && (!isdelim(*p))) ||
|
||||||
(isdelim(*p))
|
(isdelim(*p))
|
||||||
)
|
) /*the line below this is never used because it skips to
|
||||||
{/*the line below this is never used because it skips to
|
* the 'done' label which is after the return call for
|
||||||
* the 'done' label which is after the return call for
|
* in_tok being 0. is this intentional?
|
||||||
* in_tok being 0. is this intentional?
|
*/
|
||||||
*/
|
{
|
||||||
in_tok = 0;
|
in_tok = 0;
|
||||||
|
|
||||||
tok_end = p - 1;
|
tok_end = p - 1;
|
||||||
|
@ -497,7 +495,7 @@ next_token(char *p, char *end, char **new_p, int *delim)
|
||||||
if (!in_tok) return NULL;
|
if (!in_tok) return NULL;
|
||||||
tok_end = p - 1;
|
tok_end = p - 1;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
*new_p = p;
|
*new_p = p;
|
||||||
|
|
||||||
tok = mem_alloc(tok_end - tok_start + 2);
|
tok = mem_alloc(tok_end - tok_start + 2);
|
||||||
|
@ -661,7 +659,7 @@ stack_pop(void)
|
||||||
if (do_remove)
|
if (do_remove)
|
||||||
eina_strbuf_remove(stack_buf,
|
eina_strbuf_remove(stack_buf,
|
||||||
eina_strbuf_length_get(stack_buf) - tmp_length - 1,
|
eina_strbuf_length_get(stack_buf) - tmp_length - 1,
|
||||||
eina_strbuf_length_get(stack_buf)); /* remove: '.tmp' */
|
eina_strbuf_length_get(stack_buf)); /* remove: '.tmp' */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -698,8 +696,8 @@ stack_pop_quick(Eina_Bool check_last, Eina_Bool do_free)
|
||||||
tmp = end + 1;
|
tmp = end + 1;
|
||||||
}
|
}
|
||||||
eina_strbuf_remove(stack_buf,
|
eina_strbuf_remove(stack_buf,
|
||||||
eina_strbuf_length_get(stack_buf) - strlen(tmp) - 1,
|
eina_strbuf_length_get(stack_buf) - strlen(tmp) - 1,
|
||||||
eina_strbuf_length_get(stack_buf)); /* remove: '.tmp' */
|
eina_strbuf_length_get(stack_buf)); /* remove: '.tmp' */
|
||||||
stack = eina_list_remove_list(stack, eina_list_last(stack));
|
stack = eina_list_remove_list(stack, eina_list_last(stack));
|
||||||
if (do_free)
|
if (do_free)
|
||||||
{
|
{
|
||||||
|
@ -785,7 +783,8 @@ parse(char *data, off_t size)
|
||||||
err_show();
|
err_show();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
else if (*token == ',' || *token == ':') do_params = 1;
|
else if (*token == ',' || *token == ':')
|
||||||
|
do_params = 1;
|
||||||
else if (*token == '}')
|
else if (*token == '}')
|
||||||
{
|
{
|
||||||
if (do_params)
|
if (do_params)
|
||||||
|
@ -921,8 +920,9 @@ parse(char *data, off_t size)
|
||||||
}
|
}
|
||||||
else if ((!inquotes) && (!insquotes))
|
else if ((!inquotes) && (!insquotes))
|
||||||
{
|
{
|
||||||
if (p[0] == '{') squigglie++;
|
if (p[0] == '{') squigglie++;
|
||||||
else if (p[0] == '}') squigglie--;
|
else if (p[0] == '}')
|
||||||
|
squigglie--;
|
||||||
if (squigglie == 0)
|
if (squigglie == 0)
|
||||||
{
|
{
|
||||||
verbatim_2 = p - 1;
|
verbatim_2 = p - 1;
|
||||||
|
@ -1046,7 +1046,7 @@ compile(void)
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
EINA_LIST_FOREACH(defines, l, define)
|
EINA_LIST_FOREACH(defines, l, define)
|
||||||
len += strlen(define) + 1;
|
len += strlen(define) + 1;
|
||||||
def = mem_alloc(len + 1);
|
def = mem_alloc(len + 1);
|
||||||
def[0] = 0;
|
def[0] = 0;
|
||||||
EINA_LIST_FOREACH(defines, l, define)
|
EINA_LIST_FOREACH(defines, l, define)
|
||||||
|
@ -1083,24 +1083,24 @@ compile(void)
|
||||||
inc = ecore_file_dir_get(file_in);
|
inc = ecore_file_dir_get(file_in);
|
||||||
if (depfile)
|
if (depfile)
|
||||||
snprintf(buf, sizeof(buf), "\"%s\" -MMD \"%s\" -MT \"%s\" \"%s\""
|
snprintf(buf, sizeof(buf), "\"%s\" -MMD \"%s\" -MT \"%s\" \"%s\""
|
||||||
" -I\"%s\" %s -o \"%s\""
|
" -I\"%s\" %s -o \"%s\""
|
||||||
" -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d"
|
" -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d"
|
||||||
EDJE_CC_EFL_VERSION_SUPPORTED,
|
EDJE_CC_EFL_VERSION_SUPPORTED,
|
||||||
buf2, depfile, file_out, file_in,
|
buf2, depfile, file_out, file_in,
|
||||||
inc ? inc : "./", def, clean_file,
|
inc ? inc : "./", def, clean_file,
|
||||||
EINA_VERSION_MAJOR, EINA_VERSION_MINOR);
|
EINA_VERSION_MAJOR, EINA_VERSION_MINOR);
|
||||||
else if (annotate)
|
else if (annotate)
|
||||||
snprintf(buf, sizeof(buf), "\"%s\" -annotate -a \"%s\" \"%s\""
|
snprintf(buf, sizeof(buf), "\"%s\" -annotate -a \"%s\" \"%s\""
|
||||||
" -I\"%s\" %s -o \"%s\""
|
" -I\"%s\" %s -o \"%s\""
|
||||||
" -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d"
|
" -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d"
|
||||||
EDJE_CC_EFL_VERSION_SUPPORTED,
|
EDJE_CC_EFL_VERSION_SUPPORTED,
|
||||||
buf2, watchfile ? watchfile : "/dev/null", file_in,
|
buf2, watchfile ? watchfile : "/dev/null", file_in,
|
||||||
inc ? inc : "./", def, clean_file,
|
inc ? inc : "./", def, clean_file,
|
||||||
EINA_VERSION_MAJOR, EINA_VERSION_MINOR);
|
EINA_VERSION_MAJOR, EINA_VERSION_MINOR);
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "\"%s\" -a \"%s\" \"%s\" -I\"%s\" %s"
|
snprintf(buf, sizeof(buf), "\"%s\" -a \"%s\" \"%s\" -I\"%s\" %s"
|
||||||
" -o \"%s\""
|
" -o \"%s\""
|
||||||
" -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d"
|
" -DEFL_VERSION_MAJOR=%d -DEFL_VERSION_MINOR=%d"
|
||||||
EDJE_CC_EFL_VERSION_SUPPORTED,
|
EDJE_CC_EFL_VERSION_SUPPORTED,
|
||||||
buf2, watchfile ? watchfile : "/dev/null", file_in,
|
buf2, watchfile ? watchfile : "/dev/null", file_in,
|
||||||
inc ? inc : "./", def, clean_file,
|
inc ? inc : "./", def, clean_file,
|
||||||
|
@ -1247,10 +1247,10 @@ _parse_enum(char *str, va_list va)
|
||||||
va_list va2;
|
va_list va2;
|
||||||
va_copy(va2, va); /* iterator for the error message */
|
va_copy(va2, va); /* iterator for the error message */
|
||||||
|
|
||||||
for (;;)
|
for (;; )
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
s = va_arg(va, char *);
|
s = va_arg(va, char *);
|
||||||
|
|
||||||
|
@ -1328,7 +1328,7 @@ parse_flags(int n, ...)
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
va_start(va, n);
|
va_start(va, n);
|
||||||
while (n < (int) eina_array_count(¶ms))
|
while (n < (int)eina_array_count(¶ms))
|
||||||
{
|
{
|
||||||
result |= _parse_enum(eina_array_data_get(¶ms, n), va);
|
result |= _parse_enum(eina_array_data_get(¶ms, n), va);
|
||||||
n++;
|
n++;
|
||||||
|
@ -1665,7 +1665,7 @@ _get_numi(char *s, int *val)
|
||||||
}
|
}
|
||||||
buf[pos] = '\0';
|
buf[pos] = '\0';
|
||||||
(*val) = atoi(buf);
|
(*val) = atoi(buf);
|
||||||
return (s + pos);
|
return s + pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1682,10 +1682,13 @@ _is_op1i(char c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '*':;
|
case '*':;
|
||||||
case '%':;
|
|
||||||
case '/': return 1;
|
case '%':;
|
||||||
default: break;
|
|
||||||
|
case '/': return 1;
|
||||||
|
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1695,9 +1698,11 @@ _is_op2i(char c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '+':;
|
case '+':;
|
||||||
case '-': return 1;
|
|
||||||
default: break;
|
case '-': return 1;
|
||||||
|
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1705,29 +1710,34 @@ _is_op2i(char c)
|
||||||
int
|
int
|
||||||
_calci(char op, int a, int b)
|
_calci(char op, int a, int b)
|
||||||
{
|
{
|
||||||
switch(op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case '+':
|
case '+':
|
||||||
a += b;
|
a += b;
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
a -= b;
|
a -= b;
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
if (0 != b) a /= b;
|
if (0 != b) a /= b;
|
||||||
else
|
else
|
||||||
ERR("%s:%i divide by zero", file_in, line - 1);
|
ERR("%s:%i divide by zero", file_in, line - 1);
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '*':
|
case '*':
|
||||||
a *= b;
|
a *= b;
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '%':
|
case '%':
|
||||||
if (0 != b) a = a % b;
|
if (0 != b) a = a % b;
|
||||||
else
|
else
|
||||||
ERR("%s:%i modula by zero", file_in, line - 1);
|
ERR("%s:%i modula by zero", file_in, line - 1);
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("%s:%i unexpected character '%c'", file_in, line - 1, op);
|
ERR("%s:%i unexpected character '%c'", file_in, line - 1, op);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
@ -1818,7 +1828,7 @@ _gammaf(char *s, double *val)
|
||||||
static char *
|
static char *
|
||||||
_betaf(char *s, double *val)
|
_betaf(char *s, double *val)
|
||||||
{
|
{
|
||||||
double a1=0, a2=0;
|
double a1 = 0, a2 = 0;
|
||||||
char op;
|
char op;
|
||||||
|
|
||||||
if (!val) return NULL;
|
if (!val) return NULL;
|
||||||
|
@ -1837,7 +1847,7 @@ _betaf(char *s, double *val)
|
||||||
static char *
|
static char *
|
||||||
_alphaf(char *s, double *val)
|
_alphaf(char *s, double *val)
|
||||||
{
|
{
|
||||||
double a1=0, a2=0;
|
double a1 = 0, a2 = 0;
|
||||||
char op;
|
char op;
|
||||||
|
|
||||||
if (!val) return NULL;
|
if (!val) return NULL;
|
||||||
|
@ -1870,7 +1880,7 @@ _get_numf(char *s, double *val)
|
||||||
}
|
}
|
||||||
buf[pos] = '\0';
|
buf[pos] = '\0';
|
||||||
(*val) = atof(buf);
|
(*val) = atof(buf);
|
||||||
return (s+pos);
|
return s + pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1887,11 +1897,14 @@ _is_numf(char c)
|
||||||
static int
|
static int
|
||||||
_is_op1f(char c)
|
_is_op1f(char c)
|
||||||
{
|
{
|
||||||
switch(c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '*':;
|
case '*':;
|
||||||
|
|
||||||
case '%':;
|
case '%':;
|
||||||
|
|
||||||
case '/': return 1;
|
case '/': return 1;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1900,10 +1913,12 @@ _is_op1f(char c)
|
||||||
static int
|
static int
|
||||||
_is_op2f(char c)
|
_is_op2f(char c)
|
||||||
{
|
{
|
||||||
switch(c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '+':;
|
case '+':;
|
||||||
|
|
||||||
case '-': return 1;
|
case '-': return 1;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1912,29 +1927,34 @@ _is_op2f(char c)
|
||||||
static double
|
static double
|
||||||
_calcf(char op, double a, double b)
|
_calcf(char op, double a, double b)
|
||||||
{
|
{
|
||||||
switch(op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case '+':
|
case '+':
|
||||||
a += b;
|
a += b;
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
a -= b;
|
a -= b;
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '/':
|
case '/':
|
||||||
if (b != 0) a /= b;
|
if (b != 0) a /= b;
|
||||||
else
|
else
|
||||||
ERR("%s:%i divide by zero", file_in, line - 1);
|
ERR("%s:%i divide by zero", file_in, line - 1);
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '*':
|
case '*':
|
||||||
a *= b;
|
a *= b;
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
case '%':
|
case '%':
|
||||||
if (0 != b) a = (double)((int)a % (int)b);
|
if (0 != b) a = (double)((int)a % (int)b);
|
||||||
else
|
else
|
||||||
ERR("%s:%i modula by zero", file_in, line - 1);
|
ERR("%s:%i modula by zero", file_in, line - 1);
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("%s:%i unexpected character '%c'", file_in, line - 1, op);
|
ERR("%s:%i unexpected character '%c'", file_in, line - 1, op);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
@ -1942,7 +1962,7 @@ _calcf(char op, double a, double b)
|
||||||
static int
|
static int
|
||||||
strstrip(const char *in, char *out, size_t size)
|
strstrip(const char *in, char *out, size_t size)
|
||||||
{
|
{
|
||||||
if ((size -1 ) < strlen(in))
|
if ((size - 1) < strlen(in))
|
||||||
{
|
{
|
||||||
ERR("%s:%i expression is too long", file_in, line - 1);
|
ERR("%s:%i expression is too long", file_in, line - 1);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1967,7 +1987,7 @@ get_param_index(char *str)
|
||||||
int index;
|
int index;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
for(index = 0; index < get_arg_count(); index++)
|
for (index = 0; index < get_arg_count(); index++)
|
||||||
{
|
{
|
||||||
p = _parse_param_get(index);
|
p = _parse_param_get(index);
|
||||||
if (!p) continue;
|
if (!p) continue;
|
||||||
|
@ -1982,5 +2002,6 @@ get_param_index(char *str)
|
||||||
int
|
int
|
||||||
param_had_quote(int n)
|
param_had_quote(int n)
|
||||||
{
|
{
|
||||||
return (params_quote & (1 << n));
|
return params_quote & (1 << n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,19 +19,19 @@ typedef enum
|
||||||
{
|
{
|
||||||
TOKEN_TYPE_INVALID = -1,
|
TOKEN_TYPE_INVALID = -1,
|
||||||
TOKEN_TYPE_EOF,
|
TOKEN_TYPE_EOF,
|
||||||
TOKEN_TYPE_COLON = (1 << 0),
|
TOKEN_TYPE_COLON = (1 << 0),
|
||||||
TOKEN_TYPE_SEMICOLON = (1 << 1),
|
TOKEN_TYPE_SEMICOLON = (1 << 1),
|
||||||
TOKEN_TYPE_COMMA = (1 << 2),
|
TOKEN_TYPE_COMMA = (1 << 2),
|
||||||
TOKEN_TYPE_PARENS = (1 << 3),
|
TOKEN_TYPE_PARENS = (1 << 3),
|
||||||
TOKEN_TYPE_BRACES = (1 << 4),
|
TOKEN_TYPE_BRACES = (1 << 4),
|
||||||
TOKEN_TYPE_EQUAL_MARK = (1 << 5),
|
TOKEN_TYPE_EQUAL_MARK = (1 << 5),
|
||||||
TOKEN_TYPE_PUBLIC = (1 << 6),
|
TOKEN_TYPE_PUBLIC = (1 << 6),
|
||||||
TOKEN_TYPE_IDENTIFIER = (1 << 7)
|
TOKEN_TYPE_IDENTIFIER = (1 << 7)
|
||||||
} Token_Type;
|
} Token_Type;
|
||||||
|
|
||||||
typedef struct _Token
|
typedef struct _Token
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
Token_Type type;
|
Token_Type type;
|
||||||
} Token;
|
} Token;
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ code_parse_internal(Code *code)
|
||||||
sym = mem_alloc(SZ(Code_Symbol));
|
sym = mem_alloc(SZ(Code_Symbol));
|
||||||
sym->tag = eina_array_pop(name_stack);
|
sym->tag = eina_array_pop(name_stack);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_SEMICOLON:
|
case TOKEN_TYPE_SEMICOLON:
|
||||||
if (eina_array_count(name_stack))
|
if (eina_array_count(name_stack))
|
||||||
{
|
{
|
||||||
|
@ -114,6 +115,7 @@ code_parse_internal(Code *code)
|
||||||
}
|
}
|
||||||
is_public = EINA_FALSE;
|
is_public = EINA_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_COMMA:
|
case TOKEN_TYPE_COMMA:
|
||||||
if (!sym)
|
if (!sym)
|
||||||
sym = mem_alloc(SZ(Code_Symbol));
|
sym = mem_alloc(SZ(Code_Symbol));
|
||||||
|
@ -127,6 +129,7 @@ code_parse_internal(Code *code)
|
||||||
}
|
}
|
||||||
sym = NULL;
|
sym = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_PARENS:
|
case TOKEN_TYPE_PARENS:
|
||||||
is_args = !is_args;
|
is_args = !is_args;
|
||||||
if (is_args)
|
if (is_args)
|
||||||
|
@ -152,6 +155,7 @@ code_parse_internal(Code *code)
|
||||||
sym = func;
|
sym = func;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_BRACES:
|
case TOKEN_TYPE_BRACES:
|
||||||
depth = 1;
|
depth = 1;
|
||||||
body = begin;
|
body = begin;
|
||||||
|
@ -164,6 +168,7 @@ code_parse_internal(Code *code)
|
||||||
case '{':
|
case '{':
|
||||||
depth++;
|
depth++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '}':
|
case '}':
|
||||||
depth--;
|
depth--;
|
||||||
break;
|
break;
|
||||||
|
@ -182,13 +187,16 @@ code_parse_internal(Code *code)
|
||||||
sym = NULL;
|
sym = NULL;
|
||||||
is_public = EINA_FALSE;
|
is_public = EINA_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_PUBLIC:
|
case TOKEN_TYPE_PUBLIC:
|
||||||
is_public = EINA_TRUE;
|
is_public = EINA_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOKEN_TYPE_IDENTIFIER:
|
case TOKEN_TYPE_IDENTIFIER:
|
||||||
eina_array_push(name_stack, token->str);
|
eina_array_push(name_stack, token->str);
|
||||||
token->str = NULL;
|
token->str = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -228,9 +236,10 @@ next_token(char **begin, char *end)
|
||||||
case ' ':
|
case ' ':
|
||||||
case '\t':
|
case '\t':
|
||||||
case '\n':
|
case '\n':
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
parsed = EINA_TRUE;
|
parsed = EINA_TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ':':
|
case ':':
|
||||||
case ';':
|
case ';':
|
||||||
case ',':
|
case ',':
|
||||||
|
@ -239,46 +248,53 @@ next_token(char **begin, char *end)
|
||||||
case '{':
|
case '{':
|
||||||
case '}':
|
case '}':
|
||||||
case '=':
|
case '=':
|
||||||
if (!index)
|
if (!index)
|
||||||
{
|
{
|
||||||
buf[index++] = ch;
|
buf[index++] = ch;
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (parsed)
|
if (parsed)
|
||||||
goto exit;
|
goto exit;
|
||||||
buf[index++] = ch;
|
buf[index++] = ch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
switch (buf[0])
|
switch (buf[0])
|
||||||
{
|
{
|
||||||
case ':':
|
case ':':
|
||||||
token->type = TOKEN_TYPE_COLON;
|
token->type = TOKEN_TYPE_COLON;
|
||||||
break;
|
break;
|
||||||
case ';':
|
|
||||||
token->type = TOKEN_TYPE_SEMICOLON;
|
case ';':
|
||||||
break;
|
token->type = TOKEN_TYPE_SEMICOLON;
|
||||||
case ',':
|
break;
|
||||||
token->type = TOKEN_TYPE_COMMA;
|
|
||||||
break;
|
case ',':
|
||||||
case '(':
|
token->type = TOKEN_TYPE_COMMA;
|
||||||
case ')':
|
break;
|
||||||
token->type = TOKEN_TYPE_PARENS;
|
|
||||||
break;
|
case '(':
|
||||||
case '{':
|
case ')':
|
||||||
case '}':
|
token->type = TOKEN_TYPE_PARENS;
|
||||||
token->type = TOKEN_TYPE_BRACES;
|
break;
|
||||||
break;
|
|
||||||
case '=':
|
case '{':
|
||||||
token->type = TOKEN_TYPE_EQUAL_MARK;
|
case '}':
|
||||||
break;
|
token->type = TOKEN_TYPE_BRACES;
|
||||||
case '\0':
|
break;
|
||||||
token->type = TOKEN_TYPE_EOF;
|
|
||||||
break;
|
case '=':
|
||||||
|
token->type = TOKEN_TYPE_EQUAL_MARK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\0':
|
||||||
|
token->type = TOKEN_TYPE_EOF;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token->type < 0)
|
if (token->type < 0)
|
||||||
|
@ -448,3 +464,4 @@ script_rewrite(Code *code)
|
||||||
code->vars = vars;
|
code->vars = vars;
|
||||||
code->func = func;
|
code->func = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ source_fetch_file(const char *fil, const char *filname)
|
||||||
f = fopen(fil, "rb");
|
f = fopen(fil, "rb");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
ERR("Cannot open file '%s'", fil);
|
ERR("Cannot open file '%s'", fil);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
|
@ -71,12 +71,12 @@ source_fetch_file(const char *fil, const char *filname)
|
||||||
sf->file = mem_alloc(sz + 1);
|
sf->file = mem_alloc(sz + 1);
|
||||||
if (sz > 0)
|
if (sz > 0)
|
||||||
{
|
{
|
||||||
tmp = fread(sf->file, sz, 1, f);
|
tmp = fread(sf->file, sz, 1, f);
|
||||||
if (tmp != 1)
|
if (tmp != 1)
|
||||||
{
|
{
|
||||||
ERR("file length for (%s) doesn't match!", filname);
|
ERR("file length for (%s) doesn't match!", filname);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sf->file[sz] = '\0';
|
sf->file[sz] = '\0';
|
||||||
|
@ -85,14 +85,14 @@ source_fetch_file(const char *fil, const char *filname)
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), f))
|
while (fgets(buf, sizeof(buf), f))
|
||||||
{
|
{
|
||||||
char *p, *pp;
|
char *p, *pp;
|
||||||
int forgetit = 0;
|
int forgetit = 0;
|
||||||
int haveinclude = 0;
|
int haveinclude = 0;
|
||||||
char *file = NULL, *fname = NULL;
|
char *file = NULL, *fname = NULL;
|
||||||
|
|
||||||
p = buf;
|
p = buf;
|
||||||
while ((!forgetit) && (*p))
|
while ((!forgetit) && (*p))
|
||||||
{
|
{
|
||||||
if (!isspace(*p))
|
if (!isspace(*p))
|
||||||
{
|
{
|
||||||
if (*p != '#')
|
if (*p != '#')
|
||||||
|
@ -100,87 +100,87 @@ source_fetch_file(const char *fil, const char *filname)
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (!haveinclude)
|
if (!haveinclude)
|
||||||
{
|
{
|
||||||
if (!isspace(*p))
|
if (!isspace(*p))
|
||||||
{
|
{
|
||||||
if (!strncmp(p, "include", 7))
|
if (!strncmp(p, "include", 7))
|
||||||
{
|
{
|
||||||
haveinclude = 1;
|
haveinclude = 1;
|
||||||
p += 7;
|
p += 7;
|
||||||
}
|
}
|
||||||
/* HACK! the logic above should be fixed so
|
/* HACK! the logic above should be fixed so
|
||||||
* preprocessor statements don't have to begin
|
* preprocessor statements don't have to begin
|
||||||
* in column 0.
|
* in column 0.
|
||||||
* otoh, edje_cc should print a warning in that case,
|
* otoh, edje_cc should print a warning in that case,
|
||||||
* since according to the standard, preprocessor
|
* since according to the standard, preprocessor
|
||||||
* statements need to be put in column 0.
|
* statements need to be put in column 0.
|
||||||
*/
|
*/
|
||||||
else if (!strncmp(p, "#include", 8))
|
else if (!strncmp(p, "#include", 8))
|
||||||
{
|
{
|
||||||
haveinclude = 1;
|
haveinclude = 1;
|
||||||
p += 8;
|
p += 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
forgetit = 1;
|
forgetit = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!isspace(*p))
|
|
||||||
{
|
|
||||||
char end = '\0';
|
|
||||||
|
|
||||||
if (*p == '"') end = '"';
|
|
||||||
else if (*p == '<') end = '>';
|
|
||||||
|
|
||||||
if (end)
|
|
||||||
{
|
|
||||||
pp = strchr(p + 1, end);
|
|
||||||
if (!pp)
|
|
||||||
forgetit = 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ssize_t l = 0;
|
|
||||||
|
|
||||||
/* get the directory of the current file
|
|
||||||
* if we haven't already done so
|
|
||||||
*/
|
|
||||||
if (!dir)
|
|
||||||
{
|
|
||||||
dir = ecore_file_dir_get(fil);
|
|
||||||
if (dir) dir_len = strlen(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
l = pp - p + dir_len + 1;
|
|
||||||
file = mem_alloc(l);
|
|
||||||
|
|
||||||
if (!dir_len)
|
|
||||||
{
|
|
||||||
snprintf(file, l - 1, "%s", p + 1);
|
|
||||||
file[l - 2] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(file, l, "%s/%s", dir, p + 1);
|
|
||||||
file[l - 1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fname = strdup(p + 1);
|
|
||||||
pp = strrchr(fname, end);
|
|
||||||
if (pp) *pp = 0;
|
|
||||||
forgetit = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
forgetit = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
if ((file) && (fname))
|
{
|
||||||
|
if (!isspace(*p))
|
||||||
|
{
|
||||||
|
char end = '\0';
|
||||||
|
|
||||||
|
if (*p == '"') end = '"';
|
||||||
|
else if (*p == '<')
|
||||||
|
end = '>';
|
||||||
|
|
||||||
|
if (end)
|
||||||
|
{
|
||||||
|
pp = strchr(p + 1, end);
|
||||||
|
if (!pp)
|
||||||
|
forgetit = 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ssize_t l = 0;
|
||||||
|
|
||||||
|
/* get the directory of the current file
|
||||||
|
* if we haven't already done so
|
||||||
|
*/
|
||||||
|
if (!dir)
|
||||||
|
{
|
||||||
|
dir = ecore_file_dir_get(fil);
|
||||||
|
if (dir) dir_len = strlen(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
l = pp - p + dir_len + 1;
|
||||||
|
file = mem_alloc(l);
|
||||||
|
|
||||||
|
if (!dir_len)
|
||||||
|
{
|
||||||
|
snprintf(file, l - 1, "%s", p + 1);
|
||||||
|
file[l - 2] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(file, l, "%s/%s", dir, p + 1);
|
||||||
|
file[l - 1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fname = strdup(p + 1);
|
||||||
|
pp = strrchr(fname, end);
|
||||||
|
if (pp) *pp = 0;
|
||||||
|
forgetit = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
forgetit = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((file) && (fname))
|
||||||
source_fetch_file(file, fname);
|
source_fetch_file(file, fname);
|
||||||
|
|
||||||
if (file) free(file);
|
if (file) free(file);
|
||||||
|
@ -230,3 +230,4 @@ source_fontmap_load(Eet_File *ef)
|
||||||
fl = eet_data_read(ef, _font_list_edd, "edje_source_fontmap");
|
fl = eet_data_read(ef, _font_list_edd, "edje_source_fontmap");
|
||||||
return fl;
|
return fl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -37,8 +37,8 @@ _edje_file_convert_external(Edje_File *edf, Old_Edje_File *oedf)
|
||||||
|
|
||||||
EINA_LIST_FREE(oedf->external_dir->entries, ede)
|
EINA_LIST_FREE(oedf->external_dir->entries, ede)
|
||||||
{
|
{
|
||||||
edf->external_dir->entries[i++].entry = ede->entry;
|
edf->external_dir->entries[i++].entry = ede->entry;
|
||||||
free(ede);
|
free(ede);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(oedf->external_dir);
|
free(oedf->external_dir);
|
||||||
|
@ -72,10 +72,10 @@ _edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf)
|
||||||
|
|
||||||
EINA_LIST_FREE(oedf->image_dir->entries, de)
|
EINA_LIST_FREE(oedf->image_dir->entries, de)
|
||||||
{
|
{
|
||||||
memcpy(edf->image_dir->entries + de->id,
|
memcpy(edf->image_dir->entries + de->id,
|
||||||
de,
|
de,
|
||||||
sizeof (Edje_Image_Directory_Entry));
|
sizeof (Edje_Image_Directory_Entry));
|
||||||
free(de);
|
free(de);
|
||||||
}
|
}
|
||||||
|
|
||||||
max = -1;
|
max = -1;
|
||||||
|
@ -88,17 +88,17 @@ _edje_file_convert_images(Edje_File *edf, Old_Edje_File *oedf)
|
||||||
|
|
||||||
if (!edf->image_dir->sets && edf->image_dir->sets_count)
|
if (!edf->image_dir->sets && edf->image_dir->sets_count)
|
||||||
{
|
{
|
||||||
free(edf->image_dir->entries);
|
free(edf->image_dir->entries);
|
||||||
edf->image_dir->entries = NULL;
|
edf->image_dir->entries = NULL;
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(oedf->image_dir->sets, ds)
|
EINA_LIST_FREE(oedf->image_dir->sets, ds)
|
||||||
{
|
{
|
||||||
memcpy(edf->image_dir->sets + ds->id,
|
memcpy(edf->image_dir->sets + ds->id,
|
||||||
ds,
|
ds,
|
||||||
sizeof (Edje_Image_Directory_Set));
|
sizeof (Edje_Image_Directory_Set));
|
||||||
free(ds);
|
free(ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -129,15 +129,15 @@ _edje_file_convert(Eet_File *ef, Old_Edje_File *oedf)
|
||||||
|
|
||||||
EINA_LIST_FREE(oedf->data, ed)
|
EINA_LIST_FREE(oedf->data, ed)
|
||||||
{
|
{
|
||||||
Edje_String *es;
|
Edje_String *es;
|
||||||
|
|
||||||
es = calloc(1, sizeof (Edje_String));
|
es = calloc(1, sizeof (Edje_String));
|
||||||
if (!es) continue;
|
if (!es) continue;
|
||||||
|
|
||||||
es->str = ed->value;
|
es->str = ed->value;
|
||||||
|
|
||||||
eina_hash_direct_add(edf->data, ed->key, es);
|
eina_hash_direct_add(edf->data, ed->key, es);
|
||||||
free(ed);
|
free(ed);
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(oedf->collection_dir->entries, l, ce)
|
EINA_LIST_FOREACH(oedf->collection_dir->entries, l, ce)
|
||||||
|
@ -148,7 +148,7 @@ _edje_file_convert(Eet_File *ef, Old_Edje_File *oedf)
|
||||||
|
|
||||||
if (oedf->font_dir)
|
if (oedf->font_dir)
|
||||||
EINA_LIST_FOREACH(oedf->font_dir->entries, l, fnt)
|
EINA_LIST_FOREACH(oedf->font_dir->entries, l, fnt)
|
||||||
eina_hash_direct_add(edf->fonts, fnt->entry, fnt);
|
eina_hash_direct_add(edf->fonts, fnt->entry, fnt);
|
||||||
|
|
||||||
if (!_edje_file_convert_images(edf, oedf))
|
if (!_edje_file_convert_images(edf, oedf))
|
||||||
goto on_error;
|
goto on_error;
|
||||||
|
@ -174,7 +174,7 @@ _edje_file_convert(Eet_File *ef, Old_Edje_File *oedf)
|
||||||
|
|
||||||
return edf;
|
return edf;
|
||||||
|
|
||||||
on_error:
|
on_error:
|
||||||
eina_hash_free(edf->fonts);
|
eina_hash_free(edf->fonts);
|
||||||
eina_hash_free(edf->collection);
|
eina_hash_free(edf->collection);
|
||||||
eina_hash_free(edf->data);
|
eina_hash_free(edf->data);
|
||||||
|
@ -186,12 +186,12 @@ _edje_file_convert(Eet_File *ef, Old_Edje_File *oedf)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edje_collection_program_add(Edje_Program ***array,
|
_edje_collection_program_add(Edje_Program ***array,
|
||||||
unsigned int *count,
|
unsigned int *count,
|
||||||
Edje_Program *add)
|
Edje_Program *add)
|
||||||
{
|
{
|
||||||
Edje_Program **tmp;
|
Edje_Program **tmp;
|
||||||
|
|
||||||
tmp = realloc(*array, sizeof (Edje_Program*) * (*count + 1));
|
tmp = realloc(*array, sizeof (Edje_Program *) * (*count + 1));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
error_and_abort(ef, "Not enough memory");
|
error_and_abort(ef, "Not enough memory");
|
||||||
|
@ -218,40 +218,40 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce,
|
||||||
/* Count each type part and their respective state */
|
/* Count each type part and their respective state */
|
||||||
EINA_LIST_FOREACH(oedc->parts, l, part)
|
EINA_LIST_FOREACH(oedc->parts, l, part)
|
||||||
{
|
{
|
||||||
int *count;
|
int *count;
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
|
|
||||||
|
switch (part->type)
|
||||||
|
{
|
||||||
|
#define CSP(Tp, Ce) \
|
||||||
|
case EDJE_PART_TYPE_##Tp: \
|
||||||
|
count = &Ce->count.Tp; \
|
||||||
|
break;
|
||||||
|
|
||||||
switch (part->type)
|
CSP(RECTANGLE, ce);
|
||||||
{
|
CSP(TEXT, ce);
|
||||||
#define CSP(Tp, Ce) \
|
CSP(IMAGE, ce);
|
||||||
case EDJE_PART_TYPE_##Tp : \
|
CSP(SWALLOW, ce);
|
||||||
count = &Ce->count.Tp; \
|
CSP(TEXTBLOCK, ce);
|
||||||
break;
|
CSP(GROUP, ce);
|
||||||
|
CSP(BOX, ce);
|
||||||
|
CSP(TABLE, ce);
|
||||||
|
CSP(EXTERNAL, ce);
|
||||||
|
CSP(VECTOR, ce);
|
||||||
|
|
||||||
CSP(RECTANGLE, ce);
|
default:
|
||||||
CSP(TEXT, ce);
|
count = &dummy;
|
||||||
CSP(IMAGE, ce);
|
break;
|
||||||
CSP(SWALLOW, ce);
|
}
|
||||||
CSP(TEXTBLOCK, ce);
|
|
||||||
CSP(GROUP, ce);
|
|
||||||
CSP(BOX, ce);
|
|
||||||
CSP(TABLE, ce);
|
|
||||||
CSP(EXTERNAL, ce);
|
|
||||||
CSP(VECTOR, ce);
|
|
||||||
default:
|
|
||||||
count = &dummy;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
*count += eina_list_count(part->other_desc) + 1;
|
*count += eina_list_count(part->other_desc) + 1;
|
||||||
}
|
}
|
||||||
ce->count.part = eina_list_count(oedc->parts);
|
ce->count.part = eina_list_count(oedc->parts);
|
||||||
|
|
||||||
#define CONVERT_EMN(Tp, Sz, Ce) \
|
#define CONVERT_EMN(Tp, Sz, Ce) \
|
||||||
buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
|
buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
|
||||||
sprintf(buffer, "%s/%s", ce->entry, #Tp); \
|
sprintf(buffer, "%s/%s", ce->entry, #Tp); \
|
||||||
Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp);
|
Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp);
|
||||||
|
|
||||||
CONVERT_EMN(RECTANGLE, Edje_Part_Description_Common, ce);
|
CONVERT_EMN(RECTANGLE, Edje_Part_Description_Common, ce);
|
||||||
CONVERT_EMN(TEXT, Edje_Part_Description_Text, ce);
|
CONVERT_EMN(TEXT, Edje_Part_Description_Text, ce);
|
||||||
|
@ -272,43 +272,43 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce,
|
||||||
|
|
||||||
EINA_LIST_FREE(oedc->programs, pg)
|
EINA_LIST_FREE(oedc->programs, pg)
|
||||||
{
|
{
|
||||||
if (!pg->signal && !pg->source)
|
if (!pg->signal && !pg->source)
|
||||||
_edje_collection_program_add(&edc->programs.nocmp,
|
_edje_collection_program_add(&edc->programs.nocmp,
|
||||||
&edc->programs.nocmp_count,
|
&edc->programs.nocmp_count,
|
||||||
pg);
|
pg);
|
||||||
else if (pg->signal && !strpbrk(pg->signal, "*?[\\")
|
else if (pg->signal && !strpbrk(pg->signal, "*?[\\")
|
||||||
&& pg->source && !strpbrk(pg->source, "*?[\\"))
|
&& pg->source && !strpbrk(pg->source, "*?[\\"))
|
||||||
_edje_collection_program_add(&edc->programs.strcmp,
|
_edje_collection_program_add(&edc->programs.strcmp,
|
||||||
&edc->programs.strcmp_count,
|
&edc->programs.strcmp_count,
|
||||||
pg);
|
pg);
|
||||||
else if (pg->signal && edje_program_is_strncmp(pg->signal)
|
else if (pg->signal && edje_program_is_strncmp(pg->signal)
|
||||||
&& pg->source && edje_program_is_strncmp(pg->source))
|
&& pg->source && edje_program_is_strncmp(pg->source))
|
||||||
_edje_collection_program_add(&edc->programs.strncmp,
|
_edje_collection_program_add(&edc->programs.strncmp,
|
||||||
&edc->programs.strncmp_count,
|
&edc->programs.strncmp_count,
|
||||||
pg);
|
pg);
|
||||||
else if (pg->signal && edje_program_is_strrncmp(pg->signal)
|
else if (pg->signal && edje_program_is_strrncmp(pg->signal)
|
||||||
&& pg->source && edje_program_is_strrncmp(pg->source))
|
&& pg->source && edje_program_is_strrncmp(pg->source))
|
||||||
_edje_collection_program_add(&edc->programs.strrncmp,
|
_edje_collection_program_add(&edc->programs.strrncmp,
|
||||||
&edc->programs.strrncmp_count,
|
&edc->programs.strrncmp_count,
|
||||||
pg);
|
pg);
|
||||||
else
|
else
|
||||||
_edje_collection_program_add(&edc->programs.fnmatch,
|
_edje_collection_program_add(&edc->programs.fnmatch,
|
||||||
&edc->programs.fnmatch_count,
|
&edc->programs.fnmatch_count,
|
||||||
pg);
|
pg);
|
||||||
}
|
}
|
||||||
|
|
||||||
edc->data = eina_hash_string_small_new(NULL);
|
edc->data = eina_hash_string_small_new(NULL);
|
||||||
EINA_LIST_FREE(oedc->data, di)
|
EINA_LIST_FREE(oedc->data, di)
|
||||||
{
|
{
|
||||||
Edje_String *es;
|
Edje_String *es;
|
||||||
|
|
||||||
es = calloc(1, sizeof (Edje_String));
|
es = calloc(1, sizeof (Edje_String));
|
||||||
if (!es) continue ;
|
if (!es) continue;
|
||||||
|
|
||||||
es->str = di->value;
|
es->str = di->value;
|
||||||
|
|
||||||
eina_hash_direct_add(edc->data, di->key, es);
|
eina_hash_direct_add(edc->data, di->key, es);
|
||||||
free(di);
|
free(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
edc->parts_count = eina_list_count(oedc->parts);
|
edc->parts_count = eina_list_count(oedc->parts);
|
||||||
|
@ -319,60 +319,60 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce,
|
||||||
|
|
||||||
EINA_LIST_FREE(oedc->parts, part)
|
EINA_LIST_FREE(oedc->parts, part)
|
||||||
{
|
{
|
||||||
Old_Edje_Part_Description *oepd;
|
Old_Edje_Part_Description *oepd;
|
||||||
Edje_Pack_Element *elm;
|
Edje_Pack_Element *elm;
|
||||||
Edje_Part *replacement;
|
Edje_Part *replacement;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
replacement = eina_mempool_malloc(ce->mp.part, sizeof (Edje_Part));
|
replacement = eina_mempool_malloc(ce->mp.part, sizeof (Edje_Part));
|
||||||
if (!replacement)
|
if (!replacement)
|
||||||
error_and_abort(ef, "Not enough memory");
|
error_and_abort(ef, "Not enough memory");
|
||||||
|
|
||||||
replacement->name = part->name;
|
replacement->name = part->name;
|
||||||
replacement->default_desc = _edje_description_convert(part->type, ce, part->default_desc);
|
replacement->default_desc = _edje_description_convert(part->type, ce, part->default_desc);
|
||||||
|
|
||||||
replacement->other.desc_count = eina_list_count(part->other_desc);
|
replacement->other.desc_count = eina_list_count(part->other_desc);
|
||||||
replacement->other.desc = calloc(replacement->other.desc_count, sizeof (Edje_Part_Description_Common*));
|
replacement->other.desc = calloc(replacement->other.desc_count, sizeof (Edje_Part_Description_Common *));
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
EINA_LIST_FREE(part->other_desc, oepd)
|
EINA_LIST_FREE(part->other_desc, oepd)
|
||||||
replacement->other.desc[i++] = _edje_description_convert(part->type, ce, oepd);
|
replacement->other.desc[i++] = _edje_description_convert(part->type, ce, oepd);
|
||||||
|
|
||||||
replacement->source = part->source;
|
replacement->source = part->source;
|
||||||
replacement->source2 = part->source2;
|
replacement->source2 = part->source2;
|
||||||
replacement->source3 = part->source3;
|
replacement->source3 = part->source3;
|
||||||
replacement->source4 = part->source4;
|
replacement->source4 = part->source4;
|
||||||
replacement->source5 = part->source5;
|
replacement->source5 = part->source5;
|
||||||
replacement->source6 = part->source6;
|
replacement->source6 = part->source6;
|
||||||
replacement->id = part->id;
|
replacement->id = part->id;
|
||||||
replacement->clip_to_id = part->clip_to_id;
|
replacement->clip_to_id = part->clip_to_id;
|
||||||
replacement->dragable = part->dragable;
|
replacement->dragable = part->dragable;
|
||||||
replacement->items_count = eina_list_count(part->items);
|
replacement->items_count = eina_list_count(part->items);
|
||||||
replacement->items = calloc(replacement->items_count, sizeof (Edje_Pack_Element*));
|
replacement->items = calloc(replacement->items_count, sizeof (Edje_Pack_Element *));
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
EINA_LIST_FREE(part->items, elm)
|
EINA_LIST_FREE(part->items, elm)
|
||||||
replacement->items[i++] = elm;
|
replacement->items[i++] = elm;
|
||||||
|
|
||||||
replacement->type = part->type;
|
replacement->type = part->type;
|
||||||
replacement->effect = part->effect;
|
replacement->effect = part->effect;
|
||||||
replacement->mouse_events = part->mouse_events;
|
replacement->mouse_events = part->mouse_events;
|
||||||
replacement->repeat_events = part->repeat_events;
|
replacement->repeat_events = part->repeat_events;
|
||||||
replacement->ignore_flags = part->ignore_flags;
|
replacement->ignore_flags = part->ignore_flags;
|
||||||
replacement->mask_flags = part->mask_flags;
|
replacement->mask_flags = part->mask_flags;
|
||||||
replacement->scale = part->scale;
|
replacement->scale = part->scale;
|
||||||
replacement->precise_is_inside = part->precise_is_inside;
|
replacement->precise_is_inside = part->precise_is_inside;
|
||||||
replacement->use_alternate_font_metrics = part->use_alternate_font_metrics;
|
replacement->use_alternate_font_metrics = part->use_alternate_font_metrics;
|
||||||
replacement->pointer_mode = part->pointer_mode;
|
replacement->pointer_mode = part->pointer_mode;
|
||||||
replacement->entry_mode = part->entry_mode;
|
replacement->entry_mode = part->entry_mode;
|
||||||
replacement->select_mode = part->select_mode;
|
replacement->select_mode = part->select_mode;
|
||||||
replacement->multiline = part->multiline;
|
replacement->multiline = part->multiline;
|
||||||
replacement->api = part->api;
|
replacement->api = part->api;
|
||||||
replacement->required = part->required;
|
replacement->required = part->required;
|
||||||
|
|
||||||
edc->parts[k++] = replacement;
|
edc->parts[k++] = replacement;
|
||||||
|
|
||||||
free(part);
|
free(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
edc->id = oedc->id;
|
edc->id = oedc->id;
|
||||||
|
@ -389,76 +389,78 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce,
|
||||||
return edc;
|
return edc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Edje_Part_Description_Common*
|
Edje_Part_Description_Common *
|
||||||
_edje_description_convert(int type,
|
_edje_description_convert(int type,
|
||||||
Edje_Part_Collection_Directory_Entry *ce,
|
Edje_Part_Collection_Directory_Entry *ce,
|
||||||
Old_Edje_Part_Description *oed)
|
Old_Edje_Part_Description *oed)
|
||||||
{
|
{
|
||||||
Edje_Part_Description_Common *result = NULL;
|
Edje_Part_Description_Common *result = NULL;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case EDJE_PART_TYPE_RECTANGLE:
|
case EDJE_PART_TYPE_RECTANGLE:
|
||||||
result = eina_mempool_malloc(ce->mp.RECTANGLE,
|
result = eina_mempool_malloc(ce->mp.RECTANGLE,
|
||||||
sizeof (Edje_Part_Description_Common));
|
sizeof (Edje_Part_Description_Common));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDJE_PART_TYPE_SWALLOW:
|
case EDJE_PART_TYPE_SWALLOW:
|
||||||
result = eina_mempool_malloc(ce->mp.SWALLOW,
|
result = eina_mempool_malloc(ce->mp.SWALLOW,
|
||||||
sizeof (Edje_Part_Description_Common));
|
sizeof (Edje_Part_Description_Common));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDJE_PART_TYPE_GROUP:
|
case EDJE_PART_TYPE_GROUP:
|
||||||
result = eina_mempool_malloc(ce->mp.GROUP,
|
result = eina_mempool_malloc(ce->mp.GROUP,
|
||||||
sizeof (Edje_Part_Description_Common));
|
sizeof (Edje_Part_Description_Common));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDJE_PART_TYPE_IMAGE:
|
case EDJE_PART_TYPE_IMAGE:
|
||||||
{
|
{
|
||||||
Edje_Part_Description_Image *img;
|
Edje_Part_Description_Image *img;
|
||||||
Edje_Part_Image_Id *id;
|
Edje_Part_Image_Id *id;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
img = eina_mempool_malloc(ce->mp.IMAGE, sizeof (Edje_Part_Description_Image));
|
img = eina_mempool_malloc(ce->mp.IMAGE, sizeof (Edje_Part_Description_Image));
|
||||||
|
|
||||||
img->image.tweens_count = eina_list_count(oed->image.tween_list);
|
img->image.tweens_count = eina_list_count(oed->image.tween_list);
|
||||||
img->image.tweens = calloc(img->image.tweens_count,
|
img->image.tweens = calloc(img->image.tweens_count,
|
||||||
sizeof (Edje_Part_Image_Id*));
|
sizeof (Edje_Part_Image_Id *));
|
||||||
if (img->image.tweens_count > 0 && !img->image.tweens)
|
if (img->image.tweens_count > 0 && !img->image.tweens)
|
||||||
{
|
{
|
||||||
eina_mempool_free(ce->mp.IMAGE, img);
|
eina_mempool_free(ce->mp.IMAGE, img);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(oed->image.tween_list, id)
|
EINA_LIST_FREE(oed->image.tween_list, id)
|
||||||
img->image.tweens[i++] = id;
|
img->image.tweens[i++] = id;
|
||||||
|
|
||||||
img->image.id = oed->image.id;
|
img->image.id = oed->image.id;
|
||||||
img->image.scale_hint = oed->image.scale_hint;
|
img->image.scale_hint = oed->image.scale_hint;
|
||||||
img->image.set = oed->image.set;
|
img->image.set = oed->image.set;
|
||||||
|
|
||||||
img->image.border = oed->image.border;
|
img->image.border = oed->image.border;
|
||||||
img->image.fill = oed->image.fill;
|
img->image.fill = oed->image.fill;
|
||||||
|
|
||||||
result = &img->common;
|
result = &img->common;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONVERT_ALLOC_POOL(Short, Type, Name) \
|
#define CONVERT_ALLOC_POOL(Short, Type, Name) \
|
||||||
case EDJE_PART_TYPE_##Short: \
|
case EDJE_PART_TYPE_##Short: \
|
||||||
{ \
|
{ \
|
||||||
Edje_Part_Description_##Type *Name; \
|
Edje_Part_Description_##Type * Name; \
|
||||||
\
|
\
|
||||||
Name = eina_mempool_malloc(ce->mp.Short, sizeof (Edje_Part_Description_##Type)); \
|
Name = eina_mempool_malloc(ce->mp.Short, sizeof (Edje_Part_Description_##Type)); \
|
||||||
Name->Name = oed->Name; \
|
Name->Name = oed->Name; \
|
||||||
result = &Name->common; \
|
result = &Name->common; \
|
||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
CONVERT_ALLOC_POOL(TEXT, Text, text);
|
CONVERT_ALLOC_POOL(TEXT, Text, text);
|
||||||
CONVERT_ALLOC_POOL(TEXTBLOCK, Text, text);
|
CONVERT_ALLOC_POOL(TEXTBLOCK, Text, text);
|
||||||
CONVERT_ALLOC_POOL(BOX, Box, box);
|
CONVERT_ALLOC_POOL(BOX, Box, box);
|
||||||
CONVERT_ALLOC_POOL(TABLE, Table, table);
|
CONVERT_ALLOC_POOL(TABLE, Table, table);
|
||||||
CONVERT_ALLOC_POOL(EXTERNAL, External, external_params);
|
CONVERT_ALLOC_POOL(EXTERNAL, External, external_params);
|
||||||
CONVERT_ALLOC_POOL(VECTOR, Vector, vector);
|
CONVERT_ALLOC_POOL(VECTOR, Vector, vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
@ -467,3 +469,4 @@ _edje_description_convert(int type,
|
||||||
free(oed);
|
free(oed);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ main_help(void)
|
||||||
("Usage:\n"
|
("Usage:\n"
|
||||||
"\t%s file.edj\n"
|
"\t%s file.edj\n"
|
||||||
"\n"
|
"\n"
|
||||||
,progname);
|
, progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -57,17 +57,17 @@ _edje_alias_int(const char *target, Eet_File *ef, const char *base, const char *
|
||||||
strcat(buf, "%i");
|
strcat(buf, "%i");
|
||||||
for (i = 0; i < count && match; ++i)
|
for (i = 0; i < count && match; ++i)
|
||||||
{
|
{
|
||||||
char name[1024];
|
char name[1024];
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
if (sscanf(match[i], buf, &id) != 1)
|
if (sscanf(match[i], buf, &id) != 1)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Wrong fonts section `%s' in `%s'. Discarding it.", match[i], target);
|
EINA_LOG_ERR("Wrong fonts section `%s' in `%s'. Discarding it.", match[i], target);
|
||||||
continue ;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(name, sizeof (name), "%s/%i", to, id);
|
snprintf(name, sizeof (name), "%s/%i", to, id);
|
||||||
eet_alias(ef, name, match[i], 1);
|
eet_alias(ef, name, match[i], 1);
|
||||||
}
|
}
|
||||||
free(match);
|
free(match);
|
||||||
}
|
}
|
||||||
|
@ -87,17 +87,17 @@ _edje_alias_string(const char *target, Eet_File *ef, const char *base, const cha
|
||||||
strcat(buf, "%s");
|
strcat(buf, "%s");
|
||||||
for (i = 0; i < count && match; ++i)
|
for (i = 0; i < count && match; ++i)
|
||||||
{
|
{
|
||||||
char name[1024];
|
char name[1024];
|
||||||
char id[1024];
|
char id[1024];
|
||||||
|
|
||||||
if (sscanf(match[i], buf, &id) != 1)
|
if (sscanf(match[i], buf, &id) != 1)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Wrong fonts section `%s' in `%s'. Discarding it.", match[i], target);
|
EINA_LOG_ERR("Wrong fonts section `%s' in `%s'. Discarding it.", match[i], target);
|
||||||
continue ;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(name, sizeof (name), "%s/%s", to, id);
|
snprintf(name, sizeof (name), "%s/%s", to, id);
|
||||||
eet_alias(ef, name, match[i], 1);
|
eet_alias(ef, name, match[i], 1);
|
||||||
}
|
}
|
||||||
free(match);
|
free(match);
|
||||||
}
|
}
|
||||||
|
@ -119,11 +119,11 @@ main(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
_edje_cc_log_dom = eina_log_domain_register
|
_edje_cc_log_dom = eina_log_domain_register
|
||||||
("edje_convert", EDJE_CC_DEFAULT_LOG_COLOR);
|
("edje_convert", EDJE_CC_DEFAULT_LOG_COLOR);
|
||||||
if (_edje_cc_log_dom < 0)
|
if (_edje_cc_log_dom < 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Enable to create a log domain.");
|
EINA_LOG_ERR("Enable to create a log domain.");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
eet_init();
|
eet_init();
|
||||||
|
@ -131,8 +131,8 @@ main(int argc, char **argv)
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
if (argc > 2 || argc < 2 || !strcmp(argv[1], "-h"))
|
if (argc > 2 || argc < 2 || !strcmp(argv[1], "-h"))
|
||||||
{
|
{
|
||||||
main_help();
|
main_help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_edje_edd_old_init();
|
_edje_edd_old_init();
|
||||||
|
@ -141,15 +141,15 @@ main(int argc, char **argv)
|
||||||
ef = eet_open(argv[1], EET_FILE_MODE_READ_WRITE);
|
ef = eet_open(argv[1], EET_FILE_MODE_READ_WRITE);
|
||||||
if (!ef)
|
if (!ef)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Unable to open `%s'.", argv[1]);
|
EINA_LOG_ERR("Unable to open `%s'.", argv[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
oef = eet_data_read(ef, _edje_edd_old_edje_file, "edje_file");
|
oef = eet_data_read(ef, _edje_edd_old_edje_file, "edje_file");
|
||||||
if (!oef)
|
if (!oef)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Unable to get edje_file section from old file format, are you sure it's an old file ?");
|
EINA_LOG_ERR("Unable to get edje_file section from old file format, are you sure it's an old file ?");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nef = _edje_file_convert(ef, oef);
|
nef = _edje_file_convert(ef, oef);
|
||||||
|
@ -160,34 +160,34 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
EINA_ITERATOR_FOREACH(it, ce)
|
EINA_ITERATOR_FOREACH(it, ce)
|
||||||
{
|
{
|
||||||
Old_Edje_Part_Collection *opc;
|
Old_Edje_Part_Collection *opc;
|
||||||
Edje_Part_Collection *npc;
|
Edje_Part_Collection *npc;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
|
|
||||||
snprintf(buf, sizeof (buf), "collections/%i", ce->id);
|
snprintf(buf, sizeof (buf), "collections/%i", ce->id);
|
||||||
opc = eet_data_read(ef, _edje_edd_old_edje_part_collection, buf);
|
opc = eet_data_read(ef, _edje_edd_old_edje_part_collection, buf);
|
||||||
if (!opc)
|
if (!opc)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Unable to find collection `%s'[%i] in `%s'.", ce->entry, ce->id, argv[1]);
|
EINA_LOG_ERR("Unable to find collection `%s'[%i] in `%s'.", ce->entry, ce->id, argv[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
npc = _edje_collection_convert(ef, ce, opc);
|
npc = _edje_collection_convert(ef, ce, opc);
|
||||||
|
|
||||||
snprintf(buf, sizeof (buf), "edje/collections/%i", ce->id);
|
snprintf(buf, sizeof (buf), "edje/collections/%i", ce->id);
|
||||||
bytes = eet_data_write(ef, _edje_edd_edje_part_collection, buf, npc, 1);
|
bytes = eet_data_write(ef, _edje_edd_edje_part_collection, buf, npc, 1);
|
||||||
if (bytes <= 0)
|
if (bytes <= 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Unable to save `%s' in section `%s' of `%s'.", ce->entry, buf, argv[1]);
|
EINA_LOG_ERR("Unable to save `%s' in section `%s' of `%s'.", ce->entry, buf, argv[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eet_data_write(ef, _edje_edd_edje_file, "edje/file", nef, 1) <= 0)
|
if (eet_data_write(ef, _edje_edd_edje_file, "edje/file", nef, 1) <= 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Unable to save main section of `%s'.", argv[1]);
|
EINA_LOG_ERR("Unable to save main section of `%s'.", argv[1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_edje_alias_string(argv[1], ef, "fonts", "edje/fonts");
|
_edje_alias_string(argv[1], ef, "fonts", "edje/fonts");
|
||||||
|
@ -205,3 +205,4 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@ Eet_Data_Descriptor *_edje_edd_old_edje_part_description = NULL;
|
||||||
Eet_Data_Descriptor *_edje_edd_old_edje_part_image_id = NULL;
|
Eet_Data_Descriptor *_edje_edd_old_edje_part_image_id = NULL;
|
||||||
Eet_Data_Descriptor *_edje_edd_old_edje_external_param = NULL;
|
Eet_Data_Descriptor *_edje_edd_old_edje_external_param = NULL;
|
||||||
|
|
||||||
#define FREED(eed) \
|
#define FREED(eed) \
|
||||||
if (eed) \
|
if (eed) \
|
||||||
{ \
|
{ \
|
||||||
eet_data_descriptor_free((eed)); \
|
eet_data_descriptor_free((eed)); \
|
||||||
(eed) = NULL; \
|
(eed) = NULL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_edje_edd_old_shutdown(void)
|
_edje_edd_old_shutdown(void)
|
||||||
|
@ -74,8 +74,8 @@ _edje_edd_old_init(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_directory_entry, Edje_External_Directory_Entry, "entry", entry, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_external_directory_entry, Edje_External_Directory_Entry, "entry", entry, EET_T_STRING);
|
||||||
|
|
||||||
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
||||||
"Edje_External_Directory",
|
"Edje_External_Directory",
|
||||||
sizeof (Old_Edje_External_Directory));
|
sizeof (Old_Edje_External_Directory));
|
||||||
_edje_edd_old_edje_external_directory =
|
_edje_edd_old_edje_external_directory =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_old_edje_external_directory_entry);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_external_directory, Edje_External_Directory, "entries", entries, _edje_edd_old_edje_external_directory_entry);
|
||||||
|
@ -88,8 +88,8 @@ _edje_edd_old_init(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_font_directory_entry, Edje_Font_Directory_Entry, "file", file, EET_T_STRING);
|
||||||
|
|
||||||
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
||||||
"Edje_Font_Directory",
|
"Edje_Font_Directory",
|
||||||
sizeof (Old_Edje_Font_Directory));
|
sizeof (Old_Edje_Font_Directory));
|
||||||
_edje_edd_old_edje_font_directory =
|
_edje_edd_old_edje_font_directory =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_font_directory, Old_Edje_Font_Directory, "entries", entries, _edje_edd_old_edje_font_directory_entry);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_font_directory, Old_Edje_Font_Directory, "entries", entries, _edje_edd_old_edje_font_directory_entry);
|
||||||
|
@ -117,12 +117,12 @@ _edje_edd_old_init(void)
|
||||||
_edje_edd_old_edje_image_directory_set =
|
_edje_edd_old_edje_image_directory_set =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "name", name, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "name", name, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "id", id, EET_T_INT);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_old_edje_image_directory_set_entry);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory_set, Edje_Image_Directory_Set, "entries", entries, _edje_edd_old_edje_image_directory_set_entry);
|
||||||
|
|
||||||
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
||||||
"Edje_Image_Directory",
|
"Edje_Image_Directory",
|
||||||
sizeof (Old_Edje_Image_Directory));
|
sizeof (Old_Edje_Image_Directory));
|
||||||
_edje_edd_old_edje_image_directory =
|
_edje_edd_old_edje_image_directory =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory, Old_Edje_Image_Directory, "entries", entries, _edje_edd_old_edje_image_directory_entry);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_image_directory, Old_Edje_Image_Directory, "entries", entries, _edje_edd_old_edje_image_directory_entry);
|
||||||
|
@ -136,15 +136,15 @@ _edje_edd_old_init(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "id", id, EET_T_INT);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part_collection_directory_entry, Edje_Part_Collection_Directory_Entry, "id", id, EET_T_INT);
|
||||||
|
|
||||||
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
||||||
"Edje_Part_Collection_Directory",
|
"Edje_Part_Collection_Directory",
|
||||||
sizeof (Old_Edje_Part_Collection_Directory));
|
sizeof (Old_Edje_Part_Collection_Directory));
|
||||||
_edje_edd_old_edje_part_collection_directory =
|
_edje_edd_old_edje_part_collection_directory =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection_directory, Old_Edje_Part_Collection_Directory, "entries", entries, _edje_edd_old_edje_part_collection_directory_entry);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection_directory, Old_Edje_Part_Collection_Directory, "entries", entries, _edje_edd_old_edje_part_collection_directory_entry);
|
||||||
|
|
||||||
/* generic data attachment */
|
/* generic data attachment */
|
||||||
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
||||||
"Edje_Data", sizeof (Old_Edje_Data));
|
"Edje_Data", sizeof (Old_Edje_Data));
|
||||||
_edje_edd_old_edje_data =
|
_edje_edd_old_edje_data =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_data, Old_Edje_Data, "key", key, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_data, Old_Edje_Data, "key", key, EET_T_STRING);
|
||||||
|
@ -181,7 +181,7 @@ _edje_edd_old_init(void)
|
||||||
|
|
||||||
/* the main file directory */
|
/* the main file directory */
|
||||||
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
|
||||||
"Edje_File", sizeof (Old_Edje_File));
|
"Edje_File", sizeof (Old_Edje_File));
|
||||||
_edje_edd_old_edje_file =
|
_edje_edd_old_edje_file =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "compiler", compiler, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_file, Old_Edje_File, "compiler", compiler, EET_T_STRING);
|
||||||
|
@ -364,7 +364,7 @@ _edje_edd_old_init(void)
|
||||||
|
|
||||||
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Pack_Element);
|
EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Edje_Pack_Element);
|
||||||
_edje_edd_old_edje_pack_element =
|
_edje_edd_old_edje_pack_element =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "type", type, EET_T_UCHAR);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "type", type, EET_T_UCHAR);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "name", name, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "name", name, EET_T_STRING);
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "source", source, EET_T_STRING);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_pack_element, Edje_Pack_Element, "source", source, EET_T_STRING);
|
||||||
|
@ -433,7 +433,7 @@ _edje_edd_old_init(void)
|
||||||
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "required", required, EET_T_UCHAR);
|
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "required", required, EET_T_UCHAR);
|
||||||
|
|
||||||
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part_Collection", sizeof (Old_Edje_Part_Collection));
|
eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Edje_Part_Collection", sizeof (Old_Edje_Part_Collection));
|
||||||
_edje_edd_old_edje_part_collection =
|
_edje_edd_old_edje_part_collection =
|
||||||
eet_data_descriptor_file_new(&eddc);
|
eet_data_descriptor_file_new(&eddc);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "programs", programs, _edje_edd_old_edje_program);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "programs", programs, _edje_edd_old_edje_program);
|
||||||
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "parts", parts, _edje_edd_old_edje_part);
|
EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part_collection, Old_Edje_Part_Collection, "parts", parts, _edje_edd_old_edje_part);
|
||||||
|
@ -449,8 +449,9 @@ _edje_edd_old_init(void)
|
||||||
Old_Edje_Part_Collection epc;
|
Old_Edje_Part_Collection epc;
|
||||||
|
|
||||||
eet_data_descriptor_element_add(_edje_edd_old_edje_part_collection,
|
eet_data_descriptor_element_add(_edje_edd_old_edje_part_collection,
|
||||||
"alias", EET_T_STRING, EET_G_HASH,
|
"alias", EET_T_STRING, EET_G_HASH,
|
||||||
(char *)(&(epc.alias)) - (char *)(&(epc)),
|
(char *)(&(epc.alias)) - (char *)(&(epc)),
|
||||||
0, /* 0, */NULL, NULL);
|
0, /* 0, */ NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
#include <Ecore_File.h>
|
#include <Ecore_File.h>
|
||||||
#include <Ecore_Evas.h>
|
#include <Ecore_Evas.h>
|
||||||
|
|
||||||
|
@ -38,7 +37,6 @@ void output(void);
|
||||||
static int compiler_cmd_is_sane(void);
|
static int compiler_cmd_is_sane(void);
|
||||||
static int root_filename_is_sane(void);
|
static int root_filename_is_sane(void);
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edje_cc_log_cb(const Eina_Log_Domain *d,
|
_edje_cc_log_cb(const Eina_Log_Domain *d,
|
||||||
Eina_Log_Level level,
|
Eina_Log_Level level,
|
||||||
|
@ -64,22 +62,27 @@ _edje_cc_log_cb(const Eina_Log_Domain *d,
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case EINA_LOG_LEVEL_CRITICAL:
|
case EINA_LOG_LEVEL_CRITICAL:
|
||||||
color = FOREGROUND_RED | FOREGROUND_INTENSITY;
|
color = FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_ERR:
|
case EINA_LOG_LEVEL_ERR:
|
||||||
color = FOREGROUND_RED;
|
color = FOREGROUND_RED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_WARN:
|
case EINA_LOG_LEVEL_WARN:
|
||||||
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_INFO:
|
case EINA_LOG_LEVEL_INFO:
|
||||||
color = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
color = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_DBG:
|
case EINA_LOG_LEVEL_DBG:
|
||||||
color = FOREGROUND_BLUE | FOREGROUND_INTENSITY;
|
color = FOREGROUND_BLUE | FOREGROUND_INTENSITY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
||||||
}
|
}
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,16 +91,19 @@ _edje_cc_log_cb(const Eina_Log_Domain *d,
|
||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case EINA_LOG_LEVEL_CRITICAL:
|
case EINA_LOG_LEVEL_CRITICAL:
|
||||||
prefix = "Critical. ";
|
prefix = "Critical. ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_ERR:
|
case EINA_LOG_LEVEL_ERR:
|
||||||
prefix = "Error. ";
|
prefix = "Error. ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EINA_LOG_LEVEL_WARN:
|
case EINA_LOG_LEVEL_WARN:
|
||||||
prefix = "Warning. ";
|
prefix = "Warning. ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
fprintf(stderr, "%s: %s", progname, prefix);
|
fprintf(stderr, "%s: %s", progname, prefix);
|
||||||
|
|
||||||
|
@ -111,7 +117,6 @@ _edje_cc_log_cb(const Eina_Log_Domain *d,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vfprintf(stderr, fmt, args);
|
vfprintf(stderr, fmt, args);
|
||||||
putc('\n', stderr);
|
putc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +137,7 @@ main_help(void)
|
||||||
" -current-dir\tOutput to current directory \n"
|
" -current-dir\tOutput to current directory \n"
|
||||||
" -quiet\t\tProduce less output\n"
|
" -quiet\t\tProduce less output\n"
|
||||||
"\n"
|
"\n"
|
||||||
,progname);
|
, progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
Eet_File *ef;
|
Eet_File *ef;
|
||||||
|
@ -150,12 +155,12 @@ main(int argc, char **argv)
|
||||||
if (!eina_init())
|
if (!eina_init())
|
||||||
exit(-1);
|
exit(-1);
|
||||||
_edje_cc_log_dom = eina_log_domain_register
|
_edje_cc_log_dom = eina_log_domain_register
|
||||||
("edje_decc", EDJE_CC_DEFAULT_LOG_COLOR);
|
("edje_decc", EDJE_CC_DEFAULT_LOG_COLOR);
|
||||||
if (_edje_cc_log_dom < 0)
|
if (_edje_cc_log_dom < 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_ERR("Impossible to create a log domain.");
|
EINA_LOG_ERR("Impossible to create a log domain.");
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
progname = ecore_file_file_get(argv[0]);
|
progname = ecore_file_file_get(argv[0]);
|
||||||
eina_log_print_cb_set(_edje_cc_log_cb, NULL);
|
eina_log_print_cb_set(_edje_cc_log_cb, NULL);
|
||||||
|
@ -163,37 +168,37 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp(argv[i], "-h"))
|
if (!strcmp(argv[i], "-h"))
|
||||||
{
|
{
|
||||||
main_help();
|
main_help();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if (!file_in)
|
if (!file_in)
|
||||||
file_in = argv[i];
|
file_in = argv[i];
|
||||||
else if ((!strcmp(argv[i], "-main-out")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-main-out")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
file_out = argv[i];
|
file_out = argv[i];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "-no-build-sh"))
|
else if (!strcmp(argv[i], "-no-build-sh"))
|
||||||
build_sh = 0;
|
build_sh = 0;
|
||||||
else if (!strcmp(argv[i], "-current-dir"))
|
else if (!strcmp(argv[i], "-current-dir"))
|
||||||
new_dir = 0;
|
new_dir = 0;
|
||||||
else if (!strcmp(argv[i], "-quiet"))
|
else if (!strcmp(argv[i], "-quiet"))
|
||||||
eina_log_domain_level_set("edje_decc", EINA_LOG_LEVEL_WARN);
|
eina_log_domain_level_set("edje_decc", EINA_LOG_LEVEL_WARN);
|
||||||
else if ((!strcmp(argv[i], "-o") || !strcmp(argv[i], "-output")) && (i < (argc - 1)))
|
else if ((!strcmp(argv[i], "-o") || !strcmp(argv[i], "-output")) && (i < (argc - 1)))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
outdir = strdup(argv[i]);
|
outdir = strdup(argv[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!file_in)
|
if (!file_in)
|
||||||
{
|
{
|
||||||
ERR("no input file specified.");
|
ERR("no input file specified.");
|
||||||
main_help();
|
main_help();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!edje_init())
|
if (!edje_init())
|
||||||
|
@ -220,41 +225,41 @@ decomp(void)
|
||||||
ef = eet_open(file_in, EET_FILE_MODE_READ);
|
ef = eet_open(file_in, EET_FILE_MODE_READ);
|
||||||
if (!ef)
|
if (!ef)
|
||||||
{
|
{
|
||||||
ERR("cannot open %s", file_in);
|
ERR("cannot open %s", file_in);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcfiles = source_load(ef);
|
srcfiles = source_load(ef);
|
||||||
if (!srcfiles || !srcfiles->list)
|
if (!srcfiles || !srcfiles->list)
|
||||||
{
|
{
|
||||||
ERR("%s has no decompile information", file_in);
|
ERR("%s has no decompile information", file_in);
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!eina_list_data_get(srcfiles->list) || !root_filename_is_sane())
|
if (!eina_list_data_get(srcfiles->list) || !root_filename_is_sane())
|
||||||
{
|
{
|
||||||
ERR("Invalid root filename: '%s'", (char *) eina_list_data_get(srcfiles->list));
|
ERR("Invalid root filename: '%s'", (char *)eina_list_data_get(srcfiles->list));
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
edje_file = eet_data_read(ef, _edje_edd_edje_file, "edje/file");
|
edje_file = eet_data_read(ef, _edje_edd_edje_file, "edje/file");
|
||||||
if (!edje_file)
|
if (!edje_file)
|
||||||
{
|
{
|
||||||
ERR("%s does not appear to be an edje file", file_in);
|
ERR("%s does not appear to be an edje file", file_in);
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* force compiler to be edje_cc */
|
/* force compiler to be edje_cc */
|
||||||
edje_file->compiler = strdup("edje_cc");
|
edje_file->compiler = strdup("edje_cc");
|
||||||
if (!edje_file->compiler)
|
if (!edje_file->compiler)
|
||||||
{
|
{
|
||||||
edje_file->compiler = strdup("edje_cc");
|
edje_file->compiler = strdup("edje_cc");
|
||||||
}
|
}
|
||||||
else if (!compiler_cmd_is_sane())
|
else if (!compiler_cmd_is_sane())
|
||||||
{
|
{
|
||||||
ERR("invalid compiler executable: '%s'", edje_file->compiler);
|
ERR("invalid compiler executable: '%s'", edje_file->compiler);
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
fontlist = source_fontmap_load(ef);
|
fontlist = source_fontmap_load(ef);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -270,122 +275,121 @@ output(void)
|
||||||
|
|
||||||
if (!outdir)
|
if (!outdir)
|
||||||
{
|
{
|
||||||
if (!new_dir)
|
if (!new_dir)
|
||||||
outdir = strdup(".");
|
outdir = strdup(".");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p = strrchr(file_in, '/');
|
p = strrchr(file_in, '/');
|
||||||
if (p)
|
if (p)
|
||||||
outdir = strdup(p + 1);
|
outdir = strdup(p + 1);
|
||||||
else
|
else
|
||||||
outdir = strdup(file_in);
|
outdir = strdup(file_in);
|
||||||
p = strrchr(outdir, '.');
|
p = strrchr(outdir, '.');
|
||||||
if (p) *p = 0;
|
if (p) *p = 0;
|
||||||
ecore_file_mkpath(outdir);
|
ecore_file_mkpath(outdir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tef = eet_open(file_in, EET_FILE_MODE_READ);
|
tef = eet_open(file_in, EET_FILE_MODE_READ);
|
||||||
|
|
||||||
if (edje_file->image_dir)
|
if (edje_file->image_dir)
|
||||||
{
|
{
|
||||||
Edje_Image_Directory_Entry *ei;
|
Edje_Image_Directory_Entry *ei;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < edje_file->image_dir->entries_count; ++i)
|
for (i = 0; i < edje_file->image_dir->entries_count; ++i)
|
||||||
{
|
{
|
||||||
ei = &edje_file->image_dir->entries[i];
|
ei = &edje_file->image_dir->entries[i];
|
||||||
|
|
||||||
if ((ei->source_type > EDJE_IMAGE_SOURCE_TYPE_NONE) &&
|
if ((ei->source_type > EDJE_IMAGE_SOURCE_TYPE_NONE) &&
|
||||||
(ei->source_type < EDJE_IMAGE_SOURCE_TYPE_LAST) &&
|
(ei->source_type < EDJE_IMAGE_SOURCE_TYPE_LAST) &&
|
||||||
(ei->source_type != EDJE_IMAGE_SOURCE_TYPE_USER) &&
|
(ei->source_type != EDJE_IMAGE_SOURCE_TYPE_USER) &&
|
||||||
(ei->entry))
|
(ei->entry))
|
||||||
{
|
{
|
||||||
Ecore_Evas *ee;
|
Ecore_Evas *ee;
|
||||||
Evas *evas;
|
Evas *evas;
|
||||||
Evas_Object *im;
|
Evas_Object *im;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
char out[4096];
|
char out[4096];
|
||||||
char *pp;
|
char *pp;
|
||||||
|
|
||||||
ecore_init();
|
ecore_init();
|
||||||
ecore_evas_init();
|
ecore_evas_init();
|
||||||
ee = ecore_evas_buffer_new(1, 1);
|
ee = ecore_evas_buffer_new(1, 1);
|
||||||
if (!ee)
|
if (!ee)
|
||||||
{
|
{
|
||||||
ERR("Cannot create buffer engine canvas for image save.");
|
ERR("Cannot create buffer engine canvas for image save.");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
evas = ecore_evas_get(ee);
|
evas = ecore_evas_get(ee);
|
||||||
im = evas_object_image_add(evas);
|
im = evas_object_image_add(evas);
|
||||||
if (!im)
|
if (!im)
|
||||||
{
|
{
|
||||||
ERR("Cannot create image object for save.");
|
ERR("Cannot create image object for save.");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
snprintf(buf, sizeof(buf), "edje/images/%i", ei->id);
|
snprintf(buf, sizeof(buf), "edje/images/%i", ei->id);
|
||||||
evas_object_image_file_set(im, file_in, buf);
|
evas_object_image_file_set(im, file_in, buf);
|
||||||
snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
|
snprintf(out, sizeof(out), "%s/%s", outdir, ei->entry);
|
||||||
INF("Output Image: %s", out);
|
INF("Output Image: %s", out);
|
||||||
pp = strdup(out);
|
pp = strdup(out);
|
||||||
p = strrchr(pp, '/');
|
p = strrchr(pp, '/');
|
||||||
if (p) *p = 0;
|
if (p) *p = 0;
|
||||||
if (strstr(pp, "../"))
|
if (strstr(pp, "../"))
|
||||||
{
|
{
|
||||||
ERR("Potential security violation. attempt to write in parent dir.");
|
ERR("Potential security violation. attempt to write in parent dir.");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ecore_file_mkpath(pp);
|
ecore_file_mkpath(pp);
|
||||||
free(pp);
|
free(pp);
|
||||||
if (!evas_object_image_save(im, out, NULL, "quality=100 compress=9 encoding=auto"))
|
if (!evas_object_image_save(im, out, NULL, "quality=100 compress=9 encoding=auto"))
|
||||||
{
|
{
|
||||||
ERR("Cannot write file %s. Perhaps missing JPEG or PNG saver modules for Evas.", out);
|
ERR("Cannot write file %s. Perhaps missing JPEG or PNG saver modules for Evas.", out);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
evas_object_del(im);
|
evas_object_del(im);
|
||||||
ecore_evas_free(ee);
|
ecore_evas_free(ee);
|
||||||
ecore_evas_shutdown();
|
ecore_evas_shutdown();
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(srcfiles->list, l, sf)
|
EINA_LIST_FOREACH(srcfiles->list, l, sf)
|
||||||
{
|
{
|
||||||
char out[4096];
|
char out[4096];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *pp;
|
char *pp;
|
||||||
|
|
||||||
snprintf(out, sizeof(out), "%s/%s", outdir, sf->name);
|
snprintf(out, sizeof(out), "%s/%s", outdir, sf->name);
|
||||||
INF("Output Source File: %s", out);
|
INF("Output Source File: %s", out);
|
||||||
pp = strdup(out);
|
pp = strdup(out);
|
||||||
p = strrchr(pp, '/');
|
p = strrchr(pp, '/');
|
||||||
if (p) *p = 0;
|
if (p) *p = 0;
|
||||||
if (strstr(pp, "../"))
|
if (strstr(pp, "../"))
|
||||||
{
|
{
|
||||||
ERR("Potential security violation. attempt to write in parent dir.");
|
ERR("Potential security violation. attempt to write in parent dir.");
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ecore_file_mkpath(pp);
|
ecore_file_mkpath(pp);
|
||||||
free(pp);
|
free(pp);
|
||||||
if (strstr(out, "../"))
|
if (strstr(out, "../"))
|
||||||
{
|
{
|
||||||
ERR("Potential security violation. attempt to write in parent dir.");
|
ERR("Potential security violation. attempt to write in parent dir.");
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
f = fopen(out, "wb");
|
f = fopen(out, "wb");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
ERR("Unable to write file (%s).", out);
|
ERR("Unable to write file (%s).", out);
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the file is empty, sf->file will be NULL.
|
/* if the file is empty, sf->file will be NULL.
|
||||||
* note that that's not an error
|
* note that that's not an error
|
||||||
*/
|
*/
|
||||||
if (sf->file) fputs(sf->file, f);
|
if (sf->file) fputs(sf->file, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
if (edje_file->fonts)
|
if (edje_file->fonts)
|
||||||
{
|
{
|
||||||
|
@ -393,93 +397,91 @@ output(void)
|
||||||
Eina_Iterator *it;
|
Eina_Iterator *it;
|
||||||
|
|
||||||
it = eina_hash_iterator_data_new(edje_file->fonts);
|
it = eina_hash_iterator_data_new(edje_file->fonts);
|
||||||
EINA_ITERATOR_FOREACH(it, fn)
|
EINA_ITERATOR_FOREACH(it, fn)
|
||||||
{
|
{
|
||||||
void *font;
|
void *font;
|
||||||
int fontsize;
|
int fontsize;
|
||||||
char out[4096];
|
char out[4096];
|
||||||
/* FIXME!!!! */
|
/* FIXME!!!! */
|
||||||
/* should be fn->entry -v */
|
/* should be fn->entry -v */
|
||||||
snprintf(out, sizeof(out), "edje/fonts/%s", fn->file);
|
snprintf(out, sizeof(out), "edje/fonts/%s", fn->file);
|
||||||
font = eet_read(tef, out, &fontsize);
|
font = eet_read(tef, out, &fontsize);
|
||||||
if (font)
|
if (font)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *pp;
|
char *pp;
|
||||||
|
|
||||||
/* should be fn->file -v */
|
/* should be fn->file -v */
|
||||||
snprintf(out, sizeof(out), "%s/%s", outdir, fn->entry);
|
snprintf(out, sizeof(out), "%s/%s", outdir, fn->entry);
|
||||||
INF("Output Font: %s", out);
|
INF("Output Font: %s", out);
|
||||||
pp = strdup(out);
|
pp = strdup(out);
|
||||||
p = strrchr(pp, '/');
|
p = strrchr(pp, '/');
|
||||||
if (p) *p = 0;
|
if (p) *p = 0;
|
||||||
if (strstr(pp, "../"))
|
if (strstr(pp, "../"))
|
||||||
{
|
{
|
||||||
ERR("Potential security violation. attempt to write in parent dir.");
|
ERR("Potential security violation. attempt to write in parent dir.");
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
ecore_file_mkpath(pp);
|
ecore_file_mkpath(pp);
|
||||||
free(pp);
|
free(pp);
|
||||||
if (strstr(out, "../"))
|
if (strstr(out, "../"))
|
||||||
{
|
{
|
||||||
ERR("Potential security violation. attempt to write in parent dir.");
|
ERR("Potential security violation. attempt to write in parent dir.");
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (!(f = fopen(out, "wb")))
|
if (!(f = fopen(out, "wb")))
|
||||||
{
|
{
|
||||||
ERR("Could not open file: %s", out);
|
ERR("Could not open file: %s", out);
|
||||||
exit (-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if (fwrite(font, fontsize, 1, f) != 1)
|
if (fwrite(font, fontsize, 1, f) != 1)
|
||||||
ERR("Could not write font: %s", strerror(errno));
|
ERR("Could not write font: %s", strerror(errno));
|
||||||
if (f) fclose(f);
|
if (f) fclose(f);
|
||||||
free(font);
|
free(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char out[4096];
|
char out[4096];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
sf = eina_list_data_get(srcfiles->list);
|
sf = eina_list_data_get(srcfiles->list);
|
||||||
|
|
||||||
|
if (build_sh)
|
||||||
|
{
|
||||||
|
snprintf(out, sizeof(out), "%s/build.sh", outdir);
|
||||||
|
INF("Output Build Script: %s", out);
|
||||||
|
if (strstr(out, "../"))
|
||||||
|
{
|
||||||
|
ERR("potential security violation. attempt to write in parent dir.");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
if ((f = fopen(out, "wb")))
|
||||||
|
{
|
||||||
|
fprintf(f, "#!/bin/sh\n");
|
||||||
|
fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n",
|
||||||
|
edje_file->compiler, sf->name, outdir);
|
||||||
|
fclose(f);
|
||||||
|
if (chmod(out,
|
||||||
|
S_IRUSR | S_IWUSR | S_IXUSR |
|
||||||
|
S_IRGRP | S_IWGRP | S_IXGRP) < 0)
|
||||||
|
ERR("chmod on %s failed", out);
|
||||||
|
}
|
||||||
|
|
||||||
if (build_sh)
|
WRN("*** CAUTION ***\n"
|
||||||
{
|
"Please check the build script for anything malicious "
|
||||||
snprintf(out, sizeof(out), "%s/build.sh", outdir);
|
"before running it!\n\n");
|
||||||
INF("Output Build Script: %s", out);
|
}
|
||||||
if (strstr(out, "../"))
|
|
||||||
{
|
|
||||||
ERR("potential security violation. attempt to write in parent dir.");
|
|
||||||
exit (-1);
|
|
||||||
}
|
|
||||||
if ((f = fopen(out, "wb")))
|
|
||||||
{
|
|
||||||
fprintf(f, "#!/bin/sh\n");
|
|
||||||
fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n",
|
|
||||||
edje_file->compiler, sf->name, outdir);
|
|
||||||
fclose(f);
|
|
||||||
if (chmod(out,
|
|
||||||
S_IRUSR | S_IWUSR | S_IXUSR |
|
|
||||||
S_IRGRP | S_IWGRP | S_IXGRP) < 0)
|
|
||||||
ERR("chmod on %s failed", out);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRN("*** CAUTION ***\n"
|
if (file_out)
|
||||||
"Please check the build script for anything malicious "
|
{
|
||||||
"before running it!\n\n");
|
snprintf(out, sizeof(out), "%s/%s", outdir, file_out);
|
||||||
}
|
if (ecore_file_symlink(sf->name, out) != EINA_TRUE)
|
||||||
|
{
|
||||||
if (file_out)
|
ERR("symlink %s -> %s failed", sf->name, out);
|
||||||
{
|
}
|
||||||
snprintf(out, sizeof(out), "%s/%s", outdir, file_out);
|
}
|
||||||
if (ecore_file_symlink(sf->name, out) != EINA_TRUE)
|
}
|
||||||
{
|
|
||||||
ERR("symlink %s -> %s failed", sf->name, out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (edje_file->sound_dir)
|
if (edje_file->sound_dir)
|
||||||
{
|
{
|
||||||
|
@ -524,9 +526,8 @@ output(void)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
else ERR("Could not open for writing sound: %s: %s", out1, strerror(errno));
|
else ERR("Could not open for writing sound: %s: %s", out1, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (edje_file->vibration_dir)
|
if (edje_file->vibration_dir)
|
||||||
{
|
{
|
||||||
|
@ -571,7 +572,7 @@ output(void)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
else ERR("Could not open for writing sound: %s: %s", out1, strerror(errno));
|
else ERR("Could not open for writing sound: %s: %s", out1, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,16 +587,16 @@ compiler_cmd_is_sane()
|
||||||
|
|
||||||
if ((!c) || (!*c))
|
if ((!c) || (!*c))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ptr = c; ptr && *ptr; ptr++)
|
for (ptr = c; ptr && *ptr; ptr++)
|
||||||
{
|
{
|
||||||
/* only allow [a-z][A-Z][0-9]_- */
|
/* only allow [a-z][A-Z][0-9]_- */
|
||||||
if ((!isalnum(*ptr)) && (*ptr != '_') && (*ptr != '-'))
|
if ((!isalnum(*ptr)) && (*ptr != '_') && (*ptr != '-'))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -609,22 +610,27 @@ root_filename_is_sane()
|
||||||
|
|
||||||
if (!f || !*f)
|
if (!f || !*f)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ptr = f; ptr && *ptr; ptr++)
|
for (ptr = f; ptr && *ptr; ptr++)
|
||||||
{
|
{
|
||||||
/* only allow [a-z][A-Z][0-9]_-./ */
|
/* only allow [a-z][A-Z][0-9]_-./ */
|
||||||
switch (*ptr)
|
switch (*ptr)
|
||||||
{
|
{
|
||||||
case '_': case '-': case '.': case '/':
|
case '_':
|
||||||
break;
|
case '-':
|
||||||
default:
|
case '.':
|
||||||
if (!isalnum(*ptr))
|
case '/':
|
||||||
{
|
break;
|
||||||
return 0;
|
|
||||||
}
|
default:
|
||||||
}
|
if (!isalnum(*ptr))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ static int _log_dom;
|
||||||
#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
|
#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
|
||||||
#define CRI(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__)
|
#define CRI(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__)
|
||||||
|
|
||||||
#define INDENT " "
|
#define INDENT " "
|
||||||
#define INDENT2 INDENT INDENT
|
#define INDENT2 INDENT INDENT
|
||||||
#define INDENT3 INDENT2 INDENT
|
#define INDENT3 INDENT2 INDENT
|
||||||
#define INDENT4 INDENT3 INDENT
|
#define INDENT4 INDENT3 INDENT
|
||||||
|
@ -27,15 +27,14 @@ static char *module_patterns_str = NULL;
|
||||||
static int detail = 1;
|
static int detail = 1;
|
||||||
static Eina_Bool machine = EINA_FALSE;
|
static Eina_Bool machine = EINA_FALSE;
|
||||||
static char *type_glob = NULL;
|
static char *type_glob = NULL;
|
||||||
static char * const *module_patterns;
|
static char *const *module_patterns;
|
||||||
static const Eina_List *modules;
|
static const Eina_List *modules;
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
_module_patterns_str_new(void)
|
_module_patterns_str_new(void)
|
||||||
{
|
{
|
||||||
Eina_Strbuf *buf;
|
Eina_Strbuf *buf;
|
||||||
char * const *itr;
|
char *const *itr;
|
||||||
char *ret;
|
char *ret;
|
||||||
if (!module_patterns) return strdup("*");
|
if (!module_patterns) return strdup("*");
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ _module_patterns_str_new(void)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
module_matches(const char *name)
|
module_matches(const char *name)
|
||||||
{
|
{
|
||||||
char * const *itr;
|
char *const *itr;
|
||||||
if (!module_patterns) return EINA_TRUE;
|
if (!module_patterns) return EINA_TRUE;
|
||||||
|
|
||||||
for (itr = module_patterns; *itr != NULL; itr++)
|
for (itr = module_patterns; *itr != NULL; itr++)
|
||||||
|
@ -93,13 +92,18 @@ _param_type_str_get(const Edje_External_Param_Info *param)
|
||||||
switch (param->type)
|
switch (param->type)
|
||||||
{
|
{
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_INT: return "int";
|
case EDJE_EXTERNAL_PARAM_TYPE_INT: return "int";
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: return "double";
|
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE: return "double";
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_STRING: return "string";
|
case EDJE_EXTERNAL_PARAM_TYPE_STRING: return "string";
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_BOOL: return "bool";
|
case EDJE_EXTERNAL_PARAM_TYPE_BOOL: return "bool";
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: return "choice";
|
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE: return "choice";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("Unknown parameter type %d", param->type);
|
ERR("Unknown parameter type %d", param->type);
|
||||||
return "???";
|
return "???";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,38 +113,39 @@ _param_value_str_get(const Edje_External_Type *type, const Edje_External_Param_I
|
||||||
switch (param->type)
|
switch (param->type)
|
||||||
{
|
{
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||||
if (param->info.i.def == EDJE_EXTERNAL_INT_UNSET) return NULL;
|
if (param->info.i.def == EDJE_EXTERNAL_INT_UNSET) return NULL;
|
||||||
snprintf(buf, buflen, "%d", param->info.i.def);
|
snprintf(buf, buflen, "%d", param->info.i.def);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||||
if (EINA_DBL_EQ(param->info.d.def, EDJE_EXTERNAL_DOUBLE_UNSET)) return NULL;
|
if (EINA_DBL_EQ(param->info.d.def, EDJE_EXTERNAL_DOUBLE_UNSET)) return NULL;
|
||||||
snprintf(buf, buflen, "%g", param->info.d.def);
|
snprintf(buf, buflen, "%g", param->info.d.def);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||||
return param->info.s.def;
|
return param->info.s.def;
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||||
if (param->info.b.def == 0) return "0";
|
if (param->info.b.def == 0) return "0";
|
||||||
else if (param->info.b.def == 1) return "1";
|
else if (param->info.b.def == 1)
|
||||||
return NULL;
|
return "1";
|
||||||
|
return NULL;
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||||
{
|
{
|
||||||
char *def;
|
char *def;
|
||||||
if (param->info.c.def) return param->info.c.def;
|
if (param->info.c.def) return param->info.c.def;
|
||||||
if (!param->info.c.def_get) return NULL;
|
if (!param->info.c.def_get) return NULL;
|
||||||
def = param->info.c.def_get(type->data, param);
|
def = param->info.c.def_get(type->data, param);
|
||||||
if (!def) return NULL;
|
if (!def) return NULL;
|
||||||
eina_strlcpy(buf, def, buflen);
|
eina_strlcpy(buf, def, buflen);
|
||||||
free(def);
|
free(def);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("Unknown parameter type %d", param->type);
|
ERR("Unknown parameter type %d", param->type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +184,7 @@ _param_flags_str_get(const Edje_External_Param_Info *param)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_param_choices_print(const char * const *choices)
|
_param_choices_print(const char *const *choices)
|
||||||
{
|
{
|
||||||
if (machine) puts("CHOICES-BEGIN");
|
if (machine) puts("CHOICES-BEGIN");
|
||||||
else fputs(", choices:", stdout);
|
else fputs(", choices:", stdout);
|
||||||
|
@ -201,90 +206,91 @@ _param_extra_details(const Edje_External_Type *type, const Edje_External_Param_I
|
||||||
switch (param->type)
|
switch (param->type)
|
||||||
{
|
{
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
case EDJE_EXTERNAL_PARAM_TYPE_INT:
|
||||||
if (param->info.i.min != EDJE_EXTERNAL_INT_UNSET)
|
if (param->info.i.min != EDJE_EXTERNAL_INT_UNSET)
|
||||||
{
|
{
|
||||||
if (machine) printf("MIN: %d\n", param->info.i.min);
|
if (machine) printf("MIN: %d\n", param->info.i.min);
|
||||||
else printf(", min: %d", param->info.i.min);
|
else printf(", min: %d", param->info.i.min);
|
||||||
}
|
}
|
||||||
if (param->info.i.max != EDJE_EXTERNAL_INT_UNSET)
|
if (param->info.i.max != EDJE_EXTERNAL_INT_UNSET)
|
||||||
{
|
{
|
||||||
if (machine) printf("MAX: %d\n", param->info.i.max);
|
if (machine) printf("MAX: %d\n", param->info.i.max);
|
||||||
else printf(", max: %d", param->info.i.max);
|
else printf(", max: %d", param->info.i.max);
|
||||||
}
|
}
|
||||||
if (param->info.i.step != EDJE_EXTERNAL_INT_UNSET)
|
if (param->info.i.step != EDJE_EXTERNAL_INT_UNSET)
|
||||||
{
|
{
|
||||||
if (machine) printf("STEP: %d\n", param->info.i.step);
|
if (machine) printf("STEP: %d\n", param->info.i.step);
|
||||||
else printf(", step: %d", param->info.i.step);
|
else printf(", step: %d", param->info.i.step);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
|
||||||
if (EINA_DBL_EQ(param->info.d.min, EDJE_EXTERNAL_DOUBLE_UNSET))
|
|
||||||
{
|
|
||||||
if (machine) printf("MIN: %g\n", param->info.d.min);
|
|
||||||
else printf(", min: %g", param->info.d.min);
|
|
||||||
}
|
|
||||||
if (EINA_DBL_EQ(param->info.d.max, EDJE_EXTERNAL_DOUBLE_UNSET))
|
|
||||||
{
|
|
||||||
if (machine) printf("MAX: %g\n", param->info.d.max);
|
|
||||||
else printf(", max: %g", param->info.d.max);
|
|
||||||
}
|
|
||||||
if (EINA_DBL_EQ(param->info.d.step, EDJE_EXTERNAL_DOUBLE_UNSET))
|
|
||||||
{
|
|
||||||
if (machine) printf("STEP: %g\n", param->info.d.step);
|
|
||||||
else printf(", step: %g", param->info.d.step);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
|
||||||
if (param->info.s.accept_fmt)
|
|
||||||
{
|
|
||||||
if (machine) printf("ACCEPT_FMT: %s\n", param->info.s.accept_fmt);
|
|
||||||
else printf(", accept_fmt: \"%s\"", param->info.s.accept_fmt);
|
|
||||||
}
|
|
||||||
if (param->info.s.deny_fmt)
|
|
||||||
{
|
|
||||||
if (machine) printf("DENY_FMT: %s\n", param->info.s.deny_fmt);
|
|
||||||
else printf(", deny_fmt: \"%s\"", param->info.s.deny_fmt);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
|
||||||
if (param->info.b.false_str)
|
|
||||||
{
|
|
||||||
if (machine) printf("FALSE_STR: %s\n", param->info.b.false_str);
|
|
||||||
else printf(", false_str: \"%s\"", param->info.b.false_str);
|
|
||||||
}
|
|
||||||
if (param->info.b.true_str)
|
|
||||||
{
|
|
||||||
if (machine) printf("TRUE_STR: %s\n", param->info.b.true_str);
|
|
||||||
else printf(", true_str: \"%s\"", param->info.b.true_str);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
|
||||||
{
|
|
||||||
if (param->info.c.choices)
|
|
||||||
_param_choices_print(param->info.c.choices);
|
|
||||||
else if (param->info.c.query)
|
|
||||||
{
|
|
||||||
char **choices = param->info.c.query(type->data, param);
|
|
||||||
if (choices)
|
|
||||||
{
|
|
||||||
char **itr;
|
|
||||||
_param_choices_print((const char * const*)choices);
|
|
||||||
for (itr = choices; *itr; itr++) free(*itr);
|
|
||||||
free(choices);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EDJE_EXTERNAL_PARAM_TYPE_DOUBLE:
|
||||||
|
if (EINA_DBL_EQ(param->info.d.min, EDJE_EXTERNAL_DOUBLE_UNSET))
|
||||||
|
{
|
||||||
|
if (machine) printf("MIN: %g\n", param->info.d.min);
|
||||||
|
else printf(", min: %g", param->info.d.min);
|
||||||
|
}
|
||||||
|
if (EINA_DBL_EQ(param->info.d.max, EDJE_EXTERNAL_DOUBLE_UNSET))
|
||||||
|
{
|
||||||
|
if (machine) printf("MAX: %g\n", param->info.d.max);
|
||||||
|
else printf(", max: %g", param->info.d.max);
|
||||||
|
}
|
||||||
|
if (EINA_DBL_EQ(param->info.d.step, EDJE_EXTERNAL_DOUBLE_UNSET))
|
||||||
|
{
|
||||||
|
if (machine) printf("STEP: %g\n", param->info.d.step);
|
||||||
|
else printf(", step: %g", param->info.d.step);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EDJE_EXTERNAL_PARAM_TYPE_STRING:
|
||||||
|
if (param->info.s.accept_fmt)
|
||||||
|
{
|
||||||
|
if (machine) printf("ACCEPT_FMT: %s\n", param->info.s.accept_fmt);
|
||||||
|
else printf(", accept_fmt: \"%s\"", param->info.s.accept_fmt);
|
||||||
|
}
|
||||||
|
if (param->info.s.deny_fmt)
|
||||||
|
{
|
||||||
|
if (machine) printf("DENY_FMT: %s\n", param->info.s.deny_fmt);
|
||||||
|
else printf(", deny_fmt: \"%s\"", param->info.s.deny_fmt);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EDJE_EXTERNAL_PARAM_TYPE_BOOL:
|
||||||
|
if (param->info.b.false_str)
|
||||||
|
{
|
||||||
|
if (machine) printf("FALSE_STR: %s\n", param->info.b.false_str);
|
||||||
|
else printf(", false_str: \"%s\"", param->info.b.false_str);
|
||||||
|
}
|
||||||
|
if (param->info.b.true_str)
|
||||||
|
{
|
||||||
|
if (machine) printf("TRUE_STR: %s\n", param->info.b.true_str);
|
||||||
|
else printf(", true_str: \"%s\"", param->info.b.true_str);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EDJE_EXTERNAL_PARAM_TYPE_CHOICE:
|
||||||
|
{
|
||||||
|
if (param->info.c.choices)
|
||||||
|
_param_choices_print(param->info.c.choices);
|
||||||
|
else if (param->info.c.query)
|
||||||
|
{
|
||||||
|
char **choices = param->info.c.query(type->data, param);
|
||||||
|
if (choices)
|
||||||
|
{
|
||||||
|
char **itr;
|
||||||
|
_param_choices_print((const char *const *)choices);
|
||||||
|
for (itr = choices; *itr; itr++)
|
||||||
|
free(*itr);
|
||||||
|
free(choices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("Unknown parameter type %d", param->type);
|
ERR("Unknown parameter type %d", param->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!machine) fputs(" */", stdout); /* \n not desired */
|
if (!machine) fputs(" */", stdout); /* \n not desired */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -397,12 +403,14 @@ _info_list(void)
|
||||||
if (!type->label_get) str = NULL;
|
if (!type->label_get) str = NULL;
|
||||||
else str = type->label_get(type->data);
|
else str = type->label_get(type->data);
|
||||||
if (machine) printf("LABEL: %s\n", str ? str : "");
|
if (machine) printf("LABEL: %s\n", str ? str : "");
|
||||||
else if (str) printf(INDENT3 "label: \"%s\";\n", str);
|
else if (str)
|
||||||
|
printf(INDENT3 "label: \"%s\";\n", str);
|
||||||
|
|
||||||
if (!type->description_get) str = NULL;
|
if (!type->description_get) str = NULL;
|
||||||
else str = type->description_get(type->data);
|
else str = type->description_get(type->data);
|
||||||
if (machine) printf("DESCRIPTION: %s\n", str ? str : "");
|
if (machine) printf("DESCRIPTION: %s\n", str ? str : "");
|
||||||
else if (str) printf(INDENT3 "description: \"%s\";\n", str);
|
else if (str)
|
||||||
|
printf(INDENT3 "description: \"%s\";\n", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (machine) puts("PARAMS-BEGIN");
|
if (machine) puts("PARAMS-BEGIN");
|
||||||
|
@ -420,9 +428,10 @@ _info_list(void)
|
||||||
if (detail > 0)
|
if (detail > 0)
|
||||||
{
|
{
|
||||||
const char *str = _param_value_str_get
|
const char *str = _param_value_str_get
|
||||||
(type, param, buf, sizeof(buf));
|
(type, param, buf, sizeof(buf));
|
||||||
if (machine) printf("DEFAULT: %s\n", str ? str : "");
|
if (machine) printf("DEFAULT: %s\n", str ? str : "");
|
||||||
else if (str) printf(" \"%s\"", str);
|
else if (str)
|
||||||
|
printf(" \"%s\"", str);
|
||||||
|
|
||||||
if (detail > 1)
|
if (detail > 1)
|
||||||
{
|
{
|
||||||
|
@ -432,7 +441,8 @@ _info_list(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (machine) puts("PARAM-END");
|
if (machine) puts("PARAM-END");
|
||||||
else if (detail > 1) putchar('\n');
|
else if (detail > 1)
|
||||||
|
putchar('\n');
|
||||||
else puts(";");
|
else puts(";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,40 +554,40 @@ _modules_names_list(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *mode_choices[] = {
|
static const char *mode_choices[] = {
|
||||||
"info",
|
"info",
|
||||||
"modules-names",
|
"modules-names",
|
||||||
"types-names",
|
"types-names",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *detail_choices[] = {
|
static const char *detail_choices[] = {
|
||||||
"none",
|
"none",
|
||||||
"terse",
|
"terse",
|
||||||
"all",
|
"all",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
const Ecore_Getopt optdesc = {
|
const Ecore_Getopt optdesc = {
|
||||||
"edje_external_inspector",
|
"edje_external_inspector",
|
||||||
"%prog [options] [module|module-glob] ... [module|module-glob]",
|
"%prog [options] [module|module-glob] ... [module|module-glob]",
|
||||||
PACKAGE_VERSION,
|
PACKAGE_VERSION,
|
||||||
"(C) 2010 - The Enlightenment Project",
|
"(C) 2010 - The Enlightenment Project",
|
||||||
"BSD",
|
"BSD",
|
||||||
"Edje external module inspector.",
|
"Edje external module inspector.",
|
||||||
0,
|
0,
|
||||||
{
|
{
|
||||||
ECORE_GETOPT_CHOICE('m', "mode", "Choose which mode to operate.",
|
ECORE_GETOPT_CHOICE('m', "mode", "Choose which mode to operate.",
|
||||||
mode_choices),
|
mode_choices),
|
||||||
ECORE_GETOPT_STORE_STR('t', "type", "Limit output to type (or glob)."),
|
ECORE_GETOPT_STORE_STR('t', "type", "Limit output to type (or glob)."),
|
||||||
ECORE_GETOPT_CHOICE('d', "detail", "Choose detail level (default=terse)",
|
ECORE_GETOPT_CHOICE('d', "detail", "Choose detail level (default=terse)",
|
||||||
detail_choices),
|
detail_choices),
|
||||||
ECORE_GETOPT_STORE_TRUE('M', "machine", "Produce machine readable output."),
|
ECORE_GETOPT_STORE_TRUE('M', "machine", "Produce machine readable output."),
|
||||||
ECORE_GETOPT_LICENSE('L', "license"),
|
ECORE_GETOPT_LICENSE('L', "license"),
|
||||||
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
|
ECORE_GETOPT_COPYRIGHT('C', "copyright"),
|
||||||
ECORE_GETOPT_VERSION('V', "version"),
|
ECORE_GETOPT_VERSION('V', "version"),
|
||||||
ECORE_GETOPT_HELP('h', "help"),
|
ECORE_GETOPT_HELP('h', "help"),
|
||||||
ECORE_GETOPT_SENTINEL
|
ECORE_GETOPT_SENTINEL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -589,15 +599,15 @@ main(int argc, char **argv)
|
||||||
int arg_index;
|
int arg_index;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
Ecore_Getopt_Value values[] = {
|
Ecore_Getopt_Value values[] = {
|
||||||
ECORE_GETOPT_VALUE_STR(mode),
|
ECORE_GETOPT_VALUE_STR(mode),
|
||||||
ECORE_GETOPT_VALUE_STR(type_glob),
|
ECORE_GETOPT_VALUE_STR(type_glob),
|
||||||
ECORE_GETOPT_VALUE_STR(detail_name),
|
ECORE_GETOPT_VALUE_STR(detail_name),
|
||||||
ECORE_GETOPT_VALUE_BOOL(machine),
|
ECORE_GETOPT_VALUE_BOOL(machine),
|
||||||
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
||||||
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
||||||
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
||||||
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
ECORE_GETOPT_VALUE_BOOL(quit_option),
|
||||||
ECORE_GETOPT_VALUE_NONE
|
ECORE_GETOPT_VALUE_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
|
@ -609,7 +619,7 @@ main(int argc, char **argv)
|
||||||
edje_init();
|
edje_init();
|
||||||
|
|
||||||
_log_dom = eina_log_domain_register
|
_log_dom = eina_log_domain_register
|
||||||
("edje_external_inspector", EINA_COLOR_YELLOW);
|
("edje_external_inspector", EINA_COLOR_YELLOW);
|
||||||
if (_log_dom < 0)
|
if (_log_dom < 0)
|
||||||
{
|
{
|
||||||
EINA_LOG_CRIT
|
EINA_LOG_CRIT
|
||||||
|
@ -625,27 +635,32 @@ main(int argc, char **argv)
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto error_getopt;
|
goto error_getopt;
|
||||||
}
|
}
|
||||||
else if (quit_option) goto error_getopt;
|
else if (quit_option)
|
||||||
|
goto error_getopt;
|
||||||
|
|
||||||
if (!mode) mode = (char *)mode_choices[0];
|
if (!mode) mode = (char *)mode_choices[0];
|
||||||
|
|
||||||
if (detail_name)
|
if (detail_name)
|
||||||
{
|
{
|
||||||
if (!strcmp(detail_name, "none")) detail = 0;
|
if (!strcmp(detail_name, "none")) detail = 0;
|
||||||
else if (!strcmp(detail_name, "terse")) detail = 1;
|
else if (!strcmp(detail_name, "terse"))
|
||||||
else if (!strcmp(detail_name, "all")) detail = 2;
|
detail = 1;
|
||||||
|
else if (!strcmp(detail_name, "all"))
|
||||||
|
detail = 2;
|
||||||
else ERR("Unknown detail level: '%s'", detail_name);
|
else ERR("Unknown detail level: '%s'", detail_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_index < argc) module_patterns = argv + arg_index;
|
if (arg_index < argc) module_patterns = argv + arg_index;
|
||||||
else module_patterns = NULL;
|
else module_patterns = NULL;
|
||||||
|
|
||||||
modules = edje_available_modules_get();
|
modules = edje_available_modules_get();
|
||||||
module_patterns_str = _module_patterns_str_new();
|
module_patterns_str = _module_patterns_str_new();
|
||||||
|
|
||||||
if (!strcmp(mode, "info")) ret = _info_list();
|
if (!strcmp(mode, "info")) ret = _info_list();
|
||||||
else if (!strcmp(mode, "modules-names")) ret = _modules_names_list();
|
else if (!strcmp(mode, "modules-names"))
|
||||||
else if (!strcmp(mode, "types-names")) ret = _types_names_list();
|
ret = _modules_names_list();
|
||||||
|
else if (!strcmp(mode, "types-names"))
|
||||||
|
ret = _types_names_list();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERR("Unknown mode: %s", mode);
|
ERR("Unknown mode: %s", mode);
|
||||||
|
@ -654,12 +669,13 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
free(module_patterns_str);
|
free(module_patterns_str);
|
||||||
|
|
||||||
error_getopt:
|
error_getopt:
|
||||||
eina_log_domain_unregister(_log_dom);
|
eina_log_domain_unregister(_log_dom);
|
||||||
error_log:
|
error_log:
|
||||||
edje_shutdown();
|
edje_shutdown();
|
||||||
ecore_shutdown();
|
ecore_shutdown();
|
||||||
eina_shutdown();
|
eina_shutdown();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,22 +15,22 @@ Edje_Sound_Encode *
|
||||||
_edje_multisense_encode(const char *filename, Edje_Sound_Sample *sample, double quality EINA_UNUSED)
|
_edje_multisense_encode(const char *filename, Edje_Sound_Sample *sample, double quality EINA_UNUSED)
|
||||||
{
|
{
|
||||||
SF_INFO sfinfo;
|
SF_INFO sfinfo;
|
||||||
SNDFILE* sfile;
|
SNDFILE *sfile;
|
||||||
Edje_Sound_Encode *enc_info;
|
Edje_Sound_Encode *enc_info;
|
||||||
|
|
||||||
enc_info = calloc(1, sizeof(Edje_Sound_Encode));
|
enc_info = calloc(1, sizeof(Edje_Sound_Encode));
|
||||||
if (!enc_info)
|
if (!enc_info)
|
||||||
{
|
{
|
||||||
ERR("while allocating memory to load file ");
|
ERR("while allocating memory to load file ");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
memset (&sfinfo, 0, sizeof (SF_INFO));
|
memset(&sfinfo, 0, sizeof (SF_INFO));
|
||||||
|
|
||||||
enc_info->encoded = EINA_FALSE;
|
enc_info->encoded = EINA_FALSE;
|
||||||
enc_info->comp_type = "RAW PCM";
|
enc_info->comp_type = "RAW PCM";
|
||||||
|
|
||||||
// Open wav file using sndfile
|
// Open wav file using sndfile
|
||||||
sfile = sf_open (filename, SFM_READ, &sfinfo);
|
sfile = sf_open(filename, SFM_READ, &sfinfo);
|
||||||
if (!sfile)
|
if (!sfile)
|
||||||
{
|
{
|
||||||
ERR("Unable to open audio file: %s", filename);
|
ERR("Unable to open audio file: %s", filename);
|
||||||
|
@ -82,7 +82,7 @@ _edje_multisense_encode(const char *filename, Edje_Sound_Sample *sample, double
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBFLAC
|
#ifdef HAVE_LIBFLAC
|
||||||
const char*
|
const char *
|
||||||
_edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo)
|
_edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo)
|
||||||
{
|
{
|
||||||
unsigned int total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
|
unsigned int total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
|
||||||
|
@ -164,14 +164,14 @@ _edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo)
|
||||||
ok = 0;
|
ok = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read blocks of samples from WAVE file and feed to encoder */
|
/* read blocks of samples from WAVE file and feed to encoder */
|
||||||
while (ok)
|
while (ok)
|
||||||
{
|
{
|
||||||
FLAC__int32 readbuffer[READBUF * 2];
|
FLAC__int32 readbuffer[READBUF * 2];
|
||||||
sf_count_t count;
|
sf_count_t count;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
count = sf_readf_int(sfile, readbuffer, READBUF);
|
count = sf_readf_int(sfile, readbuffer, READBUF);
|
||||||
if (count <= 0) break;
|
if (count <= 0) break;
|
||||||
for (i = 0; i < (count * sfinfo.channels); i++)
|
for (i = 0; i < (count * sfinfo.channels); i++)
|
||||||
|
@ -187,8 +187,9 @@ _edje_multisense_encode_to_flac(char *snd_path, SF_INFO sfinfo)
|
||||||
|
|
||||||
FLAC__stream_encoder_delete(encoder);
|
FLAC__stream_encoder_delete(encoder);
|
||||||
sf_close(sfile);
|
sf_close(sfile);
|
||||||
return (snd_path);
|
return snd_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_VORBIS
|
#ifdef HAVE_VORBIS
|
||||||
|
@ -233,7 +234,7 @@ _edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sf
|
||||||
|
|
||||||
/********** Encode setup ************/
|
/********** Encode setup ************/
|
||||||
vorbis_info_init(&vi);
|
vorbis_info_init(&vi);
|
||||||
ret = vorbis_encode_init(&vi, sfinfo.channels, sfinfo.samplerate,
|
ret = vorbis_encode_init(&vi, sfinfo.channels, sfinfo.samplerate,
|
||||||
-1, (long)(quality * 1000), -1);
|
-1, (long)(quality * 1000), -1);
|
||||||
if (ret == OV_EFAULT) printf("OV_EFAULT\n");
|
if (ret == OV_EFAULT) printf("OV_EFAULT\n");
|
||||||
if (ret == OV_EINVAL) printf("OV_EINVAL\n");
|
if (ret == OV_EINVAL) printf("OV_EINVAL\n");
|
||||||
|
@ -280,7 +281,7 @@ _edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sf
|
||||||
int i, ch;
|
int i, ch;
|
||||||
float readbuffer[READBUF * 2];
|
float readbuffer[READBUF * 2];
|
||||||
sf_count_t count;
|
sf_count_t count;
|
||||||
|
|
||||||
count = sf_readf_float(sfile, readbuffer, READBUF);
|
count = sf_readf_float(sfile, readbuffer, READBUF);
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
|
@ -288,12 +289,12 @@ _edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sf
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float **buffer = vorbis_analysis_buffer(&vd, count);
|
float **buffer = vorbis_analysis_buffer(&vd, count);
|
||||||
|
|
||||||
/* uninterleave samples */
|
/* uninterleave samples */
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
for (ch = 0; ch < sfinfo.channels; ch++)
|
for (ch = 0; ch < sfinfo.channels; ch++)
|
||||||
buffer[ch][i]= readbuffer[(i * sfinfo.channels) + ch];
|
buffer[ch][i] = readbuffer[(i * sfinfo.channels) + ch];
|
||||||
}
|
}
|
||||||
vorbis_analysis_wrote(&vd, i);
|
vorbis_analysis_wrote(&vd, i);
|
||||||
}
|
}
|
||||||
|
@ -322,8 +323,9 @@ _edje_multisense_encode_to_ogg_vorbis(char *snd_path, double quality, SF_INFO sf
|
||||||
vorbis_comment_clear(&vc);
|
vorbis_comment_clear(&vc);
|
||||||
vorbis_info_clear(&vi);
|
vorbis_info_clear(&vi);
|
||||||
sf_close(sfile);
|
sf_close(sfile);
|
||||||
fclose (fout);
|
fclose(fout);
|
||||||
return snd_path;
|
return snd_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -590,6 +590,7 @@ _slave_mode(void *data, Ecore_Fd_Handler *fd_handler)
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1124,9 +1125,9 @@ main(int argc, char **argv)
|
||||||
f = eina_file_open(opts.file, EINA_FALSE);
|
f = eina_file_open(opts.file, EINA_FALSE);
|
||||||
if (edje_mmap_3d_has(f, group))
|
if (edje_mmap_3d_has(f, group))
|
||||||
{
|
{
|
||||||
Eina_List* engine_list, *n;
|
Eina_List *engine_list, *n;
|
||||||
Eina_Bool opengl_x11_has = EINA_FALSE, wayland_egl_has = EINA_FALSE;
|
Eina_Bool opengl_x11_has = EINA_FALSE, wayland_egl_has = EINA_FALSE;
|
||||||
const char* engine;
|
const char *engine;
|
||||||
engine_list = ecore_evas_engines_get();
|
engine_list = ecore_evas_engines_get();
|
||||||
EINA_LIST_FOREACH(engine_list, n, engine)
|
EINA_LIST_FOREACH(engine_list, n, engine)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ read_watch_file(const char *file)
|
||||||
const char *path;
|
const char *path;
|
||||||
Eina_Bool do_append = EINA_TRUE;
|
Eina_Bool do_append = EINA_TRUE;
|
||||||
|
|
||||||
if (ln->length < 4) continue ;
|
if (ln->length < 4) continue;
|
||||||
if (anotate)
|
if (anotate)
|
||||||
{
|
{
|
||||||
path = eina_stringshare_add_length(ln->start + 3, ln->length - 3);
|
path = eina_stringshare_add_length(ln->start + 3, ln->length - 3);
|
||||||
|
@ -56,7 +56,7 @@ read_watch_file(const char *file)
|
||||||
path = eina_stringshare_add_length(ln->start, ln->length);
|
path = eina_stringshare_add_length(ln->start, ln->length);
|
||||||
}
|
}
|
||||||
if (do_append)
|
if (do_append)
|
||||||
r = eina_list_append(r, eio_monitor_add(path));
|
r = eina_list_append(r, eio_monitor_add(path));
|
||||||
eina_stringshare_del(path);
|
eina_stringshare_del(path);
|
||||||
}
|
}
|
||||||
eina_iterator_free(it);
|
eina_iterator_free(it);
|
||||||
|
@ -65,7 +65,7 @@ read_watch_file(const char *file)
|
||||||
eio_monitor_del(mon);
|
eio_monitor_del(mon);
|
||||||
watching = r;
|
watching = r;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
eina_file_close(f);
|
eina_file_close(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,3 +150,4 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue