some printing improvements

This commit is contained in:
JeffBezanson 2009-03-10 19:29:30 +00:00
parent fdfaacfbe5
commit e2b7652e36
2 changed files with 9 additions and 8 deletions

View File

@ -360,6 +360,7 @@ void fl_print_child(ios_t *f, value_t v, int princ)
break;
}
if (isbuiltin(v)) {
if (!princ)
outs("#.", f);
outs(builtin_names[uintval(v)], f);
break;
@ -370,6 +371,9 @@ void fl_print_child(ios_t *f, value_t v, int princ)
(unsigned long)(builtin_t)ptr(v));
}
else {
if (princ)
outs(symbol_name(label), f);
else
HPOS += ios_printf(f, "#builtin(%s)", symbol_name(label));
}
break;
@ -534,11 +538,8 @@ 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 (type == floatsym) outc('f', f);
}
else {
if (!hasdec) outs(".0", f);
if (!princ && !weak) {
if (type == floatsym) outc('f', f);
}
}

View File

@ -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]));