CringeDB/cdb_Sustem.h
2022-08-27 19:48:36 +02:00

39 lines
1.9 KiB
C

//TODO finland up
//#include <stddef.h>
// 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)
#define SUS_FILE_NEW (1UL << 1)
#define SUS_FILE_NOTHING 0UL
//Naming: firstly the package, then the topic, lastly the operation
//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