Merge branch 'linux1'
[oweals/cde.git] / cde / programs / dthelp / parser / pass2 / util / trie.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: trie.h /main/3 1995/11/08 11:08:18 rswiston $ */
24 /*
25                    Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
26 */
27
28 /* Trie.h contains definitions relating to trees used to store
29    element names, delimiter strings, short reference strings, etc. */
30
31 /* The data structure described here is not a true trie as described
32    in Knuth, Vol. 3.  These functions represent entries by a tree
33    structure in which there is one level of subnode for each letter
34    in an entry.  In a trie, subnodes are not needed as soon as a
35    unique prefix has been encountered. */
36
37 typedef struct m_trie M_TRIE ;
38
39 typedef struct m_ptrie M_PTRIE ;
40
41 struct m_trie {
42   M_WCHAR symbol ;
43   M_TRIE *next ;
44   M_TRIE *data ;
45   } ;
46
47 struct m_ptrie {
48   LOGICAL more ;
49   M_WCHAR symbol ;
50   int index ;
51   } ;
52
53
54 M_TRIE *m_gettrienode(
55 #if defined(M_PROTO)
56   M_NOPAR
57 #endif
58   ) ;
59
60 void *m_lookfortrie(
61 #if defined(M_PROTO)
62   const M_WCHAR *p, const M_TRIE *xtrie
63 #endif
64   ) ;
65
66 void *m_ntrtrie(
67 #if defined(M_PROTO)
68   M_WCHAR *p, M_TRIE *xtrie, void *dataval
69 #endif
70   ) ;
71
72 void *m_resettrie(
73 #if defined(M_PROTO)
74   M_TRIE *xtrie, M_WCHAR *p, void *value
75 #endif
76   ) ;