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