2010-11-19 19:00:15 +02:00
|
|
|
#ifndef ID_H
|
|
|
|
#define ID_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2010-11-20 02:17:08 +02:00
|
|
|
#include "jrb.h"
|
2010-11-19 19:00:15 +02:00
|
|
|
|
|
|
|
|
2010-11-20 02:17:08 +02:00
|
|
|
struct id;
|
2010-11-19 19:00:15 +02:00
|
|
|
|
|
|
|
struct tree {
|
|
|
|
int (*comp)(const struct id *a, const struct id *b);
|
2010-11-20 02:17:08 +02:00
|
|
|
struct jrb *root;
|
2010-11-19 19:00:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct id {
|
2010-11-20 02:17:08 +02:00
|
|
|
struct jrb *jrb;
|
2010-11-19 19:00:15 +02:00
|
|
|
const char *s;
|
|
|
|
size_t len;
|
|
|
|
void *value;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int comp_id(const struct id *a, const struct id *b);
|
|
|
|
|
|
|
|
struct tree *make_tree(int (*comp)(const struct id *a, const struct id *b));
|
|
|
|
struct id *make_id(struct tree *tree, const char *s, size_t len);
|
|
|
|
const struct id *find_id(const struct tree *tree, const char *s, size_t len);
|
|
|
|
const struct id *first_id(const struct tree *tree);
|
|
|
|
const struct id *next_id(const struct id *id);
|
|
|
|
|
|
|
|
#endif /* !ID_H */
|