Upgrade codegen
This commit is contained in:
@@ -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;
|
||||
}}
|
||||
|
@@ -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;
|
||||
|
1
codegen/dbl_list/snippets/list_node
Normal file
1
codegen/dbl_list/snippets/list_node
Normal file
@@ -0,0 +1 @@
|
||||
return ({Ttitle}Node){{.item = item}};
|
@@ -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;
|
||||
}}
|
||||
|
||||
|
@@ -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;
|
||||
}}
|
||||
|
||||
|
@@ -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;
|
||||
}}
|
||||
|
@@ -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;
|
||||
}}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{T}Node *output = NULL;
|
||||
{Ttitle}Node *output = NULL;
|
||||
if (!list) {{
|
||||
goto RETURN_{Tupper}_LIST_REMOVE;
|
||||
}}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user