Half of day 38 complete.

This commit is contained in:
igor
2026-04-21 23:12:00 -07:00
parent 40c34f2b9d
commit 61ace3a058
4 changed files with 169 additions and 18 deletions
+99 -2
View File
@@ -1,7 +1,97 @@
#ifndef CORE_H_SENTRY
#define CORE_H_SENTRY
/* ---- Types ---------------------------------------------------------- */
/* ---- Environment Detection ------------------------------------------ */
/* Architecture */
#ifndef ARCHITECTURE_X64
#define ARCHITECTURE_X64 0
#endif
#ifndef ARCHITECTURE_X86
#define ARCHITECTURE_X86 0
#endif
#ifndef ARCHITECTURE_ARM64
#define ARCHITECTURE_ARM64 0
#endif
#ifndef ARCHITECTURE_ARM32
#define ARCHITECTURE_ARM32 0
#endif
#if defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || defined(__amd64)
#undef ARCHITECTURE_X64
#define ARCHITECTURE_X64 1
#elif defined(i386) || defined(__i386) || defined(__i386__)
#undef ARCHITECTURE_X86
#define ARCHITECTURE_X86 1
#elif defined(__aarch64__)
#undef ARCHITECTURE_ARM64
#define ARCHITECTURE_ARM64 1
#elif defined(__arm__)
#undef ARCHITECTURE_ARM32
#define ARCHITECTURE_ARM32 1
#else
#error Unknown not architecture . . .
#endif
/* OS */
#ifndef OS_WINDOWS
#define OS_WINDOWS 0
#endif
#ifndef OS_MACOS
#define OS_MACOS 0
#endif
#ifndef OS_LINUX
#define OS_LINUX 0
#endif
#if defined(_WIN32)
#undef OS_WINDOWS
#define OS_WINDOWS 1
#elif defined(__APPLE__) && defined(__MACH__)
#undef OS_MACOS
#define OS_MACOS 1
#elif defined(__linux__)
#undef OS_LINUX
#define OS_LINUX 1
#else
#error Unknown Operating System . . .
#endif
/* Compiler */
#ifndef COMPILER_MSVC
#define COMPILER_MSVC 0
#endif
#ifndef COMPILER_CLANG
#define COMPILER_CLANG 0
#endif
#ifndef COMPILER_GCC
#define COMPILER_GCC 0
#endif
#if _MSC_VER
#undef COMPILER_MSVC
#define COMPILER_MSVC 1
#elif __clang__
#undef COMPILER_CLANG
#define COMPILER_CLANG 1
#elif __GNUC__
#undef COMPILER_GCC
#define COMPILER_GCC 1
#else
#error Unknown compiler . . .
#endif
/* ---- Switches ------------------------------------------------------- */
#ifndef BUILD_DEBUG
#define BUILD_DEBUG 1
@@ -11,6 +101,8 @@
#define BUILD_INTERNAL 1
#endif
/* ---- Types ---------------------------------------------------------- */
#ifndef TRUE
#define TRUE 1
#endif
@@ -51,7 +143,7 @@ typedef double F64;
/* ---- Asserts -------------------------------------------------------- */
#define TRAP() __builtin_trap()
#define TRAP() __builtin_trap() // TODO: GCC and CLANG thing; not supported on MSVC.
#define ASSERT_ALWAYS(x) do { if(!(x)) { TRAP(); } } while(0)
#if BUILD_DEBUG
@@ -81,6 +173,11 @@ typedef double F64;
#define MAX_U16 (U16)0xffff
#define MAX_U8 (U8)0xff
#define MIN_U64 (U64)0x0
#define MIN_U32 (U32)0x0
#define MIN_U16 (U16)0x0
#define MIN_U8 (U8)0x0
#define MAX_S64 (S64)0x7fffffffffffffff
#define MAX_S32 (S32)0x7fffffff
#define MAX_S16 (S16)0x7fff