Lines Matching refs:dict

113   void (*free) (struct dictionary *dict);
115 void (*add_symbol) (struct dictionary *dict, struct symbol *sym);
117 struct symbol *(*iterator_first) (const struct dictionary *dict,
121 struct symbol *(*iter_name_first) (const struct dictionary *dict,
127 int (*size) (const struct dictionary *dict);
216 #define DICT_ITERATOR_DICT(iter) (iter)->dict
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_name_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_name_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);
483 dict_free (struct dictionary *dict)
485 (DICT_VECTOR (dict))->free (dict);
491 dict_add_symbol (struct dictionary *dict, struct symbol *sym)
493 (DICT_VECTOR (dict))->add_symbol (dict, sym);
500 dict_iterator_first (const struct dictionary *dict,
503 return (DICT_VECTOR (dict))->iterator_first (dict, iterator);
517 dict_iter_name_first (const struct dictionary *dict,
521 return (DICT_VECTOR (dict))->iter_name_first (dict, name, iterator);
532 dict_size (const struct dictionary *dict)
534 return (DICT_VECTOR (dict))->size (dict);
544 dict_empty (struct dictionary *dict)
548 return (dict_iterator_first (dict, &iter) == NULL);
557 free_obstack (struct dictionary *dict)
563 add_symbol_nonexpandable (struct dictionary *dict, struct symbol *sym)
572 iterator_first_hashed (const struct dictionary *dict,
575 DICT_ITERATOR_DICT (iterator) = dict;
583 const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
600 const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
601 int nbuckets = DICT_HASHED_NBUCKETS (dict);
606 struct symbol *sym = DICT_HASHED_BUCKET (dict, i);
620 iter_name_first_hashed (const struct dictionary *dict,
625 = msymbol_hash_iw (name) % DICT_HASHED_NBUCKETS (dict);
628 DICT_ITERATOR_DICT (iterator) = dict;
634 for (sym = DICT_HASHED_BUCKET (dict, hash_index);
671 insert_symbol_hashed (struct dictionary *dict,
675 struct symbol **buckets = DICT_HASHED_BUCKETS (dict);
678 % DICT_HASHED_NBUCKETS (dict));
684 size_hashed (const struct dictionary *dict)
686 return DICT_HASHED_NBUCKETS (dict);
692 free_hashed_expandable (struct dictionary *dict)
694 xfree (DICT_HASHED_BUCKETS (dict));
695 xfree (dict);
699 add_symbol_hashed_expandable (struct dictionary *dict,
702 int nsyms = ++DICT_HASHED_EXPANDABLE_NSYMS (dict);
704 if (DICT_HASHTABLE_SIZE (nsyms) > DICT_HASHED_NBUCKETS (dict))
705 expand_hashtable (dict);
707 insert_symbol_hashed (dict, sym);
708 DICT_HASHED_EXPANDABLE_NSYMS (dict) = nsyms;
712 size_hashed_expandable (const struct dictionary *dict)
714 return DICT_HASHED_EXPANDABLE_NSYMS (dict);
718 expand_hashtable (struct dictionary *dict)
720 int old_nbuckets = DICT_HASHED_NBUCKETS (dict);
721 struct symbol **old_buckets = DICT_HASHED_BUCKETS (dict);
727 DICT_HASHED_NBUCKETS (dict) = new_nbuckets;
728 DICT_HASHED_BUCKETS (dict) = new_buckets;
738 insert_symbol_hashed (dict, sym);
742 insert_symbol_hashed (dict, sym);
752 iterator_first_linear (const struct dictionary *dict,
755 DICT_ITERATOR_DICT (iterator) = dict;
757 return DICT_LINEAR_NSYMS (dict) ? DICT_LINEAR_SYM (dict, 0) : NULL;
763 const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
765 if (++DICT_ITERATOR_INDEX (iterator) >= DICT_LINEAR_NSYMS (dict))
768 return DICT_LINEAR_SYM (dict, DICT_ITERATOR_INDEX (iterator));
772 iter_name_first_linear (const struct dictionary *dict,
776 DICT_ITERATOR_DICT (iterator) = dict;
785 const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
786 int i, nsyms = DICT_LINEAR_NSYMS (dict);
791 sym = DICT_LINEAR_SYM (dict, i);
805 size_linear (const struct dictionary *dict)
807 return DICT_LINEAR_NSYMS (dict);
813 free_linear_expandable (struct dictionary *dict)
815 xfree (DICT_LINEAR_SYMS (dict));
816 xfree (dict);
821 add_symbol_linear_expandable (struct dictionary *dict,
824 int nsyms = ++DICT_LINEAR_NSYMS (dict);
827 if (nsyms > DICT_LINEAR_EXPANDABLE_CAPACITY (dict)) {
828 DICT_LINEAR_EXPANDABLE_CAPACITY (dict) *= 2;
829 DICT_LINEAR_SYMS (dict)
830 = xrealloc (DICT_LINEAR_SYMS (dict),
831 DICT_LINEAR_EXPANDABLE_CAPACITY (dict)
835 DICT_LINEAR_SYM (dict, nsyms - 1) = sym;