comparison src/llrb/llrbContext.c @ 65:025fd6e90597

to the function call(allocate and compare)
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 14 Jul 2015 15:59:41 +0900
parents c469c5ed5b4d
children 368306e1bfed
comparison
equal deleted inserted replaced
64:89d760486188 65:025fd6e90597
7 extern __code code3_stub(struct Context*); 7 extern __code code3_stub(struct Context*);
8 extern __code code4(struct Context*); 8 extern __code code4(struct Context*);
9 extern __code code5(struct Context*); 9 extern __code code5(struct Context*);
10 extern __code code6_stub(struct Context*); 10 extern __code code6_stub(struct Context*);
11 extern __code meta(struct Context*); 11 extern __code meta(struct Context*);
12 extern __code allocate(struct Context*);
13 extern __code put_stub(struct Context*); 12 extern __code put_stub(struct Context*);
14 extern __code replaceNode_stub(struct Context*); 13 extern __code replaceNode_stub(struct Context*);
15 extern __code insertNode_stub(struct Context*); 14 extern __code insertNode_stub(struct Context*);
16 extern __code compare_stub(struct Context*);
17 extern __code rotateLeft_stub(struct Context*); 15 extern __code rotateLeft_stub(struct Context*);
18 extern __code rotateRight_stub(struct Context*); 16 extern __code rotateRight_stub(struct Context*);
19 extern __code colorFlip_stub(struct Context*); 17 extern __code colorFlip_stub(struct Context*);
20 extern __code fixUp_stub(struct Context*); 18 extern __code fixUp_stub(struct Context*);
21 extern __code changeReference_stub(struct Context*); 19 extern __code changeReference_stub(struct Context*);
23 extern __code traverse_stub(struct Context*); 21 extern __code traverse_stub(struct Context*);
24 extern __code exit_code(struct Context*); 22 extern __code exit_code(struct Context*);
25 23
26 __code initLLRBContext(struct Context* context) { 24 __code initLLRBContext(struct Context* context) {
27 context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE; 25 context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE;
28 context->next = malloc(sizeof(enum Code)*ALLOCATE_SIZE);
29 context->code = malloc(sizeof(__code*)*ALLOCATE_SIZE); 26 context->code = malloc(sizeof(__code*)*ALLOCATE_SIZE);
30 context->data = malloc(sizeof(union Data*)*ALLOCATE_SIZE); 27 context->data = malloc(sizeof(union Data*)*ALLOCATE_SIZE);
31 context->heapStart = malloc(context->heapLimit); 28 context->heapStart = malloc(context->heapLimit);
32 29
33 context->codeNum = Exit; 30 context->codeNum = Exit;
34 context->code[Code1] = code1_stub; 31 context->code[Code1] = code1_stub;
35 context->code[Code2] = code2_stub; 32 context->code[Code2] = code2_stub;
36 context->code[Code3] = code3_stub; 33 context->code[Code3] = code3_stub;
37 context->code[Code4] = code4; 34 context->code[Code4] = code4;
38 context->code[Code5] = code5; 35 context->code[Code5] = code5;
39 context->code[Allocator] = allocate;
40 context->code[Put] = put_stub; 36 context->code[Put] = put_stub;
41 context->code[Replace] = replaceNode_stub; 37 context->code[Replace] = replaceNode_stub;
42 context->code[Insert] = insertNode_stub; 38 context->code[Insert] = insertNode_stub;
43 context->code[Compare] = compare_stub;
44 context->code[RotateL] = rotateLeft_stub; 39 context->code[RotateL] = rotateLeft_stub;
45 context->code[RotateR] = rotateRight_stub; 40 context->code[RotateR] = rotateRight_stub;
46 context->code[ColorFlip] = colorFlip_stub; 41 context->code[ColorFlip] = colorFlip_stub;
47 context->code[FixUp] = fixUp_stub; 42 context->code[FixUp] = fixUp_stub;
48 context->code[ChangeRef] = changeReference_stub; 43 context->code[ChangeRef] = changeReference_stub;