#define DICT_BITS	3
#define DICT_BUCKETS	(1<<DICT_BITS)

struct dict_bucket {
	char *k, *v, *c;
	};

struct dict {
	struct dict *d[DICT_BUCKETS];
	struct dict_bucket b[DICT_BUCKETS];
	struct dict *up;
	int n_inclusive;
};


struct dict *dict_constr();

void dict_destr(struct dict *d);

long dict_hash(const char *k);

const char *dict_getv(const struct dict *d, const char *k, const char *dfl);
const struct dict_bucket *dict_getb(const struct dict *d, const char *k);

void dict_remove(struct dict *d, const char *key);

const char *dict_indexv(const struct dict *d, int i, const char *dfl);
const struct dict_bucket *dict_indexb(const struct dict *d, int i);

void dict_add(struct dict *d, const char *k, const char *v, const char *c);

struct dict *dict_copy(const struct dict *d);
