Update gdb.base/default.exp for GDB 10
[deliverable/binutils-gdb.git] / gdb / dictionary.h
index 75edd7fb67a374ff41fb3874b9cd1f7abff76c50..9a7739b7c10d70a337f096227f186fb0a7881c7a 100644 (file)
@@ -1,6 +1,6 @@
 /* Routines for name->symbol lookups in GDB.
    
 /* Routines for name->symbol lookups in GDB.
    
-   Copyright 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
    Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
    Inc.
 
    Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
    Inc.
@@ -9,85 +9,89 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This program 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 of the License, or (at
-   your option) any later version.
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
 
-   This program 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.
+   This program 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
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef DICTIONARY_H
 #define DICTIONARY_H
 
 
 #ifndef DICTIONARY_H
 #define DICTIONARY_H
 
-/* An opaque type for dictionaries; only dictionary.c should know
-   about its innards.  */
+#include "symfile.h"
 
 
-struct dictionary;
+/* An opaque type for multi-language dictionaries; only dictionary.c should
+   know about its innards.  */
+
+struct multidictionary;
 
 /* Other types needed for declarations.  */
 
 struct symbol;
 struct obstack;
 struct pending;
 
 /* Other types needed for declarations.  */
 
 struct symbol;
 struct obstack;
 struct pending;
-
+struct language_defn;
 
 /* The creation functions for various implementations of
 
 /* The creation functions for various implementations of
-   dictionaries.  */
-
-/* Create a dictionary implemented via a fixed-size hashtable.  All
-   memory it uses is allocated on OBSTACK; the environment is
-   initialized from SYMBOL_LIST.  */
+   multi-language dictionaries.  */
 
 
-extern struct dictionary *dict_create_hashed (struct obstack *obstack,
-                                             const struct pending
-                                             *symbol_list);
+/* Create a multi-language dictionary of symbols implemented via
+   a fixed-size hashtable.  All memory it uses is allocated on
+   OBSTACK; the environment is initialized from SYMBOL_LIST.  */
 
 
-/* Create a dictionary implemented via a hashtable that grows as
-   necessary.  The dictionary is initially empty; to add symbols to
-   it, call dict_add_symbol().  Call dict_free() when you're done with
-   it.  */
+extern struct multidictionary *
+  mdict_create_hashed (struct obstack *obstack,
+                      const struct pending *symbol_list);
 
 
-extern struct dictionary *dict_create_hashed_expandable (void);
+/* Create a multi-language dictionary of symbols, implemented
+   via a hashtable that grows as necessary.  The initial dictionary of
+   LANGUAGE is empty; to add symbols to it, call mdict_add_symbol().
+   Call mdict_free() when you're done with it.  */
 
 
-/* Create a dictionary implemented via a fixed-size array.  All memory
-   it uses is allocated on OBSTACK; the environment is initialized
-   from the SYMBOL_LIST.  The symbols are ordered in the same order
-   that they're found in SYMBOL_LIST.  */
+extern struct multidictionary *
+  mdict_create_hashed_expandable (enum language language);
 
 
-extern struct dictionary *dict_create_linear (struct obstack *obstack,
-                                             const struct pending
-                                             *symbol_list);
+/* Create a multi-language dictionary of symbols, implemented
+   via a fixed-size array.  All memory it uses is allocated on
+   OBSTACK; the environment is initialized from the SYMBOL_LIST.  The
+   symbols are ordered in the same order that they're found in
+   SYMBOL_LIST.  */
 
 
-/* Create a dictionary implemented via an array that grows as
-   necessary.  The dictionary is initially empty; to add symbols to
-   it, call dict_add_symbol().  Call dict_free() when you're done with
-   it.  */
+extern struct multidictionary *
+  mdict_create_linear (struct obstack *obstack,
+                      const struct pending *symbol_list);
 
 
-extern struct dictionary *dict_create_linear_expandable (void);
+/* Create a multi-language dictionary of symbols, implemented
+   via an array that grows as necessary.  The multidictionary initially
+   contains a single empty dictionary of LANGUAGE; to add symbols to it,
+   call mdict_add_symbol().  Call mdict_free() when you're done with it.  */
 
 
+extern struct multidictionary *
+  mdict_create_linear_expandable (enum language language);
 
 
-/* The functions providing the interface to dictionaries.  Note that
-   the most common parts of the interface, namely symbol lookup, are
-   only provided via iterator functions.  */
+/* The functions providing the interface to multi-language dictionaries.
+   Note that the most common parts of the interface, namely symbol lookup,
+   are only provided via iterator functions.  */
 
 
-/* Free the memory used by a dictionary that's not on an obstack.  (If
+/* Free the memory used by a multidictionary that's not on an obstack.  (If
    any.)  */
 
    any.)  */
 
