From 28d63d89dd8775ddac57759526671a3b943dab5e Mon Sep 17 00:00:00 2001 From: The Arrayser <68914060+TheArrayser@users.noreply.github.com> Date: Tue, 30 Aug 2022 12:42:16 +0200 Subject: [PATCH] e --- cdb_sustem.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 cdb_sustem.h diff --git a/cdb_sustem.h b/cdb_sustem.h new file mode 100644 index 0000000..8b2a097 --- /dev/null +++ b/cdb_sustem.h @@ -0,0 +1,45 @@ +//TODO finland up + +//#include + +// TODO should propably be placed in a global header +#define sus_Bool char +#define sus_True 1 +#define sus_False 0 + +#define SUS_FILE_TEMP ((1UL << 0) | SUS_FILE_NEW) //A temporary file gets automatically deleted, once it is no longer needed; a temp file also has to be a new file +#define SUS_FILE_NEW (1UL << 1) +#define SUS_FILE_NOTHING 0UL + +//Naming: firstly the package, then the topic, lastly the operation + +#include + +//Operating System independent implementation +typedef struct sus_File_impl * sus_File; + +// File IO API +//sus_File sus_file_OpenInMem(char * fileName, unsigned long parameter); +sus_File sus_fileOpenInMem(char * fileName, unsigned long parameter); // Map a file into the memroy of the current process +//void * sus_fileOpenNewinMem(char * fileName); //prevent user errors +//void * sus_fileOpenTempFileinMem(char * fileName); + +void * sus_fileFileToMemroy(sus_File file); //retrieves the memroy Pointer of where the file was mapped in memroy + +sus_Bool sus_fileExists(char * fileName); //check if a file exists in the specified path with the specified name +void sus_fileClose(sus_File file); //Closes the file mapping and all the system specific stuff for that mapping +void sus_fileFlush(sus_File file); //Flushes the filemapping; synchronize the written data in the filemapping to the actual file on disk (without blocking for better performance) +void * sus_fileResize(sus_File file, signed long appendBytes); //if appendBytes is negative, the file shrinks. This prevents me from definining a new function for retreving the file Size +void sus_fileDelete(char * fileName); +void sus_fileRename(char * fileName, char * newFileName); + +// Memory API +void * sus_heapAlloc(size_t bytes); // returns NULL, if there is no memroy left or an error occured +void * sus_heapResize(void * memroy, size_t newBytes); // returns NULL, if there is no memroy left or an error occured +void sus_heapFree(void * memroy); // what should this function do, if an error occurse.. + +// Networking API -- coming soon, cuz idk + +//Threads +sus_Bool sus_threadNew(int (*proc)(void)); +void sus_threadSleep(unsigned long seconds); \ No newline at end of file