#pragma once // ::Platform::Types::Header:: typedef struct Library Library; typedef struct Function Function; // ::Platform::Includes::Header:: #if __linux__ #include "platform/platform_linux.h" #endif #if _WIN32 #include "platform/platform_windows.h" #endif #if __APPLE__ || __MACH__ #error Not yet implemented #endif #if __unix__ && !__linux__ #error Not yet implemented #endif // ::Platform::Types::Header:: typedef struct WindowSize { u16 h, w; } WindowSize; // ::Platform::ConsoleOut::Functions::Header:: i32 WriteStdOut(void *buf, i32 len); i32 WriteStdErr(void *buf, i32 len); // ::Platform::Library::Functions::Header:: b32 LoadLib(const char *name, Library *out_lib); b32 LoadFn(const char *name, Library *lib, Function *out_fn); // ::Platform::Memory::Functions::Header:: rawptr MemAlloc(usize size); rawptr MemAllocZeroed(usize size); rawptr MemRealloc(rawptr ptr, usize old_size, usize new_size); void MemFree(rawptr ptr, usize size); usize GetPageSize(); // ::Platform::Window::Functions::Header:: b32 CreatePlatformWindow(const char *window_name); WindowSize GetWindowSize(); b32 ShouldQuit(); PlatformWindow *GetPlatformWindow(); // ::Platform::SystemInfo::Functions::Header:: u32 AvailableCPUCount(); // ::Platform::FileSystem::Functions::Header:: b32 ChangeDir(c8 *dir); c8 **GetFileNamesInDir(Arena *arena, u32 *count); b8 DirVisible(c8 *dir_name); // ::Platform::Profiling::Functions::Header:: static u64 GetOSTimerFreq(); static u64 ReadOSTimer(); static inline u64 ReadCPUTimer(); // ::Platform::Atomics::Header:: #define DefSigAtomicFetchIncr(T) static inline T AtomicFetchIncr##T(T *ptr) #define DefSigAtomicFetchSub(T) static inline T AtomicFetchSub##T(T *ptr, T count) #define DefSigAtomicIncr(T) static inline void AtomicIncr##T(T *ptr) #define DefSigAtomicStore(T) static inline void AtomicStore##T(T *ptr, T value) #define DefSigAtomicLoad(T) static inline T AtomicLoad##T(T *ptr) #define DefSigAtomicCompareExchange(T) static inline T AtomicCompareExchange##T(T *ptr, T *expected, T desired) DefScalarSig(AtomicFetchIncr); DefScalarSig(AtomicFetchSub); DefScalarSig(AtomicIncr); DefScalarSig(AtomicStore); DefScalarSig(AtomicLoad); DefScalarSig(AtomicCompareExchange); /* static inline u32 AtomicFetchIncrU32(u32 *ptr); static inline u32 AtomicFetchSubU32(u32 *ptr, u32 count); static inline void AtomicIncrU32(u32 *ptr); static inline u32 AtomicFetchU32(u32 *ptr); static inline void AtomicStoreB32(b32 *ptr, b32 value); static inline u32 AtomicLoadU32(u32 *ptr); static inline b32 AtomicCompareExchangeU32(u32 *ptr, u32 *expected, u32 desired); static inline b32 AtomicCompareExchangeB32(b32 *ptr, b32 *expected, b32 desired); */