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 {
|
|
|
|
|
|
2006-04-05 23:55:36 +00:00
|
|
|
|
#ifndef BOOST_NO_EXCEPTIONS
|
2002-08-20 21:50:08 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
2006-04-05 23:55:36 +00:00
|
|
|
|
#endif
|
2003-09-09 17:25:35 +00:00
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
void emergencyCleanup()
|
|
|
|
|
{
|
2004-10-05 10:11:42 +00:00
|
|
|
|
static bool didCleanup;
|
|
|
|
|
if (didCleanup)
|
|
|
|
|
return;
|
2003-09-09 17:25:35 +00:00
|
|
|
|
|
2004-10-05 10:11:42 +00:00
|
|
|
|
didCleanup = true;
|
2003-09-09 17:25:35 +00:00
|
|
|
|
|
2004-10-05 10:11:42 +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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|