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