fix bug printing custom cvalue types that lack print methods
This commit is contained in:
parent
2eef9d5a5d
commit
687cf8fdb5
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
print.c
6
print.c
|
@ -700,12 +700,18 @@ 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.
|
||||||
|
numerictype_t nt = sym_to_numtype(type);
|
||||||
|
if (nt == N_NUMTYPES) {
|
||||||
|
HPOS += ios_printf(f, "#<%s>", symbol_name(type));
|
||||||
|
}
|
||||||
|
else {
|
||||||
int64_t i64 = conv_to_int64(data, sym_to_numtype(type));
|
int64_t i64 = conv_to_int64(data, sym_to_numtype(type));
|
||||||
if (weak || print_princ)
|
if (weak || print_princ)
|
||||||
HPOS += ios_printf(f, "%lld", i64);
|
HPOS += ios_printf(f, "%lld", i64);
|
||||||
else
|
else
|
||||||
HPOS += ios_printf(f, "#%s(%lld)", symbol_name(type), i64);
|
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) {
|
||||||
value_t eltype = car(cdr_(type));
|
value_t eltype = car(cdr_(type));
|
||||||
|
|
Loading…
Reference in New Issue