'Enum' macro

This commit is contained in:
jacob 2025-08-24 20:43:08 -05:00
parent 93e340853c
commit c306b2435d
27 changed files with 153 additions and 148 deletions

View File

@ -88,7 +88,7 @@ Struct(ASE_Bitbuff)
u64 cur_bit; u64 cur_bit;
}; };
typedef i32 ASE_BlockType; enum Enum(ASE_BlockType)
{ {
ASE_BlockType_Uncompressed = 0, ASE_BlockType_Uncompressed = 0,
ASE_BlockType_CompressedFixed = 1, ASE_BlockType_CompressedFixed = 1,
@ -149,7 +149,7 @@ Packed(Struct(ASE_FrameHeader)
//////////////////////////////// ////////////////////////////////
//~ Image decoder types //~ Image decoder types
typedef i32 ASE_ChunkKind; enum Enum(ASE_ChunkKind)
{ {
ASE_ChunkKind_OldPalette1 = 0x0004, ASE_ChunkKind_OldPalette1 = 0x0004,
ASE_ChunkKind_OldPalette2 = 0x0011, ASE_ChunkKind_OldPalette2 = 0x0011,
@ -167,7 +167,7 @@ typedef i32 ASE_ChunkKind; enum
ASE_ChunkKind_Tileset = 0x2023 ASE_ChunkKind_Tileset = 0x2023
}; };
typedef i32 ASE_CelKind; enum Enum(ASE_CelKind)
{ {
ASE_CelKind_RawImage = 0, ASE_CelKind_RawImage = 0,
ASE_CelKind_Linked = 1, ASE_CelKind_Linked = 1,

View File

@ -3,7 +3,7 @@
//////////////////////////////// ////////////////////////////////
//~ Asset types //~ Asset types
typedef i32 AC_Status; enum Enum(AC_Status)
{ {
ASSET_STATUS_NONE, ASSET_STATUS_NONE,
ASSET_STATUS_UNINITIALIZED, ASSET_STATUS_UNINITIALIZED,

View File

@ -317,38 +317,6 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t);
#define DllPushFront(f,l,n) DllPushFront_NPZ(0,f,l,n,next,prev) #define DllPushFront(f,l,n) DllPushFront_NPZ(0,f,l,n,next,prev)
#define DllRemove(f,l,n) DllRemove_NPZ(0,f,l,n,next,prev) #define DllRemove(f,l,n) DllRemove_NPZ(0,f,l,n,next,prev)
////////////////////////////////
//~ Type helper macros
//- alignof
#if LanguageIsC && (CompilerIsMsvc || __STDC_VERSION__ < 202311L)
# define alignof(type) __alignof(type)
#endif
//- sizeof_field
#define sizeof_field(type, field) sizeof(((type *)0)->field)
//- offsetof
#if 0
#if !CompilerIsMsvc
# if !defined _CRT_USE_BUILTIN_OFFSETOF
# define offsetof(type, field) ((u64)&(((type *)0)->field))
# else
# define offsetof(type, field) __builtin_offsetof(type, field)
# endif
#endif
#endif
////////////////////////////////
//~ Array helper macros
//- countof
#define countof(a) (sizeof(a) / sizeof((a)[0]))
//- IsArray
#define IsIndexable(a) (sizeof(a[0]) != 0)
#define IsArray(a) (IsIndexable(a) && (((void *)&a) == ((void *)a)))
//////////////////////////////// ////////////////////////////////
//~ Struct alignment / padding macros //~ Struct alignment / padding macros
@ -428,11 +396,41 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t);
#endif #endif
//////////////////////////////// ////////////////////////////////
//~ Struct helper macros //~ Type helper macros
//- Struct
#define Struct(name) typedef struct name name; struct name #define Struct(name) typedef struct name name; struct name
#define AlignedStruct(name, n) typedef struct name name; struct alignas(n) name #define AlignedStruct(name, n) typedef struct name name; struct alignas(n) name
//- Enum
#define Enum(name) typedef enum name name; enum name
//- alignof
#if LanguageIsC && (CompilerIsMsvc || __STDC_VERSION__ < 202311L)
# define alignof(type) __alignof(type)
#endif
//- sizeof_field
#define sizeof_field(type, field) sizeof(((type *)0)->field)
//- countof
#define countof(a) (sizeof(a) / sizeof((a)[0]))
//- IsArray
#define IsIndexable(a) (sizeof(a[0]) != 0)
#define IsArray(a) (IsIndexable(a) && (((void *)&a) == ((void *)a)))
//- offsetof
#if 0
#if !CompilerIsMsvc
# if !defined _CRT_USE_BUILTIN_OFFSETOF
# define offsetof(type, field) ((u64)&(((type *)0)->field))
# else
# define offsetof(type, field) __builtin_offsetof(type, field)
# endif
#endif
#endif
//////////////////////////////// ////////////////////////////////
//~ Scalar types //~ Scalar types

View File

@ -12,7 +12,7 @@ Struct(IncbinRcSearchParams)
String data; String data;
}; };
typedef i32 IncbinStatus; enum Enum(IncbinStatus)
{ {
IncbinStatus_Unsearched, IncbinStatus_Unsearched,
IncbinStatus_Searching, IncbinStatus_Searching,

View File

@ -3,7 +3,7 @@
/* Work pools contain their own worker threads with their own thread priority /* Work pools contain their own worker threads with their own thread priority
* affinity based on the intended context of the pool. */ * affinity based on the intended context of the pool. */
typedef i32 JobPool; enum Enum(JobPool)
{ {
JobPool_Inherit = -1, JobPool_Inherit = -1,
@ -22,7 +22,7 @@ typedef i32 JobPool; enum
}; };
/* Job execution order within a pool is based on priority. */ /* Job execution order within a pool is based on priority. */
typedef i32 JobPriority; enum Enum(JobPriority)
{ {
JobPriority_Inherit = -1, JobPriority_Inherit = -1,
JobPriority_High = 0, JobPriority_High = 0,

View File

@ -27,7 +27,7 @@ Struct(StringList)
#define DefaultFmtPrecision 3 #define DefaultFmtPrecision 3
#define IntChars ("0123456789abcdef") #define IntChars ("0123456789abcdef")
typedef i32 FmtKind; enum Enum(FmtKind)
{ {
FmtKind_None, FmtKind_None,

View File

@ -67,7 +67,7 @@ StaticAssert(alignof(W32_WaitBin) == 64); /* Avoid false sharing */
#define W32_FiberNameMaxSize 64 #define W32_FiberNameMaxSize 64
//- Yield param //- Yield param
typedef i32 W32_YieldKind; enum Enum(W32_YieldKind)
{ {
W32_YieldKind_None, W32_YieldKind_None,
W32_YieldKind_Done, W32_YieldKind_Done,

View File

@ -45,7 +45,7 @@ Struct(BB_Reader)
#if BITBUFF_DEBUG #if BITBUFF_DEBUG
/* Magic numbers inserted to verify read/write type & length */ /* Magic numbers inserted to verify read/write type & length */
typedef u32 BB_DebugMagicKind; enum Enum(BB_DebugMagicKind)
{ {
BB_DebugMagicKind_Align = 0x20A4, BB_DebugMagicKind_Align = 0x20A4,
BB_DebugMagicKind_UBits = 0xCB4A, BB_DebugMagicKind_UBits = 0xCB4A,

View File

@ -36,7 +36,7 @@ Struct(D_UiRectParams)
//~ Text types //~ Text types
/* How is text aligned within its area */ /* How is text aligned within its area */
typedef i32 D_TextAlignment; enum Enum( D_TextAlignment)
{ {
DRAW_TEXT_ALIGNMENT_LEFT, /* Default */ DRAW_TEXT_ALIGNMENT_LEFT, /* Default */
DRAW_TEXT_ALIGNMENT_CENTER, DRAW_TEXT_ALIGNMENT_CENTER,
@ -46,14 +46,14 @@ typedef i32 D_TextAlignment; enum
/* How does the specified text position relate to the text area. /* How does the specified text position relate to the text area.
* E.g. BOTTOM & RIGHT means the bottom-right of the text area will snap to * E.g. BOTTOM & RIGHT means the bottom-right of the text area will snap to
* the specified position. */ * the specified position. */
typedef i32 D_TextOffsetX; enum Enum(D_TextOffsetX)
{ {
DRAW_TEXT_OFFSET_X_LEFT, /* Default */ DRAW_TEXT_OFFSET_X_LEFT, /* Default */
DRAW_TEXT_OFFSET_X_CENTER, DRAW_TEXT_OFFSET_X_CENTER,
DRAW_TEXT_OFFSET_X_RIGHT DRAW_TEXT_OFFSET_X_RIGHT
}; };
typedef i32 D_TextOffsetY; enum Enum(D_TextOffsetY)
{ {
DRAW_TEXT_OFFSET_Y_TOP, /* Default */ DRAW_TEXT_OFFSET_Y_TOP, /* Default */
DRAW_TEXT_OFFSET_Y_CENTER, DRAW_TEXT_OFFSET_Y_CENTER,

View File

@ -31,9 +31,9 @@ typedef i32 GPU_QueueKind;
//~ Format types //~ Format types
/* NOTE: Matches DXGI_FORMAT */ /* NOTE: Matches DXGI_FORMAT */
typedef i32 GPU_Format; enum Enum(GPU_Format)
{ {
GPU_Format_Unknown = 0, GPU_Format_Unknown = 0,
GPU_Format_R32G32B32A32_Typeless = 1, GPU_Format_R32G32B32A32_Typeless = 1,
GPU_Format_R32G32B32A32_Float = 2, GPU_Format_R32G32B32A32_Float = 2,
GPU_Format_R32G32B32A32_Uint = 3, GPU_Format_R32G32B32A32_Uint = 3,
@ -161,7 +161,7 @@ typedef i32 GPU_Format; enum
//////////////////////////////// ////////////////////////////////
//~ Resource types //~ Resource types
typedef i32 GPU_ResourceKind; enum Enum(GPU_ResourceKind)
{ {
GPU_ResourceKind_Unknown, GPU_ResourceKind_Unknown,
GPU_ResourceKind_Buffer, GPU_ResourceKind_Buffer,
@ -171,7 +171,7 @@ typedef i32 GPU_ResourceKind; enum
GPU_ResourceKind_Sampler GPU_ResourceKind_Sampler
}; };
typedef i32 GPU_ResourceFlag; enum Enum(GPU_ResourceFlag)
{ {
GPU_ResourceFlag_None = 0, GPU_ResourceFlag_None = 0,
GPU_ResourceFlag_AllowSrv = (1 << 0), GPU_ResourceFlag_AllowSrv = (1 << 0),
@ -179,14 +179,14 @@ typedef i32 GPU_ResourceFlag; enum
GPU_ResourceFlag_AllowRtv = (1 << 2) GPU_ResourceFlag_AllowRtv = (1 << 2)
}; };
typedef i32 GPU_HeapKind; enum Enum(GPU_HeapKind)
{ {
GPU_HeapKind_Default, GPU_HeapKind_Default,
GPU_HeapKind_Upload, GPU_HeapKind_Upload,
GPU_HeapKind_Download GPU_HeapKind_Download
}; };
typedef i32 GPU_ReleaseFlag; enum Enum(GPU_ReleaseFlag)
{ {
GPU_ReleaseFlag_None = 0, GPU_ReleaseFlag_None = 0,
GPU_ReleaseFlag_Reuse = (1 << 0) GPU_ReleaseFlag_Reuse = (1 << 0)
@ -227,7 +227,7 @@ Struct(GPU_ShaderDesc)
//////////////////////////////// ////////////////////////////////
//~ Rasterizer types //~ Rasterizer types
typedef i32 GPU_RasterizeMode; enum Enum(GPU_RasterizeMode)
{ {
GPU_RasterizeMode_None, GPU_RasterizeMode_None,
GPU_RasterizeMode_TriangleList GPU_RasterizeMode_TriangleList

View File

@ -1,7 +1,7 @@
//////////////////////////////// ////////////////////////////////
//~ Blob types //~ Blob types
typedef i32 JSON_Type; enum Enum(JSON_Type)
{ {
JSON_Type_Null, JSON_Type_Null,
JSON_Type_Bool, JSON_Type_Bool,
@ -70,7 +70,7 @@ Struct(JSON_Result)
#define JSON_Case_Symbol \ #define JSON_Case_Symbol \
case ',': case ':': case '[': case ']': case '{': case '}' case ',': case ':': case '[': case ']': case '{': case '}'
typedef i32 JSON_TokenKind; enum Enum(JSON_TokenKind)
{ {
JSON_TokenKind_Unknown, JSON_TokenKind_Unknown,
@ -106,7 +106,7 @@ Struct(JSON_TokenList)
JSON_Token *token_last; JSON_Token *token_last;
}; };
typedef i32 JSON_LexNumberState; enum Enum(JSON_LexNumberState)
{ {
JSON_LexNumberState_Whole, JSON_LexNumberState_Whole,
JSON_LexNumberState_Fraction, JSON_LexNumberState_Fraction,

View File

@ -39,6 +39,10 @@
# define TestsAreEnabled 0 # define TestsAreEnabled 0
#endif #endif
#ifndef IncbinRawDir
# define IncbinRawDir
#endif
//////////////////////////////// ////////////////////////////////
//~ Includes //~ Includes
@ -111,7 +115,7 @@ Struct(L_TokenList)
L_Token *last; L_Token *last;
}; };
typedef i32 L_TokenizerMode; enum Enum(L_TokenizerMode)
{ {
L_TokenizerMode_None, L_TokenizerMode_None,
L_TokenizerMode_SingleLineComment, L_TokenizerMode_SingleLineComment,
@ -230,7 +234,7 @@ L_TokenList L_TokensFromString(Arena *arena, String s)
//////////////////////////////// ////////////////////////////////
//~ Blob //~ Blob
typedef i32 L_ParseMode; enum Enum(L_ParseMode)
{ {
L_ParseMode_None, L_ParseMode_None,
L_ParseMode_LayerName, L_ParseMode_LayerName,
@ -244,7 +248,7 @@ typedef i32 L_ParseMode; enum
L_ParseMode_DefaultWindowsImpl, L_ParseMode_DefaultWindowsImpl,
}; };
typedef i32 L_BlobTopoColor; enum Enum(L_BlobTopoColor)
{ {
L_BlobTopoColor_None, L_BlobTopoColor_None,
L_BlobTopoColor_Queued, L_BlobTopoColor_Queued,
@ -913,6 +917,7 @@ i32 main(i32 argc, u8 **argv)
PushStringToList(arena, &clang_compiler_flags, Lit("-Wunused-but-set-variable")); PushStringToList(arena, &clang_compiler_flags, Lit("-Wunused-but-set-variable"));
PushStringToList(arena, &clang_compiler_flags, Lit("-Wunused-parameter")); PushStringToList(arena, &clang_compiler_flags, Lit("-Wunused-parameter"));
PushStringToList(arena, &clang_compiler_flags, Lit("-Wno-initializer-overrides")); PushStringToList(arena, &clang_compiler_flags, Lit("-Wno-initializer-overrides"));
PushStringToList(arena, &clang_compiler_flags, Lit("-Wno-microsoft-enum-forward-reference"));
} }
} }
@ -949,7 +954,10 @@ i32 main(i32 argc, u8 **argv)
output = Trim(output, Lit("\n")); output = Trim(output, Lit("\n"));
output = Trim(output, Lit("\r")); output = Trim(output, Lit("\r"));
output = Trim(output, Lit("\n")); output = Trim(output, Lit("\n"));
Echo(output); if (result.code != 0)
{
Echo(output);
}
} }
return ret != 0 ? ret : errors.count > 0; return ret != 0 ? ret : errors.count > 0;

View File

@ -1,45 +1,40 @@
/* TODO: Remove this */
#define RtcIsEnabled 1
#define UnoptimizedIsEnabled 1
//////////////////////////////// ////////////////////////////////
//~ Compiler feature flags //~ Compiler flag checks
/* Compile definition defaults */
#ifndef RtcIsEnabled #ifndef RtcIsEnabled
# define RtcIsEnabled 0 # error Missing compile time definition for 'RtcIsEnabled'
#endif #endif
#ifndef AsanIsEnabled #ifndef AsanIsEnabled
# define AsanIsEnabled 0 # error Missing compile time definition for 'AsanIsEnabled'
#endif #endif
#ifndef CrtlibIsEnabled #ifndef CrtlibIsEnabled
# define CrtlibIsEnabled 0 # error Missing compile time definition for 'CrtlibIsEnabled'
#endif #endif
#ifndef DebinfoEnabled #ifndef DebinfoEnabled
# define DebinfoEnabled 0 # error Missing compile time definition for 'DebinfoEnabled'
#endif #endif
#ifndef DeveloperIsEnabled #ifndef DeveloperIsEnabled
# define DeveloperIsEnabled 0 # error Missing compile time definition for 'DeveloperIsEnabled'
#endif #endif
#ifndef ProfilingIsEnabled #ifndef ProfilingIsEnabled
# define ProfilingIsEnabled 0 # error Missing compile time definition for 'ProfilingIsEnabled'
#endif #endif
#ifndef UnoptimizedIsEnabled #ifndef UnoptimizedIsEnabled
# define UnoptimizedIsEnabled 0 # error Missing compile time definition for 'UnoptimizedIsEnabled'
#endif #endif
#ifndef TestsAreEnabled #ifndef TestsAreEnabled
# define TestsAreEnabled 0 # error Missing compile time definition for 'TestsAreEnabled'
#endif #endif
#ifndef IncbinRawDir #ifndef IncbinRawDir
# define IncbinDir "" # error Missing compile time definition for 'IncbinRawDir'
#else #else
# define IncbinDir Stringize(IncbinRawDir) # define IncbinDir Stringize(IncbinRawDir)
#endif #endif
@ -67,7 +62,7 @@
# define LanguageIsGpu 0 # define LanguageIsGpu 0
#endif #endif
//- Operating system //- Platform system
#if defined(_WIN32) #if defined(_WIN32)
# define PlatformIsWindows 1 # define PlatformIsWindows 1
# define PlatformIsMac 0 # define PlatformIsMac 0
@ -114,16 +109,12 @@
//~ Debug //~ Debug
//- Static assert //- Static assert
#if CompilerIsMsvc || (LanguageIsC && __STDC_VERSION__ < 202311L) || LanguageIsGpu #if LanguageIsC
# if CompilerIsMsvc # define StaticAssert2(cond, line, counter) struct STATIC_ASSERT_____##line##counter {int foo[(cond) ? 1 : -1];}
# define StaticAssert2(cond, line) struct STATIC_ASSERT_____##line {int foo[(cond) ? 1 : -1];} # define StaticAssert1(cond, line, counter) StaticAssert2(cond, line, counter)
# define StaticAssert1(cond, line) StaticAssert2(cond, line) # define StaticAssert(cond) StaticAssert1(cond, __LINE__, __COUNTER__)
# define StaticAssert(cond) StaticAssert1(cond, __LINE__)
# else
# define StaticAssert(cond) _Static_assert(cond, "")
# endif
#else #else
# define StaticAssert(c) static_assert(c, "") # define StaticAssert(cond) static_assert(cond, "")
#endif #endif
//- Debug assert //- Debug assert
@ -326,38 +317,6 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t);
#define DllPushFront(f,l,n) DllPushFront_NPZ(0,f,l,n,next,prev) #define DllPushFront(f,l,n) DllPushFront_NPZ(0,f,l,n,next,prev)
#define DllRemove(f,l,n) DllRemove_NPZ(0,f,l,n,next,prev) #define DllRemove(f,l,n) DllRemove_NPZ(0,f,l,n,next,prev)
////////////////////////////////
//~ Type helper macros
//- alignof
#if LanguageIsC && (CompilerIsMsvc || __STDC_VERSION__ < 202311L)
# define alignof(type) __alignof(type)
#endif
//- sizeof_field
#define sizeof_field(type, field) sizeof(((type *)0)->field)
//- offsetof
#if 0
#if !CompilerIsMsvc
# if !defined _CRT_USE_BUILTIN_OFFSETOF
# define offsetof(type, field) ((u64)&(((type *)0)->field))
# else
# define offsetof(type, field) __builtin_offsetof(type, field)
# endif
#endif
#endif
////////////////////////////////
//~ Array helper macros
//- countof
#define countof(a) (sizeof(a) / sizeof((a)[0]))
//- IsArray
#define IsIndexable(a) (sizeof(a[0]) != 0)
#define IsArray(a) (IsIndexable(a) && (((void *)&a) == ((void *)a)))
//////////////////////////////// ////////////////////////////////
//~ Struct alignment / padding macros //~ Struct alignment / padding macros
@ -437,11 +396,41 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t);
#endif #endif
//////////////////////////////// ////////////////////////////////
//~ Struct helper macros //~ Type helper macros
//- Struct
#define Struct(name) typedef struct name name; struct name #define Struct(name) typedef struct name name; struct name
#define AlignedStruct(name, n) typedef struct name name; struct alignas(n) name #define AlignedStruct(name, n) typedef struct name name; struct alignas(n) name
//- Enum
#define Enum(name) typedef enum name name; enum name
//- alignof
#if LanguageIsC && (CompilerIsMsvc || __STDC_VERSION__ < 202311L)
# define alignof(type) __alignof(type)
#endif
//- sizeof_field
#define sizeof_field(type, field) sizeof(((type *)0)->field)
//- countof
#define countof(a) (sizeof(a) / sizeof((a)[0]))
//- IsArray
#define IsIndexable(a) (sizeof(a[0]) != 0)
#define IsArray(a) (IsIndexable(a) && (((void *)&a) == ((void *)a)))
//- offsetof
#if 0
#if !CompilerIsMsvc
# if !defined _CRT_USE_BUILTIN_OFFSETOF
# define offsetof(type, field) ((u64)&(((type *)0)->field))
# else
# define offsetof(type, field) __builtin_offsetof(type, field)
# endif
#endif
#endif
//////////////////////////////// ////////////////////////////////
//~ Scalar types //~ Scalar types
@ -562,7 +551,6 @@ ForceInline i64 Atomic64FetchAdd(Atomic64 *x, i64 a) { return (i64)_InterlockedE
//~ Ticket mutex //~ Ticket mutex
#if LanguageIsC #if LanguageIsC
Struct(TicketMutex) Struct(TicketMutex)
{ {
Atomic64Padded ticket; Atomic64Padded ticket;
@ -628,7 +616,7 @@ Struct(String32)
# if PlatformIsWindows # if PlatformIsWindows
ForceInline i16 FiberId(void) ForceInline i16 FiberId(void)
{ {
i16 *v = (void *)__readgsqword(32); i16 *v = (void *)(u64)__readgsqword(32);
return *v; return *v;
} }
# else # else
@ -644,11 +632,22 @@ void StartupBase(void);
b32 Panic(String msg); b32 Panic(String msg);
b32 IsRunningInDebugger(void); b32 IsRunningInDebugger(void);
i16 ThreadId(void); i16 ThreadId(void);
void TrueRand(String buffer);
#define MaxThreads 1024 #define MaxThreads 1024
StaticAssert(MaxThreads < I16Max); /* Thread id type should fit max threads */ StaticAssert(MaxThreads < I16Max); /* Thread id type should fit max threads */
////////////////////////////////
//~ @hookdecl Layer startup hook (defined by meta program)
void StartupLayers(void);
//////////////////////////////// ////////////////////////////////
//~ Prof //~ Prof
#include "../prof/prof_tracy.h" #include "../prof/prof_tracy.h"
////////////////////////////////
//~ Config
#include "../config.h"

View File

@ -27,7 +27,7 @@ Struct(StringList)
#define DefaultFmtPrecision 3 #define DefaultFmtPrecision 3
#define IntChars ("0123456789abcdef") #define IntChars ("0123456789abcdef")
typedef i32 FmtKind; enum Enum(FmtKind)
{ {
FmtKind_None, FmtKind_None,

View File

@ -1,7 +1,7 @@
//////////////////////////////// ////////////////////////////////
//~ File iter types //~ File iter types
typedef i32 F_IterFlag; enum Enum(F_IterFlag)
{ {
F_IterFlag_None = 0, F_IterFlag_None = 0,
F_IterFlag_Recurse = (1 << 0) F_IterFlag_Recurse = (1 << 0)

View File

@ -1,7 +1,7 @@
//////////////////////////////// ////////////////////////////////
//~ File types //~ File types
typedef i32 OS_FileFlag; enum Enum(OS_FileFlag)
{ {
OS_FileFlag_None = 0, OS_FileFlag_None = 0,
OS_FileFlag_Read = (1 << 0), OS_FileFlag_Read = (1 << 0),

View File

@ -1,7 +1,7 @@
//////////////////////////////// ////////////////////////////////
//~ Track types //~ Track types
typedef u32 MIX_TrackFlag; enum Enum(MIX_TrackFlag)
{ {
MIX_TrackFlag_None = 0, MIX_TrackFlag_None = 0,
MIX_TrackFlag_Spatialize = (1 << 0) MIX_TrackFlag_Spatialize = (1 << 0)

View File

@ -1,7 +1,7 @@
//////////////////////////////// ////////////////////////////////
//~ Mp3 types //~ Mp3 types
typedef u32 MP3_DecodeFlag; enum Enum(MP3_DecodeFlag)
{ {
MP3_DecodeFlag_None = 0, MP3_DecodeFlag_None = 0,
MP3_DecodeFlag_Stereo = (1 << 0), MP3_DecodeFlag_Stereo = (1 << 0),

View File

@ -10,7 +10,7 @@ Struct(N_ChannelId)
//////////////////////////////// ////////////////////////////////
//~ Host command types //~ Host command types
typedef i32 N_CmdKind; enum Enum(N_CmdKind)
{ {
N_CmdKind_None, N_CmdKind_None,
N_CmdKind_TryConnect, N_CmdKind_TryConnect,
@ -20,7 +20,7 @@ typedef i32 N_CmdKind; enum
N_CmdKind_Write N_CmdKind_Write
}; };
typedef i32 N_WriteFlag; enum Enum(N_WriteFlag)
{ {
N_WriteFlag_None = 0, N_WriteFlag_None = 0,
N_WriteFlag_Reliable = (1 << 0) N_WriteFlag_Reliable = (1 << 0)
@ -43,7 +43,7 @@ Struct(N_Cmd)
//////////////////////////////// ////////////////////////////////
//~ Event types //~ Event types
typedef i32 N_EventKind; enum Enum(N_EventKind)
{ {
N_EventKind_None, N_EventKind_None,
N_EventKind_ChannelOpened, N_EventKind_ChannelOpened,
@ -79,7 +79,7 @@ Struct(N_ChannelLookupBin)
#define N_MaxPacketChunkLen 1024 #define N_MaxPacketChunkLen 1024
#define N_MaxPacketLen 1280 /* Give enough space for msg chunk + header */ #define N_MaxPacketLen 1280 /* Give enough space for msg chunk + header */
typedef i32 N_PacketKind; enum Enum(N_PacketKind)
{ {
N_PacketKind_None, N_PacketKind_None,
N_PacketKind_TryConnect, N_PacketKind_TryConnect,
@ -89,7 +89,7 @@ typedef i32 N_PacketKind; enum
N_PacketKind_MsgChunk N_PacketKind_MsgChunk
}; };
typedef i32 N_PacketFlag; enum Enum(N_PacketFlag)
{ {
N_PacketFlag_None = 0, N_PacketFlag_None = 0,
N_PacketFlag_Reliable = (1 << 0) N_PacketFlag_Reliable = (1 << 0)

View File

@ -46,7 +46,7 @@ Struct(P_FileMap)
//////////////////////////////// ////////////////////////////////
//~ Watch info types //~ Watch info types
typedef i32 P_WatchInfoKind; enum Enum(P_WatchInfoKind)
{ {
P_WatchInfoKind_Unknown, P_WatchInfoKind_Unknown,
P_WatchInfoKind_Added, P_WatchInfoKind_Added,
@ -75,7 +75,7 @@ Struct(P_WatchInfoList)
//~ Window event types //~ Window event types
//- Button //- Button
typedef i32 P_Btn; enum Enum(P_Btn)
{ {
P_Btn_None, P_Btn_None,
@ -181,7 +181,7 @@ typedef i32 P_Btn; enum
}; };
//- Window event //- Window event
typedef i32 P_WindowEventKind; enum Enum(P_WindowEventKind)
{ {
P_WindowEventKind_None, P_WindowEventKind_None,
@ -228,7 +228,7 @@ Struct(P_WindowEventArray)
* This restriction is in place because of how Win32 works, IE you cannot * This restriction is in place because of how Win32 works, IE you cannot
* create a Win32 window in one thread and process its messages on another. */ * create a Win32 window in one thread and process its messages on another. */
typedef i32 P_WindowSettingsFlag; enum Enum(P_WindowSettingsFlag)
{ {
P_WindowSettingsFlag_None = 0x00, P_WindowSettingsFlag_None = 0x00,
P_WindowSettingsFlag_Fullscreen = 0x01, P_WindowSettingsFlag_Fullscreen = 0x01,
@ -240,7 +240,7 @@ typedef i32 P_WindowSettingsFlag; enum
P_WindowSettingsFlag_Minimized = 0x04 P_WindowSettingsFlag_Minimized = 0x04
}; };
typedef i32 P_WindowFlag; enum Enum(P_WindowFlag)
{ {
P_WindowFlag_None = 0x00, P_WindowFlag_None = 0x00,
P_WindowFlag_Showing = 0x02 P_WindowFlag_Showing = 0x02
@ -265,7 +265,7 @@ Struct(P_WindowSettings)
//////////////////////////////// ////////////////////////////////
//~ Address types //~ Address types
typedef i32 P_AddressFamily; enum Enum(P_AddressFamily)
{ {
P_AddressFamily_Ipv4, P_AddressFamily_Ipv4,
P_AddressFamily_Ipv6 P_AddressFamily_Ipv6
@ -293,7 +293,7 @@ Struct(P_SockReadResult)
//////////////////////////////// ////////////////////////////////
//~ Message box types //~ Message box types
typedef i32 P_MessageBoxKind; enum Enum(P_MessageBoxKind)
{ {
P_MessageBoxKind_Ok, P_MessageBoxKind_Ok,
P_MessageBoxKind_Warning, P_MessageBoxKind_Warning,

View File

@ -17,7 +17,7 @@
//////////////////////////////// ////////////////////////////////
//~ Window types //~ Window types
typedef i32 P_W32_CursorFlag; enum Enum(P_W32_CursorFlag)
{ {
P_W32_CursorFlag_None = (0 << 0), P_W32_CursorFlag_None = (0 << 0),
P_W32_CursorFlag_Position = (1 << 0), P_W32_CursorFlag_Position = (1 << 0),

View File

@ -2,7 +2,7 @@
//~ Binds //~ Binds
//- Bind kinds //- Bind kinds
typedef i32 BindKind; enum Enum(BindKind)
{ {
BindKind_None, BindKind_None,

View File

@ -1,7 +1,7 @@
//////////////////////////////// ////////////////////////////////
//~ Entity props //~ Entity props
typedef i32 Prop; enum Enum(Prop)
{ {
Prop_Active, Prop_Active,
Prop_Release, Prop_Release,

View File

@ -127,7 +127,7 @@ Inline b32 EqClientHandle(ClientHandle a, ClientHandle b)
//////////////////////////////// ////////////////////////////////
//~ Control types //~ Control types
typedef i32 ControlFlag; enum Enum(ControlFlag)
{ {
ControlFlag_Fire = 1 << 0, ControlFlag_Fire = 1 << 0,
ControlFlag_AltFire = 1 << 1, ControlFlag_AltFire = 1 << 1,
@ -154,7 +154,7 @@ Struct(ControlData)
ControlFlag flags; ControlFlag flags;
}; };
typedef i32 CmdKind; enum Enum(CmdKind)
{ {
CmdKind_Invalid, CmdKind_Invalid,
@ -165,7 +165,7 @@ typedef i32 CmdKind; enum
//////////////////////////////// ////////////////////////////////
//~ Tile types //~ Tile types
typedef i32 TileKind; enum Enum(TileKind)
{ {
TileKind_None, TileKind_None,
TileKind_Wall, TileKind_Wall,
@ -177,7 +177,7 @@ StaticAssert(TileKind_Count < 256); /* Tile kind must fit in 8 bits */
//////////////////////////////// ////////////////////////////////
//~ Snapshot types //~ Snapshot types
typedef i32 SyncFlag; enum Enum(SyncFlag)
{ {
SyncFlag_NoSyncPredictables = 1 << 0 SyncFlag_NoSyncPredictables = 1 << 0
}; };

View File

@ -3,7 +3,7 @@
#define SND_SampleRate 48000 #define SND_SampleRate 48000
typedef u32 SND_SoundFlag; enum Enum(SND_SoundFlag)
{ {
SND_SoundFlag_None = 0, SND_SoundFlag_None = 0,
SND_SoundFlag_Stereo = (1 << 0) SND_SoundFlag_Stereo = (1 << 0)

View File

@ -93,7 +93,7 @@ Struct(S_Sheet)
//////////////////////////////// ////////////////////////////////
//~ Cache types //~ Cache types
typedef i32 S_CacheEntryKind; enum Enum(S_CacheEntryKind)
{ {
S_CacheEntryKind_Texture, S_CacheEntryKind_Texture,
S_CacheEntryKind_Sheet, S_CacheEntryKind_Sheet,
@ -101,7 +101,7 @@ typedef i32 S_CacheEntryKind; enum
S_CacheEntryKind_Count S_CacheEntryKind_Count
}; };
typedef i32 S_CacheEntryState; enum Enum(S_CacheEntryState)
{ {
S_CacheEntryState_None, S_CacheEntryState_None,
S_CacheEntryState_Queued, S_CacheEntryState_Queued,

View File

@ -25,7 +25,7 @@ extern Readonly TAR_Entry TAR_nil_entry;
//////////////////////////////// ////////////////////////////////
//~ Header types //~ Header types
typedef u8 TAR_FileKind; enum Enum(TAR_FileKind)
{ {
TAR_FileKind_File = '0', TAR_FileKind_File = '0',
TAR_FileKind_HardLink = '1', TAR_FileKind_HardLink = '1',