changeset 717:1595fc808041

add StackTestImpl3
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 01 Sep 2020 15:59:32 +0900
parents 284fa7d7326e
children 7c79694229d3
files src/parallel_execution/examples/pop_and_push/StackTestImpl3.cbc src/parallel_execution/examples/pop_and_push/StackTestImpl3.h
diffstat 2 files changed, 59 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parallel_execution/examples/pop_and_push/StackTestImpl3.cbc	Tue Sep 01 15:59:32 2020 +0900
@@ -0,0 +1,56 @@
+#include "../../../context.h"
+#interface "StackTest.h"
+#interface "StackTest2.h"
+#interface "Stack.h"
+#include <stdio.h>
+
+#include "String.h"
+
+#impl "StackTest.h" for "StackTestImpl3.h"
+
+
+__code insertTest1(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(...)) {
+    String* str = NEW(String);
+    str->size = 99;
+    goto stack->push((union Data*)str, insertTest2);
+}
+
+__code insertTest2(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(...)) {
+    String* str = NEW(String);
+    str->size = 100;
+    goto stack->push((union Data*)str, pop2Test);
+}
+
+
+__code pop2Test(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(...)) {
+  goto stack->pop2(pop2Test1);
+}
+
+__code pop2Test3(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(union Data* data, union Data* data1, ...)) {
+  String* str = NEW(String);
+  str->size = 200;
+  String* str1 = NEW(String);
+  str1->size = 300;
+  data = (union Data*)str;
+  data1 = (union Data*)str1;
+
+  goto pop2Test1(stackTest, data, data1);
+}
+
+
+__code pop2Test1(struct StackTestImpl3* stackTest, union Data* data, union Data* data1, struct Stack* stack, __code next(...)) {
+    String* str = (String*)data;
+    String* str2 = (String*)data1;
+
+    printf("%d\n", str->size);
+    printf("%d\n", str2->size);
+    goto next(...);
+}
+
+
+__code insertTest3(struct StackTestImpl3* stackTest, struct Stack* stack, __code next(...)) {
+    StackTest2* stackTest2 = createStackTest2Impl(context);
+    String* str = NEW(String);
+    str->size = 100;
+    goto stackTest2->insertTest1((union Data*)str, pop2Test);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parallel_execution/examples/pop_and_push/StackTestImpl3.h	Tue Sep 01 15:59:32 2020 +0900
@@ -0,0 +1,3 @@
+typedef struct StackTestImpl3 <Type, Isa> impl StackTest {
+  __code next(....);
+} StackTestImpl3;