fix bug printing custom cvalue types that lack print methods
This commit is contained in:
parent
a0707331b8
commit
fe8b88cfc6
|
@ -768,7 +768,6 @@ static numerictype_t sym_to_numtype(value_t type)
|
||||||
return T_FLOAT;
|
return T_FLOAT;
|
||||||
else if (type == doublesym)
|
else if (type == doublesym)
|
||||||
return T_DOUBLE;
|
return T_DOUBLE;
|
||||||
assert(0);
|
|
||||||
return N_NUMTYPES;
|
return N_NUMTYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
print.c
16
print.c
|
@ -700,11 +700,17 @@ static void cvalue_printdata(ios_t *f, void *data, size_t len, value_t type,
|
||||||
else if (issymbol(type)) {
|
else if (issymbol(type)) {
|
||||||
// handle other integer prims. we know it's smaller than uint64
|
// handle other integer prims. we know it's smaller than uint64
|
||||||
// at this point, so int64 is big enough to capture everything.
|
// at this point, so int64 is big enough to capture everything.
|
||||||
int64_t i64 = conv_to_int64(data, sym_to_numtype(type));
|
numerictype_t nt = sym_to_numtype(type);
|
||||||
if (weak || print_princ)
|
if (nt == N_NUMTYPES) {
|
||||||
HPOS += ios_printf(f, "%lld", i64);
|
HPOS += ios_printf(f, "#<%s>", symbol_name(type));
|
||||||
else
|
}
|
||||||
HPOS += ios_printf(f, "#%s(%lld)", symbol_name(type), i64);
|
else {
|
||||||
|
int64_t i64 = conv_to_int64(data, sym_to_numtype(type));
|
||||||
|
if (weak || print_princ)
|
||||||
|
HPOS += ios_printf(f, "%lld", i64);
|
||||||
|
else
|
||||||
|
HPOS += ios_printf(f, "#%s(%lld)", symbol_name(type), i64);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (iscons(type)) {
|
else if (iscons(type)) {
|
||||||
if (car_(type) == arraysym) {
|
if (car_(type) == arraysym) {
|
||||||
|
|
Loading…
Reference in New Issue