libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_typedefs.h
Go to the documentation of this file.
1/*! \file
2 * \brief Basic primtive typedefs and forward declarations
3 * \ingroup core
4 *
5 * \copyright 2023 Falco Girgis
6 */
7#ifndef GIMBAL_TYPEDEFS_H
8#define GIMBAL_TYPEDEFS_H
9
10#include <stdint.h>
11#include <stdlib.h>
12
13#define GBL_TRUE 1
14#define GBL_FALSE 0
15#define GBL_INDEX_INVALID SIZE_MAX
16#define GBL_NPOS ((size_t )-1)
17
18// ======== Primitive Types ==========
19
20typedef uint8_t GblBool; //!< Basic boolean type, standardized to sizeof(char)
21typedef char GblChar;
22typedef uint8_t GblUint8;
23typedef int8_t GblInt8;
24typedef uint16_t GblUint16;
25typedef int16_t GblInt16;
26typedef uint32_t GblUint32;
27typedef int32_t GblInt32;
28typedef uint64_t GblUint64;
29typedef int64_t GblInt64;
30typedef size_t size_t;
31typedef float GblFloat;
32typedef double GblDouble;
33typedef void* GblPointer;
34typedef void (*GblFunction)();
35typedef const char* GblString;
36typedef uint32_t GblEnum; //!< Standard-sized enum type, 32-bits across platforms
37typedef uint32_t GblFlags; //!< Standard-sized flags type, 32-bits across platforms
38
39// ========== Auxiliary Types ==========
40
41typedef uint32_t GblHash; //!< Type representing a calculated numeric hash across the codebase
42typedef uint16_t GblRefCount; //!< Type able to hold a reference counter across the codebase
43
44typedef void (*GblFnPtr)(); //!< Type used for holding an untyped function pointer
45
46//! Union for SAFELY holding untyped data or function pointers
47typedef union GblPtr {
48 void* pData; //!< Data pointer
49 GblFnPtr pFunc; //!< Function pointer
50} GblPtr;
51
52
53#endif // GIMBAL_TYPEDEFS_H
uint32_t GblHash
Type representing a calculated numeric hash across the codebase.
uint32_t GblEnum
Standard-sized enum type, 32-bits across platforms.
uint32_t GblFlags
Standard-sized flags type, 32-bits across platforms.
void(* GblFnPtr)()
Type used for holding an untyped function pointer.
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
uint16_t GblRefCount
Type able to hold a reference counter across the codebase.
Union for SAFELY holding untyped data or function pointers.
GblFnPtr pFunc
Function pointer.
void * pData
Data pointer.