You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
592 B
C
32 lines
592 B
C
1 year ago
|
#pragma once
|
||
|
|
||
2 years ago
|
#include <stdio.h>
|
||
1 year ago
|
#include <stdbool.h>
|
||
2 years ago
|
|
||
2 years ago
|
#ifdef WEB
|
||
1 year ago
|
//#include <assert.h>
|
||
|
#include <signal.h>
|
||
2 years ago
|
#endif
|
||
|
|
||
1 year ago
|
static void assert_impl(bool cond, const char *expression)
|
||
2 years ago
|
{
|
||
|
if(!cond)
|
||
|
{
|
||
|
fprintf(stderr, "Assertion failed: %s\n", expression);
|
||
2 years ago
|
#ifdef WEB
|
||
1 year ago
|
raise(SIGTRAP);
|
||
|
//assert(false);
|
||
2 years ago
|
#elif defined(DESKTOP)
|
||
2 years ago
|
__debugbreak();
|
||
2 years ago
|
#else
|
||
|
#error "Don't know how to assert for current platform configuration"
|
||
|
#endif
|
||
2 years ago
|
}
|
||
|
}
|
||
|
#ifdef assert
|
||
|
#undef assert
|
||
|
#endif
|
||
|
|
||
|
#define assert(cond) assert_impl(cond, #cond)
|
||
1 year ago
|
|
||
|
#define Log(...) { printf("%s Log %d | ", __FILE__, __LINE__); printf(__VA_ARGS__); }
|