File: assert.h

package info (click to toggle)
binkd 1.0.5~pre5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,956 kB
  • sloc: ansic: 22,016; makefile: 933; perl: 601; sh: 227
file content (46 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download | duplicates (2)
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
44
45
46
/*
 *  assert.h -- ...
 *
 *  assert.h is a part of binkd project
 *
 *  Copyright (C) 1997  Dima Maloff, 5047/13
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version. See COPYING.
 */

/*
 * $Id$
 *
 * $Log$
 * Revision 2.0  2001/01/10 12:12:37  gul
 * Binkd is under CVS again
 *
 * Revision 1.1  1997/03/28  06:56:22  mff
 * Initial revision
 *
 */
#ifndef _assert_h
#define _assert_h

#include "tools.h"

#if defined (NDEBUG)
  #define assert(exp) ((void)0)
#else
#if defined (EMX)
  #define assert(exp) if ((exp)==0) \
           { int hcore=open("c:\\binkd.core",O_BINARY|O_RDWR|O_CREAT,0600); \
             if (hcore!=-1) _core(hcore), close(hcore); \
             Log (0, "%s: %i: %s: assertion failed", __FILE__, __LINE__, #exp); \
             abort(); }
#else
  #define assert(exp) ((exp) ? (void)0 : \
          Log (0, "%s: %i: %s: assertion failed", __FILE__, __LINE__, #exp))
#endif
#endif

#endif