changeset 654:9d360601b620

...
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 14 Aug 2020 17:29:19 +0900
parents 74a3d3a72c77
children 4846c5f8ccbf
files src/parallel_execution/examples/pop_and_push/StackTest.h src/parallel_execution/examples/pop_and_push/StackTestImpl.cbc src/parallel_execution/examples/pop_and_push/String.h src/parallel_execution/tools/static_gen_header.pl
diffstat 4 files changed, 40 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/examples/pop_and_push/StackTest.h	Fri Aug 14 17:02:47 2020 +0900
+++ b/src/parallel_execution/examples/pop_and_push/StackTest.h	Fri Aug 14 17:29:19 2020 +0900
@@ -1,5 +1,7 @@
 typedef struct StackTest <Type, Impl> {
   __code insertTest1(Impl* stackTest, struct Stack* stack, __code next(...));
   __code insertTest2(Impl* stackTest, struct Stack* stack, __code next(...));
-  __code next(....);
+  __code pop2Test(Impl* stackTest, struct Stack* stack, __code next(...));
+  __code pop2Test1(Impl* stackTest, union Data* data, union Data* data1, struct Stack* stack, __code next(...));
+  __code next(...);
 } StackTest;
--- a/src/parallel_execution/examples/pop_and_push/StackTestImpl.cbc	Fri Aug 14 17:02:47 2020 +0900
+++ b/src/parallel_execution/examples/pop_and_push/StackTestImpl.cbc	Fri Aug 14 17:29:19 2020 +0900
@@ -1,6 +1,9 @@
 #include "../../../context.h"
 #interface "StackTest.h"
 #interface "Stack.h"
+#include <stdio.h>
+
+#include "/Users/anatofuz/src/firefly/hg/Gears/Gears/src/parallel_execution/examples/pop_and_push/String.h"
 
 // ----
 // typedef struct StackTestImpl <Type, Isa> impl StackTest {
@@ -18,12 +21,37 @@
 }
 
 __code insertTest1_StackTestImpl(struct StackTestImpl* stackTest, struct Stack* stack, __code next(...)) {
-    Element* elem = NEW(Element);
-    goto stack->push((union Data*)elem, insertTest2_StackTestImpl);
+    String* str = NEW(String);
+    str->size = 99;
+    goto stack->push((union Data*)str, insertTest2_StackTestImpl);
 }
 
 __code insertTest2_StackTestImpl(struct StackTestImpl* stackTest, struct Stack* stack, __code next(...)) {
-  Element* elem = NEW(Element);
-  goto next(...);
+    String* str = NEW(String);
+    str->size = 100;
+    goto stack->push((union Data*)str, pop2Test_StackTestImpl);
+}
+
+
+__code pop2Test_StackTestImpl(struct StackTestImpl* stackTest, struct Stack* stack, __code next(...)) {
+  goto stack->pop2(pop2Test1_StackTestImpl);
 }
 
+
+__code pop2Test1_StackTestImpl(struct StackTestImpl* 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 pop2Test1_StackTestImpl_stub(struct Context* context) {
+  struct StackTestImpl* stackTest = GearImpl(context, StackTest, stackTest);
+  Data* data = Gearef(context, Stack)->data;
+  Data* data1 = Gearef(context, Stack)->data1;
+  Stack* stack = Gearef(context, StackTest)->stack;
+  enum Code next = Gearef(context, StackTest)->next;
+  goto pop2Test1_StackTestImpl(context, stackTest, data, data1, stack, next);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parallel_execution/examples/pop_and_push/String.h	Fri Aug 14 17:29:19 2020 +0900
@@ -0,0 +1,4 @@
+typedef struct String {
+  char* str;
+  int size;
+} String;
--- a/src/parallel_execution/tools/static_gen_header.pl	Fri Aug 14 17:02:47 2020 +0900
+++ b/src/parallel_execution/tools/static_gen_header.pl	Fri Aug 14 17:29:19 2020 +0900
@@ -77,7 +77,7 @@
 
 sub emit_last {
   my $type = shift;
-  my $msg = "  __code next(....);\n";
+  my $msg = "  __code next(...);\n";
   $msg .= "} $type;\n";
   return $msg;
 }