Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/include/splay-tree.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* A splay-tree datatype. 
    2    Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
     2   Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
    33   Contributed by Mark Mitchell (mark@markmitchell.com).
    44
    5 This file is part of GNU CC.
     5This file is part of GCC.
    66   
    7 GNU CC is free software; you can redistribute it and/or modify it
     7GCC is free software; you can redistribute it and/or modify it
    88under the terms of the GNU General Public License as published by
    99the Free Software Foundation; either version 2, or (at your option)
    1010any later version.
    1111
    12 GNU CC is distributed in the hope that it will be useful, but
     12GCC is distributed in the hope that it will be useful, but
    1313WITHOUT ANY WARRANTY; without even the implied warranty of
    1414MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    1616
    1717You should have received a copy of the GNU General Public License
    18 along with GNU CC; see the file COPYING.  If not, write to
     18along with GCC; see the file COPYING.  If not, write to
    1919the Free Software Foundation, 59 Temple Place - Suite 330,
    2020Boston, MA 02111-1307, USA.  */
     
    3535#endif /* __cplusplus */
    3636
    37 #include <ansidecl.h>
     37#include "ansidecl.h"
     38
     39#ifndef GTY
     40#define GTY(X)
     41#endif
    3842
    3943/* Use typedefs for the key and data types to facilitate changing
     
    6266typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*));
    6367
     68/* The type of a function used to allocate memory for tree root and
     69   node structures.  The first argument is the number of bytes needed;
     70   the second is a data pointer the splay tree functions pass through
     71   to the allocator.  This function must never return zero.  */
     72typedef PTR (*splay_tree_allocate_fn) PARAMS((int, void *));
     73
     74/* The type of a function used to free memory allocated using the
     75   corresponding splay_tree_allocate_fn.  The first argument is the
     76   memory to be freed; the latter is a data pointer the splay tree
     77   functions pass through to the freer.  */
     78typedef void (*splay_tree_deallocate_fn) PARAMS((void *, void *));
     79
    6480/* The nodes in the splay tree.  */
    65 struct splay_tree_node_s
     81struct splay_tree_node_s GTY(())
    6682{
    6783  /* The key.  */
    68   splay_tree_key key;
     84  splay_tree_key GTY ((use_param1 (""))) key;
    6985
    7086  /* The value.  */
    71   splay_tree_value value;
     87  splay_tree_value GTY ((use_param2 (""))) value;
    7288
    7389  /* The left and right children, respectively.  */
    74   splay_tree_node left;
    75   splay_tree_node right;
     90  splay_tree_node GTY ((use_params (""))) left;
     91  splay_tree_node GTY ((use_params (""))) right;
    7692};
    7793
    7894/* The splay tree itself.  */
    79 typedef struct splay_tree_s
     95struct splay_tree_s GTY(())
    8096{
    8197  /* The root of the tree.  */
    82   splay_tree_node root;
     98  splay_tree_node GTY ((use_params (""))) root;
    8399
    84100  /* The comparision function.  */
     
    90106  /* The deallocate-value function.  NULL if no cleanup is necessary.  */
    91107  splay_tree_delete_value_fn delete_value;
    92 } *splay_tree;
     108
     109  /* Allocate/free functions, and a data pointer to pass to them.  */
     110  splay_tree_allocate_fn allocate;
     111  splay_tree_deallocate_fn deallocate;
     112  PTR GTY((skip (""))) allocate_data;
     113
     114};
     115typedef struct splay_tree_s *splay_tree;
    93116
    94117extern splay_tree splay_tree_new        PARAMS((splay_tree_compare_fn,
    95118                                                splay_tree_delete_key_fn,
    96119                                                splay_tree_delete_value_fn));
     120extern splay_tree splay_tree_new_with_allocator
     121                                        PARAMS((splay_tree_compare_fn,
     122                                                splay_tree_delete_key_fn,
     123                                                splay_tree_delete_value_fn,
     124                                                splay_tree_allocate_fn,
     125                                                splay_tree_deallocate_fn,
     126                                                void *));
    97127extern void splay_tree_delete           PARAMS((splay_tree));
    98128extern splay_tree_node splay_tree_insert         
     
    111141                                        PARAMS((splay_tree,
    112142                                                splay_tree_key));
     143extern splay_tree_node splay_tree_max
     144                                        PARAMS((splay_tree));
     145extern splay_tree_node splay_tree_min
     146                                        PARAMS((splay_tree));
    113147extern int splay_tree_foreach           PARAMS((splay_tree,
    114148                                                splay_tree_foreach_fn,
Note: See TracChangeset for help on using the changeset viewer.