1 #ifndef __LIBXML_WIN32_CONFIG__
2 #define __LIBXML_WIN32_CONFIG__
3 
4 #define HAVE_CTYPE_H
5 #define HAVE_STDARG_H
6 #define HAVE_MALLOC_H
7 #define HAVE_ERRNO_H
8 
9 #ifdef _WIN32_WCE
10 #undef HAVE_ERRNO_H
11 #include <windows.h>
12 #include "wincecompat.h"
13 #elif defined(WIN32)
14 #define HAVE_SYS_STAT_H
15 #define HAVE__STAT
16 #define HAVE_STAT
17 #define HAVE_STDLIB_H
18 #define HAVE_TIME_H
19 #define HAVE_FCNTL_H
20 #include <io.h>
21 #include <direct.h>
22 #endif
23 
24 #include <libxml/xmlversion.h>
25 
26 #ifdef NEED_SOCKETS
27 #include <wsockcompat.h>
28 #endif
29 
30 #define HAVE_ISINF
31 #define HAVE_ISNAN
32 #include <math.h>
33 #ifdef WIN32
34 #if defined(_MSC_VER) || defined(__BORLANDC__)
35 /* MS C-runtime has functions which can be used in order to determine if
36    a given floating-point variable contains NaN, (+-)INF. These are
37    preferred, because floating-point technology is considered propriatary
38    by MS and we can assume that their functions know more about their
39    oddities than we do. */
40 #include <float.h>
41 /* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
42    function. */
43 #ifndef isinf
44 #define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
45 	: ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
46 #endif
47 /* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
48 #ifndef isnan
49 #define isnan(d) (_isnan(d))
50 #endif
51 #else /* _MSC_VER */
52 #ifndef isinf
isinf(double d)53 static int isinf (double d) {
54     int expon = 0;
55     double val = frexp (d, &expon);
56     if (expon == 1025) {
57         if (val == 0.5) {
58             return 1;
59         } else if (val == -0.5) {
60             return -1;
61         } else {
62             return 0;
63         }
64     } else {
65         return 0;
66     }
67 }
68 #endif
69 #ifndef isnan
isnan(double d)70 static int isnan (double d) {
71     int expon = 0;
72     double val = frexp (d, &expon);
73     if (expon == 1025) {
74         if (val == 0.5) {
75             return 0;
76         } else if (val == -0.5) {
77             return 0;
78         } else {
79             return 1;
80         }
81     } else {
82         return 0;
83     }
84 }
85 #endif
86 #endif /* _MSC_VER */
87 #endif // WIN32
88 
89 #if defined(_MSC_VER) || defined(__MINGW32__)
90 #define mkdir(p,m) _mkdir(p)
91 #define snprintf _snprintf
92 #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
93 #endif
94 
95 /* Threading API to use should be specified here for compatibility reasons.
96    This is however best specified on the compiler's command-line. */
97 #if defined(LIBXML_THREAD_ENABLED)
98 #if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS)
99 #define HAVE_WIN32_THREADS
100 #endif
101 #endif
102 
103 /* Some third-party libraries far from our control assume the following
104    is defined, which it is not if we don't include windows.h. */
105 #if !defined(FALSE)
106 #define FALSE 0
107 #endif
108 #if !defined(TRUE)
109 #define TRUE (!(FALSE))
110 #endif
111 
112 #endif /* __LIBXML_WIN32_CONFIG__ */
113 
114