make edje binaries compile and allow the creation of the edje shared lib on windows. Remove some trailing spaces

SVN revision: 31517
This commit is contained in:
doursse 2007-08-26 12:54:51 +00:00 committed by doursse
parent 50432552c8
commit 2e7692e45e
10 changed files with 281 additions and 191 deletions

View File

@ -12,3 +12,8 @@ To install (run this as root, or the user who handles installs):
make install
NOTE: You MUST make install Edje for it to run properly.
NOTE: for compilation with MinGW, fnmatch.h is probably missing.
That file can be found here:
http://www.koders.com/c/fid2B518462CB1EED3D4E31E271DB83CD1582F6EEBE.aspx
It should be installed in the mingw include directory.

View File

@ -12,24 +12,38 @@ AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_HEADER_STDC
AC_C_CONST
AM_ENABLE_SHARED
AM_PROG_LIBTOOL
AC_FUNC_ALLOCA
create_shared_lib=""
case "$host_os" in
mingw|mingw32)
create_shared_lib="-no-undefined "
;;
esac
AC_SUBST(create_shared_lib)
AC_CHECK_FUNCS(realpath)
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file MinGW users: see the INSTALL file]))
fnmatch_libs=""
AC_CHECK_FUNCS(fnmatch, res=yes, res=no)
if test "x$res" = "xno"; then
AC_CHECK_LIB(fnmatch, fnmatch, res=yes, res=no)
if test "x$res" = "xno"; then
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch])
else
fnmatch_libs="-lfnmatch"
fi
AC_CHECK_LIB(fnmatch, fnmatch, res=yes fnmatch_libs="-lfnmatch", res=no)
dnl Test for compilation with MinGW.
dnl fnmatch function is in the libiberty library
if test "x$res" = "xno"; then
AC_CHECK_LIB(iberty, fnmatch, res=yes fnmatch_libs="-liberty", res=no)
fi
if test "x$res" = "xno"; then
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty])
fi
fi
AC_SUBST(fnmatch_libs)

View File

@ -8,7 +8,7 @@ INCLUDES = \
-DPACKAGE_BIN_DIR=\"@PACKAGE_BIN_DIR@\" \
-DPACKAGE_LIB_DIR=\"@PACKAGE_LIB_DIR@\" \
-DPACKAGE_DATA_DIR=\"@PACKAGE_DATA_DIR@\"
bin_SCRIPTS = \
@EDJE_RECC_PRG@
@ -16,8 +16,8 @@ EXTRA_DIST = @EDJE_RECC_PRG@
EXTRA_SCRIPTS = edje_recc
bin_PROGRAMS = \
@EDJE_CC_PRG@ \
@EDJE_DECC_PRG@
edje_cc \
edje_decc
EXTRA_PROGRAMS = \
edje_cc \

View File

