Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show methods for LBTConfig and LBTLibraryInfo #40357

Merged
merged 4 commits into from
Apr 6, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions stdlib/LinearAlgebra/src/lbt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,38 @@ struct LBTConfig
end
end

Base.show(io::IO, lbt::LBTLibraryInfo) = print(io, "LBTLibraryInfo($(basename(lbt.libname)))")
function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, lbt::LBTLibraryInfo)
summary(io, lbt); println(io)
println(io, "├ Library: ", basename(lbt.libname))
println(io, "├ Interface: ", lbt.interface)
print(io, "└ F2C: ", lbt.f2c)
end

function Base.show(io::IO, lbt::LBTConfig)
if length(lbt.loaded_libs) <= 3
print(io, "LBTConfig(", join(basename.(getfield.(lbt.loaded_libs, :libname)), ", "), ")")
carstenbauer marked this conversation as resolved.
Show resolved Hide resolved
else
print(io, "LBTConfig")
end
end
function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, lbt::LBTConfig)
summary(io, lbt); println(io)
println(io, "Libraries: ")
for (i,l) in enumerate(lbt.loaded_libs)
char = i == length(lbt.loaded_libs) ? "└" : "├"
interface_str = if l.interface == :ilp64
"ILP64"
elseif l.interface == :lp64
" LP64"
else
"UNKWN"
carstenbauer marked this conversation as resolved.
Show resolved Hide resolved
end
print(io, char, " [", interface_str,"] ", basename(l.libname))
i !== length(lbt.loaded_libs) && println()
end
end

function lbt_get_config()
config_ptr = ccall((:lbt_get_config, libblastrampoline), Ptr{lbt_config_t}, ())
return LBTConfig(unsafe_load(config_ptr))
Expand Down