comparison final_pre/src/rbtreeContext.h @ 7:0e8b9646d43f

add final_pre
author e155702
date Sun, 17 Feb 2019 05:39:59 +0900
parents
children
comparison
equal deleted inserted replaced
6:8f5d263c219b 7:0e8b9646d43f
1 // DataSegments for Red-Black Tree
2 union Data {
3 struct Comparable { // interface
4 enum Code compare;
5 union Data* data;
6 } compare;
7 struct Count {
8 enum Code next;
9 long i;
10 } count;
11 struct Tree {
12 enum Code next;
13 struct Node* root;
14 struct Node* current;
15 struct Node* deleted;
16 int result;
17 } tree;
18 struct Node {
19 // need to tree
20 enum Code next;
21 int key; // comparable data segment
22 int value;
23 struct Node* left;
24 struct Node* right;
25 // need to balancing
26 enum Color {
27 Red,
28 Black,
29 } color;
30 } node;
31 struct Allocate {
32 enum Code next;
33 long size;
34 } allocate;
35 };
36
37
38 // Meta DataSegment
39 struct Context {
40 enum Code next;
41 int codeNum;
42 __code (**code) (struct Context*);
43 void* heapStart;
44 void* heap;
45 long heapLimit;
46 int dataNum;
47 stack_ptr code_stack;
48 stack_ptr node_stack;
49 union Data **data;
50 };