diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog index 9d0b7070bc..d8f3bf7c93 100644 --- a/legacy/evil/ChangeLog +++ b/legacy/evil/ChangeLog @@ -1,3 +1,29 @@ +2008-10-11 Vincent Torri + + * configure.ac: + * src/lib/Makefile.am: + readd guards suppressed in previous commit + + * src/lib/Evil.h: + include new header files + + * src/lib/errno.h: + * src/lib/evil_errno.c: + add fake errno system with mingw32ce + + * src/lib/evil_fcntl.c: + * src/lib/evil_fcntl.h: + fix compilation on cegcc and mingw32 (mainly does + nothing on Windows CE) + + * src/lib/evil_stdio.c: + * src/lib/evil_stdio.h: + add rewind and perror for mingw32ce + + * src/lib/evil_string.c: + * src/lib/evil_string.h: + add strerror for mingw32ce + 2008-10-11 Vincent Torri * configure.ac: @@ -42,7 +68,7 @@ fix mkstemp() on all Windows platform, guard errno stuff * src/lib/evil_stdlib.h: - template -> __template because 'template ' is a c++ keyword. + template -> __template because 'template' is a c++ keyword. * src/lib/evil_unistd.c: guard errno stuff diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac index fd203f9c60..7bf0fe2de2 100644 --- a/legacy/evil/configure.ac +++ b/legacy/evil/configure.ac @@ -97,6 +97,7 @@ if test "x${have_wince}" = "xyes" ; then fi AM_CONDITIONAL(EVIL_HAVE_WINCE, test "x${have_wince}" = "xyes") +AM_CONDITIONAL(EVIL_HAVE_MINGW32CE, test "x${have_mingw32ce}" = "xyes") ### Checks for linker characteristics diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h index eff555b4b5..40c2bdb519 100644 --- a/legacy/evil/src/lib/Evil.h +++ b/legacy/evil/src/lib/Evil.h @@ -105,6 +105,8 @@ typedef unsigned long gid_t; #include "evil_fcntl.h" #include "evil_langinfo.h" #include "evil_stdlib.h" +#include "evil_stdio.h" +#include "evil_string.h" #include "evil_unistd.h" #include "evil_util.h" diff --git a/legacy/evil/src/lib/Makefile.am b/legacy/evil/src/lib/Makefile.am index 18318d64fc..7287859306 100644 --- a/legacy/evil/src/lib/Makefile.am +++ b/legacy/evil/src/lib/Makefile.am @@ -10,13 +10,22 @@ Evil.h \ evil_fcntl.h \ evil_langinfo.h \ evil_stdlib.h \ +evil_stdio.h \ +evil_string.h \ evil_unistd.h \ evil_util.h -nobase_include_HEADERS = fnmatch.h pwd.h sys/mman.h +nobase_include_HEADERS = pwd.h sys/mman.h + +if EVIL_HAVE_MINGW32CE + +nobase_include_HEADERS += fnmatch.h errno.h + +endif libevil_la_SOURCES = \ evil.c \ +evil_errno.c \ evil_fcntl.c \ evil_fnmatch.c \ evil_fnmatch_list_of_states.c \ @@ -24,6 +33,8 @@ evil_langinfo.c \ evil_mman.c \ evil_pwd.c \ evil_stdlib.c \ +evil_stdio.c \ +evil_string.c \ evil_unistd.c \ evil_util.c diff --git a/legacy/evil/src/lib/errno.h b/legacy/evil/src/lib/errno.h new file mode 100644 index 0000000000..390bf64fe4 --- /dev/null +++ b/legacy/evil/src/lib/errno.h @@ -0,0 +1,111 @@ +#ifndef __EVIL_ERRNO_H__ +#define __EVIL_ERRNO_H__ + +#ifdef EAPI +# undef EAPI +#endif /* EAPI */ + +#ifdef _WIN32 +# ifdef EFL_EVIL_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_EVIL_BUILD */ +#endif /* _WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern int errno; + +/* Fake values */ +#define E2BIG 1 +#define EACCES 2 +#define EAGAIN 3 +#define EBADF 4 +#define EBADMSG 5 +#define EBUSY 6 +#define ECANCELED 7 +#define ECHILD 9 +#define EDEADLK 10 +#define EDOM 11 +#define EEXIST 12 +#define EFAULT 13 +#define EFBIG 14 +#define EINPROGRESS 15 +#define EINTR 16 +#define EINVAL 17 +#define EIO 18 +#define EISDIR 19 +#define EMFILE 20 +#define EMLINK 21 +#define EMSGSIZE 22 +#define ENAMETOOLONG 23 +#define ENFILE 24 +#define ENODEV 25 +#define ENOENT 26 +#define ENOEXEC 27 +#define ENOLCK 28 +#define ENOMEM 29 +#define ENOSPC 30 +#define ENOSYS 31 +#define ENOTDIR 32 +#define ENOTEMPTY 33 +#define ENOTSUP 34 +#define ENOTTY 35 +#define ENXIO 36 +#define EPERM 37 +#define EPIPE 38 +#define ERANGE 39 +#define EROFS 40 +#define ESPIPE 41 +#define ESRCH 42 +#define ETIMEDOUT 43 +#define EXDEV 44 +#define EADDRINUSE 45 +#define EADDRNOTAVAIL 46 +#define EAFNOSUPPORT 47 +#define EALREADY 48 +#define ECONNABORTED 49 +#define ECONNREFUSED 50 +#define ECONNRESET 51 +#define EDESTADDRREQ 52 +#define EDQUOT 53 +#define EHOSTUNREACH 54 +#define EIDRM 55 +#define EILSEQ 56 +#define EISCONN 57 +#define ELOOP 58 +#define EMULTIHOP 59 +#define ENETDOWN 60 +#define ENETRESET 61 +#define ENETUNREACH 62 +#define ENOBUFS 63 +#define ENODATA 64 +#define ENOLINK 65 +#define ENOMSG 66 +#define ENOPROTOOPT 67 +#define ENOSR 68 +#define ENOSTR 69 +#define ENOTCONN 70 +#define ENOTSOCK 71 +#define EOPNOTSUPP 72 +#define EOVERFLOW 73 +#define EPROTO 74 +#define EPROTONOSUPPORT 75 +#define EPROTOTYPE 76 +#define ESTALE 77 +#define ETIME 78 +#define ETXTBSY 79 +#define EWOULDBLOCK 80 + +#ifdef __cplusplus +} +#endif + +#endif /* __EVIL_ERRNO_H__ */ diff --git a/legacy/evil/src/lib/evil_errno.c b/legacy/evil/src/lib/evil_errno.c new file mode 100644 index 0000000000..2320f06fe2 --- /dev/null +++ b/legacy/evil/src/lib/evil_errno.c @@ -0,0 +1,7 @@ +#ifdef __MINGW32CE__ + +#include "Evil.h" + +int errno = 0; + +#endif /* __MINGW32CE__ */ diff --git a/legacy/evil/src/lib/evil_fcntl.c b/legacy/evil/src/lib/evil_fcntl.c index 58438b3a30..4d0c7196e7 100644 --- a/legacy/evil/src/lib/evil_fcntl.c +++ b/legacy/evil/src/lib/evil_fcntl.c @@ -24,8 +24,6 @@ * */ -#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) - int fcntl(int fd, int cmd, ...) { va_list va; @@ -45,10 +43,13 @@ int fcntl(int fd, int cmd, ...) flag = va_arg(va, long); if (flag == FD_CLOEXEC) { +#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) if (SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0)) res = 0; +#endif /* __CEGCC__ || __MINGW32CE__ */ } } +#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) ) else if ((cmd == F_SETLK) || (cmd == F_SETLKW)) { struct flock fl; @@ -81,9 +82,9 @@ int fcntl(int fd, int cmd, ...) res = _locking(fd, _LK_UNLCK, fl.l_len); } +#endif /* __CEGCC__ || __MINGW32CE__ */ + va_end(va); return res; } - -#endif /* __CEGCC__ || __MINGW32CE__ */ diff --git a/legacy/evil/src/lib/evil_fcntl.h b/legacy/evil/src/lib/evil_fcntl.h index cedeffb6e8..1043791e39 100644 --- a/legacy/evil/src/lib/evil_fcntl.h +++ b/legacy/evil/src/lib/evil_fcntl.h @@ -2,8 +2,6 @@ #define __EVIL_FCNTL_H__ -#ifndef __CEGCC__ - # include /** @@ -100,7 +98,4 @@ struct flock EAPI int fcntl(int fd, int cmd, ...); -#endif /* ! __CEGCC__ */ - - #endif /* __EVIL_FCNTL_H__ */ diff --git a/legacy/evil/src/lib/evil_stdio.c b/legacy/evil/src/lib/evil_stdio.c new file mode 100644 index 0000000000..37d38c1a40 --- /dev/null +++ b/legacy/evil/src/lib/evil_stdio.c @@ -0,0 +1,31 @@ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include "Evil.h" + + +#ifdef __MINGW32CE__ + +/* + * Error related functions + * + */ + +void perror (const char *s) +{ + fprintf(stderr, "[Windows CE] error\n"); +} + +/* + * Stream related functions + * + */ + +void rewind(FILE *stream) +{ + fseek(stream, 0, SEEK_SET); +} + +#endif /* __MINGW32CE__ */ diff --git a/legacy/evil/src/lib/evil_stdio.h b/legacy/evil/src/lib/evil_stdio.h new file mode 100644 index 0000000000..6077001918 --- /dev/null +++ b/legacy/evil/src/lib/evil_stdio.h @@ -0,0 +1,27 @@ +#ifndef __EVIL_STDIO_H__ +#define __EVIL_STDIO_H__ + + +#include + + +#ifdef __MINGW32CE__ + +/* + * Error related functions + * + */ + +EAPI void perror (const char *s); + +/* + * Stream related functions + * + */ + +EAPI void rewind(FILE *stream); + +#endif /* __MINGW32CE__ */ + + +#endif /* __EVIL_STDIO_H__ */ diff --git a/legacy/evil/src/lib/evil_string.c b/legacy/evil/src/lib/evil_string.c new file mode 100644 index 0000000000..878a1c2de6 --- /dev/null +++ b/legacy/evil/src/lib/evil_string.c @@ -0,0 +1,21 @@ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif /* HAVE_CONFIG_H */ + +#include "Evil.h" + + +#ifdef __MINGW32CE__ + +/* + * Error related functions + * + */ + +char *strerror (int errnum) +{ + return "[Windows CE] error\n"; +} + +#endif /* __MINGW32CE__ */ diff --git a/legacy/evil/src/lib/evil_string.h b/legacy/evil/src/lib/evil_string.h new file mode 100644 index 0000000000..f6a52006cc --- /dev/null +++ b/legacy/evil/src/lib/evil_string.h @@ -0,0 +1,17 @@ +#ifndef __EVIL_STRING_H__ +#define __EVIL_STRING_H__ + + +#ifdef __MINGW32CE__ + +/* + * Environment variable related functions + * + */ + +EAPI char *strerror (int errnum); + +#endif /* __MINGW32CE__ */ + + +#endif /* __EVIL_STRING_H__ */