Update dbl_list codegen

This commit is contained in:
2025-04-19 20:54:04 +01:00
parent add2ba541d
commit 8dbdfa2094
10 changed files with 83 additions and 28 deletions

View File

@@ -2,8 +2,8 @@
return NULL;
}}
{Ttitle}Node *output = NULL;
{Ttitle}Node *current = list->first;
{NodeType} *output = NULL;
{NodeType} *current = list->first;
for (u64 i = 1; i <= index; ++i) {{
current = current->next;
}}

View File

@@ -10,16 +10,16 @@
return;
}}
{Ttitle}Node *dst_node = wapp_{Tlower}_list_get(list, index);
{NodeType} *dst_node = wapp_{Tlower}_list_get(list, index);
if (!dst_node) {{
return;
}}
{Ttitle}List node_list = {Tlower}_node_to_list(node);
{ListType} node_list = {Tlower}_node_to_list(node);
list->node_count += node_list.node_count;
{Ttitle}Node *prev = dst_node->prev;
{NodeType} *prev = dst_node->prev;
dst_node->prev = node_list.last;
prev->next = node_list.first;

View File

@@ -1 +1 @@
(({Ttitle}Node){{.item = ITEM_PTR}})
(({NodeType}){{.item = ITEM_PTR}})

View File

@@ -1,4 +1,4 @@
{Ttitle}Node *output = NULL;
{NodeType} *output = NULL;
if (!list || list->node_count == 0) {{
goto RETURN_{Tupper}_LIST_POP_BACK;
@@ -7,7 +7,7 @@
output = list->last;
if (list->node_count == 1) {{
*list = ({Ttitle}List){{0}};
*list = ({ListType}){{0}};
goto RETURN_{Tupper}_LIST_POP_BACK;
}}

View File

@@ -1,4 +1,4 @@
{Ttitle}Node *output = NULL;
{NodeType} *output = NULL;
if (!list || list->node_count == 0) {{
goto RETURN_{Tupper}_LIST_POP_FRONT;
@@ -7,7 +7,7 @@
output = list->first;
if (list->node_count == 1) {{
*list = ({Ttitle}List){{0}};
*list = ({ListType}){{0}};
goto RETURN_{Tupper}_LIST_POP_FRONT;
}}

View File

@@ -2,7 +2,7 @@
return;
}}
{Ttitle}List node_list = {Tlower}_node_to_list(node);
{ListType} node_list = {Tlower}_node_to_list(node);
if (list->node_count == 0) {{
*list = node_list;
@@ -11,7 +11,7 @@
list->node_count += node_list.node_count;
{Ttitle}Node *last = list->last;
{NodeType} *last = list->last;
if (last) {{
last->next = node_list.first;
}}

View File

@@ -2,7 +2,7 @@
return;
}}
{Ttitle}List node_list = {Tlower}_node_to_list(node);
{ListType} node_list = {Tlower}_node_to_list(node);
if (list->node_count == 0) {{
*list = node_list;
@@ -11,7 +11,7 @@
list->node_count += node_list.node_count;
{Ttitle}Node *first = list->first;
{NodeType} *first = list->first;
if (first) {{
first->prev = node_list.last;
}}

View File

@@ -1,4 +1,4 @@
{Ttitle}Node *output = NULL;
{NodeType} *output = NULL;
if (!list) {{
goto RETURN_{Tupper}_LIST_REMOVE;
}}

View File

@@ -1,4 +1,4 @@
{Ttitle}List output = {{.first = node, .last = node, .node_count = 1}};
{ListType} output = {{.first = node, .last = node, .node_count = 1}};
while (output.first->prev != NULL) {{
output.first = output.first->prev;