X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=mware%2Fexcept.h;h=5229f3f5f23eafbd407173ea15a26e926e689a57;hb=5f3952176a4e9a00ca8dd5ec4a6b994958f89e0a;hp=fc7f1421e0f50c0a11a1df5918621b18e86c47f8;hpb=4bf15025c3fe95a226686b793e39a44f5f08d7da;p=bertos.git diff --git a/mware/except.h b/mware/except.h old mode 100755 new mode 100644 index fc7f1421..5229f3f5 --- a/mware/except.h +++ b/mware/except.h @@ -32,15 +32,9 @@ extern jmp_buf except_stack[EXCEPT_CONTEXTS]; extern int except_top; -#ifdef _DEBUG -# define PUSH_ABORT ASSERT(abort_top < ABORT_CONTEXTS), setjmp(abort_stack[abort_top++])) -# define POP_ABORT (ASSERT(abort_top > 0), --abort_top) -# define DO_ABORT (ASSERT(abort_top > 0), longjmp(abort_stack[--abort_top], true)) -#else -# define PUSH_ABORT (setjmp(abort_stack[abort_top++])) -# define POP_ABORT (--abort_top) -# define DO_ABORT (longjmp(abort_stack[--abort_top], true)) -#endif +#define PUSH_EXCEPT (ASSERT(except_top < EXCEPT_CONTEXTS), setjmp(except_stack[except_top++])) +#define POP_EXCEPT (ASSERT(except_top > 0), --except_top) +#define DO_EXCEPT (ASSERT(except_top > 0), longjmp(except_stack[--except_top], true)) /** * Jump buffer to use when throwing an exception or aborting an operation @@ -92,15 +86,15 @@ extern int except_top; * EXCEPT_DEFINE; * \endcode */ -#define TRY if (PUSH_ABORT) { { -#define TRY_END } POP_ABORT; } -#define CATCH } POP_ABORT; } else { +#define TRY if (PUSH_EXCEPT) { { +#define TRY_END } POP_EXCEPT; } +#define CATCH } POP_EXCEPT; } else { #define CATCH_END } -#define THROW DO_ABORT +#define THROW DO_EXCEPT #define EXCEPT_DEFINE \ - jmp_buf abort_stack[ABORT_CONTEXTS]; \ - int abort_top; + jmp_buf except_stack[EXCEPT_CONTEXTS]; \ + int except_top; #endif /* MWARE_EXCEPT_H */