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 make install
NOTE: You MUST make install Edje for it to run properly. 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 AC_PROG_CC
AM_PROG_CC_STDC AM_PROG_CC_STDC
AM_PROG_CC_C_O
AC_HEADER_STDC AC_HEADER_STDC
AC_C_CONST AC_C_CONST
AM_ENABLE_SHARED AM_ENABLE_SHARED
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
AC_FUNC_ALLOCA 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_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) AC_CHECK_FUNCS(fnmatch, res=yes, res=no)
if test "x$res" = "xno"; then if test "x$res" = "xno"; then
AC_CHECK_LIB(fnmatch, fnmatch, res=yes, res=no) AC_CHECK_LIB(fnmatch, fnmatch, res=yes fnmatch_libs="-lfnmatch", res=no)
if test "x$res" = "xno"; then dnl Test for compilation with MinGW.
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch]) dnl fnmatch function is in the libiberty library
else if test "x$res" = "xno"; then
fnmatch_libs="-lfnmatch" AC_CHECK_LIB(iberty, fnmatch, res=yes fnmatch_libs="-liberty", res=no)
fi fi
if test "x$res" = "xno"; then
AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty])
fi
fi fi
AC_SUBST(fnmatch_libs) AC_SUBST(fnmatch_libs)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,5 +39,5 @@ edje_textblock_styles.c
libedje_la_LIBADD = -lm @EDJE_LIBS@ @fnmatch_libs@ libedje_la_LIBADD = -lm @EDJE_LIBS@ @fnmatch_libs@
libedje_la_CPPFLAGS = libedje_la_CPPFLAGS =
libedje_la_DEPENDENCIES = $(top_builddir)/config.h 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 #ifdef EAPI
#undef EAPI #undef EAPI
#endif #endif
#ifdef WIN32 #ifdef _MSC_VER
# ifdef BUILDING_DLL # ifdef BUILDING_DLL
# define EAPI __declspec(dllexport) # define EAPI __declspec(dllexport)
# else # else