Mercurial > hg > Gears > GearsAgda
diff src/parallel_execution/rb_tree.c @ 140:f31b4e4bf4bb
fixes
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 09 Nov 2016 13:26:53 +0900 |
parents | c13b07d15d86 |
children | 4f6a660c14a1 |
line wrap: on
line diff
--- a/src/parallel_execution/rb_tree.c Wed Nov 09 10:13:31 2016 +0900 +++ b/src/parallel_execution/rb_tree.c Wed Nov 09 13:26:53 2016 +0900 @@ -140,8 +140,7 @@ } __code insert2_stub(struct Context* context) { - struct SingleLinkedStack *nodeStack = (struct SingleLinkedStack*)context->data[Traverse]->traverse.nodeStack->stack; - goto insertCase2(context, &context->data[Traverse]->traverse, &context->data[Stack]->stack, &nodeStack->top->data->node); + goto insertCase2(context, &context->data[Traverse]->traverse, &context->data[Stack]->stack, &context->data[Stack]->stack.data->node); } __code insertCase3(struct Context* context, struct Traverse* traverse, struct Stack* nodeStack, struct Node* parent, struct Node* grandparent) { @@ -170,8 +169,8 @@ __code insert3_stub(struct Context* context) { goto insertCase3(context, &context->data[Traverse]->traverse, &context->data[Stack]->stack, - &context->data[Traverse]->traverse.nodeStack->data->node, - &context->data[Traverse]->traverse.nodeStack->data1->node + &context->data[Stack]->stack.data->node, + &context->data[Stack]->stack.data1->node ); } @@ -199,19 +198,18 @@ __code insert4_stub(struct Context* context) { goto insertCase4(context, &context->data[Traverse]->traverse, context->data[Traverse]->traverse.current, - &context->data[Traverse]->traverse.nodeStack->data->node, - &context->data[Traverse]->traverse.nodeStack->data1->node); + &context->data[Stack]->stack.data->node, + &context->data[Stack]->stack.data1->node); } -__code insertCase5(struct Context* context, struct Traverse* traverse) { - struct Stack* nodeStack = traverse->nodeStack; +__code insertCase5(struct Context* context, struct Traverse* traverse,struct Stack *nodeStack) { nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = InsertCase51; - goto meta(context, nodeStack->get2); + goto meta(context, traverse->nodeStack->get2); } __code insert5_stub(struct Context* context) { - goto insertCase5(context, &context->data[Traverse]->traverse); + goto insertCase5(context, &context->data[Traverse]->traverse, &context->data[Stack]->stack); } __code insertCase51(struct Context* context, struct Traverse* traverse, struct Node* current, struct Node* parent, struct Node* grandparent) { @@ -227,22 +225,20 @@ } __code insert51_stub(struct Context* context) { - struct Traverse* traverse = &context->data[Traverse]->traverse; - struct Node* parent = &traverse->nodeStack->data->node; - struct Node* grandparent = &traverse->nodeStack->data1->node; + struct Node* parent = &context->data[Stack]->stack.data->node; + struct Node* grandparent = &context->data[Stack]->stack.data1->node; goto insertCase51(context, &context->data[Traverse]->traverse, context->data[Traverse]->traverse.current, parent, grandparent); } // put rotateLeft's continuation as argument -__code rotateLeft(struct Context* context, struct Traverse* traverse) { - struct Stack* nodeStack = traverse->nodeStack; +__code rotateLeft(struct Context* context, struct Traverse* traverse,struct Stack* nodeStack) { nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = RotateL1; - goto meta(context, nodeStack->get); + goto meta(context, traverse->nodeStack->get); } __code rotateLeft_stub(struct Context* context) { - goto rotateLeft(context, &context->data[Traverse]->traverse); + goto rotateLeft(context, &context->data[Traverse]->traverse, &context->data[Stack]->stack); } __code rotateLeft1(struct Context* context, struct Node* node, struct Tree* tree, struct Traverse* traverse, struct Node* parent) { @@ -265,8 +261,7 @@ } __code rotateLeft1_stub(struct Context* context) { - struct Traverse* traverse = &context->data[Traverse]->traverse; - struct Node* parent = &traverse->nodeStack->data->node; + struct Node* parent = &context->data[Stack]->stack.data->node; goto rotateLeft1(context, context->data[Traverse]->traverse.current, &context->data[Tree]->tree, @@ -274,14 +269,14 @@ parent); } -__code rotateRight(struct Context* context, struct Traverse* traverse) { - struct Stack* nodeStack = traverse->nodeStack; +__code rotateRight(struct Context* context, struct Traverse* traverse,struct Stack *nodeStack) { + nodeStack->stack = (union Data*)traverse->nodeStack; nodeStack->next = RotateR1; - goto meta(context, nodeStack->get); + goto meta(context, traverse->nodeStack->get); } __code rotateRight_stub(struct Context* context) { - goto rotateRight(context, &context->data[Traverse]->traverse); + goto rotateLeft(context, &context->data[Traverse]->traverse, &context->data[Stack]->stack); } __code rotateRight1(struct Context* context, struct Node* node, struct Tree* tree, struct Traverse* traverse, struct Node* parent) { @@ -304,8 +299,7 @@ } __code rotateRight1_stub(struct Context* context) { - struct Traverse* traverse = &context->data[Traverse]->traverse; - struct Node* parent = &traverse->nodeStack->data->node; + struct Node* parent = &context->data[Stack]->stack.data->node; goto rotateRight1(context, context->data[Traverse]->traverse.current, &context->data[Tree]->tree,