From ff2cfc706efd88c2e30fdb4c27ddad3263227367 Mon Sep 17 00:00:00 2001 From: Clement Sibille Date: Wed, 5 Jun 2024 17:52:00 +0900 Subject: Have specific assertions for playdate platform --- src/lisiblestd/assert.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/lisiblestd/assert.h') 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 +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 -- cgit v1.2.3