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