-extern void dict_free (struct dictionary *dict);
+extern void mdict_free (struct multidictionary *mdict);
 
 
-/* Add a symbol to an expandable dictionary.  */
+/* Add a symbol to an expandable multidictionary.  */
 
 
-extern void dict_add_symbol (struct dictionary *dict, struct symbol *sym);
+extern void mdict_add_symbol (struct multidictionary *mdict,
+                             struct symbol *sym);
 
 
-/* Is the dictionary empty?  */
+/* Utility to add a list of symbols to a multidictionary.  */
 
 
-extern int dict_empty (struct dictionary *dict);
+extern void mdict_add_pending (struct multidictionary *mdict,
+                              const struct pending *symbol_list);
 
 /* A type containing data that is used when iterating over all symbols
    in a dictionary.  Don't ever look at its innards; this type would
 
 /* A type containing data that is used when iterating over all symbols
    in a dictionary.  Don't ever look at its innards; this type would
@@ -104,42 +108,61 @@ struct dict_iterator
   struct symbol *current;
 };
 
   struct symbol *current;
 };
 
-/* Initialize ITERATOR to point at the first symbol in DICT, and
-   return that first symbol, or NULL if DICT is empty.  */
+/* The multi-language dictionary iterator.  Like dict_iterator above,
+   these contents should be considered private.  */
+
+struct mdict_iterator
+{
+  /* The multidictionary with whcih this iterator is associated.  */
+  const struct multidictionary *mdict;
+
+  /* The iterator used to iterate through individual dictionaries.  */
+  struct dict_iterator iterator;
+
+  /* The current index of the dictionary being iterated over.  */
+  unsigned short current_idx;
+};
+
+/* Initialize ITERATOR to point at the first symbol in MDICT, and
+   return that first symbol, or NULL if MDICT is empty.  */
 
 
-extern struct symbol *dict_iterator_first (const struct dictionary *dict,
-                                          struct dict_iterator *iterator);
+extern struct symbol *
+  mdict_iterator_first (const struct multidictionary *mdict,
+                       struct mdict_iterator *miterator);
 
 
-/* Advance ITERATOR, and return the next symbol, or NULL if there are
+/* Advance MITERATOR, and return the next symbol, or NULL if there are
    no more symbols.  Don't call this if you've previously received
    no more symbols.  Don't call this if you've previously received
-   NULL from dict_iterator_first or dict_iterator_next on this
+   NULL from mdict_iterator_first or mdict_iterator_next on this
    iteration.  */
 
    iteration.  */
 
-extern struct symbol *dict_iterator_next (struct dict_iterator *iterator);
+extern struct symbol *mdict_iterator_next (struct mdict_iterator *miterator);
 
 
-/* Initialize ITERATOR to point at the first symbol in DICT whose
-   SYMBOL_BEST_NAME is NAME (as tested using strcmp_iw), and return
-   that first symbol, or NULL if there are no such symbols.  */
+/* Initialize MITERATOR to point at the first symbol in MDICT whose
+   search_name () is NAME, as tested using COMPARE (which must use
+   the same conventions as strcmp_iw and be compatible with any
+   dictionary hashing function), and return that first symbol, or NULL
+   if there are no such symbols.  */
 
 
-extern struct symbol *dict_iter_name_first (const struct dictionary *dict,
-                                           const char *name,
-                                           struct dict_iterator *iterator);
+extern struct symbol *
+  mdict_iter_match_first (const struct multidictionary *mdict,
+                         const lookup_name_info &name,
+                         struct mdict_iterator *miterator);
 
 
-/* Advance ITERATOR to point at the next symbol in DICT whose
-   SYMBOL_BEST_NAME is NAME (as tested using strcmp_iw), or NULL if
-   there are no more such symbols.  Don't call this if you've
-   previously received NULL from dict_iterator_first or
-   dict_iterator_next on this iteration.  And don't call it unless
-   ITERATOR was created by a previous call to dict_iter_name_first
-   with the same NAME.  */
+/* Advance MITERATOR to point at the next symbol in MDICT whose
+   search_name () is NAME, as tested using COMPARE (see
+   dict_iter_match_first), or NULL if there are no more such symbols.
+   Don't call this if you've previously received NULL from 
+   mdict_iterator_match_first or mdict_iterator_match_next on this
+   iteration.  And don't call it unless MITERATOR was created by a
+   previous call to mdict_iter_match_first with the same NAME and COMPARE.  */
 
 
-extern struct symbol *dict_iter_name_next (const char *name,
-                                          struct dict_iterator *iterator);
+extern struct symbol *mdict_iter_match_next (const lookup_name_info &name,
+                                            struct mdict_iterator *miterator);
 
 
-/* Return some notion of the size of the dictionary: the number of
+/* Return some notion of the size of the multidictionary: the number of
    symbols if we have that, the number of hash buckets otherwise.  */
 
    symbols if we have that, the number of hash buckets otherwise.  */
 
-extern int dict_size (const struct dictionary *dict);
+extern int mdict_size (const struct multidictionary *mdict);
 
 /* Macro to loop through all symbols in a dictionary DICT, in no
    particular order.  ITER is a struct dict_iterator (NOTE: __not__ a
 
 /* Macro to loop through all symbols in a dictionary DICT, in no
    particular order.  ITER is a struct dict_iterator (NOTE: __not__ a
@@ -149,8 +172,8 @@ extern int dict_size (const struct dictionary *dict);
    early by a break if you desire.  */
 
 #define ALL_DICT_SYMBOLS(dict, iter, sym)                      \
    early by a break if you desire.  */
 
 #define ALL_DICT_SYMBOLS(dict, iter, sym)                      \
-       for ((sym) = dict_iterator_first ((dict), &(iter));     \
+       for ((sym) = mdict_iterator_first ((dict), &(iter));    \
             (sym);                                             \
             (sym);                                             \
-            (sym) = dict_iterator_next (&(iter)))
+            (sym) = mdict_iterator_next (&(iter)))
 
 #endif /* DICTIONARY_H */
 
 #endif /* DICTIONARY_H */
This page took 0.030499 seconds and 4 git commands to generate.