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