diff src/parallel_execution/examples/twice/createArray.cbc @ 409:4d1e3697a6b8

Add twice cbc file
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Wed, 06 Sep 2017 22:01:27 +0900
parents
children 85b0ddbf458e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/parallel_execution/examples/twice/createArray.cbc	Wed Sep 06 22:01:27 2017 +0900
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#include "../../../context.h"
+
+extern int length;
+extern int split;
+extern int* array_ptr;
+
+__code createArray(__code next(struct Array* output, ...)) {
+    struct Array* output = *O_output;
+    output->prefix = length/split;
+    output->array  = array_ptr;
+    output->size   = length;
+    *O_output = output;
+    goto meta(context, context->next);
+}
+
+__code createArray_stub(struct Context* context) {
+    Array** O_output = (struct Array **)&context->data[context->odg];
+    goto createArray(context,
+                     context->next,
+                     O_output);
+}