mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 22:08:41 +00:00
fix pointer dereference path in type-mode evaluation; carve out exception for lens visualization with string-pointers - in that case, we just want to apply a string size limitation & go to the regular string path; begin getting off old color slots
This commit is contained in:
+9
-2
@@ -749,7 +749,10 @@ E_TYPE_ACCESS_FUNCTION_DEF(default)
|
|||||||
l_restype_kind == E_TypeKind_RRef)
|
l_restype_kind == E_TypeKind_RRef)
|
||||||
{
|
{
|
||||||
new_tree = e_irtree_resolve_to_value(arena, l.mode, new_tree, l_restype);
|
new_tree = e_irtree_resolve_to_value(arena, l.mode, new_tree, l_restype);
|
||||||
mode = E_Mode_Offset;
|
if(l.mode != E_Mode_Null)
|
||||||
|
{
|
||||||
|
mode = E_Mode_Offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(r_value != 0 && !r_is_constant_value)
|
if(r_value != 0 && !r_is_constant_value)
|
||||||
{
|
{
|
||||||
@@ -1023,7 +1026,11 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *root_expr)
|
|||||||
}
|
}
|
||||||
result.root = new_tree;
|
result.root = new_tree;
|
||||||
result.type_key = r_type_direct;
|
result.type_key = r_type_direct;
|
||||||
result.mode = E_Mode_Offset;
|
result.mode = E_Mode_Null;
|
||||||
|
if(r_tree.mode == E_Mode_Value)
|
||||||
|
{
|
||||||
|
result.mode = E_Mode_Offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
|||||||
@@ -1604,6 +1604,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
|
|||||||
goto arrays_and_sets_and_structs;
|
goto arrays_and_sets_and_structs;
|
||||||
}
|
}
|
||||||
E_Type *type = e_type_from_key__cached(type_key);
|
E_Type *type = e_type_from_key__cached(type_key);
|
||||||
|
E_TypeKind element_type_kind = e_type_kind_from_key(e_type_key_unwrap(type->direct_type_key, E_TypeUnwrapFlag_All));
|
||||||
B32 lens_applied = 1;
|
B32 lens_applied = 1;
|
||||||
EV_StringParams lens_params = *params;
|
EV_StringParams lens_params = *params;
|
||||||
if(0){}
|
if(0){}
|
||||||
@@ -1624,6 +1625,15 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
|
|||||||
{
|
{
|
||||||
lens_params.flags |= EV_StringFlag_DisableAddresses;
|
lens_params.flags |= EV_StringFlag_DisableAddresses;
|
||||||
}
|
}
|
||||||
|
else if(str8_match(type->name, str8_lit("array"), 0) &&
|
||||||
|
type->count >= 1 &&
|
||||||
|
(((E_TypeKind_Char8 <= element_type_kind && element_type_kind <= E_TypeKind_UChar32) ||
|
||||||
|
element_type_kind == E_TypeKind_S8 ||
|
||||||
|
element_type_kind == E_TypeKind_U8)))
|
||||||
|
{
|
||||||
|
lens_params.limit_strings = 1;
|
||||||
|
lens_params.limit_strings_size = e_value_from_expr(type->args[0]).u64;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lens_applied = 0;
|
lens_applied = 0;
|
||||||
@@ -1821,6 +1831,12 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
|
|||||||
case 4: {string = str8_from_32(scratch.arena, str32_cstring((U32 *)string_buffer));}break;
|
case 4: {string = str8_from_32(scratch.arena, str32_cstring((U32 *)string_buffer));}break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: apply string size limitation
|
||||||
|
if(params->limit_strings)
|
||||||
|
{
|
||||||
|
string = str8_prefix(string, params->limit_strings_size);
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: escape and quote
|
// rjf: escape and quote
|
||||||
B32 string__is_escaped_and_quoted = (!(params->flags & EV_StringFlag_DisableStringQuotes) || depth > 0);
|
B32 string__is_escaped_and_quoted = (!(params->flags & EV_StringFlag_DisableStringQuotes) || depth > 0);
|
||||||
String8 string__escaped_and_quoted = string;
|
String8 string__escaped_and_quoted = string;
|
||||||
|
|||||||
@@ -246,6 +246,8 @@ struct EV_StringParams
|
|||||||
U32 min_digits;
|
U32 min_digits;
|
||||||
U8 digit_group_separator;
|
U8 digit_group_separator;
|
||||||
String8 filter;
|
String8 filter;
|
||||||
|
B32 limit_strings;
|
||||||
|
U64 limit_strings_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct EV_StringIterTask EV_StringIterTask;
|
typedef struct EV_StringIterTask EV_StringIterTask;
|
||||||
|
|||||||
@@ -3041,11 +3041,15 @@ rd_view_ui(Rng2F32 rect)
|
|||||||
{
|
{
|
||||||
rd_cmd(RD_CmdKind_OpenRecentProject, .cfg = cfg->id);
|
rd_cmd(RD_CmdKind_OpenRecentProject, .cfg = cfg->id);
|
||||||
}
|
}
|
||||||
else
|
else if(e_type_kind_from_key(e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative)) == E_TypeKind_Set)
|
||||||
{
|
{
|
||||||
rd_cmd(RD_CmdKind_PushQuery, .expr = e_string_from_expr(scratch.arena, eval.expr, str8_zero()));
|
rd_cmd(RD_CmdKind_PushQuery, .expr = e_string_from_expr(scratch.arena, eval.expr, str8_zero()));
|
||||||
}
|
}
|
||||||
}break;
|
else
|
||||||
|
{
|
||||||
|
did_cmd = 0;
|
||||||
|
}
|
||||||
|
}break;
|
||||||
case RD_EvalSpaceKind_MetaUnattachedProcess:
|
case RD_EvalSpaceKind_MetaUnattachedProcess:
|
||||||
{
|
{
|
||||||
U64 pid = eval.value.u128.u64[0];
|
U64 pid = eval.value.u128.u64[0];
|
||||||
|
|||||||
@@ -1739,8 +1739,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
UI_TagF("floating")
|
UI_TagF("floating")
|
||||||
{
|
{
|
||||||
TxtRng select_rng = txt_rng(*cursor, *mark);
|
TxtRng select_rng = txt_rng(*cursor, *mark);
|
||||||
Vec4F32 active_color = rd_rgba_from_theme_color(RD_ThemeColor_CodeLineNumbersSelected);
|
|
||||||
Vec4F32 inactive_color = rd_rgba_from_theme_color(RD_ThemeColor_CodeLineNumbers);
|
|
||||||
ui_set_next_fixed_x(floor_f32(params->margin_float_off_px + params->priority_margin_width_px + params->catchall_margin_width_px));
|
ui_set_next_fixed_x(floor_f32(params->margin_float_off_px + params->priority_margin_width_px + params->catchall_margin_width_px));
|
||||||
ui_set_next_pref_width(ui_px(params->line_num_width_px, 1.f));
|
ui_set_next_pref_width(ui_px(params->line_num_width_px, 1.f));
|
||||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||||
@@ -1756,7 +1754,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
line_num <= params->line_num_range.max;
|
line_num <= params->line_num_range.max;
|
||||||
line_num += 1, line_idx += 1)
|
line_num += 1, line_idx += 1)
|
||||||
{
|
{
|
||||||
Vec4F32 text_color = (select_rng.min.line <= line_num && line_num <= select_rng.max.line) ? active_color : inactive_color;
|
B32 line_is_selected = (select_rng.min.line <= line_num && line_num <= select_rng.max.line);
|
||||||
Vec4F32 bg_color = v4f32(0, 0, 0, 0);
|
Vec4F32 bg_color = v4f32(0, 0, 0, 0);
|
||||||
|
|
||||||
// rjf: line info on this line -> adjust bg color to visualize
|
// rjf: line info on this line -> adjust bg color to visualize
|
||||||
@@ -1785,7 +1783,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: build line num box
|
// rjf: build line num box
|
||||||
UI_TextColor(text_color) UI_BackgroundColor(bg_color)
|
UI_TagF(line_is_selected ? "" : "weak") UI_BackgroundColor(bg_color)
|
||||||
ui_build_box_from_stringf(UI_BoxFlag_DrawText|(UI_BoxFlag_DrawBackground*!!has_line_info), "%I64u##line_num", line_num);
|
ui_build_box_from_stringf(UI_BoxFlag_DrawText|(UI_BoxFlag_DrawBackground*!!has_line_info), "%I64u##line_num", line_num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2001,10 +1999,11 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
|||||||
Vec4F32 pin_color = rd_color_from_cfg(pin);
|
Vec4F32 pin_color = rd_color_from_cfg(pin);
|
||||||
if(pin_color.w == 0)
|
if(pin_color.w == 0)
|
||||||
{
|
{
|
||||||
pin_color = rd_rgba_from_theme_color(RD_ThemeColor_CodeDefault);
|
pin_color = ui_color_from_name(str8_lit("text"));
|
||||||
}
|
}
|
||||||
rd_code_label(0.8f, 1, rd_rgba_from_theme_color(RD_ThemeColor_CodeDefault), pin_expr);
|
Vec4F32 default_code_color = ui_color_from_name(str8_lit("code_default"));
|
||||||
rd_code_label(0.6f, 1, rd_rgba_from_theme_color(RD_ThemeColor_CodeDefault), eval_string);
|
rd_code_label(0.8f, 1, default_code_color, pin_expr);
|
||||||
|
rd_code_label(0.6f, 1, default_code_color, eval_string);
|
||||||
}
|
}
|
||||||
UI_Signal pin_sig = ui_signal_from_box(pin_box);
|
UI_Signal pin_sig = ui_signal_from_box(pin_box);
|
||||||
if(ui_key_match(pin_box_key, ui_hot_key()))
|
if(ui_key_match(pin_box_key, ui_hot_key()))
|
||||||
|
|||||||
Reference in New Issue
Block a user