Mercurial > hg > GearsTemplate
annotate src/parallel_execution/examples/calc/add.cbc @ 381:b81492c74d2b
Create examples directory
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 24 Jul 2017 16:52:09 +0900 (2017-07-24) |
parents | src/parallel_execution/examples/add.cbc@59c694722ce6 |
children | 929aa06a12f9 |
rev | line source |
---|---|
381
b81492c74d2b
Create examples directory
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
370
diff
changeset
|
1 #include "../../../context.h" |
349
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
2 #include <stdio.h> |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
3 __code add(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) { |
353
b07078bd1f2c
Add spawn Tasks to TaskManagerImpl
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
349
diff
changeset
|
4 struct Integer* output = *O_output; |
349
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
5 output->value = input1->value + input2->value; |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
6 printf("%d + %d = %d\n", input1->value, input2->value, output->value); |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
7 *O_output = output; |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
8 goto meta(context, next); |
344 | 9 } |
10 | |
349
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
11 __code add_stub(struct Context* context) { |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
12 Integer** O_output = (struct Integer **)&context->data[context->odg]; |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
13 goto add(context, |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
14 &context->data[context->idg]->Integer, |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
15 &context->data[context->idg + 1]->Integer, |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
16 context->next, |
01e0fa598ce3
Fix compile error but not work
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
347
diff
changeset
|
17 O_output); |
347 | 18 } |