blob: 7084ebbbb3d7aecb666e47672ae774e93716669a [file] [log] [blame]
Daniel Veillard4151acb2001-06-22 10:48:57 +00001#ifndef __LIBXML_WIN32_CONFIG__
2#define __LIBXML_WIN32_CONFIG__
3
Owen Taylor3473f882001-02-23 17:55:21 +00004#define HAVE_CTYPE_H
5#define HAVE_STDLIB_H
6#define HAVE_MALLOC_H
7#define HAVE_TIME_H
8#define HAVE_FCNTL_H
9
10#include <io.h>
11
Daniel Veillard12f7d292001-06-28 13:12:11 +000012#define SOCKLEN_T int
Daniel Veillardf3afa7d2001-06-09 13:52:58 +000013#ifdef NEED_SOCKETS
Owen Taylor3473f882001-02-23 17:55:21 +000014#include <winsock2.h>
15
16#define EWOULDBLOCK WSAEWOULDBLOCK
17#define EINPROGRESS WSAEINPROGRESS
18#define EALREADY WSAEALREADY
19#define ENOTSOCK WSAENOTSOCK
20#define EDESTADDRREQ WSAEDESTADDRREQ
21#define EMSGSIZE WSAEMSGSIZE
22#define EPROTOTYPE WSAEPROTOTYPE
23#define ENOPROTOOPT WSAENOPROTOOPT
24#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
25#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
26#define EOPNOTSUPP WSAEOPNOTSUPP
27#define EPFNOSUPPORT WSAEPFNOSUPPORT
28#define EAFNOSUPPORT WSAEAFNOSUPPORT
29#define EADDRINUSE WSAEADDRINUSE
30#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
31#define ENETDOWN WSAENETDOWN
32#define ENETUNREACH WSAENETUNREACH
33#define ENETRESET WSAENETRESET
34#define ECONNABORTED WSAECONNABORTED
35#define ECONNRESET WSAECONNRESET
36#define ENOBUFS WSAENOBUFS
37#define EISCONN WSAEISCONN
38#define ENOTCONN WSAENOTCONN
39#define ESHUTDOWN WSAESHUTDOWN
40#define ETOOMANYREFS WSAETOOMANYREFS
41#define ETIMEDOUT WSAETIMEDOUT
42#define ECONNREFUSED WSAECONNREFUSED
43#define ELOOP WSAELOOP
44#define ENAMETOOLONG WSAENAMETOOLONG
45#define EHOSTDOWN WSAEHOSTDOWN
46#define EHOSTUNREACH WSAEHOSTUNREACH
47#define ENOTEMPTY WSAENOTEMPTY
48#define EPROCLIM WSAEPROCLIM
49#define EUSERS WSAEUSERS
50#define EDQUOT WSAEDQUOT
51#define ESTALE WSAESTALE
52#define EREMOTE WSAEREMOTE
53#endif /* INCLUDE_WINSOCK */
54
55#define HAVE_ISINF
56#define HAVE_ISNAN
57
58#include <math.h>
Daniel Veillard50f34372001-08-03 12:06:36 +000059#ifdef _MSC_VER
60/* MS C-runtime has functions which can be used in order to determine if
61 a given floating-point variable contains NaN, (+-)INF. These are
62 preferred, because floating-point technology is considered propriatary
63 by MS and we can assume that their functions know more about their
64 oddities than we do. */
65#include <float.h>
66/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
67 function. */
68#ifndef isinf
69#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
70 : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
71#endif
72/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
73#ifndef isnan
74#define isnan(d) (_isnan(d))
75#endif
76#else /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +000077static int isinf (double d) {
78 int expon = 0;
79 double val = frexp (d, &expon);
80 if (expon == 1025) {
81 if (val == 0.5) {
82 return 1;
83 } else if (val == -0.5) {
84 return -1;
85 } else {
86 return 0;
87 }
88 } else {
89 return 0;
90 }
91}
92static int isnan (double d) {
93 int expon = 0;
94 double val = frexp (d, &expon);
95 if (expon == 1025) {
96 if (val == 0.5) {
97 return 0;
98 } else if (val == -0.5) {
99 return 0;
100 } else {
101 return 1;
102 }
103 } else {
104 return 0;
105 }
106}
Daniel Veillard50f34372001-08-03 12:06:36 +0000107#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +0000108
109#include <direct.h>
110
Daniel Veillard2d90de42001-04-16 17:46:18 +0000111#define HAVE_SYS_STAT_H
112#define HAVE__STAT
113
Daniel Veillard50f34372001-08-03 12:06:36 +0000114#include <libxml/xmlwin32version.h>
115
116#ifdef _MSC_VER
117/* We don't use trio when compiling under MSVC. This is not because trio
118 is bad, but because MSVC has no easy way to conditionally include a .c
119 file in the project. In order to enable trio usage, we would have to compile
120 all trio functionality into the executable, even if we don't use it.
121 Since MS C-runtime has all required functions, trio is not necessary. */
122#ifdef WITH_TRIO
123#undef WITH_TRIO
124#endif /* WITH_TRIO */
125#ifndef WITHOUT_TRIO
126#define WITHOUT_TRIO
127#endif /* WITHOUT_TRIO */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000128/* Microsoft's C runtime names all non-ANSI functions with a leading
129 underscore. Since functionality is still the same, they can be used. */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000130#define snprintf _snprintf
131#define vsnprintf _vsnprintf
132#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +0000133
Daniel Veillard50f34372001-08-03 12:06:36 +0000134#ifndef LIBXML_DLL_IMPORT
135#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
136#define LIBXML_DLL_IMPORT __declspec(dllimport)
137#else
138#define LIBXML_DLL_IMPORT
139#endif
140#endif
Daniel Veillardcc146db2001-06-22 11:10:52 +0000141
142#ifndef ATTRIBUTE_UNUSED
143#define ATTRIBUTE_UNUSED
144#endif
145
Daniel Veillard4151acb2001-06-22 10:48:57 +0000146#endif /* __LIBXML_WIN32_CONFIG__ */
147