diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 07:06:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 07:06:31 -0700 |
commit | ab77a519ba5d9ad21a1cc732d78b6b49e9ca2c2b (patch) | |
tree | 9d32b53621f50414ae85d4fdc4b79cf04268e199 /lib.c | |
parent | c6c05649f5d3890281e6fe95694794d39f6f0841 (diff) | |
download | txr-ab77a519ba5d9ad21a1cc732d78b6b49e9ca2c2b.tar.gz txr-ab77a519ba5d9ad21a1cc732d78b6b49e9ca2c2b.tar.bz2 txr-ab77a519ba5d9ad21a1cc732d78b6b49e9ca2c2b.zip |
More informative printed rep for functions.
* lib.c (obj_print_impl): Print whether
a function is interpreted or intrinsic, and
include argument information.
* tests/012/struct.tl: Test case relying on
function printed rep updated.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -7380,7 +7380,24 @@ finish: format(out, lit("#<package: ~s>"), obj->pk.name, nao); break; case FUN: - format(out, lit("#<function: type ~a>"), num(obj->f.functype), nao); + { + struct func *f = &obj->f; + if (f->functype == FINTERP) { + val fun = f->f.interp_fun; + format(out, lit("#<interpreted fun: ~s ~s>"), + car(fun), cadr(fun), nao); + } else { + format(out, lit("#<intrinsic fun: ~a param"), + num_fast(f->fixparam - f->optargs), nao); + if (f->optargs) + format(out, lit(" + ~a optional"), + num_fast(f->optargs), nao); + if (obj->f.variadic) + put_string(lit(" + variadic>"), out); + else + put_char(chr('>'), out); + } + } break; case VEC: { |