Big patch to make Evas work (more or less) with Windows CE:

* when fopen used, open in binary mode
 * use Evil when fopen is used
 * clean a bit some Makefile.am and add Evil dependency where needed
 * in evas_path.c, remove useless old Windows CE code. It's managed by Evil, now
 * in Evas_Data.h, move Eina.h before EAPI is defined for Evas.
 * define _WIN32_WCE when the host is windows cee


SVN revision: 37476
This commit is contained in:
Vincent Torri 2008-11-05 17:21:04 +00:00
parent e8ed3963c8
commit d250e5501b
21 changed files with 172 additions and 290 deletions

View File

@ -38,6 +38,7 @@ AC_DEFINE_UNQUOTED(MODULE_ARCH, "$MODULE_ARCH", "Module architecture")
PKG_PROG_PKG_CONFIG
WIN32_CPPFLAGS=""
WIN32_CFLAGS=""
lt_no_undefined=""
lt_enable_auto_import=""
@ -48,12 +49,17 @@ case "$host_os" in
dnl needed for correct definition of EAPI
AC_DEFINE(EFL_EVAS_BUILD, 1, [Define to mention that evas is built])
if test "$host_os" = "cegcc" ; then
WIN32_CPPFLAGS="-D_WIN32_WCE=0x0420"
WIN32_CFLAGS="-mwin32"
lt_enable_auto_import="-Wl,--enable-auto-import"
fi
if test "$host_os" = "mingw32ce" ; then
WIN32_CPPFLAGS="-D_WIN32_WCE=0x0420"
fi
lt_no_undefined="-no-undefined"
;;
esac
AC_SUBST(WIN32_CPPFLAGS)
AC_SUBST(WIN32_CFLAGS)
AC_SUBST(lt_no_undefined)
AC_SUBST(lt_enable_auto_import)

View File

@ -1,6 +1,8 @@
#ifndef _EVAS_DATA_H
#define _EVAS_DATA_H
#include <Eina.h>
#ifdef EAPI
# undef EAPI
#endif
@ -27,8 +29,6 @@
# endif
#endif /* ! _WIN32 */
#include <Eina.h>
/**
* @file
* @brief These routines are used for Evas data types.

View File

@ -7,6 +7,8 @@ AM_CPPFLAGS = -I. \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@WIN32_CPPFLAGS@ \
@EVIL_CFLAGS@ \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@
@ -15,6 +17,8 @@ libevas_cache_la_SOURCES = \
evas_cache_image.c \
evas_cache_engine_image.c
libevas_cache_la_LIBAD = @EVIL_LIBS@
libevas_cache_la_DEPENDENCIES = $(top_builddir)/config.h
EXTRA_DIST = evas_cache.h

View File

@ -2,8 +2,18 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"

View File

@ -1,14 +1,19 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@FREETYPE_CFLAGS@ @EET_CFLAGS@ \
@FONTCONFIG_CFLAGS@ @EINA_CFLAGS@
AM_CPPFLAGS = \
-I. \
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib/include \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@WIN32_CPPFLAGS@ \
@FREETYPE_CFLAGS@ \
@EET_CFLAGS@ \
@FONTCONFIG_CFLAGS@ \
@EINA_CFLAGS@ \
@EVIL_CFLAGS@
noinst_LTLIBRARIES = libevas_canvas.la
libevas_canvas_la_SOURCES = \
@ -45,8 +50,8 @@ evas_stack.c \
evas_async_events.c \
evas_transform.c
libevas_canvas_la_LIBADD = @EVIL_LIBS@
EXTRA_DIST = \
evas_object_gradient2_linear.c \
evas_object_gradient2_radial.c
libevas_canvas_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,8 +1,19 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
#ifdef BUILD_FONT_LOADER_EET
#include <Eet.h>
#endif
#ifdef HAVE_FONTCONFIG
#include <fontconfig/fontconfig.h>
#endif
@ -602,7 +613,7 @@ object_text_font_cache_dir_add(char *dir)
{
FILE *f;
f = fopen(tmp, "r");
f = fopen(tmp, "rb");
if (f)
{
int num;
@ -685,7 +696,7 @@ object_text_font_cache_dir_add(char *dir)
{
FILE *f;
f = fopen(tmp, "r");
f = fopen(tmp, "rb");
if (f)
{
char fname[4096], fdef[4096];

View File

@ -10,7 +10,8 @@ AM_CPPFLAGS = \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@EVIL_CFLAGS@
@EVIL_CFLAGS@ \
@WIN32_CPPFLAGS@
AM_CFLAGS = @WIN32_CFLAGS@
@ -18,7 +19,6 @@ noinst_LTLIBRARIES = libevas_file.la
libevas_file_la_SOURCES = \
evas_path.c \
evas_module.c
libevas_file_la_LIBADD = @EVIL_LIBS@
libevas_file_la_DEPENDENCIES = $(top_builddir)/config.h
libevas_file_la_LIBADD = @EINA_LIBS@ @EVIL_LIBS@
EXTRA_DIST = evas_module.h evas_path.h

View File

@ -153,7 +153,7 @@ evas_module_init(void)
struct dirent *de;
if (!(dir = opendir(mp->path))) break;
/* printf("[evas module] searching modules on %s\n", mp->path); */
/* printf("[evas module] searching modules on %s\n", mp->path); */
while ((de = readdir(dir)))
{
char *buf;
@ -192,7 +192,7 @@ evas_module_init(void)
else if (em->type == EVAS_MODULE_TYPE_IMAGE_SAVER)
{
}
/* printf("[evas module] including module path %s/%s of type %d\n",em->path, em->name, em->type); */
/* printf("[evas module] including module path %s/%s of type %d\n",em->path, em->name, em->type); */
evas_modules = eina_list_append(evas_modules, em);
}
free(buf);

