summaryrefslogtreecommitdiff
path: root/include/egg/prim/eggAssert.h
blob: 18c1365d3be61352bb0c1ef0ebc0ce4d16d986db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef EGG_ASSERT_H
#define EGG_ASSERT_H

#include "common.h"
#include <cstdarg>

namespace EGG {
// All this is guess
// TODO: Fixup funtions
namespace Assert {

#if 1
#define EGG_ASSERT(EXP)
#define EGG_ASSERT_MSG(EXP, ...)
#define EGG_PRINT(...)
#else
#define EGG_ASSERT(EXP)                                                                                                \
    if (!(EXP))                                                                                                        \
    system_halt(__FILE__, __LINE__, #EXP)

#define EGG_ASSERT_MSG(EXP, ...)                                                                                       \
    if (!(EXP))                                                                                                        \
    system_halt(__FILE__, __LINE__, __VA_ARGS__)

#define EGG_PRINT(...) system_print(true, __FILE__, __VA_ARGS__)
#endif

typedef void (*AssertCallback)();
void wait(u32 time);
void system_vreport(const char *str, va_list list);
void system_report(const char *str, ...);
s32 getPeriodPos(const char *);
char *getMapSymbol();
bool isOutsideMEM1(u32 addr);
AssertCallback setAssertCallback(AssertCallback cb);
void system_halt(const char *file, u32 line, const char *msg, va_list list);
void assert(const char *file, u32 line, const char *msg, ...);

} // namespace Assert

} // namespace EGG

#endif