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 ++++++++++++++++++- tests/012/struct.tl | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) 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: { diff --git a/tests/012/struct.tl b/tests/012/struct.tl index 047204a6..5be89cab 100644 --- a/tests/012/struct.tl +++ b/tests/012/struct.tl @@ -103,7 +103,7 @@ (defvarl bz (new baz)) (stest bz - "#S(baz array #(1 2 3) increment #)") + "#S(baz array #(1 2 3) increment #)") (test bz.[array 2] 3) (test bz.(increment 0 42) 43) -- cgit v1.2.3