Skip to content

Commit 54b610b

Browse files
authored
Show methods for LBTConfig and LBTLibraryInfo (#40357)
* show methods for LBTConfig and LBTLibraryInfo * add interface information to LBTConfig printing * interface information in show fallback of LBTConfig and LBTLibraryInfo * LBTConfig(...) instead of LBTConfig() for n>3 libs
1 parent 79e198b commit 54b610b

File tree

1 file changed

+36
-0
lines changed
  • stdlib/LinearAlgebra/src

1 file changed

+36
-0
lines changed

stdlib/LinearAlgebra/src/lbt.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,42 @@ struct LBTConfig
103103
end
104104
end
105105

106+
Base.show(io::IO, lbt::LBTLibraryInfo) = print(io, "LBTLibraryInfo(", basename(lbt.libname), ", ", lbt.interface, ")")
107+
function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, lbt::LBTLibraryInfo)
108+
summary(io, lbt); println(io)
109+
println(io, "├ Library: ", basename(lbt.libname))
110+
println(io, "├ Interface: ", lbt.interface)
111+
print(io, "└ F2C: ", lbt.f2c)
112+
end
113+
114+
function Base.show(io::IO, lbt::LBTConfig)
115+
if length(lbt.loaded_libs) <= 3
116+
print(io, "LBTConfig(")
117+
gen = (string("[", uppercase(string(l.interface)), "] ",
118+
basename(l.libname)) for l in lbt.loaded_libs)
119+
print(io, join(gen, ", "))
120+
print(io, ")")
121+
else
122+
print(io, "LBTConfig(...)")
123+
end
124+
end
125+
function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, lbt::LBTConfig)
126+
summary(io, lbt); println(io)
127+
println(io, "Libraries: ")
128+
for (i,l) in enumerate(lbt.loaded_libs)
129+
char = i == length(lbt.loaded_libs) ? "" : ""
130+
interface_str = if l.interface == :ilp64
131+
"ILP64"
132+
elseif l.interface == :lp64
133+
" LP64"
134+
else
135+
"UNKWN"
136+
end
137+
print(io, char, " [", interface_str,"] ", basename(l.libname))
138+
i !== length(lbt.loaded_libs) && println()
139+
end
140+
end
141+
106142
function lbt_get_config()
107143
config_ptr = ccall((:lbt_get_config, libblastrampoline), Ptr{lbt_config_t}, ())
108144
return LBTConfig(unsafe_load(config_ptr))

0 commit comments

Comments
 (0)