e
This commit is contained in:
parent
dab907dc14
commit
28d63d89dd
45
cdb_sustem.h
Normal file
45
cdb_sustem.h
Normal file
@ -0,0 +1,45 @@
|
||||
//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) | 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 <stddef.h>
|
||||
|
||||
//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);
|
Loading…
Reference in New Issue
Block a user