Mercurial > hg > Gears > GearsAgda
comparison src/llrb/llrbContext.h @ 19:9302b1a48008
add llrb
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Apr 2015 22:36:23 +0900 |
parents | |
children | 324c44f2076f |
comparison
equal
deleted
inserted
replaced
18:ec4e7a81bddf | 19:9302b1a48008 |
---|---|
1 /* Context definition for llrb example */ | |
2 | |
3 enum Code { | |
4 Code1, | |
5 Code2, | |
6 Allocate, | |
7 Put, | |
8 Insert, | |
9 Exit, | |
10 }; | |
11 | |
12 enum Color { | |
13 Red, | |
14 Black, | |
15 }; | |
16 | |
17 struct Context { | |
18 int codeSize; | |
19 __code (**code) (struct Context *); | |
20 void* heap; | |
21 union Data* root; | |
22 int dataSize; | |
23 union Data **data; | |
24 }; | |
25 | |
26 union Data { | |
27 struct Node { | |
28 int key; | |
29 int value; | |
30 enum Color color; | |
31 union Data* left; | |
32 union Data* right; | |
33 } node; | |
34 struct Allocate { | |
35 long size; | |
36 enum Code next; | |
37 enum Code after_put; | |
38 int key; | |
39 int value; | |
40 } allocate; | |
41 }; |