add json printing and parsing (of strings)

This commit is contained in:
Felix Van der Jeugt 2022-11-02 00:05:01 +01:00
parent 563b1b0c5a
commit a13c6ecb3a
No known key found for this signature in database
GPG key ID: 58B209295023754D
6 changed files with 277 additions and 81 deletions

View file

@ -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