Advertisement
Delfigamer

utils/cbase.hpp

Feb 24th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #ifndef UTILS_CBASE_HPP__
  2. #define UTILS_CBASE_HPP__ 1
  3.  
  4. #include <exception>
  5.  
  6. #define CBASE_PROTECT( op ) \
  7.         cbase_seterror( 0 ); \
  8.         try { \
  9.             op \
  10.         } catch( std::exception const& e ) { \
  11.             cbase_seterror( e.what() ); \
  12.         } catch( ... ) { \
  13.             cbase_seterror( "unknown exception" ); \
  14.         } \
  15.         return 0;
  16.  
  17. extern "C" {
  18.     char const* cbase_geterror() noexcept;
  19.     char const* cbase_seterror( char const* error ) noexcept;
  20.     bool cbase_log( char const* str ) noexcept;
  21.     void cbase_yield() noexcept;
  22. }
  23.  
  24. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement