changeset 207:7470b8382672

Fix compile error to stack_test
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 20 Dec 2016 17:55:49 +0900
parents bd11fa6891b6
children b6ffdd99e525
files src/parallel_execution/context.h src/parallel_execution/stack.h src/parallel_execution/test/stack_test.c
diffstat 3 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/context.h	Tue Dec 20 17:19:54 2016 +0900
+++ b/src/parallel_execution/context.h	Tue Dec 20 17:55:49 2016 +0900
@@ -1,6 +1,7 @@
 /* Context definition for llrb example */
 #ifndef CONTEXT_H
 #define CONTEXT_H
+#include <stdlib.h>
 #include <pthread.h>
 #ifdef USE_CUDA
 #include <cuda.h>
--- a/src/parallel_execution/stack.h	Tue Dec 20 17:19:54 2016 +0900
+++ b/src/parallel_execution/stack.h	Tue Dec 20 17:55:49 2016 +0900
@@ -1,1 +1,2 @@
+#include "context.h"
 extern union Data* createSingleLinkedStack(struct Context* context);
--- a/src/parallel_execution/test/stack_test.c	Tue Dec 20 17:19:54 2016 +0900
+++ b/src/parallel_execution/test/stack_test.c	Tue Dec 20 17:55:49 2016 +0900
@@ -2,7 +2,7 @@
 #include "../context.h"
 #include "../origin_cs.h"
 #include <assert.h>
-
+extern __code initContext(struct Context* context);
 
 __code stack_test1(struct Context* context, struct Task* task, struct Stack* stack) {
     task->code = C_stack_test1;
@@ -18,7 +18,7 @@
     context->data[D_Stack]->Stack.stack = (union Data*)stack;
     goto stack_test1(context,
             task,
-            context->data[D_Stack]->Stack.stack);
+            &context->data[D_Stack]->Stack.stack->Stack);
 }
 
 __code stack_test2(struct Context* context, struct Task* task, struct Stack* stack) {
@@ -29,32 +29,32 @@
 }
 
 __code stack_test2_stub(struct Context* context) {
-    assert(((struct Task)context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data)->code == C_stack_test1);
+    assert(context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data->Task.code == C_stack_test1);
     Task* task = &ALLOCATE(context, Task)->Task;
     goto stack_test2(context,
             task,
-            context->data[D_Stack]->Stack.stack);
+            &context->data[D_Stack]->Stack.stack->Stack);
 }
 
 __code stack_test3(struct Context* context, struct Stack* stack) {
     stack->next = C_stack_test4;
-    goto meta(context, stack->take)
+    goto meta(context, stack->pop);
 }
 
 __code stack_test3_stub(struct Context* context) {
-    assert(((struct Task)context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data)->code == C_stack_test2);
-    assert(((struct Task)context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data)->code == C_stack_test1);
+    assert(context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data->Task.code == C_stack_test2);
+    assert(context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data->Task.code == C_stack_test1);
     goto stack_test3(context,
-            context->data[D_Stack]->Stack.stack);
+            &context->data[D_Stack]->Stack.stack->Stack);
 }
 
 __code stack_test4(struct Context* context) {
-    goto meta(context, C_exit);
+    goto meta(context, C_exit_code);
 }
 
 __code stack_test4_stub(struct Context* context) {
-    assert(((struct Task)context->data[D_Stack]->stack.stack.data)->code == C_StackTest1);
-    assert(((struct Task)context->data[D_Stack]->stack.stack.last->data)->code == C_StackTest2);
+    assert(context->data[D_Stack]->Stack.stack->Stack.data->Task.code == C_stack_test1);
+    assert(context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data->Task.code == C_stack_test1);
     goto stack_test4(context);
 }