38#include "ws_symbol_export.h"
39#include "ws_attributes.h"
41#define XCEPT_GROUP_ANY 0
42#define XCEPT_CODE_ANY 0
43#define XCEPT_BAD_ALLOC 1
49enum { except_no_call, except_call };
52 unsigned long except_group;
53 unsigned long except_code;
58 const char *
volatile except_message;
59 void *
volatile except_dyndata;
63 void (*except_func)(
void *);
74enum except_stacktype {
75 XCEPT_CLEANUP, XCEPT_CATCHER
102WS_DLL_PUBLIC
int except_init(
void);
103WS_DLL_PUBLIC
void except_deinit(
void);
104WS_DLL_PUBLIC WS_NORETURN
void except_rethrow(
except_t *);
105WS_DLL_PUBLIC WS_NORETURN
void except_throw(
long,
long,
const char *);
106WS_DLL_PUBLIC WS_NORETURN
void except_throwd(
long,
long,
const char *,
void *);
107WS_DLL_PUBLIC WS_NORETURN
void except_vthrowf(
long group,
long code,
const char *fmt, va_list vl);
108WS_DLL_PUBLIC WS_NORETURN
void except_throwf(
long,
long,
const char *, ...)
110WS_DLL_PUBLIC
void (*except_unhandled_catcher(
void (*)(
except_t *)))(
except_t *);
111extern
unsigned long except_code(
except_t *);
112extern
unsigned long except_group(
except_t *);
113extern const
char *except_message(
except_t *);
114extern
void *except_data(
except_t *);
115WS_DLL_PUBLIC
void *except_take_data(
except_t *);
116WS_DLL_PUBLIC
void except_set_allocator(
void *(*)(
size_t),
void (*)(
void *));
117WS_DLL_PUBLIC
void *except_alloc(
size_t);
118WS_DLL_PUBLIC
void except_free(
void *);
120#define except_code(E) ((E)->except_id.except_code)
121#define except_group(E) ((E)->except_id.except_group)
122#define except_message(E) ((E)->except_message)
123#define except_data(E) ((E)->except_dyndata)
137#define except_cleanup_push(F, C) \
139 struct except_stacknode except_sn; \
140 struct except_cleanup except_cl; \
141 except_setup_clean(&except_sn, &except_cl, F, C)
143#define except_cleanup_pop(E) \
146 except_cl.except_func(except_cl.except_context); \
149#define except_checked_cleanup_pop(F, E) \
151 assert (except_cl.except_func == (F)); \
153 except_cl.except_func(except_cl.except_context); \
158#define except_cleanup_push_pfx(pfx, F, C) \
160 struct except_stacknode pfx##_except_sn; \
161 struct except_cleanup pfx##_except_cl; \
162 except_setup_clean(&pfx##_except_sn, &pfx##_except_cl, F, C)
164#define except_cleanup_pop_pfx(pfx, E) \
167 pfx##_except_cl.except_func(pfx##_except_cl.except_context);\
170#define except_checked_cleanup_pop_pfx(pfx, F, E) \
172 assert (pfx##_except_cl.except_func == (F)); \
174 pfx##_except_cl.except_func(pfx##_except_cl.except_context);\
179#define except_try_push(ID, NUM, PPE) \
181 struct except_stacknode except_sn; \
182 struct except_catch except_ch; \
183 except_setup_try(&except_sn, &except_ch, ID, NUM); \
184 if (setjmp(except_ch.except_jmp)) \
185 *(PPE) = &except_ch.except_obj; \
189#define except_try_pop() \
190 except_free(except_ch.except_obj.except_dyndata); \
Represents a node in the exception handling stack.
Definition except.h:85
struct except_cleanup * except_cleanup
Definition except.h:90
enum except_stacktype except_type
Definition except.h:87
struct except_stacknode * except_down
Definition except.h:86
struct except_catch * except_catcher
Definition except.h:89