2006-01-28 19:03:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct node
|
|
|
|
{
|
|
|
|
unsigned char value;
|
|
|
|
struct node *left;
|
|
|
|
struct node *middle;
|
|
|
|
struct node *right;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tst
|
|
|
|
{
|
|
|
|
int node_line_width;
|
|
|
|
struct node_lines *node_lines;
|
|
|
|
struct node *free_list;
|
|
|
|
struct node *head[127];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct node_lines
|
|
|
|
{
|
|
|
|
struct node *node_line;
|
|
|
|
struct node_lines *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum tst_constants
|
|
|
|
{
|
2007-09-13 04:12:01 +00:00
|
|
|
TST_OK, TST_ERROR, TST_NULL_KEY, TST_DUPLICATE_KEY, TST_REPLACE, TST_LONGEST_MATCH
|
2006-01-28 19:03:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct tst *tst_init(int node_line_width);
|
|
|
|
|
|
|
|
int tst_insert(unsigned char *key, void *data, struct tst *tst, int option, void **exist_ptr);
|
|
|
|
|
2007-09-13 04:12:01 +00:00
|
|
|
void *tst_search(const unsigned char *key, struct tst *tst, int option, unsigned int *match_len);
|
2006-01-28 19:03:53 +00:00
|
|
|
|
|
|
|
void *tst_delete(unsigned char *key, struct tst *tst);
|
|
|
|
|
|
|
|
void tst_cleanup(struct tst *tst);
|
|
|
|
|
|
|
|
|