Mercurial > hg > Gears > GearsAgda
changeset 174:f9ed0b8f7132
add enum Code next
author | mir3636 |
---|---|
date | Mon, 28 Nov 2016 17:07:19 +0900 |
parents | 8260b230dc2f |
children | 00107b452a04 |
files | src/parallel_execution/rb_tree.c |
diffstat | 1 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/rb_tree.c Thu Nov 24 20:51:32 2016 +0900 +++ b/src/parallel_execution/rb_tree.c Mon Nov 28 17:07:19 2016 +0900 @@ -78,11 +78,11 @@ &context->data[D_Stack]->stack); } -__code replaceNode1(struct Context* context, struct RedBlackTree* traverse, struct Node* node, struct Node* oldNode, struct Node* newNode, struct Node* newnewNode, int result) { +__code replaceNode1(struct Context* context, struct RedBlackTree* traverse, struct Node* node, struct Node* oldNode, struct Node* newNode, struct Node* newnewNode, int result, enum Code next) { if (result == EQ) { newNode->value = node->value; // go to stack clear - goto meta(context, context->next); + goto meta(context, next); } else if (result == GT) { traverse->current = oldNode->right; newNode->right = newnewNode; @@ -107,7 +107,8 @@ context->data[D_RedBlackTree]->RedBlackTree.current, context->data[D_RedBlackTree]->RedBlackTree.previous, newnewNode, - context->data[D_RedBlackTree]->RedBlackTree.result); + context->data[D_RedBlackTree]->RedBlackTree.result, + Gearef(context, Tree)->next); } __code insertNode(struct Context* context, struct RedBlackTree* traverse, struct Stack *nodeStack, struct Node* node, struct Node* newNode) { @@ -328,39 +329,40 @@ &context->data[D_RotateTree]->rotateTree); } -__code stackClear(struct Context* context, struct RedBlackTree* traverse,struct Stack *nodeStack) { +__code stackClear(struct Context* context, struct RedBlackTree* traverse,struct Stack *nodeStack, enum Code next) { traverse->current = 0; nodeStack->stack = (union Data*)traverse->nodeStack; - nodeStack->next = context->next; + nodeStack->next = next; goto meta(context, traverse->nodeStack->clear); } __code stackClear_stub(struct Context* context) { - goto stackClear(context, &context->data[D_RedBlackTree]->RedBlackTree,&context->data[D_Stack]->stack); + goto stackClear(context, &context->data[D_RedBlackTree]->RedBlackTree,&context->data[D_Stack]->stack, + Gearef(context, Tree)->next); } -__code getRedBlackTree(struct Context* context, struct RedBlackTree* traverse) { +__code getRedBlackTree(struct Context* context, struct RedBlackTree* traverse, enum Code next) { if (traverse->root) { traverse->current = traverse->root; goto meta(context, C_search); } - goto meta(context, traverse->next); + goto meta(context, next); } __code getRedBlackTree_stub(struct Context* context) { - goto getRedBlackTree(context, &context->data[D_RedBlackTree]->RedBlackTree); + goto getRedBlackTree(context, &context->data[D_RedBlackTree]->RedBlackTree, Gearef(context, Tree)->next); } -__code search(struct Context* context, struct RedBlackTree* traverse, struct Node* node) { +__code search(struct Context* context, struct RedBlackTree* traverse, struct Node* node, enum Code next) { // compare(context, traverse, traverse->current->key, node->key); traverse->result = compare(traverse->current, node); if (traverse->result == EQ) { *node = *traverse->current; - goto meta(context, traverse->next); + goto meta(context, next); } else if (traverse->result == GT) { traverse->current = traverse->current->right; } else { @@ -370,11 +372,11 @@ if (traverse->current) goto meta(context, C_search); - goto meta(context, traverse->next); + goto meta(context, next); } __code search_stub(struct Context* context) { - goto search(context, &context->data[D_RedBlackTree]->RedBlackTree, &context->data[D_Node]->node); + goto search(context, &context->data[D_RedBlackTree]->RedBlackTree, &context->data[D_Node]->node, Gearef(context, Tree)->next); } /* /\* __code delete(struct Context* context, struct Tree* tree) { *\/ */