Mercurial > hg > Gears > GearsAgda
annotate src/list/listContext.h @ 35:2bdd8e2118c7
Add tail pointer to List data segment
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 05 May 2015 21:16:04 +0900 |
parents | c3314208d7b9 |
children | 2ff693c5563c |
rev | line source |
---|---|
34 | 1 /* Context definition for list example */ |
2 | |
3 #define ALLOCATE_SIZE 100 | |
4 | |
5 enum Code { | |
6 Code1, | |
7 Code2, | |
8 Code3, | |
9 Code4, | |
10 Code5, | |
11 Code6, | |
12 Allocator, | |
13 Append, | |
14 Traverse, | |
15 Delete, | |
16 Exit, | |
17 }; | |
18 | |
19 enum UniqueData { | |
20 Allocate, | |
21 List, | |
22 }; | |
23 | |
24 struct Context { | |
25 int codeNum; | |
26 __code (**code) (struct Context *); | |
27 void* heap_start; | |
28 void* heap; | |
29 long dataSize; | |
30 int dataNum; | |
31 union Data* head; | |
32 union Data** data; | |
33 }; | |
34 | |
35 union Data { | |
36 long count; | |
37 struct List { | |
38 union Data* head; | |
35
2bdd8e2118c7
Add tail pointer to List data segment
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
34
diff
changeset
|
39 union Data* tail; |
34 | 40 union Data* current; |
41 } list; | |
42 struct Element { | |
43 int value; | |
44 union Data* next; | |
45 } element; | |
46 struct Allocate { | |
47 long size; | |
48 enum Code next; | |
49 enum Code after_append; | |
50 enum Code after_delete; | |
51 enum Code after_traverse; | |
52 } allocate; | |
53 }; |