00001
00002
00003 #ifndef OSL_NTESUKI_EXCEPTIONS
00004 #define OSL_NTESUKI_EXCEPTIONS
00005 #include <iostream>
00006 #include <stdexcept>
00007
00008 #ifndef NDEBUG
00009 # define ntesuki_assert(assertion)\
00010 if (!(assertion))\
00011 throw DfpnError("assertion failed", __FILE__, __LINE__);
00012 #else
00013 #define ntesuki_assert(assertion)
00014 #endif
00015
00016 #ifndef NDEBUG
00017 #define TRY_DFPN \
00018 try\
00019 {\
00020
00021 #define CATCH_DFPN \
00022 }\
00023 catch (DfpnError err)\
00024 {\
00025 ntesuki_assert(false);\
00026 }
00027 #else
00028 #define TRY_DFPN
00029 #define CATCH_DFPN
00030 #endif
00031
00032 namespace osl
00033 {
00034 namespace ntesuki
00035 {
00039 struct DfpnError : std::runtime_error
00040 {
00041 DfpnError(const char *message,
00042 const char *filename,
00043 int linenum) : std::runtime_error(message)
00044 {
00045 std::cerr << message
00046 << "\n\tin " << filename
00047 << " line " << linenum << "\n";
00048 }
00049 };
00050 }
00051 }
00052
00053 #endif
00054
00055
00056
00057