1 #ifndef SOQT_INTERNALDEFS_H
2 #define SOQT_INTERNALDEFS_H
3
4 // src/soqtdefs.h. Generated from soguidefs.h.in by configure.
5
6 /**************************************************************************\
7 * Copyright (c) Kongsberg Oil & Gas Technologies AS
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
13 *
14 * Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * Neither the name of the copyright holder nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 \**************************************************************************/
37
38 /* ********************************************************************** */
39
40 #ifndef SOQT_INTERNAL
41 #error this is a private header file
42 #endif /* !SOQT_INTERNAL */
43
44 #ifdef HAVE_CONFIG_H
45 #include <config.h>
46 #endif /* HAVE_CONFIG_H */
47
48 /* ********************************************************************** */
49
50 #ifdef __FILE__
51 #define SOQT_STUB_FILE __FILE__
52 #else
53 /* FIXME: avoid this case by redefining the compilation rules to define the
54 current filename in some variable. [20010919 larsa] */
55 #define SOQT_STUB_FILE ((char *)0L)
56 #endif
57
58 #ifdef __LINE__
59 #define SOQT_STUB_LINE __LINE__
60 #else
61 #define SOQT_STUB_LINE 0
62 #endif
63
64 #ifdef __cplusplus
65 #ifdef HAVE_CPP_COMPILER_FUNCTION_NAME_VAR
66 #define SOQT_STUB_FUNC HAVE_CPP_COMPILER_FUNCTION_NAME_VAR
67 #else
68 #define SOQT_STUB_FUNC ((const char *)0L)
69 #endif
70 #else /* !__cplusplus */
71 #ifdef HAVE_C_COMPILER_FUNCTION_NAME_VAR
72 #define SOQT_STUB_FUNC HAVE_C_COMPILER_FUNCTION_NAME_VAR
73 #else
74 #define SOQT_STUB_FUNC ((const char *)0L)
75 #endif
76 #endif /* !__cplusplus */
77
78 #if SOQT_DEBUG
79
80 #include <Inventor/errors/SoDebugError.h>
81
82 /*
83 This stupid thing is here to silence some compilers that complain on
84 constant if-expressions.
85 */
86
soqt_not_null(const void * arg)87 inline int soqt_not_null(const void * arg) { return (arg != NULL) ? 1 : 0; }
88
89
90 /* Collects common code from SOQT_STUB(), SOQT_STUB()_ONCE and
91 SOQT_OBSOLETED(). */
92
93 #define SOQT_FUNCTIONIDENTIFIER(SOQTSTR) \
94 SbString SOQTSTR(soqt_not_null(SOQT_STUB_FILE) ? SOQT_STUB_FILE : ""); \
95 if (SOQTSTR.getLength() > 0) { SOQTSTR += ':'; } \
96 SOQTSTR += SbString((int)SOQT_STUB_LINE); SOQTSTR += ':'; \
97 SOQTSTR += soqt_not_null(SOQT_STUB_FUNC) ? SOQT_STUB_FUNC : ""
98
99 /*
100 SOQT_STUB(): a macro that prints out stub information.
101 Used where there is functionality missing.
102 */
103
104 #define SOQT_STUB() \
105 do { \
106 SOQT_FUNCTIONIDENTIFIER(s); \
107 SoDebugError::postWarning(s.getString(), \
108 "STUB: functionality not yet completed"); \
109 } while (0)
110
111 /*
112 SOQT_STUB_ONCE(): a macro that prints out stub information, but only on
113 the first pass. Used where there is functionality missing that may be
114 called hundreds of times.
115 */
116
117 #define SOQT_STUB_ONCE() \
118 do { \
119 static int first = 1; \
120 if (first) { \
121 SOQT_FUNCTIONIDENTIFIER(s); \
122 SoDebugError::postWarning(s.getString(), \
123 "STUB: functionality not yet completed " \
124 "(first and last warning)"); \
125 first = 0; \
126 } \
127 } while (0)
128
129 /*
130 SOQT_OBSOLETED(): a macro that prints out information about an obsoleted
131 function still being in use.
132 */
133
134 #define SOQT_OBSOLETED() \
135 do { \
136 SOQT_FUNCTIONIDENTIFIER(s); \
137 SoDebugError::post(s.getString(), \
138 "OBSOLETED: functionality no longer supported"); \
139 } while (0)
140
141 #else /* !SOQT_DEBUG */
142
143 /* snub the stubs */
144 #define SOQT_STUB() do { } while (0)
145 #define SOQT_STUB_ONCE() do { } while (0)
146 #define SOQT_OBSOLETED() do { } while (0)
147
148 #endif /* !SOQT_DEBUG */
149
150 /*
151 GETTEXT support
152 */
153
154 #if defined(ENABLE_NLS) && defined(HAVE_GETTEXT)
155 #include <libintl.h>
156 #define _(String) dgettext (PACKAGE, String)
157 #define N_(String) (String)
158 #else
159 #define _(String) (String)
160 #define N_(String) (String)
161 #endif /* HAVE_GETTEXT && ENABLE_NLS */
162
163 /* ********************************************************************** */
164
165 #endif /* ! SOQT_INTERNALDEFS_H */
166