Commit 59d3ed8f authored by Daniel Veillard's avatar Daniel Veillard

applied patch from Andreas Stricke to ease the compilation on Windows CE

* catalog.c libxml.h win32/wince/wincecompat.h win32/wince/wincecompat.c
  xmlIO.c nanohttp.c nanoftp.c trio.c triostr.c triostr.h: applied 
  patch from Andreas Stricke to ease the compilation on Windows CE
Daniel

svn path=/trunk/; revision=3600
parent ed12138b
Tue Apr 17 14:47:42 CEST 2007 Daniel Veillard <daniel@veillard.com>
* catalog.c libxml.h win32/wince/wincecompat.h win32/wince/wincecompat.c
xmlIO.c nanohttp.c nanoftp.c trio.c triostr.c triostr.h: applied
patch from Andreas Stricke to ease the compilation on Windows CE
Tue Apr 17 14:34:45 CEST 2007 Daniel Veillard <daniel@veillard.com> Tue Apr 17 14:34:45 CEST 2007 Daniel Veillard <daniel@veillard.com>
* xmllint.c catalog.c: "xmllint unusable on win32" so applied * xmllint.c catalog.c: "xmllint unusable on win32" so applied
......
...@@ -77,9 +77,15 @@ ...@@ -77,9 +77,15 @@
#if defined(_WIN32) && defined(_MSC_VER) #if defined(_WIN32) && defined(_MSC_VER)
#undef XML_XML_DEFAULT_CATALOG #undef XML_XML_DEFAULT_CATALOG
static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog"; static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog";
#if defined(_WIN32_WCE)
/* Windows CE don't have a A variant */
#define GetModuleHandleA GetModuleHandle
#define GetModuleFileNameA GetModuleFileName
#else
void* __stdcall GetModuleHandleA(const char*); void* __stdcall GetModuleHandleA(const char*);
unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long); unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long);
#endif #endif
#endif
static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID); static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID);
static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename); static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename);
......
...@@ -32,6 +32,15 @@ int snprintf(char *, size_t, const char *, ...); ...@@ -32,6 +32,15 @@ int snprintf(char *, size_t, const char *, ...);
int vfprintf(FILE *, const char *, va_list); int vfprintf(FILE *, const char *, va_list);
#endif #endif
/*
* Windows CE compatibility definitions and functions
* This is needed to compile libxml2 for Windows CE.
* At least I tested it with WinCE 4.2 for Emulator and SH4 target
*/
#if defined(_WIN32_WCE)
#include <wincecompat.h>
#endif
#ifndef WITH_TRIO #ifndef WITH_TRIO
#include <stdio.h> #include <stdio.h>
#else #else
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#endif #endif
#ifdef __MINGW32__ #if defined(__MINGW32__) || defined(_WIN32_WCE)
#define _WINSOCKAPI_ #define _WINSOCKAPI_
#include <wsockcompat.h> #include <wsockcompat.h>
#include <winsock2.h> #include <winsock2.h>
......
...@@ -74,8 +74,7 @@ ...@@ -74,8 +74,7 @@
#define SOCKET int #define SOCKET int
#endif #endif
#if defined(__MINGW32__) || defined(_WIN32_WCE)
#ifdef __MINGW32__
#define _WINSOCKAPI_ #define _WINSOCKAPI_
#include <wsockcompat.h> #include <wsockcompat.h>
#include <winsock2.h> #include <winsock2.h>
......
...@@ -62,7 +62,9 @@ ...@@ -62,7 +62,9 @@
#include <limits.h> #include <limits.h>
#include <float.h> #include <float.h>
#if defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) || defined(USE_MULTIBYTE) || TRIO_WIDECHAR #if (defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) \
|| defined(USE_MULTIBYTE) || TRIO_WIDECHAR) \
&& !defined(_WIN32_WCE)
# define TRIO_COMPILER_SUPPORTS_MULTIBYTE # define TRIO_COMPILER_SUPPORTS_MULTIBYTE
# if !defined(MB_LEN_MAX) # if !defined(MB_LEN_MAX)
# define MB_LEN_MAX 6 # define MB_LEN_MAX 6
...@@ -73,6 +75,10 @@ ...@@ -73,6 +75,10 @@
# define TRIO_COMPILER_SUPPORTS_MSVC_INT # define TRIO_COMPILER_SUPPORTS_MSVC_INT
#endif #endif
#if defined(_WIN32_WCE)
#include <wincecompat.h>
#endif
/************************************************************************* /*************************************************************************
* Generic definitions * Generic definitions
*/ */
...@@ -92,7 +98,10 @@ ...@@ -92,7 +98,10 @@
# include <stdarg.h> # include <stdarg.h>
#endif #endif
#include <stddef.h> #include <stddef.h>
#ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif
#ifndef NULL #ifndef NULL
# define NULL 0 # define NULL 0
...@@ -133,9 +142,13 @@ typedef unsigned long trio_flags_t; ...@@ -133,9 +142,13 @@ typedef unsigned long trio_flags_t;
# include <unistd.h> # include <unistd.h>
#endif #endif
#if defined(TRIO_PLATFORM_WIN32) #if defined(TRIO_PLATFORM_WIN32)
# include <io.h> # if defined(_WIN32_WCE)
# define read _read # include <wincecompat.h>
# define write _write # else
# include <io.h>
# define read _read
# define write _write
# endif
#endif /* TRIO_PLATFORM_WIN32 */ #endif /* TRIO_PLATFORM_WIN32 */
#if TRIO_WIDECHAR #if TRIO_WIDECHAR
...@@ -243,8 +256,9 @@ typedef trio_longlong_t trio_int64_t; ...@@ -243,8 +256,9 @@ typedef trio_longlong_t trio_int64_t;
# endif # endif
#endif #endif
#if !(defined(TRIO_COMPILER_SUPPORTS_C99) \ #if (!(defined(TRIO_COMPILER_SUPPORTS_C99) \
|| defined(TRIO_COMPILER_SUPPORTS_UNIX01)) || defined(TRIO_COMPILER_SUPPORTS_UNIX01))) \
&& !defined(_WIN32_WCE)
# define floorl(x) floor((double)(x)) # define floorl(x) floor((double)(x))
# define fmodl(x,y) fmod((double)(x),(double)(y)) # define fmodl(x,y) fmod((double)(x),(double)(y))
# define powl(x,y) pow((double)(x),(double)(y)) # define powl(x,y) pow((double)(x),(double)(y))
......
...@@ -73,7 +73,11 @@ ...@@ -73,7 +73,11 @@
# endif # endif
#elif defined(TRIO_PLATFORM_WIN32) #elif defined(TRIO_PLATFORM_WIN32)
# define USE_STRCASECMP # define USE_STRCASECMP
# define strcasecmp(x,y) strcmpi(x,y) # if defined(_WIN32_WCE)
# define strcasecmp(x,y) _stricmp(x,y)
# else
# define strcasecmp(x,y) strcmpi(x,y)
# endif
#endif #endif
#if !(defined(TRIO_PLATFORM_SUNOS)) #if !(defined(TRIO_PLATFORM_SUNOS))
...@@ -574,7 +578,7 @@ TRIO_ARGS1((error_number), ...@@ -574,7 +578,7 @@ TRIO_ARGS1((error_number),
} }
#if !defined(TRIO_MINIMAL) #if !defined(TRIO_MINIMAL) && !defined(_WIN32_WCE)
/** /**
Format the date/time according to @p format. Format the date/time according to @p format.
...@@ -1887,7 +1891,7 @@ TRIO_ARGS3((self, max, other), ...@@ -1887,7 +1891,7 @@ TRIO_ARGS3((self, max, other),
#endif /* !defined(TRIO_MINIMAL) */ #endif /* !defined(TRIO_MINIMAL) */
#if !defined(TRIO_MINIMAL) #if !defined(TRIO_MINIMAL) && !defined(_WIN32_WCE)
/* /*
* trio_string_format_data_max * trio_string_format_data_max
*/ */
......
...@@ -65,7 +65,9 @@ TRIO_STRING_PUBLIC int trio_contains TRIO_PROTO((const char *string, const char ...@@ -65,7 +65,9 @@ TRIO_STRING_PUBLIC int trio_contains TRIO_PROTO((const char *string, const char
TRIO_STRING_PUBLIC int trio_copy TRIO_PROTO((char *target, const char *source)); TRIO_STRING_PUBLIC int trio_copy TRIO_PROTO((char *target, const char *source));
TRIO_STRING_PUBLIC char *trio_duplicate_max TRIO_PROTO((const char *source, size_t max)); TRIO_STRING_PUBLIC char *trio_duplicate_max TRIO_PROTO((const char *source, size_t max));
TRIO_STRING_PUBLIC int trio_equal_case_max TRIO_PROTO((const char *first, size_t max, const char *second)); TRIO_STRING_PUBLIC int trio_equal_case_max TRIO_PROTO((const char *first, size_t max, const char *second));
#if !defined(_WIN32_WCE)
TRIO_STRING_PUBLIC size_t trio_format_date_max TRIO_PROTO((char *target, size_t max, const char *format, const struct tm *datetime)); TRIO_STRING_PUBLIC size_t trio_format_date_max TRIO_PROTO((char *target, size_t max, const char *format, const struct tm *datetime));
#endif
TRIO_STRING_PUBLIC unsigned long trio_hash TRIO_PROTO((const char *string, int type)); TRIO_STRING_PUBLIC unsigned long trio_hash TRIO_PROTO((const char *string, int type));
TRIO_STRING_PUBLIC char *trio_index TRIO_PROTO((const char *string, int character)); TRIO_STRING_PUBLIC char *trio_index TRIO_PROTO((const char *string, int character));
TRIO_STRING_PUBLIC char *trio_index_last TRIO_PROTO((const char *string, int character)); TRIO_STRING_PUBLIC char *trio_index_last TRIO_PROTO((const char *string, int character));
...@@ -114,7 +116,9 @@ TRIO_STRING_PUBLIC int trio_string_equal TRIO_PROTO((trio_string_t *self, trio_s ...@@ -114,7 +116,9 @@ TRIO_STRING_PUBLIC int trio_string_equal TRIO_PROTO((trio_string_t *self, trio_s
TRIO_STRING_PUBLIC int trio_string_equal_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second)); TRIO_STRING_PUBLIC int trio_string_equal_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second));
TRIO_STRING_PUBLIC int trio_string_equal_case TRIO_PROTO((trio_string_t *self, trio_string_t *other)); TRIO_STRING_PUBLIC int trio_string_equal_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
TRIO_STRING_PUBLIC int trio_string_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other)); TRIO_STRING_PUBLIC int trio_string_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other));
#if !defined(_WIN32_WCE)
TRIO_STRING_PUBLIC size_t trio_string_format_date_max TRIO_PROTO((trio_string_t *self, size_t max, const char *format, const struct tm *datetime)); TRIO_STRING_PUBLIC size_t trio_string_format_date_max TRIO_PROTO((trio_string_t *self, size_t max, const char *format, const struct tm *datetime));
#endif
TRIO_STRING_PUBLIC char *trio_string_index TRIO_PROTO((trio_string_t *self, int character)); TRIO_STRING_PUBLIC char *trio_string_index TRIO_PROTO((trio_string_t *self, int character));
TRIO_STRING_PUBLIC char *trio_string_index_last TRIO_PROTO((trio_string_t *self, int character)); TRIO_STRING_PUBLIC char *trio_string_index_last TRIO_PROTO((trio_string_t *self, int character));
TRIO_STRING_PUBLIC int trio_string_length TRIO_PROTO((trio_string_t *self)); TRIO_STRING_PUBLIC int trio_string_length TRIO_PROTO((trio_string_t *self));
......
...@@ -47,6 +47,14 @@ int close(int handle) ...@@ -47,6 +47,14 @@ int close(int handle)
} }
char *getcwd( char *buffer, unsigned int size)
{
/* Windows CE don't have the concept of a current directory
* so we just return NULL to indicate an error
*/
return NULL;
}
char *getenv( const char *varname ) char *getenv( const char *varname )
{ {
return NULL; return NULL;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#define __WINCECOMPAT_H__ #define __WINCECOMPAT_H__
#include <stdio.h> #include <stdio.h>
#include <winbase.h>
#define MAX_STRERROR 31 #define MAX_STRERROR 31
...@@ -24,6 +25,8 @@ ...@@ -24,6 +25,8 @@
#define O_TRUNC 0x0200 /* open and truncate */ #define O_TRUNC 0x0200 /* open and truncate */
#define O_EXCL 0x0400 /* open only if file doesn't already exist */ #define O_EXCL 0x0400 /* open only if file doesn't already exist */
#define BUFSIZ 4096
extern int errno; extern int errno;
/* /*
Prototypes Prototypes
...@@ -33,6 +36,7 @@ int write(int handle, const char *buffer, unsigned int len); ...@@ -33,6 +36,7 @@ int write(int handle, const char *buffer, unsigned int len);
int open(const char *filename,int oflag, ...); int open(const char *filename,int oflag, ...);
int close(int handle); int close(int handle);
char *getenv( const char *varname ); char *getenv( const char *varname );
char *getcwd( char *buffer, unsigned int size);
char *strerror(int errnum); char *strerror(int errnum);
/* /*
......
...@@ -36,10 +36,14 @@ ...@@ -36,10 +36,14 @@
#include <zlib.h> #include <zlib.h>
#endif #endif
#ifdef WIN32 #if defined(WIN32) || defined(_WIN32)
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(_WIN32_WCE)
#include <winnls.h> /* for CP_UTF8 */
#endif
/* Figure a portable way to know if a file is a directory. */ /* Figure a portable way to know if a file is a directory. */
#ifndef HAVE_STAT #ifndef HAVE_STAT
# ifdef HAVE__STAT # ifdef HAVE__STAT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment