paulo@0: /* paulo@0: * $Id: trie.h,v 1.2 2003/07/09 09:31:52 hipnod Exp $ paulo@0: * paulo@0: * Copyright (C) 2001-2003 giFT project (gift.sourceforge.net) paulo@0: * paulo@0: * This program is free software; you can redistribute it and/or modify it paulo@0: * under the terms of the GNU General Public License as published by the paulo@0: * Free Software Foundation; either version 2, or (at your option) any paulo@0: * later version. paulo@0: * paulo@0: * This program is distributed in the hope that it will be useful, but paulo@0: * WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU paulo@0: * General Public License for more details. paulo@0: */ paulo@0: paulo@0: #ifndef __GT_TRIE_H__ paulo@0: #define __GT_TRIE_H__ paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: typedef struct trie paulo@0: { paulo@0: List *children; /* List of children. paulo@0: The zeroth item is the data list paulo@0: if this is a terminal node */ paulo@0: unsigned char terminal_node : 1; /* TRUE if is a terminal node */ paulo@0: char c; /* Character of this node */ paulo@0: paulo@0: } Trie; paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: Trie *trie_new (void); paulo@0: void trie_free (Trie *trie); paulo@0: void *trie_lookup (Trie *trie, char *s); paulo@0: void trie_insert (Trie *trie, char *s, void *value); paulo@0: void trie_remove (Trie *trie, char *s); paulo@0: void trie_print (Trie *trie); paulo@0: paulo@0: /*****************************************************************************/ paulo@0: paulo@0: #endif /* __GT_TRIE_H__ */