29 #include "safe-ctype.h" 181 #define DICT_VECTOR(d) (d)->vector 182 #define DICT_LANGUAGE(d) (d)->language 186 #define DICT_HASHED_NBUCKETS(d) (d)->data.hashed.nbuckets 187 #define DICT_HASHED_BUCKETS(d) (d)->data.hashed.buckets 188 #define DICT_HASHED_BUCKET(d,i) DICT_HASHED_BUCKETS (d) [i] 190 #define DICT_HASHED_EXPANDABLE_NSYMS(d) (d)->data.hashed_expandable.nsyms 194 #define DICT_LINEAR_NSYMS(d) (d)->data.linear.nsyms 195 #define DICT_LINEAR_SYMS(d) (d)->data.linear.syms 196 #define DICT_LINEAR_SYM(d,i) DICT_LINEAR_SYMS (d) [i] 198 #define DICT_LINEAR_EXPANDABLE_CAPACITY(d) \ 199 (d)->data.linear_expandable.capacity 203 #define DICT_EXPANDABLE_INITIAL_CAPACITY 10 208 #define DICT_HASHTABLE_SIZE(n) ((n)/5 + 1) 215 #define DICT_ITERATOR_DICT(iter) (iter)->dict 218 #define DICT_ITERATOR_INDEX(iter) (iter)->index 221 #define DICT_ITERATOR_CURRENT(iter) (iter)->current 354 int nsyms = 0, nbuckets, i;
356 const struct pending *list_counter;
364 list_counter != NULL;
365 list_counter = list_counter->
next)
371 buckets = XOBNEWVEC (obstack,
struct symbol *, nbuckets);
372 memset (buckets, 0, nbuckets *
sizeof (
struct symbol *));
377 list_counter != NULL;
378 list_counter = list_counter->
next)
380 for (i = list_counter->
nsyms - 1; i >= 0; --i)
416 const struct pending *list_counter;
424 list_counter != NULL;
425 list_counter = list_counter->
next)
430 syms = XOBNEWVEC (obstack,
struct symbol *,
nsyms );
436 list_counter != NULL;
437 list_counter = list_counter->
next)
439 for (i = list_counter->
nsyms - 1;
443 syms[j] = list_counter->
symbol[i];
497 for (i = 0; i < list->
nsyms; ++i)
509 return (
DICT_VECTOR (dict))->iterator_first (dict, iterator);
519 ->iterator_next (iterator);
535 ->iter_match_next (
name, iterator);
573 _(
"dict_add_symbol: non-expandable dictionary"));
684 unsigned int hash_index;
695 buckets[hash_index] = sym;
737 int new_nbuckets = 2 * old_nbuckets + 1;
744 for (i = 0; i < old_nbuckets; ++i)
746 struct symbol *sym, *next_sym;
748 sym = old_buckets[i];
799 if (string0 ==
string)
807 if (
string[1] ==
'_' &&
string != string0)
811 if ((c < 'a' || c >
'z') && c !=
'O')
827 if (strcmp (
string,
"TKB") == 0)
881 struct symbol *sym, *retval = NULL;
static struct symbol * iterator_first_linear(const struct dictionary *dict, struct dict_iterator *iterator)
#define DICT_HASHED_EXPANDABLE_NSYMS(d)
static const struct dict_vector dict_linear_expandable_vector
#define DICT_LINEAR_SYM(d, i)
struct symbol * dict_iter_match_next(const lookup_name_info &name, struct dict_iterator *iterator)
void dict_free(struct dictionary *dict)
unsigned int default_search_name_hash(const char *string0)
struct dictionary_hashed_expandable hashed_expandable
struct symbol * hash_next
const struct dict_vector * vector
static struct @23 symbol_list[]
symbol_name_matcher_ftype * get_symbol_name_matcher(const language_defn *lang, const lookup_name_info &lookup_name)
struct dictionary * dict_create_linear(struct obstack *obstack, enum language language, const struct pending *symbol_list)
static void expand_hashtable(struct dictionary *dict)
static struct symbol * iterator_hashed_advance(struct dict_iterator *iter)
void * memset(T *s, int c, size_t n)=delete
void internal_error(const char *file, int line, const char *fmt,...)
const struct language_defn * language_def(enum language lang)
int(* size)(const struct dictionary *dict)
#define DICT_HASHED_BUCKET(d, i)
bool() symbol_name_matcher_ftype(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
#define DICT_LINEAR_SYMS(d)
void(* add_symbol)(struct dictionary *dict, struct symbol *sym)
struct symbol * symbol[PENDINGSIZE]
#define DICT_ITERATOR_CURRENT(iter)
enum language la_language
static void add_symbol_linear_expandable(struct dictionary *dict, struct symbol *sym)
#define DICT_ITERATOR_DICT(iter)
#define DICT_HASHED_NBUCKETS(d)
static const struct dict_vector dict_linear_vector
const struct language_defn * language
static void free_hashed_expandable(struct dictionary *dict)
struct symbol * dict_iter_match_first(const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
struct dictionary_hashed hashed
#define DICT_LINEAR_NSYMS(d)
void dict_add_pending(struct dictionary *dict, const struct pending *symbol_list)
#define DICT_EXPANDABLE_INITIAL_CAPACITY
static struct symbol * iterator_next_hashed(struct dict_iterator *iterator)
static const struct dict_vector dict_hashed_expandable_vector
#define SYMBOL_HASH_NEXT(hash, c)
#define DICT_LINEAR_EXPANDABLE_CAPACITY(d)
static int size_linear(const struct dictionary *dict)
static int startswith(const char *string, const char *pattern)
static struct symbol * iterator_first_hashed(const struct dictionary *dict, struct dict_iterator *iterator)
static void add_symbol(struct symbol *, struct symtab *, struct block *)
int dict_empty(struct dictionary *dict)
#define XRESIZEVEC(T, P, N)
struct symbol * dict_iterator_next(struct dict_iterator *iterator)
struct dictionary * dict_create_linear_expandable(enum language language)
unsigned long hash(const void *addr, int length)
static void add_symbol_hashed_expandable(struct dictionary *dict, struct symbol *sym)
static void free_linear_expandable(struct dictionary *dict)
union dictionary::@35 data
static struct symbol * iter_match_next_linear(const lookup_name_info &name, struct dict_iterator *iterator)
struct dictionary_linear linear
void(* free)(struct dictionary *dict)
void dict_add_symbol(struct dictionary *dict, struct symbol *sym)
unsigned int search_name_hash(enum language language, const char *search_name)
#define SYMBOL_LANGUAGE(symbol)
static struct symbol * iter_match_first_linear(const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
struct dictionary * dict_create_hashed(struct obstack *obstack, enum language language, const struct pending *symbol_list)
static int size_hashed_expandable(const struct dictionary *dict)
static void insert_symbol_hashed(struct dictionary *dict, struct symbol *sym)
static const struct dict_vector dict_hashed_vector
#define SYMBOL_SEARCH_NAME(symbol)
static struct symbol * iter_match_first_hashed(const struct dictionary *dict, const lookup_name_info &name, struct dict_iterator *iterator)
int dict_size(const struct dictionary *dict)
#define DICT_HASHTABLE_SIZE(n)
struct dictionary * dict_create_hashed_expandable(enum language language)
const struct dictionary * dict
static struct symbol * iter_match_next_hashed(const lookup_name_info &name, struct dict_iterator *iterator)
static void add_symbol_nonexpandable(struct dictionary *dict, struct symbol *sym)
static int size_hashed(const struct dictionary *dict)
struct dictionary_linear_expandable linear_expandable
static void free_obstack(struct dictionary *dict)
struct symbol * dict_iterator_first(const struct dictionary *dict, struct dict_iterator *iterator)
unsigned int msymbol_hash_iw(const char *string)
static struct symbol * iterator_next_linear(struct dict_iterator *iterator)
#define DICT_HASHED_BUCKETS(d)
#define DICT_ITERATOR_INDEX(iter)