20 // Includes all system headers required to use the openNURBS toolkit.
25 #if !defined(OPENNURBS_SYSTEM_INC_) 26 #define OPENNURBS_SYSTEM_INC_ 32 #define OPENNURBS_PP2STR_HELPER(s) #s 33 #define OPENNURBS_PP2STR(s) OPENNURBS_PP2STR_HELPER(s) 44 #if defined(ON_DLL_EXPORTS) 45 #error "ON_DLL_EXPORTS" is obsolete. V6 uses "OPENNURBS_EXPORTS". 48 #if defined(ON_EXPORTS) 49 #error "ON_EXPORTS" is obsolete. V6 uses "OPENNURBS_EXPORTS". 52 #if defined(ON_DLL_IMPORTS) 53 #error "ON_DLL_IMPORTS" is obsolete. V6 uses "OPENNURBS_IMPORTS". 56 #if defined(ON_IMPORTS) 57 #error "ON_IMPORTS" is obsolete. V6 uses "OPENNURBS_IMPORTS". 60 #if defined(OPENNURBS_EXPORTS) && defined(OPENNURBS_IMPORTS) 71 #error At most one of OPENNURBS_EXPORTS or OPENNURBS_IMPORTS can be defined. 74 #if defined(OPENNURBS_EXPORTS) 75 #if !defined(ON_COMPILING_OPENNURBS) 76 #define ON_COMPILING_OPENNURBS 82 #if !defined(ON_DEBUG) 87 #if defined(ON_COMPILING_OPENNURBS) && defined(OPENNURBS_IMPORTS) 94 #error At most one of ON_COMPILING_OPENNURBS or OPENNURBS_IMPORTS can be defined. 102 #if defined(ON_COMPILING_OPENNURBS) 103 #if !defined(OPENNURBS_WALL) 108 #define OPENNURBS_WALL 112 #include "opennurbs_system_compiler.h" 114 #include "opennurbs_system_runtime.h" 116 #pragma ON_PRAGMA_WARNING_PUSH 119 #if defined(ON_COMPILER_MSC) 120 #include "opennurbs_windows_targetver.h" 123 #if defined(ON_RUNTIME_APPLE) && defined(__OBJC__) 132 #define ON_RUNTIME_APPLE_OBJECTIVE_C_AVAILABLE 136 #if defined(ON_64BIT_RUNTIME) 138 #define ON_SIZEOF_POINTER 8 140 #define ON_MAX_SIZE_T 0xFFFFFFFFFFFFFFFFULL 142 #if defined(ON_COMPILER_MSC) 144 typedef __int64 ON__INT_PTR;
145 typedef unsigned __int64 ON__UINT_PTR;
146 #elif defined(_GNU_SOURCE) || defined(ON_COMPILER_CLANG) 147 typedef long long ON__INT_PTR;
148 typedef unsigned long long ON__UINT_PTR;
150 #define ON__UINT_PTR_MAX 0xFFFFFFFFFFFFFFFFULL 152 #elif defined(ON_32BIT_RUNTIME) 154 #define ON_SIZEOF_POINTER 4 156 #define ON_MAX_SIZE_T 0xFFFFFFFFULL 158 typedef int ON__INT_PTR;
159 typedef unsigned int ON__UINT_PTR;
160 #define ON__UINT_PTR_MAX 0xFFFFFFFFULL 165 typedef char ON__INT8;
168 typedef unsigned char ON__UINT8;
171 typedef short ON__INT16;
174 typedef unsigned short ON__UINT16;
177 typedef int ON__INT32;
180 typedef unsigned int ON__UINT32;
182 #if defined(ON_COMPILER_MSC) 184 typedef __int64 ON__INT64;
186 typedef unsigned __int64 ON__UINT64;
188 #elif defined(_GNU_SOURCE) || defined(ON_COMPILER_CLANG) 190 typedef long long ON__INT64;
192 typedef unsigned long long ON__UINT64;
196 #error Verify that long long is a 64 bit integer with your compiler! 199 typedef long long ON__INT64;
202 typedef unsigned long long ON__UINT64;
208 #if 8 == ON_SIZEOF_POINTER 210 #if defined(ON_COMPILER_GNU) || defined(ON_COMPILER_CLANG) 211 typedef long long ON__INT_PTR;
212 typedef unsigned long long ON__UINT_PTR;
214 typedef __int64 ON__INT_PTR;
215 typedef unsigned __int64 ON__UINT_PTR;
218 #elif 4 == ON_SIZEOF_POINTER 220 typedef int ON__INT_PTR;
221 typedef unsigned int ON__UINT_PTR;
224 #error Update OpenNURBS to work with new pointer size. 232 // BEGIN - fill in missing types and defines
234 // If you are using an old compiler, then define ON_NEED_* when
235 // you define ON_COMPILER_* above.
238 #if defined(ON_NEED_BOOL_TYPEDEF) 239 #undef ON_NEED_BOOL_TYPEDEF 240 typedef ON__UINT8 bool;
243 #if defined(ON_NEED_TRUEFALSE_DEFINE) 244 #undef ON_NEED_TRUEFALSE_DEFINE 245 #define true ((bool)1) 246 #define false ((bool)0) 249 #if defined(ON_NEED_NULLPTR_DEFINE) 250 #undef ON_NEED_NULLPTR_DEFINE 254 #if defined(ON_NEED_UTF8_WCHAR_T_TYPEDEF) 255 #if defined(ON_NEED_UTF16_WCHAR_T_TYPEDEF) || defined(ON_NEED_UTF32_WCHAR_T_TYPEDEF) 256 #error You may define at most one of ON_NEED_UTF8_WCHAR_T_TYPEDEF, ON_NEED_UTF16_WCHAR_T_TYPEDEF and ON_NEED_UTF16_WCHAR_T_TYPEDEF 258 #undef ON_NEED_UTF8_WCHAR_T_TYPEDEF 259 typedef ON__UINT8 wchar_t;
260 #define ON_SIZEOF_WCHAR_T 1 262 #elif defined(ON_NEED_UTF16_WCHAR_T_TYPEDEF) 263 #if defined(ON_NEED_UTF32_WCHAR_T_TYPEDEF) 264 #error You may define at most one of ON_NEED_UTF8_WCHAR_T_TYPEDEF, ON_NEED_UTF16_WCHAR_T_TYPEDEF and ON_NEED_UTF16_WCHAR_T_TYPEDEF 266 #undef ON_NEED_UTF16_WCHAR_T_TYPEDEF 267 typedef ON__UINT16 wchar_t;
268 #define ON_SIZEOF_WCHAR_T 2 270 #elif defined(ON_NEED_UTF32_WCHAR_T_TYPEDEF) 271 #undef ON_NEED_UTF32_WCHAR_T_TYPEDEF 272 typedef ON__UINT32 wchar_t;
273 #define ON_SIZEOF_WCHAR_T 4 282 // Validate ON_SIZEOF_WCHAR_T and set ON_WCHAR_T_ENCODING
286 #if !defined(ON_SIZEOF_WCHAR_T) 287 #error unknown sizeof(wchar_t) 290 #if !defined(ON_WCHAR_T_ENCODING) 292 #if (1 == ON_SIZEOF_WCHAR_T) 293 #define ON_WCHAR_T_ENCODING ON_UnicodeEncoding::ON_UTF_8 294 #elif (2 == ON_SIZEOF_WCHAR_T) 295 #if defined(ON_LITTLE_ENDIAN) 296 #define ON_WCHAR_T_ENCODING ON_UnicodeEncoding::ON_UTF_16LE 297 #elif defined(ON_BIG_ENDIAN) 298 #define ON_WCHAR_T_ENCODING ON_UnicodeEncoding::ON_UTF_16BE 300 #elif (4 == ON_SIZEOF_WCHAR_T) 301 #if defined(ON_LITTLE_ENDIAN) 302 #define ON_WCHAR_T_ENCODING ON_UnicodeEncoding::ON_UTF_32LE 303 #elif defined(ON_BIG_ENDIAN) 304 #define ON_WCHAR_T_ENCODING ON_UnicodeEncoding::ON_UTF_32BE 308 #if !defined(ON_WCHAR_T_ENCODING) 309 #error unable to automatically set ON_WCHAR_T_ENCODING 320 // BEGIN - OBSOLETE defines
322 // These legacy defines will be remvoed from V6
326 #if defined(__APPLE__) && (defined(_GNU_SOURCE) || defined(ON_COMPILER_CLANG)) 328 #if !defined(ON_COMPILER_XCODE) 329 #define ON_COMPILER_XCODE 333 #if defined (ON_RUNTIME_WIN) && !defined(ON_OS_WINDOWS) 334 #define ON_OS_WINDOWS 337 #define ON_MSC_CDECL ON_CALLBACK_CDECL 339 #if defined(ON_64BIT_RUNTIME) 340 #define ON_64BIT_POINTER 341 #elif defined(ON_32BIT_RUNTIME) 342 #define ON_32BIT_POINTER 357 #if defined(ON_RUNTIME_WIN) && !defined(ON_NO_WINDOWS) 362 // Begin Windows system includes -
366 #if defined(_M_X64) && defined(WIN32) && defined(WIN64) 369 #if defined(_INC_WINDOWS) 376 #error do not define WIN32 for x64 builds 381 #if !defined(_WINDOWS_) 383 #define WIN32_LEAN_AND_MEAN 384 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 386 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 389 #if defined(_M_X64) && defined(WIN32) && defined(WIN64) 396 #if defined(ON_RUNTIME_WIN) && !defined(NOGDI) 400 #define ON_OS_WINDOWS_GDI 405 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 407 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 409 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 411 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 413 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 414 #if defined(ON_COMPILER_CLANG) && defined(ON_RUNTIME_APPLE) 415 #include <malloc/malloc.h> 419 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 421 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 423 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 425 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 427 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 429 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 431 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 433 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 435 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 437 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 439 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 441 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 443 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 445 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 447 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 449 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 451 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 453 #if defined(ON_COMPILER_IRIX) 454 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 456 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 460 #if !defined(ON_COMPILER_BORLANDC) 461 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 463 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 467 #if defined(ON_COMPILER_MSC) 468 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 470 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 472 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 473 #include <sys/stat.h> 474 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 476 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 478 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 480 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 482 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 486 #if defined(ON_COMPILER_GNU) 487 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 488 #include <sys/types.h> 489 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 491 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 492 #include <sys/stat.h> 493 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 495 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 497 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 499 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 501 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 505 #if defined(ON_COMPILER_CLANG) 506 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 507 #include <sys/types.h> 508 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 510 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 511 #include <sys/stat.h> 512 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 514 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 516 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 518 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 520 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 522 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 523 #if defined(ON_RUNTIME_ANDROID) 524 #include "android_uuid/uuid.h" 526 #include <uuid/uuid.h> 528 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 532 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 534 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 536 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 538 #include <inttypes.h> 543 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 546 #if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus) 549 #if !defined(ON_CPLUSPLUS) 554 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 556 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 558 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 560 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 562 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 564 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 566 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 568 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 570 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 572 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 574 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 576 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 579 #define ON_NO_SHARED_PTR_DTOR(T) [=](T*){} 580 #define ON_MANAGED_SHARED_PTR(T, p) std::shared_ptr<T>(p) 581 #define ON_UNMANAGED_SHARED_PTR(T, p) std::shared_ptr<T>(p,[=](T*){}) 583 #if defined(ON_RUNTIME_APPLE) 585 #if defined(ON_COMPILER_CLANG) 586 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 588 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 590 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 592 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 596 #if defined(ON_RUNTIME_APPLE_OBJECTIVE_C_AVAILABLE) 601 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE 602 #include <Cocoa/Cocoa.h> 603 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE 620 #if defined(ON_LITTLE_ENDIAN) && defined(ON_BIG_ENDIAN) 621 #error Exactly one of ON_LITTLE_ENDIAN or ON_BIG_ENDIAN must be defined. 624 #if !defined(ON_LITTLE_ENDIAN) && !defined(ON_BIG_ENDIAN) 625 #error Either ON_LITTLE_ENDIAN or ON_BIG_ENDIAN must be defined. 631 #if defined(ON_64BIT_RUNTIME) && defined(ON_32BIT_RUNTIME) 632 #error Exactly one of ON_64BIT_RUNTIME or ON_32BIT_RUNTIME must be defined. 635 #if !defined(ON_64BIT_RUNTIME) && !defined(ON_32BIT_RUNTIME) 636 #error Either ON_64BIT_RUNTIME or ON_32BIT_RUNTIME must be defined. 642 #if 8 == ON_SIZEOF_POINTER 644 #if !defined(ON_64BIT_RUNTIME) 645 #error 8 = ON_SIZEOF_POINTER and ON_64BIT_RUNTIME is not defined 647 #if defined(ON_32BIT_RUNTIME) 648 #error 8 = ON_SIZEOF_POINTER and ON_32BIT_RUNTIME is defined 652 #elif 4 == ON_SIZEOF_POINTER 654 #if !defined(ON_32BIT_RUNTIME) 655 #error 4 = ON_SIZEOF_POINTER and ON_32BIT_RUNTIME is not defined 657 #if defined(ON_64BIT_RUNTIME) 658 #error 4 = ON_SIZEOF_POINTER and ON_64BIT_RUNTIME is defined 663 #error OpenNURBS assumes sizeof(void*) is 4 or 8 bytes 667 #if defined(__FUNCTION__) 668 #define OPENNURBS__FUNCTION__ __FUNCTION__ 669 #elif defined(__func__) 670 #define OPENNURBS__FUNCTION__ __func__ 672 #define OPENNURBS__FUNCTION__ "" 675 #pragma ON_PRAGMA_WARNING_POP