summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-04-10 00:36:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-04-10 00:36:05 -0700
commit079e081ab3f1a1bef175d8185c80108d16452c74 (patch)
treeafb0e2628bfb7f3871e163f299568232cf909752 /parser.c
parent3376e74aef0bd84a8dd3ef7c0c08a6a2d298dd7d (diff)
downloadtxr-079e081ab3f1a1bef175d8185c80108d16452c74.tar.gz
txr-079e081ab3f1a1bef175d8185c80108d16452c74.tar.bz2
txr-079e081ab3f1a1bef175d8185c80108d16452c74.zip
exceptions: allow description field in catch frames.
* eval.c (op_catch): Extra argument in sys:catch syntax specifies an expression that evaluates to a description field. (expand_catch): Expand the desc expression in sys:catch syntax. * parser.c (read_file_common): Increase acceptance of compiled files from versions 1-4 to 1-5, since we are now marking compiled files with version 5.0 rather than 4.0. * share/txr/stdlib/asm.tl (op-catch catch): Support new argument in the opcode syntax. Turns out we have a spare field in the instruction format which was previously set to zero We can use that for the description. Thus, the instruction set and VM remain backward compatible: old code works. * share/txr/stdlib/compiler.tl (compiler comp-catch): Handle the desc argument introduced into the sys:catch form. We must compile it as an expression, then inject the code into the instruction template, and reference the output register of that code block in the catch instruction. (%tlo-ver%): Bump up the compiled file version to 5.0. * share/txr/stdlib/except.tl (usr:catch, catch*): Add desc argument to generated sys:catch form, specifying it as nil. * unwind.c (desc_s): New symbol variable. (uw_find_frames_impl): Set the desc member of the extracted catch structure from the corresponding field in the catch frame. (uw_late_init): Initialize desc_s with interned symbol. Add desc slot to catch-frame type. * unwind.h (struct uw_catch): New member, desc. (uw_catch_begin_w_desc): New macro. * vm.c (vm_catch): Extract the desc field from the catch instruction, and use uw_catch_begin_w_desc to propagate that to the catch frame.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index b7713f64..4ac341b7 100644
--- a/parser.c
+++ b/parser.c
@@ -645,7 +645,7 @@ static val read_file_common(val self, val stream, val error_stream, val compiled
if (compiled && first) {
val major = car(form);
- if (lt(major, one) || gt(major, four))
+ if (lt(major, one) || gt(major, num_fast(5)))
uw_throwf(error_s,
lit("cannot load ~s: version number mismatch"),
stream, nao);