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

add final_pre
author e155702
date Sun, 17 Feb 2019 05:39:59 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/final_pre/src/rbtreeContext.h	Sun Feb 17 05:39:59 2019 +0900
@@ -0,0 +1,50 @@
+// DataSegments for Red-Black Tree
+union Data {
+    struct Comparable { // interface
+        enum Code compare;
+        union Data* data;
+    } compare;
+    struct Count {
+        enum Code next;
+        long i;
+    } count;
+    struct Tree {
+        enum Code next;
+        struct Node* root;
+        struct Node* current;
+        struct Node* deleted;
+        int result;
+    } tree;
+    struct Node {
+        // need to tree
+        enum Code next;
+        int key; // comparable data segment
+        int value;
+        struct Node* left;
+        struct Node* right;
+        // need to balancing
+        enum Color {
+            Red,
+            Black,
+        } color;
+    } node;
+    struct Allocate {
+        enum Code next;
+        long size;
+    } allocate;
+};
+
+
+// Meta DataSegment
+struct Context {
+    enum Code next;
+    int codeNum;
+    __code (**code) (struct Context*);
+    void* heapStart;
+    void* heap;
+    long heapLimit;
+    int dataNum;
+    stack_ptr code_stack;
+    stack_ptr node_stack;
+    union Data **data;
+};