mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-20 15:36:47 +00:00
begin sketching out live cfg mutation code, as replacement for frontend entity tree formation/mutation
This commit is contained in:
@@ -197,6 +197,13 @@ md_push_node(Arena *arena, MD_NodeKind kind, MD_NodeFlags flags, String8 string,
|
||||
return node;
|
||||
}
|
||||
|
||||
internal void
|
||||
md_node_insert_child(MD_Node *parent, MD_Node *prev_child, MD_Node *node)
|
||||
{
|
||||
node->parent = parent;
|
||||
DLLInsert_NPZ(&md_nil_node, parent->first, parent->last, prev_child, node, next, prev);
|
||||
}
|
||||
|
||||
internal void
|
||||
md_node_push_child(MD_Node *parent, MD_Node *node)
|
||||
{
|
||||
@@ -204,6 +211,19 @@ md_node_push_child(MD_Node *parent, MD_Node *node)
|
||||
DLLPushBack_NPZ(&md_nil_node, parent->first, parent->last, node, next, prev);
|
||||
}
|
||||
|
||||
internal void
|
||||
md_node_remove_child(MD_Node *parent, MD_Node *node)
|
||||
{
|
||||
DLLRemove_NPZ(&md_nil_node, parent->first, parent->last, node, next, prev);
|
||||
}
|
||||
|
||||
internal void
|
||||
md_node_insert_tag(MD_Node *parent, MD_Node *prev_child, MD_Node *node)
|
||||
{
|
||||
node->parent = parent;
|
||||
DLLInsert_NPZ(&md_nil_node, parent->first_tag, parent->last_tag, prev_child, node, next, prev);
|
||||
}
|
||||
|
||||
internal void
|
||||
md_node_push_tag(MD_Node *parent, MD_Node *node)
|
||||
{
|
||||
@@ -211,6 +231,12 @@ md_node_push_tag(MD_Node *parent, MD_Node *node)
|
||||
DLLPushBack_NPZ(&md_nil_node, parent->first_tag, parent->last_tag, node, next, prev);
|
||||
}
|
||||
|
||||
internal void
|
||||
md_node_remove_tag(MD_Node *parent, MD_Node *node)
|
||||
{
|
||||
DLLRemove_NPZ(&md_nil_node, parent->first_tag, parent->last_tag, node, next, prev);
|
||||
}
|
||||
|
||||
//- rjf: tree building helpers
|
||||
|
||||
internal MD_Node *
|
||||
@@ -229,6 +255,27 @@ md_list_push_ref(Arena *arena, MD_Node *list, MD_Node *ref_dst)
|
||||
return ref;
|
||||
}
|
||||
|
||||
internal void
|
||||
md_list_concat_in_place(MD_Node *dst, MD_Node **src)
|
||||
{
|
||||
if(!md_node_is_nil(dst->last) && !md_node_is_nil(src[0]->first))
|
||||
{
|
||||
dst->last->next = src[0]->first;
|
||||
src[0]->first->prev = dst->last;
|
||||
dst->last = src[0]->last;
|
||||
}
|
||||
else if(!md_node_is_nil(src[0]->first))
|
||||
{
|
||||
dst->first = src[0]->first;
|
||||
dst->last = src[0]->last;
|
||||
}
|
||||
for(MD_EachNode(child, src[0]->first))
|
||||
{
|
||||
child->parent = dst;
|
||||
}
|
||||
MemoryZeroStruct(src);
|
||||
}
|
||||
|
||||
//- rjf: tree introspection
|
||||
|
||||
internal MD_Node *
|
||||
|
||||
@@ -260,12 +260,17 @@ internal MD_NodeRec md_node_rec_depth_first(MD_Node *node, MD_Node *subtree_root
|
||||
|
||||
//- rjf: tree building
|
||||
internal MD_Node *md_push_node(Arena *arena, MD_NodeKind kind, MD_NodeFlags flags, String8 string, String8 raw_string, U64 src_offset);
|
||||
internal void md_node_insert_child(MD_Node *parent, MD_Node *prev_child, MD_Node *node);
|
||||
internal void md_node_push_child(MD_Node *parent, MD_Node *node);
|
||||
internal void md_node_remove_child(MD_Node *parent, MD_Node *node);
|
||||
internal void md_node_insert_tag(MD_Node *parent, MD_Node *prev_child, MD_Node *node);
|
||||
internal void md_node_push_tag(MD_Node *parent, MD_Node *node);
|
||||
internal void md_node_remove_tag(MD_Node *parent, MD_Node *node);
|
||||
|
||||
//- rjf: tree building helpers
|
||||
internal MD_Node *md_push_list(Arena *arena);
|
||||
internal MD_Node *md_list_push_ref(Arena *arena, MD_Node *list, MD_Node *ref_dst);
|
||||
internal void md_list_concat_in_place(MD_Node *dst, MD_Node **src);
|
||||
|
||||
//- rjf: tree introspection
|
||||
internal MD_Node * md_node_from_chain_string(MD_Node *first, MD_Node *opl, String8 string, StringMatchFlags flags);
|
||||
|
||||
Reference in New Issue
Block a user