1/* include/Inventor/C/basic.h. Generated from basic.h.cmake.in by CMake. */ 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. */ 45typedef 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 61static 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 69static 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 * NB: MSVC at least since VS 2005 knows about some of the values if 108 * _USE_MATH_DEFINES is set before calling #include <math.h>. 109 */ 110#ifndef M_E 111#define M_E 2.7182818284590452354 112#endif /* !M_E */ 113#ifndef M_LOG2E 114#define M_LOG2E 1.4426950408889634074 115#endif /* !M_LOG2E */ 116#ifndef M_LOG10E 117#define M_LOG10E 0.43429448190325182765 118#endif /* !M_LOG10E */ 119#ifndef M_LN2 120#define M_LN2 0.69314718055994530942 121#endif /* !M_LN2 */ 122#ifndef M_LN10 123#define M_LN10 2.30258509299404568402 124#endif /* !M_LN10 */ 125#ifndef M_PI 126#define M_PI 3.14159265358979323846 127#endif /* !M_PI */ 128#ifndef M_TWOPI 129#define M_TWOPI (M_PI * 2.0) 130#endif /* !M_TWOPI */ 131#ifndef M_PI_2 132#define M_PI_2 1.57079632679489661923 133#endif /* !M_PI_2 */ 134#ifndef M_PI_4 135#define M_PI_4 0.78539816339744830962 136#endif /* !M_PI_4 */ 137#ifndef M_3PI_4 138#define M_3PI_4 2.3561944901923448370E0 139#endif /* !M_3PI_4 */ 140#ifndef M_SQRTPI 141#define M_SQRTPI 1.77245385090551602792981 142#endif /* !M_SQRTPI */ 143#ifndef M_1_PI 144#define M_1_PI 0.31830988618379067154 145#endif /* !M_1_PI */ 146#ifndef M_2_PI 147#define M_2_PI 0.63661977236758134308 148#endif /* !M_2_PI */ 149#ifndef M_2_SQRTPI 150#define M_2_SQRTPI 1.12837916709551257390 151#endif /* !M_2_SQRTPI */ 152#ifndef M_SQRT2 153#define M_SQRT2 1.41421356237309504880 154#endif /* !M_SQRT2 */ 155#ifndef M_SQRT1_2 156#define M_SQRT1_2 0.70710678118654752440 157#endif /* !M_SQRT1_2 */ 158#ifndef M_LN2LO 159#define M_LN2LO 1.9082149292705877000E-10 160#endif /* !M_LN2LO */ 161#ifndef M_LN2HI 162#define M_LN2HI 6.9314718036912381649E-1 163#endif /* !M_LN2HI */ 164#ifndef M_SQRT3 165#define M_SQRT3 1.73205080756887719000 166#endif /* !M_SQRT3 */ 167#ifndef M_IVLN10 168#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ 169#endif /* !M_IVLN10 */ 170#ifndef M_LOG2_E 171#define M_LOG2_E 0.693147180559945309417 172#endif /* !M_LOG2_E */ 173#ifndef M_INVLN2 174#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ 175#endif /* !M_INVLN2 */ 176 177/*************************************************************************** 178 * COIN_UNIQUE_ID_UINT32 179 * 180 * Set this define for backwards compatibility where unique id is a 32 bit 181 * unsigned integer. To address integer overruns that result in changes not 182 * correctly being propagated in the scene, unique id type was changed to 183 * 64 bit. 184 * 185 * Default is to typedef SbUniqueId to uint64_t. 186 */ 187 188/* Documented for Doxygen in SoNode.cpp. */ 189#ifndef COIN_UNIQUE_ID_UINT32 190typedef uint64_t SbUniqueId; 191#else 192typedef uint32_t SbUniqueId; 193#endif /* COIN_UNIQUE_ID_UINT32 */ 194 195/* *********************************************************************** */ 196 197/* A unique identifier to recognize whether or not we're running under 198 * Kongsberg Oil & Gas Technologies's Coin library. 199 */ 200#define __COIN__ 201 202/* The following #undef'ed defines are automatically defined and 203 * synchronized with the settings in configure.in when ``configure'' 204 * is executed. 205 * 206 * The #ifndef wrapper is necessary because during development, these 207 * are also defined in the config.h file generated by ``configure''. 208 */ 209#ifndef COIN_VERSION 210 211/* These are available for adding or omitting features based on Coin 212 * version numbers in client application sources. */ 213#define COIN_MAJOR_VERSION @COIN_MAJOR_VERSION@ 214#define COIN_MINOR_VERSION @COIN_MINOR_VERSION@ 215#define COIN_MICRO_VERSION @COIN_MICRO_VERSION@ 216#define COIN_BETA_VERSION @COIN_BETA_VERSION@ 217#define COIN_VERSION "@COIN_VERSION@" 218 219/* This define is set by the configure script if singleprecision math 220 functions are available from the C library API headers. */ 221/* #undef HAVE_SINGLEPRECISION_MATH */ 222 223/* Most compilers should have "hash quoting", as it is part of the 224 ANSI standard. */ 225#define HAVE_HASH_QUOTING 1 226/* #undef HAVE_APOSTROPHES_QUOTING */ 227 228/* IN_PATH define in HPUX's sys/unistd.h conflicts with SoAction::IN_PATH */ 229/* #undef COIN_UNDEF_IN_PATH_HACK */ 230 231#endif /* !COIN_VERSION */ /* Ends configure-generated defines. */ 232 233/* *********************************************************************** */ 234 235/* SO__QUOTE(str) - use the preprocessor to quote a string. 236 * SO__CONCAT(str1,str2) - use the preprocessor to concatenate two strings. 237 */ 238 239#ifdef HAVE_HASH_QUOTING 240#define SO__QUOTE(str) #str 241#define SO__CONCAT(str1, str2) str1##str2 242#elif defined(HAVE_APOSTROPHES_QUOTING) 243#define SO__QUOTE(str) "str" 244#define SO__CONCAT(str1, str2) str1/**/str2 245#else 246#error No valid way to do macro quoting! 247#endif 248 249/* *********************************************************************** */ 250 251/* For Visual Studio compiler use COIN_DLL by default and auto-linking. */ 252#if !defined(COIN_INTERNAL) && defined(_MSC_VER) 253# if !defined(COIN_NOT_DLL) && !defined(COIN_DLL) 254# define COIN_DLL 255# endif 256# define COIN_STRINGIFY(str) SO__QUOTE(str) 257# ifdef COIN_DLL 258# ifdef _DEBUG 259# pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) "d.lib") 260# else 261# pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) ".lib") 262# endif 263# else 264# ifdef _DEBUG 265# pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) "sd.lib") 266# else 267# pragma comment(lib, "Coin" COIN_STRINGIFY(COIN_MAJOR_VERSION) "s.lib") 268# endif 269# endif 270# undef COIN_STRINGIFY 271#endif 272 273 274/* Precaution to avoid an some errors easily made by the application 275 programmer. */ 276#ifdef COIN_DLL_API 277# error Leave the internal COIN_DLL_API define alone. 278#endif /* COIN_DLL_API */ 279#ifdef COIN_INTERNAL 280# ifdef COIN_NOT_DLL 281# error The COIN_NOT_DLL define is not supposed to be used when building the library, only when building Win32 applications. 282# endif /* COIN_INTERNAL && COIN_NOT_DLL */ 283# ifdef COIN_DLL 284# error The COIN_DLL define is not supposed to be used when building the library, only when building Win32 applications. 285# endif /* COIN_INTERNAL && COIN_DLL */ 286#endif /* COIN_INTERNAL */ 287 288/* 289 On MSWindows platforms, one of these defines must always be set when 290 building application programs: 291 292 - "COIN_DLL", when the application programmer is using the library 293 in the form of a dynamic link library (DLL) 294 295 - "COIN_NOT_DLL", when the application programmer is using the 296 library in the form of a static object library (LIB) 297 298 Note that either COIN_DLL or COIN_NOT_DLL _must_ be defined by the 299 application programmer on MSWindows platforms, or else the #error 300 statement will hit. Set up one or the other of these two defines in 301 your compiler environment according to how the library was built -- 302 as a DLL (use "COIN_DLL") or as a LIB (use "COIN_NOT_DLL"). 303 304 (Setting up defines for the compiler is typically done by either 305 adding something like "/DCOIN_DLL" to the compiler's argument line 306 (for command-line build processes), or by adding the define to the 307 list of preprocessor symbols in your IDE GUI (in the MSVC IDE, this 308 is done from the "Project"->"Settings" menu, choose the "C/C++" tab, 309 then "Preprocessor" from the dropdown box and add the appropriate 310 define)). 311 312 It is extremely important that the application programmer uses the 313 correct define, as using "COIN_NOT_DLL" when "COIN_DLL" is correct 314 will cause mysterious crashes. 315 */ 316/* FIXME: use a feature check to see if this is a platform which can 317 recognize the __declspec keyword instead of the crap #if below. 318 20011201 mortene. */ 319#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) 320# ifdef COIN_INTERNAL 321# ifdef COIN_MAKE_DLL 322# define COIN_DLL_API __declspec(dllexport) 323# endif /* COIN_MAKE_DLL */ 324# else /* !COIN_INTERNAL */ 325# ifdef COIN_DLL 326# ifdef COIN_NOT_DLL 327# 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. 328# endif /* COIN_NOT_DLL */ 329# define COIN_DLL_API __declspec(dllimport) 330# else /* !COIN_DLL */ 331# ifndef COIN_NOT_DLL 332# error Define either COIN_DLL or COIN_NOT_DLL as appropriate for your linkage! See Inventor/C/basic.h for further instructions. 333# endif /* !COIN_NOT_DLL */ 334# endif /* !COIN_DLL */ 335# endif /* !COIN_INTERNAL */ 336#endif /* Microsoft Windows */ 337 338/* Empty define to avoid errors when _not_ compiling an MSWindows DLL. */ 339#ifndef COIN_DLL_API 340# define COIN_DLL_API 341#endif /* !COIN_DLL_API */ 342 343#endif /* !COIN_BASIC_H */ 344