00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef DTOOLBASE_H
00021 #define DTOOLBASE_H
00022
00023 #include "dtool_config.h"
00024
00025
00026 #ifdef _WIN32
00027 #ifndef WIN32
00028 #define WIN32
00029 #endif
00030 #ifdef _MSC_VER
00031 #ifndef WIN32_VC
00032 #define WIN32_VC
00033 #endif
00034 #endif
00035 #endif
00036
00037 #ifdef WIN32_VC
00038
00039
00040
00041
00042
00043 #pragma warning (disable : 4231)
00044
00045 #pragma warning (disable : 4786)
00046
00047 #pragma warning (disable : 4251)
00048
00049 #pragma warning (disable : 4503)
00050
00051 #pragma warning (disable : 4305)
00052
00053 #pragma warning (disable : 4250)
00054
00055 #pragma warning (disable : 4355)
00056
00057 #pragma warning (disable : 4244)
00058
00059 #if _MSC_VER >= 1300
00060 #if _MSC_VER >= 1310
00061 #define USING_MSVC7_1
00062
00063 #else
00064
00065 #endif
00066 #define USING_MSVC7
00067 #else
00068
00069 #endif
00070
00071
00072
00073 #ifdef _DEBUG
00074 # define NODEFAULT default: assert(0);
00075 #else
00076 # define NODEFAULT default: __assume(0); // special VC keyword
00077 #endif
00078
00079 #else
00080 #ifdef _DEBUG
00081 # define NODEFAULT default: assert(0);
00082 #else
00083 # define NODEFAULT
00084 #endif
00085 #endif
00086
00087
00088
00089
00090
00091
00092 #ifdef _WIN32_WINNT
00093 #undef _WIN32_WINNT
00094 #endif
00095 #define _WIN32_WINNT 0x0502
00096
00097 #ifdef __cplusplus
00098 #ifndef __STDC_LIMIT_MACROS
00099 #define __STDC_LIMIT_MACROS
00100 #endif
00101 #ifndef __STDC_CONSTANT_MACROS
00102 #define __STDC_CONSTANT_MACROS
00103 #endif
00104 #endif
00105
00106 #ifdef HAVE_PYTHON
00107 #undef _POSIX_C_SOURCE
00108 #undef _XOPEN_SOURCE
00109 #include "pyconfig.h"
00110 #endif
00111
00112 #ifndef HAVE_EIGEN
00113
00114 #undef LINMATH_ALIGN
00115 #endif
00116
00117 #include "dtoolsymbols.h"
00118
00119
00120 #include <assert.h>
00121
00122
00123 #include <signal.h>
00124
00125 #ifdef __GNUC__
00126
00127
00128 #define _FILE_OFFSET_BITS 64
00129 #define _LARGEFILE_SOURCE 1
00130 #endif
00131
00132 #ifdef PHAVE_TYPES_H
00133 #include <types.h>
00134 #endif
00135
00136 #ifdef PHAVE_SYS_TYPES_H
00137 #include <sys/types.h>
00138 #endif
00139
00140 #ifdef PHAVE_MALLOC_H
00141 #include <malloc.h>
00142 #endif
00143
00144 #ifdef PHAVE_SYS_MALLOC_H
00145 #include <sys/malloc.h>
00146 #endif
00147
00148 #ifdef PHAVE_ALLOCA_H
00149 #include <alloca.h>
00150 #endif
00151
00152 #ifdef PHAVE_UNISTD_H
00153 #include <unistd.h>
00154 #endif
00155
00156 #ifdef PHAVE_IO_H
00157 #include <io.h>
00158 #endif
00159
00160 #ifdef PHAVE_LOCALE_H
00161 #include <locale.h>
00162 #endif
00163
00164 #ifdef PHAVE_STRING_H
00165 #include <string.h>
00166 #endif
00167
00168 #ifdef PHAVE_STDLIB_H
00169 #include <stdlib.h>
00170 #endif
00171
00172 #ifdef PHAVE_LIMITS_H
00173 #include <limits.h>
00174 #endif
00175
00176 #ifdef PHAVE_MINMAX_H
00177 #include <minmax.h>
00178 #endif
00179
00180 #ifdef PHAVE_SYS_TIME_H
00181 #include <sys/time.h>
00182 #endif
00183
00184 #ifdef PHAVE_STDINT_H
00185 #include <stdint.h>
00186 #endif
00187
00188 #ifdef CPPPARSER
00189 #include <stdtypedefs.h>
00190 #endif
00191
00192 #ifdef USE_TAU
00193
00194
00195 #include <TAU.h>
00196 #include <Profile/Profiler.h>
00197 #else
00198
00199
00200
00201 #define TAU_TYPE_STRING(profileString, str)
00202 #define TAU_PROFILE(name, type, group)
00203 #define TAU_PROFILE_TIMER(var, name, type, group)
00204 #define TAU_PROFILE_START(var)
00205 #define TAU_PROFILE_STOP(var)
00206 #define TAU_PROFILE_STMT(stmt)
00207 #define TAU_PROFILE_EXIT(msg)
00208 #define TAU_PROFILE_INIT(argc, argv)
00209 #define TAU_PROFILE_SET_NODE(node)
00210 #define TAU_PROFILE_SET_CONTEXT(context)
00211 #define TAU_PROFILE_SET_GROUP_NAME(newname)
00212 #define TAU_PROFILE_TIMER_SET_GROUP_NAME(t, newname)
00213 #define TAU_PROFILE_CALLSTACK()
00214 #define TAU_DB_DUMP()
00215 #define TAU_DB_PURGE()
00216
00217 #define TAU_REGISTER_CONTEXT_EVENT(event, name)
00218 #define TAU_CONTEXT_EVENT(event, data)
00219 #define TAU_DISABLE_CONTEXT_EVENT(event)
00220 #define TAU_ENABLE_CONTEXT_EVENT(event)
00221
00222 #define TAU_REGISTER_EVENT(event, name)
00223 #define TAU_EVENT(event, data)
00224 #define TAU_EVENT_DISABLE_MIN(event)
00225 #define TAU_EVENT_DISABLE_MAX(event)
00226 #define TAU_EVENT_DISABLE_MEAN(event)
00227 #define TAU_EVENT_DISABLE_STDDEV(event)
00228 #define TAU_REPORT_STATISTICS()
00229 #define TAU_REPORT_THREAD_STATISTICS()
00230 #define TAU_REGISTER_THREAD()
00231 #define TAU_REGISTER_FORK(id, op)
00232 #define TAU_ENABLE_INSTRUMENTATION()
00233 #define TAU_DISABLE_INSTRUMENTATION()
00234 #define TAU_ENABLE_GROUP(group)
00235 #define TAU_DISABLE_GROUP(group)
00236 #define TAU_ENABLE_GROUP_NAME(group)
00237 #define TAU_DISABLE_GROUP_NAME(group)
00238 #define TAU_ENABLE_ALL_GROUPS()
00239 #define TAU_DISABLE_ALL_GROUPS()
00240 #define TAU_TRACK_MEMORY()
00241 #define TAU_TRACK_MEMORY_HERE()
00242 #define TAU_ENABLE_TRACKING_MEMORY()
00243 #define TAU_DISABLE_TRACKING_MEMORY()
00244 #define TAU_TRACK_MEMORY()
00245 #define TAU_TRACK_MEMORY_HERE()
00246 #define TAU_ENABLE_TRACKING_MUSE_EVENTS()
00247 #define TAU_DISABLE_TRACKING_MUSE_EVENTS()
00248 #define TAU_TRACK_MUSE_EVENTS()
00249 #define TAU_SET_INTERRUPT_INTERVAL(value)
00250
00251 #define TAU_TRACE_SENDMSG(type, destination, length)
00252 #define TAU_TRACE_RECVMSG(type, source, length)
00253
00254 #define TAU_MAPPING(stmt, group) stmt
00255 #define TAU_MAPPING_OBJECT(FuncInfoVar)
00256 #define TAU_MAPPING_LINK(FuncInfoVar, Group)
00257 #define TAU_MAPPING_PROFILE(FuncInfoVar)
00258 #define TAU_MAPPING_CREATE(name, type, key, groupname, tid)
00259 #define TAU_MAPPING_PROFILE_TIMER(Timer, FuncInfoVar, tid)
00260 #define TAU_MAPPING_TIMER_CREATE(t, name, type, gr, group_name)
00261 #define TAU_MAPPING_PROFILE_START(Timer, tid)
00262 #define TAU_MAPPING_PROFILE_STOP(tid)
00263 #define TAU_MAPPING_PROFILE_EXIT(msg, tid)
00264 #define TAU_MAPPING_DB_DUMP(tid)
00265 #define TAU_MAPPING_DB_PURGE(tid)
00266 #define TAU_MAPPING_PROFILE_SET_NODE(node, tid)
00267 #define TAU_MAPPING_PROFILE_SET_GROUP_NAME(timer, name)
00268 #define TAU_PROFILE_TIMER_SET_NAME(t, newname)
00269 #define TAU_PROFILE_TIMER_SET_TYPE(t, newname)
00270 #define TAU_PROFILE_TIMER_SET_GROUP(t, id)
00271 #define TAU_MAPPING_PROFILE_SET_NAME(timer, name)
00272 #define TAU_MAPPING_PROFILE_SET_TYPE(timer, name)
00273 #define TAU_MAPPING_PROFILE_SET_GROUP(timer, id)
00274 #define TAU_MAPPING_PROFILE_GET_GROUP_NAME(timer)
00275 #define TAU_MAPPING_PROFILE_GET_GROUP(timer)
00276 #define TAU_MAPPING_PROFILE_GET_NAME(timer)
00277 #define TAU_MAPPING_PROFILE_GET_TYPE(timer)
00278
00279 #define TAU_PHASE(name, type, group)
00280 #define TAU_PHASE_CREATE_STATIC(var, name, type, group)
00281 #define TAU_PHASE_CREATE_DYNAMIC(var, name, type, group)
00282 #define TAU_PHASE_START(var)
00283 #define TAU_PHASE_STOP(var)
00284 #define TAU_GLOBAL_PHASE(timer, name, type, group)
00285 #define TAU_GLOBAL_PHASE_START(timer)
00286 #define TAU_GLOBAL_PHASE_STOP(timer)
00287 #define TAU_GLOBAL_PHASE_EXTERNAL(timer)
00288 #define TAU_GLOBAL_TIMER(timer, name, type, group)
00289 #define TAU_GLOBAL_TIMER_EXTERNAL(timer)
00290 #define TAU_GLOBAL_TIMER_START(timer)
00291 #define TAU_GLOBAL_TIMER_STOP()
00292
00293 #endif
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304 #if defined(__LITTLE_ENDIAN__) || defined(__i386__)
00305 #undef WORDS_BIGENDIAN
00306
00307 #elif defined(__BIG_ENDIAN__) || defined(__ppc__)
00308 #undef WORDS_BIGENDIAN
00309 #define WORDS_BIGENDIAN 1
00310
00311 #endif
00312
00313
00314
00315 #ifdef __WORDSIZE
00316 #define NATIVE_WORDSIZE __WORDSIZE
00317 #elif defined(_LP64)
00318 #define NATIVE_WORDSIZE 64
00319 #else
00320 #define NATIVE_WORDSIZE 32
00321 #endif
00322
00323
00324 #ifdef CPPPARSER
00325 #define ALIGN_4BYTE
00326 #define ALIGN_8BYTE
00327 #define ALIGN_16BYTE
00328 #elif defined(WIN32_VC)
00329 #define ALIGN_4BYTE __declspec(align(4))
00330 #define ALIGN_8BYTE __declspec(align(8))
00331 #define ALIGN_16BYTE __declspec(align(16))
00332 #elif defined(__GNUC__)
00333 #define ALIGN_4BYTE __attribute__ ((aligned (4)))
00334 #define ALIGN_8BYTE __attribute__ ((aligned (8)))
00335 #define ALIGN_16BYTE __attribute__ ((aligned (16)))
00336 #else
00337 #define ALIGN_4BYTE
00338 #define ALIGN_8BYTE
00339 #define ALIGN_16BYTE
00340 #endif
00341
00342
00343
00344
00345 #if !defined(LINMATH_ALIGN)
00346
00347
00348 #undef MEMORY_HOOK_DO_ALIGN
00349
00350 #elif defined(USE_MEMORY_DLMALLOC)
00351
00352
00353 #undef MEMORY_HOOK_DO_ALIGN
00354
00355 #elif defined(USE_MEMORY_PTMALLOC2)
00356
00357
00358
00359 #define MEMORY_HOOK_DO_ALIGN 1
00360
00361 #elif defined(IS_OSX) || defined(_WIN64)
00362
00363
00364 #undef MEMORY_HOOK_DO_ALIGN
00365
00366 #elif defined(MEMORY_HOOK_DO_ALIGN)
00367
00368
00369 #else
00370
00371
00372
00373
00374 #define USE_MEMORY_DLMALLOC 1
00375
00376 #endif
00377
00378
00379 #if defined(USE_MEMORY_PTMALLOC2) || defined(USE_MEMORY_DLMALLOC) || defined(DO_MEMORY_USAGE) || defined(MEMORY_HOOK_DO_ALIGN)
00380
00381 #else
00382
00383
00384
00385 #define USE_MEMORY_NOWRAPPERS 1
00386 #endif
00387
00388
00389
00390 #define USE_STL_ALLOCATOR 1
00391
00392
00393
00394
00395
00396
00397
00398
00399 #ifdef CPPPARSER
00400 #define BEGIN_PUBLISH __begin_publish
00401 #define END_PUBLISH __end_publish
00402 #define BLOCKING __blocking
00403 #define MAKE_SEQ(seq_name, num_name, element_name) __make_seq(seq_name, num_name, element_name)
00404 #undef USE_STL_ALLOCATOR
00405 #define EXTENSION(x) __extension x
00406 #define EXTEND __extension
00407 #define EXT_FUNC(func) ::func()
00408 #define EXT_FUNC_ARGS(func, ...) ::func(__VA_ARGS__)
00409 #define CALL_EXT_FUNC(func, ...) ::func (__VA_ARGS__)
00410 #else
00411 #define BEGIN_PUBLISH
00412 #define END_PUBLISH
00413 #define BLOCKING
00414 #define MAKE_SEQ(seq_name, num_name, element_name)
00415 #define EXTENSION(x)
00416 #define EXTEND
00417
00418 #define _EXT_FUNC(func) _ext__ ## func
00419 #define EXT_FUNC(func) _EXT_FUNC(func) ()
00420 #define EXT_FUNC_ARGS(func, ...) _EXT_FUNC(func) (__VA_ARGS__)
00421 #define CALL_EXT_FUNC(func, ...) _EXT_METHOD(cl, m) (__VA_ARGS__)
00422 #endif
00423
00424 #ifdef __cplusplus
00425 #include "dtoolbase_cc.h"
00426 #endif
00427
00428 #endif