|
|
|
/*
|
|
|
|
* trie.h: declaration of functions workong with trie
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TRIE_H
|
|
|
|
#define TRIE_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "grow.h"
|
|
|
|
|
|
|
|
struct trie {
|
|
|
|
int64_t val;
|
|
|
|
struct trie *children[37]; //Alphabet: A-Z0-9_
|
|
|
|
bool def;
|
|
|
|
struct grow *tasks;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum trie_ret_status {OK, UNDEF};
|
|
|
|
|
|
|
|
struct trie_retval {
|
|
|
|
int64_t val;
|
|
|
|
bool def;
|
|
|
|
struct grow *tasks;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct trie_list {
|
|
|
|
int64_t val;
|
|
|
|
char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct trie_retval trie_lookup(char string[]);
|
|
|
|
bool trie_set (char string[], int64_t val);
|
|
|
|
bool trie_un (char string[]);
|
|
|
|
struct grow *trie_list(void);
|
|
|
|
|
|
|
|
bool trie_assoc(char var[], uint64_t task);
|
|
|
|
bool trie_unassoc(char var[], uint64_t task);
|
|
|
|
|
|
|
|
bool trie_load(const char fn[]);
|
|
|
|
bool trie_save(const char fn[]);
|
|
|
|
|
|
|
|
#endif
|