collapse register mode into being a thread space, unify process/thread/debugger read/write paths, keep differences in core eval read/write paths

This commit is contained in:
Ryan Fleury
2024-08-22 14:50:27 -07:00
parent a7cf64d5e2
commit acd7435553
12 changed files with 201 additions and 70 deletions
+6 -6
View File
@@ -6135,7 +6135,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
DF_ExpandKey parent_key = df_expand_key_make(5381, 1);
DF_ExpandKey key = df_expand_key_make(df_hash_from_expand_key(parent_key), 1);
DF_EvalVizBlockList viz_blocks = df_eval_viz_block_list_from_eval_view_expr_keys(scratch.arena, eval_view, &top_level_cfg_table, expr, parent_key, key);
U32 default_radix = (eval.space == E_Space_Regs ? 16 : 10);
DF_Entity *entity = eval.space ? (DF_Entity *)eval.space : &df_g_nil_entity;
U32 default_radix = (entity->kind == DF_EntityKind_Thread ? 16 : 10);
DF_EvalVizWindowedRowList viz_rows = df_eval_viz_windowed_row_list_from_viz_block_list(scratch.arena, eval_view, r1s64(0, 50), &viz_blocks);
//- rjf: animate
@@ -6314,8 +6315,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
if(ui_committed(sig))
{
String8 commit_string = str8(ws->hover_eval_txt_buffer, ws->hover_eval_txt_size);
E_Eval write_eval = e_eval_from_string(scratch.arena, commit_string);
B32 success = df_commit_eval_value(row_eval, write_eval);
B32 success = df_commit_eval_value_string(row_eval, commit_string);
if(success == 0)
{
DF_CmdParams params = df_cmd_params_from_window(ws);
@@ -8383,9 +8383,11 @@ df_append_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags flags, U32
// rjf: special case: push strings for textual string content
B32 did_content = 0;
B32 did_string = 0;
if(!did_content && ptee_has_string && !has_array)
{
did_content = 1;
did_string = 1;
U64 string_memory_addr = value_eval.value.u64;
U64 element_size = e_type_byte_size_from_key(direct_type_key);
U64 string_buffer_size = 1024;
@@ -8415,14 +8417,12 @@ df_append_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags flags, U32
}
// rjf: special case: push strings for symbols
B32 did_string = 0;
if(!did_content && symbol_name.size != 0 &&
((type_kind == E_TypeKind_Ptr && direct_type_kind == E_TypeKind_Void) ||
(type_kind == E_TypeKind_Ptr && direct_type_kind == E_TypeKind_Function) ||
(type_kind == E_TypeKind_Function)))
{
did_content = 1;
did_string = 1;
str8_list_push(arena, out, symbol_name);
space_taken += f_dim_from_tag_size_string(font, font_size, 0, 0, symbol_name).x;
}
@@ -8459,7 +8459,7 @@ df_append_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags flags, U32
// rjf: push pointer value
B32 did_ptr_value = 0;
if((!no_addr || !did_content) && (!(flags & DF_EvalVizStringFlag_ReadOnlyDisplayRules) || !did_string))
if((!no_addr || !did_content) && ((flags & DF_EvalVizStringFlag_ReadOnlyDisplayRules) || !did_string))
{
did_ptr_value = 1;
if(did_content)
+12 -10
View File
@@ -1264,6 +1264,14 @@ df_string_from_eval_viz_row_column(Arena *arena, DF_EvalView *ev, DF_EvalVizRow
result = df_value_string_from_eval(arena, !editable * DF_EvalVizStringFlag_ReadOnlyDisplayRules, default_radix, font, font_size, max_size_px, eval, row->member, row->cfg_table);
}break;
}
if(col->dequote_string &&
result.size >= 2 &&
result.str[0] == '"' &&
result.str[result.size-1] == '"')
{
result = str8_skip(str8_chop(result, 1), 1);
}
return result;
}
@@ -2169,10 +2177,12 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
// rjf: commit edited cell string
Vec2S64 tbl = v2s64(x, y);
switch((DF_WatchViewColumnKind)x)
DF_WatchViewColumn *col = df_watch_view_column_from_x(ewv, x);
switch(col->kind)
{
default:{}break;
case DF_WatchViewColumnKind_Expr:
if(modifiable)
{
DF_WatchViewPoint pt = df_watch_view_point_from_tbl(&blocks, tbl);
DF_Entity *watch = df_entity_from_expand_key_and_kind(pt.key, mutable_entity_kind);
@@ -2202,8 +2212,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
if(rows.first != 0)
{
E_Eval dst_eval = e_eval_from_expr(scratch.arena, rows.first->expr);
E_Eval src_eval = e_eval_from_string(scratch.arena, new_string);
success = df_commit_eval_value(dst_eval, src_eval);
success = df_commit_eval_value_string(dst_eval, new_string);
}
if(!success)
{
@@ -2800,13 +2809,6 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
DF_WatchViewTextEditState *cell_edit_state = df_watch_view_text_edit_state_from_pt(ewv, cell_pt);
B32 cell_selected = (row_selected && selection_tbl.min.x <= cell_pt.x && cell_pt.x <= selection_tbl.max.x);
String8 cell_pre_edit_string = df_string_from_eval_viz_row_column(scratch.arena, eval_view, row, col, 0, default_radix, ui_top_font(), ui_top_font_size(), row_string_max_size_px);
if(col->dequote_string &&
cell_pre_edit_string.size >= 2 &&
cell_pre_edit_string.str[0] == '"' &&
cell_pre_edit_string.str[cell_pre_edit_string.size-1] == '"')
{
cell_pre_edit_string = str8_skip(str8_chop(cell_pre_edit_string, 1), 1);
}
//- rjf: unpack column-kind-specific info
E_Eval cell_eval = row_eval;