Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/module_tail.cpp @ 47

Last change on this file since 47 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.4 KB
Line 
1// Copyright David Abrahams 2001.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6#if defined(_WIN32)
7# ifdef __MWERKS__
8#  pragma ANSI_strict off
9# endif
10# include <windows.h>
11# ifdef __MWERKS__
12#  pragma ANSI_strict reset
13# endif
14
15# ifdef _MSC_VER
16#  pragma warning(push)
17#  pragma warning(disable:4297)
18#  pragma warning(disable:4535)
19extern "C" void straight_to_debugger(unsigned int, EXCEPTION_POINTERS*)
20{
21    throw;
22}
23extern "C" void (*old_translator)(unsigned, EXCEPTION_POINTERS*)
24         = _set_se_translator(straight_to_debugger);
25#  pragma warning(pop)
26# endif
27
28#endif // _WIN32
29
30#include <exception>
31#include <boost/python/extract.hpp>
32#include <boost/python/str.hpp>
33struct test_failure : std::exception
34{
35    test_failure(char const* expr, char const* function, char const* file, unsigned line)
36      : msg(file + boost::python::str(":%s:") % line + ": Boost.Python assertion failure: " + expr)
37    {}
38
39    ~test_failure() throw() {}
40   
41    char const* what() const throw()
42    {
43        return boost::python::extract<char const*>(msg)();
44    }
45
46    boost::python::str msg;
47};
48
49namespace boost
50{
51
52void assertion_failed(char const * expr, char const * function, char const * file, long line)
53{
54    throw ::test_failure(expr,function, file, line);
55}
56
57} // namespace boost
Note: See TracBrowser for help on using the repository browser.