Skip to content

Commit

Permalink
cleaner display
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jan 6, 2025
1 parent 22770f6 commit d8130f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/methods/set_header.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function set_traceheader!(traceheaders::Array{BinaryTraceHeader,1},
setfield!(traceheaders[t], name, x_typed[t])
end
catch e
@warn "Unable to convert $x to $(ftype)"
@warn "Unable to convert $(first(x)) to $(ftype) for header $(name)"
throw(e)
end
end
Expand Down
7 changes: 5 additions & 2 deletions src/types/BinaryFileHeader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ end
fh_keys() = collect(keys(fh_byte2sample()))

function show(io::IO, bfh::BinaryFileHeader)

bf = fh_byte2sample()
println("BinaryFileHeader:")

for field in fieldnames(BinaryFileHeader)
s = @sprintf " %30s: %9d" String(field) getfield(bfh, field)
byte = bf[String(field)] + 1
next = byte + sizeof(getfield(bfh, field)) - 1
sfield = "$(field) ($(byte)-$(next))"
s = @sprintf " %40s: %9d" sfield getfield(bfh, field)
println(s)
end
println("\n")
Expand Down
6 changes: 5 additions & 1 deletion src/types/BinaryTraceHeader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,14 @@ end
Base.zeros(::Type{BinaryTraceHeader}, n::Integer) = [BinaryTraceHeader() for _=1:n]

function show(io::IO, bth::BinaryTraceHeader)
th = th_byte2sample()

println("BinaryTraceHeader:")
for field in fieldnames(BinaryTraceHeader)
s = @sprintf " %30s: %9d" String(field) getfield(bth, field)
byte = th[String(String(field))] + 1
next = byte + sizeof(getfield(bth, field)) - 1
sfield = "$(field) ($(byte)-$(next))"
s = @sprintf " %40s: %9d" sfield getfield(bth, field)
println(s)
end
println("\n")
Expand Down

0 comments on commit d8130f8

Please sign in to comment.