blob: 8dcfcdee3647ad93716a073c1f5f52837488be38 [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
Daniel Veillardf216d462002-02-08 13:44:24 +00005#define HAVE_STDARG_H
Owen Taylor3473f882001-02-23 17:55:21 +00006#define HAVE_MALLOC_H
Igor Zlatkovicddce4422002-09-29 17:51:32 +00007#define HAVE_ERRNO_H
8
9#ifdef _WIN32_WCE
10#undef HAVE_ERRNO_H
11#include <windows.h>
12#include "wincecompat.h"
13#else
14#define HAVE_SYS_STAT_H
15#define HAVE__STAT
16#define HAVE_STAT
17#define HAVE_STDLIB_H
Owen Taylor3473f882001-02-23 17:55:21 +000018#define HAVE_TIME_H
19#define HAVE_FCNTL_H
Owen Taylor3473f882001-02-23 17:55:21 +000020#include <io.h>
Igor Zlatkovicddce4422002-09-29 17:51:32 +000021#include <direct.h>
Igor Zlatkovic648b8e92002-04-17 18:35:57 +000022#endif
23
Igor Zlatkovic2103b052002-10-31 15:59:57 +000024#include <libxml/xmlversion.h>
Igor Zlatkovic648b8e92002-04-17 18:35:57 +000025
Igor Zlatkovicddce4422002-09-29 17:51:32 +000026#ifdef NEED_SOCKETS
27#include <wsockcompat.h>
28#endif
Owen Taylor3473f882001-02-23 17:55:21 +000029
30#define HAVE_ISINF
31#define HAVE_ISNAN
Owen Taylor3473f882001-02-23 17:55:21 +000032#include <math.h>
Daniel Veillard50f34372001-08-03 12:06:36 +000033#ifdef _MSC_VER
34/* MS C-runtime has functions which can be used in order to determine if
35 a given floating-point variable contains NaN, (+-)INF. These are
36 preferred, because floating-point technology is considered propriatary
37 by MS and we can assume that their functions know more about their
38 oddities than we do. */
39#include <float.h>
40/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
41 function. */
42#ifndef isinf
43#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
44 : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
45#endif
46/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
47#ifndef isnan
48#define isnan(d) (_isnan(d))
49#endif
50#else /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +000051static int isinf (double d) {
52 int expon = 0;
53 double val = frexp (d, &expon);
54 if (expon == 1025) {
55 if (val == 0.5) {
56 return 1;
57 } else if (val == -0.5) {
58 return -1;
59 } else {
60 return 0;
61 }
62 } else {
63 return 0;
64 }
65}
66static int isnan (double d) {
67 int expon = 0;
68 double val = frexp (d, &expon);
69 if (expon == 1025) {
70 if (val == 0.5) {
71 return 0;
72 } else if (val == -0.5) {
73 return 0;
74 } else {
75 return 1;
76 }
77 } else {
78 return 0;
79 }
80}
Daniel Veillard50f34372001-08-03 12:06:36 +000081#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +000082
Igor Zlatkovicb2f61632002-11-14 17:43:55 +000083#if defined(_MSC_VER) || defined(__MINGW32__)
84#define mkdir(p,m) _mkdir(p)
Daniel Veillard2d90de42001-04-16 17:46:18 +000085#define snprintf _snprintf
Igor Zlatkovicb2f61632002-11-14 17:43:55 +000086#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
87#endif
Owen Taylor3473f882001-02-23 17:55:21 +000088
Igor Zlatkovic2103b052002-10-31 15:59:57 +000089/* Threading API to use should be specified here for compatibility reasons.
90 This is however best specified on the compiler's command-line. */
91#if defined(LIBXML_THREAD_ENABLED)
92#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS)
Daniel Veillarddb0eb8d2002-01-13 13:35:00 +000093#define HAVE_WIN32_THREADS
Igor Zlatkovic2103b052002-10-31 15:59:57 +000094#endif
95#endif
96
97/* Some third-party libraries far from our control assume the following
98 is defined, which it is not if we don't include windows.h. */
99#if !defined(FALSE)
100#define FALSE 0
101#endif
102#if !defined(TRUE)
103#define TRUE (!(FALSE))
104#endif
Daniel Veillarddb0eb8d2002-01-13 13:35:00 +0000105
Daniel Veillard4151acb2001-06-22 10:48:57 +0000106#endif /* __LIBXML_WIN32_CONFIG__ */
107