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.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2008-04-30 08:26:40 +00:00
|
|
|
#include "support/lassert.h"
|
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>
|
2020-01-14 20:59:05 +00:00
|
|
|
#include <ostream>
|
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;
|
2002-08-20 21:50:08 +00:00
|
|
|
|
|
|
|
namespace boost {
|
|
|
|
|
2006-04-05 23:55:36 +00:00
|
|
|
#ifndef BOOST_NO_EXCEPTIONS
|
2020-01-07 15:23:03 +00:00
|
|
|
void throw_exception(exception const & e)
|
2002-08-20 21:50:08 +00:00
|
|
|
{
|
2008-10-01 00:35:26 +00:00
|
|
|
lyxerr << "Exception caught:\n" << e.what() << endl;
|
2008-04-10 21:49:34 +00:00
|
|
|
LASSERT(false, /**/);
|
2003-09-09 17:25:35 +00:00
|
|
|
}
|
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,
|
2020-01-07 15:23:03 +00:00
|
|
|
char const * file, long line)
|
2003-09-09 17:25:35 +00:00
|
|
|
{
|
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?
|
2008-07-14 08:35:00 +00:00
|
|
|
lyx::lyx_exit(1);
|
2002-08-20 21:50:08 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 15:23:03 +00:00
|
|
|
void assertion_failed_msg(char const * expr, char const * msg,
|
|
|
|
char const * function, char const * file, long line)
|
|
|
|
{
|
|
|
|
lyxerr << "Assertion triggered in " << function
|
|
|
|
<< " by failing check \"" << expr << "\""
|
|
|
|
<< " with message \"" << msg << "\""
|
|
|
|
<< " in file " << file << ":" << line << endl;
|
|
|
|
|
|
|
|
// 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::lyx_exit(1);
|
|
|
|
}
|
|
|
|
|
2006-11-10 21:38:07 +00:00
|
|
|
} // namespace boost
|