blob: 3fc9be535eaee32ab012ba8d3de3024e01a18322 [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
Daniel Veillard509ed2a2007-04-18 07:51:50 +00009#if defined(_WIN32_WCE)
Igor Zlatkovicddce4422002-09-29 17:51:32 +000010#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
Rob Richardsa544c182008-03-10 15:26:27 +000026#ifndef ICONV_CONST
27#define ICONV_CONST const
28#endif
29
Igor Zlatkovicddce4422002-09-29 17:51:32 +000030#ifdef NEED_SOCKETS
31#include <wsockcompat.h>
32#endif
Owen Taylor3473f882001-02-23 17:55:21 +000033
Daniel Veillard509ed2a2007-04-18 07:51:50 +000034/*
35 * Windows platforms may define except
36 */
37#undef except
38
Owen Taylor3473f882001-02-23 17:55:21 +000039#define HAVE_ISINF
40#define HAVE_ISNAN
Owen Taylor3473f882001-02-23 17:55:21 +000041#include <math.h>
Igor Zlatkovic72f92a82003-06-14 16:48:26 +000042#if defined(_MSC_VER) || defined(__BORLANDC__)
Daniel Veillard50f34372001-08-03 12:06:36 +000043/* MS C-runtime has functions which can be used in order to determine if
44 a given floating-point variable contains NaN, (+-)INF. These are
45 preferred, because floating-point technology is considered propriatary
46 by MS and we can assume that their functions know more about their
47 oddities than we do. */
48#include <float.h>
49/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
50 function. */
51#ifndef isinf
52#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
53 : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
54#endif
55/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
56#ifndef isnan
57#define isnan(d) (_isnan(d))
58#endif
59#else /* _MSC_VER */
Igor Zlatkovic1932b6c2002-12-11 17:00:40 +000060#ifndef isinf
Owen Taylor3473f882001-02-23 17:55:21 +000061static int isinf (double d) {
62 int expon = 0;
63 double val = frexp (d, &expon);
64 if (expon == 1025) {
65 if (val == 0.5) {
66 return 1;
67 } else if (val == -0.5) {
68 return -1;
69 } else {
70 return 0;
71 }
72 } else {
73 return 0;
74 }
75}
Igor Zlatkovic1932b6c2002-12-11 17:00:40 +000076#endif
77#ifndef isnan
Owen Taylor3473f882001-02-23 17:55:21 +000078static int isnan (double d) {
79 int expon = 0;
80 double val = frexp (d, &expon);
81 if (expon == 1025) {
82 if (val == 0.5) {
83 return 0;
84 } else if (val == -0.5) {
85 return 0;
86 } else {
87 return 1;
88 }
89 } else {
90 return 0;
91 }
92}
Igor Zlatkovic1932b6c2002-12-11 17:00:40 +000093#endif
Daniel Veillard50f34372001-08-03 12:06:36 +000094#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +000095
Daniel Veillard3d6aa102005-11-01 10:55:24 +000096#if defined(_MSC_VER)
Igor Zlatkovicb2f61632002-11-14 17:43:55 +000097#define mkdir(p,m) _mkdir(p)
Daniel Veillard2d90de42001-04-16 17:46:18 +000098#define snprintf _snprintf
Rob Richards82fbf572008-01-25 19:03:37 +000099#if _MSC_VER < 1500
Igor Zlatkovicb2f61632002-11-14 17:43:55 +0000100#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
Rob Richards82fbf572008-01-25 19:03:37 +0000101#endif
Daniel Veillard3d6aa102005-11-01 10:55:24 +0000102#elif defined(__MINGW32__)
103#define mkdir(p,m) _mkdir(p)
Igor Zlatkovicb2f61632002-11-14 17:43:55 +0000104#endif
Owen Taylor3473f882001-02-23 17:55:21 +0000105
Igor Zlatkovic2103b052002-10-31 15:59:57 +0000106/* Threading API to use should be specified here for compatibility reasons.
107 This is however best specified on the compiler's command-line. */
108#if defined(LIBXML_THREAD_ENABLED)
Daniel Veillard509ed2a2007-04-18 07:51:50 +0000109#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
Daniel Veillarddb0eb8d2002-01-13 13:35:00 +0000110#define HAVE_WIN32_THREADS
Igor Zlatkovic2103b052002-10-31 15:59:57 +0000111#endif
112#endif
113
114/* Some third-party libraries far from our control assume the following
115 is defined, which it is not if we don't include windows.h. */
116#if !defined(FALSE)
117#define FALSE 0
118#endif
119#if !defined(TRUE)
120#define TRUE (!(FALSE))
121#endif
Daniel Veillarddb0eb8d2002-01-13 13:35:00 +0000122
Daniel Veillard4151acb2001-06-22 10:48:57 +0000123#endif /* __LIBXML_WIN32_CONFIG__ */
124