Upgrade codegen

This commit is contained in:
Abdelrahman Said
2025-04-17 09:03:30 +01:00
parent aa04fab6ea
commit 3c32b247c0
15 changed files with 66 additions and 46 deletions

View File

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

View File

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

View File

@@ -0,0 +1 @@
return ({Ttitle}Node){{.item = item}};

View File

@@ -1,4 +1,4 @@
{T}Node *output = NULL;
{Ttitle}Node *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 = ({T}List){{0}};
*list = ({Ttitle}List){{0}};
goto RETURN_{Tupper}_LIST_POP_BACK;
}}

View File

@@ -1,4 +1,4 @@
{T}Node *output = NULL;
{Ttitle}Node *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 = ({T}List){{0}};
*list = ({Ttitle}List){{0}};
goto RETURN_{Tupper}_LIST_POP_FRONT;
}}

View File

@@ -2,7 +2,7 @@
return;
}}
{T}List node_list = {Tlower}_node_to_list(node);
{Ttitle}List 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;
{T}Node *last = list->last;
{Ttitle}Node *last = list->last;
if (last) {{
last->next = node_list.first;
}}

View File

@@ -2,7 +2,7 @@
return;
}}
{T}List node_list = {Tlower}_node_to_list(node);
{Ttitle}List 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;
{T}Node *first = list->first;
{Ttitle}Node *first = list->first;
if (first) {{
first->prev = node_list.last;
}}

View File

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

View File

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