~ubuntu-branches/ubuntu/raring/binkd/raring

« back to all changes in this revision

Viewing changes to assert.h

  • Committer: Bazaar Package Importer
  • Author(s): Marco d'Itri
  • Date: 2002-03-24 22:52:25 UTC
  • Revision ID: james.westby@ubuntu.com-20020324225225-7ru6itlapn03nl35
Tags: upstream-0.9.5a
ImportĀ upstreamĀ versionĀ 0.9.5a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  assert.h -- ...
 
3
 *
 
4
 *  assert.h is a part of binkd project
 
5
 *
 
6
 *  Copyright (C) 1997  Dima Maloff, 5047/13
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; either version 2 of the License, or
 
11
 *  (at your option) any later version. See COPYING.
 
12
 */
 
13
 
 
14
/*
 
15
 * $Id: assert.h,v 2.0 2001/01/10 12:12:37 gul Exp $
 
16
 *
 
17
 * $Log: assert.h,v $
 
18
 * Revision 2.0  2001/01/10 12:12:37  gul
 
19
 * Binkd is under CVS again
 
20
 *
 
21
 * Revision 1.1  1997/03/28  06:56:22  mff
 
22
 * Initial revision
 
23
 *
 
24
 */
 
25
#ifndef _assert_h
 
26
#define _assert_h
 
27
 
 
28
#include "tools.h"
 
29
 
 
30
#if defined (NDEBUG)
 
31
  #define assert(exp) ((void)0)
 
32
#else
 
33
#if defined (EMX)
 
34
  #define assert(exp) if ((exp)==0) \
 
35
           { int hcore=open("c:\\binkd.core",O_BINARY|O_RDWR|O_CREAT,0600); \
 
36
             if (hcore!=-1) _core(hcore), close(hcore); \
 
37
             Log (0, "%s: %i: %s: assertion failed", __FILE__, __LINE__, #exp); \
 
38
             abort(); }
 
39
#else
 
40
  #define assert(exp) ((exp) ? (void)0 : \
 
41
          Log (0, "%s: %i: %s: assertion failed", __FILE__, __LINE__, #exp))
 
42
#endif
 
43
#endif
 
44
 
 
45
#endif
 
46