add all visualizers to fixed tab list, derive language from view tree correctly rather than just the evaluation

This commit is contained in:
Ryan Fleury
2025-05-01 11:39:08 -07:00
parent 36e77e9691
commit 630394750e
5 changed files with 58 additions and 34 deletions
+24 -8
View File
@@ -4,7 +4,7 @@
//- GENERATED CODE
C_LINKAGE_BEGIN
String8 rd_tab_fast_path_view_name_table[20] =
String8 rd_tab_fast_path_view_name_table[24] =
{
str8_lit_comp("watch"),
str8_lit_comp("watch"),
@@ -24,11 +24,15 @@ str8_lit_comp("watch"),
str8_lit_comp("watch"),
str8_lit_comp("watch"),
str8_lit_comp("text"),
str8_lit_comp("text"),
str8_lit_comp("disasm"),
str8_lit_comp("memory"),
str8_lit_comp("bitmap"),
str8_lit_comp("color"),
str8_lit_comp("geo3d"),
};
String8 rd_tab_fast_path_query_name_table[20] =
String8 rd_tab_fast_path_query_name_table[24] =
{
str8_lit_comp(""),
str8_lit_comp("query:locals"),
@@ -50,9 +54,13 @@ str8_lit_comp("query:auto_view_rules"),
str8_lit_comp("query:output"),
str8_lit_comp(""),
str8_lit_comp(""),
str8_lit_comp(""),
str8_lit_comp(""),
str8_lit_comp(""),
str8_lit_comp(""),
};
RD_VocabInfo rd_vocab_info_table[329] =
RD_VocabInfo rd_vocab_info_table[333] =
{
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), RD_IconKind_Binoculars},
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
@@ -381,8 +389,12 @@ RD_VocabInfo rd_vocab_info_table[329] =
{str8_lit_comp("file_path_maps"), str8_lit_comp(""), str8_lit_comp("File Path Map"), str8_lit_comp(""), RD_IconKind_FileOutline},
{str8_lit_comp("auto_view_rules"), str8_lit_comp(""), str8_lit_comp("Auto View Rules"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("output"), str8_lit_comp(""), str8_lit_comp("Output"), str8_lit_comp(""), RD_IconKind_List},
{str8_lit_comp("text"), str8_lit_comp(""), str8_lit_comp("Text"), str8_lit_comp(""), RD_IconKind_FileOutline},
{str8_lit_comp("disasm"), str8_lit_comp(""), str8_lit_comp("Disassembly"), str8_lit_comp(""), RD_IconKind_Glasses},
{str8_lit_comp("memory"), str8_lit_comp(""), str8_lit_comp("Memory"), str8_lit_comp(""), RD_IconKind_Grid},
{str8_lit_comp("bitmap"), str8_lit_comp(""), str8_lit_comp("Bitmap"), str8_lit_comp(""), RD_IconKind_Bitmap},
{str8_lit_comp("color"), str8_lit_comp(""), str8_lit_comp("Color"), str8_lit_comp(""), RD_IconKind_Palette},
{str8_lit_comp("geo3d"), str8_lit_comp(""), str8_lit_comp("Geometry (3D)"), str8_lit_comp(""), RD_IconKind_Cube},
};
RD_NameSchemaInfo rd_name_schema_info_table[23] =
@@ -393,12 +405,12 @@ RD_NameSchemaInfo rd_name_schema_info_table[23] =
{str8_lit_comp("window"), str8_lit_comp("x:\n{\n //- rjf: text rasterization settings\n @default(1) @display_name('Smooth UI Text') @description(\"Controls whether or not UI text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_ui_text': bool,\n @default(1) @display_name('Hint UI Text') @description(\"Controls whether or not UI text is hinted, for better text readability at small sizes.\")\n 'hint_ui_text': bool,\n @default(0) @display_name('Smooth Code Text') @description(\"Controls whether or not code text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_code_text': bool,\n @default(1) @display_name('Hint Code Text') @description(\"Controls whether or not code text is hinted, for better text readability at small sizes.\")\n 'hint_code_text': bool,\n @default(11) @display_name('Window Font Size') @description(\"Controls the window's default font size. Does not apply to tabs with their own font size set.\")\n 'font_size': @range[6, 72] u64,\n\n //- rjf: size settings\n @default(3.f) @display_name('Window Row Height') @description(\"Controls the window's default row height, in multiples of the font size. Does not apply to tabs with their own row height set.\")\n 'row_height': @range[1.75f, 5.f] f32,\n @default(3.f) @description(\"Controls the height of tabs, in multiples of the font size.\")\n 'tab_height': @range[1.75f, 5.f] f32,\n}\n")},
{str8_lit_comp("tab"), str8_lit_comp("@expand_commands(duplicate_tab, close_tab)\nx:\n{\n @default(11) @display_name('Tab Font Size') @description(\"Controls the tab's font size.\")\n 'font_size': @range[6, 72] u64,\n}\n")},
{str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @default(3.f) @display_name('Tab Row Height') @description(\"Controls the tab's row height, in multiples of the font size.\")\n 'row_height': @range[1.75f, 5.f] f32,\n 'label': code_string,\n @description(\"The root expression which is evaluated to produce the watch window.\")\n 'expression': code_string,\n @no_expand 'watches': query,\n}\n")},
{str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': code_string,\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': lang,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n}\n")},
{str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the disassembly.\")\n 'expression': code_string,\n 'arch': arch,\n 'syntax': dasm_syntax,\n 'size': code_string,\n @default(1) @description(\"Controls whether or not addresses are shown in the disassembly text.\")\n 'show_addresses': bool,\n @default(0) @description(\"Controls whether or not code bytes are shown in the disassembly text.\")\n 'show_code_bytes': bool,\n @default(1) @description(\"Controls whether or not source lines, corresponding to disassembly instruction ranges, are shown in the disassembly text.\")\n 'show_source_lines': bool,\n @default(1) @description(\"Controls whether or not disassembly text is decorated with symbol names.\")\n 'show_symbol_names': bool,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers': bool,\n}\n")},
{str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': code_string,\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': code_string,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n}\n")},
{str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the disassembly.\")\n 'expression': code_string,\n 'arch': code_string,\n 'syntax': code_string,\n 'size': code_string,\n @default(1) @description(\"Controls whether or not addresses are shown in the disassembly text.\")\n 'show_addresses': bool,\n @default(0) @description(\"Controls whether or not code bytes are shown in the disassembly text.\")\n 'show_code_bytes': bool,\n @default(1) @description(\"Controls whether or not source lines, corresponding to disassembly instruction ranges, are shown in the disassembly text.\")\n 'show_source_lines': bool,\n @default(1) @description(\"Controls whether or not disassembly text is decorated with symbol names.\")\n 'show_symbol_names': bool,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers': bool,\n}\n")},
{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the memory view.\")\n 'expression': code_string,\n @description(\"The number of bytes of the viewed memory range.\")\n 'size': code_string,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n @default(1) @description(\"The number of bytes that each cell should represent.\")\n 'bytes_per_cell': @range[1, 8] u64,\n}\n")},
{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Base Pointer\") @description(\"An expression to describe the base address or offset of the bitmap data.\")\n 'expression': code_string,\n @order(0) 'w': u64,\n @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': tex2dformat,\n}\n")},
{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Base Pointer\") @description(\"An expression to describe the base address or offset of the bitmap data.\")\n 'expression': code_string,\n @order(0) 'w': u64,\n @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': code_string,\n}\n")},
{str8_lit_comp("color"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Value\") @description(\"An expression to describe the value or location of the color.\")\n 'expression': code_string,\n}\n")},
{str8_lit_comp("geo3d"), str8_lit_comp("@inherit(tab) x:\n{\n 'count': code_string,\n 'vtx': code_string,\n 'vtx_size': code_string,\n 'yaw': @range[0, 1] f32,\n 'pitch': @range[-0.5, 0] f32,\n 'zoom': @range[0, 100] f32,\n}\n")},
{str8_lit_comp("geo3d"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Expression\") @description(\"An expression to describe the base address of the index buffer.\")\n 'expression': code_string,\n 'count': code_string,\n 'vtx': code_string,\n 'vtx_size': code_string,\n 'yaw': @range[0, 1] f32,\n 'pitch': @range[-0.5, 0] f32,\n 'zoom': @range[0, 100] f32,\n}\n")},
{str8_lit_comp("target"), str8_lit_comp("@row_commands(enable_cfg, launch_and_run, launch_and_step_into, duplicate_cfg, remove_cfg)\n@collection_commands(add_target)\nx:\n{\n 'label': code_string,\n 'executable': path,\n 'arguments': string,\n 'working_directory': path,\n 'entry_point': code_string,\n 'stdout_path': path,\n 'stderr_path': path,\n 'stdin_path': path,\n 'environment': query,\n 'debug_subprocesses': bool,\n @no_expand @default(0) 'enabled': bool,\n}\n")},
{str8_lit_comp("breakpoint"), str8_lit_comp("@row_commands(enable_cfg, duplicate_cfg, remove_cfg)\n@collection_commands(toggle_breakpoint, add_breakpoint, add_address_breakpoint)\nx:\n{\n 'label': code_string,\n 'condition': code_string,\n 'source_location': string,\n 'address_location': code_string,\n 'hit_count': u64,\n 'address_range_size': @or(0, 1, 2, 4, 8) u64,\n 'break_on_write': bool,\n 'break_on_read': bool,\n 'break_on_execute': bool,\n @no_expand @default(1) 'enabled': bool,\n}\n")},
{str8_lit_comp("watch_pin"), str8_lit_comp("@row_commands(duplicate_cfg, remove_cfg)\n@collection_commands(add_watch_pin, toggle_watch_pin)\nx:\n{\n 'expression': code_string,\n 'source_location': string,\n 'address_location': code_string,\n}\n")},
@@ -459,7 +471,7 @@ Rng1U64 rd_reg_slot_range_table[43] =
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
};
RD_CmdKindInfo rd_cmd_kind_info_table[221] =
RD_CmdKindInfo rd_cmd_kind_info_table[225] =
{
{0},
{ str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp(""), (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1)|(RD_CmdKindFlag_ListInTextPt*0)|(RD_CmdKindFlag_ListInTextRng*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Floating*1)|(RD_QueryFlag_Required*1), RD_RegSlot_Cfg, str8_lit_comp("query:targets"), str8_lit_comp(""), CTRL_EntityKind_Null}},
@@ -680,8 +692,12 @@ RD_CmdKindInfo rd_cmd_kind_info_table[221] =
{ str8_lit_comp("file_path_maps"), str8_lit_comp("Opens a File Path Map tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("auto_view_rules"), str8_lit_comp("Opens a Auto View Rules tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("output"), str8_lit_comp("Opens a Output tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("text"), str8_lit_comp("Opens a Text tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("disasm"), str8_lit_comp("Opens a Disassembly tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("memory"), str8_lit_comp("Opens a Memory tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("bitmap"), str8_lit_comp("Opens a Bitmap tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("color"), str8_lit_comp("Opens a Color tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
{ str8_lit_comp("geo3d"), str8_lit_comp("Opens a Geometry (3D) tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
};
struct {String8 string; RD_Binding binding;} rd_default_binding_table[111] =
+11 -3
View File
@@ -275,8 +275,12 @@ RD_CmdKind_OpenModules,
RD_CmdKind_OpenFilePathMaps,
RD_CmdKind_OpenAutoViewRules,
RD_CmdKind_OpenOutput,
RD_CmdKind_OpenText,
RD_CmdKind_OpenDisasm,
RD_CmdKind_OpenMemory,
RD_CmdKind_OpenBitmap,
RD_CmdKind_OpenColor,
RD_CmdKind_OpenGeo3D,
RD_CmdKind_COUNT,
RD_CmdKind_FirstTabFastPathCmd = RD_CmdKind_OpenWatch,
} RD_CmdKind;
@@ -629,8 +633,12 @@ X(modules) \
X(file_path_maps) \
X(auto_view_rules) \
Y(output, text, "query:output")\
Y(text, text, "")\
Y(disasm, disasm, "")\
Y(memory, memory, "")\
Y(bitmap, bitmap, "")\
Y(color, color, "")\
Y(geo3d, geo3d, "")\
Z(getting_started)\
#define rd_regs_lit_init_top \
@@ -678,9 +686,9 @@ Z(getting_started)\
.os_event = rd_regs()->os_event,\
C_LINKAGE_BEGIN
extern String8 rd_tab_fast_path_view_name_table[20];
extern String8 rd_tab_fast_path_query_name_table[20];
extern RD_VocabInfo rd_vocab_info_table[329];
extern String8 rd_tab_fast_path_view_name_table[24];
extern String8 rd_tab_fast_path_query_name_table[24];
extern RD_VocabInfo rd_vocab_info_table[333];
extern RD_NameSchemaInfo rd_name_schema_info_table[23];
extern Rng1U64 rd_reg_slot_range_table[43];
extern String8 rd_binding_version_remap_old_name_table[8];
+11 -5
View File
@@ -40,8 +40,12 @@ RD_WatchTabFastPathTable:
RD_ViewTabFastPathTable:
{
{Output "Output" output text "query:output" List }
{Text "Text" text text "" FileOutline }
{Disasm "Disassembly" disasm disasm "" Glasses }
{Memory "Memory" memory memory "" Grid }
{Bitmap "Bitmap" bitmap bitmap "" Bitmap }
{Color "Color" color color "" Palette }
{Geo3D "Geometry (3D)" geo3d geo3d "" Cube }
}
@table(name display_name name_lower icon)
@@ -437,7 +441,7 @@ RD_VocabTable:
@description("An expression to describe data which should be viewed as text or code.")
'expression': code_string,
@description("The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.")
'lang': lang,
'lang': code_string,
@default(1) @description("Controls whether or not line numbers are shown.")
'show_line_numbers':bool,
@default(0) @display_name('Transient') @description("Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.")
@@ -452,9 +456,9 @@ RD_VocabTable:
{
@description("An expression to describe the base address or offset of the disassembly.")
'expression': code_string,
'arch': arch,
'syntax': dasm_syntax,
'size': code_string,
'arch': code_string,
'syntax': code_string,
'size': code_string,
@default(1) @description("Controls whether or not addresses are shown in the disassembly text.")
'show_addresses': bool,
@default(0) @description("Controls whether or not code bytes are shown in the disassembly text.")
@@ -494,7 +498,7 @@ RD_VocabTable:
@order(0) 'w': u64,
@order(1) 'h': u64,
@display_name("Bitmap Format") @description("The pixel format that the bitmap data should be interpreted as being within.")
'fmt': tex2dformat,
'fmt': code_string,
}
```
}
@@ -513,6 +517,8 @@ RD_VocabTable:
```
@inherit(tab) x:
{
@display_name("Expression") @description("An expression to describe the base address of the index buffer.")
'expression': code_string,
'count': code_string,
'vtx': code_string,
'vtx_size': code_string,
-16
View File
@@ -5415,22 +5415,6 @@ rd_lang_kind_from_eval(E_Eval eval)
{
lang_kind = txt_lang_kind_from_extension(str8_skip_last_dot(file_path));
}
if(lang_kind == TXT_LangKind_Null)
{
E_Type *type = e_type_from_key__cached(eval.irtree.type_key);
if(type->kind == E_TypeKind_Lens)
{
for EachIndex(idx, type->count)
{
E_Expr *arg = type->args[idx];
if(arg->kind == E_ExprKind_Define && str8_match(arg->first->string, str8_lit("lang"), 0))
{
lang_kind = txt_lang_kind_from_extension(arg->first->next->string);
break;
}
}
}
}
scratch_end(scratch);
return lang_kind;
}
+12 -2
View File
@@ -1908,7 +1908,15 @@ RD_VIEW_UI_FUNCTION_DEF(text)
if(rd_regs()->mark.column == 0) { rd_regs()->mark.column = 1; }
Rng1U64 range = e_range_from_eval(eval);
rd_regs()->text_key = rd_key_from_eval_space_range(eval.space, range, 1);
rd_regs()->lang_kind = rd_lang_kind_from_eval(eval);
String8 lang = rd_view_cfg_from_string(str8_lit("lang"))->first->string;
if(lang.size == 0)
{
rd_regs()->lang_kind = rd_lang_kind_from_eval(eval);
}
else
{
rd_regs()->lang_kind = txt_lang_kind_from_extension(lang);
}
U128 hash = {0};
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, rd_regs()->text_key, rd_regs()->lang_kind, &hash);
String8 data = hs_data_from_hash(hs_scope, hash);
@@ -3307,6 +3315,7 @@ RD_VIEW_UI_FUNCTION_DEF(bitmap)
//- rjf: equip loading info
//
if(offset_range.max != offset_range.min &&
eval.string.size != 0 &&
eval.msgs.max_kind == E_MsgKind_Null &&
(u128_match(data_hash, u128_zero()) ||
r_handle_match(texture, r_handle_zero()) ||
@@ -3790,7 +3799,8 @@ RD_VIEW_UI_FUNCTION_DEF(geo3d)
//////////////////////////////
//- rjf: equip loading info
//
if(eval.msgs.max_kind == E_MsgKind_Null &&
if(eval.string.size != 0 &&
eval.msgs.max_kind == E_MsgKind_Null &&
(r_handle_match(idxs_buffer, r_handle_zero()) ||
r_handle_match(vtxs_buffer, r_handle_zero())))
{