summaryrefslogtreecommitdiffstats
path: root/unwind.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-16 05:51:49 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-16 05:51:49 -0800
commitecc500b1b343a8fc087236cc0b22a25322b6852e (patch)
tree727760b2b620677c60e823606298bc48a9cb5fe2 /unwind.c
parentdbd876b7ae581822ebe1b3920a51fa32d4267480 (diff)
downloadtxr-ecc500b1b343a8fc087236cc0b22a25322b6852e.tar.gz
txr-ecc500b1b343a8fc087236cc0b22a25322b6852e.tar.bz2
txr-ecc500b1b343a8fc087236cc0b22a25322b6852e.zip
TXR Lisp gets exception handling.
* eval.c (op_catch, expand_catch_clause, expand_catch): New static functions. (expand): Handle catch operator. (eval_init): Added catch operator to op_table, and registered new functions throw, throwf and error. * txr.1: Documented catch operator and created stub section for throw, throwf and error. * txr.vim: Updated. * unwind.c (uw_throwfv, uw_errorfv): New functions. * unwind.h (uw_throwfv, uw_errorfv): Declared.
Diffstat (limited to 'unwind.c')
-rw-r--r--unwind.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/unwind.c b/unwind.c
index ac99665a..ac4bb79d 100644
--- a/unwind.c
+++ b/unwind.c
@@ -295,6 +295,14 @@ val uw_throwf(val sym, val fmt, ...)
abort();
}
+val uw_throwfv(val sym, val fmt, val args)
+{
+ val stream = make_string_output_stream();
+ (void) formatv(stream, fmt, args);
+ uw_throw(sym, get_string_from_stream(stream));
+ abort();
+}
+
val uw_errorf(val fmt, ...)
{
va_list vl;
@@ -308,6 +316,14 @@ val uw_errorf(val fmt, ...)
abort();
}
+val uw_errorfv(val fmt, val args)
+{
+ val stream = make_string_output_stream();
+ (void) formatv(stream, fmt, args);
+ uw_throw(error_s, get_string_from_stream(stream));
+ abort();
+}
+
val type_mismatch(val fmt, ...)
{
va_list vl;