annotate cbmc/insert_verification/include/cbmcLLRBContext.h @ 37:e27f4961281e

WIP: insert verification using cbmc (syntax valid)
author atton
date Mon, 13 Jun 2016 01:35:37 +0000
parents
children 517d1108f91f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
1 /* Context definition for llrb example */
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
2 #include "stack.h"
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
3
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
4 #define ALLOCATE_SIZE 20000000
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
5 #define LIMIT_OF_VERIFICATION_SIZE 5
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
6
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
7 enum Code {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
8 /* for CBMC */
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
9 VerifySpecification,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
10
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
11 /* definitions from llrb */
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
12 Allocator,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
13 Put,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
14 Replace,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
15 Insert,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
16 Compare,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
17 RotateL,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
18 RotateR,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
19 SetTree,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
20 InsertCase1,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
21 InsertCase2,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
22 InsertCase3,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
23 InsertCase4,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
24 InsertCase4_1,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
25 InsertCase4_2,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
26 InsertCase5,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
27 StackClear,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
28 Get,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
29 Search,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
30 Delete,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
31 Delete1,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
32 Delete2,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
33 Delete3,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
34 Replace_d1,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
35 Replace_d2,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
36 FindMax1,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
37 FindMax2,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
38 DeleteCase1,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
39 DeleteCase2,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
40 DeleteCase3,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
41 DeleteCase4,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
42 DeleteCase5,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
43 DeleteCase6,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
44 Exit,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
45 };
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
46
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
47 enum Relational {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
48 EQ,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
49 GT,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
50 LT,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
51 };
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
52
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
53 enum UniqueData {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
54 Allocate,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
55 Tree,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
56 Node,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
57 };
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
58
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
59 struct Context {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
60 enum Code next;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
61 enum Code prev;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
62 unsigned int codeNum;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
63 void (**code) (struct Context*);
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
64 void* heapStart;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
65 void* heap;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
66 unsigned long heapLimit;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
67 unsigned long dataNum;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
68 stack_ptr code_stack;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
69 stack_ptr node_stack;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
70 union Data **data;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
71
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
72 unsigned int loopCount;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
73 };
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
74
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
75 union Data {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
76 struct Comparable { // inteface
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
77 enum Code compare;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
78 union Data* data;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
79 } compare;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
80 struct Count {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
81 enum Code next;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
82 long i;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
83 } count;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
84 struct Tree {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
85 enum Code next;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
86 struct Node* root;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
87 struct Node* current;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
88 struct Node* deleted;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
89 int result;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
90 } tree;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
91 struct Node {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
92 // need to tree
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
93 enum Code next;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
94 int key; // comparable data segment
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
95 int value;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
96 struct Node* left;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
97 struct Node* right;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
98 // need to balancing
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
99 enum Color {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
100 Red,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
101 Black,
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
102 } color;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
103 } node;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
104 struct Allocate {
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
105 enum Code next;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
106 long size;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
107 } allocate;
e27f4961281e WIP: insert verification using cbmc (syntax valid)
atton
parents:
diff changeset
108 };