+ * @brief A set of macros providing exception a la C++ in ANSI C (grounding feature)
+ *
+ * <center><table><tr><td><b>Top</b> <td> [\ref index]::[\ref XBT_API]
+ * <tr><td><b>Prev</b> <td> [\ref XBT_syscall]
+ * <tr><td><b>Next</b> <td> [\ref XBT_log] </table></center>
*
* This module is a small ISO-C++ style exception handling library
* for use in the ISO-C language. It allows you to use the paradigm
*
* This module is a small ISO-C++ style exception handling library
* for use in the ISO-C language. It allows you to use the paradigm
* These features are brought to you by a modified version of the libex
* library, one of the numerous masterpiece of Ralf S. Engelschall.
*
* These features are brought to you by a modified version of the libex
* library, one of the numerous masterpiece of Ralf S. Engelschall.
*
- * In SimGrid, exceptions is a triple <\a msg , \a category , \a value>
+ * In SimGrid, an exception is a triple <\a msg , \a category , \a value>
* where \a msg is a human-readable text describing the exceptional
* condition, \a code an integer describing what went wrong and \a value
* providing a sort of sub-category. (this is different in the original libex).
* where \a msg is a human-readable text describing the exceptional
* condition, \a code an integer describing what went wrong and \a value
* providing a sort of sub-category. (this is different in the original libex).
* following code which shows some pitfalls and contains many errors (assuming
* a mallocex() function which throws an exception if malloc(3) fails):
*
* following code which shows some pitfalls and contains many errors (assuming
* a mallocex() function which throws an exception if malloc(3) fails):
*
#define THROW0(c,v,m) _THROW(c,v,(m?bprintf(m):NULL))
#define THROW0(c,v,m) _THROW(c,v,(m?bprintf(m):NULL))
#define THROW1(c,v,m,a1) _THROW(c,v,bprintf(m,a1))
#define THROW1(c,v,m,a1) _THROW(c,v,bprintf(m,a1))
#define THROW2(c,v,m,a1,a2) _THROW(c,v,bprintf(m,a1,a2))
#define THROW2(c,v,m,a1,a2) _THROW(c,v,bprintf(m,a1,a2))
#define THROW3(c,v,m,a1,a2,a3) _THROW(c,v,bprintf(m,a1,a2,a3))
#define THROW3(c,v,m,a1,a2,a3) _THROW(c,v,bprintf(m,a1,a2,a3))
#define THROW4(c,v,m,a1,a2,a3,a4) _THROW(c,v,bprintf(m,a1,a2,a3,a4))
#define THROW4(c,v,m,a1,a2,a3,a4) _THROW(c,v,bprintf(m,a1,a2,a3,a4))
#define THROW5(c,v,m,a1,a2,a3,a4,a5) _THROW(c,v,bprintf(m,a1,a2,a3,a4,a5))
#define THROW5(c,v,m,a1,a2,a3,a4,a5) _THROW(c,v,bprintf(m,a1,a2,a3,a4,a5))
#define THROW6(c,v,m,a1,a2,a3,a4,a5,a6) _THROW(c,v,bprintf(m,a1,a2,a3,a4,a5,a6))
#define THROW_IMPOSSIBLE THROW0(unknown_error,0,"The Impossible Did Happen (yet again)")
#define THROW6(c,v,m,a1,a2,a3,a4,a5,a6) _THROW(c,v,bprintf(m,a1,a2,a3,a4,a5,a6))
#define THROW_IMPOSSIBLE THROW0(unknown_error,0,"The Impossible Did Happen (yet again)")
#define RETHROW1(msg,a) _XBT_PRE_RETHROW msg,a, _XBT_POST_RETHROW
#define RETHROW1(msg,a) _XBT_PRE_RETHROW msg,a, _XBT_POST_RETHROW
#define RETHROW2(msg,a,b) _XBT_PRE_RETHROW msg,a,b, _XBT_POST_RETHROW
#define RETHROW2(msg,a,b) _XBT_PRE_RETHROW msg,a,b, _XBT_POST_RETHROW
#define RETHROW3(msg,a,b,c) _XBT_PRE_RETHROW msg,a,b,c, _XBT_POST_RETHROW
#define RETHROW3(msg,a,b,c) _XBT_PRE_RETHROW msg,a,b,c, _XBT_POST_RETHROW
#define RETHROW4(msg,a,b,c,d) _XBT_PRE_RETHROW msg,a,b,c, _XBT_POST_RETHROW
#define RETHROW4(msg,a,b,c,d) _XBT_PRE_RETHROW msg,a,b,c, _XBT_POST_RETHROW
#define RETHROW5(msg,a,b,c,d,e) _XBT_PRE_RETHROW msg,a,b,c,d,e _XBT_POST_RETHROW
#define RETHROW5(msg,a,b,c,d,e) _XBT_PRE_RETHROW msg,a,b,c,d,e _XBT_POST_RETHROW