numparam, use `local_symbols[0]' instead of `global_symbols'
This commit is contained in:
parent
cdf4623b6f
commit
30fc375e2c
|
|
@ -46,8 +46,6 @@ typedef struct _ttdico { /* the input scanner data structure */
|
|||
int errcount;
|
||||
int symbol_stack_alloc; /* stack allocation */
|
||||
int stack_depth; /* current depth of the symbol stack */
|
||||
NGHASHPTR global_symbols; /* hash table of globally defined symbols
|
||||
for quick lookup */
|
||||
NGHASHPTR *local_symbols; /* stack of locally defined symbols */
|
||||
NGHASHPTR inst_symbols; /* instance qualified symbols - after a pop */
|
||||
char **inst_name; /* name of subcircuit */
|
||||
|
|
|
|||
|
|
@ -471,8 +471,8 @@ nupa_del_dicoS(void)
|
|||
dispose(dicoS->dynrefptr);
|
||||
dispose(dicoS->dyncategory);
|
||||
dispose(dicoS->inst_name);
|
||||
nghash_free(dicoS->local_symbols[0], del_attrib, NULL);
|
||||
dispose(dicoS->local_symbols);
|
||||
nghash_free(dicoS->global_symbols, del_attrib, NULL);
|
||||
dispose(dicoS);
|
||||
dicoS = NULL;
|
||||
}
|
||||
|
|
@ -588,7 +588,7 @@ nupa_list_params(FILE *cp_out)
|
|||
* Finally dump the global symbols.
|
||||
* ----------------------------------------------------------------- */
|
||||
fprintf(cp_out, " global symbol definitions:\n");
|
||||
dump_symbol_table(dico_p, dico_p->global_symbols, cp_out);
|
||||
dump_symbol_table(dico_p, dico_p->local_symbols[0], cp_out);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -629,7 +629,7 @@ nupa_get_param(char *param_name, int *found)
|
|||
|
||||
if (!(*found)) {
|
||||
/* No luck. Try the global table. */
|
||||
entry_p = (entry *) nghash_find(dico_p->global_symbols, up_name);
|
||||
entry_p = (entry *) nghash_find(dico_p->local_symbols[0], up_name);
|
||||
if (entry_p) {
|
||||
result = entry_p->vl;
|
||||
*found = 1;
|
||||
|
|
@ -665,7 +665,7 @@ nupa_add_param(char *param_name, double value)
|
|||
htable_p = dico_p->local_symbols[dico_p->stack_depth];
|
||||
} else {
|
||||
/* global symbol */
|
||||
htable_p = dico_p->global_symbols;
|
||||
htable_p = dico_p->local_symbols[0];
|
||||
}
|
||||
|
||||
entry_p = attrib(dico_p, htable_p, up_name, 'N');
|
||||
|
|
|
|||
|
|
@ -250,15 +250,17 @@ initdico(tdico *dico)
|
|||
dico->srcline = -1;
|
||||
dico->errcount = 0;
|
||||
|
||||
dico->global_symbols = nghash_init(NGHASH_MIN_SIZE);
|
||||
nghash_unique(dico->global_symbols, TRUE); /* no rewrite of global symbols */
|
||||
spice_dstring_init(&(dico->lookup_buf));
|
||||
|
||||
dico->stack_depth = 0; /* top of the stack */
|
||||
asize = dico->symbol_stack_alloc = 10;/* expected stack depth - no longer limited */
|
||||
asize++; /* account for zero */
|
||||
dico->local_symbols = TMALLOC(NGHASHPTR, asize);
|
||||
dico->inst_name = TMALLOC(char*, asize);
|
||||
dico->stack_depth = 0; /* top of the stack */
|
||||
|
||||
dico->local_symbols[0] = nghash_init(NGHASH_MIN_SIZE);
|
||||
nghash_unique(dico->local_symbols[0], TRUE); /* no rewrite of global symbols */
|
||||
|
||||
dico->inst_symbols = NULL; /* instance qualified are lazily allocated */
|
||||
|
||||
compat_mode = ngspice_compat_mode();
|
||||
|
|
@ -357,7 +359,7 @@ dicostack_pop(tdico *dico)
|
|||
int
|
||||
donedico(tdico *dico)
|
||||
{
|
||||
int sze = nghash_get_size(dico->global_symbols);
|
||||
int sze = nghash_get_size(dico->local_symbols[0]);
|
||||
return sze;
|
||||
}
|
||||
|
||||
|
|
@ -385,7 +387,7 @@ entrynb(tdico *d, char *s)
|
|||
}
|
||||
|
||||
/* No local symbols - try the global table */
|
||||
entry_p = (entry *) nghash_find(d->global_symbols, s);
|
||||
entry_p = (entry *) nghash_find(d->local_symbols[0], s);
|
||||
return (entry_p);
|
||||
}
|
||||
|
||||
|
|
@ -513,7 +515,7 @@ nupa_define(tdico *dico,
|
|||
htable_p = dico->local_symbols[dico->stack_depth];
|
||||
} else {
|
||||
/* global symbol */
|
||||
htable_p = dico->global_symbols;
|
||||
htable_p = dico->local_symbols[0];
|
||||
}
|
||||
|
||||
entry_p = attrib(dico, htable_p, t, op);
|
||||
|
|
|
|||
Loading…
Reference in New Issue