1 /* include/Inventor/C/basic.h. Generated by configure. */ 2 /**************************************************************************\ 3 * Copyright (c) Kongsberg Oil & Gas Technologies AS 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: 9 * 10 * Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * 13 * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * Neither the name of the copyright holder nor the names of its 18 * contributors may be used to endorse or promote products derived from 19 * this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 \**************************************************************************/ 33 34 #ifndef COIN_BASIC_H 35 #define COIN_BASIC_H 36 37 /* 38 NOTE: basic.h is automatically generated from basic.h.in, so don't 39 edit basic.h directly. 40 */ 41 42 /* *********************************************************************** */ 43 44 /* Documented for Doxygen in SoDB.cpp. */ 45 typedef int SbBool; 46 47 #ifdef DOXYGEN_SKIP_THIS 48 #ifndef USE_STATIC_CONSTS 49 /* 50 Using static consts might have some problems with merging on older 51 compilers, so lie for doxygen for now, this is tested and found 52 working on GCC 4.(1-3) 53 */ 54 #define USE_STATIC_CONSTS 55 #endif //USE_STATIC_CONSTS 56 #endif //DOXYGEN_SKIP_THIS 57 58 #ifndef FALSE 59 #ifdef USE_STATIC_CONSTS 60 static const SbBool FALSE = 0; 61 #else 62 #define FALSE 0 63 #endif //USE_STATIC_CONSTS 64 #endif /* !FALSE */ 65 66 #ifndef TRUE 67 #ifdef USE_STATIC_CONSTS 68 static const SbBool TRUE = 1; 69 #else 70 #define TRUE 1 71 #endif //USE_STATIC_CONSTS 72 #endif /* !TRUE */ 73 74 /* *********************************************************************** */ 75 76 /* Ye good olde min/max macros. No library would be complete without them. */ 77 78 #define cc_min(x, y) (((x) < (y)) ? (x) : (y)) 79 #define cc_max(x, y) (((x) > (y)) ? (x) : (y)) 80 81 /* *********************************************************************** */ 82 83 /* Include this to 1) be compatible with Open Inventor's SbBasic.h, 2) 84 * provide a way for application programmers to get hold of the type 85 * definitions without explicitly including inttypes.h. 86 * 87 * The latter point is important because the inttypes.h file in SGI 88 * and TGS Open Inventor is placed _below_ the Inventor/ directory in 89 * the header files hierarchy. This is a stupid thing to do because it 90 * could easily conflict with the inttypes.h file installed as part of 91 * the C library on many systems (like GNU/Linux's glibc, for 92 * instance). 93 */ 94 #include <Inventor/system/inttypes.h> 95 96 /* Internal note for Coin developers: in other sourcefiles in Coin, we 97 * depend on math.h being included through SbBasic.h. It is done this 98 * way to always make sure we have the M_* symbols available under 99 * MSWin (see below). So don't remove the following line unless you 100 * know very well what you are doing. 101 */ 102 #include <math.h> 103 104 /* Define misc values if they are not available from math.h. UNIX 105 * systems typically have these defines, and MSWindows systems don't. 106 */ 107 #ifndef M_E 108 #define M_E 2.7182818284590452354 109 #endif /* !M_E */ 110 #ifndef M_LOG2E 111 #define M_LOG2E 1.4426950408889634074 112 #endif /* !M_LOG2E */ 113 #ifndef M_LOG10E 114 #define M_LOG10E 0.43429448190325182765 115 #endif /* !M_LOG10E */ 116 #ifndef M_LN2 117 #define M_LN2 0.69314718055994530942 118 #endif /* !M_LN2 */ 119 #ifndef M_LN10 120 #define M_LN10 2.30258509299404568402 121 #endif /* !M_LN10 */ 122 #ifndef M_PI 123 #define M_PI 3.14159265358979323846 124 #endif /* !M_PI */ 125 #ifndef M_TWOPI 126 #define M_TWOPI (M_PI * 2.0) 127 #endif /* !M_TWOPI */ 128 #ifndef M_PI_2 129 #define M_PI_2 1.57079632679489661923 130 #endif /* !M_PI_2 */ 131 #ifndef M_PI_4 132 #define M_PI_4 0.78539816339744830962 133 #endif /* !M_PI_4 */ 134 #ifndef M_3PI_4 135 #define M_3PI_4 2.3561944901923448370E0 136 #endif /* !M_3PI_4 */ 137 #ifndef M_SQRTPI 138 #define M_SQRTPI 1.77245385090551602792981 139 #endif /* !M_SQRTPI */ 140 #ifndef M_1_PI 141 #define M_1_PI 0.31830988618379067154 142 #endif /* !M_1_PI */ 143 #ifndef M_2_PI 144 #define M_2_PI 0.63661977236758134308 145 #endif /* !M_2_PI */ 146 #ifndef M_2_SQRTPI 147 #define M_2_SQRTPI 1.12837916709551257390 148 #endif /* !M_2_SQRTPI */ 149 #ifndef M_SQRT2 150 #define M_SQRT2 1.41421356237309504880 151 #endif /* !M_SQRT2 */ 152 #ifndef M_SQRT1_2 153 #define M_SQRT1_2 0.70710678118654752440 154 #endif /* !M_SQRT1_2 */ 155 #ifndef M_LN2LO 156 #define M_LN2LO 1.9082149292705877000E-10 157 #endif /* !M_LN2LO */ 158 #ifndef M_LN2HI 159 #define M_LN2HI 6.9314718036912381649E-1 160 #endif /* !M_LN2HI */ 161 #ifndef M_SQRT3 162 #define M_SQRT3 1.73205080756887719000 163 #endif /* !M_SQRT3 */ 164 #ifndef M_IVLN10 165 #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ 166 #endif /* !M_IVLN10 */ 167 #ifndef M_LOG2_E 168 #define M_LOG2_E 0.693147180559945309417 169 #endif /* !M_LOG2_E */ 170 #ifndef M_INVLN2 171 #define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ 172 #endif /* !M_INVLN2 */ 173 174 /*************************************************************************** 175 * COIN_UNIQUE_ID_UINT32 176 * 177 * Set this define for backwards compatibility where unique id is a 32 bit 178 * unsigned integer. To address integer overruns that result in changes not 179 * correctly being propagated in the scene, unique id type was changed to 180 * 64 bit. 181 * 182 * Default is to typedef SbUniqueId to uint64_t. 183 */ 184 185 /* Documented for Doxygen in SoNode.cpp. */ 186 #ifndef COIN_UNIQUE_ID_UINT32 187 typedef uint64_t SbUniqueId; 188 #else 189 typedef uint32_t SbUniqueId; 190 #endif /* COIN_UNIQUE_ID_UINT32 */ 191 192 /* *********************************************************************** */ 193 194 /* A unique identifier to recognize whether or not we're running under 195 * Kongsberg Oil & Gas Technologies's Coin library. 196 */ 197 #define __COIN__ 198 199 /* The following #undef'ed defines are automatically defined and 200 * synchronized with the settings in configure.in when ``configure'' 201 * is executed. 202 * 203 * The #ifndef wrapper is necessary because during development, these 204 * are also defined in the config.h file generated by ``configure''. 205 */ 206 #ifndef COIN_VERSION 207 208 /* These are available for adding or omitting features based on Coin 209 * version numbers in client application sources. */ 210 #define COIN_MAJOR_VERSION 4 211 #define COIN_MINOR_VERSION 0 212 #define COIN_MICRO_VERSION 0 213 #define COIN_BETA_VERSION a 214 #define COIN_VERSION "4.0.0a" 215 216 /* This define is set by the configure script if singleprecision math 217 functions are available from the C library API headers. */ 218 /* #undef HAVE_SINGLEPRECISION_MATH */ 219 220 /* Most compilers should have "hash quoting", as it is part of the 221 ANSI standard. */ 222 #define HAVE_HASH_QUOTING 1 223 /* #undef HAVE_APOSTROPHES_QUOTING */ 224 225 /* IN_PATH define in HPUX's sys/unistd.h conflicts with SoAction::IN_PATH */ 226 /* #undef COIN_UNDEF_IN_PATH_HACK */ 227 228 #endif /* !COIN_VERSION */ /* Ends configure-generated defines. */ 229 230 /* *********************************************************************** */ 231 232 /* SO__QUOTE(str) - use the preprocessor to quote a string. 233 * SO__CONCAT(str1,str2) - use the preprocessor to concatenate two strings. 234 */ 235 236 #ifdef HAVE_HASH_QUOTING 237 #define SO__QUOTE(str) #str 238 #define SO__CONCAT(str1, str2) str1##str2 239 #elif defined(HAVE_APOSTROPHES_QUOTING) 240 #define SO__QUOTE(str) "str" 241 #define SO__CONCAT(str1, str2) str1/**/str2 242 #else 243 #error No valid way to do macro quoting! 244 #endif 245 246 /* *********************************************************************** */ 247 248 /* For Visual Studio compiler use COIN_DLL by default and auto-linking. */ 249 #if !defined(COIN_INTERNAL) && defined(_MSC_VER) 250 # if !defined(COIN_NOT_DLL) && !defined(COIN_DLL) 251 # define COIN_DLL 252 # endif 253 # define COIN_STRINGIFY(str) SO__QUOTE(str) 254 # ifdef COIN_DLL 255 # ifdef _DEBUG 256 # pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) "d.lib") 257 # else 258 # pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) ".lib") 259 # endif 260 # else 261 # ifdef _DEBUG 262 # pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) "sd.lib") 263 # else 264 # pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) "s.lib") 265 # endif 266 # endif 267 # undef COIN_STRINGIFY 268 #endif 269 270 271 /* Precaution to avoid an some errors easily made by the application 272 programmer. */ 273 #ifdef COIN_DLL_API 274 # error Leave the internal COIN_DLL_API define alone. 275 #endif /* COIN_DLL_API */ 276 #ifdef COIN_INTERNAL 277 # ifdef COIN_NOT_DLL 278 # error The COIN_NOT_DLL define is not supposed to be used when building the library, only when building Win32 applications. 279 # endif /* COIN_INTERNAL && COIN_NOT_DLL */ 280 # ifdef COIN_DLL 281 # error The COIN_DLL define is not supposed to be used when building the library, only when building Win32 applications. 282 # endif /* COIN_INTERNAL && COIN_DLL */ 283 #endif /* COIN_INTERNAL */ 284 285 /* 286 On MSWindows platforms, one of these defines must always be set when 287 building application programs: 288 289 - "COIN_DLL", when the application programmer is using the library 290 in the form of a dynamic link library (DLL) 291 292 - "COIN_NOT_DLL", when the application programmer is using the 293 library in the form of a static object library (LIB) 294 295 Note that either COIN_DLL or COIN_NOT_DLL _must_ be defined by the 296 application programmer on MSWindows platforms, or else the #error 297 statement will hit. Set up one or the other of these two defines in 298 your compiler environment according to how the library was built -- 299 as a DLL (use "COIN_DLL") or as a LIB (use "COIN_NOT_DLL"). 300 301 (Setting up defines for the compiler is typically done by either 302 adding something like "/DCOIN_DLL" to the compiler's argument line 303 (for command-line build processes), or by adding the define to the 304 list of preprocessor symbols in your IDE GUI (in the MSVC IDE, this 305 is done from the "Project"->"Settings" menu, choose the "C/C++" tab, 306 then "Preprocessor" from the dropdown box and add the appropriate 307 define)). 308 309 It is extremely important that the application programmer uses the 310 correct define, as using "COIN_NOT_DLL" when "COIN_DLL" is correct 311 will cause mysterious crashes. 312 */ 313 /* FIXME: use a feature check to see if this is a platform which can 314 recognize the __declspec keyword instead of the crap #if below. 315 20011201 mortene. */ 316 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) 317 # ifdef COIN_INTERNAL 318 # ifdef COIN_MAKE_DLL 319 # define COIN_DLL_API __declspec(dllexport) 320 # endif /* COIN_MAKE_DLL */ 321 # else /* !COIN_INTERNAL */ 322 # ifdef COIN_DLL 323 # ifdef COIN_NOT_DLL 324 # error Define _either_ COIN_DLL _or_ COIN_NOT_DLL as appropriate for your linkage -- not both at the same time! See Inventor/C/basic.h for further instructions. 325 # endif /* COIN_NOT_DLL */ 326 # define COIN_DLL_API __declspec(dllimport) 327 # else /* !COIN_DLL */ 328 # ifndef COIN_NOT_DLL 329 # error Define either COIN_DLL or COIN_NOT_DLL as appropriate for your linkage! See Inventor/C/basic.h for further instructions. 330 # endif /* !COIN_NOT_DLL */ 331 # endif /* !COIN_DLL */ 332 # endif /* !COIN_INTERNAL */ 333 #endif /* Microsoft Windows */ 334 335 /* Empty define to avoid errors when _not_ compiling an MSWindows DLL. */ 336 #ifndef COIN_DLL_API 337 # define COIN_DLL_API 338 #endif /* !COIN_DLL_API */ 339 340 #endif /* !COIN_BASIC_H */ 341