opennurbs_system.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2014 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 /*
18 ////////////////////////////////////////////////////////////////
19 //
20 // Includes all system headers required to use the openNURBS toolkit.
21 //
22 ////////////////////////////////////////////////////////////////
23 */
24 
25 #if !defined(OPENNURBS_SYSTEM_INC_)
26 #define OPENNURBS_SYSTEM_INC_
27 
28 
29 
30 
31 
32 #define OPENNURBS_PP2STR_HELPER(s) #s
33 #define OPENNURBS_PP2STR(s) OPENNURBS_PP2STR_HELPER(s)
34 /*
35 // To print the value of a preprocessor macro, do something like:
36 //
37 // #pragma message( "MY_MACRO = " OPENNURBS_PP2STR(MY_MACRO) )
38 //
39 // Typically something mysterious is defining a macro whose value
40 // you would like to see at compile time so you can fix a issue
41 // involving the preprocessor macro's value.
42 */
43 
44 #if defined(ON_DLL_EXPORTS)
45 #error "ON_DLL_EXPORTS" is obsolete. V6 uses "OPENNURBS_EXPORTS".
46 #endif
47 
48 #if defined(ON_EXPORTS)
49 #error "ON_EXPORTS" is obsolete. V6 uses "OPENNURBS_EXPORTS".
50 #endif
51 
52 #if defined(ON_DLL_IMPORTS)
53 #error "ON_DLL_IMPORTS" is obsolete. V6 uses "OPENNURBS_IMPORTS".
54 #endif
55 
56 #if defined(ON_IMPORTS)
57 #error "ON_IMPORTS" is obsolete. V6 uses "OPENNURBS_IMPORTS".
58 #endif
59 
60 #if defined(OPENNURBS_EXPORTS) && defined(OPENNURBS_IMPORTS)
61 /*
62 // - When compiling opennurbs as a dll, define OPENNURBS_EXPORTS.
63 // - When using opennurbs as a dll, define OPENNURBS_IMPORTS.
64 // - When compiling opennurbs as a static library, ON_COMPILING_OPENNURBS
65 // should be defined and neither OPENNURBS_EXPORTS nor OPENNURBS_IMPORTS
66 // should be defined.
67 // - When using opennurbs as a static library, neither
68 // ON_COMPILING_OPENNURBS nor OPENNURBS_EXPORTS nor OPENNURBS_IMPORTS
69 // should be defined.
70 */
71 #error At most one of OPENNURBS_EXPORTS or OPENNURBS_IMPORTS can be defined.
72 #endif
73 
74 #if defined(OPENNURBS_EXPORTS)
75 #if !defined(ON_COMPILING_OPENNURBS)
76 #define ON_COMPILING_OPENNURBS
77 #endif
78 #endif
79 
80 #if defined(_DEBUG)
81 /* enable OpenNurbs debugging code */
82 #if !defined(ON_DEBUG)
83 #define ON_DEBUG
84 #endif
85 #endif
86 
87 #if defined(ON_COMPILING_OPENNURBS) && defined(OPENNURBS_IMPORTS)
88 /*
89 // - If you are using opennurbs as library, do not define
90 // ON_COMPILING_OPENNURBS.
91 // - If you are compiling an opennurbs library, define
92 // ON_COMPILING_OPENNURBS.
93 */
94 #error At most one of ON_COMPILING_OPENNURBS or OPENNURBS_IMPORTS can be defined.
95 #endif
96 
97 /*
98 // Define ON_NO_WINDOWS if you are compiling on a Windows system but want
99 // to explicitly exclude inclusion of windows.h.
100 */
101 
102 #if defined(ON_COMPILING_OPENNURBS)
103 #if !defined(OPENNURBS_WALL)
104 /*
105 // When OPENNURBS_WALL is defined, warnings and deprications that
106 // encourage the highest quality of code are used.
107 */
108 #define OPENNURBS_WALL
109 #endif
110 #endif
111 
112 #include "opennurbs_system_compiler.h"
113 
114 #include "opennurbs_system_runtime.h"
115 
116 #pragma ON_PRAGMA_WARNING_PUSH
117 
118 /* compiler choice */
119 #if defined(ON_COMPILER_MSC)
120 #include "opennurbs_windows_targetver.h"
121 #endif
122 
123 #if defined(ON_RUNTIME_APPLE) && defined(__OBJC__)
124 
125 // The header file opennurbs_system_runtime.h is included in several
126 // places before opennurbs.h or opennurbs_system.h is included.
127 // Therefore, this define cannot be in opennurbs_system_runtime.h
128 //
129 // When ON_RUNTIME_APPLE_OBJECTIVE_C_AVAILABLE is defined,
130 // <Cocoa/Cocoa.h> is included by opennurbs_system.h and
131 // your project must link with the Apple Cocoa Framework.
132 #define ON_RUNTIME_APPLE_OBJECTIVE_C_AVAILABLE
133 
134 #endif
135 
136 #if defined(ON_64BIT_RUNTIME)
137 /* 64 bit (8 byte) pointers */
138 #define ON_SIZEOF_POINTER 8
139 /* ON_MAX_SIZET = maximum value of a size_t type */
140 #define ON_MAX_SIZE_T 0xFFFFFFFFFFFFFFFFULL
141 
142 #if defined(ON_COMPILER_MSC)
143 
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;
149 #endif
150 #define ON__UINT_PTR_MAX 0xFFFFFFFFFFFFFFFFULL
151 
152 #elif defined(ON_32BIT_RUNTIME)
153 /* 32 bit (4 byte) pointers */
154 #define ON_SIZEOF_POINTER 4
155 /* ON_MAX_SIZET = maximum value of a size_t type */
156 #define ON_MAX_SIZE_T 0xFFFFFFFFULL
157 
158 typedef int ON__INT_PTR;
159 typedef unsigned int ON__UINT_PTR;
160 #define ON__UINT_PTR_MAX 0xFFFFFFFFULL
161 
162 #endif
163 
164 // 8 bit integer
165 typedef char ON__INT8;
166 
167 // 8 bit unsigned integer
168 typedef unsigned char ON__UINT8;
169 
170 // 16 bit integer
171 typedef short ON__INT16;
172 
173 // 16 bit unsigned integer
174 typedef unsigned short ON__UINT16;
175 
176 // 32 bit integer
177 typedef int ON__INT32;
178 
179 // 32 bit unsigned integer
180 typedef unsigned int ON__UINT32;
181 
182 #if defined(ON_COMPILER_MSC)
183 // 64 bit integer
184 typedef __int64 ON__INT64;
185 // 64 bit unsigned integer
186 typedef unsigned __int64 ON__UINT64;
187 
188 #elif defined(_GNU_SOURCE) || defined(ON_COMPILER_CLANG)
189 // 64 bit integer
190 typedef long long ON__INT64;
191 // 64 bit unsigned integer
192 typedef unsigned long long ON__UINT64;
193 
194 #else
195 
196 #error Verify that long long is a 64 bit integer with your compiler!
197 
198 // 64 bit integer
199 typedef long long ON__INT64;
200 
201 // 64 bit unsigned integer
202 typedef unsigned long long ON__UINT64;
203 
204 #endif
205 
206 
207 // ON_INT_PTR must be an integer type with sizeof(ON_INT_PTR) = sizeof(void*).
208 #if 8 == ON_SIZEOF_POINTER
209 
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;
213 #else
214 typedef __int64 ON__INT_PTR;
215 typedef unsigned __int64 ON__UINT_PTR;
216 #endif
217 
218 #elif 4 == ON_SIZEOF_POINTER
219 
220 typedef int ON__INT_PTR;
221 typedef unsigned int ON__UINT_PTR;
222 
223 #else
224 #error Update OpenNURBS to work with new pointer size.
225 #endif
226 
227 /*
228 ////////////////////////////////////////////////////////////
229 ////////////////////////////////////////////////////////////
230 ////////////////////////////////////////////////////////////
231 //
232 // BEGIN - fill in missing types and defines
233 //
234 // If you are using an old compiler, then define ON_NEED_* when
235 // you define ON_COMPILER_* above.
236 //
237 */
238 #if defined(ON_NEED_BOOL_TYPEDEF)
239 #undef ON_NEED_BOOL_TYPEDEF
240 typedef ON__UINT8 bool;
241 #endif
242 
243 #if defined(ON_NEED_TRUEFALSE_DEFINE)
244 #undef ON_NEED_TRUEFALSE_DEFINE
245 #define true ((bool)1)
246 #define false ((bool)0)
247 #endif
248 
249 #if defined(ON_NEED_NULLPTR_DEFINE)
250 #undef ON_NEED_NULLPTR_DEFINE
251 #define nullptr 0
252 #endif
253 
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
257 #endif
258 #undef ON_NEED_UTF8_WCHAR_T_TYPEDEF
259 typedef ON__UINT8 wchar_t;
260 #define ON_SIZEOF_WCHAR_T 1
261 
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
265 #endif
266 #undef ON_NEED_UTF16_WCHAR_T_TYPEDEF
267 typedef ON__UINT16 wchar_t;
268 #define ON_SIZEOF_WCHAR_T 2
269 
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
274 
275 #endif
276 
277 /*
278 ////////////////////////////////////////////////////////////
279 ////////////////////////////////////////////////////////////
280 ////////////////////////////////////////////////////////////
281 //
282 // Validate ON_SIZEOF_WCHAR_T and set ON_WCHAR_T_ENCODING
283 //
284 */
285 
286 #if !defined(ON_SIZEOF_WCHAR_T)
287 #error unknown sizeof(wchar_t)
288 #endif
289 
290 #if !defined(ON_WCHAR_T_ENCODING)
291 
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
299 #endif
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
305 #endif
306 #endif
307 
308 #if !defined(ON_WCHAR_T_ENCODING)
309 #error unable to automatically set ON_WCHAR_T_ENCODING
310 #endif
311 
312 #endif
313 
314 
315 /*
316 ////////////////////////////////////////////////////////////
317 ////////////////////////////////////////////////////////////
318 ////////////////////////////////////////////////////////////
319 //
320 // BEGIN - OBSOLETE defines
321 //
322 // These legacy defines will be remvoed from V6
323 //
324 */
325 
326 #if defined(__APPLE__) && (defined(_GNU_SOURCE) || defined(ON_COMPILER_CLANG))
327 /* Poorly named and used define that indicated using Apple's OSX compiler and/or runtime */
328 #if !defined(ON_COMPILER_XCODE)
329 #define ON_COMPILER_XCODE
330 #endif
331 #endif
332 
333 #if defined (ON_RUNTIME_WIN) && !defined(ON_OS_WINDOWS)
334 #define ON_OS_WINDOWS
335 #endif
336 
337 #define ON_MSC_CDECL ON_CALLBACK_CDECL
338 
339 #if defined(ON_64BIT_RUNTIME)
340 #define ON_64BIT_POINTER
341 #elif defined(ON_32BIT_RUNTIME)
342 #define ON_32BIT_POINTER
343 #endif
344 
345 /*
346 //
347 // END - OBSOLETE defines
348 //
349 ////////////////////////////////////////////////////////////
350 ////////////////////////////////////////////////////////////
351 ////////////////////////////////////////////////////////////
352 */
353 
354 // To debug linking pragma path issues, uncomment the followint line
355 //#pragma message( "OPENNURBS_OUTPUT_DIR = " OPENNURBS_PP2STR(OPENNURBS_OUTPUT_DIR) )
356 
357 #if defined(ON_RUNTIME_WIN) && !defined(ON_NO_WINDOWS)
358 
359 /*
360 /////////////////////////////////////////////////////////////////////////
361 //
362 // Begin Windows system includes -
363 */
364 
365 
366 #if defined(_M_X64) && defined(WIN32) && defined(WIN64)
367 // 23 August 2007 Dale Lear
368 
369 #if defined(_INC_WINDOWS)
370 // The user has included Microsoft's windows.h before opennurbs.h,
371 // and windows.h has nested includes that unconditionally define WIN32.
372 // Just undo the damage here or everybody that includes opennurbs.h after
373 // windows.h has to fight with this Microsoft bug.
374 #undef WIN32
375 #else
376 #error do not define WIN32 for x64 builds
377 #endif
378 // NOTE _WIN32 is defined for any type of Windows build
379 #endif
380 
381 #if !defined(_WINDOWS_)
382 /* windows.h has not been read - read just what we need */
383 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
384 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
385 #include <windows.h>
386 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
387 #endif
388 
389 #if defined(_M_X64) && defined(WIN32) && defined(WIN64)
390 // 23 August 2007 Dale Lear
391 // windows.h unconditionally defines WIN32 This is a bug
392 // and the hope is this simple undef will let us continue.
393 #undef WIN32
394 #endif
395 
396 #if defined(ON_RUNTIME_WIN) && !defined(NOGDI)
397 /*
398 // ok to use Windows GDI RECT, LOGFONT, ... stucts.
399 */
400 #define ON_OS_WINDOWS_GDI
401 #endif
402 
403 #endif
404 
405 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
406 #include <stdlib.h>
407 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
408 
409 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
410 #include <memory.h>
411 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
412 
413 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
414 #if defined(ON_COMPILER_CLANG) && defined(ON_RUNTIME_APPLE)
415 #include <malloc/malloc.h>
416 #else
417 #include <malloc.h>
418 #endif
419 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
420 
421 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
422 #include <string.h>
423 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
424 
425 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
426 #include <math.h>
427 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
428 
429 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
430 #include <stdio.h>
431 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
432 
433 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
434 #include <stdarg.h>
435 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
436 
437 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
438 #include <float.h>
439 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
440 
441 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
442 #include <time.h>
443 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
444 
445 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
446 #include <limits.h>
447 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
448 
449 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
450 #include <ctype.h>
451 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
452 
453 #if defined(ON_COMPILER_IRIX)
454 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
455 #include <alloca.h>
456 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
457 
458 #endif
459 
460 #if !defined(ON_COMPILER_BORLANDC)
461 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
462 #include <wchar.h>
463 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
464 
465 #endif
466 
467 #if defined(ON_COMPILER_MSC)
468 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
469 #include <io.h>
470 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
471 
472 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
473 #include <sys/stat.h>
474 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
475 
476 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
477 #include <tchar.h>
478 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
479 
480 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
481 #include <Rpc.h>
482 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
483 
484 #endif
485 
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
490 
491 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
492 #include <sys/stat.h>
493 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
494 
495 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
496 #include <wctype.h>
497 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
498 
499 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
500 #include <dirent.h>
501 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
502 
503 #endif
504 
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
509 
510 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
511 #include <sys/stat.h>
512 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
513 
514 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
515 #include <wctype.h>
516 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
517 
518 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
519 #include <dirent.h>
520 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
521 
522 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
523 #if defined(ON_RUNTIME_ANDROID)
524 #include "android_uuid/uuid.h"
525 #else
526 #include <uuid/uuid.h>
527 #endif
528 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
529 
530 #endif
531 
532 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
533 #include <errno.h>
534 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
535 
536 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
537 // For definition of PRIu64 to print 64-bit ints portably.
538 #include <inttypes.h>
539 #if !defined(PRIu64)
540 #error no PRIu64
541 #endif
542 
543 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
544 
545 
546 #if defined (cplusplus) || defined(_cplusplus) || defined(__cplusplus)
547 // C++ system includes
548 
549 #if !defined(ON_CPLUSPLUS)
550 #define ON_CPLUSPLUS
551 #endif
552 
553 // Standard C++ tools
554 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
555 #include <new> // for declaration of placement versions of new used in ON_ClassArray<>.
556 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
557 
558 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
559 #include <memory> // for std::shared_ptr
560 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
561 
562 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
563 #include <utility> // std::move
564 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
565 
566 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
567 #include <string> // std::string, std::wstring
568 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
569 
570 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
571 #include <locale> // for call create_locale(LC_ALL,"C") in ON_Locale().
572 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
573 
574 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
575 #include <atomic> // for std:atomic<type>
576 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
577 
578 
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*){})
582 
583 #if defined(ON_RUNTIME_APPLE)
584 
585 #if defined(ON_COMPILER_CLANG)
586 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
587 #include <wchar.h>
588 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
589 
590 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
591 #include <xlocale.h>
592 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
593 
594 #endif
595 
596 #if defined(ON_RUNTIME_APPLE_OBJECTIVE_C_AVAILABLE)
597 // Opennurbs uses NSFont and NSString to load Apple fonts
598 // int the ON_Font and freetype internals.
599 // When ON_RUNTIME_APPLE_OBJECTIVE_C_AVAILABLE is defined, you
600 // must link with the Apple Cocoa Framework.
601 #pragma ON_PRAGMA_WARNING_BEFORE_DIRTY_INCLUDE
602 #include <Cocoa/Cocoa.h>
603 #pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE
604 
605 #endif
606 #endif
607 
608 #endif
609 
610 /*
611 /////////////////////////////////////////////////////////////////////////////////
612 //
613 // Validate defines
614 //
615 */
616 
617 /*
618 // Validate ON_x_ENDIAN defines
619 */
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.
622 #endif
623 
624 #if !defined(ON_LITTLE_ENDIAN) && !defined(ON_BIG_ENDIAN)
625 #error Either ON_LITTLE_ENDIAN or ON_BIG_ENDIAN must be defined.
626 #endif
627 
628 /*
629 // Validate ON_xBIT_RUNTIME defines
630 */
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.
633 #endif
634 
635 #if !defined(ON_64BIT_RUNTIME) && !defined(ON_32BIT_RUNTIME)
636 #error Either ON_64BIT_RUNTIME or ON_32BIT_RUNTIME must be defined.
637 #endif
638 
639 /*
640 // Validate ON_SIZEOF_POINTER defines
641 */
642 #if 8 == ON_SIZEOF_POINTER
643 
644 #if !defined(ON_64BIT_RUNTIME)
645 #error 8 = ON_SIZEOF_POINTER and ON_64BIT_RUNTIME is not defined
646 #endif
647 #if defined(ON_32BIT_RUNTIME)
648 #error 8 = ON_SIZEOF_POINTER and ON_32BIT_RUNTIME is defined
649 #error
650 #endif
651 
652 #elif 4 == ON_SIZEOF_POINTER
653 
654 #if !defined(ON_32BIT_RUNTIME)
655 #error 4 = ON_SIZEOF_POINTER and ON_32BIT_RUNTIME is not defined
656 #endif
657 #if defined(ON_64BIT_RUNTIME)
658 #error 4 = ON_SIZEOF_POINTER and ON_64BIT_RUNTIME is defined
659 #endif
660 
661 #else
662 
663 #error OpenNURBS assumes sizeof(void*) is 4 or 8 bytes
664 
665 #endif
666 
667 #if defined(__FUNCTION__)
668 #define OPENNURBS__FUNCTION__ __FUNCTION__
669 #elif defined(__func__)
670 #define OPENNURBS__FUNCTION__ __func__
671 #else
672 #define OPENNURBS__FUNCTION__ ""
673 #endif
674 
675 #pragma ON_PRAGMA_WARNING_POP
676 
677 
678 #endif