]> git.gir.st - ttxd.git/blob - src/vtx2ascii-src/vtx_assert.h
update to dvb-t2 (new hardware, software)
[ttxd.git] / src / vtx2ascii-src / vtx_assert.h
1 /* $Id: vtx_assert.h,v 1.1 1996/10/01 21:25:20 mb Exp mb $
2 *
3 * Copyright (c) 1994-96 Martin Buck <martin-2.buck@student.uni-ulm.de>
4 * Read COPYING for more information
5 */
6
7 /* This header file provides an alternative to the standard assert: You can
8 * choose wheter or not your program should dump core when an assertion
9 * fails. If you don't define ASSERT_DUMP_CORE, your program will print the
10 * `failed assertion'-message and call exit(1) without a coredump.
11 *
12 * The reason for this is that you can lock up your X-server when assert
13 * calls abort() at the wrong time (probably during grabs). If you can't
14 * login on a serial line or over the network to kill the X-server, you will
15 * have to reboot your machine (I once experienced this with another
16 * application -- not even XFree's ZapServer-key did work)!
17 *
18 * There has been a report that in VideoteXt an assertion fails when a
19 * station broadcasts a multipage-extension-table. I wasn't able to
20 * reproduce this and I don't think that this was the reason for the abort,
21 * but I decided to use this alternative assert just to make sure VideoteXt
22 * doesn't do bad things[tm] to your machine :-)
23 *
24 * But if you get `failed assertion'-messages, *please* report them to me!
25 */
26
27 #include <stdio.h>
28
29 #undef assert
30 #undef __assert
31
32 #ifdef NDEBUG
33 #define assert(ignore) ((void) 0)
34 #else
35
36 #define assert(exp) ((void) ((exp) ? 0 : __assert (#exp, __FILE__, __LINE__)))
37
38 #ifdef ASSERT_DUMP_CORE
39 #define __assert(exp, file, lineno) \
40 (fprintf (stderr, "%s:%u: failed assertion `%s'\n", file, lineno, exp), abort (), 0)
41 #else
42 #define __assert(exp, file, lineno) \
43 (fprintf (stderr, "%s:%u: failed assertion `%s'\nTerminating\n", file, lineno, exp), \
44 exit (1), 0)
45 #endif
46 #endif
Imprint / Impressum