2010-11-19 14:00:15 -03:00
|
|
|
#ifndef ID_H
|
|
|
|
#define ID_H
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2010-11-19 21:17:08 -03:00
|
|
|
#include "jrb.h"
|
2010-11-19 14:00:15 -03:00
|
|
|
|
|
|
|
|
2010-11-19 21:17:08 -03:00
|
|
|
struct id;
|
2010-11-19 14:00:15 -03:00
|
|
|
|
|
|
|
struct tree {
|
2010-11-19 21:48:48 -03:00
|
|
|
int (*comp)(const void *a, const void *b);
|
2010-11-19 21:17:08 -03:00
|
|
|
struct jrb *root;
|
2010-11-19 14:00:15 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct id {
|
2010-11-19 21:17:08 -03:00
|
|
|
struct jrb *jrb;
|
2010-11-19 14:00:15 -03:00
|
|
|
const char *s;
|
|
|
|
size_t len;
|
|
|
|
void *value;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-19 21:48:48 -03:00
|
|
|
int comp_id(const void *a, const void *b);
|
2010-11-19 14:00:15 -03:00
|
|
|
|
2010-11-19 21:48:48 -03:00
|
|
|
struct tree *make_tree(int (*comp)(const void *a, const void *b));
|
2010-11-19 14:00:15 -03:00
|
|
|
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 */
|