Mercurial > hg > Papers > 2017 > mitsuki-prosym
view Paper/src/context.c @ 0:dbbe5ef644fb
add
author | mir3636 |
---|---|
date | Tue, 21 Nov 2017 19:56:10 +0900 |
parents | |
children | aa9a59aea7fa |
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; }