diff src/llrb/llrbContext.c @ 19:9302b1a48008

add llrb
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 21 Apr 2015 22:36:23 +0900
parents
children 324c44f2076f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/llrb/llrbContext.c	Tue Apr 21 22:36:23 2015 +0900
@@ -0,0 +1,22 @@
+#include "llrbContext.h"
+extern __code code1(struct Context*);
+extern __code code2(struct Context*);
+extern __code meta(struct Context*);
+extern __code allocate(struct Context*);
+extern __code put(struct Context*);
+extern __code insert(struct Context*);
+extern __code exit_code(struct Context*);
+
+__code initLLRBContext(struct Context* context) {
+    context->codeSize = 3;
+    context->code[Code1]    = code1;
+    context->code[Code2]    = code2;
+    context->code[Allocate] = allocate;
+    context->code[Put]      = put;
+    context->code[Insert]   = insert;
+    context->code[Exit]     = exit_code;
+    
+    context->dataSize = 0;
+    context->data[context->dataSize] = context->heap;
+    context->heap += sizeof(struct Allocate);
+}