-SG_BEGIN_DECL()
-
-/*-*-* Emergency debuging: define this when the exceptions get crazy *-*-*/
-#undef __EX_MAYDAY
-#ifdef __EX_MAYDAY
-# include <stdio.h>
-#include <errno.h>
-# define MAYDAY_SAVE(m) printf("%d %s:%d save %p\n", \
- xbt_getpid(), __FILE__, __LINE__, \
- (m)->jb \
- ),
-# define MAYDAY_RESTORE(m) printf("%d %s:%d restore %p\n", \
- xbt_getpid(), __FILE__, __LINE__, \
- (m)->jb \
- ),
-# define MAYDAY_CATCH(e) printf("%d %s:%d Catched '%s'\n", \
- xbt_getpid(), __FILE__, __LINE__, \
- (e).msg \
- ),
-#else
-# define MAYDAY_SAVE(m)
-# define MAYDAY_RESTORE(m)
-# define MAYDAY_CATCH(e)
-#endif
-/*-*-* end of debugging stuff *-*-*/
-#if defined(__EX_MCTX_MCSC__)
-#include <ucontext.h> /* POSIX.1 ucontext(3) */
-#define __ex_mctx_struct ucontext_t uc;
-#define __ex_mctx_save(mctx) (getcontext(&(mctx)->uc) == 0)
-#define __ex_mctx_restored(mctx) /* noop */
-#define __ex_mctx_restore(mctx) (void)setcontext(&(mctx)->uc)
-#elif defined(__EX_MCTX_SSJLJ__)
-#include <setjmp.h> /* POSIX.1 sigjmp_buf(3) */
-#define __ex_mctx_struct sigjmp_buf jb;
-#define __ex_mctx_save(mctx) (sigsetjmp((mctx)->jb, 1) == 0)
-#define __ex_mctx_restored(mctx) /* noop */
-#define __ex_mctx_restore(mctx) (void)siglongjmp((mctx)->jb, 1)
-#elif defined(__EX_MCTX_SJLJ__) || !defined(__EX_MCTX_CUSTOM__) || defined(__EX_MAYDAY)
-#include <setjmp.h> /* ISO-C jmp_buf(3) */
-#define __ex_mctx_struct jmp_buf jb;
-#define __ex_mctx_save(mctx) ( MAYDAY_SAVE(mctx) setjmp((mctx)->jb) == 0)
-#define __ex_mctx_restored(mctx) /* noop */
-#define __ex_mctx_restore(mctx) ( MAYDAY_RESTORE(mctx) (void)longjmp((mctx)->jb, 1))
-#endif
-/* declare the machine context type */
-typedef struct {
-__ex_mctx_struct} __ex_mctx_t;
-
-/** @addtogroup XBT_ex
- * @brief A set of macros providing exception a la C++ in ANSI C (grounding feature)
- *
- * 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
- * of throwing and catching exceptions in order to reduce the amount
- * of error handling code without hindering program robustness.
- *
- * This is achieved by directly transferring exceptional return codes
- * (and the program control flow) from the location where the exception
- * is raised (throw point) to the location where it is handled (catch
- * point) -- usually from a deeply nested sub-routine to a parent
- * routine. All intermediate routines no longer have to make sure that
- * the exceptional return codes from sub-routines are correctly passed
- * back to the parent.
- *
- * These features are brought to you by a modified version of the libex
- * library, one of the numerous masterpiece of Ralf S. Engelschall.
- *
- * \htmlonly <div class="toc">\endhtmlonly
- *
- * @section XBT_ex_toc TABLE OF CONTENTS
- *
- * - \ref XBT_ex_intro
- * - \ref XBT_ex_base
- * - \ref XBT_ex_pitfalls
- *
- * \htmlonly </div> \endhtmlonly
- *
- * @section XBT_ex_intro DESCRIPTION
- *
- * 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).
- *
- * @section XBT_ex_base BASIC USAGE
- *
- * \em TRY \b TRIED_BLOCK [\em TRY_CLEANUP \b CLEANUP_BLOCK] \em CATCH (variable) \b CATCH_BLOCK
- *
- * This is the primary syntactical construct provided. It is modeled after the
- * ISO-C++ try-catch clause and should sound familiar to most of you.
- *
- * Any exception thrown directly from the TRIED_BLOCK block or from called
- * subroutines is caught. Cleanups which must be done after this block
- * (whenever an exception arose or not) should be placed into the optionnal
- * CLEANUP_BLOCK. The code dealing with the exceptions when they arise should
- * be placed into the (mandatory) CATCH_BLOCK.
- *
- *
- * In absence of exception, the control flow goes into the blocks TRIED_BLOCK
- * and CLEANUP_BLOCK (if present); The CATCH_BLOCK block is then ignored.
- *
- * When an exception is thrown, the control flow goes through the following
- * blocks: TRIED_BLOCK (up to the statement throwing the exception),
- * CLEANUP_BLOCK (if any) and CATCH_BLOCK. The exception is stored in a
- * variable for inspection inside the CATCH_BLOCK. This variable must be
- * declared in the outter scope, but its value is only valid within the
- * CATCH_BLOCK block.