1
//------------------------------------------------------------------------
3
//------------------------------------------------------------------------
5
// GL-Node Viewer (C) 2004-2007 Andrew Apted
7
// This program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public License
9
// as published by the Free Software Foundation; either version 2
10
// of the License, or (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
//------------------------------------------------------------------------
19
#ifndef __NODEVIEW_ASSERT_H__
20
#define __NODEVIEW_ASSERT_H__
25
assert_fail_c(const char *_msg);
26
assert_fail_c(const assert_fail_c &other);
30
static const int MSG_MAX = 200;
32
char message[MSG_MAX];
35
const char* GetMessage() const { return message; }
37
assert_fail_c& operator=(const assert_fail_c &other);
40
// -------- the macros --------
43
#define SYS_ASSERT(cond) ((void) 0)
45
#elif 1 // FIXME: proper test for __func__
46
#define SYS_ASSERT(cond) ((cond) ? (void)0 : \
47
AssertFail("Assertion (%s) failed\nIn function %s (%s:%d)\n", #cond , __func__, __FILE__, __LINE__))
50
#define SYS_ASSERT(cond) ((cond) ? (void)0 : \
51
AssertFail("Assertion (%s) failed\nIn file %s:%d\n", #cond , __FILE__, __LINE__))
56
#define SYS_ASSERT_MSG(cond, arglist) ((void) 0)
58
#define SYS_ASSERT_MSG(cond, arglist) ((cond) ? (void)0 : \
62
#define SYS_NULL_CHECK(ptr) SYS_ASSERT((ptr) != NULL)
63
#define SYS_ZERO_CHECK(value) SYS_ASSERT((value) != 0)
65
// -------- the support code --------
67
void AssertFail(const char *msg, ...);
68
// throw an assertion exception with the given message.
70
#endif /* __NODEVIEW_ASSERT_H__ */