Mercurial > hg > Gears > GearsAgda
changeset 139:c13b07d15d86
fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 09 Nov 2016 10:13:31 +0900 |
parents | 04a2f486a30d |
children | f31b4e4bf4bb |
files | src/parallel_execution/rb_tree.c |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/rb_tree.c Tue Nov 08 19:39:40 2016 +0900 +++ b/src/parallel_execution/rb_tree.c Wed Nov 09 10:13:31 2016 +0900 @@ -112,9 +112,12 @@ context->data[Traverse]->traverse.newNode); } -__code insertCase1(struct Context* context, struct Tree* tree, struct SingleLinkedStack* nodeStack) { - if (nodeStack->top != NULL) { - goto meta(context, InsertCase2); +__code insertCase1(struct Context* context,struct Traverse* traverse, struct Tree* tree, struct Stack* nodeStack) { + struct SingleLinkedStack* stack = (struct SingleLinkedStack*)traverse->nodeStack->stack; + if (stack->top != NULL) { + nodeStack->stack = (union Data*)traverse->nodeStack; + nodeStack->next = InsertCase2; + goto meta(context, traverse->nodeStack->get); } tree->root->color = Black; goto meta(context, StackClear); @@ -122,8 +125,9 @@ __code insert1_stub(struct Context* context) { goto insertCase1(context, + &context->data[Traverse]->traverse, &context->data[Tree]->tree, - &context->data[Traverse]->traverse.nodeStack->stack->singleLinkedStack); + &context->data[Stack]->stack); } __code insertCase2(struct Context* context, struct Traverse* traverse, struct Stack* nodeStack, struct Node* parent) { @@ -180,13 +184,13 @@ traverse->rotateNext = InsertCase5; nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = RotateL; - goto meta(context, nodeStack->get); + goto meta(context, nodeStack->pop); } else if ((current == parent->left) && (parent == grandparent->right)) { traverse->current = traverse->current->right; traverse->rotateNext = InsertCase5; nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = RotateR; - goto meta(context, nodeStack->get); + goto meta(context, nodeStack->pop); } traverse->current = current; @@ -203,7 +207,7 @@ struct Stack* nodeStack = traverse->nodeStack; nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = InsertCase51; - goto meta(context, nodeStack->pop2); + goto meta(context, nodeStack->get2); } __code insert5_stub(struct Context* context) {