Mercurial > hg > Gears > GearsAgda
annotate src/llrb/llrbContext.h @ 53:399ed10d1760
modify
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 11 Jun 2015 15:08:38 +0900 |
parents | 348148d8fdb1 |
children | 0299b90256e5 |
rev | line source |
---|---|
19 | 1 /* Context definition for llrb example */ |
2 | |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
3 #define ALLOCATE_SIZE 100 |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
4 |
19 | 5 enum Code { |
6 Code1, | |
7 Code2, | |
21 | 8 Code3, |
22
4c3c0ad4a75d
add benchmark method
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
9 Code4, |
4c3c0ad4a75d
add benchmark method
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
21
diff
changeset
|
10 Code5, |
46 | 11 Code6, |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
12 Allocator, |
19 | 13 Put, |
44 | 14 Replace, |
15 Insert, | |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
16 Compare, |
44 | 17 Create, |
24
7494c0b87ec4
implement insert of Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
23
diff
changeset
|
18 RotateL, |
7494c0b87ec4
implement insert of Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
23
diff
changeset
|
19 RotateR, |
7494c0b87ec4
implement insert of Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
23
diff
changeset
|
20 ColorFlip, |
27 | 21 FixUp, |
24
7494c0b87ec4
implement insert of Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
23
diff
changeset
|
22 ChangeRef, |
46 | 23 Get, |
24 Traverse, | |
19 | 25 Exit, |
26 }; | |
27 | |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
28 enum UniqueData { |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
29 Allocate, |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
30 Tree, |
42 | 31 Node, |
32 Next, | |
19 | 33 }; |
34 | |
35 struct Context { | |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
36 int codeNum; |
53 | 37 __code (**code) (struct Context*); |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
38 void* heap_start; |
19 | 39 void* heap; |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
40 long dataSize; |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
41 int dataNum; |
19 | 42 union Data **data; |
43 }; | |
44 | |
45 union Data { | |
21 | 46 long count; |
42 | 47 enum Code next; |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
48 struct Tree { |
42 | 49 struct Node* root; |
50 struct Node* current; | |
51 struct Node* prev; | |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
52 int result; |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
53 } tree; |
19 | 54 struct Node { |
55 int key; | |
56 int value; | |
23
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
57 enum Color { |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
58 Red, |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
59 Black, |
868c2918b634
Non Destructive llrb
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
22
diff
changeset
|
60 } color; |
42 | 61 struct Node* left; |
62 struct Node* right; | |
19 | 63 } node; |
64 struct Allocate { | |
65 long size; | |
66 enum Code next; | |
67 } allocate; | |
68 }; |