1 /* 2 * Summary: Windows configuration header 3 * Description: Windows configuration header 4 * 5 * Copy: See Copyright for the status of this software. 6 * 7 * Author: Igor Zlatkovic 8 */ 9 #ifndef __LIBXSLT_WIN32_CONFIG__ 10 #define __LIBXSLT_WIN32_CONFIG__ 11 12 #define HAVE_CTYPE_H 1 13 #define HAVE_STDLIB_H 1 14 #define HAVE_STDARG_H 1 15 #define HAVE_MALLOC_H 1 16 #define HAVE_TIME_H 1 17 #define HAVE_LOCALTIME 1 18 #define HAVE_GMTIME 1 19 #define HAVE_TIME 1 20 #define HAVE_MATH_H 1 21 #define HAVE_FCNTL_H 1 22 23 #include <io.h> 24 25 #define HAVE_ISINF 26 #define HAVE_ISNAN 27 28 #include <math.h> 29 #if defined _MSC_VER || defined __MINGW32__ 30 /* MS C-runtime has functions which can be used in order to determine if 31 a given floating-point variable contains NaN, (+-)INF. These are 32 preferred, because floating-point technology is considered propriatary 33 by MS and we can assume that their functions know more about their 34 oddities than we do. */ 35 #include <float.h> 36 /* Bjorn Reese figured a quite nice construct for isinf() using the 37 _fpclass() function. */ 38 #ifndef isinf 39 #define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \ 40 : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0)) 41 #endif 42 /* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */ 43 #ifndef isnan 44 #define isnan(d) (_isnan(d)) 45 #endif 46 #else /* _MSC_VER */ 47 static int isinf (double d) { 48 int expon = 0; 49 double val = frexp (d, &expon); 50 if (expon == 1025) { 51 if (val == 0.5) { 52 return 1; 53 } else if (val == -0.5) { 54 return -1; 55 } else { 56 return 0; 57 } 58 } else { 59 return 0; 60 } 61 } 62 static int isnan (double d) { 63 int expon = 0; 64 double val = frexp (d, &expon); 65 if (expon == 1025) { 66 if (val == 0.5) { 67 return 0; 68 } else if (val == -0.5) { 69 return 0; 70 } else { 71 return 1; 72 } 73 } else { 74 return 0; 75 } 76 } 77 #endif /* _MSC_VER */ 78 79 #include <direct.h> 80 81 /* snprintf emulation taken from http://stackoverflow.com/a/8712996/1956010 */ 82 #if defined(_MSC_VER) && _MSC_VER < 1900 83 84 #include <stdarg.h> 85 #include <stdio.h> 86 87 #define snprintf c99_snprintf 88 #define vsnprintf c99_vsnprintf 89 90 __inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) 91 { 92 int count = -1; 93 94 if (size != 0) 95 count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); 96 if (count == -1) 97 count = _vscprintf(format, ap); 98 99 return count; 100 } 101 102 __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) 103 { 104 int count; 105 va_list ap; 106 107 va_start(ap, format); 108 count = c99_vsnprintf(outBuf, size, format, ap); 109 va_end(ap); 110 111 return count; 112 } 113 114 #endif /* defined(_MSC_VER) && _MSC_VER < 1900 */ 115 116 #define HAVE_SYS_STAT_H 117 #define HAVE__STAT 118 #define HAVE_STRING_H 119 120 #include <libxml/xmlversion.h> 121 122 #ifndef ATTRIBUTE_UNUSED 123 #define ATTRIBUTE_UNUSED 124 #endif 125 126 #define _WINSOCKAPI_ 127 128 #endif /* __LIBXSLT_WIN32_CONFIG__ */ 129