improved stability w.r.t. cfgs and ctrl entities expansion across changes

This commit is contained in:
Ryan Fleury
2025-02-21 18:14:02 -08:00
parent 1b4a5e529f
commit 8bca57ef7f
6 changed files with 224 additions and 93 deletions
+25 -1
View File
@@ -169,10 +169,34 @@ ctrl_handle_list_copy(Arena *arena, CTRL_HandleList *src)
internal String8
ctrl_string_from_handle(Arena *arena, CTRL_Handle handle)
{
String8 result = push_str8f(arena, "$%I64x_%I64x", handle.machine_id, handle.dmn_handle.u64[0]);
String8 result = push_str8f(arena, "$0x%I64x$0x%I64x", handle.machine_id, handle.dmn_handle.u64[0]);
return result;
}
internal CTRL_Handle
ctrl_handle_from_string(String8 string)
{
CTRL_Handle handle = {0};
{
Temp scratch = scratch_begin(0, 0);
U8 split = '$';
String8List parts = str8_split(scratch.arena, string, &split, 1, 0);
if(parts.first && parts.first->next)
{
CTRL_MachineID machine_id = 0;
DMN_Handle dmn_handle = {0};
if(try_u64_from_str8_c_rules(parts.first->string, &machine_id) &&
try_u64_from_str8_c_rules(parts.first->next->string, &dmn_handle.u64[0]))
{
handle.machine_id = machine_id;
handle.dmn_handle = dmn_handle;
}
}
scratch_end(scratch);
}
return handle;
}
////////////////////////////////
//~ rjf: Trap Type Functions