summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2018-01-06 21:38:34 -0500
committerProjectRevoTPP <projectrevotpp@hotmail.com>2018-01-06 21:38:34 -0500
commit419e6d885baa060506489a947718b8610173b450 (patch)
treed3625430361840695274f44cb9d098f1d2df5ae8
parent8cf6da7a3b77bdceb38bbc4d9c1460028e8d9180 (diff)
use firered isagbprint header.
-rwxr-xr-xinclude/assert.h43
-rw-r--r--include/gba/gba.h1
-rwxr-xr-xinclude/gba/isagbprint.h50
3 files changed, 51 insertions, 43 deletions
diff --git a/include/assert.h b/include/assert.h
deleted file mode 100755
index 0c1e5bf77..000000000
--- a/include/assert.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef GUARD_GBASDKASSERT_H
-#define GUARD_GBASDKASSERT_H
-
-// this header is based on the
-// GBA SDK IsAgbAssert.h.
-
-#ifdef NOAGBPRN
- #define AGBPrintInit()
- #define AGBPutc(pBuf)
- #define AGBPrint(pBuf)
- #define AGBPrintf(...)
- #define AGBPrintFlush1Block()
- #define AGBPrintFlush()
- #define AGBAssert(pFile, nLine, pExpression, nStopProgram)
-#else
- // without NOAGBPRN defined, this enables asserts for usage
- // on a standard GBA debugger unit or in emulators that
- // support it.
-
- void AGBPrintInit(void);
- void AGBPutc(const char pBuf);
- void AGBPrint(const char *pBuf);
- void AGBPrintf(const char *pBuf, ...);
- void AGBPrintFlush1Block(void);
- void AGBPrintFlush(void);
- void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopProgram);
-#endif
-
-// when using AGB_WARNING, be sure to flush after as AGBAssert does not flush the string to console
-// immediately after usage.
-#ifdef NOAGBPRN
- #define AGB_ASSERT(expression)
-#else
- #define AGB_ASSERT(expression) (expression) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #expression, 1);
-#endif
-
-#ifdef NOAGBPRN
- #define AGB_WARNING(expression)
-#else
- #define AGB_WARNING(expression) (expression) ? ((void *)0) : AGBAssert(__FILE__, __LINE__, #expression, 0);
-#endif
-
-#endif
diff --git a/include/gba/gba.h b/include/gba/gba.h
index 42ae3cdde..349344031 100644
--- a/include/gba/gba.h
+++ b/include/gba/gba.h
@@ -7,5 +7,6 @@
#include "gba/multiboot.h"
#include "gba/syscall.h"
#include "gba/macro.h"
+#include "gba/isagbprint.h"
#endif // GUARD_GBA_GBA_H
diff --git a/include/gba/isagbprint.h b/include/gba/isagbprint.h
new file mode 100755
index 000000000..c5eb456c3
--- /dev/null
+++ b/include/gba/isagbprint.h
@@ -0,0 +1,50 @@
+#ifndef GUARD_GBA_ISAGBPRINT_H
+#define GUARD_GBA_ISAGBPRINT_H
+
+#ifdef NDEBUG
+#define AGBPrintInit()
+#define AGBPutc(cChr)
+#define AGBPrint(pBuf)
+#define AGBPrintf(pBuf, ...)
+#define AGBPrintFlush1Block()
+#define AGBPrintFlush()
+#define AGBAssert(pFile, nLine, pExpression, nStopProgram)
+#else
+void AGBPrintInit(void);
+void AGBPutc(const char cChr);
+void AGBPrint(const char *pBuf);
+void AGBPrintf(const char *pBuf, ...);
+void AGBPrintFlush1Block(void);
+void AGBPrintFlush(void);
+void AGBAssert(const char *pFile, int nLine, const char *pExpression, int nStopProgram);
+#endif
+
+#undef AGB_ASSERT
+#ifdef NDEBUG
+#define AGB_ASSERT(exp)
+#else
+#define AGB_ASSERT(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, 1);
+#endif
+
+#undef AGB_WARNING
+#ifdef NDEBUG
+#define AGB_WARNING(exp)
+#else
+#define AGB_WARNING(exp) (exp) ? ((void*)0) : AGBAssert(__FILE__, __LINE__, #exp, 0);
+#endif
+
+// for matching purposes
+
+#ifdef NDEBUG
+#define AGB_ASSERT_EX(exp, file, line)
+#else
+#define AGB_ASSERT_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 1);
+#endif
+
+#ifdef NDEBUG
+#define AGB_WARNING_EX(exp, file, line)
+#else
+#define AGB_WARNING_EX(exp, file, line) (exp) ? ((void*)0) : AGBAssert(file, line, #exp, 0);
+#endif
+
+#endif // GUARD_GBA_ISAGBPRINT_H