annotate final_pre/src/context.h @ 11:ef87093f92d4

add pdf
author e155702
date Sun, 17 Feb 2019 17:13:37 +0900
parents 0e8b9646d43f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
1 /* Context definition */
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
2
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
3 #define ALLOCATE_SIZE 1024
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
4
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
5 enum Code {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
6 Code1,
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
7 Code2,
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
8 Allocator,
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
9 };
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
10
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
11 enum UniqueData {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
12 Allocate,
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
13 Tree,
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
14 };
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
15
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
16 struct Context {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
17 int codeNum;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
18 __code (**code) (struct Context *);
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
19 void* heap_start;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
20 void* heap;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
21 long dataSize;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
22 int dataNum;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
23 union Data **data;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
24 };
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
25
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
26 union Data {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
27 struct Tree {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
28 union Data* root;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
29 union Data* current;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
30 union Data* prev;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
31 int result;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
32 } tree;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
33 struct Node {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
34 int key;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
35 int value;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
36 enum Color {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
37 Red,
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
38 Black,
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
39 } color;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
40 union Data* left;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
41 union Data* right;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
42 } node;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
43 struct Allocate {
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
44 long size;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
45 enum Code next;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
46 } allocate;
0e8b9646d43f add final_pre
e155702
parents:
diff changeset
47 };