source: doc/working/exception/impl/exception.h @ 3f12158

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 3f12158 was c529a24, checked in by Andrew Beach <ajbeach@…>, 7 years ago

Updates to exception handling and translation.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1// Trying to create the new secret header for the exception handling mechanism.
2
3// This will have to go in the public header later.
4typedef int exception;
5
6
7
8void __throw_terminate(exception except) __attribute__((noreturn));
9void __rethrow_terminate(void) __attribute__((noreturn));
10void __throw_resume(exception except);
11
12void __try_terminate(void (*try_block)(),
13        void (*catch_block)(int index, exception except),
14        int (*match_block)(exception except));
15
16struct __try_resume_node {
17        struct __try_resume_node * next;
18        _Bool (*try_to_handle)(exception except);
19};
20
21void __try_resume_cleanup(struct __try_resume_node * node);
22
23struct __cleanup_hook {};
24
25
26
27/* The following code is temperary. How exceptions interact with coroutines
28 * and threads means that... well I'm going to get it working ignoring those
29 * first, then get it working with concurrency.
30 * Eventually there should be some global name that just gets you the right
31 * data block.
32 */
33struct shared_stack_t {
34        struct __try_resume_node * top_resume;
35        struct __try_resume_node * current_resume;
36
37        exception current_exception;
38        int current_handler_index;
39};
40
41extern struct shared_stack_t shared_stack;
Note: See TracBrowser for help on using the repository browser.