win32config.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef __LIBXML_WIN32_CONFIG__
  2. #define __LIBXML_WIN32_CONFIG__
  3. #define HAVE_CTYPE_H
  4. #define HAVE_STDARG_H
  5. #define HAVE_MALLOC_H
  6. #define HAVE_ERRNO_H
  7. #define SEND_ARG2_CAST
  8. #define GETHOSTBYNAME_ARG_CAST
  9. #if defined(_WIN32_WCE)
  10. #undef HAVE_ERRNO_H
  11. #include "wincecompat.h"
  12. #else
  13. #define HAVE_SYS_STAT_H
  14. #define HAVE_STAT
  15. #define HAVE_STDLIB_H
  16. #define HAVE_TIME_H
  17. #define HAVE_FCNTL_H
  18. #include <io.h>
  19. #include <direct.h>
  20. #endif
  21. #include <libxml/xmlversion.h>
  22. #ifndef ICONV_CONST
  23. #define ICONV_CONST const
  24. #endif
  25. /*
  26. * Windows platforms may define except
  27. */
  28. #undef except
  29. #define HAVE_ISINF
  30. #define HAVE_ISNAN
  31. #include <math.h>
  32. #if defined(_MSC_VER) || defined(__BORLANDC__)
  33. /* MS C-runtime has functions which can be used in order to determine if
  34. a given floating-point variable contains NaN, (+-)INF. These are
  35. preferred, because floating-point technology is considered proprietary
  36. by MS and we can assume that their functions know more about their
  37. oddities than we do. */
  38. #include <float.h>
  39. /* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
  40. function. */
  41. #ifndef isinf
  42. #define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
  43. : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
  44. #endif
  45. /* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
  46. #ifndef isnan
  47. #define isnan(d) (_isnan(d))
  48. #endif
  49. #else /* _MSC_VER */
  50. #ifndef isinf
  51. static 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. }
  66. #endif
  67. #ifndef isnan
  68. static int isnan (double d) {
  69. int expon = 0;
  70. double val = frexp (d, &expon);
  71. if (expon == 1025) {
  72. if (val == 0.5) {
  73. return 0;
  74. } else if (val == -0.5) {
  75. return 0;
  76. } else {
  77. return 1;
  78. }
  79. } else {
  80. return 0;
  81. }
  82. }
  83. #endif
  84. #endif /* _MSC_VER */
  85. #if defined(_MSC_VER)
  86. #define mkdir(p,m) _mkdir(p)
  87. #if _MSC_VER < 1900
  88. #define snprintf _snprintf
  89. #endif
  90. #if _MSC_VER < 1500
  91. #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
  92. #endif
  93. #elif defined(__MINGW32__)
  94. #define mkdir(p,m) _mkdir(p)
  95. #endif
  96. /* Threading API to use should be specified here for compatibility reasons.
  97. This is however best specified on the compiler's command-line. */
  98. #if defined(LIBXML_THREAD_ENABLED)
  99. #if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
  100. #define HAVE_WIN32_THREADS
  101. #endif
  102. #endif
  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
  111. #endif /* __LIBXML_WIN32_CONFIG__ */