# basic.h

    00001 /* include/Inventor/C/basic.h.  Generated by configure.  */
    00002 /**************************************************************************\
    00003  *
    00004  *  This file is part of the Coin 3D visualization library.
    00005  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00006  *
    00007  *  This library is free software; you can redistribute it and/or
    00008  *  modify it under the terms of the GNU General Public License
    00009  *  ("GPL") version 2 as published by the Free Software Foundation.
    00010  *  See the file LICENSE.GPL at the root directory of this source
    00011  *  distribution for additional information about the GNU GPL.
    00012  *
    00013  *  For using Coin with software that can not be combined with the GNU
    00014  *  GPL, and for taking advantage of the additional benefits of our
    00015  *  support services, please contact Systems in Motion about acquiring
    00016  *  a Coin Professional Edition License.
    00017  *
    00018  *  See <URL:http://www.coin3d.org> for  more information.
    00019  *
    00020  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00021  *  <URL:http://www.sim.no>.
    00022  *
    00023 \**************************************************************************/
    00024
    00025 #ifndef COIN_BASIC_H
    00026 #define COIN_BASIC_H
    00027
    00028 /*
    00029   NOTE: basic.h is automatically generated from basic.h.in, so don't
    00030   edit basic.h directly.
    00031 */
    00032
    00033 /* *********************************************************************** */
    00034
    00035 /* Documented for Doxygen in SoDB.cpp. */
    00036 typedef int SbBool;
    00037
    00038 #ifndef FALSE
    00039 #define FALSE 0
    00040 #endif /* !FALSE */
    00041 #ifndef TRUE
    00042 #define TRUE  1
    00043 #endif /* !TRUE */
    00044
    00045 /* *********************************************************************** */
    00046
    00047 /* Include this to 1) be compatible with Open Inventor's SbBasic.h, 2)
    00048  * provide a way for application programmers to get hold of the type
    00049  * definitions without explicitly including inttypes.h.
    00050  *
    00051  * The latter point is important because the inttypes.h file in SGI
    00052  * and TGS Open Inventor is placed _below_ the Inventor/ directory in
    00053  * the header files hierarchy. This is a stupid thing to do because it
    00054  * could easily conflict with the inttypes.h file installed as part of
    00055  * the C library on many systems (like GNU/Linux's glibc, for
    00056  * instance).
    00057  */
    00058 #include <Inventor/system/inttypes.h>
    00059
    00060 /* Internal note for Coin developers: in other sourcefiles in Coin, we
    00061  * depend on math.h being included through SbBasic.h. It is done this
    00062  * way to always make sure we have the M_* symbols available under
    00063  * MSWin (see below). So don't remove the following line unless you
    00064  * know very well what you are doing.
    00065  */
    00066 #include <math.h>
    00067
    00068 /* Define misc values if they are not available from math.h. UNIX
    00069  * systems typically have these defines, and MSWindows systems don't.
    00070  */
    00071 #ifndef M_E
    00072 #define M_E 2.7182818284590452354
    00073 #endif /* !M_E */
    00074 #ifndef M_LOG2E
    00075 #define M_LOG2E 1.4426950408889634074
    00076 #endif /* !M_LOG2E */
    00077 #ifndef M_LOG10E
    00078 #define M_LOG10E 0.43429448190325182765
    00079 #endif /* !M_LOG10E */
    00080 #ifndef M_LN2
    00081 #define M_LN2 0.69314718055994530942
    00082 #endif /* !M_LN2 */
    00083 #ifndef M_LN10
    00084 #define M_LN10 2.30258509299404568402
    00085 #endif /* !M_LN10 */
    00086 #ifndef M_PI
    00087 #define M_PI 3.14159265358979323846
    00088 #endif /* !M_PI */
    00089 #ifndef M_TWOPI
    00090 #define M_TWOPI (M_PI * 2.0)
    00091 #endif /* !M_TWOPI */
    00092 #ifndef M_PI_2
    00093 #define M_PI_2 1.57079632679489661923
    00094 #endif /* !M_PI_2 */
    00095 #ifndef M_PI_4
    00096 #define M_PI_4 0.78539816339744830962
    00097 #endif /* !M_PI_4 */
    00098 #ifndef M_3PI_4
    00099 #define M_3PI_4 2.3561944901923448370E0
    00100 #endif /* !M_3PI_4 */
    00101 #ifndef M_SQRTPI
    00102 #define M_SQRTPI 1.77245385090551602792981
    00103 #endif /* !M_SQRTPI */
    00104 #ifndef M_1_PI
    00105 #define M_1_PI 0.31830988618379067154
    00106 #endif /* !M_1_PI */
    00107 #ifndef M_2_PI
    00108 #define M_2_PI 0.63661977236758134308
    00109 #endif /* !M_2_PI */
    00110 #ifndef M_2_SQRTPI
    00111 #define M_2_SQRTPI 1.12837916709551257390
    00112 #endif /* !M_2_SQRTPI */
    00113 #ifndef M_SQRT2
    00114 #define M_SQRT2 1.41421356237309504880
    00115 #endif /* !M_SQRT2 */
    00116 #ifndef M_SQRT1_2
    00117 #define M_SQRT1_2 0.70710678118654752440
    00118 #endif /* !M_SQRT1_2 */
    00119 #ifndef M_LN2LO
    00120 #define M_LN2LO 1.9082149292705877000E-10
    00121 #endif /* !M_LN2LO */
    00122 #ifndef M_LN2HI
    00123 #define M_LN2HI 6.9314718036912381649E-1
    00124 #endif /* !M_LN2HI */
    00125 #ifndef M_SQRT3
    00126 #define M_SQRT3 1.73205080756887719000
    00127 #endif /* !M_SQRT3 */
    00128 #ifndef M_IVLN10
    00129 #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */
    00130 #endif /* !M_IVLN10 */
    00131 #ifndef M_LOG2_E
    00132 #define M_LOG2_E 0.693147180559945309417
    00133 #endif /* !M_LOG2_E */
    00134 #ifndef M_INVLN2
    00135 #define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
    00136 #endif /* !M_INVLN2 */
    00137
    00138 /* *********************************************************************** */
    00139
    00140 /* A unique identifier to recognize whether or not we're running under
    00141  * Systems in Motion's Coin library.
    00142  */
    00143 #define __COIN__
    00144
    00145 /* The following #undef'ed defines are automatically defined and
    00146  * synchronized with the settings in configure.in when ``configure''
    00147  * is executed.
    00148  *
    00149  * The #ifndef wrapper is necessary because during development, these
    00150  * are also defined in the config.h file generated by ``configure''.
    00151  */
    00152 #ifndef COIN_VERSION
    00153
    00154 /* These are available for adding or omitting features based on Coin
    00155  * version numbers in client application sources. */
    00156 #define COIN_MAJOR_VERSION 2
    00157 #define COIN_MINOR_VERSION 1
    00158 #define COIN_MICRO_VERSION 0
    00159 #define COIN_VERSION "2.1.0"
    00160
    00161 /* This define is set by the configure script if singleprecision math
    00162    functions are available from the C library API headers. */
    00163 #define HAVE_SINGLEPRECISION_MATH 1
    00164
    00165 /* Most compilers should have "hash quoting", as it is part of the
    00166    ANSI standard. */
    00167 #define HAVE_HASH_QUOTING 1
    00168 /* #undef HAVE_APOSTROPHES_QUOTING */
    00169
    00170 /* IN_PATH define in HPUX's sys/unistd.h conflicts with SoAction::IN_PATH */
    00171 /* #undef COIN_UNDEF_IN_PATH_HACK */
    00172
    00173 #endif /* !COIN_VERSION */ /* Ends configure-generated defines. */
    00174
    00175
    00176 /* *********************************************************************** */
    00177
    00178 #ifndef HAVE_SINGLEPRECISION_MATH
    00179 /* If singleprecision math functions are missing, define them to their
    00180    doubleprecision counterparts. This is done to be consistent with
    00181    SbBasic.h in Open Inventor (application programmers might rely on
    00182    the float-versions being set up from the Inventor SbBasic.h). */
    00183 #define cosf(x) ((float)cos(x))
    00184 #define sinf(x) ((float)sin(x))
    00185 #define tanf(x) ((float)tan(x))
    00186 #define powf(x, y) ((float)pow(x, y))
    00187 #define sqrtf(x) ((float)sqrt(x))
    00188 #define acosf(x) ((float)acos(x))
    00189 #define asinf(x) ((float)asin(x))
    00190 #define atanf(x) ((float)atan(x))
    00191 #define atan2f(x, y) ((float)atan2(x, y))
    00192 #endif /* HAVE_SINGLEPRECISION_MATH */
    00193
    00194
    00195 /* *********************************************************************** */
    00196
    00197 /* SO__QUOTE(str)        - use the preprocessor to quote a string.
    00198  * SO__CONCAT(str1,str2) - use the preprocessor to concatenate two strings.
    00199  */
    00200
    00201 #ifdef HAVE_HASH_QUOTING
    00202 #define SO__QUOTE(str)           #str
    00203 #define SO__CONCAT(str1, str2)   str1##str2
    00204 #elif defined(HAVE_APOSTROPHES_QUOTING)
    00205 #define SO__QUOTE(str)           "str"
    00206 #define SO__CONCAT(str1, str2)   str1str2
    00207 #else
    00208 #error No valid way to do macro quoting!
    00209 #endif
    00210
    00211 /* *********************************************************************** */
    00212
    00213 /* Precaution to avoid an some errors easily made by the application
    00214    programmer. */
    00215 #ifdef COIN_DLL_API
    00216 # error Leave the internal COIN_DLL_API define alone.
    00217 #endif /* COIN_DLL_API */
    00218 #ifdef COIN_INTERNAL
    00219 # ifdef COIN_NOT_DLL
    00220 #  error The COIN_NOT_DLL define is not supposed to be used when building the library, only when building Win32 applications.
    00221 # endif /* COIN_INTERNAL && COIN_NOT_DLL */
    00222 # ifdef COIN_DLL
    00223 #  error The COIN_DLL define is not supposed to be used when building the library, only when building Win32 applications.
    00224 # endif /* COIN_INTERNAL && COIN_DLL */
    00225 #endif /* COIN_INTERNAL */
    00226
    00227 /*
    00228   On MSWindows platforms, one of these defines must always be set when
    00229   building application programs:
    00230
    00231    - "COIN_DLL", when the application programmer is using the library
    00232      in the form of a dynamic link library (DLL)
    00233
    00234    - "COIN_NOT_DLL", when the application programmer is using the
    00235      library in the form of a static object library (LIB)
    00236
    00237   Note that either COIN_DLL or COIN_NOT_DLL _must_ be defined by the
    00238   application programmer on MSWindows platforms, or else the #error
    00239   statement will hit. Set up one or the other of these two defines in
    00240   your compiler environment according to how the library was built --
    00241   as a DLL (use "COIN_DLL") or as a LIB (use "COIN_NOT_DLL").
    00242
    00243   (Setting up defines for the compiler is typically done by either
    00244   adding something like "/DCOIN_DLL" to the compiler's argument line
    00245   (for command-line build processes), or by adding the define to the
    00246   list of preprocessor symbols in your IDE GUI (in the MSVC IDE, this
    00247   is done from the "Project"->"Settings" menu, choose the "C/C++" tab,
    00248   then "Preprocessor" from the dropdown box and add the appropriate
    00249   define)).
    00250
    00251   It is extremely important that the application programmer uses the
    00252   correct define, as using "COIN_NOT_DLL" when "COIN_DLL" is correct
    00253   will cause mysterious crashes.
    00254  */
    00255 /* FIXME: use a feature check to see if this is a platform which can
    00256    recognize the __declspec keyword instead of the crap #if below.
    00257    20011201 mortene. */
    00258 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
    00259 # ifdef COIN_INTERNAL
    00260 #  ifdef COIN_MAKE_DLL
    00261 #   define COIN_DLL_API __declspec(dllexport)
    00262 #  endif /* COIN_MAKE_DLL */
    00263 # else /* !COIN_INTERNAL */
    00264 #  ifdef COIN_DLL
    00265 #   ifdef COIN_NOT_DLL
    00266 #     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.
    00267 #   endif /* COIN_NOT_DLL */
    00268 #   define COIN_DLL_API __declspec(dllimport)
    00269 #  else /* !COIN_DLL */
    00270 #   ifndef COIN_NOT_DLL
    00271 #    error Define either COIN_DLL or COIN_NOT_DLL as appropriate for your linkage! See Inventor/C/basic.h for further instructions.
    00272 #   endif /* COIN_NOT_DLL */
    00273 #  endif /* !COIN_DLL */
    00274 # endif /* !COIN_INTERNAL */
    00275 #endif /* Microsoft Windows */
    00276
    00277 /* Empty define to avoid errors when _not_ compiling an MSWindows DLL. */
    00278 #ifndef COIN_DLL_API
    00279 # define COIN_DLL_API
    00280 #endif /* !COIN_DLL_API */
    00281
    00282
    00283 #endif /* !COIN_BASIC_H */