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