/* */
/* */
/* */
-/* (C) 1998 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 1998-2001 Ullrich von Bassewitz */
+/* Wacholderweg 14 */
+/* D-70597 Stuttgart */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
extern void (*CheckFailed) (const char* Msg, const char* Cond,
- int Code, const char* File, unsigned Line)
+ const char* File, unsigned Line)
attribute ((noreturn));
/* Function pointer that is called from check if the condition code is true. */
-void Check (const char* Msg, const char* Cond, int Code,
- const char* File, unsigned Line);
-/* This function is called from all check macros (see below). It checks,
- * wether the given Code is true (!= 0). If so, it calls the CheckFailed
- * vector with the given strings. If not, it simply returns.
- */
-
-
-
-#define FAIL(s) CheckFailed (MsgInternalError, s, 0, __FILE__, __LINE__)
+#define FAIL(s) CheckFailed (MsgInternalError, s, __FILE__, __LINE__)
/* Fail macro. Is used if something evil happens, calls checkfailed directly. */
-#define ABORT(s) CheckFailed (MsgProgramAborted, s, 0, __FILE__, __LINE__)
+#define ABORT(s) CheckFailed (MsgProgramAborted, s, __FILE__, __LINE__)
/* Use this one instead of FAIL if there is no internal program error but an
* error condition that is caused by the user or operating system (FAIL and
* ABORT are essentially the same but the message differs).
*/
-#define PRECONDITION(c) Check (MsgPrecondition, #c, !(c), __FILE__, __LINE__)
-
-#define CHECK(c) Check (MsgCheckFailed, #c, !(c), __FILE__, __LINE__)
+#define PRECONDITION(c) \
+ ((void) ((c)? 0 : (CheckFailed (MsgPrecondition, #c, __FILE__, __LINE__), 0)))
-#define ZCHECK(c) Check (MsgCheckFailed, #c, c, __FILE__, __LINE__)
+#define CHECK(c) \
+ ((void) ((c)? 0 : (CheckFailed (MsgCheckFailed, #c, __FILE__, __LINE__), 0)))