#ifndef MIC_PLATFORM_H #define MIC_PLATFORM_H // Function pointers for the PlatformAPI. This allows the app to call platform // specific functions that perform IO, memory allocations, etc. typedef struct PlatformAPI { // Reads an entire file into a null terminated buffer. It doesn't perform // memory allocations and may crash if there is not enough memory or if it // is uninitialized. Returns the number of bytes read. size_t (*read_file)(const char *path, char *memory); // Custom memory allocation functions for the platform. void *(*malloc)(size_t size); void (*free)(void *ptr); void *(*calloc)(size_t nmemb, size_t size); void *(*realloc)(void *ptr, size_t size); // Sleep/wait for a given number of microseconds. void (*sleep)(size_t microseconds); // Logging functions. void (*log)(const char *format, ...); } PlatformAPI; #endif // MIC_PLATFORM_H