annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
409
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdio.h>
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include "../../../context.h"
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 extern int length;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 extern int split;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 extern int* array_ptr;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 __code createArray(__code next(struct Array* output, ...)) {
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 struct Array* output = *O_output;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 output->prefix = length/split;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 output->array = array_ptr;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 output->size = length;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 *O_output = output;
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 goto meta(context, context->next);
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 __code createArray_stub(struct Context* context) {
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 Array** O_output = (struct Array **)&context->data[context->odg];
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 goto createArray(context,
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 context->next,
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 O_output);
4d1e3697a6b8 Add twice cbc file
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 }