Context switching for project, core defines and include pattern definition

This commit is contained in:
Tijani Lawal 2024-08-05 00:54:47 -05:00
parent c061916a98
commit e7f7f3e321
5 changed files with 167 additions and 2 deletions

View File

@ -44,8 +44,8 @@ if "%msvc%"=="1" set out=%cl_out%
if "%debug%"=="1" set compile=%compile_debug% if "%debug%"=="1" set compile=%compile_debug%
if "%release%"=="1" set compile=%compile_release% if "%release%"=="1" set compile=%compile_release%
rem :: --- Get Current SVN Revision ID --------------------------------------------- :: --- Get Current Git Commit Id ----------------------------------------------
rem for /f "tokens=2 delims==" %%i in ('svn info --show-item revision') do set compile=%compile% -DBUILD_SVN_REVISION=\"%%i\" for /f %%i in ('call git describe --always --dirty') do set compile=%compile% -DBUILD_GIT_HASH=\"%%i\"
:: --- Prep Directory -------------------------------------------------------- :: --- Prep Directory --------------------------------------------------------
if not exist run_tree ( if not exist run_tree (

View File

@ -0,0 +1,117 @@
#ifndef BASE_CONTEXT_SWITCHING_H
#define BASE_CONTEXT_SWITCHING_H
#if defined(_MSC_VER)
#define COMPILER_MSVC 1
#if defined(_WIN32)
#define OS_WINDOWS 1
#else
#error Compiler/OS combination is not supported.
#endif
#if defined(_M_AMD64)
#define ARCH_X64 1
#elif defined(_M_IX86)
#define ARCH_x86 1
#else
#error Architecture not supported.
#endif
#endif
// Architecture Context
#if defined(ARCH_X64)
#define ARCH_64BIT 1
#elif defined(ARCH_X86)
#define ARCH_32BIT 1
#endif
#if ARCH_X64 || ARCH_X86
#define ARCH_LITTLE_ENDIAN 1
#else
#error Endianess of this architecture is not supported.
#endif
// Language Context
#if defined(__cplusplus)
#define LANG_CPP 1
#else
#define LANG_C 1
#endif
//=================================
//~ tijani: Build Options
#if !defined(BUILD_DEBUG)
#define BUILD_DEBUG 1
#endif
#if !defined(BUILD_VERSION_MAJOR)
#define BUILD_VERSION_MAJOR 0
#endif
#if !defined(BUILD_VERSION_MINOR)
#define BUILD_VERSION_MINOR 0
#endif
#if !defined(BUILD_VERSION_PATCH)
#define BUILD_VERSION_PATCH 0
#endif
#define BUILD_VERSION_STRING_LITERAL \
Stringify(BUILD_VERSION_MAJOR) "." Stringify(BUILD_VERSION_MINOR) "." Stringify(BUILD_VERSION_PATCH)
#if BUILD_DEBUG
#define BUILD_MODE_STRING_LITERAL_APPEND " [Debug]"
#else
#define BUILD_MODE_STRING_LITERAL_APPEND ""
#endif
#if defined(BUILD_GIT_HASH)
#define BUILD_GIT_HASH_STRING_LITERAL_APPEND " [" BUILD_GIT_HASH "]"
#else
#define BUILD_GITH_HASH_STRING_LITERAL_APPEND ""
#endif
#if !defined(BUILD_TITLE)
#define BUILD_TITLE "Untitled"
#endif
#if !defined(BUILD_RELEASE_PHASE_STRING_LITERAL)
#define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
#endif
#if !defined(BUILD_ISSUES_LINK_STRING_LITERAL)
#define BUILD_ISSUES_LINK_STRING_LITERAL ""
#endif
#define BUILD_TITLE_STRING_LITERAL \
BUILD_TITLE \
" (" BUILD_VERSION_STRING_LITERAL " " BUILD_RELEASE_PHASE_STRING_LITERAL ") - " __DATE__ \
"" BUILD_GIT_HASH_STRING_LITERAL_APPEND BUILD_MODE_STRING_LITERAL_APPEND
//=============================
//~ tijani: Zero Undefined Options
#if !defined(COMPILER_MSVC)
#define COMPILER_MSVC 0
#endif
#if !defined(OS_WINDOWS)
#define OS_WINDOWS 0
#endif
#if !defined(ARCH_X64)
#define ARCH_X64 0
#endif
#if !defined(ARCH_X86)
#define ARCH_X86 0
#endif
#if !defined(ARCH_32BIT)
#define ARCH_32BIT 0
#endif
#if !defined(ARCH_64BIT)
#define ARCH_64BIT 0
#endif
#if !defined(LANG_CPP)
#define LANG_CPP 0
#endif
#if !defined(LANG_C)
#define LANG_C 0
#endif
#endif // BASE_CONTEXT_SWITCHING_H

29
src/base/base_core.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef BASE_CORE_H
#define BASE_CORE_H
#define global static
#define local static
#define internal static
// Base Types
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
typedef s8 b8;
typedef s16 b16;
typedef s32 b32;
typedef s64 b64;
typedef float f32;
typedef double f64;
#endif // BASE_CORE_H

5
src/base/base_inc.c Normal file
View File

@ -0,0 +1,5 @@
// clang-format off
#include "base_core.c"
#include "base_arena.c"
// clang-format on

14
src/base/base_inc.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef BASE_INC_H
#define BASE_INC_H
// clang-format off
#include "base_context_switching.h"
#include "base_core.h"
#include "base_arena.h"
// clang-format on
#endif // BASE_INC_H