2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file boost.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-08-20 21:50:08 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2003-09-09 17:25:35 +00:00
|
|
|
|
#include "lyx_main.h"
|
2002-08-20 21:50:08 +00:00
|
|
|
|
#include "debug.h"
|
2003-09-10 13:39:38 +00:00
|
|
|
|
#include "support/lyxlib.h"
|
2002-08-20 21:50:08 +00:00
|
|
|
|
|
2003-09-09 17:25:35 +00:00
|
|
|
|
#include <boost/assert.hpp>
|
2002-08-20 21:50:08 +00:00
|
|
|
|
|
2003-09-09 17:25:35 +00:00
|
|
|
|
#include <exception>
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
2002-08-20 21:50:08 +00:00
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
|
|
|
|
|
|
void throw_exception(std::exception const & e)
|
|
|
|
|
{
|
|
|
|
|
lyxerr << "Exception caught:\n"
|
|
|
|
|
<< e.what() << endl;
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
void emergencyCleanup()
|
|
|
|
|
{
|
|
|
|
|
static bool didCleanup;
|
|
|
|
|
if (didCleanup)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
didCleanup = true;
|
|
|
|
|
|
2003-10-14 21:30:23 +00:00
|
|
|
|
LyX::cref().emergencyCleanup();
|
2003-09-09 17:25:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void assertion_failed(char const * expr, char const * function,
|
|
|
|
|
char const * file, long line)
|
|
|
|
|
{
|
2003-09-21 23:00:47 +00:00
|
|
|
|
lyxerr << "Assertion triggered in " << function
|
|
|
|
|
<< " by failing check \"" << expr << "\""
|
|
|
|
|
<< " in file " << file << ":" << line << endl;
|
2003-09-09 17:25:35 +00:00
|
|
|
|
emergencyCleanup();
|
2003-09-10 13:39:38 +00:00
|
|
|
|
lyx::support::abort();
|
2002-08-20 21:50:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|