Add stubs, wanted to compile to wasm
This commit is contained in:
@@ -381,7 +381,7 @@ OS_API OS_Date OS_GetDate(void) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#elif __linux__ || __APPLE__ || __unix__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -690,9 +690,9 @@ OS_API OS_Result OS_WriteFile(S8_String path, S8_String string) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _WIN32 || __linux__ || __APPLE__ || __unix__
|
||||||
OS_API int OS_SystemF(const char *string, ...) {
|
OS_API int OS_SystemF(const char *string, ...) {
|
||||||
MA_Checkpoint scratch = MA_GetScratch();
|
MA_Checkpoint scratch = MA_GetScratch();
|
||||||
S8_FORMAT(scratch.arena, string, result);
|
S8_FORMAT(scratch.arena, string, result);
|
||||||
@@ -746,3 +746,4 @@ OS_API S8_String OS_ExpandIncludes(MA_Arena *arena, S8_String filepath) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
@@ -434,7 +434,7 @@ MA_API bool MV_DecommitPos(MV_Memory *m, size_t pos) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#elif __unix__ || __linux__ || __APPLE__
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#define MV__UNIX_PAGE_SIZE 4096
|
#define MV__UNIX_PAGE_SIZE 4096
|
||||||
MA_API MV_Memory MV_Reserve(size_t size) {
|
MA_API MV_Memory MV_Reserve(size_t size) {
|
||||||
@@ -465,4 +465,17 @@ MA_API void MV_Deallocate(MV_Memory *m) {
|
|||||||
int result = munmap(m->data, m->reserve);
|
int result = munmap(m->data, m->reserve);
|
||||||
MA_Assertf(result == 0, "Failed to release virtual memory using munmap");
|
MA_Assertf(result == 0, "Failed to release virtual memory using munmap");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MA_API MV_Memory MV_Reserve(size_t size) {
|
||||||
|
MV_Memory result = {0};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
MA_API bool MV_Commit(MV_Memory *m, size_t commit) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MA_API void MV_Deallocate(MV_Memory *m) {
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -203,9 +203,8 @@ IO_API IO_ErrorResult IO_OutputError(char *str, int len) {
|
|||||||
IO_API void IO_Exit(int error_code) {
|
IO_API void IO_Exit(int error_code) {
|
||||||
ExitProcess(error_code);
|
ExitProcess(error_code);
|
||||||
}
|
}
|
||||||
#else // _WIN32 else // LIBC
|
#elif __linux__ || __unix__ || __APPLE__
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
IO_API IO_ErrorResult IO_OutputError(char *str, int len) {
|
IO_API IO_ErrorResult IO_OutputError(char *str, int len) {
|
||||||
fprintf(stderr, "%.*s", len, str);
|
fprintf(stderr, "%.*s", len, str);
|
||||||
return IO_ErrorResult_Exit;
|
return IO_ErrorResult_Exit;
|
||||||
@@ -222,4 +221,19 @@ IO_API void IO_Exit(int error_code) {
|
|||||||
IO_API bool IO_IsDebuggerPresent(void) {
|
IO_API bool IO_IsDebuggerPresent(void) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
IO_API IO_ErrorResult IO_OutputError(char *str, int len) {
|
||||||
|
return IO_ErrorResult_Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
IO_API void IO_OutputMessage(char *str, int len) {
|
||||||
|
}
|
||||||
|
|
||||||
|
IO_API void IO_Exit(int error_code) {
|
||||||
|
}
|
||||||
|
|
||||||
|
IO_API bool IO_IsDebuggerPresent(void) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LIBC
|
#endif // LIBC
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
#define OS_POSIX 1
|
#define OS_POSIX 1
|
||||||
#define OS_LINUX 1
|
#define OS_LINUX 1
|
||||||
|
#elif OS_WASM
|
||||||
#else
|
#else
|
||||||
#error Unsupported platform
|
#error Unsupported platform
|
||||||
#endif
|
#endif
|
||||||
@@ -109,6 +110,8 @@
|
|||||||
#define OS_NAME "linux"
|
#define OS_NAME "linux"
|
||||||
#elif OS_MAC
|
#elif OS_MAC
|
||||||
#define OS_NAME "mac_os"
|
#define OS_NAME "mac_os"
|
||||||
|
#elif OS_WASM
|
||||||
|
#define OS_NAME "wasm"
|
||||||
#else
|
#else
|
||||||
#error couldnt figure out OS
|
#error couldnt figure out OS
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user