odeconfig.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*************************************************************************
  2. * *
  3. * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
  4. * All rights reserved. Email: [email protected] Web: www.q12.org *
  5. * *
  6. * This library is free software; you can redistribute it and/or *
  7. * modify it under the terms of EITHER: *
  8. * (1) The GNU Lesser General Public License as published by the Free *
  9. * Software Foundation; either version 2.1 of the License, or (at *
  10. * your option) any later version. The text of the GNU Lesser *
  11. * General Public License is included with this library in the *
  12. * file LICENSE.TXT. *
  13. * (2) The BSD-style license that is included with this library in *
  14. * the file LICENSE-BSD.TXT. *
  15. * *
  16. * This library is distributed in the hope that it will be useful, *
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
  19. * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
  20. * *
  21. *************************************************************************/
  22. #ifndef _ODE_ODECONFIG_H_
  23. #define _ODE_ODECONFIG_H_
  24. /* Pull in the standard headers */
  25. #include <stddef.h>
  26. #include <limits.h>
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <stdarg.h>
  30. #include <math.h>
  31. #include <string.h>
  32. #include <float.h>
  33. #include <ode/precision.h>
  34. #if defined(ODE_DLL) || defined(ODE_LIB)
  35. #define __ODE__
  36. #endif
  37. /* Define a DLL export symbol for those platforms that need it */
  38. #if defined(_MSC_VER) || (defined(__GNUC__) && defined(_WIN32))
  39. #if defined(ODE_DLL)
  40. #define ODE_API __declspec(dllexport)
  41. #elif !defined(ODE_LIB)
  42. #define ODE_DLL_API __declspec(dllimport)
  43. #endif
  44. #endif
  45. #if !defined(ODE_API)
  46. #define ODE_API
  47. #endif
  48. #if defined(_MSC_VER)
  49. # define ODE_API_DEPRECATED __declspec(deprecated)
  50. #elif defined (__GNUC__) && ( (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) )
  51. # define ODE_API_DEPRECATED __attribute__((__deprecated__))
  52. #else
  53. # define ODE_API_DEPRECATED
  54. #endif
  55. #define ODE_PURE_INLINE static __inline
  56. #define ODE_INLINE __inline
  57. #if defined(__cplusplus)
  58. #define ODE_EXTERN_C extern "C"
  59. #else
  60. #define ODE_EXTERN_C
  61. #endif
  62. /* Well-defined common data types...need to define for 64 bit systems */
  63. #if defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)
  64. #define X86_64_SYSTEM 1
  65. #if defined(_MSC_VER)
  66. typedef __int64 dint64;
  67. typedef unsigned __int64 duint64;
  68. #else
  69. typedef long long dint64;
  70. typedef unsigned long long duint64;
  71. #endif
  72. typedef int dint32;
  73. typedef unsigned int duint32;
  74. typedef short dint16;
  75. typedef unsigned short duint16;
  76. typedef signed char dint8;
  77. typedef unsigned char duint8;
  78. #else
  79. #if defined(_MSC_VER)
  80. typedef __int64 dint64;
  81. typedef unsigned __int64 duint64;
  82. #else
  83. typedef long long dint64;
  84. typedef unsigned long long duint64;
  85. #endif
  86. typedef int dint32;
  87. typedef unsigned int duint32;
  88. typedef short dint16;
  89. typedef unsigned short duint16;
  90. typedef signed char dint8;
  91. typedef unsigned char duint8;
  92. #endif
  93. /* Define the dInfinity macro */
  94. #ifdef INFINITY
  95. #ifdef dSINGLE
  96. #define dInfinity ((float)INFINITY)
  97. #else
  98. #define dInfinity ((double)INFINITY)
  99. #endif
  100. #elif defined(HUGE_VAL)
  101. #ifdef dSINGLE
  102. #ifdef HUGE_VALF
  103. #define dInfinity HUGE_VALF
  104. #else
  105. #define dInfinity ((float)HUGE_VAL)
  106. #endif
  107. #else
  108. #define dInfinity HUGE_VAL
  109. #endif
  110. #else
  111. #ifdef dSINGLE
  112. #define dInfinity ((float)(1.0/0.0))
  113. #else
  114. #define dInfinity (1.0/0.0)
  115. #endif
  116. #endif
  117. /* Visual C does not define these functions */
  118. #if defined(_MSC_VER)
  119. #define _ode_copysignf(x, y) ((float)_copysign(x, y))
  120. #define _ode_copysign(x, y) _copysign(x, y)
  121. #define _ode_nextafterf(x, y) _nextafterf(x, y)
  122. #define _ode_nextafter(x, y) _nextafter(x, y)
  123. #if !defined(_WIN64) && defined(dSINGLE)
  124. #define _ODE__NEXTAFTERF_REQUIRED
  125. ODE_EXTERN_C float _nextafterf(float x, float y);
  126. #endif
  127. #else
  128. #define _ode_copysignf(x, y) copysignf(x, y)
  129. #define _ode_copysign(x, y) copysign(x, y)
  130. #define _ode_nextafterf(x, y) nextafterf(x, y)
  131. #define _ode_nextafter(x, y) nextafter(x, y)
  132. #endif
  133. #endif