00001 // +-------------------------------------------------------------------------+ 00002 // | I__n__t__e__L__i__b 0.6.10 development | 00003 // | Copyright (c) Andrey Vikt. Stolyarov <crocodil_AT_croco.net> 2000-2007. | 00004 // | | 00005 // | This is free software. The library part is available under | 00006 // | GNU LESSER GENERAL PUBLIC LICENSE v.2.1. | 00007 // | GNU LGPL v2.1 is found in docs/gnu_gpl2.txt, or at http://www.gnu.org | 00008 // | Please see also docs/readme.txt and visit http://www.intelib.org | 00009 // | | 00010 // | !!! THERE IS NO WARRANTY OF ANY KIND, NEITHER EXPRESSED NOR IMPLIED !!! | 00011 // +-------------------------------------------------------------------------+ 00012 00013 00014 00015 00024 #ifndef INTELIB_IEXCEPT_HPP_SENTRY 00025 #define INTELIB_IEXCEPT_HPP_SENTRY 00026 00027 #include "sexpress.hpp" 00028 00030 00040 class IntelibX { 00042 00046 const char *descr; 00048 00053 SReference param; 00054 00056 00059 SReference stack; 00060 public: 00062 00066 IntelibX(const char *a_descr); 00068 00073 IntelibX(const char *a_descr, SReference a_param); 00075 00077 IntelibX(const IntelibX& other); 00079 ~IntelibX(); 00080 00082 void AddStack(SReference r); 00083 00085 const char *Description() const { return descr; } 00087 const SReference &Parameter() const { return param; } 00089 const SReference &Stack() const { return stack; } 00090 }; 00091 00092 00093 00095 class IntelibX_wrong_expression_type : public IntelibX { 00096 public: 00097 IntelibX_wrong_expression_type(const SReference &a_param); 00098 }; 00099 00101 class IntelibX_not_a_string : public IntelibX { 00102 public: 00103 IntelibX_not_a_string(SReference a_param); 00104 }; 00105 00107 class IntelibX_not_a_number : public IntelibX { 00108 public: 00109 IntelibX_not_a_number(SReference a_param); 00110 }; 00111 00113 class IntelibX_not_a_char : public IntelibX { 00114 public: 00115 IntelibX_not_a_char(SReference a_param); 00116 }; 00117 00119 class IntelibX_not_a_cons : public IntelibX { 00120 public: 00121 IntelibX_not_a_cons(SReference a_param); 00122 }; 00123 00125 class IntelibX_not_a_list : public IntelibX { 00126 public: 00127 IntelibX_not_a_list(SReference a_param); 00128 }; 00129 00131 class IntelibX_not_a_label : public IntelibX { 00132 public: 00133 IntelibX_not_a_label(SReference a_param); 00134 }; 00135 00137 class IntelibX_unexpected_unbound_value : public IntelibX { 00138 public: 00139 IntelibX_unexpected_unbound_value(); 00140 }; 00141 00143 class IntelibX_not_implemented : public IntelibX { 00144 public: 00145 IntelibX_not_implemented(); 00146 }; 00147 00149 00151 class IntelibX_bug : public IntelibX { 00152 public: 00153 IntelibX_bug(); 00154 }; 00155 00156 00157 00158 #if INTELIB_RUNTIME_CHECKS == 1 00159 00160 # define INTELIB_ASSERT(condition, exception) \ 00161 do { if(!(condition)) throw exception; } while(0) 00162 #else 00163 00164 # define INTELIB_ASSERT(condition, exception) 00165 #endif 00166 00167 #endif // sentry