OSDN Git Service

* splay-tree.h (splay_tree_predecessor): Declare.
[pf3gnuchains/gcc-fork.git] / include / splay-tree.h
index b52d802..f53f855 100644 (file)
@@ -1,24 +1,25 @@
 /* A splay-tree datatype.  
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    Contributed by Mark Mitchell (mark@markmitchell.com).
 
-   This file is part of GNU CC.
+This file is part of GNU CC.
    
-   GNU CC is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
+GNU CC is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
 
-   GNU CC is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+GNU CC is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with GNU CC; see the file COPYING.  If not, write to the Free
-   Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
-   For an easily readable description of splay-trees, see:
+/* For an easily readable description of splay-trees, see:
 
      Lewis, Harry R. and Denenberg, Larry.  Data Structures and Their
      Algorithms.  Harper-Collins, Inc.  1991.  
 extern "C" {
 #endif /* __cplusplus */
 
-#ifdef IN_GCC
-#include "gansidecl.h"
-#define PARAMS(ARGS) PROTO(ARGS)
-#else /* ! IN_GCC */
 #include <ansidecl.h>
-#endif /* IN_GCC */
 
 /* Use typedefs for the key and data types to facilitate changing
    these types, if necessary.  These types should be sufficiently wide
@@ -48,7 +44,7 @@ typedef unsigned long int splay_tree_key;
 typedef unsigned long int splay_tree_value;
 
 /* Forward declaration for a node in the tree.  */
-typedef struct splay_tree_node *splay_tree_node;
+typedef struct splay_tree_node_s *splay_tree_node;
 
 /* The type of a function which compares two splay-tree keys.  The
    function should return values as for qsort.  */
@@ -66,7 +62,7 @@ typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value));
 typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*));
 
 /* The nodes in the splay tree.  */
-struct splay_tree_node
+struct splay_tree_node_s
 {
   /* The key.  */
   splay_tree_key key;
@@ -80,7 +76,7 @@ struct splay_tree_node
 };
 
 /* The splay tree itself.  */
-typedef struct splay_tree
+typedef struct splay_tree_s
 {
   /* The root of the tree.  */
   splay_tree_node root;
@@ -99,15 +95,28 @@ extern splay_tree splay_tree_new        PARAMS((splay_tree_compare_fn,
                                                splay_tree_delete_key_fn,
                                                splay_tree_delete_value_fn));
 extern void splay_tree_delete           PARAMS((splay_tree));
-extern void splay_tree_insert           PARAMS((splay_tree,
+extern splay_tree_node splay_tree_insert          
+                                       PARAMS((splay_tree,
                                                splay_tree_key,
                                                splay_tree_value));
+extern void splay_tree_remove          PARAMS((splay_tree,
+                                               splay_tree_key));
 extern splay_tree_node splay_tree_lookup   
                                         PARAMS((splay_tree,
                                                splay_tree_key));
+extern splay_tree_node splay_tree_predecessor
+                                        PARAMS((splay_tree,
+                                               splay_tree_key));
+extern splay_tree_node splay_tree_successor
+                                        PARAMS((splay_tree,
+                                               splay_tree_key));
 extern int splay_tree_foreach           PARAMS((splay_tree,
                                                splay_tree_foreach_fn,
                                                void*));
+extern int splay_tree_compare_ints      PARAMS((splay_tree_key,
+                                               splay_tree_key));
+extern int splay_tree_compare_pointers  PARAMS((splay_tree_key,
+                                               splay_tree_key));
                                               
 #ifdef __cplusplus
 }