Lines Matching defs:dictionary
27 #include "dictionary.h"
34 dictionary'. That type has various internal implementations, which
38 Each dictionary starts with a 'virtual function table' that
44 To add a new dictionary implementation <impl>, what you should do
66 gizmos. Add its declaration to dictionary.h.
86 dict_<op> to dictionary.h. */
107 /* The type of the dictionary. This is only here to make debugging
110 /* The function to free a dictionary. */
111 void (*free) (struct dictionary *dict);
112 /* Add a symbol to a dictionary, if possible. */
113 void (*add_symbol) (struct dictionary *dict, struct symbol *sym);
115 struct symbol *(*iterator_first) (const struct dictionary *dict,
119 struct symbol *(*iter_match_first) (const struct dictionary *dict,
125 int (*size) (const struct dictionary *dict);
166 struct dictionary
202 /* The initial size of a DICT_*_EXPANDABLE dictionary. */
212 dictionary.h because code elsewhere should treat dict_iterators as
215 /* The dictionary that the iterator is associated to. */
226 /* Functions that might work across a range of dictionary types. */
228 static void add_symbol_nonexpandable (struct dictionary *dict,
231 static void free_obstack (struct dictionary *dict);
236 static struct symbol *iterator_first_hashed (const struct dictionary *dict,
241 static struct symbol *iter_match_first_hashed (const struct dictionary *dict,
250 static int size_hashed (const struct dictionary *dict);
254 static void free_hashed_expandable (struct dictionary *dict);
256 static void add_symbol_hashed_expandable (struct dictionary *dict,
259 static int size_hashed_expandable (const struct dictionary *dict);
264 static struct symbol *iterator_first_linear (const struct dictionary *dict,
269 static struct symbol *iter_match_first_linear (const struct dictionary *dict,
276 static int size_linear (const struct dictionary *dict);
280 static void free_linear_expandable (struct dictionary *dict);
282 static void add_symbol_linear_expandable (struct dictionary *dict,
340 static void insert_symbol_hashed (struct dictionary *dict,
343 static void expand_hashtable (struct dictionary *dict);
347 /* Create a hashed dictionary of a given language. */
349 static struct dictionary *
354 /* Allocate the dictionary. */
355 struct dictionary *retval = XOBNEW (obstack, struct dictionary);
374 /* Create an expandable hashed dictionary of a given language. */
376 static struct dictionary *
379 struct dictionary *retval = XNEW (struct dictionary);
391 /* Create a linear dictionary of a given language. */
393 static struct dictionary *
398 struct dictionary *retval = XOBNEW (obstack, struct dictionary);
416 /* Create an expandable linear dictionary of a given language. */
418 static struct dictionary *
421 struct dictionary *retval = XNEW (struct dictionary);
433 /* The functions providing the dictionary interface. */
435 /* Free the memory used by a dictionary that's not on an obstack. (If
439 dict_free (struct dictionary *dict)
447 dict_add_symbol (struct dictionary *dict, struct symbol *sym)
452 /* Utility to add a list of symbols to a dictionary.
453 DICT must be an expandable dictionary. */
456 dict_add_pending (struct dictionary *dict,
468 dict_iterator_first (const struct dictionary *dict,
485 dict_iter_match_first (const struct dictionary *dict,
501 dict_size (const struct dictionary *dict)
511 /* The functions implementing the dictionary interface. */
516 free_obstack (struct dictionary *dict)
522 add_symbol_nonexpandable (struct dictionary *dict, struct symbol *sym)
524 internal_error (_("dict_add_symbol: non-expandable dictionary"));
530 iterator_first_hashed (const struct dictionary *dict,
557 const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
577 iter_match_first_hashed (const struct dictionary *dict,
632 insert_symbol_hashed (struct dictionary *dict,
639 /* We don't want to insert a symbol into a dictionary of a different
650 size_hashed (const struct dictionary *dict)
669 free_hashed_expandable (struct dictionary *dict)
676 add_symbol_hashed_expandable (struct dictionary *dict,
689 size_hashed_expandable (const struct dictionary *dict)
695 expand_hashtable (struct dictionary *dict)
728 /* See dictionary.h. */
810 iterator_first_linear (const struct dictionary *dict,
821 const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
830 iter_match_first_linear (const struct dictionary *dict,
844 const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
869 size_linear (const struct dictionary *dict)
877 free_linear_expandable (struct dictionary *dict)
885 add_symbol_linear_expandable (struct dictionary *dict,
902 /* Multi-language dictionary support. */
904 /* The structure describing a multi-language dictionary. */
910 dictionary types. */
911 struct dictionary **dictionaries;
955 /* See dictionary.h. */
968 = XOBNEWVEC (obstack, struct dictionary *, nsyms.size ());
984 /* See dictionary.h. */
992 dictionary of the requested language to populate later. */
994 retval->dictionaries = XNEW (struct dictionary *);
1000 /* See dictionary.h. */
1013 = XOBNEWVEC (obstack, struct dictionary *, nsyms.size ());
1029 /* See dictionary.h. */
1037 dictionary to populate later. */
1039 retval->dictionaries = XNEW (struct dictionary *);
1045 /* See dictionary.h. */
1050 /* Grab the type of dictionary being used. */
1057 /* Free the dictionary list, if needed. */
1072 /* Helper function to find the dictionary associated with LANGUAGE
1073 or NULL if there is no dictionary of that language. */
1075 static struct dictionary *
1088 /* Create a new language dictionary for LANGUAGE and add it to the
1093 static struct dictionary *
1097 struct dictionary *retval = nullptr;
1099 /* We use the first dictionary entry to decide what create function
1118 /* Grow the dictionary vector and save the new dictionary. */
1120 = (struct dictionary **) xrealloc (mdict->dictionaries,
1122 * sizeof (struct dictionary *)));
1128 /* See dictionary.h. */
1133 struct dictionary *dict
1139 Create a new dictionary for it. */
1146 /* See dictionary.h. */
1159 struct dictionary *dict = find_language_dictionary (mdict, language);
1163 /* The language was not previously seen. Create a new dictionary
1172 /* See dictionary.h. */
1197 /* See dictionary.h. */
1207 /* The current dictionary had no matches -- move to the next
1208 dictionary, if any. */
1225 /* See dictionary.h. */
1249 /* See dictionary.h. */
1255 /* Search the current dictionary. */
1261 /* The current dictionary had no matches -- move to the next
1262 dictionary, if any. */
1279 /* See dictionary.h. */