mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-28 02:10:13 +00:00
begin working on watch window stylization for file system evaluations
This commit is contained in:
@@ -134,8 +134,6 @@ E_ExprKindTable:
|
||||
{ Array Null 0 "array" "" "" "" }
|
||||
{ Func Null 0 "function" "" "" "" }
|
||||
|
||||
{ Line Binary 1 ":" "" ":" "" }
|
||||
|
||||
{ Define Binary 13 "=" "" "=" "" }
|
||||
|
||||
{ Tag Null 0 "=>" "=>" "," "" }
|
||||
|
||||
+15
-65
@@ -243,19 +243,25 @@ E_LOOKUP_ACCESS_FUNCTION_DEF(file)
|
||||
String8 member_name = rhs->string;
|
||||
if(str8_match(member_name, str8_lit("size"), 0))
|
||||
{
|
||||
result.irtree_and_type.root = e_irtree_const_u(arena, accel->props.size);
|
||||
E_Space space = e_space_make(E_SpaceKind_FileSystem);
|
||||
space.u64_0 = e_id_from_string(accel->file_path);
|
||||
result.irtree_and_type.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, accel->props.size));
|
||||
result.irtree_and_type.type_key = e_type_key_basic(E_TypeKind_U64);
|
||||
result.irtree_and_type.mode = E_Mode_Value;
|
||||
}
|
||||
else if(str8_match(member_name, str8_lit("last_modified_time"), 0))
|
||||
{
|
||||
result.irtree_and_type.root = e_irtree_const_u(arena, accel->props.modified);
|
||||
E_Space space = e_space_make(E_SpaceKind_FileSystem);
|
||||
space.u64_0 = e_id_from_string(accel->file_path);
|
||||
result.irtree_and_type.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, accel->props.modified));
|
||||
result.irtree_and_type.type_key = e_type_key_basic(E_TypeKind_U64);
|
||||
result.irtree_and_type.mode = E_Mode_Value;
|
||||
}
|
||||
else if(str8_match(member_name, str8_lit("creation_time"), 0))
|
||||
{
|
||||
result.irtree_and_type.root = e_irtree_const_u(arena, accel->props.created);
|
||||
E_Space space = e_space_make(E_SpaceKind_FileSystem);
|
||||
space.u64_0 = e_id_from_string(accel->file_path);
|
||||
result.irtree_and_type.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, accel->props.created));
|
||||
result.irtree_and_type.type_key = e_type_key_basic(E_TypeKind_U64);
|
||||
result.irtree_and_type.mode = E_Mode_Value;
|
||||
}
|
||||
@@ -2223,32 +2229,24 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
//- rjf: leaf file paths
|
||||
case E_ExprKind_LeafFilePath:
|
||||
{
|
||||
FileProperties props = os_properties_from_file_path(expr->string);
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8 file_path = path_normalized_from_string(scratch.arena, expr->string);
|
||||
FileProperties props = os_properties_from_file_path(file_path);
|
||||
if(props.flags & FilePropertyFlag_IsFolder)
|
||||
{
|
||||
E_Space space = e_space_make(E_SpaceKind_FileSystem);
|
||||
result.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, e_id_from_string(expr->string)));
|
||||
result.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, e_id_from_string(file_path)));
|
||||
result.type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = str8_lit("folder"));
|
||||
result.mode = E_Mode_Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
E_Space space = e_space_make(E_SpaceKind_FileSystem);
|
||||
result.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, e_id_from_string(expr->string)));
|
||||
result.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, e_id_from_string(file_path)));
|
||||
result.type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = str8_lit("file"));
|
||||
result.mode = E_Mode_Value;
|
||||
#if 0
|
||||
U128 key = fs_key_from_path_range(expr->string, r1u64(0, max_U64));
|
||||
E_Space space = {E_SpaceKind_HashStoreKey, .u128 = key};
|
||||
U64 size = props.size;
|
||||
E_IRNode *base_offset = e_irtree_const_u(arena, 0);
|
||||
base_offset->space = space;
|
||||
result.root = base_offset;
|
||||
result.root->string = push_str8_copy(arena, expr->string);
|
||||
result.type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), size);
|
||||
result.mode = E_Mode_Offset;
|
||||
#endif
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
|
||||
//- rjf: types
|
||||
@@ -2268,54 +2266,6 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, expr->location, "Type expression not expected.");
|
||||
}break;
|
||||
|
||||
//- rjf: textual line slicing
|
||||
case E_ExprKind_Line:
|
||||
{
|
||||
E_Expr *lhs = expr->first;
|
||||
E_Expr *rhs = expr->last;
|
||||
E_IRTreeAndType lhs_irtree = e_irtree_and_type_from_expr(arena, lhs);
|
||||
U64 line_num = rhs->value.u64;
|
||||
B32 space_is_good = 1;
|
||||
E_Space space = {0};
|
||||
if(lhs_irtree.root->op != E_IRExtKind_SetSpace)
|
||||
{
|
||||
space_is_good = 0;
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, lhs->location, "Cannot take a line from a non-file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MemoryCopy(&space, &lhs_irtree.root->value, sizeof(space));
|
||||
}
|
||||
B32 line_num_is_good = 1;
|
||||
if(rhs->kind != E_ExprKind_LeafU64)
|
||||
{
|
||||
line_num_is_good = 0;
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, rhs->location, "Line number must be specified as a constant number.");
|
||||
}
|
||||
if(space_is_good && line_num_is_good)
|
||||
{
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
U128 key = space.u128;
|
||||
U128 hash = {0};
|
||||
TXT_TextInfo text_info = txt_text_info_from_key_lang(txt_scope, key, TXT_LangKind_Null, &hash);
|
||||
if(1 <= line_num && line_num <= text_info.lines_count)
|
||||
{
|
||||
Rng1U64 line_range = text_info.lines_ranges[line_num-1];
|
||||
U64 line_size = dim_1u64(line_range);
|
||||
E_IRNode *line_offset = e_irtree_const_u(arena, line_range.min);
|
||||
result.root = line_offset;
|
||||
result.root->space = space;
|
||||
result.type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), line_size);
|
||||
result.mode = E_Mode_Offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, rhs->location, "Line %I64u is out of bounds.", line_num);
|
||||
}
|
||||
txt_scope_close(txt_scope);
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: definitions
|
||||
case E_ExprKind_Define:
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ str8_lit_comp("CharLiteral"),
|
||||
str8_lit_comp("Symbol"),
|
||||
};
|
||||
|
||||
String8 e_expr_kind_strings[51] =
|
||||
String8 e_expr_kind_strings[50] =
|
||||
{
|
||||
str8_lit_comp("Nil"),
|
||||
str8_lit_comp("Ref"),
|
||||
@@ -64,7 +64,6 @@ str8_lit_comp("TypeIdent"),
|
||||
str8_lit_comp("Ptr"),
|
||||
str8_lit_comp("Array"),
|
||||
str8_lit_comp("Func"),
|
||||
str8_lit_comp("Line"),
|
||||
str8_lit_comp("Define"),
|
||||
str8_lit_comp("Tag"),
|
||||
};
|
||||
@@ -84,7 +83,7 @@ str8_lit_comp("Insufficient evaluation machine stack space."),
|
||||
str8_lit_comp("Malformed bytecode."),
|
||||
};
|
||||
|
||||
E_OpInfo e_expr_kind_op_info_table[51] =
|
||||
E_OpInfo e_expr_kind_op_info_table[50] =
|
||||
{
|
||||
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
|
||||
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
|
||||
@@ -134,7 +133,6 @@ E_OpInfo e_expr_kind_op_info_table[51] =
|
||||
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
|
||||
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
|
||||
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
|
||||
{ E_OpKind_Binary, 1, str8_lit_comp(""), str8_lit_comp(":"), str8_lit_comp("") },
|
||||
{ E_OpKind_Binary, 13, str8_lit_comp(""), str8_lit_comp("="), str8_lit_comp("") },
|
||||
{ E_OpKind_Null, 0, str8_lit_comp("=>"), str8_lit_comp(","), str8_lit_comp("") },
|
||||
};
|
||||
|
||||
@@ -139,7 +139,6 @@ E_ExprKind_TypeIdent,
|
||||
E_ExprKind_Ptr,
|
||||
E_ExprKind_Array,
|
||||
E_ExprKind_Func,
|
||||
E_ExprKind_Line,
|
||||
E_ExprKind_Define,
|
||||
E_ExprKind_Tag,
|
||||
E_ExprKind_COUNT,
|
||||
@@ -163,9 +162,9 @@ E_InterpretationCode_COUNT,
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 e_token_kind_strings[6];
|
||||
extern String8 e_expr_kind_strings[51];
|
||||
extern String8 e_expr_kind_strings[50];
|
||||
extern String8 e_interpretation_code_display_strings[11];
|
||||
extern E_OpInfo e_expr_kind_op_info_table[51];
|
||||
extern E_OpInfo e_expr_kind_op_info_table[50];
|
||||
extern U8 e_kind_basic_byte_size_table[56];
|
||||
extern String8 e_kind_basic_string_table[56];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user