diff --git a/femtolisp/print.c b/femtolisp/print.c index 955c6a9..ef779fe 100644 --- a/femtolisp/print.c +++ b/femtolisp/print.c @@ -360,7 +360,8 @@ void fl_print_child(ios_t *f, value_t v, int princ) break; } if (isbuiltin(v)) { - outs("#.", f); + if (!princ) + outs("#.", f); outs(builtin_names[uintval(v)], f); break; } @@ -370,7 +371,10 @@ void fl_print_child(ios_t *f, value_t v, int princ) (unsigned long)(builtin_t)ptr(v)); } else { - HPOS += ios_printf(f, "#builtin(%s)", symbol_name(label)); + if (princ) + outs(symbol_name(label), f); + else + HPOS += ios_printf(f, "#builtin(%s)", symbol_name(label)); } break; case TAG_CVALUE: @@ -534,13 +538,10 @@ static void cvalue_printdata(ios_t *f, void *data, size_t len, value_t type, snprint_real(buf, sizeof(buf), d, 0, ndec, 3, 10); int hasdec = (strpbrk(buf, ".eE") != NULL); outs(buf, f); - if (weak || princ || hasdec) { + if (!hasdec) outs(".0", f); + if (!princ && !weak) { if (type == floatsym) outc('f', f); } - else { - if (!hasdec) outs(".0", f); - if (type==floatsym) outc('f', f); - } } } else if (issymbol(type)) { diff --git a/femtolisp/string.c b/femtolisp/string.c index 4762e78..bcdf8a1 100644 --- a/femtolisp/string.c +++ b/femtolisp/string.c @@ -146,7 +146,7 @@ value_t fl_string(value_t *args, u_int32_t nargs) sz += cv_len((cvalue_t*)ptr(cv)); continue; } - args[i] = print_to_string(args[i], iscprim(args[i])); + args[i] = print_to_string(args[i], iscprim(args[i])||isbuiltinish(args[i])); if (nargs == 1) // convert single value to string return args[i]; sz += cv_len((cvalue_t*)ptr(args[i]));