ODE  0.13.1
 All Data Structures Functions Variables Typedefs Enumerations Groups
odeconfig.h
1 /*************************************************************************
2  * *
3  * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4  * All rights reserved. Email: russ@q12.org 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 
23 #ifndef _ODE_ODECONFIG_H_
24 #define _ODE_ODECONFIG_H_
25 
26 /* Pull in the standard headers */
27 #include <stddef.h>
28 #include <limits.h>
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <stdarg.h>
32 #include <math.h>
33 #include <string.h>
34 #include <float.h>
35 
36 
37 #include <ode/precision.h>
38 
39 
40 #if defined(ODE_DLL) || defined(ODE_LIB)
41 #define __ODE__
42 #endif
43 
44 /* Define a DLL export symbol for those platforms that need it */
45 #if defined(_MSC_VER) || (defined(__GNUC__) && defined(_WIN32))
46  #if defined(ODE_DLL)
47  #define ODE_API __declspec(dllexport)
48  #elif !defined(ODE_LIB)
49  #define ODE_DLL_API __declspec(dllimport)
50  #endif
51 #endif
52 
53 #if !defined(ODE_API)
54  #define ODE_API
55 #endif
56 
57 #if defined(_MSC_VER)
58 # define ODE_API_DEPRECATED __declspec(deprecated)
59 #elif defined (__GNUC__) && ( (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) )
60 # define ODE_API_DEPRECATED __attribute__((__deprecated__))
61 #else
62 # define ODE_API_DEPRECATED
63 #endif
64 
65 #define ODE_PURE_INLINE static __inline
66 #define ODE_INLINE __inline
67 
68 #if defined(__cplusplus)
69  #define ODE_EXTERN_C extern "C"
70 #else
71  #define ODE_EXTERN_C
72 #endif
73 
74 /* Well-defined common data types...need to define for 64 bit systems */
75 #if defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)
76  #define X86_64_SYSTEM 1
77 #if defined(_MSC_VER)
78  typedef __int64 dint64;
79  typedef unsigned __int64 duint64;
80 #else
81  typedef long long dint64;
82  typedef unsigned long long duint64;
83 #endif
84  typedef int dint32;
85  typedef unsigned int duint32;
86  typedef short dint16;
87  typedef unsigned short duint16;
88  typedef signed char dint8;
89  typedef unsigned char duint8;
90 #else
91 #if defined(_MSC_VER)
92  typedef __int64 dint64;
93  typedef unsigned __int64 duint64;
94 #else
95  typedef long long dint64;
96  typedef unsigned long long duint64;
97 #endif
98  typedef int dint32;
99  typedef unsigned int duint32;
100  typedef short dint16;
101  typedef unsigned short duint16;
102  typedef signed char dint8;
103  typedef unsigned char duint8;
104 #endif
105 
106 
107 /* Define the dInfinity macro */
108 #ifdef INFINITY
109  #ifdef dSINGLE
110  #define dInfinity ((float)INFINITY)
111  #else
112  #define dInfinity ((double)INFINITY)
113  #endif
114 #elif defined(HUGE_VAL)
115  #ifdef dSINGLE
116  #ifdef HUGE_VALF
117  #define dInfinity HUGE_VALF
118  #else
119  #define dInfinity ((float)HUGE_VAL)
120  #endif
121  #else
122  #define dInfinity HUGE_VAL
123  #endif
124 #else
125  #ifdef dSINGLE
126  #define dInfinity ((float)(1.0/0.0))
127  #else
128  #define dInfinity (1.0/0.0)
129  #endif
130 #endif
131 
132 
133 /* Define the dNaN macro */
134 #ifdef NAN
135  #define dNaN NAN
136 #else
137  #ifdef dSINGLE
138  #define dNaN ((float)(dInfinity - dInfinity))
139  #else
140  #define dNaN (dInfinity - dInfinity)
141  #endif
142 #endif
143 
144 
145  /* Visual C does not define these functions */
146 #if defined(_MSC_VER)
147  #define _ode_copysignf(x, y) ((float)_copysign(x, y))
148  #define _ode_copysign(x, y) _copysign(x, y)
149  #define _ode_nextafterf(x, y) _nextafterf(x, y)
150  #define _ode_nextafter(x, y) _nextafter(x, y)
151  #if !defined(_WIN64) && defined(dSINGLE)
152  #define _ODE__NEXTAFTERF_REQUIRED
153  ODE_EXTERN_C float _nextafterf(float x, float y);
154  #endif
155 #else
156  #define _ode_copysignf(x, y) copysignf(x, y)
157  #define _ode_copysign(x, y) copysign(x, y)
158  #define _ode_nextafterf(x, y) nextafterf(x, y)
159  #define _ode_nextafter(x, y) nextafter(x, y)
160 #endif
161 
162 
163 #endif