view Paper/src/context.c @ 14:393c839f987b default tip

DONE
author soto <soto@cr.ie.u-ryukyu.ac.jp>
date Sat, 08 Jan 2022 12:41:39 +0900
parents c59202657321
children
line wrap: on
line source

#include <stdlib.h>

#include "context.h"

extern __code code1_stub(struct Context*);
extern __code code2_stub(struct Context*);
extern __code code3_stub(struct Context*);

__code initContext(struct Context* context) {
    context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE;
    context->code = (__code(**) (struct Context*)) NEWN(ALLOCATE_SIZE, void*);
    context->data = NEWN(ALLOCATE_SIZE, union Data*);
    context->heapStart = NEWN(context->heapLimit, char);
    context->heap = context->heapStart;

    context->code[Code1]      = code1_stub;
    context->code[Code2]      = code2_stub;
    context->code[Code3]      = code3_stub;

#include "dataGearInit.c"
    context->dataNum = 39;
    context->tasks = createSingleLinkedQueue(context);
}