comparison src/llrb/main.c @ 72:5c4b9d116eda

use stack for code segment
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 10 Nov 2015 01:59:04 +0900
parents 368306e1bfed
children 2667c3251a00
comparison
equal deleted inserted replaced
71:6e5b0e4245cc 72:5c4b9d116eda
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <sys/time.h> 3 #include <sys/time.h>
4 4
5 #include "llrbContext.h" 5 #include "llrbContext.h"
6 #include "origin_cs.h" 6 #include "origin_cs.h"
7 #include "stack.h"
8 7
9 static double st_time; 8 static double st_time;
10 static double ed_time; 9 static double ed_time;
11 static clock_t c1,c2; 10 static clock_t c1,c2;
12 11
13 int num; 12 int num;
14 stack_ptr node_stack;
15 13
16 extern __code initLLRBContext(struct Context* context); 14 extern __code initLLRBContext(struct Context* context, int);
17 extern void allocator(struct Context* context); 15 extern void allocator(struct Context* context);
18 16
19 static double getTime() { 17 static double getTime() {
20 struct timeval tv; 18 struct timeval tv;
21 gettimeofday(&tv, NULL); 19 gettimeofday(&tv, NULL);
124 } 122 }
125 123
126 __code code6(struct Context* context) { 124 __code code6(struct Context* context) {
127 printf("%p\n", context->data[Tree]->tree.current); 125 printf("%p\n", context->data[Tree]->tree.current);
128 126
129 stack_free(node_stack); 127 stack_free(context->node_stack);
130 128
131 goto meta(context, Exit); 129 goto meta(context, Exit);
132 } 130 }
133 131
134 int main(int argc, char** argv) { 132 int main(int argc, char** argv) {
135 num = (int)atoi(argv[1]); 133 num = (int)atoi(argv[1]);
136 node_stack = stack_init(sizeof(union Data*), num);
137 struct Context* context = (struct Context*)malloc(sizeof(struct Context)); 134 struct Context* context = (struct Context*)malloc(sizeof(struct Context));
138 initLLRBContext(context); 135 initLLRBContext(context, num);
139 goto start_code(context, Code1); 136 goto start_code(context, Code1);
140 } 137 }