summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Rumney <jasonr@gnu.org>2007-08-06 12:52:52 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2007-08-06 12:52:52 -0700
commit43dfc6be8128139888426d8c709aa78efc207953 (patch)
tree4f0f6f9f6ccb5d3e1db56ebebf21e3faaa37b81d /src
parent290f0b9115428dab0cbf2880d154468c557b3e7e (diff)
downloadxorg-lib-libXpm-43dfc6be8128139888426d8c709aa78efc207953.tar.gz
X.Org Bug #11863: Build libXpm on MS Windows (with MinGW)
* src/XpmI.h [FOR_MSW]: Include simx.h instead of real X headers. * src/simx.h (_XFUNCPROTOBEGIN, _XFUNCPROTOEND, NO_ZPIPE): Define. (XAllocColor): Fix arg list in prototype. (bzero, close, fdopen, index, rindex, open, strdup, O_RDONLY): Map to W32 equivalents. * src/RdFToI.c [FOR_MSW]: Include fcntl.h.
Diffstat (limited to 'src')
-rw-r--r--src/RdFToI.c4
-rw-r--r--src/XpmI.h4
-rw-r--r--src/simx.h17
3 files changed, 24 insertions, 1 deletions
diff --git a/src/RdFToI.c b/src/RdFToI.c
index 35fe78e..60db54a 100644
--- a/src/RdFToI.c
+++ b/src/RdFToI.c
@@ -44,6 +44,10 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
+#else
+#ifdef FOR_MSW
+#include <fcntl.h>
+#endif
#endif
LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata));
diff --git a/src/XpmI.h b/src/XpmI.h
index 70844ac..e9f28cc 100644
--- a/src/XpmI.h
+++ b/src/XpmI.h
@@ -58,9 +58,13 @@
extern FILE *popen();
#endif
+#ifdef FOR_MSW
+#include "simx.h"
+#else
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
#include <X11/Xmd.h>
+#endif
#ifdef VMS
#include <unixio.h>
diff --git a/src/simx.h b/src/simx.h
index 001cfdb..7c4c4b9 100644
--- a/src/simx.h
+++ b/src/simx.h
@@ -40,6 +40,9 @@
#ifdef FOR_MSW
#include "windows.h" /* MS windows GDI types */
+#define _XFUNCPROTOBEGIN
+#define _XFUNCPROTOEND
+#define NO_ZPIPE
/*
* minimal portability layer between ansi and KR C
@@ -101,7 +104,7 @@ extern "C" {
/* color related */
FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *));
- FUNC(XAllocColor, int, (Display *, Colormap *, XColor *));
+ FUNC(XAllocColor, int, (Display *, Colormap, XColor *));
FUNC(XQueryColors, void, (Display *display, Colormap *colormap,
XColor *xcolors, int ncolors));
FUNC(XFreeColors, int, (Display *d, Colormap cmap,
@@ -134,6 +137,18 @@ typedef BOOL Bool; /* take MSW bool */
#undef LFUNC
#undef FUNC
+/* Some functions and constants that have non-standard names in the
+ MS library. */
+#define bzero(addr,sz) memset(addr, 0, sz)
+#define close _close
+#define fdopen _fdopen
+#define index strchr
+#define open _open
+#define O_RDONLY _O_RDONLY
+#define rindex strrchr
+#define strdup _strdup
+
+
#endif /* def FOR_MSW */
#endif /* _SIMX_H */