IF_PLATFORM_WINDOWS
This commit is contained in:
@@ -78,23 +78,6 @@ b32 vmem_decommit(void *p, usize size) { return true; }
|
||||
|
||||
#if PLATFORM_WASM
|
||||
f64 s8_deserial_f64(s8_t string);
|
||||
#else
|
||||
f64 s8_deserial_f64(s8_t string) { return strtod(string.str, NULL); }
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
void core_log_message(char *string) {
|
||||
if (IsDebuggerPresent()) {
|
||||
OutputDebugStringA(string);
|
||||
}
|
||||
printf("%s", string);
|
||||
fflush(stdout);
|
||||
}
|
||||
void core_panic(void) {
|
||||
if (core_desc.on_exit) core_desc.on_exit();
|
||||
ExitProcess(1);
|
||||
}
|
||||
#elif PLATFORM_WASM
|
||||
void write_to_console(char *string);
|
||||
void core_log_message(char *string) {
|
||||
write_to_console(string);
|
||||
@@ -104,16 +87,21 @@ void core_panic(void) {
|
||||
debug_break();
|
||||
}
|
||||
#else
|
||||
f64 s8_deserial_f64(s8_t string) { return strtod(string.str, NULL); }
|
||||
void core_log_message(char *string) {
|
||||
printf("%s");
|
||||
IF_PLATFORM_WINDOWS(if (IsDebuggerPresent()) OutputDebugStringA(string));
|
||||
printf("%s", string);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
void core_panic(void) {
|
||||
if (core_desc.on_exit) core_desc.on_exit();
|
||||
debug_break();
|
||||
IF_PLATFORM_WINDOWS(ExitProcess(1));
|
||||
IF_NOT_PLATFORM_WINDOWS(exit(1));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void core_on_exit(void) {
|
||||
debugf("program panicked! exiting...");
|
||||
}
|
||||
|
||||
@@ -67,3 +67,19 @@
|
||||
#ifndef PLATFORM_ADDRESS_SANITIZER
|
||||
#define PLATFORM_ADDRESS_SANITIZER 0
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
#define IF_PLATFORM_WINDOWS(x) x
|
||||
#define IF_NOT_PLATFORM_WINDOWS(x)
|
||||
#else
|
||||
#define IF_PLATFORM_WINDOWS(x)
|
||||
#define IF_NOT_PLATFORM_WINDOWS(x) x
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WASM
|
||||
#define IF_PLATFORM_WASM(x) x
|
||||
#define IF_NOT_PLATFORM_WASM(x)
|
||||
#else
|
||||
#define IF_PLATFORM_WASM(x)
|
||||
#define IF_NOT_PLATFORM_WASM(x) x
|
||||
#endif
|
||||
Reference in New Issue
Block a user