blob: 3e56217adfe60c2d989d0964eff0e5f1fbde64d7 [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
Daniel Veillard16756b62001-10-01 07:36:25 +0000113#define HAVE_STAT
Daniel Veillard2d90de42001-04-16 17:46:18 +0000114
Daniel Veillard50f34372001-08-03 12:06:36 +0000115#include <libxml/xmlwin32version.h>
116
117#ifdef _MSC_VER
118/* We don't use trio when compiling under MSVC. This is not because trio
119 is bad, but because MSVC has no easy way to conditionally include a .c
120 file in the project. In order to enable trio usage, we would have to compile
121 all trio functionality into the executable, even if we don't use it.
122 Since MS C-runtime has all required functions, trio is not necessary. */
123#ifdef WITH_TRIO
124#undef WITH_TRIO
125#endif /* WITH_TRIO */
126#ifndef WITHOUT_TRIO
127#define WITHOUT_TRIO
128#endif /* WITHOUT_TRIO */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000129/* Microsoft's C runtime names all non-ANSI functions with a leading
130 underscore. Since functionality is still the same, they can be used. */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000131#define snprintf _snprintf
132#define vsnprintf _vsnprintf
133#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +0000134
Daniel Veillard50f34372001-08-03 12:06:36 +0000135#ifndef LIBXML_DLL_IMPORT
136#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
137#define LIBXML_DLL_IMPORT __declspec(dllimport)
138#else
139#define LIBXML_DLL_IMPORT
140#endif
141#endif
Daniel Veillardcc146db2001-06-22 11:10:52 +0000142
143#ifndef ATTRIBUTE_UNUSED
144#define ATTRIBUTE_UNUSED
145#endif
146
Daniel Veillarddb0eb8d2002-01-13 13:35:00 +0000147/* Define this if you want to use Windows native thread implementation.
148 Undefine it if you wish to use another, pthreads for example. Note
149 that this alone does not enable threads, just specifies the
150 threading model. Threading support is activated in xmlversion.h by
151 defining LIBXML_THREAD_ENABLE. */
152#define HAVE_WIN32_THREADS
153
Daniel Veillard4151acb2001-06-22 10:48:57 +0000154#endif /* __LIBXML_WIN32_CONFIG__ */
155