begin eliminating separate hook system for view rule uis; shift over to regular views, so there is just one codepath for all visualizers; move ui to event pump system, with permissions stack, so that callers of sub-ui-codepaths can mask off event consumption as needed

This commit is contained in:
Ryan Fleury
2024-08-26 09:56:47 -07:00
parent 74471e4b8d
commit 14f617db85
24 changed files with 1361 additions and 1248 deletions
+43
View File
@@ -71,6 +71,49 @@ e_raw_from_escaped_string(Arena *arena, String8 string)
return result;
}
internal String8
e_escaped_from_raw_string(Arena *arena, String8 string)
{
Temp scratch = scratch_begin(&arena, 1);
String8List parts = {0};
U64 start_split_idx = 0;
for(U64 idx = 0; idx <= string.size; idx += 1)
{
U8 byte = (idx < string.size) ? string.str[idx] : 0;
B32 split = 1;
String8 separator_replace = {0};
switch(byte)
{
default:{split = 0;}break;
case 0: {}break;
case '\a': {separator_replace = str8_lit("\\a");}break;
case '\b': {separator_replace = str8_lit("\\b");}break;
case '\f': {separator_replace = str8_lit("\\f");}break;
case '\n': {separator_replace = str8_lit("\\n");}break;
case '\r': {separator_replace = str8_lit("\\r");}break;
case '\t': {separator_replace = str8_lit("\\t");}break;
case '\v': {separator_replace = str8_lit("\\v");}break;
case '\\': {separator_replace = str8_lit("\\\\");}break;
case '"': {separator_replace = str8_lit("\\\"");}break;
case '?': {separator_replace = str8_lit("\\?");}break;
}
if(split)
{
String8 substr = str8_substr(string, r1u64(start_split_idx, idx));
start_split_idx = idx+1;
str8_list_push(scratch.arena, &parts, substr);
if(separator_replace.size != 0)
{
str8_list_push(scratch.arena, &parts, separator_replace);
}
}
}
StringJoin join = {0};
String8 result = str8_list_join(arena, &parts, &join);
scratch_end(scratch);
return result;
}
////////////////////////////////
//~ rjf: Message Functions
+2
View File
@@ -48,6 +48,7 @@ union E_Value
U64 u64;
U32 u32;
S64 s64;
S32 s32;
F64 f64;
F32 f32;
};
@@ -121,6 +122,7 @@ struct E_Module
internal U64 e_hash_from_string(U64 seed, String8 string);
internal String8 e_raw_from_escaped_string(Arena *arena, String8 string);
internal String8 e_escaped_from_raw_string(Arena *arena, String8 string);
#define e_value_u64(v) (E_Value){.u64 = (v)}
////////////////////////////////
+4
View File
@@ -750,6 +750,10 @@ e_append_strings_from_expr(Arena *arena, E_Expr *expr, String8List *out)
{
str8_list_pushf(arena, out, "0x%I64x", expr->value.u64);
}break;
case E_ExprKind_LeafFilePath:
{
str8_list_pushf(arena, out, "file:\"%S\"", e_escaped_from_raw_string(arena, expr->string));
}break;
case E_ExprKind_LeafF64:
{
str8_list_pushf(arena, out, "%f", expr->value.f64);