diff options
| author | Clement Sibille <clements+github@lisible.xyz> | 2024-06-05 17:52:00 +0900 |
|---|---|---|
| committer | Clement Sibille <clements+github@lisible.xyz> | 2024-06-05 17:52:00 +0900 |
| commit | ff2cfc706efd88c2e30fdb4c27ddad3263227367 (patch) | |
| tree | 258df57b8763d4b1fe9cde1586f9f9542f58286b /src/lisiblestd/assert.h | |
| parent | 221770922f959a5d5ae54e196b98bb13ab250842 (diff) | |
Have specific assertions for playdate platform
Diffstat (limited to 'src/lisiblestd/assert.h')
| -rw-r--r-- | src/lisiblestd/assert.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lisiblestd/assert.h b/src/lisiblestd/assert.h index 9bd998b..15026f9 100644 --- a/src/lisiblestd/assert.h +++ b/src/lisiblestd/assert.h @@ -5,6 +5,23 @@ extern void exit(int); + + +#ifdef LSTD_PLATFORM_PLAYDATE +#include <pd_api.h> +extern PlaydateAPI* pd; +#define LSTD_ASSERT(expr) \ + do { \ + if (!(expr)) { \ + pd->system->error("Assertion failed:\n\t%s", #expr); \ + } \ + } while (0) + +#define LSTD_UNIMPLEMENTED() \ + do { \ + pd->system->error("Unimpemented code reached"); \ + } while (0) +#else #define LSTD_ASSERT(expr) \ do { \ if (!(expr)) { \ @@ -18,5 +35,6 @@ extern void exit(int); LOG_ERROR("Unimplemented code reached"); \ exit(1); \ } while (0) +#endif #endif // LSTD_ASSERT_H |
