]> git.lyx.org Git - lyx.git/blob - src/boost.C
* Painter.h:
[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 #include "support/lyxlib.h"
16
17 #include <boost/assert.hpp>
18
19 #include <exception>
20
21
22 namespace lyx {
23
24 using std::endl;
25
26 namespace boost {
27
28 #ifndef BOOST_NO_EXCEPTIONS
29 void throw_exception(std::exception const & e)
30 {
31         lyxerr << "Exception caught:\n"
32             << e.what() << endl;
33         BOOST_ASSERT(false);
34 }
35 #endif
36
37 namespace {
38
39 void emergencyCleanup()
40 {
41         static bool didCleanup;
42         if (didCleanup)
43                 return;
44
45         didCleanup = true;
46
47         LyX::cref().emergencyCleanup();
48 }
49
50 }
51
52
53 void assertion_failed(char const * expr, char const * function,
54                       char const * file, long line)
55 {
56         lyxerr << "Assertion triggered in " << function
57                << " by failing check \"" << expr << "\""
58                << " in file " << file << ":" << line << endl;
59         emergencyCleanup();
60         support::abort();
61 }
62
63
64 }
65
66
67 } // namespace lyx