]> git.lyx.org Git - lyx.git/blob - src/boost.C
Change Assert to BOOST_ASSERT.
[lyx.git] / src / boost.C
1 /**
2  * \file boost.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "lyx_main.h"
14 #include "debug.h"
15
16 #include <boost/assert.hpp>
17
18 #include <exception>
19
20 using std::endl;
21
22 namespace boost {
23
24 void throw_exception(std::exception const & e)
25 {
26         lyxerr << "Exception caught:\n"
27             << e.what() << endl;
28         BOOST_ASSERT(false);
29 }
30
31
32 namespace {
33
34 void emergencyCleanup()
35 {
36         static bool didCleanup;
37         if (didCleanup)
38                 return;
39
40         didCleanup = true;
41
42         LyX::emergencyCleanup();
43 }
44
45 }
46
47
48 void assertion_failed(char const * expr, char const * function,
49                       char const * file, long line)
50 {
51         lyxerr << "Assertion triggered in " << function << " by \"" <<
52                 expr << " in file " << file << ":" << line << endl;
53         emergencyCleanup();
54         assert(false);
55 }
56
57
58 }