~ubuntu-branches/ubuntu/gutsy/binutils/gutsy

« back to all changes in this revision

Viewing changes to include/ternary.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-08-01 18:46:10 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20070801184610-o2erg3m3n7bjofvj
Tags: 2.17.20070801cvs-0ubuntu1
* CVS snapshot 20070801, taken from the trunk.
  - Fixes objcopy --only-keep-debug on amd64.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ternary.h - Ternary Search Trees
2
 
   Copyright 2001 Free Software Foundation, Inc.
3
 
 
4
 
   Contributed by Daniel Berlin (dan@cgsoftware.com)
5
 
 
6
 
 
7
 
   This program is free software; you can redistribute it and/or modify it
8
 
   under the terms of the GNU General Public License as published by the
9
 
   Free Software Foundation; either version 2, or (at your option) any
10
 
   later version.
11
 
 
12
 
   This program is distributed in the hope that it will be useful,
13
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
   GNU General Public License for more details.
16
 
 
17
 
   You should have received a copy of the GNU General Public License
18
 
   along with this program; if not, write to the Free Software
19
 
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
20
 
   USA.  */
21
 
#ifndef TERNARY_H_
22
 
#define TERNARY_H_
23
 
/* Ternary search trees */
24
 
 
25
 
typedef struct ternary_node_def *ternary_tree;
26
 
 
27
 
typedef struct ternary_node_def
28
 
{
29
 
  char splitchar;
30
 
  ternary_tree lokid;
31
 
  ternary_tree eqkid;
32
 
  ternary_tree hikid;
33
 
}
34
 
ternary_node;
35
 
 
36
 
/* Insert string S into tree P, associating it with DATA. 
37
 
   Return the data in the tree associated with the string if it's
38
 
   already there, and replace is 0.
39
 
   Otherwise, replaces if it it exists, inserts if it doesn't, and
40
 
   returns the data you passed in. */
41
 
void *ternary_insert (ternary_tree *p, const char *s,
42
 
                      void *data, int replace);
43
 
 
44
 
/* Delete the ternary search tree rooted at P. 
45
 
   Does NOT delete the data you associated with the strings. */
46
 
void ternary_cleanup (ternary_tree p);
47
 
 
48
 
/* Search the ternary tree for string S, returning the data associated
49
 
   with it if found. */
50
 
void *ternary_search (const ternary_node *p, const char *s);
51
 
#endif