view paper/src/initContext.c @ 3:86340b0bf212

Update
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Wed, 17 Jan 2018 08:48:10 +0900
parents
children
line wrap: on
line source

#include <stdlib.h>

#include "../context.h"

void 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->codeNum = Exit;

    // Code Gear Init
    context->code[C_code1]    = code1_stub;
    context->code[C_code2]    = code2_stub;
    ....


    // allocate Default Data Gear
    ALLOC_DATA(context, Context);
    ALLOC_DATA(context, Meta);
    ALLOC_DATA(context, Timer);
    ALLOC_DATA(context, TimerImpl);
    ...
    context->dataNum = 45;
}