add json printing and parsing (of strings)
This commit is contained in:
parent
563b1b0c5a
commit
a13c6ecb3a
6 changed files with 277 additions and 81 deletions
10
sortedmap.h
10
sortedmap.h
|
@ -1,16 +1,24 @@
|
|||
#ifndef SORTED_MAP
|
||||
#define SORTED_MAP
|
||||
enum nodetype { LEAF, INTERN };
|
||||
enum nodetype { EMPTY, LEAF, INTERN };
|
||||
|
||||
typedef struct node {
|
||||
enum nodetype type;
|
||||
char * key;
|
||||
union {
|
||||
struct children {
|
||||
struct node * l;
|
||||
struct node * r;
|
||||
} children;
|
||||
void * value;
|
||||
} content;
|
||||
} SortedMap;
|
||||
|
||||
SortedMap * map();
|
||||
void * get_map(SortedMap *this, char *key);
|
||||
SortedMap * put_map(SortedMap *this, char *key, void *value);
|
||||
void print_map(SortedMap *this);
|
||||
void * fold_map(SortedMap *this, void * init, void * (*f)(void * acc, char *key, void *value));
|
||||
void free_mapvalues(SortedMap *this);
|
||||
void free_map(SortedMap *this);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue