Mercurial > hg > Gears > GearsAgda
diff src/llrb/llrbContext.c @ 72:5c4b9d116eda
use stack for code segment
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 10 Nov 2015 01:59:04 +0900 |
parents | 368306e1bfed |
children | 2667c3251a00 |
line wrap: on
line diff
--- a/src/llrb/llrbContext.c Tue Oct 27 01:15:29 2015 +0900 +++ b/src/llrb/llrbContext.c Tue Nov 10 01:59:04 2015 +0900 @@ -19,6 +19,9 @@ extern __code colorFlip_stub(struct Context*); extern __code fixUp_stub(struct Context*); extern __code changeReference_stub(struct Context*); +extern __code balance1_stub(struct Context*); +extern __code balance2_stub(struct Context*); +extern __code balance3_stub(struct Context*); extern __code get_stub(struct Context*); extern __code delete_stub(struct Context*); extern __code deleteMax_stub(struct Context*); @@ -27,7 +30,7 @@ extern __code max_stub(struct Context*); extern __code exit_code(struct Context*); -__code initLLRBContext(struct Context* context) { +__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); @@ -50,12 +53,15 @@ context->code[ColorFlip] = colorFlip_stub; context->code[FixUp] = fixUp_stub; context->code[ChangeRef] = changeReference_stub; + context->code[Balance1] = balance1_stub; + context->code[Balance2] = balance2_stub; + context->code[Balance3] = balance3_stub; context->code[Get] = get_stub; - context->code[Delete] = delete_stub; - context->code[DeleteMax] = deleteMax_stub; - // context->code[DeleteMin] = deleteMin_stub; - context->code[Replace_d] = replaceNode_d_stub; - context->code[Max] = max_stub; + /* context->code[Delete] = delete_stub; */ + /* context->code[DeleteMax] = deleteMax_stub; */ + /* // context->code[DeleteMin] = deleteMin_stub; */ + /* context->code[Replace_d] = replaceNode_d_stub; */ + /* context->code[Max] = max_stub; */ context->code[Exit] = exit_code; context->heap = context->heapStart; @@ -76,4 +82,6 @@ tree->current = 0; tree->prev = 0; + context->node_stack = stack_init(sizeof(union Data*), num); + context->code_stack = stack_init(sizeof(enum Code), 100); }