Mercurial > hg > Members > innparusu > Gears
view src/llrb/llrbContext.h @ 54:0299b90256e5
syntax suggest
author | kkb |
---|---|
date | Thu, 11 Jun 2015 17:23:50 +0900 |
parents | 399ed10d1760 |
children | c469c5ed5b4d |
line wrap: on
line source
/* Context definition for llrb example */ #define ALLOCATE_SIZE 100 enum Code { Code1, Code2, Code3, Code4, Code5, Code6, Allocator, Put, Replace, Insert, Compare, Create, RotateL, RotateR, ColorFlip, FixUp, ChangeRef, Get, Traverse, Exit, }; enum UniqueData { Allocate, Tree, Node, Next, }; struct Context { enum Code *next; int current; int codeNum; __code (**code) (struct Context*); void* heapStart; void* heap; long heapLimit; int dataNum; union Data **data; }; union Data { struct Comparable { // inteface enum Code compare; union Data* data; } struct Count { enum Code next; long count; } count; struct Tree { enum Code next; struct Node* root; struct Node* current; struct Node* prev; int result; } tree; struct Node { enum Code next; int key; // comparable data segment int value; enum Color { Red, Black, } color; struct Node* left; struct Node* right; } node; struct Allocate { enum Code next; long size; } allocate; };