@ -2,6 +2,11 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef _WIN32
# include <windows.h>
#endif /* _WIN32 */
#include "edje_cc.h"
typedef struct _Part_Lookup Part_Lookup;
@ -156,14 +161,14 @@ check_part (Edje_Part_Collection *pc, Edje_Part *ep, Eet_File *ef)
static void
check_program (Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef)
{
switch (ep->action)
switch (ep->action)
{
case EDJE_ACTION_TYPE_STATE_SET:
case EDJE_ACTION_TYPE_ACTION_STOP:
case EDJE_ACTION_TYPE_DRAG_VAL_SET:
case EDJE_ACTION_TYPE_DRAG_VAL_STEP:
case EDJE_ACTION_TYPE_DRAG_VAL_PAGE:
if (!ep->targets)
if (!ep->targets)
{
fprintf(stderr, "%s: Error. collection %i: "
"target missing in program %s\n",
@ -179,7 +184,7 @@ check_program (Edje_Part_Collection *pc, Edje_Program *ep, Eet_File *ef)
static void
check_spectrum (Edje_Spectrum_Directory_Entry *se, Eet_File *ef)
{
if (!se->entry)
if (!se->entry)
fprintf(stderr, "%s: Error. Spectrum missing a name.\n", progname);
else if (!se->color_list)
fprintf(stderr, "%s: Error. Spectrum %s is empty. At least one color must be given.", progname, se->entry);
@ -204,7 +209,7 @@ data_write(void)
int font_num;
int collection_num;
int i;
bytes = 0;
input_bytes = 0;
total_bytes = 0;
@ -224,7 +229,7 @@ data_write(void)
if (edje_file)
{
if (edje_file->collection_dir)
if (edje_file->collection_dir)
{
/* copy aliases into collection directory */
while (aliases)
@ -237,7 +242,7 @@ data_write(void)
if (bytes <= 0)
{
fprintf(stderr, "%s: Error. unable to write \"edje_file\" entry to \"%s\" \n",
progname, file_out);
progname, file_out);
ABORT_WRITE(ef, file_out);
}
else
@ -255,13 +260,13 @@ data_write(void)
int fsize = 0;
Evas_List *ll;
FILE *f;
fn = l->data;
f = fopen(fn->file, "rb");
if (f)
{
long pos;
fseek(f, 0, SEEK_END);
pos = ftell(f);
rewind(f);
@ -283,13 +288,13 @@ data_write(void)
for (ll = fnt_dirs; ll; ll = ll->next)
{
char buf[4096];
snprintf(buf, sizeof(buf), "%s/%s", (char *)(ll->data), fn->file);
f = fopen(buf, "rb");
if (f)
{
long pos;
fseek(f, 0, SEEK_END);
pos = ftell(f);
rewind(f);
@ -318,13 +323,13 @@ data_write(void)
else
{
char buf[4096];
snprintf(buf, sizeof(buf), "fonts/%s", fn->name);
bytes = eet_write(ef, buf, fdata, fsize, 1);
if (bytes <= 0)
{
fprintf(stderr, "%s: Error. unable to write font part \"%s\" as \"%s\" part entry to %s \n",
progname, fn->file, buf, file_out);
progname, fn->file, buf, file_out);
ABORT_WRITE(ef, file_out);
}
else
@ -348,7 +353,7 @@ data_write(void)
{
Ecore_Evas *ee;
Evas *evas;
ecore_init();
ecore_evas_init();
ee = ecore_evas_buffer_new(1, 1);
@ -361,8 +366,8 @@ data_write(void)
for (l = edje_file->image_dir->entries; l; l = l->next)
{
Edje_Image_Directory_Entry *img;
img = l->data;
img = l->data;
if (img->source_type == EDJE_IMAGE_SOURCE_TYPE_EXTERNAL)
{
}
@ -370,19 +375,19 @@ data_write(void)
{
Evas_Object *im;
Evas_List *ll;
im = NULL;
for (ll = img_dirs; ll; ll = ll->next)
{
char buf[4096];
snprintf(buf, sizeof(buf), "%s/%s",
snprintf(buf, sizeof(buf), "%s/%s",
(char *)(ll->data), img->entry);
im = evas_object_image_add(evas);
if (im)
{
evas_object_image_file_set(im, buf, NULL);
if (evas_object_image_load_error_get(im) ==
if (evas_object_image_load_error_get(im) ==
EVAS_LOAD_ERROR_NONE)
{
break;
@ -397,7 +402,7 @@ data_write(void)
if (im)
{
evas_object_image_file_set(im, img->entry, NULL);
if (evas_object_image_load_error_get(im) !=
if (evas_object_image_load_error_get(im) !=
EVAS_LOAD_ERROR_NONE)
{
evas_object_del(im);
@ -411,14 +416,14 @@ data_write(void)
int im_w, im_h;
int im_alpha;
char buf[256];
evas_object_image_size_get(im, &im_w, &im_h);
im_alpha = evas_object_image_alpha_get(im);
im_data = evas_object_image_data_get(im, 0);
if ((im_data) && (im_w > 0) && (im_h > 0))
{
int mode, qual;
snprintf(buf, sizeof(buf), "images/%i", img->id);
mode = 2;
qual = 80;
@ -452,24 +457,24 @@ data_write(void)
if (qual > max_quality) qual = max_quality;
}
if (mode == 0)
bytes = eet_data_image_write(ef, buf,
bytes = eet_data_image_write(ef, buf,
im_data, im_w, im_h,
im_alpha,
im_alpha,
0, 0, 0);
else if (mode == 1)
bytes = eet_data_image_write(ef, buf,
bytes = eet_data_image_write(ef, buf,
im_data, im_w, im_h,
im_alpha,
im_alpha,
1, 0, 0);
else if (mode == 2)
bytes = eet_data_image_write(ef, buf,
bytes = eet_data_image_write(ef, buf,
im_data, im_w, im_h,
im_alpha,
0, qual, 1);
if (bytes <= 0)
{
fprintf(stderr, "%s: Error. unable to write image part \"%s\" as \"%s\" part entry to %s\n",
progname, img->entry, buf, file_out);
progname, img->entry, buf, file_out);
ABORT_WRITE(ef, file_out);
}
else
@ -481,14 +486,14 @@ data_write(void)
else
{
fprintf(stderr, "%s: Error. unable to load image for image part \"%s\" as \"%s\" part entry to %s\n",
progname, img->entry, buf, file_out);
progname, img->entry, buf, file_out);
ABORT_WRITE(ef, file_out);
}
if (verbose)
{
struct stat st;
const char *file = NULL;
evas_object_image_file_get(im, &file, NULL);
if ((file) && (stat(file, &st) != 0))
st.st_size = 0;
@ -505,7 +510,7 @@ data_write(void)
else
{
fprintf(stderr, "%s: Error. unable to load image for image \"%s\" part entry to %s. Missing PNG or JPEG loader modules for Evas or file does not exist, or is not readable.\n",
progname, img->entry, file_out);
progname, img->entry, file_out);
ABORT_WRITE(ef, file_out);
}
}
@ -542,7 +547,7 @@ data_write(void)
{
Edje_Part_Collection *pc;
Evas_List *ll;
pc = l->data;
for (ll = pc->parts; ll; ll = ll->next)
check_part (pc, ll->data, ef);
@ -553,14 +558,14 @@ data_write(void)
{
Edje_Part_Collection *pc;
char buf[4096];
pc = l->data;
snprintf(buf, sizeof(buf), "collections/%i", pc->id);
bytes = eet_data_write(ef, edd_edje_part_collection, buf, pc, 1);
if (bytes <= 0)
{
fprintf(stderr, "%s: Error. unable to write \"%s\" part entry to %s \n",
progname, buf, file_out);
progname, buf, file_out);
ABORT_WRITE(ef, file_out);
}
else
@ -578,27 +583,44 @@ data_write(void)
{
Code *cd;
int ln = 0;
cd = l->data;
if ((cd->shared) || (cd->programs))
{
int fd;
#ifdef _WIN32
int ret;
char path[4096];
#endif /* _WIN32 */
char tmpn[4096];
#ifdef _WIN32
ret = GetTempPath(_MAX_PATH, path);
if ((ret > _MAX_PATH) || (ret == 0))
fd = -1;
else
{
if (!GetTempFileName(path, "edj", 0, tmpn))
fd = -1;
else
fd = open(tmpn, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
}
#else
strcpy(tmpn, "/tmp/edje_cc.sma-tmp-XXXXXX");
fd = mkstemp(tmpn);
#endif /* _WIN32 */
if (fd >= 0)
{
FILE *f;
char buf[4096];
char tmpo[4096];
int ret;
f = fopen(tmpn, "w");
if (f)
{
Evas_List *ll;
fprintf(f, "#include <edje>\n");
ln = 2;
if (cd->shared)
@ -612,7 +634,7 @@ data_write(void)
char *sp;
int hash = 0;
int newlined = 0;
for (sp = cd->shared; *sp; sp++)
{
if ((sp[0] == '#') && (newlined))
@ -631,7 +653,7 @@ data_write(void)
for (ll = cd->programs; ll; ll = ll->next)
{
Code_Program *cp;
cp = ll->data;
if (cp->script)
{
@ -647,7 +669,7 @@ data_write(void)
char *sp;
int hash = 0;
int newlined = 0;
for (sp = cp->script; *sp; sp++)
{
if ((sp[0] == '#') && (newlined))
@ -667,8 +689,21 @@ data_write(void)
fclose(f);
}
close(fd);
#ifdef _WIN32
ret = GetTempPath(_MAX_PATH, path);
if ((ret > _MAX_PATH) || (ret == 0))
fd = -1;
else
{
if (!GetTempFileName(path, "edj", 0, tmpo))
fd = -1;
else
fd = open(tmpo, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
}
#else
strcpy(tmpo, "/tmp/edje_cc.amx-tmp-XXXXXX");
fd = mkstemp(tmpo);
#endif /* _WIN32 */
if (fd >= 0)
{
snprintf(buf, sizeof(buf),
@ -679,7 +714,7 @@ data_write(void)
if (ret < 0 || ret > 1)
{
fprintf(stderr, "%s: Warning. Compiling script code not clean.\n",
progname);
progname);
ABORT_WRITE(ef, file_out);
}
close(fd);
@ -689,14 +724,14 @@ data_write(void)
{
int size;
void *data;
fseek(f, 0, SEEK_END);
size = ftell(f);
rewind(f);
if (size > 0)
{
int bt;
data = malloc(size);
if (data)
{
@ -726,7 +761,7 @@ data_write(void)
if (verbose)
{
struct stat st;
if (stat(file_in, &st) != 0)
st.st_size = 0;
input_bytes += st.st_size;
@ -768,7 +803,7 @@ void
data_queue_part_lookup(Edje_Part_Collection *pc, char *name, int *dest)
{
Part_Lookup *pl;
pl = mem_alloc(SZ(Part_Lookup));
part_lookups = evas_list_append(part_lookups, pl);
pl->pc = pc;
@ -780,7 +815,7 @@ void
data_queue_program_lookup(Edje_Part_Collection *pc, char *name, int *dest)
{
Program_Lookup *pl;
pl = mem_alloc(SZ(Program_Lookup));
program_lookups = evas_list_append(program_lookups, pl);
pl->pc = pc;
@ -792,7 +827,7 @@ void
data_queue_image_lookup(char *name, int *dest)
{
Image_Lookup *il;
il = mem_alloc(SZ(Image_Lookup));
image_lookups = evas_list_append(image_lookups, il);
il->name = mem_strdup(name);
@ -803,7 +838,7 @@ void
data_queue_spectrum_lookup(char *name, int *dest)
{
Spectrum_Lookup *sl;
sl = mem_alloc(SZ(Spectrum_Lookup));
spectrum_lookups = evas_list_append(spectrum_lookups, sl);
sl->name = mem_strdup(name);
@ -861,17 +896,17 @@ void
data_process_lookups(void)
{
Evas_List *l;
while (part_lookups)
{
Part_Lookup *pl;
pl = part_lookups->data;
for (l = pl->pc->parts; l; l = l->next)
{
Edje_Part *ep;
ep = l->data;
if ((ep->name) && (!strcmp(ep->name, pl->name)))
{
@ -894,13 +929,13 @@ data_process_lookups(void)
while (program_lookups)
{
Program_Lookup *pl;
pl = program_lookups->data;
for (l = pl->pc->programs; l; l = l->next)
{
Edje_Program *ep;
ep = l->data;
if ((ep->name) && (!strcmp(ep->name, pl->name)))
{
@ -918,13 +953,13 @@ data_process_lookups(void)
free(pl->name);
free(pl);
}
while (image_lookups)
{
Image_Lookup *il;
il = image_lookups->data;
if (!edje_file->image_dir)
l = NULL;
else
@ -932,7 +967,7 @@ data_process_lookups(void)
for (l = edje_file->image_dir->entries; l; l = l->next)
{
Edje_Image_Directory_Entry *de;
de = l->data;
if ((de->entry) && (!strcmp(de->entry, il->name)))
{
@ -945,7 +980,7 @@ data_process_lookups(void)
}
}
}
if (!l)
{
fprintf(stderr, "%s: Error. unable to find image name %s\n",
@ -960,7 +995,7 @@ data_process_lookups(void)
while (spectrum_lookups)
{
Spectrum_Lookup *il;
il = spectrum_lookups->data;
if (!edje_file->spectrum_dir)
@ -970,7 +1005,7 @@ data_process_lookups(void)
for (l = edje_file->spectrum_dir->entries; l; l = l->next)
{
Edje_Spectrum_Directory_Entry *de;
de = l->data;
*(il->dest) = 1;
if ((de->entry) && (!strcmp(de->entry, il->name)))
@ -981,7 +1016,7 @@ data_process_lookups(void)
}
}
}
if (!l)
{
fprintf(stderr, "%s: Error. unable to find spectrum name %s\n",
@ -1019,7 +1054,7 @@ data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void
char *key;
int keyl;
int quote, escape;
key = alloca(strlen(prefix) + 2 + 1);
if (!key) return;
strcpy(key, prefix);
@ -1042,13 +1077,13 @@ data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void
if (!strncmp(p, key, keyl))
{
Code_Lookup *cl;
cl = mem_alloc(SZ(Code_Lookup));
if (cl)
{
int inesc = 0;
char *name;
cl->ptr = p;
p += keyl;
while ((*p))
@ -1075,7 +1110,7 @@ data_process_string(Edje_Part_Collection *pc, const char *prefix, char *s, void
{
char *pp;
int i;
name[0] = 0;
pp = cl->ptr + keyl;
inesc = 0;
@ -1145,18 +1180,18 @@ void
data_process_scripts(void)
{
Evas_List *l, *l2;
for (l = codes, l2 = edje_collections; (l) && (l2); l = l->next, l2 = l2->next)
{
Code *cd;
Edje_Part_Collection *pc;
cd = l->data;
pc = l2->data;
if ((cd->shared) || (cd->programs))
{
Evas_List *ll;
if (cd->shared)
{
data_process_string(pc, "PART", cd->shared, data_queue_part_lookup);
@ -1166,7 +1201,7 @@ data_process_scripts(void)
for (ll = cd->programs; ll; ll = ll->next)
{
Code_Program *cp;
cp = ll->data;
if (cp->script)
{
@ -1183,7 +1218,7 @@ void
data_process_script_lookups(void)
{
Evas_List *l;
for (l = code_lookups; l; l = l->next)
{
Code_Lookup *cl;

View File

@ -2,6 +2,10 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef _WIN32
# include <windows.h>
#endif /* _WIN32 */
#include "edje_cc.h"
static void new_object(void);
@ -54,7 +58,7 @@ new_object(void)
char *id;
int i;
int handled = 0;
id = stack_id();
for (i = 0; i < object_handler_num(); i++)
{
@ -95,7 +99,7 @@ new_statement(void)
char *id;
int i;
int handled = 0;
id = stack_id();
for (i = 0; i < statement_handler_num(); i++)
{
@ -144,7 +148,7 @@ isdelim(char c)
{
const char *delims = "{},;:";
char *d;
d = (char *)delims;
while (*d)
{
@ -198,14 +202,14 @@ next_token(char *p, char *end, char **new_p, int *delim)
char *pp, fl[4096];
char *tmpstr = NULL;
int l, nm;
/* handle cpp comments */
/* their line format is
* # <line no. of next line> <filename from next line on> [??]
*/
cpp_token_line = NULL;
cpp_token_file = NULL;
pp = p;
while ((pp < end) && (*pp != '\n'))
{
@ -304,10 +308,10 @@ next_token(char *p, char *end, char **new_p, int *delim)
}
if (!in_tok) return NULL;
tok_end = p - 1;
done:
*new_p = p;
tok = mem_alloc(tok_end - tok_start + 2);
strncpy(tok, tok_start, tok_end - tok_start + 1);
tok[tok_end - tok_start + 1] = 0;
@ -381,7 +385,7 @@ static void
stack_chop_top(void)
{
char *top;
/* remove top from stack */
top = evas_list_data(evas_list_last(stack));
if (top)
@ -459,7 +463,7 @@ parse(char *data, off_t size)
{
fprintf(stderr, "%s: Error. parse error %s:%i. { marker before ; marker\n",
progname, file_in, line - 1);
exit(-1);
exit(-1);
}
}
free(token);
@ -481,7 +485,7 @@ parse(char *data, off_t size)
int l1 = 0, l2 = 0;
char *verbatim_1;
char *verbatim_2;
l1 = line;
while ((p[0] != '{') && (p < end))
{
@ -531,7 +535,7 @@ parse(char *data, off_t size)
{
int l;
char *v;
l = verbatim_2 - verbatim_1 + 1;
v = malloc(l + 1);
strncpy(v, verbatim_1, l);
@ -608,22 +612,38 @@ compile(void)
int fd;
off_t size;
char *data, *p;
#ifdef _WIN32
int ret;
#endif /* _WIN32 */
char buf[4096];
char inc[4096];
static char tmpn[4096];
strcpy(tmpn, "/tmp/edje_cc.edc-tmp-XXXXXX");
strncpy(inc, file_in, 4000);
inc[4001] = 0;
p = strrchr(inc, '/');
if (!p) strcpy(inc, "./");
else *p = 0;
#ifdef _WIN32
ret = GetTempPath(4096, buf);
if ((ret > 4096) || (ret == 0))
fd = -1;
else
{
if (!GetTempFileName(buf, "edj", 0, tmpn))
fd = -1;
else
fd = open(tmpn, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
}
#else
strcpy(tmpn, "/tmp/edje_cc.edc-tmp-XXXXXX");
fd = mkstemp(tmpn);
#endif /* _WIN32 */
if (fd >= 0)
{
int ret;
char *def;
clean_file = tmpn;
close(fd);
atexit(clean_tmp_file);
@ -633,7 +653,7 @@ compile(void)
{
Evas_List *l;
int len;
len = 0;
for (l = defines; l; l = l->next)
{
@ -656,7 +676,7 @@ compile(void)
* If the preprocessor is invoked via gcc -E, it will treat
* file_in as a linker file. The safest route seems to be to
* run cpp with the output as the second non-option argument.
*
*
* Redirecting the output is required for MacOS 10.3, and works fine
* on other systems.
*/
@ -673,7 +693,7 @@ compile(void)
file_in = tmpn;
free(def);
/* OLD CODE
snprintf(buf, sizeof(buf), "cat %s | cpp -I%s %s -E -o %s",
snprintf(buf, sizeof(buf), "cat %s | cpp -I%s %s -E -o %s",
file_in, inc, def, tmpn);
ret = system(buf);
if (ret < 0)
@ -698,7 +718,7 @@ compile(void)
printf("%s: Opening \"%s\" for input\n",
progname, file_in);
}
size = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
data = malloc(size);
@ -718,7 +738,7 @@ int
is_param(int n)
{
char *str;
str = evas_list_nth(params, n);
if (str) return 1;
return 0;
@ -730,13 +750,13 @@ is_num(int n)
char *str;
long int ret;
char *end;
str = evas_list_nth(params, n);
if (!str)
{
fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n",
progname, file_in, line - 1, n + 1);
exit(-1);
exit(-1);
}
if (str[0] == 0) return 0;
end = str;
@ -750,13 +770,13 @@ parse_str(int n)
{
char *str;
char *s;
str = evas_list_nth(params, n);
if (!str)
{
fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n",
progname, file_in, line - 1, n + 1);
exit(-1);
exit(-1);
}
s = mem_strdup(str);
return s;
@ -767,20 +787,20 @@ parse_enum(int n, ...)
{
char *str;
va_list va;
str = evas_list_nth(params, n);
str = evas_list_nth(params, n);
if (!str)
{
fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n",
progname, file_in, line - 1, n + 1);
exit(-1);
exit(-1);
}
va_start(va, n);
for (;;)
{
char *s;
int v;
s = va_arg(va, char *);
if (!s)
{
@ -797,7 +817,7 @@ parse_enum(int n, ...)
}
fprintf(stderr, "\n");
va_end(va);
exit(-1);
exit(-1);
}
v = va_arg(va, int);
if (!strcmp(s, str))
@ -815,13 +835,13 @@ parse_int(int n)
{
char *str;
int i;
str = evas_list_nth(params, n);
if (!str)
{
fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n",
progname, file_in, line - 1, n + 1);
exit(-1);
exit(-1);
}
i = my_atoi(str);
return i;
@ -832,13 +852,13 @@ parse_int_range(int n, int f, int t)
{
char *str;
int i;
str = evas_list_nth(params, n);
if (!str)
{
fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n",
progname, file_in, line - 1, n + 1);
exit(-1);
exit(-1);
}
i = my_atoi(str);
if ((i < f) || (i > t))
@ -891,13 +911,13 @@ parse_float(int n)
{
char *str;
double i;
str = evas_list_nth(params, n);
if (!str)
{
fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n",
progname, file_in, line - 1, n + 1);
exit(-1);
exit(-1);
}
i = my_atof(str);
return i;
@ -908,13 +928,13 @@ parse_float_range(int n, double f, double t)
{
char *str;
double i;
str = evas_list_nth(params, n);
if (!str)
{
fprintf(stderr, "%s: Error. %s:%i no parameter supplied as argument %i\n",
progname, file_in, line - 1, n + 1);
exit(-1);
exit(-1);
}
i = my_atof(str);
if ((i < f) || (i > t))
@ -946,7 +966,7 @@ check_arg_count(int required_args)
* beta ::= gamma + gamma || gamma
* gamma ::= num || delta
* delta ::= '(' alpha ')'
*
*
*/
/* int set of function */
@ -956,17 +976,17 @@ my_atoi(const char * s)
{
int res = 0;
char buf[4096];
if (!s)
return 0;
if (!strstrip(s, buf, sizeof (buf)))
{
fprintf(stderr, "%s: Error. %s:%i expression is too long\n",
progname, file_in, line - 1);
return 0;
}
_alphai(buf, &res);
return res;
}
@ -975,9 +995,9 @@ static char *
_deltai(char *s, int * val)
{
if (!val) return NULL;
if ('(' != s[0])
{
{
fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n",
progname, file_in, line - 1, s);
return s;
@ -989,7 +1009,7 @@ _deltai(char *s, int * val)
s++;
return s;
}
return s;
}
@ -997,7 +1017,7 @@ static char *
_gammai(char *s, int * val)
{
if (!val) return NULL;
if (_is_numi(s[0]))
{
s = _get_numi(s, val);
@ -1019,12 +1039,12 @@ _betai(char *s, int * val)
{
int a1, a2;
char op;
if (!val)
return NULL;
s = _gammai(s, &a1);
while (_is_op1i(s[0]))
{
op = s[0];
@ -1032,9 +1052,9 @@ _betai(char *s, int * val)
s = _gammai(s, &a2);
a1 = _calci(op, a1, a2);
}
(*val) = a1;
return s;
}
@ -1043,12 +1063,12 @@ _alphai(char *s, int * val)
{
int a1, a2;
char op;
if (!val)
return NULL;
s = _betai(s, &a1);
while (_is_op2i(s[0]))
{
op = s[0];
@ -1056,7 +1076,7 @@ _alphai(char *s, int * val)
s = _betai(s, &a2);
a1 = _calci(op, a1, a2);
}
(*val) = a1;
return s;
}
@ -1066,10 +1086,10 @@ _get_numi(char *s, int * val)
{
char buf[4096];
int pos = 0;
if (!val)
return s;
return s;
while (
(('0' <= s[pos]) && ('9' >= s[pos])) ||
((0 == pos) && ('-' == s[pos]))
@ -1078,7 +1098,7 @@ _get_numi(char *s, int * val)
buf[pos] = s[pos];
pos++;
}
buf[pos] = '\0';
(*val) = atoi(buf);
return (s+pos);
@ -1125,7 +1145,7 @@ _calci(char op, int a, int b)
case '+':
a += b;
return a;
case '-':
case '-':
a -= b;
return a;
case '/':
@ -1152,17 +1172,17 @@ my_atof(const char * s)
{
double res = 0;
char buf[4096];
if (!s)
return 0;
if (!strstrip(s, buf, sizeof (buf)))
{
fprintf(stderr, "%s: Error. %s:%i expression is too long\n",
progname, file_in, line - 1);
return 0;
}
_alphaf(buf, &res);
return res;
}
@ -1171,7 +1191,7 @@ static char *
_deltaf(char *s, double * val)
{
if (!val) return NULL;
if ('(' != s[0])
{
fprintf(stderr, "%s: Error. %s:%i unexpected character at %s\n",
@ -1185,7 +1205,7 @@ _deltaf(char *s, double * val)
s++;
return s;
}
return s;
}
@ -1193,7 +1213,7 @@ static char *
_gammaf(char *s, double * val)
{
if (!val) return NULL;
if (_is_numf(s[0]))
{
s = _get_numf(s, val);
@ -1215,12 +1235,12 @@ _betaf(char *s, double * val)
{
double a1=0, a2=0;
char op;
if (!val)
return NULL;
s = _gammaf(s, &a1);
while (_is_op1f(s[0]))
{
op = s[0];
@ -1228,9 +1248,9 @@ _betaf(char *s, double * val)
s = _gammaf(s, &a2);
a1 = _calcf(op, a1, a2);
}
(*val) = a1;
return s;
}
@ -1239,12 +1259,12 @@ _alphaf(char *s, double * val)
{
double a1=0, a2=0;
char op;
if (!val)
return NULL;
s = _betaf(s, &a1);
while (_is_op2f(s[0]))
{
op = s[0];
@ -1252,9 +1272,9 @@ _alphaf(char *s, double * val)
s = _betaf(s, &a2);
a1 = _calcf(op, a1, a2);
}
(*val) = a1;
return s;
}
@ -1263,10 +1283,10 @@ _get_numf(char *s, double * val)
{
char buf[4096];
int pos = 0;
if (!val)
return s;
return s;
while (
(('0' <= s[pos]) && ('9' >= s[pos])) ||
('.' == s[pos]) ||
@ -1276,7 +1296,7 @@ _get_numf(char *s, double * val)
buf[pos] = s[pos];
pos++;
}
buf[pos] = '\0';
(*val) = atof(buf);
return (s+pos);
@ -1285,8 +1305,8 @@ _get_numf(char *s, double * val)
static int
_is_numf(char c)
{
if (((c >= '0') && (c <= '9'))
|| ('-' == c)
if (((c >= '0') && (c <= '9'))
|| ('-' == c)
|| ('.' == c)
|| ('+' == c))
return 1;
@ -1326,7 +1346,7 @@ _calcf(char op, double a, double b)
case '+':
a += b;
return a;
case '-':
case '-':
a -= b;
return a;
case '/':

View File

@ -8,6 +8,9 @@
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef _WIN32
# include <windows.h>
#endif /* _WIN32 */
char *progname = NULL;
char *file_in = NULL;
@ -43,7 +46,7 @@ main(int argc, char **argv)
int i;
setlocale(LC_NUMERIC, "C");
progname = argv[0];
for (i = 1; i < argc; i++)
{
@ -65,7 +68,7 @@ main(int argc, char **argv)
edje_init();
eet_init();
source_edd();
if (!decomp()) return -1;
output();
@ -83,7 +86,7 @@ decomp(void)
printf("ERROR: cannot open %s\n", file_in);
return 0;
}
srcfiles = source_load(ef);
if (!srcfiles || !srcfiles->list)
{
@ -125,7 +128,7 @@ output(void)
Evas_List *l;
Eet_File *ef;
char *outdir, *p;
p = strrchr(file_in, '/');
if (p)
outdir = strdup(p + 1);
@ -133,9 +136,9 @@ output(void)
outdir = strdup(file_in);
p = strrchr(outdir, '.');
if (p) *p = 0;
e_file_mkpath(outdir);
ef = eet_open(file_in, EET_FILE_MODE_READ);
if (edje_file->image_dir)
@ -143,9 +146,9 @@ output(void)
for (l = edje_file->image_dir->entries; l; l = l->next)
{
Edje_Image_Directory_Entry *ei;
ei = l->data;
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_EXTERNAL) &&
(ei->entry))
@ -156,7 +159,7 @@ output(void)
char buf[4096];
char out[4096];
char *pp;
ecore_init();
ecore_evas_init();
ee = ecore_evas_buffer_new(1, 1);
@ -205,7 +208,7 @@ output(void)
char out[4096];
FILE *f;
char *pp;
sf = l->data;
snprintf(out, sizeof(out), "%s/%s", outdir, sf->name);
printf("Output Source File: %s\n", out);
@ -225,7 +228,7 @@ output(void)
exit (-1);
}
f = fopen(out, "w");
if (!f)
if (!f)
{
printf("ERROR: unable to write file (%s).\n", out);
exit (-1);
@ -245,7 +248,7 @@ output(void)
void *font;
int fontsize;
char out[4096];
fn = l->data;
snprintf(out, sizeof(out), "fonts/%s", fn->name);
font = eet_read(ef, out, &fontsize);
@ -253,7 +256,7 @@ output(void)
{
FILE *f;
char *pp;
snprintf(out, sizeof(out), "%s/%s", outdir, fn->file);
printf("Output Font: %s\n", out);
pp = strdup(out);
@ -282,7 +285,7 @@ output(void)
char out[4096];
FILE *f;
SrcFile *sf = srcfiles->list->data;
snprintf(out, sizeof(out), "%s/build.sh", outdir);
printf("Output Build Script: %s\n", out);
if (strstr(out, "../"))
@ -294,16 +297,20 @@ output(void)
fprintf(f, "#!/bin/sh\n");
fprintf(f, "%s $@ -id . -fd . %s -o %s.edj\n", edje_file->compiler, sf->name, outdir);
fclose(f);
if (file_out)
{
snprintf(out, sizeof(out), "%s/%s", outdir, file_out);
#ifdef _WIN32
CopyFile(sf->name, out, TRUE);
#else
symlink(sf->name, out);
#endif /* _WIN32 */
}
#ifndef WIN32
#ifndef _WIN32
chmod(out, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP);
#endif
#endif /* _WIN32 */
printf("\n*** CAUTION ***\n"
"Please check the build script for anything malicious "
@ -316,7 +323,7 @@ int
e_file_is_dir(char *file)
{
struct stat st;
if (stat(file, &st) < 0) return 0;
if (S_ISDIR(st.st_mode)) return 1;
return 0;
@ -325,13 +332,13 @@ e_file_is_dir(char *file)
int
e_file_mkdir(char *dir)
{
#ifndef WIN32
#ifndef _WIN32
static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
if (mkdir(dir, default_mode) < 0) return 0;
#else
if (mkdir(dir) < 0) return 0;
#endif
#endif /* _WIN32 */
return 1;
}
@ -340,7 +347,7 @@ e_file_mkpath(char *path)
{
char ss[PATH_MAX];
int i, ii;
ss[0] = 0;
i = 0;
ii = 0;

View File

@ -11,16 +11,13 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/param.h>
#include <dlfcn.h>
#include <math.h>
#include <fnmatch.h>
#include <limits.h>
#include <ctype.h>
#include <time.h>
#include <dirent.h>
#include <pwd.h>
#include <grp.h>
#include <glob.h>
#include "edje_prefix.h"
/* local subsystem functions */
@ -377,7 +374,11 @@ _e_prefix_try_argv(char *argv0)
if (getcwd(buf3, sizeof(buf3)))
{
snprintf(buf2, sizeof(buf2), "%s/%s", buf3, argv0);
#ifdef _WIN32
if (_fullpath(buf2, buf, _MAX_PATH))
#else
if (realpath(buf2, buf))
#endif /* _WIN32 */
{
_exe_path = strdup(buf);
if (access(_exe_path, X_OK) == 0) return 1;
@ -401,7 +402,11 @@ _e_prefix_try_argv(char *argv0)
strncpy(s, cp, len);
s[len] = '/';
strcpy(s + len + 1, argv0);
#ifdef _WIN32
if (_fullpath(s, buf, _MAX_PATH))
#else
if (realpath(s, buf))
#endif /* _WIN32 */
{
if (access(buf, X_OK) == 0)
{
@ -421,7 +426,11 @@ _e_prefix_try_argv(char *argv0)
strncpy(s, cp, len);
s[len] = '/';
strcpy(s + len + 1, argv0);
#ifdef _WIN32
if (_fullpath(s, buf, _MAX_PATH))
#else
if (realpath(s, buf))
#endif /* _WIN32 */
{
if (access(buf, X_OK) == 0)
{

View File

@ -6,7 +6,7 @@
#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
# else

View File

@ -39,5 +39,5 @@ edje_textblock_styles.c
libedje_la_LIBADD = -lm @EDJE_LIBS@ @fnmatch_libs@
libedje_la_CPPFLAGS =
libedje_la_DEPENDENCIES = $(top_builddir)/config.h
libedje_la_LDFLAGS = -version-info 5:0:5
libedje_la_LDFLAGS = @create_shared_lib@ -version-info 5:0:5

View File

@ -35,7 +35,7 @@
#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
#ifdef _MSC_VER
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
# else