source: branches/libc-0.6/src/emx/include/ternary.h

Last change on this file was 1506, checked in by bird, 21 years ago

@unixroot. header reviews. ++

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1/* ternary.h,v 1.2 2004/09/14 22:27:36 bird Exp */
2/** @file
3 * GNU, -liberty.
4 */
5
6/* ternary.h - Ternary Search Trees
7 Copyright 2001 Free Software Foundation, Inc.
8
9 Contributed by Daniel Berlin (dan@cgsoftware.com)
10
11
12 This program is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License as published by the
14 Free Software Foundation; either version 2, or (at your option) any
15 later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 USA. */
26#ifndef TERNARY_H_
27#define TERNARY_H_
28/* Ternary search trees */
29
30typedef struct ternary_node_def *ternary_tree;
31
32typedef struct ternary_node_def
33{
34 char splitchar;
35 ternary_tree lokid;
36 ternary_tree eqkid;
37 ternary_tree hikid;
38}
39ternary_node;
40
41/* Insert string S into tree P, associating it with DATA.
42 Return the data in the tree associated with the string if it's
43 already there, and replace is 0.
44 Otherwise, replaces if it it exists, inserts if it doesn't, and
45 returns the data you passed in. */
46PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
47 PTR data, int replace));
48
49/* Delete the ternary search tree rooted at P.
50 Does NOT delete the data you associated with the strings. */
51void ternary_cleanup PARAMS ((ternary_tree p));
52
53/* Search the ternary tree for string S, returning the data associated
54 with it if found. */
55PTR ternary_search PARAMS ((const ternary_node *p, const char *s));
56#endif
Note: See TracBrowser for help on using the repository browser.