2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
2007-04-25 18:04:04 +00:00
|
|
|
|
* \file boost.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* 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>
|
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "LyX.h"
|
2007-11-29 07:04:28 +00:00
|
|
|
|
|
|
|
|
|
#include "support/debug.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>
|
2007-11-28 22:12:03 +00:00
|
|
|
|
#include <iomanip>
|
2008-02-07 17:04:06 +00:00
|
|
|
|
#include <iostream>
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
using namespace std;
|
2006-11-10 21:38:07 +00:00
|
|
|
|
using lyx::lyxerr;
|
|
|
|
|
using lyx::LyX;
|
2002-08-20 21:50:08 +00:00
|
|
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
|
|
2006-04-05 23:55:36 +00:00
|
|
|
|
#ifndef BOOST_NO_EXCEPTIONS
|
2007-12-12 19:28:07 +00:00
|
|
|
|
void throw_exception(exception const & e)
|
2002-08-20 21:50:08 +00:00
|
|
|
|
{
|
2007-11-28 22:12:03 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2007-12-16 11:34:29 +00:00
|
|
|
|
|
|
|
|
|
// FIXME: by default we exit here but we could also inform the user
|
|
|
|
|
// about the assertion and do the emergency cleanup without exiting.
|
|
|
|
|
// FIXME: do we have a list of exit codes defined somewhere?
|
|
|
|
|
LyX::cref().exit(1);
|
2002-08-20 21:50:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-11-10 21:38:07 +00:00
|
|
|
|
} // namespace boost
|