source: trunk/src/emx/include/splay-tree.h@ 1876

Last change on this file since 1876 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: 5.6 KB
Line 
1/* splay-tree.h,v 1.2 2004/09/14 22:27:35 bird Exp */
2/** @file
3 * GNU, -liberty.
4 */
5/* A splay-tree datatype.
6 Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
7 Contributed by Mark Mitchell ([email protected]).
8
9This file is part of GCC.
10
11GCC is free software; you can redistribute it and/or modify it
12under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2, or (at your option)
14any later version.
15
16GCC is distributed in the hope that it will be useful, but
17WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with GCC; see the file COPYING. If not, write to
23the Free Software Foundation, 59 Temple Place - Suite 330,
24Boston, MA 02111-1307, USA. */
25
26/* For an easily readable description of splay-trees, see:
27
28 Lewis, Harry R. and Denenberg, Larry. Data Structures and Their
29 Algorithms. Harper-Collins, Inc. 1991.
30
31 The major feature of splay trees is that all basic tree operations
32 are amortized O(log n) time for a tree with n nodes. */
33
34#ifndef _SPLAY_TREE_H
35#define _SPLAY_TREE_H
36
37#ifdef __cplusplus
38extern "C" {
39#endif /* __cplusplus */
40
41#include <ansidecl.h>
42
43/* Use typedefs for the key and data types to facilitate changing
44 these types, if necessary. These types should be sufficiently wide
45 that any pointer or scalar can be cast to these types, and then
46 cast back, without loss of precision. */
47typedef unsigned long int splay_tree_key;
48typedef unsigned long int splay_tree_value;
49
50/* Forward declaration for a node in the tree. */
51typedef struct splay_tree_node_s *splay_tree_node;
52
53/* The type of a function which compares two splay-tree keys. The
54 function should return values as for qsort. */
55typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key));
56
57/* The type of a function used to deallocate any resources associated
58 with the key. */
59typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key));
60
61/* The type of a function used to deallocate any resources associated
62 with the value. */
63typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value));
64
65/* The type of a function used to iterate over the tree. */
66typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*));
67