ref: e2b7652e36a03d6a07b73af884e53d8e87c7fde1
parent: fdfaacfbe55da150c6637288e821dd69780026e2
author: JeffBezanson <[email protected]>
date: Tue Mar 10 15:29:30 EDT 2009
some printing improvements
--- a/femtolisp/print.c
+++ b/femtolisp/print.c
@@ -360,7 +360,8 @@
break;
}
if (isbuiltin(v)) {
- outs("#.", f);
+ if (!princ)
+ outs("#.", f);
outs(builtin_names[uintval(v)], f);
break;
}
@@ -370,7 +371,10 @@
(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,12 +538,9 @@
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);
}
}
}
--- a/femtolisp/string.c
+++ b/femtolisp/string.c
@@ -146,7 +146,7 @@
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]));