mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-23 20:24:59 -07:00
mdesk layer extensions for mutable tree manipulations
This commit is contained in:
@@ -197,6 +197,21 @@ 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_insert_tag(MD_Node *parent, MD_Node *prev_child, MD_Node *node)
|
||||
{
|
||||
node->kind = MD_NodeKind_Tag;
|
||||
node->parent = parent;
|
||||
DLLInsert_NPZ(&md_nil_node, parent->first_tag, parent->last_tag, prev_child, node, next, prev);
|
||||
}
|
||||
|
||||
internal void
|
||||
md_node_push_child(MD_Node *parent, MD_Node *node)
|
||||
{
|
||||
@@ -207,10 +222,29 @@ md_node_push_child(MD_Node *parent, MD_Node *node)
|
||||
internal void
|
||||
md_node_push_tag(MD_Node *parent, MD_Node *node)
|
||||
{
|
||||
node->kind = MD_NodeKind_Tag;
|
||||
node->parent = parent;
|
||||
DLLPushBack_NPZ(&md_nil_node, parent->first_tag, parent->last_tag, node, next, prev);
|
||||
}
|
||||
|
||||
internal void
|
||||
md_unhook(MD_Node *node)
|
||||
{
|
||||
MD_Node *parent = node->parent;
|
||||
if(!md_node_is_nil(parent))
|
||||
{
|
||||
if(node->kind == MD_NodeKind_Tag)
|
||||
{
|
||||
DLLRemove_NPZ(&md_nil_node, parent->first_tag, parent->last_tag, node, next, prev);
|
||||
}
|
||||
else
|
||||
{
|
||||
DLLRemove_NPZ(&md_nil_node, parent->first, parent->last, node, next, prev);
|
||||
}
|
||||
node->parent = &md_nil_node;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: tree introspection
|
||||
|
||||
internal MD_Node *
|
||||
|
||||
@@ -270,8 +270,11 @@ 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_insert_tag(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_push_tag(MD_Node *parent, MD_Node *node);
|
||||
internal void md_unhook(MD_Node *node);
|
||||
|
||||
//- 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