View File

@ -3,11 +3,9 @@
/* the file path separator isn't "/" then you may need to help out by */
/* adding in a new set of functions here */
#ifndef _WIN32_WCE
/* UNIX compatability functions */
#include "evas_common.h"
#include "evas_private.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <limits.h>
#include <unistd.h>
@ -19,11 +17,32 @@
#include <fnmatch.h>
#include <dirent.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
#ifdef _WIN32
# define EVAS_PATH_SEPARATOR "\\"
#else
# define EVAS_PATH_SEPARATOR "/"
#endif
int
evas_file_path_is_full_path(const char *path)
{
if (!path) return 0;
#if defined _WIN32_WCE
if (path[0] == '\\') return 1;
#elif defined _WIN32
if ((path[0] == '\0') || (path[1] == '\0'))
return 0;
if (path[1] == ':') return 1;
#else
if (path[0] == '/') return 1;
#endif
return 0;
}
@ -38,11 +57,11 @@ evas_file_path_join(const char *path, const char *end)
if (!end) return strdup(path);
len = strlen(path);
len += strlen(end);
len += strlen("/");
len += strlen(EVAS_PATH_SEPARATOR);
res = malloc(len + 1);
if (!res) return NULL;
strcpy(res, path);
strcat(res, "/");
strcat(res, EVAS_PATH_SEPARATOR);
strcat(res, end);
return res;
}
@ -137,243 +156,3 @@ evas_file_path_resolve(const char *file)
return buf2;
#endif
}
#else
/* WIN32 WINCE compatability functions */
/* Forward declarations */
static DWORD winstat(char *path);
static wchar_t *convert_utf_unicode(const char* putf);
static char *convert_unicode_utf(const wchar_t* punicode);
/* Unicode to utf and utf to unicode conversion functions */
static wchar_t *
convert_utf_unicode(const char *putf)
{
int len;
wchar_t *punicode;
len = strlen(putf)+ 1; //add one for safety
punicode = (wchar_t *)malloc(len * sizeof(wchar_t));
if (punicode == NULL) return NULL;
#ifdef UNICODE
strcpy(punicode,putf);
#else
if (mbstowcs(punicode,putf,len) < 0)
{
free(punicode);
return NULL;
}
#endif
return punicode;
}
static char *
convert_unicode_utf(const wchar_t *punicode)
{
int len;
char *putf;
/* add one for safety */
len = wcslen(punicode) + 1;
/* this will alloc too many bytes */
putf = (char *)malloc(len * sizeof(wchar_t));
if (putf == NULL) return NULL;
#ifdef UNICODE
strcpy(putf,punicode);
#else
if (wcstombs(putf,punicode,len) < 0)
{
free(putf);
return NULL;
}
#endif
return putf;
}
/*
* win"stat"
* This is like the stat function except that it reurns a bitmask (DWORD)
* Since this library is complied using MBCS then the path is multibyte
*/
static DWORD
winstat(char *path)
{
DWORD fa;
wchar_t *pwpath; /* A wide character type */
pwpath = convert_utf_unicode(path);
/* 0xFFFFFFFF is the error return val for the GetFile Attributes Function */
/* so I am usin this as an error return up here */
if (pwpath == NULL) return 0xFFFFFFFF;
/* this function needed the wide string"*/
/* I dont think that WinCe has mbcs equiv functions and only provides UNICODE*/
fa = GetFileAttributesW(pwpath);
free(pwpath);
return fa;
}
int
evas_file_path_is_full_path(char *path)
{
if (!path) return 0;
if (path[0] == '\\') return 1;
return 0;
}
char *
evas_file_path_join(char *path, char *end)
{
char *res = NULL;
int len;
if ((!path) && (!end)) return NULL;
if (!path) return strdup(end);
if (!end) return strdup(path);
len = strlen(path);
len += strlen(end);
len += strlen("\\");
res = malloc(len + 1);
if (!res) return NULL;
strcpy(res, path);
strcat(res, "\\");
strcat(res, end);
return res;
}
int
evas_file_path_exists(char *path)
{
DWORD fa;
fa = winstat(path);
if (fa == 0xFFFFFFFF) return 0;
return 1;
}
int
evas_file_path_is_file(char *path)
{
DWORD fa;
fa = winstat(path);
if (fa == 0xFFFFFFFF) return 0;
if (fa & FILE_ATTRIBUTE_DIRECTORY) return 0;
return 1;
}
int
evas_file_path_is_dir(char *path)
{
DWORD fa;
fa = winstat(path);
if (fa == 0xFFFFFFFF) return 0;
if (fa & FILE_ATTRIBUTE_DIRECTORY) return 1;
return 0;
}
Eina_List *
evas_file_path_list(char *path, char *match, int match_case)
{
Eina_List *files = NULL;
WIN32_FIND_DATAW find;
HANDLE fh;
int fullpathlen;
char *pfp; /* full path pointer */
wchar_t *pfup; /* full unicode path pointer */
/*
* work out the full path length of the combined patch and match
* if we are looking for a specific match eg *.txt then we will will add
* the length of *.txt and \\ to the string
* if we are not looking for a match then we want to list the whole
* directory and we find the length of \\*.*
*/
fullpathlen = strlen(path);
if (match)
{
fullpathlen += strlen("\\");
fullpathlen += strlen(match);
}
else
fullpathlen += strlen("\\*.*");
/* Create the full search path */
pfp = (char *)malloc(fullpathlen + 1); /* add one for safety*/
if (pfp == NULL) return NULL;
/* construct the full path */
strcpy(pfp, path);
if (match)
{
strcat(pfp,"\\");
strcat(pfp,match);
}
else
strcat(pfp,"\\*.*");
/* pfp now contains the fully constructed path*/
pfup = convert_utf_unicode(pfp);
free(pfp); /* chuck it away now as we don't need it, we have a unicode version */
if (pfup == NULL) return NULL;
fh = FindFirstFileW(pfup,&find);
free(pfup); /* chuck it away now as we don't need it, we have a handle */
if (fh == INVALID_HANDLE_VALUE) return NULL;
/* OK now go through the directory picking up filenames */
do
{
if (!(find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
files = eina_list_append(files,convert_unicode_utf(find.cFileName));
}
while (FindNextFileW(fh,&find));
FindClose(fh);
return files;
}
DATA64
evas_file_modified_time(const char *file)
{
WIN32_FIND_DATAW find;
HANDLE fh;
ULARGE_INTEGER modtime;
wchar_t *pufile;
pufile = convert_utf_unicode(file);
if (pufile == NULL) return 0;
fh = FindFirstFileW(pufile,&find);
if (fh == INVALID_HANDLE_VALUE)
{
free(pufile);
return 0;
}
FindClose(fh);
free(pufile);
modtime.u.HighPart = find.ftCreationTime.dwHighDateTime;
modtime.u.LowPart = find.ftCreationTime.dwLowDateTime;
return modtime.QuadPart;
}
char *
evas_file_path_resolve(const char *file)
{
return strdup(file);
}
#endif

View File

@ -7,7 +7,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@jpeg_cflags@
@jpeg_cflags@ \
@EVIL_CFLAGS@ \
@WIN32_CPPFLAGS@
AM_CFLAGS = @WIN32_CFLAGS@
@ -17,6 +19,6 @@ pkg_LTLIBRARIES = module.la
module_la_SOURCES = evas_image_load_jpeg.c
module_la_LIBADD = @EINA_LIBS@ @jpeg_libs@ $(top_builddir)/src/lib/libevas.la
module_la_LIBADD = @EINA_LIBS@ @EVIL_LIBS@ @jpeg_libs@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static

View File

@ -1,10 +1,19 @@
#include "evas_common.h"
#include "evas_private.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <jpeglib.h>
#include <setjmp.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
typedef struct _JPEG_error_mgr *emptr;
struct _JPEG_error_mgr

View File

@ -7,7 +7,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@pmaps_cflags@
@pmaps_cflags@ \
@EVIL_CFLAGS@ \
@WIN32_CPPFLAGS@
AM_CFLAGS = @WIN32_CFLAGS@
@ -17,6 +19,6 @@ pkg_LTLIBRARIES = module.la
module_la_SOURCES = evas_image_load_pmaps.c
module_la_LIBADD = @EINA_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LIBADD = @EINA_LIBS@ @EVIL_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static

View File

@ -1,7 +1,16 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
@ -166,7 +175,7 @@ pmaps_buffer_open(Pmaps_Buffer *b, const char *filename)
{
size_t len;
b->file = fopen(filename, "r");
b->file = fopen(filename, "rb");
if (!b->file)
return 0;

View File

@ -7,7 +7,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@PNG_CFLAGS@
@PNG_CFLAGS@ \
@EVIL_CFLAGS@ \
@WIN32_CPPFLAGS@
pkgdir = $(libdir)/evas/modules/loaders/png/$(MODULE_ARCH)
@ -15,6 +17,6 @@ pkg_LTLIBRARIES = module.la
module_la_SOURCES = evas_image_load_png.c
module_la_LIBADD = @EINA_LIBS@ @PNG_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LIBADD = @EINA_LIBS@ @PNG_LIBS@ @EVIL_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static

View File

@ -1,9 +1,19 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <png.h>
#include <stdio.h>
#include <setjmp.h>
#include <png.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"

View File

@ -7,7 +7,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@tiff_cflags@
@tiff_cflags@ \
@EVIL_CFLAGS@ \
@WIN32_CPPFLAGS@
AM_CFLAGS = @WIN32_CFLAGS@
@ -17,6 +19,6 @@ pkg_LTLIBRARIES = module.la
module_la_SOURCES = evas_image_load_tiff.c
module_la_LIBADD = @EINA_LIBS@ @tiff_libs@ $(top_builddir)/src/lib/libevas.la
module_la_LIBADD = @EINA_LIBS@ @EVIL_LIBS@ @tiff_libs@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static

View File

@ -1,9 +1,18 @@
#include "evas_common.h"
#include "evas_private.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <tiffio.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
int evas_image_load_file_head_tiff(Image_Entry *ie, const char *file, const char *key);
int evas_image_load_file_data_tiff(Image_Entry *ie, const char *file, const char *key);

View File

@ -7,7 +7,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@xpm_cflags@
@xpm_cflags@ \
@EVIL_CFLAGS@ \
@WIN32_CPPFLAGS@
AM_CFLAGS = @WIN32_CFLAGS@
@ -17,6 +19,6 @@ pkg_LTLIBRARIES = module.la
module_la_SOURCES = evas_image_load_xpm.c
module_la_LIBADD = @EINA_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LIBADD = @EINA_LIBS@ @EVIL_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static

View File

@ -1,3 +1,12 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"
@ -23,12 +32,12 @@ xpm_parse_color(char *color, int *r, int *g, int *b)
{
int len;
char val[32];
len = strlen(color) - 1;
if (len < 96)
{
int i;
len /= 3;
for (i = 0; i < len; i++)
val[i] = color[1 + i + (0 * len)];
@ -71,7 +80,7 @@ xpm_parse_color(char *color, int *r, int *g, int *b)
{
int rr, gg, bb;
char name[4096];
if (sscanf(buf, "%i %i %i %[^\n]", &rr, &gg, &bb, name) == 4)
{
if (!strcasecmp(name, color))
@ -142,7 +151,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key, int
xpm_parse_done();
return 0;
}
i = 0;
j = 0;
cmap = NULL;
@ -361,7 +370,7 @@ evas_image_load_file_xpm(Image_Entry *ie, const char *file, const char *key, int
}
if (transp) ie->flags.alpha = 1;
if (load_data)
{
evas_cache_image_surface_alloc(ie, w, h);
@ -634,7 +643,7 @@ module_open(Evas_Module *em)
EAPI void
module_close(void)
{
}
EAPI Evas_Module_Api evas_modapi =

View File

@ -7,7 +7,9 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/lib/include \
@FREETYPE_CFLAGS@ \
@EINA_CFLAGS@ \
@PNG_CFLAGS@
@PNG_CFLAGS@ \
@EVIL_CFLAGS@ \
@WIN32_CPPFLAGS@
AM_CFLAGS = @WIN32_CFLAGS@
@ -17,6 +19,6 @@ pkg_LTLIBRARIES = module.la
module_la_SOURCES = evas_image_save_png.c
module_la_LIBADD = @EINA_LIBS@ @PNG_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LIBADD = @EINA_LIBS@ @PNG_LIBS@ @EVIL_LIBS@ $(top_builddir)/src/lib/libevas.la
module_la_LDFLAGS = @lt_no_undefined@ @lt_enable_auto_import@ -module -avoid-version
module_la_LIBTOOLFLAGS = --tag=disable-static

View File

@ -1,3 +1,8 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
@ -5,6 +10,10 @@
#include <png.h>
#include <setjmp.h>
#ifdef HAVE_EVIL
# include <Evil.h>
#endif
#include "evas_common.h"
#include "evas_private.h"