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