fix wrong type name for pages
This commit is contained in:
parent
ba42f11722
commit
e9cdfa0364
2 changed files with 25 additions and 28 deletions
|
@ -1,19 +1,12 @@
|
|||
// C++ fuckery to get the number of lambda arguments
|
||||
// C++ fuckery to get the number of lambda arguments ----
|
||||
template <typename F>
|
||||
struct Signature;
|
||||
|
||||
template <typename... Args>
|
||||
struct Tuple {
|
||||
static constexpr u32 N_Elems = sizeof...(Args);
|
||||
};
|
||||
|
||||
// Oh god, oh fuck
|
||||
template <typename Obj, typename... Args>
|
||||
struct Signature<void(Obj::*)(Args...) const> {
|
||||
static constexpr u32 N_Args = Tuple<Args...>::N_Elems;
|
||||
static constexpr u32 N_Args = sizeof...(Args);
|
||||
};
|
||||
|
||||
// Bruh
|
||||
template <typename F>
|
||||
constexpr u32 n_functor_args = Signature<decltype(&std::decay_t<F>::operator())>::N_Args;
|
||||
// -------- end C++ fuckery
|
||||
|
@ -39,6 +32,7 @@ template <typename T> T bswap_if_needed(T x) {
|
|||
return x;
|
||||
}
|
||||
|
||||
// Default display functions, used by the majority of fields
|
||||
template <typename T>
|
||||
String8_Node *hover_display_val_be(Arena *arena, String8_Node *prev, const char *fmt, T val)
|
||||
{
|
||||
|
@ -118,9 +112,8 @@ String8_Node *display_val_rootzip(Arena *arena, String8_Node *prev, const char *
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
using Display_Fn = String8_Node *(*)(Arena *, String8_Node *, const char *, T);
|
||||
|
||||
using Display_Range_Fn = String8_Node *(*)(Arena *, String8_Node *, const char *, const u8 *, u64);
|
||||
using Display_Fn = String8_Node *(*)(Arena *arena, String8_Node *prev, const char *fmt, T data);
|
||||
using Display_Range_Fn = String8_Node *(*)(Arena *arena, String8_Node *prev, const char *fmt, const u8 *data, u64 len);
|
||||
|
||||
enum Hover_Section_Flags {
|
||||
HoverSec_None = 0,
|
||||
|
@ -134,11 +127,13 @@ enum Hover_Section_Flags {
|
|||
struct Sec_Hover_Fn {
|
||||
u64 off; // the hovered offset relative to the start of `data`
|
||||
const u8 *data; // the entire file data
|
||||
const Section §ion;
|
||||
const Section §ion; // the section we're hovering
|
||||
Arena *arena;
|
||||
Sec_Hover_Info &info;
|
||||
Sec_Hover_Info &info; // our main output
|
||||
u64 &cur_field_off; // current field offset relative to the start of `data`
|
||||
// settings
|
||||
b8 display_grouped;
|
||||
// internals
|
||||
u8 cur_section_nesting = 0;
|
||||
u8 innermost_section_highlighted = 0;
|
||||
|
||||
|
@ -457,7 +452,7 @@ struct Sec_Hover_Fn {
|
|||
{
|
||||
frame<Frame_Record>(title, [this] {
|
||||
field<u16>("Column type: %s", [](Arena *arena, String8_Node *prev, const char *fmt, u16 val) {
|
||||
const char *readable_col_type = get_column_type_name(val);
|
||||
const char *readable_col_type = get_column_type_name_from_ondisk_type(val);
|
||||
return push_str8_node_child(arena, prev, fmt, readable_col_type);
|
||||
});
|
||||
field_le<u16>("Bits on storage: %u");
|
||||
|
@ -903,14 +898,16 @@ struct Sec_Hover_Fn {
|
|||
|
||||
void page()
|
||||
{
|
||||
// only try hovering a key if this is the first page of the cluster (<=> pre_size != 0)
|
||||
if (section.pre_size)
|
||||
tkey();
|
||||
b8 zipped;
|
||||
if (!maybe_rootzip(&zipped))
|
||||
return;
|
||||
range("Payload", section.range.len - section.post_size); // TODO: improve
|
||||
field_le<u64>("Checksum: 0x%" PRIX64);
|
||||
titled_section("Page", [this] {
|
||||
// only try hovering a key if this is the first page of the cluster (<=> pre_size != 0)
|
||||
if (section.pre_size)
|
||||
tkey();
|
||||
b8 zipped;
|
||||
if (!maybe_rootzip(&zipped))
|
||||
return;
|
||||
range("Payload", section.range.len - section.post_size); // TODO: improve
|
||||
field_le<u64>("Checksum: 0x%" PRIX64);
|
||||
});
|
||||
}
|
||||
|
||||
void page_list()
|
||||
|
@ -955,7 +952,6 @@ Sec_Hover_Info get_section_hover_info(Arena *arena, Section section, u64 off, co
|
|||
push_str8_node_child(arena, info.desc, "N. Elems: %d", abs(pinfo->n_elems));
|
||||
push_str8_node_child(arena, info.desc, "Bits per elem: %u", pinfo->bits_per_elem);
|
||||
push_str8_node_child(arena, info.desc, "-----------");
|
||||
} else {
|
||||
}
|
||||
|
||||
u64 cur_field_off = section.range.start - section.pre_size;
|
||||
|
|
|
@ -95,7 +95,7 @@ String8 build_fully_qualified_field_name(Arena *arena, const ROOT::Experimental:
|
|||
}
|
||||
|
||||
internal
|
||||
const char *get_column_type_name(u16 type)
|
||||
const char *get_column_type_name_from_ondisk_type(u16 type)
|
||||
{
|
||||
switch (type) {
|
||||
case 0x01: return "Index64";
|
||||
|
@ -169,7 +169,8 @@ void gather_ntuple_metadata(Arena *arena, RMicroFileReader &reader, const RNTupl
|
|||
|
||||
Cluster_Info *clusters = arena_push_array<Cluster_Info>(arena, descriptor.GetNActiveClusters());
|
||||
|
||||
const char *elem_type_name;
|
||||
// @ForeignAlloc
|
||||
std::string elem_type_name;
|
||||
|
||||
// gather clusters and pages metadata
|
||||
for (const RClusterDescriptor &cluster_desc : descriptor.GetClusterIterable()) {
|
||||
|
@ -178,7 +179,7 @@ void gather_ntuple_metadata(Arena *arena, RMicroFileReader &reader, const RNTupl
|
|||
|
||||
for (const RClusterDescriptor::RColumnRange &col_range : cluster_desc.GetColumnRangeIterable()) {
|
||||
const auto &col_descriptor = descriptor.GetColumnDescriptor(col_range.fPhysicalColumnId);
|
||||
elem_type_name = get_column_type_name((u16)col_descriptor.GetType());
|
||||
elem_type_name = RColumnElementBase::GetTypeName(col_descriptor.GetType());
|
||||
const auto &field_desc = descriptor.GetFieldDescriptor(col_descriptor.GetFieldId());
|
||||
const String8 owner_field_name = build_fully_qualified_field_name(arena, descriptor, &field_desc);
|
||||
|
||||
|
@ -194,7 +195,7 @@ void gather_ntuple_metadata(Arena *arena, RMicroFileReader &reader, const RNTupl
|
|||
// If in the future we get RNTuples with more than 4B clusters we can just change the type to u64.
|
||||
assert(cluster_desc.GetId() <= UINT_MAX);
|
||||
pinfo->cluster_id = cluster_desc.GetId();
|
||||
pinfo->elem_type_name = push_str8f(arena, "%s", elem_type_name);
|
||||
pinfo->elem_type_name = push_str8f(arena, "%s", elem_type_name.c_str());
|
||||
pinfo->owner_field_name = owner_field_name;
|
||||
pinfo->bits_per_elem = col_descriptor.GetBitsOnStorage();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue