diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-10-09 13:44:26 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-10-09 13:44:26 +0000 |
| commit | 86e9acc7a7b714307e08ab25117ca03cecb00936 (patch) | |
| tree | 38dd7904147567c4e97e1f62eca64739d3a516eb /src/runtime/c/gu/exn.h | |
| parent | 8e3ed825a8dde13894a44169ddc09cc2c2be60b2 (diff) | |
throw away the long obsolete runtime type information in the C runtime
Diffstat (limited to 'src/runtime/c/gu/exn.h')
| -rw-r--r-- | src/runtime/c/gu/exn.h | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/runtime/c/gu/exn.h b/src/runtime/c/gu/exn.h index faf413a96..14f77dbcf 100644 --- a/src/runtime/c/gu/exn.h +++ b/src/runtime/c/gu/exn.h @@ -2,7 +2,6 @@ #define GU_EXN_H_ #include <gu/mem.h> -#include <gu/type.h> /** @file * @@ -47,9 +46,7 @@ struct GuExnData struct GuExn { /// @privatesection GuExnState state; - GuExn* parent; - GuKind* catch; - GuType* caught; + const char* caught; GuExnData data; }; @@ -59,10 +56,8 @@ struct GuExn { /// Allocate a new local exception frame. -#define gu_exn(parent_, catch_, pool_) &(GuExn){ \ +#define gu_exn(pool_) &(GuExn){ \ .state = GU_EXN_OK, \ - .parent = parent_, \ - .catch = gu_kind(catch_), \ .caught = NULL, \ .data = {.pool = pool_, .data = NULL} \ } @@ -70,8 +65,7 @@ struct GuExn { /// Allocate a new exception frame. GuExn* -gu_new_exn(GuExn* parent, GuKind* catch_kind, GuPool* pool); - +gu_new_exn(GuPool* pool); bool @@ -83,10 +77,11 @@ gu_exn_clear(GuExn* err) { err->state = GU_EXN_OK; } - - -GuType* -gu_exn_caught(GuExn* err); +#define gu_exn_caught(err, type) \ + (err->caught && strcmp(err->caught, #type) == 0) + +bool +gu_exn_caught_(GuExn* err, const char* type); static inline const void* gu_exn_caught_data(GuExn* err) @@ -104,11 +99,11 @@ gu_exn_unblock(GuExn* err); //@private GuExnData* -gu_exn_raise_(GuExn* err, GuType* type); +gu_exn_raise_(GuExn* err, const char* type); //@private GuExnData* -gu_exn_raise_debug_(GuExn* err, GuType* type, +gu_exn_raise_debug_(GuExn* err, const char* type, const char* filename, const char* func, int lineno); #ifdef NDEBUG @@ -122,7 +117,7 @@ gu_exn_raise_debug_(GuExn* err, GuType* type, /// Raise an exception. #define gu_raise(exn, T) \ - gu_exn_raise(exn, gu_type(T)) + gu_exn_raise(exn, #T) /**< * @param exn The current exception frame. * @@ -168,8 +163,6 @@ gu_ok(GuExn* exn) { typedef int GuErrno; -extern GU_DECLARE_TYPE(GuErrno, signed); - void gu_raise_errno(GuExn* err); |
