~ubuntu-branches/ubuntu/intrepid/glbsp/intrepid

« back to all changes in this revision

Viewing changes to nodeview/asserts.h

  • Committer: Bazaar Package Importer
  • Author(s): Darren Salt
  • Date: 2008-01-30 13:33:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080130133349-kgojg33vyiu8xbvp
Tags: 2.24-1
* New upstream release.
* Bumped the lib soname and the library package name due to one silly
  little binary incompatibility caused by changes in an exported struct.
  (Safe; nothing else currently in the archive has ever used libglbsp2.)
* Removed my patches since they're all applied upstream.
* Updated the list of documentation files.
* Build-time changes:
  - Switched from dh_movefiles to dh_install.
  - Updated my makefile to cope with upstream changes.
  - Corrected for debian-rules-ignores-make-clean-error.
  - Corrected for substvar-source-version-is-deprecated.
  - Link libglbsp, rather than glbsp, with libm and libz.
* Fixed shlibdeps. (Closes: #460387)
* Bumped standards version to 3.7.3 (no other changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------
 
2
//  ASSERTIONS
 
3
//------------------------------------------------------------------------
 
4
//
 
5
//  GL-Node Viewer (C) 2004-2007 Andrew Apted
 
6
//
 
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.
 
11
//
 
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.
 
16
//
 
17
//------------------------------------------------------------------------
 
18
 
 
19
#ifndef __NODEVIEW_ASSERT_H__
 
20
#define __NODEVIEW_ASSERT_H__
 
21
 
 
22
class assert_fail_c
 
23
{
 
24
public:
 
25
  assert_fail_c(const char *_msg);
 
26
  assert_fail_c(const assert_fail_c &other);
 
27
  ~assert_fail_c();
 
28
  
 
29
private:
 
30
  static const int MSG_MAX = 200;
 
31
 
 
32
  char message[MSG_MAX];
 
33
 
 
34
public:
 
35
  const char* GetMessage() const { return message; }
 
36
 
 
37
  assert_fail_c& operator=(const assert_fail_c &other);
 
38
};
 
39
 
 
40
// -------- the macros --------
 
41
 
 
42
#ifdef NDEBUG
 
43
#define SYS_ASSERT(cond)  ((void) 0)
 
44
 
 
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__))
 
48
 
 
49
#else
 
50
#define SYS_ASSERT(cond)  ((cond) ? (void)0 :  \
 
51
    AssertFail("Assertion (%s) failed\nIn file %s:%d\n", #cond , __FILE__, __LINE__))
 
52
 
 
53
#endif  // NDEBUG
 
54
 
 
55
#ifdef NDEBUG
 
56
#define SYS_ASSERT_MSG(cond, arglist)  ((void) 0)
 
57
#else
 
58
#define SYS_ASSERT_MSG(cond, arglist)  ((cond) ? (void)0 :  \
 
59
    AssertFail arglist )
 
60
#endif
 
61
 
 
62
#define SYS_NULL_CHECK(ptr)    SYS_ASSERT((ptr) != NULL)
 
63
#define SYS_ZERO_CHECK(value)  SYS_ASSERT((value) != 0)
 
64
 
 
65
// -------- the support code -------- 
 
66
 
 
67
void AssertFail(const char *msg, ...);
 
68
// throw an assertion exception with the given message.
 
69
 
 
70
#endif  /* __NODEVIEW_ASSERT_H__ */