diff --git a/src/ase/ase_core.h b/src/ase/ase_core.h index d24785a7..86149564 100644 --- a/src/ase/ase_core.h +++ b/src/ase/ase_core.h @@ -88,7 +88,7 @@ Struct(ASE_Bitbuff) u64 cur_bit; }; -typedef i32 ASE_BlockType; enum +Enum(ASE_BlockType) { ASE_BlockType_Uncompressed = 0, ASE_BlockType_CompressedFixed = 1, @@ -149,7 +149,7 @@ Packed(Struct(ASE_FrameHeader) //////////////////////////////// //~ Image decoder types -typedef i32 ASE_ChunkKind; enum +Enum(ASE_ChunkKind) { ASE_ChunkKind_OldPalette1 = 0x0004, ASE_ChunkKind_OldPalette2 = 0x0011, @@ -167,7 +167,7 @@ typedef i32 ASE_ChunkKind; enum ASE_ChunkKind_Tileset = 0x2023 }; -typedef i32 ASE_CelKind; enum +Enum(ASE_CelKind) { ASE_CelKind_RawImage = 0, ASE_CelKind_Linked = 1, diff --git a/src/asset_cache/asset_cache_core.h b/src/asset_cache/asset_cache_core.h index fd1e8b33..702c26bf 100644 --- a/src/asset_cache/asset_cache_core.h +++ b/src/asset_cache/asset_cache_core.h @@ -3,7 +3,7 @@ //////////////////////////////// //~ Asset types -typedef i32 AC_Status; enum +Enum(AC_Status) { ASSET_STATUS_NONE, ASSET_STATUS_UNINITIALIZED, diff --git a/src/base/base_core.h b/src/base/base_core.h index 1de78854..2d2fbf98 100644 --- a/src/base/base_core.h +++ b/src/base/base_core.h @@ -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 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 @@ -428,11 +396,41 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t); #endif //////////////////////////////// -//~ Struct helper macros +//~ Type helper macros +//- Struct #define Struct(name) typedef struct name name; struct 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 diff --git a/src/base/base_incbin.h b/src/base/base_incbin.h index b994452b..efe80bfa 100644 --- a/src/base/base_incbin.h +++ b/src/base/base_incbin.h @@ -12,7 +12,7 @@ Struct(IncbinRcSearchParams) String data; }; -typedef i32 IncbinStatus; enum +Enum(IncbinStatus) { IncbinStatus_Unsearched, IncbinStatus_Searching, diff --git a/src/base/base_job.h b/src/base/base_job.h index eb9b7e27..9160b707 100644 --- a/src/base/base_job.h +++ b/src/base/base_job.h @@ -3,7 +3,7 @@ /* Work pools contain their own worker threads with their own thread priority * affinity based on the intended context of the pool. */ -typedef i32 JobPool; enum +Enum(JobPool) { JobPool_Inherit = -1, @@ -22,7 +22,7 @@ typedef i32 JobPool; enum }; /* Job execution order within a pool is based on priority. */ -typedef i32 JobPriority; enum +Enum(JobPriority) { JobPriority_Inherit = -1, JobPriority_High = 0, diff --git a/src/base/base_string.h b/src/base/base_string.h index 719e2270..6b58325b 100644 --- a/src/base/base_string.h +++ b/src/base/base_string.h @@ -27,7 +27,7 @@ Struct(StringList) #define DefaultFmtPrecision 3 #define IntChars ("0123456789abcdef") -typedef i32 FmtKind; enum +Enum(FmtKind) { FmtKind_None, diff --git a/src/base/base_win32/base_win32_job.h b/src/base/base_win32/base_win32_job.h index 8a99c438..0e8a5e89 100644 --- a/src/base/base_win32/base_win32_job.h +++ b/src/base/base_win32/base_win32_job.h @@ -67,7 +67,7 @@ StaticAssert(alignof(W32_WaitBin) == 64); /* Avoid false sharing */ #define W32_FiberNameMaxSize 64 //- Yield param -typedef i32 W32_YieldKind; enum +Enum(W32_YieldKind) { W32_YieldKind_None, W32_YieldKind_Done, diff --git a/src/bitbuff/bitbuff_core.h b/src/bitbuff/bitbuff_core.h index 7a28a37b..ec367b08 100644 --- a/src/bitbuff/bitbuff_core.h +++ b/src/bitbuff/bitbuff_core.h @@ -45,7 +45,7 @@ Struct(BB_Reader) #if BITBUFF_DEBUG /* Magic numbers inserted to verify read/write type & length */ -typedef u32 BB_DebugMagicKind; enum +Enum(BB_DebugMagicKind) { BB_DebugMagicKind_Align = 0x20A4, BB_DebugMagicKind_UBits = 0xCB4A, diff --git a/src/draw/draw_core.h b/src/draw/draw_core.h index 804b338d..016199dc 100644 --- a/src/draw/draw_core.h +++ b/src/draw/draw_core.h @@ -36,7 +36,7 @@ Struct(D_UiRectParams) //~ Text types /* How is text aligned within its area */ -typedef i32 D_TextAlignment; enum +Enum( D_TextAlignment) { DRAW_TEXT_ALIGNMENT_LEFT, /* Default */ DRAW_TEXT_ALIGNMENT_CENTER, @@ -46,14 +46,14 @@ typedef i32 D_TextAlignment; enum /* 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 * the specified position. */ -typedef i32 D_TextOffsetX; enum +Enum(D_TextOffsetX) { DRAW_TEXT_OFFSET_X_LEFT, /* Default */ DRAW_TEXT_OFFSET_X_CENTER, DRAW_TEXT_OFFSET_X_RIGHT }; -typedef i32 D_TextOffsetY; enum +Enum(D_TextOffsetY) { DRAW_TEXT_OFFSET_Y_TOP, /* Default */ DRAW_TEXT_OFFSET_Y_CENTER, diff --git a/src/gpu/gpu_core.h b/src/gpu/gpu_core.h index 22ba53f6..aaf8616e 100644 --- a/src/gpu/gpu_core.h +++ b/src/gpu/gpu_core.h @@ -31,9 +31,9 @@ typedef i32 GPU_QueueKind; //~ Format types /* 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_Float = 2, GPU_Format_R32G32B32A32_Uint = 3, @@ -161,7 +161,7 @@ typedef i32 GPU_Format; enum //////////////////////////////// //~ Resource types -typedef i32 GPU_ResourceKind; enum +Enum(GPU_ResourceKind) { GPU_ResourceKind_Unknown, GPU_ResourceKind_Buffer, @@ -171,7 +171,7 @@ typedef i32 GPU_ResourceKind; enum GPU_ResourceKind_Sampler }; -typedef i32 GPU_ResourceFlag; enum +Enum(GPU_ResourceFlag) { GPU_ResourceFlag_None = 0, GPU_ResourceFlag_AllowSrv = (1 << 0), @@ -179,14 +179,14 @@ typedef i32 GPU_ResourceFlag; enum GPU_ResourceFlag_AllowRtv = (1 << 2) }; -typedef i32 GPU_HeapKind; enum +Enum(GPU_HeapKind) { GPU_HeapKind_Default, GPU_HeapKind_Upload, GPU_HeapKind_Download }; -typedef i32 GPU_ReleaseFlag; enum +Enum(GPU_ReleaseFlag) { GPU_ReleaseFlag_None = 0, GPU_ReleaseFlag_Reuse = (1 << 0) @@ -227,7 +227,7 @@ Struct(GPU_ShaderDesc) //////////////////////////////// //~ Rasterizer types -typedef i32 GPU_RasterizeMode; enum +Enum(GPU_RasterizeMode) { GPU_RasterizeMode_None, GPU_RasterizeMode_TriangleList diff --git a/src/json/json_core.h b/src/json/json_core.h index d8596384..c8f68fe8 100644 --- a/src/json/json_core.h +++ b/src/json/json_core.h @@ -1,7 +1,7 @@ //////////////////////////////// //~ Blob types -typedef i32 JSON_Type; enum +Enum(JSON_Type) { JSON_Type_Null, JSON_Type_Bool, @@ -70,7 +70,7 @@ Struct(JSON_Result) #define JSON_Case_Symbol \ case ',': case ':': case '[': case ']': case '{': case '}' -typedef i32 JSON_TokenKind; enum +Enum(JSON_TokenKind) { JSON_TokenKind_Unknown, @@ -106,7 +106,7 @@ Struct(JSON_TokenList) JSON_Token *token_last; }; -typedef i32 JSON_LexNumberState; enum +Enum(JSON_LexNumberState) { JSON_LexNumberState_Whole, JSON_LexNumberState_Fraction, diff --git a/src/meta/meta.c b/src/meta/meta.c index fdb7270e..28e6b519 100644 --- a/src/meta/meta.c +++ b/src/meta/meta.c @@ -39,6 +39,10 @@ # define TestsAreEnabled 0 #endif +#ifndef IncbinRawDir +# define IncbinRawDir +#endif + //////////////////////////////// //~ Includes @@ -111,7 +115,7 @@ Struct(L_TokenList) L_Token *last; }; -typedef i32 L_TokenizerMode; enum +Enum(L_TokenizerMode) { L_TokenizerMode_None, L_TokenizerMode_SingleLineComment, @@ -230,7 +234,7 @@ L_TokenList L_TokensFromString(Arena *arena, String s) //////////////////////////////// //~ Blob -typedef i32 L_ParseMode; enum +Enum(L_ParseMode) { L_ParseMode_None, L_ParseMode_LayerName, @@ -244,7 +248,7 @@ typedef i32 L_ParseMode; enum L_ParseMode_DefaultWindowsImpl, }; -typedef i32 L_BlobTopoColor; enum +Enum(L_BlobTopoColor) { L_BlobTopoColor_None, 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-parameter")); 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("\r")); output = Trim(output, Lit("\n")); - Echo(output); + if (result.code != 0) + { + Echo(output); + } } return ret != 0 ? ret : errors.count > 0; diff --git a/src/meta/meta_base/meta_base.h b/src/meta/meta_base/meta_base.h index 0a365fe6..2d2fbf98 100644 --- a/src/meta/meta_base/meta_base.h +++ b/src/meta/meta_base/meta_base.h @@ -1,45 +1,40 @@ -/* TODO: Remove this */ -#define RtcIsEnabled 1 -#define UnoptimizedIsEnabled 1 - //////////////////////////////// -//~ Compiler feature flags +//~ Compiler flag checks -/* Compile definition defaults */ #ifndef RtcIsEnabled -# define RtcIsEnabled 0 +# error Missing compile time definition for 'RtcIsEnabled' #endif #ifndef AsanIsEnabled -# define AsanIsEnabled 0 +# error Missing compile time definition for 'AsanIsEnabled' #endif #ifndef CrtlibIsEnabled -# define CrtlibIsEnabled 0 +# error Missing compile time definition for 'CrtlibIsEnabled' #endif #ifndef DebinfoEnabled -# define DebinfoEnabled 0 +# error Missing compile time definition for 'DebinfoEnabled' #endif #ifndef DeveloperIsEnabled -# define DeveloperIsEnabled 0 +# error Missing compile time definition for 'DeveloperIsEnabled' #endif #ifndef ProfilingIsEnabled -# define ProfilingIsEnabled 0 +# error Missing compile time definition for 'ProfilingIsEnabled' #endif #ifndef UnoptimizedIsEnabled -# define UnoptimizedIsEnabled 0 +# error Missing compile time definition for 'UnoptimizedIsEnabled' #endif #ifndef TestsAreEnabled -# define TestsAreEnabled 0 +# error Missing compile time definition for 'TestsAreEnabled' #endif #ifndef IncbinRawDir -# define IncbinDir "" +# error Missing compile time definition for 'IncbinRawDir' #else # define IncbinDir Stringize(IncbinRawDir) #endif @@ -67,7 +62,7 @@ # define LanguageIsGpu 0 #endif -//- Operating system +//- Platform system #if defined(_WIN32) # define PlatformIsWindows 1 # define PlatformIsMac 0 @@ -114,16 +109,12 @@ //~ Debug //- Static assert -#if CompilerIsMsvc || (LanguageIsC && __STDC_VERSION__ < 202311L) || LanguageIsGpu -# if CompilerIsMsvc -# define StaticAssert2(cond, line) struct STATIC_ASSERT_____##line {int foo[(cond) ? 1 : -1];} -# define StaticAssert1(cond, line) StaticAssert2(cond, line) -# define StaticAssert(cond) StaticAssert1(cond, __LINE__) -# else -# define StaticAssert(cond) _Static_assert(cond, "") -# endif +#if LanguageIsC +# define StaticAssert2(cond, line, counter) struct STATIC_ASSERT_____##line##counter {int foo[(cond) ? 1 : -1];} +# define StaticAssert1(cond, line, counter) StaticAssert2(cond, line, counter) +# define StaticAssert(cond) StaticAssert1(cond, __LINE__, __COUNTER__) #else -# define StaticAssert(c) static_assert(c, "") +# define StaticAssert(cond) static_assert(cond, "") #endif //- 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 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 @@ -437,11 +396,41 @@ void __asan_unpoison_memory_region(void const volatile *add, size_t); #endif //////////////////////////////// -//~ Struct helper macros +//~ Type helper macros +//- Struct #define Struct(name) typedef struct name name; struct 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 @@ -562,7 +551,6 @@ ForceInline i64 Atomic64FetchAdd(Atomic64 *x, i64 a) { return (i64)_InterlockedE //~ Ticket mutex #if LanguageIsC - Struct(TicketMutex) { Atomic64Padded ticket; @@ -628,7 +616,7 @@ Struct(String32) # if PlatformIsWindows ForceInline i16 FiberId(void) { - i16 *v = (void *)__readgsqword(32); + i16 *v = (void *)(u64)__readgsqword(32); return *v; } # else @@ -644,11 +632,22 @@ void StartupBase(void); b32 Panic(String msg); b32 IsRunningInDebugger(void); i16 ThreadId(void); +void TrueRand(String buffer); #define MaxThreads 1024 StaticAssert(MaxThreads < I16Max); /* Thread id type should fit max threads */ +//////////////////////////////// +//~ @hookdecl Layer startup hook (defined by meta program) + +void StartupLayers(void); + //////////////////////////////// //~ Prof #include "../prof/prof_tracy.h" + +//////////////////////////////// +//~ Config + +#include "../config.h" diff --git a/src/meta/meta_base/meta_base_string.h b/src/meta/meta_base/meta_base_string.h index 71d413ed..15ee69df 100644 --- a/src/meta/meta_base/meta_base_string.h +++ b/src/meta/meta_base/meta_base_string.h @@ -27,7 +27,7 @@ Struct(StringList) #define DefaultFmtPrecision 3 #define IntChars ("0123456789abcdef") -typedef i32 FmtKind; enum +Enum(FmtKind) { FmtKind_None, diff --git a/src/meta/meta_file/meta_file.h b/src/meta/meta_file/meta_file.h index d533a7ed..8b25088e 100644 --- a/src/meta/meta_file/meta_file.h +++ b/src/meta/meta_file/meta_file.h @@ -1,7 +1,7 @@ //////////////////////////////// //~ File iter types -typedef i32 F_IterFlag; enum +Enum(F_IterFlag) { F_IterFlag_None = 0, F_IterFlag_Recurse = (1 << 0) diff --git a/src/meta/meta_os/meta_os.h b/src/meta/meta_os/meta_os.h index b08f6384..1d61566c 100644 --- a/src/meta/meta_os/meta_os.h +++ b/src/meta/meta_os/meta_os.h @@ -1,7 +1,7 @@ //////////////////////////////// //~ File types -typedef i32 OS_FileFlag; enum +Enum(OS_FileFlag) { OS_FileFlag_None = 0, OS_FileFlag_Read = (1 << 0), diff --git a/src/mixer/mixer_core.h b/src/mixer/mixer_core.h index 6952aa67..11a1dbd5 100644 --- a/src/mixer/mixer_core.h +++ b/src/mixer/mixer_core.h @@ -1,7 +1,7 @@ //////////////////////////////// //~ Track types -typedef u32 MIX_TrackFlag; enum +Enum(MIX_TrackFlag) { MIX_TrackFlag_None = 0, MIX_TrackFlag_Spatialize = (1 << 0) diff --git a/src/mp3/mp3_core.h b/src/mp3/mp3_core.h index 1a094d35..d33e2c11 100644 --- a/src/mp3/mp3_core.h +++ b/src/mp3/mp3_core.h @@ -1,7 +1,7 @@ //////////////////////////////// //~ Mp3 types -typedef u32 MP3_DecodeFlag; enum +Enum(MP3_DecodeFlag) { MP3_DecodeFlag_None = 0, MP3_DecodeFlag_Stereo = (1 << 0), diff --git a/src/net/net_core.h b/src/net/net_core.h index e89626bb..f107bd51 100644 --- a/src/net/net_core.h +++ b/src/net/net_core.h @@ -10,7 +10,7 @@ Struct(N_ChannelId) //////////////////////////////// //~ Host command types -typedef i32 N_CmdKind; enum +Enum(N_CmdKind) { N_CmdKind_None, N_CmdKind_TryConnect, @@ -20,7 +20,7 @@ typedef i32 N_CmdKind; enum N_CmdKind_Write }; -typedef i32 N_WriteFlag; enum +Enum(N_WriteFlag) { N_WriteFlag_None = 0, N_WriteFlag_Reliable = (1 << 0) @@ -43,7 +43,7 @@ Struct(N_Cmd) //////////////////////////////// //~ Event types -typedef i32 N_EventKind; enum +Enum(N_EventKind) { N_EventKind_None, N_EventKind_ChannelOpened, @@ -79,7 +79,7 @@ Struct(N_ChannelLookupBin) #define N_MaxPacketChunkLen 1024 #define N_MaxPacketLen 1280 /* Give enough space for msg chunk + header */ -typedef i32 N_PacketKind; enum +Enum(N_PacketKind) { N_PacketKind_None, N_PacketKind_TryConnect, @@ -89,7 +89,7 @@ typedef i32 N_PacketKind; enum N_PacketKind_MsgChunk }; -typedef i32 N_PacketFlag; enum +Enum(N_PacketFlag) { N_PacketFlag_None = 0, N_PacketFlag_Reliable = (1 << 0) diff --git a/src/platform/platform_core.h b/src/platform/platform_core.h index 4360dd5a..a95974b0 100644 --- a/src/platform/platform_core.h +++ b/src/platform/platform_core.h @@ -46,7 +46,7 @@ Struct(P_FileMap) //////////////////////////////// //~ Watch info types -typedef i32 P_WatchInfoKind; enum +Enum(P_WatchInfoKind) { P_WatchInfoKind_Unknown, P_WatchInfoKind_Added, @@ -75,7 +75,7 @@ Struct(P_WatchInfoList) //~ Window event types //- Button -typedef i32 P_Btn; enum +Enum(P_Btn) { P_Btn_None, @@ -181,7 +181,7 @@ typedef i32 P_Btn; enum }; //- Window event -typedef i32 P_WindowEventKind; enum +Enum(P_WindowEventKind) { P_WindowEventKind_None, @@ -228,7 +228,7 @@ Struct(P_WindowEventArray) * 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. */ -typedef i32 P_WindowSettingsFlag; enum +Enum(P_WindowSettingsFlag) { P_WindowSettingsFlag_None = 0x00, P_WindowSettingsFlag_Fullscreen = 0x01, @@ -240,7 +240,7 @@ typedef i32 P_WindowSettingsFlag; enum P_WindowSettingsFlag_Minimized = 0x04 }; -typedef i32 P_WindowFlag; enum +Enum(P_WindowFlag) { P_WindowFlag_None = 0x00, P_WindowFlag_Showing = 0x02 @@ -265,7 +265,7 @@ Struct(P_WindowSettings) //////////////////////////////// //~ Address types -typedef i32 P_AddressFamily; enum +Enum(P_AddressFamily) { P_AddressFamily_Ipv4, P_AddressFamily_Ipv6 @@ -293,7 +293,7 @@ Struct(P_SockReadResult) //////////////////////////////// //~ Message box types -typedef i32 P_MessageBoxKind; enum +Enum(P_MessageBoxKind) { P_MessageBoxKind_Ok, P_MessageBoxKind_Warning, diff --git a/src/platform/platform_win32/platform_win32.h b/src/platform/platform_win32/platform_win32.h index 88c23016..054fdfb3 100644 --- a/src/platform/platform_win32/platform_win32.h +++ b/src/platform/platform_win32/platform_win32.h @@ -17,7 +17,7 @@ //////////////////////////////// //~ Window types -typedef i32 P_W32_CursorFlag; enum +Enum(P_W32_CursorFlag) { P_W32_CursorFlag_None = (0 << 0), P_W32_CursorFlag_Position = (1 << 0), diff --git a/src/pp/pp_core.h b/src/pp/pp_core.h index 7e413c94..f6e4cc5f 100644 --- a/src/pp/pp_core.h +++ b/src/pp/pp_core.h @@ -2,7 +2,7 @@ //~ Binds //- Bind kinds -typedef i32 BindKind; enum +Enum(BindKind) { BindKind_None, diff --git a/src/pp/pp_ent.h b/src/pp/pp_ent.h index 9846cf33..7ec5c2ed 100644 --- a/src/pp/pp_ent.h +++ b/src/pp/pp_ent.h @@ -1,7 +1,7 @@ //////////////////////////////// //~ Entity props -typedef i32 Prop; enum +Enum(Prop) { Prop_Active, Prop_Release, diff --git a/src/pp/pp_sim.h b/src/pp/pp_sim.h index 1972e81d..b87706aa 100644 --- a/src/pp/pp_sim.h +++ b/src/pp/pp_sim.h @@ -127,7 +127,7 @@ Inline b32 EqClientHandle(ClientHandle a, ClientHandle b) //////////////////////////////// //~ Control types -typedef i32 ControlFlag; enum +Enum(ControlFlag) { ControlFlag_Fire = 1 << 0, ControlFlag_AltFire = 1 << 1, @@ -154,7 +154,7 @@ Struct(ControlData) ControlFlag flags; }; -typedef i32 CmdKind; enum +Enum(CmdKind) { CmdKind_Invalid, @@ -165,7 +165,7 @@ typedef i32 CmdKind; enum //////////////////////////////// //~ Tile types -typedef i32 TileKind; enum +Enum(TileKind) { TileKind_None, TileKind_Wall, @@ -177,7 +177,7 @@ StaticAssert(TileKind_Count < 256); /* Tile kind must fit in 8 bits */ //////////////////////////////// //~ Snapshot types -typedef i32 SyncFlag; enum +Enum(SyncFlag) { SyncFlag_NoSyncPredictables = 1 << 0 }; diff --git a/src/sound/sound_core.h b/src/sound/sound_core.h index f1f22fb9..6091132c 100644 --- a/src/sound/sound_core.h +++ b/src/sound/sound_core.h @@ -3,7 +3,7 @@ #define SND_SampleRate 48000 -typedef u32 SND_SoundFlag; enum +Enum(SND_SoundFlag) { SND_SoundFlag_None = 0, SND_SoundFlag_Stereo = (1 << 0) diff --git a/src/sprite/sprite_core.h b/src/sprite/sprite_core.h index 04badcd1..a1023570 100644 --- a/src/sprite/sprite_core.h +++ b/src/sprite/sprite_core.h @@ -93,7 +93,7 @@ Struct(S_Sheet) //////////////////////////////// //~ Cache types -typedef i32 S_CacheEntryKind; enum +Enum(S_CacheEntryKind) { S_CacheEntryKind_Texture, S_CacheEntryKind_Sheet, @@ -101,7 +101,7 @@ typedef i32 S_CacheEntryKind; enum S_CacheEntryKind_Count }; -typedef i32 S_CacheEntryState; enum +Enum(S_CacheEntryState) { S_CacheEntryState_None, S_CacheEntryState_Queued, diff --git a/src/tar/tar_core.h b/src/tar/tar_core.h index c2edd414..7fdc959d 100644 --- a/src/tar/tar_core.h +++ b/src/tar/tar_core.h @@ -25,7 +25,7 @@ extern Readonly TAR_Entry TAR_nil_entry; //////////////////////////////// //~ Header types -typedef u8 TAR_FileKind; enum +Enum(TAR_FileKind) { TAR_FileKind_File = '0', TAR_FileKind_HardLink = '1',