Mercurial > hg > Papers > 2017 > atton-master
view paper/src/initLLRBContext.c @ 35:26c89a10de3c
Update TODO
author | atton <atton@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 28 Jan 2017 09:47:44 +0900 |
parents | 5510bb043a74 |
children |
line wrap: on
line source
__code initLLRBContext(struct Context* context, int num) { context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE; context->code = malloc(sizeof(__code*)*ALLOCATE_SIZE); context->data = malloc(sizeof(union Data*)*ALLOCATE_SIZE); context->heapStart = malloc(context->heapLimit); context->codeNum = Exit; context->code[Code1] = code1_stub; context->code[Code2] = code2_stub; context->code[Code3] = code3_stub; context->code[Code4] = code4; context->code[Code5] = code5; context->code[Find] = find; context->code[Not_find] = not_find; context->code[Code6] = code6; context->code[Put] = put_stub; context->code[Replace] = replaceNode_stub; context->code[Insert] = insertNode_stub; context->code[RotateL] = rotateLeft_stub; context->code[RotateR] = rotateRight_stub; context->code[InsertCase1] = insert1_stub; context->code[InsertCase2] = insert2_stub; context->code[InsertCase3] = insert3_stub; context->code[InsertCase4] = insert4_stub; context->code[InsertCase4_1] = insert4_1_stub; context->code[InsertCase4_2] = insert4_2_stub; context->code[InsertCase5] = insert5_stub; context->code[StackClear] = stackClear_stub; context->code[Exit] = exit_code; context->heap = context->heapStart; context->data[Allocate] = context->heap; context->heap += sizeof(struct Allocate); context->data[Tree] = context->heap; context->heap += sizeof(struct Tree); context->data[Node] = context->heap; context->heap += sizeof(struct Node); context->dataNum = Node; struct Tree* tree = &context->data[Tree]->tree; tree->root = 0; tree->current = 0; tree->deleted = 0; context->node_stack = stack_init(sizeof(struct Node*), 100); context->code_stack = stack_init(sizeof(enum Code), 100); }