debug.c needs dylib.h.
[SquirrelJME.git] / nanocoat / include / sjme / config.h
blob56fb8485e35204ec029f3f7cb1370a9e719189e8
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 /**
11 * Basic configuration header.
13 * @since 2023/07/27
16 #ifndef SQUIRRELJME_CONFIG_H
17 #define SQUIRRELJME_CONFIG_H
19 #include <stddef.h>
21 /* Anti-C++. */
22 #ifdef __cplusplus
23 #ifndef SJME_CXX_IS_EXTERNED
24 #define SJME_CXX_IS_EXTERNED
25 #define SJME_CXX_SQUIRRELJME_CONFIG_H
26 extern "C" {
27 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
28 #endif /* #ifdef __cplusplus */
30 /*--------------------------------------------------------------------------*/
32 #if !defined(SJME_CONFIG_RELEASE) && !defined(SJME_CONFIG_DEBUG)
33 #if (defined(DEBUG) || defined(_DEBUG)) || \
34 (!defined(NDEBUG) && !defined(_NDEBUG))
35 /** Debug build. */
36 #define SJME_CONFIG_DEBUG
37 #else
38 /** Release build. */
39 #define SJME_CONFIG_RELEASE
40 #endif
41 #elif defined(SJME_CONFIG_RELEASE) && defined(SJME_CONFIG_DEBUG)
42 #undef SJME_CONFIG_RELEASE
43 #endif
45 /* The current operating system. */
46 #if defined(__EMSCRIPTEN__) || defined(EMSCRIPTEN)
47 /** Emscripten (WASM). */
48 #define SJME_CONFIG_HAS_EMSCRIPTEN
49 #elif defined(GEKKO)
50 #if defined(WIIU)
51 /** Nintendo Wii U is available. */
52 #define SJME_CONFIG_HAS_NINTENDO_WIIU
53 #else
54 /** Nintendo Wii is available. */
55 #define SJME_CONFIG_HAS_NINTENDO_WII
56 #endif
57 #elif defined(__3DS__) || defined(_3DS)
58 /** Nintendo 3DS is available. */
59 #define SJME_CONFIG_HAS_NINTENDO_3DS
60 #elif defined(__linux__) || defined(linux) || defined(__linux)
61 /** Linux is available. */
62 #define SJME_CONFIG_HAS_LINUX
63 #elif defined(__CYGWIN__)
64 /** Cygwin is available. */
65 #define SJME_CONFIG_HAS_CYGWIN
66 #elif defined(_WIN16) || defined(__WIN16__) || defined(__WIN16)
67 /** Using Windows 16-bit. */
68 #define SJME_CONFIG_HAS_WINDOWS_16
70 /** Windows is available however. */
71 #define SJME_CONFIG_HAS_WINDOWS 16
72 #elif defined(_WIN32) || defined(__WIN32__) || \
73 defined(__WIN32) || defined(_WINDOWS)
74 /** Using Windows 32-bit. */
75 #define SJME_CONFIG_HAS_WINDOWS_32
77 /** Windows is available. */
78 #define SJME_CONFIG_HAS_WINDOWS 32
79 #elif defined(__APPLE__) && defined(__MACH__)
80 /** macOS 10+ is available. */
81 #define SJME_CONFIG_HAS_MACOS
82 #elif defined(macintosh)
83 /** macOS Classic is available. */
84 #define SJME_CONFIG_HAS_MACOS_CLASSIC
85 #elif defined(__palmos__)
86 /** PalmOS is available. */
87 #define SJME_CONFIG_HAS_PALMOS
88 #elif defined(__FreeBSD__) || defined(__NetBSD__) || \
89 defined(__OpenBSD__) || defined(__bsdi__) || \
90 defined(__DragonFly__) || defined(__MidnightBSD__)
91 /** BSD is available. */
92 #define SJME_CONFIG_HAS_BSD
93 #elif defined(__BEOS__) || defined(__HAIKU__)
94 /** BeOS/Haiku is available. */
95 #define SJME_CONFIG_HAS_BEOS
96 #endif
98 /** Possibly detect endianess. */
99 #if !defined(SJME_CONFIG_HAS_BIG_ENDIAN) && \
100 !defined(SJME_CONFIG_HAS_LITTLE_ENDIAN)
101 /** Defined by the system? */
102 #if !defined(SJME_CONFIG_HAS_BIG_ENDIAN)
103 #if defined(__BYTE_ORDER__) && \
104 (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
105 #define SJME_CONFIG_HAS_BIG_ENDIAN
106 #endif
107 #endif
109 /** Just set little endian if no endianess was defined */
110 #if !defined(SJME_CONFIG_HAS_BIG_ENDIAN) && \
111 !defined(SJME_CONFIG_HAS_LITTLE_ENDIAN)
112 #define SJME_CONFIG_HAS_LITTLE_ENDIAN
113 #endif
115 /** If both are defined, just set big endian. */
116 #if defined(SJME_CONFIG_HAS_BIG_ENDIAN) && \
117 defined(SJME_CONFIG_HAS_LITTLE_ENDIAN)
118 #undef SJME_CONFIG_HAS_LITTLE_ENDIAN
119 #endif
120 #endif
122 #if defined(__amd64__) || defined(__amd64__) || defined(__x86_64__) || \
123 defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
124 /** Has AMD64. */
125 #define SJME_CONFIG_HAS_ARCH_AMD64
126 #elif defined(_M_ARM64) || defined(_M_ARM64EC) || defined(__aarch64__)
127 /** Has ARM64. */
128 #define SJME_CONFIG_HAS_ARCH_ARM64
129 #elif defined(__ia64__) || defined(_IA64) || \
130 defined(__IA64__) || defined(__ia64) || defined(_M_IA64) || \
131 defined(__itanium__)
132 /** Has Itanium. */
133 #define SJME_CONFIG_HAS_ARCH_IA64
134 #elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \
135 defined(_ARCH_PPC64)
136 /** Has PowerPC. */
137 #define SJME_CONFIG_HAS_ARCH_POWERPC 32
139 /** Has PowerPC 64-bit. */
140 #define SJME_CONFIG_HAS_ARCH_POWERPC_64
141 #elif defined(_M_PPC) || defined(__powerpc) || defined(__powerpc__) || \
142 defined(__POWERPC__) || defined(__ppc__) || \
143 defined(__PPC__) || defined(_ARCH_PPC)
144 /** Has PowerPC. */
145 #define SJME_CONFIG_HAS_ARCH_POWERPC 32
147 /** Has PowerPC 32-bit. */
148 #define SJME_CONFIG_HAS_ARCH_POWERPC_32
149 #elif defined(_M_I86) || defined(_M_IX86) || defined(__X86__) || \
150 defined(_X86_) || defined(__I86__) || defined(__i386) || \
151 defined(__i386__) || defined(__i486__) || defined(__i586__) || \
152 defined(__i686__)
153 /** Has Intel 32-bit (x86). */
154 #define SJME_CONFIG_HAS_ARCH_IA32
155 #endif
157 /* Attempt detection of pointer sizes based on architecture? */
158 #if (defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4) || \
159 defined(_ILP32) || defined(__ILP32__)
160 /** Pointer size. */
161 #define SJME_CONFIG_HAS_POINTER 32
162 #elif (defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8) || \
163 defined(_LP64) || defined(_LP64)
164 /** Pointer size. */
165 #define SJME_CONFIG_HAS_POINTER 64
166 #else
167 /* 64-bit seeming architecture, common 64-bit ones? */
168 #if defined(SJME_CONFIG_HAS_ARCH_AMD64) || \
169 defined(SJME_CONFIG_HAS_ARCH_ARM64) || \
170 defined(SJME_CONFIG_HAS_ARCH_IA64) || \
171 defined(SJME_CONFIG_HAS_ARCH_POWERPC_64) || \
172 defined(_WIN64)
173 /** Pointer size. */
174 #define SJME_CONFIG_HAS_POINTER 64
175 #else
176 /** Pointer size. */
177 #define SJME_CONFIG_HAS_POINTER 32
178 #endif
179 #endif
181 #if SJME_CONFIG_HAS_POINTER == 32
182 /** Has 32-bit pointer. */
183 #define SJME_CONFIG_HAS_POINTER32
184 #endif
186 #if SJME_CONFIG_HAS_POINTER == 64
187 /** Has 64-bit pointer. */
188 #define SJME_CONFIG_HAS_POINTER64
189 #endif
191 #if defined(SJME_CONFIG_ROM0)
192 /** ROM 0 Address. */
193 #define SJME_CONFIG_ROM0_ADDR &SJME_CONFIG_ROM0
194 #elif !defined(SJME_CONFIG_ROM0_ADDR)
195 /** ROM 0 Address. */
196 #define SJME_CONFIG_ROM0_ADDR NULL
197 #endif
199 #if defined(SJME_CONFIG_ROM1)
200 /** ROM 1 Address. */
201 #define SJME_CONFIG_ROM1_ADDR &SJME_CONFIG_ROM1
202 #elif !defined(SJME_CONFIG_ROM1_ADDR)
203 /** ROM 1 Address. */
204 #define SJME_CONFIG_ROM1_ADDR NULL
205 #endif
207 #if defined(SJME_CONFIG_ROM2)
208 /** ROM 2 Address. */
209 #define SJME_CONFIG_ROM2_ADDR &SJME_CONFIG_ROM2
210 #elif !defined(SJME_CONFIG_ROM2_ADDR)
211 /** ROM 2 Address. */
212 #define SJME_CONFIG_ROM2_ADDR NULL
213 #endif
215 #if defined(SJME_CONFIG_ROM3)
216 /** ROM 3 Address. */
217 #define SJME_CONFIG_ROM3_ADDR &SJME_CONFIG_ROM3
218 #elif !defined(SJME_CONFIG_ROM3_ADDR)
219 /** ROM 3 Address. */
220 #define SJME_CONFIG_ROM3_ADDR NULL
221 #endif
223 #if defined(SJME_CONFIG_ROM4)
224 /** ROM 4 Address. */
225 #define SJME_CONFIG_ROM4_ADDR &SJME_CONFIG_ROM4
226 #elif !defined(SJME_CONFIG_ROM4_ADDR)
227 /** ROM 4 Address. */
228 #define SJME_CONFIG_ROM4_ADDR NULL
229 #endif
231 #if defined(SJME_CONFIG_ROM5)
232 /** ROM 5 Address. */
233 #define SJME_CONFIG_ROM5_ADDR &SJME_CONFIG_ROM5
234 #elif !defined(SJME_CONFIG_ROM5_ADDR)
235 /** ROM 5 Address. */
236 #define SJME_CONFIG_ROM5_ADDR NULL
237 #endif
239 #if defined(SJME_CONFIG_ROM6)
240 /** ROM 6 Address. */
241 #define SJME_CONFIG_ROM6_ADDR &SJME_CONFIG_ROM6
242 #elif !defined(SJME_CONFIG_ROM6_ADDR)
243 /** ROM 6 Address. */
244 #define SJME_CONFIG_ROM6_ADDR NULL
245 #endif
247 #if defined(SJME_CONFIG_ROM7)
248 /** ROM 7 Address. */
249 #define SJME_CONFIG_ROM7_ADDR &SJME_CONFIG_ROM7
250 #elif !defined(SJME_CONFIG_ROM7_ADDR)
251 /** ROM 7 Address. */
252 #define SJME_CONFIG_ROM7_ADDR NULL
253 #endif
255 #if defined(SJME_CONFIG_ROM8)
256 /** ROM 8 Address. */
257 #define SJME_CONFIG_ROM8_ADDR &SJME_CONFIG_ROM8
258 #elif !defined(SJME_CONFIG_ROM8_ADDR)
259 /** ROM 8 Address. */
260 #define SJME_CONFIG_ROM8_ADDR NULL
261 #endif
263 #if defined(SJME_CONFIG_ROM9)
264 /** ROM 9 Address. */
265 #define SJME_CONFIG_ROM9_ADDR &SJME_CONFIG_ROM9
266 #elif !defined(SJME_CONFIG_ROM9_ADDR)
267 /** ROM 9 Address. */
268 #define SJME_CONFIG_ROM9_ADDR NULL
269 #endif
271 /* C99 supports flexible array members. */
272 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
273 /** Flexible array members. */
274 #define sjme_flexibleArrayCount
275 #endif
277 /* Visual C++. */
278 #if defined(_MSC_VER)
279 #include <sal.h>
281 /** Return value must be checked. */
282 #define sjme_attrCheckReturn _Must_inspect_result_
284 /** Deprecated. */
285 #define sjme_attrDeprecated __declspec(deprecated)
287 /** Formatted string argument. */
288 #define sjme_attrFormatArg _Printf_format_string_
290 /** Input cannot be null. */
291 #define sjme_attrInNotNull _In_
293 /** Input can be null. */
294 #define sjme_attrInNullable _In_opt_
296 /** Takes input and produces output. */
297 #define sjme_attrInOutNotNull _In_opt_ _Out_opt_
299 /** Input value range. */
300 #define sjme_attrInRange(lo, hi) _In_range_((lo), (hi))
302 /** Method takes input. */
303 #define sjme_attrInValue _In_
305 /** Does not return. */
306 #define sjme_attrReturnNever _Always_(_Raises_SEH_exception_)
308 /** Returns nullable value. */
309 #define sjme_attrReturnNullable _Outptr_result_maybenull_z_
311 /** Method gives output. */
312 #define sjme_attrOutNotNull _Out_
314 /** Method output can be null. */
315 #define sjme_attrOutNullable _Out_opt_
317 /** Output to buffer. */
318 #define sjme_attrOutNotNullBuf(lenArg) _Out_writes_(lenArg)
320 /** Output value range. */
321 #define sjme_attrOutRange(lo, hi) _Out_range_((lo), (hi))
323 #if !defined(sjme_flexibleArrayCount)
324 /** Flexible array count, MSVC requires 1 because C2233. */
325 #define sjme_flexibleArrayCount 1
326 #endif
328 #if !defined(sjme_flexibleArrayCountUnion)
329 /** Flexible array count for union, MSVC requires 1 because C2233. */
330 #define sjme_flexibleArrayCountUnion 1
331 #endif
333 /** Allocate on the stack. */
334 #define sjme_alloca(size) _alloca((size))
335 #elif defined(__clang__) || defined(__GNUC__)
336 /* Clang has special analyzer stuff, but also same as GCC otherwise. */
337 #if defined(__clang__)
338 #if __has_feature(attribute_analyzer_noreturn)
339 /** Method does not return. */
340 #define sjme_attrReturnNever __attribute__((analyzer_noreturn))
341 #endif
343 /** Returns nullable value. */
344 #define sjme_attrReturnNullable _Nullable_result
345 #endif
347 #if !defined(sjme_attrReturnNever)
348 #if defined(__builtin_unreachable)
349 /** Function never returns. */
350 #define sjme_attrReturnNever (__builtin_unreachable())
351 #endif
352 #endif
354 /** Artificial function. */
355 #define sjme_attrArtificial __attribute__((artificial))
357 /** Check return value. */
358 #define sjme_attrCheckReturn __attribute__((warn_unused_result))
360 /** Deprecated. */
361 #define sjme_attrDeprecated __attribute__((deprecated))
363 /** Disable optimization. */
364 #define sjme_noOptimize __attribute__((optimize("O0")))
367 * Formatted string.
369 * @param formatIndex The formatted string index.
370 * @param vaIndex The index of @c ... or @c va_list .
371 * @since 2023/08/05
373 #define sjme_attrFormatOuter(formatIndex, vaIndex) \
374 __attribute__((format(__printf__, formatIndex + 1, vaIndex + 1)))
376 /** Indicates a callback. */
377 #define sjme_attrCallback __attribute__((callback))
379 /** Not used. */
380 #define sjme_attrUnused __attribute__((unused))
382 /** Not used enum constant. */
383 #define sjme_attrUnusedEnum(x) x sjme_attrUnused
385 #if !defined(sjme_attrReturnNever)
386 /** Method does not return. */
387 #define sjme_attrReturnNever __attribute__((noreturn))
388 #endif
390 #if !defined(sjme_flexibleArrayCount)
391 /** Flexible array size count, GCC is fine with blank. */
392 #define sjme_flexibleArrayCount
393 #endif
394 #elif defined(__WATCOMC__)
395 /** Flexible array size count. */
396 #define sjme_flexibleArrayCount
398 /** Flexible array count but for unions. */
399 #define sjme_flexibleArrayCountUnion 1
400 #endif
402 #if !defined(sjme_attrCallback)
403 /** Indicates a callback. */
404 #define sjme_attrCallback
405 #endif
407 #if !defined(sjme_attrCheckReturn)
408 /** Return value must be checked. */
409 #define sjme_attrCheckReturn
410 #endif
412 #if !defined(sjme_attrDeprecated)
413 /** Deprecated. */
414 #define sjme_attrDeprecated
415 #endif
417 #if !defined(sjme_attrFormatArg)
418 /** Formatted string argument. */
419 #define sjme_attrFormatArg
420 #endif
422 #if !defined(sjme_attrFormatOuter)
424 * Formatted string.
426 * @param formatIndex The formatted string index.
427 * The index of @c ... or @c va_list .
428 * @since 2023/08/05
430 #define sjme_attrFormatOuter(formatIndex, vaIndex)
431 #endif
433 #if !defined(sjme_attrInValue)
434 /** Method takes input. */
435 #define sjme_attrInValue
436 #endif
438 #if !defined(sjme_attrInRange)
439 /** Input value range. */
440 #define sjme_attrInRange(lo, hi)
441 #endif
443 #if !defined(sjme_attrReturnNever)
444 /** Method does not return. */
445 #define sjme_attrReturnNever
446 #endif
448 #if !defined(sjme_attrReturnNullable)
449 /** Returns a nullable value. */
450 #define sjme_attrReturnNullable
451 #endif
453 #if !defined(sjme_attrInValue)
454 /** Takes input value. */
455 #define sjme_attrInValue
456 #endif
458 #if !defined(sjme_attrInNotNull)
459 /** Cannot be null. */
460 #define sjme_attrInNotNull sjme_attrInValue
461 #endif
463 #if !defined(sjme_attrInNullable)
464 /** Nullable. */
465 #define sjme_attrInNullable sjme_attrInValue
466 #endif
468 #if !defined(sjme_attrOutNotNull)
469 /** Method gives output. */
470 #define sjme_attrOutNotNull sjme_attrInNotNull
471 #endif
473 #if !defined(sjme_attrOutNullable)
474 /** Method output can be null. */
475 #define sjme_attrOutNullable sjme_attrInNullable
476 #endif
478 #if !defined(sjme_attrInOutNotNull)
479 /** Takes input and produces output. */
480 #define sjme_attrInOutNotNull sjme_attrInNotNull sjme_attrOutNotNull
481 #endif
483 #if !defined(sjme_attrInNotNullBuf)
484 /** Input to buffer. */
485 #define sjme_attrInNotNullBuf(lenArg) sjme_attrInNotNull
486 #endif
488 #if !defined(sjme_attrOutNotNullBuf)
489 /** Output to buffer. */
490 #define sjme_attrOutNotNullBuf(lenArg) sjme_attrOutNotNull
491 #endif
493 #if !defined(sjme_attrOutRange)
494 /** Output value range. */
495 #define sjme_attrOutRange(lo, hi)
496 #endif
498 /** Positive value. */
499 #define sjme_attrInPositive sjme_attrInRange(0, INT32_MAX)
501 /** Non-zero positive value. */
502 #define sjme_attrInPositiveNonZero sjme_attrInRange(1, INT32_MAX)
504 /** Negative one to positive. */
505 #define sjme_attrInNegativeOnePositive sjme_attrInRange(-1, INT32_MAX)
507 /** Positive value. */
508 #define sjme_attrOutPositive sjme_attrOutRange(0, INT32_MAX)
510 /** Non-zero positive value. */
511 #define sjme_attrOutPositiveNonZero sjme_attrOutRange(1, INT32_MAX)
513 /** Negative one to positive. */
514 #define sjme_attrOutNegativeOnePositive sjme_attrOutRange(-1, INT32_MAX)
516 #if !defined(sjme_flexibleArrayCount)
517 /** Flexible array count, zero by default. */
518 #define sjme_flexibleArrayCount 0
519 #endif
521 #if !defined(sjme_flexibleArrayCountUnion)
522 /** Flexible array count but for unions. */
523 #define sjme_flexibleArrayCountUnion 0
524 #endif
526 #if !defined(sjme_attrUnused)
527 /** Unused value. */
528 #define sjme_attrUnused
529 #endif
531 #if !defined(sjme_attrUnusedEnum)
532 /** Unused enumeration element. */
533 #define sjme_attrUnusedEnum(x) x
534 #endif
536 #if !defined(sjme_attrArtificial)
537 /** Artificial function. */
538 #define sjme_attrArtificial
539 #endif
541 #if !defined(sjme_alloca)
542 /** Allocate on the stack. */
543 #define sjme_alloca(size) alloca((size))
544 #endif
546 #if !defined(sjme_inline)
547 /** Inline function. */
548 #define sjme_inline inline
549 #endif
551 #if !defined(sjme_noOptimize)
552 /** Disable optimization. */
553 #define sjme_noOptimize
554 #endif
556 #if defined(__GNUC__)
557 /** GNU C Compiler. */
558 #define SJME_CONFIG_HAS_GCC
559 #endif
561 #if defined(_MSC_VER)
562 /** Microsoft Visual C++ Compiler. */
563 #define SJME_CONFIG_HAS_MSVC
564 #endif
566 #if defined(SJME_CONFIG_HAS_WINDOWS)
567 /** Supports Windows Atomic Access. */
568 #define SJME_CONFIG_HAS_ATOMIC_WIN32
569 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \
570 !defined(__STDC_NO_ATOMICS__)
571 /** Supports C11 atomics. */
572 #define SJME_CONFIG_HAS_ATOMIC_C11
573 #elif defined(SJME_CONFIG_HAS_GCC)
574 /** GCC Atomics. */
575 #define SJME_CONFIG_HAS_ATOMIC_GCC
576 #endif
578 #if !defined(SJME_CONFIG_HAS_ATOMIC)
579 #if defined(SJME_CONFIG_HAS_ATOMIC_WIN32) || \
580 defined(SJME_CONFIG_HAS_ATOMIC_C11) || \
581 defined(SJME_CONFIG_HAS_ATOMIC_GCC)
582 /** Atomics are supported. */
583 #define SJME_CONFIG_HAS_ATOMIC
584 #else
585 /** Use old atomic handling. */
586 #define SJME_CONFIG_HAS_ATOMIC_OLD
588 /** Atomics are supported. */
589 #define SJME_CONFIG_HAS_ATOMIC
590 #endif
591 #endif
593 #if defined(SJME_CONFIG_HAS_LINUX) || \
594 defined(SJME_CONFIG_HAS_BSD) || \
595 defined(SJME_CONFIG_HAS_BEOS)
596 /** Dynamic library path name as static define. */
597 #define SJME_CONFIG_DYLIB_PATHNAME(x) \
598 "lib" x ".so"
599 #elif defined(SJME_CONFIG_HAS_CYGWIN)
600 /** Dynamic library path name as static define. */
601 #define SJME_CONFIG_DYLIB_PATHNAME(x) \
602 "lib" x ".dll"
603 #elif defined(SJME_CONFIG_HAS_WINDOWS)
604 /** Dynamic library path name as static define. */
605 #define SJME_CONFIG_DYLIB_PATHNAME(x) \
606 "" x ".dll"
607 #elif defined(SJME_CONFIG_HAS_MACOS)
608 /** Dynamic library path name as static define. */
609 #define SJME_CONFIG_DYLIB_PATHNAME(x) \
610 "lib" x ".dylib"
611 #else
612 /** Dynamic library path name as static define. */
613 #define SJME_CONFIG_DYLIB_PATHNAME(x) NULL
614 #endif
616 /* Nintendo 3DS: devkitPro has broken/unimplemented pthreads. */
617 #if defined(SJME_CONFIG_HAS_NINTENDO_3DS)
618 /** Use fallback threading regardless of the system. */
619 #define SJME_CONFIG_HAS_THREADS_FALLBACK
620 #endif
622 #if defined(SJME_CONFIG_HAS_MSVC)
623 /** Align to 32-bit. */
624 #define sjme_align32 __declspec(align(4))
625 #elif defined(SJME_CONFIG_HAS_GCC)
626 /** Align to 32-bit. */
627 #define sjme_align32 __attribute__((aligned(4)))
628 #else
629 /** Align to 32-bit. */
630 #define sjme_align32
631 #endif
633 #if defined(SJME_CONFIG_HAS_WINDOWS_16)
634 #define SJME_CALL FAR PASCAL
635 #elif defined(SJME_CONFIG_HAS_WINDOWS)
636 #define SJME_CALL __stdcall
637 #else
638 /** SquirrelJME calling convention. */
639 #define SJME_CALL
640 #endif
642 #if defined(SJME_CONFIG_HAS_MSVC)
643 /** Align to 64-bit. */
644 #define sjme_align64 __declspec(align(8))
645 #elif defined(SJME_CONFIG_HAS_GCC)
646 /** Align to 64-bit. */
647 #define sjme_align64 __attribute__((aligned(8)))
648 #else
649 /** Align to 64-bit. */
650 #define sjme_align64
651 #endif
653 #if SJME_CONFIG_HAS_POINTER == 64
654 /** Align to pointer. */
655 #define sjme_alignPointer sjme_align64
656 #elif SJME_CONFIG_HAS_POINTER == 32
657 /** Align to pointer. */
658 #define sjme_alignPointer sjme_align32
659 #else
660 /** Align to pointer. */
661 #define sjme_alignPointer
662 #endif
664 #if defined(SJME_CONFIG_HAS_NINTENDO_3DS) || \
665 defined(SJME_CONFIG_HAS_NINTENDO_WIIU) || \
666 defined(SJME_CONFIG_HAS_NINTENDO_WII)
667 /* Disable errno support. */
668 #define SJME_CONFIG_MISSING_ERRNO
669 #endif
671 /* Missing standard C functions. */
672 #if defined(SJME_CONFIG_HAS_NO_SNPRINTF)
673 #include "sjme/stdgone.h"
674 #endif
676 /*--------------------------------------------------------------------------*/
678 /* Anti-C++. */
679 #ifdef __cplusplus
680 #ifdef SJME_CXX_SQUIRRELJME_CONFIG_H
682 #undef SJME_CXX_SQUIRRELJME_CONFIG_H
683 #undef SJME_CXX_IS_EXTERNED
684 #endif /* #ifdef SJME_CXX_SQUIRRELJME_CONFIG_H */
685 #endif /* #ifdef __cplusplus */
687 #endif /* SQUIRRELJME_CONFIG_H */