diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-10 20:48:39 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-10 20:48:39 -0800 |
commit | 12fc8a196dd7cfa4ef9413d7fde7545c78d1a017 (patch) | |
tree | bfdb1c0221e25814f3a547b8c9bb5e4678f904d4 | |
parent | b20f57e55eea53a570c1fb59961173035f00f8dc (diff) | |
download | txr-12fc8a196dd7cfa4ef9413d7fde7545c78d1a017.tar.gz txr-12fc8a196dd7cfa4ef9413d7fde7545c78d1a017.tar.bz2 txr-12fc8a196dd7cfa4ef9413d7fde7545c78d1a017.zip |
Handle interpreted functions in circle printing.
Interpreted functions print as #<interpreted fun: name args>,
thus repeating some list structure in their notation.
This means we must traverse them when populating the
object hash during printing, and also when backpatching
after parsing.
Test case: evaluate and print
(let ((s '(lambda (a b c) d))) (list s (eval s)))
with *print-circle* enabled.
* lib.c (populate_obj_hash): Handle FUN objects of
functype FINTERP.
* parser.c (circ_backpatch): Likewise.
-rw-r--r-- | lib.c | 7 | ||||
-rw-r--r-- | parser.c | 7 |
2 files changed, 14 insertions, 0 deletions
@@ -9794,6 +9794,13 @@ tail: } } break; + case FUN: + if (obj->f.functype == FINTERP) { + val fun = obj->f.f.interp_fun; + populate_obj_hash(car(fun), ctx); + obj = cadr(fun); + goto tail; + } default: break; } @@ -333,6 +333,13 @@ tail: } } break; + case FUN: + if (obj->f.functype == FINTERP) { + val fun = obj->f.f.interp_fun; + circ_backpatch(p, &cs, car(fun)); + obj = cadr(fun); + goto tail; + } default: break; } |