some refactoring to hover
This commit is contained in:
parent
0b16048271
commit
4176cfe107
4 changed files with 56 additions and 32 deletions
|
@ -44,7 +44,7 @@ String8_Node *hover_display_datetime_str(Arena *arena, String8_Node *prev, const
|
|||
// datetime:
|
||||
// year (6b) | month (4b) | day (5b) | hour (5b) | min (6b) | sec (6b)
|
||||
u32 year = (datetime >> 26) + 1995;
|
||||
u32 month = ((datetime & 0x3ff'ffff) >> 22) - 1;
|
||||
u32 month = ((datetime & 0x3ff'ffff) >> 22);
|
||||
u32 day = (datetime & 0x3f'ffff) >> 17;
|
||||
u32 hour = (datetime & 0x1'ffff) >> 12;
|
||||
u32 min = (datetime & 0xfff) >> 6;
|
||||
|
@ -415,7 +415,7 @@ struct Sec_Hover_Fn {
|
|||
}
|
||||
}
|
||||
|
||||
b8 column_desc() const
|
||||
b8 column_desc(const char *title) const
|
||||
{
|
||||
if (display_grouped) {
|
||||
i64 size;
|
||||
|
@ -423,7 +423,7 @@ struct Sec_Hover_Fn {
|
|||
u64 col_desc_len = (u64)std::abs(size);
|
||||
if (roff < cur_field_off + col_desc_len) {
|
||||
info.rng = { start + cur_field_off, col_desc_len };
|
||||
return titled_section("Column", [this] {
|
||||
return titled_section(title, [this] {
|
||||
add_to_desc<i64>("Size: %" PRIi64 " B");
|
||||
add_to_desc<u16>("Column type: %s", [](Arena *arena, String8_Node *prev, const char *fmt, u16 val) {
|
||||
const char *readable_col_type = get_column_type_name(val);
|
||||
|
@ -472,33 +472,33 @@ struct Sec_Hover_Fn {
|
|||
}
|
||||
}
|
||||
|
||||
b8 schema_description() const
|
||||
template <typename F>
|
||||
b8 list_frame(F &&fn) const
|
||||
{
|
||||
return titled_section("Schema Description", [this] {
|
||||
if (list_frame_preamble())
|
||||
return true;
|
||||
// we need to read back the number of entries to know how long is the next section.
|
||||
u64 n_elems_off = cur_field_off - sizeof(u32);
|
||||
u32 n_elems;
|
||||
memcpy(&n_elems, data + start + n_elems_off, sizeof(n_elems));
|
||||
for (u32 i = 0; i < n_elems; ++i)
|
||||
if (fn())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
b8 schema_description(const char *title) const
|
||||
{
|
||||
return titled_section(title, [this] {
|
||||
// Fields
|
||||
if (list_frame_preamble())
|
||||
return true;
|
||||
// we need to read back the number of fields to know how long is the next section.
|
||||
u64 n_fields_off = cur_field_off - sizeof(u32);
|
||||
u32 n_fields;
|
||||
memcpy(&n_fields, data + start + n_fields_off, sizeof(n_fields));
|
||||
for (u32 i = 0; i < n_fields; ++i)
|
||||
if (field_desc())
|
||||
return true;
|
||||
|
||||
// Columns
|
||||
if (list_frame_preamble())
|
||||
return true;
|
||||
u64 n_columns_off = cur_field_off - sizeof(u32);
|
||||
u32 n_columns;
|
||||
memcpy(&n_columns, data + start + n_columns_off, sizeof(n_columns));
|
||||
for (u32 i = 0; i < n_columns; ++i)
|
||||
if (column_desc())
|
||||
return true;
|
||||
if (field<i64>("Size: %" PRIi64, hover_display_val_le_abs<i64>))
|
||||
return true;
|
||||
|
||||
return false; // TODO
|
||||
return list_frame([this] { return field_desc(); })
|
||||
|| list_frame([this] { return column_desc("Column"); })
|
||||
|| list_frame([this] { return column_desc("Alias Column"); })
|
||||
|| list_frame([this] {
|
||||
return field_le<u32>("Content identifier: %lu")
|
||||
|| field_le<u32>("Type version from: %lu")
|
||||
|| field_le<u32>("Type version to: %lu");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -659,8 +659,7 @@ Sec_Hover_Info get_section_hover_info(Arena *arena, Section section, u64 off, co
|
|||
|| hover.field_str8<u32>("Name: %s")
|
||||
|| hover.field_str8<u32>("Description: %s")
|
||||
|| hover.field_str8<u32>("ROOT version: %s")
|
||||
|| hover.schema_description()
|
||||
|| hover.range("Payload", section.range.len - hover.cur_field_off) // TODO
|
||||
|| hover.schema_description("Schema Description")
|
||||
|| hover.field_le<u64>("Checksum: 0x%" PRIX64)
|
||||
;
|
||||
}
|
||||
|
@ -668,6 +667,29 @@ Sec_Hover_Info get_section_hover_info(Arena *arena, Section section, u64 off, co
|
|||
}
|
||||
break;
|
||||
case Sec_RNTuple_Footer:
|
||||
if (!hover.tkey()) {
|
||||
b8 zipped;
|
||||
if (!hover.maybe_rootzip(&zipped)) {
|
||||
if (zipped) {
|
||||
hover.range("Payload", section.range.len - section.post_size)
|
||||
|| hover.field_le<u64>("Checksum: 0x%" PRIX64)
|
||||
;
|
||||
} else {
|
||||
hover.envelope_preamble()
|
||||
// NOTE: flags in principle require a more complex handling, but for now they are unused,
|
||||
// so they're always occupying only 8 bytes.
|
||||
|| hover.field_le<u64>("Flags: 0x%" PRIX64)
|
||||
|| hover.field_le<u64>("Header checksum: 0x%" PRIX64)
|
||||
|| hover.schema_description("Schema Extension")
|
||||
// TODO:
|
||||
// - list of column group record frames
|
||||
// - list of cluster group record frames
|
||||
|| hover.range("Payload", section.range.len - hover.cur_field_off)
|
||||
|| hover.field_le<u64>("Checksum: 0x%" PRIX64)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
case Sec_Page_List: {
|
||||
hover.tkey()
|
||||
|| hover.maybe_rootzip()
|
||||
|
|
|
@ -10,7 +10,7 @@ b8 init_imgui(GLFWwindow* window) {
|
|||
ImGui::StyleColorsDark();
|
||||
|
||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||
ImGui_ImplOpenGL3_Init("#version 400");
|
||||
ImGui_ImplOpenGL3_Init("#version 330");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ void update_and_render(Arena *arena, App_State &app, f32 delta_time_ms)
|
|||
void *content = app.inspected_file.mem + app.base_display_addr;
|
||||
u64 content_size = app.inspected_file.size - app.base_display_addr;
|
||||
app.last_pinfo = &invalid_pinfo;
|
||||
app.viewer.mem_edit.DrawContents(content, content_size, app.base_display_addr);
|
||||
app.viewer.mem_edit.DrawContents(content, std::min<u64>(5'287'500'000, content_size), app.base_display_addr);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
const ImGuiColorEditFlags edit_flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoLabel;
|
||||
|
|
|
@ -1223,9 +1223,11 @@ RMicroFileReader::GetNTupleProper(const char *ntupleName)
|
|||
// @Incomplete: each section has a differently-sized RBlob, we need to account for that!
|
||||
RTFString blobName { kBlobClassName };
|
||||
RTFKey dummy;
|
||||
// FIXME: it seems that sometimes even if IsBigFile() == false we get a big header size!
|
||||
if (fileHeader.IsBigFile())
|
||||
dummy.MakeBigKey();
|
||||
fileInfo.rblob_key_header_nbytes = dummy.GetHeaderSize() + blobName.GetSize() + 2 * RTFString{}.GetSize();
|
||||
printf("nbytes: %lu\n", fileInfo.rblob_key_header_nbytes);
|
||||
}
|
||||
// @----
|
||||
ReadBuffer(ntuple, objNbytes, offset);
|
||||
|
|
Loading…
Reference in a new issue