From ab77a519ba5d9ad21a1cc732d78b6b49e9ca2c2b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 9 Sep 2015 07:06:31 -0700 Subject: 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. --- lib.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index d31a06bb..b912e9b0 100644 --- a/lib.c +++ b/lib.c @@ -7380,7 +7380,24 @@ finish: format(out, lit("#"), obj->pk.name, nao); break; case FUN: - format(out, lit("#"), num(obj->f.functype), nao); + { + struct func *f = &obj->f; + if (f->functype == FINTERP) { + val fun = f->f.interp_fun; + format(out, lit("#"), + car(fun), cadr(fun), nao); + } else { + format(out, lit("#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: { -- cgit v1.2.3