Skip to content

Commit

Permalink
better static printing of typemap entries
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed May 5, 2017
1 parent 9beece6 commit 4bcb1bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ end

show(io::IO, x::ANY) = ccall(:jl_static_show, Void, (Ptr{Void}, Any), io_pointer(io), x)
print(io::IO, x::Char) = ccall(:jl_uv_putc, Void, (Ptr{Void}, Char), io_pointer(io), x)
print(io::IO, x::String) = write(io, x)
print(io::IO, x::String) = (write(io, x); nothing)
print(io::IO, x::ANY) = show(io, x)
print(io::IO, x::ANY, a::ANY...) = (print(io, x); print(io, a...))
println(io::IO) = write(io, 0x0a) # 0x0a = '\n'
println(io::IO) = (write(io, 0x0a); nothing) # 0x0a = '\n'
println(io::IO, x::ANY...) = (print(io, x...); println(io))

show(a::ANY) = show(STDOUT, a)
Expand Down
16 changes: 11 additions & 5 deletions src/rtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,14 +841,16 @@ static size_t jl_static_show_x_(JL_STREAM *out, jl_value_t *v, jl_datatype_t *vt
if (nb > 0 && tlen == 0) {
uint8_t *data = (uint8_t*)v;
n += jl_printf(out, "0x");
for(int i=nb-1; i >= 0; --i)
for(int i = nb - 1; i >= 0; --i)
n += jl_printf(out, "%02" PRIx8, data[i]);
}
else {
for (size_t i = 0; i < tlen; i++) {
size_t i = 0;
if (vt == jl_typemap_entry_type)
i = 1;
for (; i < tlen; i++) {
if (!istuple) {
n += jl_printf(out, "%s", jl_symbol_name((jl_sym_t*)jl_svecref(vt->name->names, i)));
//jl_fielddesc_t f = t->fields[i];
n += jl_printf(out, "=");
}
size_t offs = jl_field_offset(vt, i);
Expand All @@ -861,11 +863,15 @@ static size_t jl_static_show_x_(JL_STREAM *out, jl_value_t *v, jl_datatype_t *vt
(jl_datatype_t*)jl_field_type(vt, i),
depth);
}
if (istuple && tlen==1)
if (istuple && tlen == 1)
n += jl_printf(out, ",");
else if (i != tlen-1)
else if (i != tlen - 1)
n += jl_printf(out, ", ");
}
if (vt == jl_typemap_entry_type) {
n += jl_printf(out, ", next=↩︎\n ");
n += jl_static_show_x(out, jl_fieldref(v, 0), depth);
}
}
n += jl_printf(out, ")");
}
Expand Down

0 comments on commit 4bcb1bf

Please sign in to comment.