Program Listing for File exception.h

Return to documentation for file (rcsw/common/exception.h)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <setjmp.h>

/*******************************************************************************
 * Macros
 ******************************************************************************/
#define TRY                                     \
    do {                                        \
        jmp_buf ex_buf__;                       \
        switch (setjmp(ex_buf__)) {             \
        case 0:                                 \
            while (1) {
#define CATCH(x)                                \
    break;                                      \
case x:

#define FINALLY                                 \
    break;                                      \
    }                                           \
default:
#define ETRY                                    \
    break;                                      \
    }                                           \
        }                                       \
    } while (0)

#define THROW(x) longjmp(ex_buf__, x)