Mercurial > hg > Members > Moririn
diff 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 |
parents | src/parallel_execution/examples/add.cbc@59c694722ce6 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parallel_execution/examples/calc/add.cbc Mon Jul 24 16:52:09 2017 +0900 @@ -0,0 +1,18 @@ +#include "../../../context.h" +#include <stdio.h> +__code add(struct Integer* input1, struct Integer* input2, __code next(struct Integer* output, ...)) { + struct Integer* output = *O_output; + output->value = input1->value + input2->value; + printf("%d + %d = %d\n", input1->value, input2->value, output->value); + *O_output = output; + goto meta(context, next); +} + +__code add_stub(struct Context* context) { + Integer** O_output = (struct Integer **)&context->data[context->odg]; + goto add(context, + &context->data[context->idg]->Integer, + &context->data[context->idg + 1]->Integer, + context->next, + O_output); +}