Mercurial > hg > Papers > 2015 > kkb-sigos
view paper/source/context.c @ 20:bb2bf03f09b4 default tip
add graffle files
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 04 Feb 2016 17:28:04 +0900 |
parents | bb5fab31cf41 |
children |
line wrap: on
line source
#include <stdlib.h> #include "context.h" extern __code code1(struct Context*); extern __code code2(struct Context*); extern __code allocate(struct Context*); __code initContext(struct Context* context) { context->dataSize = sizeof(union Data)*ALLOCATE_SIZE; context->code = malloc(sizeof(__code*)*ALLOCATE_SIZE); context->data = malloc(sizeof(union Data*)*ALLOCATE_SIZE); context->heap_start = malloc(context->dataSize); context->heap = context->heap_start; context->codeNum = 3; context->code[Code1] = code1; context->code[Code2] = code2; context->code[Allocator] = allocate; context->dataNum = 2; context->data[Allocate] = context->heap; context->heap += sizeof(struct Allocate); context->data[Tree] = context->heap; context->heap += sizeof(struct Tree); context->root = 0; context->current = 0; }