view src/parallel_execution/examples/twice/createArray.cbc @ 548:4fdeb0afc187

tweak GearsExamples, generate_stubs
author anatofuz
date Fri, 11 Oct 2019 17:37:56 +0900
parents 1566caacdaae
children 39b5adbcd83f
line wrap: on
line source

#include <stdio.h>
#include "../../../context.h"
#interface "Timer.h"

extern int length;
extern int split;

__code createArray(__code next(struct Array* output, struct Timer* output1, ...), struct LoopCounter* loopCounter) {
    int i = loopCounter->i;
    if (i == 0){
        output->array = (Int*)ALLOCATE_ARRAY(context, Int, length);
        output->prefix = length/split;
    }
    if (i == GET_LEN(output->array)){
        printf("created Array\n");
        loopCounter->i = 0;
        goto output1->start(next(...));
    }
    output->array[i] = i;
    loopCounter->i++;
    goto createArray();
}