Mercurial > hg > Gears > GearsAgda
comparison src/llrb/llrbContext.c @ 73:2667c3251a00
implement llrb deletion
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 10 Nov 2015 10:21:37 +0900 |
parents | 5c4b9d116eda |
children | 97387904add9 |
comparison
equal
deleted
inserted
replaced
72:5c4b9d116eda | 73:2667c3251a00 |
---|---|
21 extern __code changeReference_stub(struct Context*); | 21 extern __code changeReference_stub(struct Context*); |
22 extern __code balance1_stub(struct Context*); | 22 extern __code balance1_stub(struct Context*); |
23 extern __code balance2_stub(struct Context*); | 23 extern __code balance2_stub(struct Context*); |
24 extern __code balance3_stub(struct Context*); | 24 extern __code balance3_stub(struct Context*); |
25 extern __code get_stub(struct Context*); | 25 extern __code get_stub(struct Context*); |
26 extern __code findMin_stub(struct Context*); | |
26 extern __code delete_stub(struct Context*); | 27 extern __code delete_stub(struct Context*); |
27 extern __code deleteMax_stub(struct Context*); | 28 extern __code replaceNode_d1_stub(struct Context*); |
28 extern __code deleteMin_stub(struct Context*); | 29 extern __code replaceNode_d2_stub(struct Context*); |
29 extern __code replaceNode_d_stub(struct Context*); | 30 extern __code replaceNode_d3_stub(struct Context*); |
30 extern __code max_stub(struct Context*); | 31 extern __code replaceNode_d4_stub(struct Context*); |
32 extern __code moveRedLeft1_stub(struct Context*); | |
33 extern __code moveRedLeft2_stub(struct Context*); | |
34 extern __code moveRedLeft3_stub(struct Context*); | |
35 extern __code moveRedRight1_stub(struct Context*); | |
36 extern __code moveRedRight2_stub(struct Context*); | |
37 extern __code deleteMin1_stub(struct Context*); | |
38 extern __code deleteMin2_stub(struct Context*); | |
31 extern __code exit_code(struct Context*); | 39 extern __code exit_code(struct Context*); |
32 | 40 |
33 __code initLLRBContext(struct Context* context, int num) { | 41 __code initLLRBContext(struct Context* context, int num) { |
34 context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE; | 42 context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE; |
35 context->code = malloc(sizeof(__code*)*ALLOCATE_SIZE); | 43 context->code = malloc(sizeof(__code*)*ALLOCATE_SIZE); |
36 context->data = malloc(sizeof(union Data*)*ALLOCATE_SIZE); | 44 context->data = malloc(sizeof(union Data*)*ALLOCATE_SIZE); |
37 context->heapStart = malloc(context->heapLimit); | 45 context->heapStart = malloc(context->heapLimit); |
38 | 46 |
39 context->codeNum = Exit; | 47 context->codeNum = Exit; |
40 context->code[Code1] = code1_stub; | 48 |
41 context->code[Code2] = code2_stub; | 49 context->code[Code1] = code1_stub; |
42 context->code[Code3] = code3_stub; | 50 context->code[Code2] = code2_stub; |
43 context->code[Code4] = code4; | 51 context->code[Code3] = code3_stub; |
44 context->code[Code5] = code5; | 52 context->code[Code4] = code4; |
45 context->code[Find] = find; | 53 context->code[Code5] = code5; |
46 context->code[Not_find] = not_find; | 54 context->code[Find] = find; |
47 context->code[Code6] = code6; | 55 context->code[Not_find] = not_find; |
48 context->code[Put] = put_stub; | 56 context->code[Code6] = code6; |
49 context->code[Replace] = replaceNode_stub; | 57 context->code[Put] = put_stub; |
50 context->code[Insert] = insertNode_stub; | 58 context->code[Replace] = replaceNode_stub; |
51 context->code[RotateL] = rotateLeft_stub; | 59 context->code[Insert] = insertNode_stub; |
52 context->code[RotateR] = rotateRight_stub; | 60 context->code[RotateL] = rotateLeft_stub; |
53 context->code[ColorFlip] = colorFlip_stub; | 61 context->code[RotateR] = rotateRight_stub; |
54 context->code[FixUp] = fixUp_stub; | 62 context->code[ColorFlip] = colorFlip_stub; |
55 context->code[ChangeRef] = changeReference_stub; | 63 context->code[FixUp] = fixUp_stub; |
56 context->code[Balance1] = balance1_stub; | 64 context->code[ChangeRef] = changeReference_stub; |
57 context->code[Balance2] = balance2_stub; | 65 context->code[Balance1] = balance1_stub; |
58 context->code[Balance3] = balance3_stub; | 66 context->code[Balance2] = balance2_stub; |
59 context->code[Get] = get_stub; | 67 context->code[Balance3] = balance3_stub; |
60 /* context->code[Delete] = delete_stub; */ | 68 context->code[Get] = get_stub; |
61 /* context->code[DeleteMax] = deleteMax_stub; */ | 69 context->code[Delete] = delete_stub; |
62 /* // context->code[DeleteMin] = deleteMin_stub; */ | 70 context->code[FindMin] = findMin_stub; |
63 /* context->code[Replace_d] = replaceNode_d_stub; */ | 71 context->code[Replace_d1] = replaceNode_d1_stub; |
64 /* context->code[Max] = max_stub; */ | 72 context->code[Replace_d2] = replaceNode_d2_stub; |
65 context->code[Exit] = exit_code; | 73 context->code[Replace_d3] = replaceNode_d3_stub; |
74 context->code[Replace_d4] = replaceNode_d4_stub; | |
75 context->code[MoveRedL1] = moveRedLeft1_stub; | |
76 context->code[MoveRedL2] = moveRedLeft2_stub; | |
77 context->code[MoveRedL3] = moveRedLeft3_stub; | |
78 context->code[MoveRedR1] = moveRedRight1_stub; | |
79 context->code[MoveRedR2] = moveRedRight2_stub; | |
80 context->code[DeleteMin1] = deleteMin1_stub; | |
81 context->code[DeleteMin2] = deleteMin2_stub; | |
82 context->code[Exit] = exit_code; | |
66 | 83 |
67 context->heap = context->heapStart; | 84 context->heap = context->heapStart; |
68 | 85 |
69 context->data[Allocate] = context->heap; | 86 context->data[Allocate] = context->heap; |
70 context->heap += sizeof(struct Allocate); | 87 context->heap += sizeof(struct Allocate); |