Initial commit
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
/* - | Copyright | ------------------------------------------------------------
|
||||
Copyright (c) 2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_ASSERT_H
|
||||
#define CI2_ASSERT_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Force Inline */
|
||||
#if defined(_MSC_VER) || defined(__INTEL__LLVM_COMPILER)
|
||||
#define CI2_INLINE __forceinline
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
#define CI2_INLINE __attribute__((always_inline)) inline
|
||||
#else
|
||||
#define CI2_INLINE inline
|
||||
#endif
|
||||
|
||||
/* Use __has_builtin if available (Clang and newer GCC). */
|
||||
#if defined(__has_builtin)
|
||||
/* Check builtins in preferred order */
|
||||
#if __has_builtin(__builtin_debugtrap)
|
||||
#define CI2_DEBUG_TRAP() __builtin_debugtrap()
|
||||
#elif __has_builtin(__builtin_trap)
|
||||
#define CI2_DEBUG_TRAP() __builtin_trap()
|
||||
#elif __has_builtin(__builtin_break)
|
||||
#define CI2_DEBUG_TRAP() __builtin_break()
|
||||
#endif
|
||||
#elif defined(_MSC_VER) || defined(__INTEL__LLVM_COMPILER)
|
||||
#define CI2_DEBUG_TRAP() __debugbreak()
|
||||
#else
|
||||
#define CI2_DEBUG_TRAP() (*(volatile int*)0 = 0)
|
||||
#endif
|
||||
|
||||
/* Static Asserts */
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
||||
/* C11 */
|
||||
#define CI2_STATIC_ASSERT(expr) _Static_assert((expr), #expr)
|
||||
#else
|
||||
/* Abuse a typedef of a negative-size array */
|
||||
#define CI2_STATIC_ASSERT(expr) typedef char _static_assert_[(expr) ? 1 : -1]
|
||||
#endif
|
||||
|
||||
/* Current __func__ */
|
||||
#if defined(__FUNC__)
|
||||
#define CI2_FUNC __FUNCTION__
|
||||
#else
|
||||
#define CI2_FUNC __func__
|
||||
#endif
|
||||
|
||||
/* Assert Fail */
|
||||
static CI2_INLINE void
|
||||
ci2_assert_fail(const char* expr,
|
||||
const char* msg, /* may be NULL */
|
||||
const char* file,
|
||||
int line,
|
||||
const char* func)
|
||||
{
|
||||
if (msg)
|
||||
fprintf(stderr,
|
||||
"\n[ASSERT FAILED]\n"
|
||||
" Expression : %s\n"
|
||||
" Message : %s\n"
|
||||
" Location : %s:%d\n"
|
||||
" Function : %s\n\n",
|
||||
expr,
|
||||
msg,
|
||||
file,
|
||||
line,
|
||||
func);
|
||||
else
|
||||
fprintf(stderr,
|
||||
"\n[ASSERT FAILED]\n"
|
||||
" Expression : %s\n"
|
||||
" Location : %s:%d\n"
|
||||
" Function : %s\n\n",
|
||||
expr,
|
||||
file,
|
||||
line,
|
||||
func);
|
||||
|
||||
/* Flush so the message is visible before we halt */
|
||||
fflush(stderr);
|
||||
|
||||
CI2_DEBUG_TRAP();
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define CI2_ASSERT(expr) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
ci2_assert_fail(#expr, NULL, __FILE__, __LINE__, CI2_FUNC); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CI2_ASSERT_MSG(expr, msg) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
ci2_assert_fail(#expr, (msg), __FILE__, __LINE__, CI2_FUNC); \
|
||||
} \
|
||||
} while (0)
|
||||
#else /* NDEBUG — strip all runtime checks */
|
||||
|
||||
#define ASSERT(expr) ((void)(expr))
|
||||
#define ASSERT_MSG(expr, msg) ((void)(expr))
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#endif // ci2_assert.h
|
||||
@@ -0,0 +1,49 @@
|
||||
/* - | Copyright | ------------------------------------------------------------
|
||||
Copyright (c) 2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_BASE_H
|
||||
#define CI2_BASE_H
|
||||
|
||||
#include "ci2_assert.h"
|
||||
#include "ci2_compiler.h"
|
||||
#include "ci2_os.h"
|
||||
#include "ci2_thread.h"
|
||||
#include "ci2_win_env.h"
|
||||
|
||||
#include "ci2_macros.h"
|
||||
#include "ci2_syntax.h"
|
||||
|
||||
/* Here is where we abstract away the differnces between Operating Systems */
|
||||
#if defined CI2_UNIX
|
||||
#define CI2_INVALID_FD -1
|
||||
typedef int ci2_fd;
|
||||
typedef char ci2_sys_char;
|
||||
|
||||
#else // Windows:
|
||||
|
||||
#define CI2_INVALID_FD NULL
|
||||
typedef HANDLE ci2_fd;
|
||||
typedef wchar_t ci2_sys_char;
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ci2_base.h
|
||||
@@ -0,0 +1,38 @@
|
||||
/* - | Copyright | ------------------------------------------------------------
|
||||
Copyright (c) 2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_COMPILER_H
|
||||
#define CI2_COMPILER_H
|
||||
|
||||
#if defined(__INTEL_LLVM_COMPILER)
|
||||
#define CI2_INTEL_ICX
|
||||
#elif defined(__GNUC__) && !defined(__clang__)
|
||||
#define CI2_GCC
|
||||
#elif defined(__clang__)
|
||||
#define CI2_CLANG
|
||||
#elif define(_MSC_VER) && !defined(__clang__)
|
||||
#define CI2_MSVC
|
||||
#else
|
||||
#error "Compiler is unkown and unsupported."
|
||||
#endif
|
||||
|
||||
#endif // ci2_compiler.h
|
||||
@@ -0,0 +1,101 @@
|
||||
/* - | Copyright |
|
||||
-------------------------------------------------------------- Copyright (c)
|
||||
2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_MACROS_H
|
||||
#define CI2_MACROS_H
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
#define STR2(s) #s
|
||||
#define STR(s) STR2(s)
|
||||
|
||||
#define U8_MIN 0u
|
||||
#define U8_MAX 0xffu
|
||||
#define I8_MIN (-0x7f - 1)
|
||||
#define I8_MAX 0x7f
|
||||
|
||||
#define U16_MIN 0u
|
||||
#define U16_MAX 0xffffu
|
||||
#define I16_MIN (-0x7fff - 1)
|
||||
#define I16_MAX 0x7fff
|
||||
|
||||
#define U32_MIN 0u
|
||||
#define U32_MAX 0xffffffffu
|
||||
#define I32_MIN (-0x7fffffff - 1)
|
||||
#define I32_MAX 0x7fffffff
|
||||
|
||||
#define U64_MIN 0ull
|
||||
#define U64_MAX 0xffffffffffffffffull
|
||||
#define I64_MIN (-0x7fffffffffffffffll - 1)
|
||||
#define I64_MAX 0x7fffffffffffffffll
|
||||
|
||||
#define F32_MIN 1.17549435e-38f
|
||||
#define F32_MAX 3.40282347e+38f
|
||||
|
||||
#define F64_MIN 2.2250738585072014e-308
|
||||
#define F64_MAX 1.7976931348623157e+308
|
||||
|
||||
#define PI 3.14159265
|
||||
#define RAD2DEG(x) ((x) / PI * 180)
|
||||
#define DEG2RAD(x) ((x) * PI / 180)
|
||||
#define ALIGNB(x, align) (((x) + ((align) - 1)) & ~((align) - 1))
|
||||
#define ALIGN(x, align) ((((x) + ((align) - 1)) / (align)) * (align))
|
||||
#define FLOORB(x, align) ((x) & ~((align) - 1))
|
||||
#define FLOOR(x, align) (((x) / (align)) * (align))
|
||||
#define CEILB(x, align) ALIGNB(x, align)
|
||||
#define CEIL(x, align) ALIGN(x, align)
|
||||
#define CLIP(x, min, max) \
|
||||
(((x) < (min)) ? (min) : (((x) > (max)) ? (max) : (x)))
|
||||
#define UCLIP(x, max) (((x) > (max)) ? (max) : (x))
|
||||
#define LCLIP(x, min) (((x) < (min)) ? (min) : (x))
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#define ABS(x) (((x) < 0) ? -(x) : (x))
|
||||
#define DIFF(a, b) ABS((a) - (b))
|
||||
#define IS_NAN(x) ((x) != (x))
|
||||
#define IMPLIES(x, y) (!(x) || (y))
|
||||
#define COMPARE(x, y) (((x) > (y)) - ((x) < (y)))
|
||||
#define SIGN(x) COMPARE(x, 0)
|
||||
#define IS_ODD(num) ((num) & 1)
|
||||
#define IS_EVEN(num) (!IS_ODD((num)))
|
||||
#define IS_BETWEEN(n, L, H) ((unsigned char)((n) >= (L) && (n) <= (H)))
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
#define SET(d, n, v) \
|
||||
do { \
|
||||
size_t i_, n_; \
|
||||
for (n_ = (n), i_ = 0; n_ > 0; --n_, ++i_) \
|
||||
(d)[i_] = (v); \
|
||||
} while (0)
|
||||
#define ZERO(d, n) SET(d, n, 0)
|
||||
#define SWAP(a, b) \
|
||||
do { \
|
||||
a ^= b; \
|
||||
b ^= a; \
|
||||
a ^= b; \
|
||||
} while (0)
|
||||
#define SORT(a, b) \
|
||||
do { \
|
||||
if ((a) > (b)) \
|
||||
SWAP((a), (b)); \
|
||||
} while (0)
|
||||
#endif // ci2_macros.h
|
||||
@@ -0,0 +1,81 @@
|
||||
/* - | Copyright | ------------------------------------------------------------
|
||||
Copyright (c) 2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_OS_H
|
||||
#define CI2_OS_H
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
/* Entire windows platform */
|
||||
#define CI2_WIN_APIVER 0x0600 // Vista
|
||||
#define NOMINMAX // Don't define min/max macros
|
||||
#define _CRT_SECURE_NO_WARNINGS // No unsafe C warnings
|
||||
#define _CRT_RAND_S // TODO
|
||||
#define OEMRESOURCE // GUI must be before windows.h
|
||||
#include <windows.h> // haha
|
||||
#define CI2_WINDOWS
|
||||
|
||||
#ifdef _WIN64
|
||||
/* Windows (64-bit only) */
|
||||
#define CI2_WINDOWS_64
|
||||
#else
|
||||
/* Windows (32-bit only) */
|
||||
#define CI2_WINDOWS_32
|
||||
#endif
|
||||
|
||||
#elif __APPLE__
|
||||
#define CI2_UNIX
|
||||
#define CI2_APPLE
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
// iOS, tvOS, or watchOS Simulator
|
||||
#define CI2_IOS
|
||||
#elif TARGET_OS_MACCATALYST
|
||||
// Mac's Catalyst (ports iOS API into Mac, like UIKit).
|
||||
#define CI2_IOS
|
||||
#elif TARGET_OS_IPHONE
|
||||
// iOS, tvOS, or watchOS device
|
||||
#define CI2_IOS
|
||||
#elif TARGET_OS_MAC
|
||||
// Other kinds of Apple platforms
|
||||
#define CI2_OSX
|
||||
#else
|
||||
#error "Unknown Apple platform"
|
||||
#endif
|
||||
|
||||
#elif __ANDROID__
|
||||
#define CI2_UNIX
|
||||
#define CI2_ANDROID
|
||||
|
||||
#elif __linux__
|
||||
#define CI2_UNIX
|
||||
|
||||
#elif __unix__ // TODO BSD Variants
|
||||
#define CI2_UNIX
|
||||
|
||||
#elif defined(_POSIX_VERSION)
|
||||
#define CI2_POSIX
|
||||
|
||||
#else
|
||||
#error "Unknown and unsupported operating system."
|
||||
#endif
|
||||
|
||||
#endif // ci2_os.h
|
||||
@@ -0,0 +1,68 @@
|
||||
/* - | Copyright | ------------------------------------------------------------
|
||||
Copyright (c) 2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_SYNTAX_H
|
||||
#define CI2_SYNTAX_H
|
||||
|
||||
/* Floating Points */
|
||||
typedef float ci2_f32; // IEEE 754
|
||||
typedef double ci2_f64; // IEE 754
|
||||
|
||||
/* Characters */
|
||||
typedef signed char ci2_char; // [−127, +127]
|
||||
typedef unsigned char ci2_uchar; // [0, 255]
|
||||
typedef unsigned char ci2_byte; // [0, 255]
|
||||
typedef unsigned char* ci2_bytes; // Pointer
|
||||
|
||||
/* Integers */
|
||||
typedef signed short ci2_short; // [−32,767, 32,767]
|
||||
typedef unsigned short ci2_ushort; // [0, 65,535]
|
||||
typedef signed int ci2_int; // [−32,767, 32,767]
|
||||
typedef unsigned int ci2_uint; // [0, 65,535]
|
||||
typedef signed long int ci2_long; // [−2,147,483,647, 2,147,483,647]
|
||||
typedef unsigned long int ci2_ulong; // [0, 4,294,967,295]
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
// −9223372036854775807
|
||||
typedef unsigned long long int ci2_ull; // +9223372036854775807 range.
|
||||
typedef signed long long int ci2_ll; //[0, 18446744073709551615] range.
|
||||
|
||||
typedef int8_t i8;
|
||||
typedef int16_t i16;
|
||||
typedef int32_t i32;
|
||||
typedef int64_t i64;
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef uintptr_t uptr;
|
||||
typedef ptrdiff_t size;
|
||||
typedef size_t usize;
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ci2_syntax.h
|
||||
@@ -0,0 +1,37 @@
|
||||
/* - | Copyright | ------------------------------------------------------------
|
||||
Copyright (c) 2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_THREAD_H
|
||||
#define CI2_THREAD_H
|
||||
|
||||
#if !defined(ci2_thread_local)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
#define ci2_thread_local __declspec(thread)
|
||||
#elif defined(__GNUC__)
|
||||
#define ci2_thread_local __thread
|
||||
#else
|
||||
#define ci2_thread_local thread_local
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // ci2_thread.h
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/* - | Copyright | ------------------------------------------------------------
|
||||
Copyright (c) 2026 Randy Jordan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
* --------------------------------------------------------------------------*/
|
||||
#ifndef CI2_WIN_ENV_H
|
||||
#define CI2_WIN_ENV_H
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
|
||||
#if defined __MINGW32__ || defined __MINGW64__
|
||||
#define CI2_WIN_ENV
|
||||
#define CI2_MINGW
|
||||
#elif defined __CYGWIN__
|
||||
#define CI2_WIN_ENV
|
||||
#define CI2_CYGWIN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // ci2_win_env.h
|
||||
|
||||
Reference in New Issue
Block a user