Daniel Veillard | 4151acb | 2001-06-22 10:48:57 +0000 | [diff] [blame] | 1 | #ifndef __LIBXML_WIN32_CONFIG__ |
| 2 | #define __LIBXML_WIN32_CONFIG__ |
| 3 | |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 4 | #define HAVE_CTYPE_H |
Daniel Veillard | f216d46 | 2002-02-08 13:44:24 +0000 | [diff] [blame] | 5 | #define HAVE_STDARG_H |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 6 | #define HAVE_MALLOC_H |
Igor Zlatkovic | ddce442 | 2002-09-29 17:51:32 +0000 | [diff] [blame] | 7 | #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 Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 18 | #define HAVE_TIME_H |
| 19 | #define HAVE_FCNTL_H |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 20 | #include <io.h> |
Igor Zlatkovic | ddce442 | 2002-09-29 17:51:32 +0000 | [diff] [blame] | 21 | #include <direct.h> |
Igor Zlatkovic | 648b8e9 | 2002-04-17 18:35:57 +0000 | [diff] [blame] | 22 | #endif |
| 23 | |
Igor Zlatkovic | 2103b05 | 2002-10-31 15:59:57 +0000 | [diff] [blame] | 24 | #include <libxml/xmlversion.h> |
Igor Zlatkovic | 648b8e9 | 2002-04-17 18:35:57 +0000 | [diff] [blame] | 25 | |
Igor Zlatkovic | ddce442 | 2002-09-29 17:51:32 +0000 | [diff] [blame] | 26 | #ifdef NEED_SOCKETS |
| 27 | #include <wsockcompat.h> |
| 28 | #endif |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 29 | |
| 30 | #define HAVE_ISINF |
| 31 | #define HAVE_ISNAN |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 32 | #include <math.h> |
Igor Zlatkovic | 72f92a8 | 2003-06-14 16:48:26 +0000 | [diff] [blame] | 33 | #if defined(_MSC_VER) || defined(__BORLANDC__) |
Daniel Veillard | 50f3437 | 2001-08-03 12:06:36 +0000 | [diff] [blame] | 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 */ |
Igor Zlatkovic | 1932b6c | 2002-12-11 17:00:40 +0000 | [diff] [blame] | 51 | #ifndef isinf |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 52 | static int isinf (double d) { |
| 53 | int expon = 0; |
| 54 | double val = frexp (d, &expon); |
| 55 | if (expon == 1025) { |
| 56 | if (val == 0.5) { |
| 57 | return 1; |
| 58 | } else if (val == -0.5) { |
| 59 | return -1; |
| 60 | } else { |
| 61 | return 0; |
| 62 | } |
| 63 | } else { |
| 64 | return 0; |
| 65 | } |
| 66 | } |
Igor Zlatkovic | 1932b6c | 2002-12-11 17:00:40 +0000 | [diff] [blame] | 67 | #endif |
| 68 | #ifndef isnan |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 69 | static int isnan (double d) { |
| 70 | int expon = 0; |
| 71 | double val = frexp (d, &expon); |
| 72 | if (expon == 1025) { |
| 73 | if (val == 0.5) { |
| 74 | return 0; |
| 75 | } else if (val == -0.5) { |
| 76 | return 0; |
| 77 | } else { |
| 78 | return 1; |
| 79 | } |
| 80 | } else { |
| 81 | return 0; |
| 82 | } |
| 83 | } |
Igor Zlatkovic | 1932b6c | 2002-12-11 17:00:40 +0000 | [diff] [blame] | 84 | #endif |
Daniel Veillard | 50f3437 | 2001-08-03 12:06:36 +0000 | [diff] [blame] | 85 | #endif /* _MSC_VER */ |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 86 | |
Daniel Veillard | 3d6aa10 | 2005-11-01 10:55:24 +0000 | [diff] [blame] | 87 | #if defined(_MSC_VER) |
Igor Zlatkovic | b2f6163 | 2002-11-14 17:43:55 +0000 | [diff] [blame] | 88 | #define mkdir(p,m) _mkdir(p) |
Daniel Veillard | 2d90de4 | 2001-04-16 17:46:18 +0000 | [diff] [blame] | 89 | #define snprintf _snprintf |
Igor Zlatkovic | b2f6163 | 2002-11-14 17:43:55 +0000 | [diff] [blame] | 90 | #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a) |
Daniel Veillard | 3d6aa10 | 2005-11-01 10:55:24 +0000 | [diff] [blame] | 91 | #elif defined(__MINGW32__) |
| 92 | #define mkdir(p,m) _mkdir(p) |
Igor Zlatkovic | b2f6163 | 2002-11-14 17:43:55 +0000 | [diff] [blame] | 93 | #endif |
Owen Taylor | 3473f88 | 2001-02-23 17:55:21 +0000 | [diff] [blame] | 94 | |
Igor Zlatkovic | 2103b05 | 2002-10-31 15:59:57 +0000 | [diff] [blame] | 95 | /* Threading API to use should be specified here for compatibility reasons. |
| 96 | This is however best specified on the compiler's command-line. */ |
| 97 | #if defined(LIBXML_THREAD_ENABLED) |
| 98 | #if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) |
Daniel Veillard | db0eb8d | 2002-01-13 13:35:00 +0000 | [diff] [blame] | 99 | #define HAVE_WIN32_THREADS |
Igor Zlatkovic | 2103b05 | 2002-10-31 15:59:57 +0000 | [diff] [blame] | 100 | #endif |
| 101 | #endif |
| 102 | |
| 103 | /* Some third-party libraries far from our control assume the following |
| 104 | is defined, which it is not if we don't include windows.h. */ |
| 105 | #if !defined(FALSE) |
| 106 | #define FALSE 0 |
| 107 | #endif |
| 108 | #if !defined(TRUE) |
| 109 | #define TRUE (!(FALSE)) |
| 110 | #endif |
Daniel Veillard | db0eb8d | 2002-01-13 13:35:00 +0000 | [diff] [blame] | 111 | |
Daniel Veillard | 4151acb | 2001-06-22 10:48:57 +0000 | [diff] [blame] | 112 | #endif /* __LIBXML_WIN32_CONFIG__ */ |
| 113 | |