Cleanup headers

This commit is contained in:
2025-11-10 22:11:50 +11:00
parent 70e4a3fa1d
commit 0d55b5d459
44 changed files with 236 additions and 122 deletions
+4 -2
View File
@@ -1,7 +1,9 @@
#define DN_OS_CPP
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#endif
#if defined(DN_PLATFORM_POSIX)
#include <sys/sysinfo.h> // get_nprocs
+6 -2
View File
@@ -1,8 +1,10 @@
#if !defined(DN_OS_H)
#define DN_OS_H
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#endif
#include <new> // operator new
@@ -33,6 +35,8 @@
#include <emscripten/fetch.h> // emscripten_fetch (for DN_OSHttpResponse)
#endif
extern DN_CPUFeatureDecl g_dn_cpu_feature_decl[DN_CPUFeature_Count];
// NOTE: DN_OSDate /////////////////////////////////////////////////////////////////////////////////
struct DN_OSDateTimeStr8
{
+5 -2
View File
@@ -1,7 +1,10 @@
#define DN_OS_ALLOCATOR_CPP
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#include "../dn_inc.h"
#endif
static void *DN_ArenaBasicAllocFromOSHeap(DN_USize size)
{
+4
View File
@@ -1,6 +1,10 @@
#if !defined(DN_OS_ALLOCATOR_H)
#define DN_OS_ALLOCATOR_H
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#endif
DN_API DN_Arena DN_ArenaFromHeap(DN_U64 size, DN_ArenaFlags flags);
DN_API DN_Arena DN_ArenaFromVMem(DN_U64 reserve, DN_U64 commit, DN_ArenaFlags flags);
+2
View File
@@ -1,5 +1,7 @@
#define DN_OS_CONTAINERS_CPP
#include "dn_os_containers.h"
/*
////////////////////////////////////////////////////////////////////////////////////////////////////
//
+5 -1
View File
@@ -1,7 +1,11 @@
#if !defined(DN_OS_CONTAINERS_H)
#define DN_OS_CONTAINERS_H
// NOTE: DN_VArray /////////////////////////////////////////////////////////////////////////////////
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#endif
// NOTE: DN_VArray
// TODO(doyle): Add an API for shrinking the array by decomitting pages back to the OS.
template <typename T> struct DN_VArray
{
+6 -1
View File
@@ -1,9 +1,14 @@
#define DN_OS_POSIX_CPP
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#endif
#include <dirent.h> // readdir, opendir, closedir
#include <sys/statvfs.h>
// NOTE: DN_OSMem //////////////////////////////////////////////////////////////////////////////////
// NOTE: DN_OSMem
static DN_U32 DN_OS_MemConvertPageToOSFlags_(DN_U32 protect)
{
DN_Assert((protect & ~DN_MemPage_All) == 0);
+7 -1
View File
@@ -1,4 +1,9 @@
#pragma once
#if !defined(DN_OS_POSIX_H)
#define DN_OS_POSIX_H
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#endif
#include <pthread.h>
#include <semaphore.h>
@@ -76,3 +81,4 @@ struct DN_POSIXCore
DN_API void DN_Posix_Init(DN_POSIXCore *posix);
DN_API void DN_Posix_ThreadSetName(DN_Str8 name);
DN_API DN_POSIXProcSelfStatus DN_Posix_ProcSelfStatus();
#endif // !defined(DN_OS_POSIX_H)
+2 -2
View File
@@ -7,7 +7,7 @@ enum DN_OSPrintDest
DN_OSPrintDest_Err,
};
// NOTE: Print Macros //////////////////////////////////////////////////////////////////////////////
// NOTE: Print Macros
#define DN_OS_PrintOut(string) DN_OS_Print(DN_OSPrintDest_Out, string)
#define DN_OS_PrintOutF(fmt, ...) DN_OS_PrintF(DN_OSPrintDest_Out, fmt, ##__VA_ARGS__)
#define DN_OS_PrintOutFV(fmt, args) DN_OS_PrintFV(DN_OSPrintDest_Out, fmt, args)
@@ -40,7 +40,7 @@ enum DN_OSPrintDest
#define DN_OS_PrintErrLnFStyle(style, fmt, ...) DN_OS_PrintLnFStyle(DN_OSPrintDest_Err, style, fmt, ##__VA_ARGS__)
#define DN_OS_PrintErrLnFVStyle(style, fmt, args) DN_OS_PrintLnFVStyle(DN_OSPrintDest_Err, style, fmt, args);
// NOTE: Print /////////////////////////////////////////////////////////////////////////////////////
// NOTE: Print
DN_API void DN_OS_Print (DN_OSPrintDest dest, DN_Str8 string);
DN_API void DN_OS_PrintF (DN_OSPrintDest dest, DN_FMT_ATTRIB char const *fmt, ...);
DN_API void DN_OS_PrintFV (DN_OSPrintDest dest, DN_FMT_ATTRIB char const *fmt, va_list args);
+4 -2
View File
@@ -1,7 +1,9 @@
#define DN_OS_STRING_CPP
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#endif
// NOTE: DN_Str8
DN_API DN_Str8 DN_Str8FromFmtArenaFrame(DN_FMT_ATTRIB char const *fmt, ...)
+5 -3
View File
@@ -1,10 +1,12 @@
#if !defined(DN_OS_STRING_H)
#define DN_OS_STRING_H
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#endif
// NOTE: DN_Str8 ///////////////////////////////////////////////////////////////////////////////////
// NOTE: DN_Str8
DN_API DN_Str8 DN_Str8FromFmtVArenaFrame (DN_FMT_ATTRIB char const *fmt, va_list args);
DN_API DN_Str8 DN_Str8FromFmtArenaFrame (DN_FMT_ATTRIB char const *fmt, ...);
+4
View File
@@ -1,5 +1,9 @@
#define DN_OS_TLSCPP
#if defined(_CLANGD)
#include "dn_os_tls.h"
#endif
// NOTE: DN_OSTLS ////////////////////////////////////////////////////////////////////////////////////
DN_OSTLSTMem::DN_OSTLSTMem(DN_OSTLS *tls, DN_U8 arena_index, DN_OSTLSPushTMem push_tmem)
{
+5 -3
View File
@@ -1,10 +1,12 @@
#if !defined(DN_OS_TLS_H)
#define DN_OS_TLS_H
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "../dn_os_inc.h"
#endif
// NOTE: DN_OSErrSink /////////////////////////////////////////////////////////////////////////////
// NOTE: DN_OSErrSink
enum DN_OSErrSinkMode
{
DN_OSErrSinkMode_Nil, // Default behaviour to accumulate errors into the sink
+5
View File
@@ -1,6 +1,11 @@
#if !defined(DN_OS_WIN32_H)
#define DN_OS_WIN32_H
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#include "dn_os_windows.h"
#endif
struct DN_W32Error
{
unsigned long code;
+4
View File
@@ -1,6 +1,10 @@
#if !defined(DN_OS_WINDOWS_H)
#define DN_OS_WINDOWS_H
#if defined(_CLANGD)
#include "../dn_base_inc.h"
#endif
#if defined(DN_COMPILER_MSVC) || defined(DN_COMPILER_CLANG_CL)
#pragma comment(lib, "bcrypt")
#pragma comment(lib, "winhttp")