fix & simplify path/pt meta editing

This commit is contained in:
Ryan Fleury
2025-04-26 11:38:22 -07:00
parent 6a9d212e70
commit ea18e58903
4 changed files with 17 additions and 32 deletions
+5 -4
View File
@@ -330,7 +330,7 @@ RD_VocabInfo rd_vocab_info_table[316] =
{str8_lit_comp("enable_breakpoint"), str8_lit_comp(""), str8_lit_comp("Enable Breakpoint"), str8_lit_comp(""), RD_IconKind_CheckFilled},
{str8_lit_comp("disable_breakpoint"), str8_lit_comp(""), str8_lit_comp("Disable Breakpoint"), str8_lit_comp(""), RD_IconKind_CheckHollow},
{str8_lit_comp("add_watch_pin"), str8_lit_comp(""), str8_lit_comp("Add Watch Pin"), str8_lit_comp(""), RD_IconKind_Pin},
{str8_lit_comp("toggle_watch_pin"), str8_lit_comp(""), str8_lit_comp("Toggle Watch Pin"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("toggle_watch_pin"), str8_lit_comp(""), str8_lit_comp("Toggle Watch Pin"), str8_lit_comp(""), RD_IconKind_Pin},
{str8_lit_comp("add_auto_view_rule"), str8_lit_comp(""), str8_lit_comp("Add Auto View Rule"), str8_lit_comp(""), RD_IconKind_Binoculars},
{str8_lit_comp("set_next_statement"), str8_lit_comp(""), str8_lit_comp("Set Next Statement"), str8_lit_comp(""), RD_IconKind_RightArrow},
{str8_lit_comp("add_target"), str8_lit_comp(""), str8_lit_comp("Add Target"), str8_lit_comp(""), RD_IconKind_Target},
@@ -385,8 +385,8 @@ RD_NameSchemaInfo rd_name_schema_info_table[21] =
{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("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("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': path_pt,\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)\nx:\n{\n 'expression': code_string,\n 'source_location': path_pt,\n 'address_location': code_string,\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")},
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source':path, 'dest':path}")},
{str8_lit_comp("auto_view_rule"), str8_lit_comp("@collection_commands(add_auto_view_rule) @row_commands(remove_cfg) x:{'type':code_string, 'view_rule':code_string}")},
{str8_lit_comp("recent_project"), str8_lit_comp("x:{'path':path}")},
@@ -659,7 +659,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[212] =
{ str8_lit_comp("memory"), str8_lit_comp("Opens a Memory tab."), {0}, {0}, RD_CmdKindFlag_ListInUI|RD_CmdKindFlag_ListInIPCDocs|RD_CmdKindFlag_ListInTab},
};
struct {String8 string; RD_Binding binding;} rd_default_binding_table[108] =
struct {String8 string; RD_Binding binding;} rd_default_binding_table[109] =
{
{str8_lit_comp("kill_all"), {OS_Key_F5, 0 |OS_Modifier_Shift }},
{str8_lit_comp("step_into_inst"), {OS_Key_F11, 0 |OS_Modifier_Alt}},
@@ -764,6 +764,7 @@ struct {String8 string; RD_Binding binding;} rd_default_binding_table[108] =
{str8_lit_comp("toggle_watch_expr_at_mouse"), {OS_Key_D, 0 |OS_Modifier_Ctrl }},
{str8_lit_comp("toggle_watch_pin"), {OS_Key_F9, 0 |OS_Modifier_Ctrl }},
{str8_lit_comp("toggle_breakpoint"), {OS_Key_F9, 0 }},
{str8_lit_comp("add_address_breakpoint"), {OS_Key_F9, 0 |OS_Modifier_Shift }},
{str8_lit_comp("attach"), {OS_Key_F6, 0 |OS_Modifier_Shift }},
{str8_lit_comp("open_palette"), {OS_Key_F1, 0 }},
{str8_lit_comp("open_palette"), {OS_Key_P, 0 |OS_Modifier_Ctrl |OS_Modifier_Shift }},
+5 -4
View File
@@ -439,7 +439,7 @@ RD_VocabTable:
{
'label': code_string,
'condition': code_string,
'source_location': path_pt,
'source_location': string,
'address_location': code_string,
'hit_count': u64,
'address_range_size': @or(0, 1, 2, 4, 8) u64,
@@ -456,11 +456,11 @@ RD_VocabTable:
watch_pin,
```
@row_commands(duplicate_cfg, remove_cfg)
@collection_commands(add_watch_pin)
@collection_commands(add_watch_pin, toggle_watch_pin)
x:
{
'expression': code_string,
'source_location': path_pt,
'source_location': string,
'address_location': code_string,
}
```,
@@ -813,7 +813,7 @@ RD_CmdTable: // | | | |
//- rjf: watch pins
{AddWatchPin 1 1 0 0 "" Expr null Nil Null 0 0 0 0 1 1 1 Pin "add_watch_pin" "Add Watch Pin" "Places a watch pin at a given location (file path and line number or address)." "" "$watch_pins," }
{ToggleWatchPin 1 0 0 0 "" Expr null Nil Null 0 0 0 0 1 1 1 Binoculars "toggle_watch_pin" "Toggle Watch Pin" "Places or removes a watch pin at a given location (file path and line number or address)." "" "" }
{ToggleWatchPin 1 0 0 0 "" Expr null Nil Null 0 0 0 0 1 1 1 Pin "toggle_watch_pin" "Toggle Watch Pin" "Places or removes a watch pin at a given location (file path and line number or address)." "" "" }
//- rjf: auto view rule
{AddAutoViewRule 1 1 0 0 "" String null Nil Null 0 0 0 0 0 0 0 Binoculars "add_auto_view_rule" "Add Auto View Rule" "Adds a new auto view rule." "" "$auto_view_rules," }
@@ -1045,6 +1045,7 @@ RD_DefaultBindingTable:
//- rjf: breakpoints
{ "toggle_breakpoint" F9 0 0 0 }
{ "add_address_breakpoint" F9 0 shift 0 }
//- rjf: attaching
{ "attach" F6 0 shift 0 }
+7 -17
View File
@@ -1109,12 +1109,9 @@ rd_location_from_cfg(RD_Cfg *cfg)
RD_Cfg *addr_loc = rd_cfg_child_from_string(cfg, str8_lit("address_location"));
if(src_loc != &rd_nil_cfg)
{
dst_loc.file_path = src_loc->first->string;
try_s64_from_str8_c_rules(src_loc->first->first->string, &dst_loc.pt.line);
if(!try_s64_from_str8_c_rules(src_loc->first->first->first->string, &dst_loc.pt.column))
{
dst_loc.pt.column = 1;
}
String8TxtPtPair loc_description = str8_txt_pt_pair_from_string(src_loc->first->string);
dst_loc.file_path = loc_description.string;
dst_loc.pt = loc_description.pt;
}
else if(addr_loc != &rd_nil_cfg)
{
@@ -1681,13 +1678,9 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
child_schema = md_child_from_string(n->v, child_key, 0);
}
String8 child_type_name = child_schema->first->string;
if(str8_match(child_type_name, str8_lit("path_pt"), 0))
{
read_data = push_str8f(scratch.arena, "%S%s%S%s%S", cfg->first->string, cfg->first->string.size ? ":" : "", cfg->first->first->string, cfg->first->first->first->string.size ? ":" : "", cfg->first->first->first->string);
}
else if(str8_match(child_type_name, str8_lit("path"), 0) ||
str8_match(child_type_name, str8_lit("code_string"), 0) ||
str8_match(child_type_name, str8_lit("string"), 0))
if(str8_match(child_type_name, str8_lit("path"), 0) ||
str8_match(child_type_name, str8_lit("code_string"), 0) ||
str8_match(child_type_name, str8_lit("string"), 0))
{
read_data = cfg->first->string;
}
@@ -14991,10 +14984,7 @@ rd_frame(void)
if(file_path.size != 0 && pt.line != 0)
{
RD_Cfg *src_loc = rd_cfg_new(cfg, str8_lit("source_location"));
RD_Cfg *file = rd_cfg_new(src_loc, file_path);
RD_Cfg *line = rd_cfg_newf(file, "%I64d", pt.line);
RD_Cfg *col = rd_cfg_newf(line, "%I64d", pt.column);
(void)col;
rd_cfg_newf(src_loc, "%S:%I64d:%I64d", file_path, pt.line, pt.column);
}
else if(expr_string.size != 0)
{
-7
View File
@@ -257,13 +257,6 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema)
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, E_TypeFlag_IsPathText);
}
else if(str8_match(child_schema->first->string, str8_lit("path_pt"), 0))
{
Temp scratch = scratch_begin(&arena, 1);
String8 string = push_str8f(scratch.arena, "%S%s%S%s%S", child->first->string, child->first->string.size ? ":" : "", child->first->first->string, child->first->first->first->string.size ? ":" : "", child->first->first->first->string);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), string.size, E_TypeFlag_IsPathText);
scratch_end(scratch);
}
else if(str8_match(child_schema->first->string, str8_lit("string"), 0))
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, E_TypeFlag_IsPlainText);