Mercurial > hg > Papers > 2017 > ikkun-sigos
view paper/src/context.c @ 10:a7d96c2f588b
Update
author | one |
---|---|
date | Sat, 22 Apr 2017 16:51:58 +0900 |
parents | 38b037c42c34 |
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->codeNum = Code3; context->code[Code1] = code1_stub; context->code[Code2] = code2_stub; context->code[Code3] = code3_stub; struct Worker* worker = ALLOC_DATA(context, Worker); worker->num = 0; worker->contexts = 0; struct Allocate* allocate = ALLOC_DATA(context, Allocate); allocate->size = 0; struct Tree* tree = ALLOC_DATA(context, Tree); tree->root = 0; struct Node* node = ALLOC_DATA(context, Node); node->key = 0; node->value = 0; node->left = 0; node->right = 0; }