diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-05-07 18:19:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-05-07 18:19:31 -0700 |
commit | 7a3280106d04624a00bddb5abdf74485b9d0dee7 (patch) | |
tree | 46769937aa27c60cbfa1164c709ee06406e00978 /unwind.h | |
parent | 8f1e467559024433853e6ec0a862752c9a546104 (diff) | |
download | txr-7a3280106d04624a00bddb5abdf74485b9d0dee7.tar.gz txr-7a3280106d04624a00bddb5abdf74485b9d0dee7.tar.bz2 txr-7a3280106d04624a00bddb5abdf74485b9d0dee7.zip |
Adding panic macro, which throws a panic exception.
* lib.c (panic_s): New symbol variable.
(obj_init): Initialize panic_s.
* lib.h (panic_s): Declared.
* unwind.c (uw_init): Register panic exception.
* unwind.h (panic): New macro.
Diffstat (limited to 'unwind.h')
-rw-r--r-- | unwind.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -235,6 +235,16 @@ noreturn val type_mismatch(val, ...); nao); \ } while (0) +#define panic(STR) \ + do { \ + extern obj_t *num(cnum); \ + uw_throwf(panic_s, \ + lit("~a:~a ~a"), \ + lit(__FILE__), \ + num(__LINE__), lit(STR), \ + nao); \ + } while (0) + #define type_assert(EXPR, ARGS) \ if (!(EXPR)) type_mismatch ARGS |