WinTer 0.1.1
Windows Terminal Emulator
Loading...
Searching...
No Matches
base_macros.h File Reference

Compile-time context detection, compiler abstractions, math utilities, and intrusive data structure macros. More...

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for base_macros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 Excludes rarely-used services from Windows headers to speed up compilation.
#define OS_WINDOWS   1
 Defined to 1 if compiling for a Windows operating system.
#define OS_NAME   "Windows"
 Human-readable string name of the operating system.
#define BUILD_DEBUG   1
 Defined to 1 if compiling in Debug mode.
#define BUILD_NAME   "Debug"
 Human-readable string name of the build configuration.
#define C_STANDARD   89
 Integer representing the detected C standard version.
#define C_STANDARD_NAME   "C89/Default"
 Human-readable string of the detected C standard.
#define INTERNAL   static
 Marks a function or variable as strictly internal to its translation unit (static).
#define EXTERNAL   extern
 Marks a function or variable as externally linked (extern).
#define API_EXPORT
 Exports a symbol from a shared library (.dll / .so).
#define API_LOCAL
 Hides a symbol from a shared library (.dll / .so).
#define C_LINKAGE_BEGIN
 Opens a C linkage block for C++ compilers (Empty in C).
#define C_LINKAGE_END
 Closes a C linkage block for C++ compilers (Empty in C).
#define STRINGIFY_DETAIL(x)
 Internal implementation of STRINGIFY. Do not use directly.
#define STRINGIFY(x)
 Safely converts a macro argument into a string literal.
#define GLUE_DETAIL(x, y)
 Internal implementation of GLUE. Do not use directly.
#define GLUE(x, y)
 Safely concatenates two tokens together into a single token.
#define INT_FROM_PTR(ptr)
 Safely casts a pointer to an integer of pointer size.
#define PTR_FROM_INT(type, val)
 Safely casts a pointer-sized integer back to a specific pointer type.
#define ARRAY_SIZE(arr)
 Calculates the number of elements in a statically allocated array.
#define MIN(a, b)
 Returns the minimum of two values (Standard C fallback).
#define MAX(a, b)
 Returns the maximum of two values (Standard C fallback).
#define CLAMP(val, min, max)
 Clamps a value between a minimum and a maximum (Standard C fallback).
#define SWAP(type, a, b)
 Generic variable swap.
#define ALIGN_UP_POW2(x, p)
 Aligns a value UP to the nearest power of 2.
#define ALIGN_DOWN_POW2(x, p)
 Aligns a value DOWN to the nearest power of 2.
#define IS_POW2_OR_ZERO(x)
 Checks if a given integer is a power of 2 (or zero).
#define MEM_ZERO(ptr, size)
 Wraps memset to explicitly write 0s to a block of memory.
#define MEM_ZERO_STRUCT(ptr)
 Zeroes out a struct securely using the pointer's inner type size.
#define MEM_ZERO_ARRAY(arr)
 Zeroes out a static array securely using the array's full size.
#define MEM_COPY(dst, src, size)
 Wraps memmove for standard memory copying.
#define MEM_COPY_STRUCT(dst, src)
 Safely copies data from one struct pointer to another.
#define MEM_COPY_ARRAY(dst, src)
 Safely copies data from one static array to another.
#define DLL_PUSH_BACK_NP(f, l, n, next, prev)
 Pushes a node to the back of a doubly linked list (Custom pointer names).
#define DLL_PUSH_BACK(f, l, n)
 Pushes a node to the back of a doubly linked list.
#define DLL_PUSH_FRONT(f, l, n)
 Pushes a node to the front of a doubly linked list.
#define DLL_REMOVE_NP(f, l, n, next, prev)
 Removes a node from a doubly linked list (Custom pointer names).
#define DLL_REMOVE(f, l, n)
 Removes a node from a doubly linked list.
#define SLL_QUEUE_PUSH_N(f, l, n, next)
 Pushes a node to a singly linked queue (Custom pointer name).
#define SLL_QUEUE_PUSH(f, l, n)
 Pushes a node to the back of a singly linked queue.
#define SLL_STACK_PUSH_N(f, n, next)
 Pushes a node to the top of a singly linked stack (Custom pointer name).
#define SLL_STACK_PUSH(f, n)
 Pushes a node to the top of a singly linked stack.
#define SLL_STACK_POP_N(f, next)
 Pops a node from the top of a singly linked stack (Custom pointer name).
#define SLL_STACK_POP(f)
 Pops a node from the top of a singly linked stack.
#define debug_break()
 Triggers a native breakpoint in GDB/LLDB.
#define ASSERT(expr)
 Standard runtime assertion. Triggers a debug break on failure.
#define ASSERT_NOT_NULL(ptr)
 Asserts that a given pointer is not NULL.

Functions

static void print_context_info (void)
 Prints OS, architecture, compiler, endianness, build, and C standard to stdout.

Detailed Description

Compile-time context detection, compiler abstractions, math utilities, and intrusive data structure macros.

This is the lowest-level header in the base layer. It detects the current OS, compiler, architecture, endianness, C standard, and build configuration at compile time via preprocessor macros, then exposes a set of zero-cost utility macros built on top of that context.

Include order: this header has no dependencies within ccDB and may be included first by any other header.

Definition in file base_macros.h.

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Excludes rarely-used services from Windows headers to speed up compilation.

Definition at line 23 of file base_macros.h.