28 |
28 |
29 |
29 |
30 #include <stdlib.h> |
30 #include <stdlib.h> |
31 |
31 |
32 #include "../public/nsapi.h" |
32 #include "../public/nsapi.h" |
33 #include "../util/map.h" |
33 |
|
34 #include "../ucx/map.h" |
|
35 |
34 #include "func.h" |
36 #include "func.h" |
35 |
37 |
36 hashmap_t *function_map; |
38 UcxMap *function_map; |
37 |
39 |
38 void func_init() { |
40 void func_init() { |
39 function_map = hashmap_new(128); |
41 function_map = ucx_map_new(128); |
40 } |
42 } |
41 |
43 |
42 void add_function(struct FuncStruct *func) { |
44 void add_function(struct FuncStruct *func) { |
43 printf("add function: %s\n", func->name); |
45 printf("add function: %s\n", func->name); |
44 |
46 |
45 struct FuncStruct *f = malloc(sizeof(FuncStruct)); |
47 struct FuncStruct *f = malloc(sizeof(FuncStruct)); |
46 *f = *func; |
48 *f = *func; |
47 hashmap_put(function_map, sstr((char*)f->name), func); |
49 ucx_map_cstr_put(function_map, (char*)f->name, func); |
48 } |
50 } |
49 |
51 |
50 void add_functions(struct FuncStruct *funcs) { |
52 void add_functions(struct FuncStruct *funcs) { |
51 int i = 0; |
53 int i = 0; |
52 while(funcs[i].func != NULL) { |
54 while(funcs[i].func != NULL) { |