Browse Source

frontend/subckt.c, do not put model names into numparam hash table

nobody seems to make use of these entries.
see nupa_type which shrinks to four enum's
pre-master-46
h_vogt 10 years ago
committed by rlar
parent
commit
3dd2115291
  1. 2
      src/frontend/numparam/numpaif.h
  2. 4
      src/frontend/numparam/numparam.h
  3. 7
      src/frontend/numparam/spicenum.c
  4. 17
      src/frontend/numparam/xpressn.c
  5. 9
      src/frontend/subckt.c

2
src/frontend/numparam/numpaif.h

@ -16,7 +16,7 @@ struct card;
extern char *nupa_copy(struct card *c);
extern int nupa_eval(struct card *card);
extern void nupa_signal(int sig);
extern void nupa_scan(struct card *card, int is_subckt);
extern void nupa_scan(struct card *card);
extern void nupa_list_params(FILE *cp_out);
extern double nupa_get_param(char *param_name, int *found);
extern void nupa_add_param(char *param_name, double value);

4
src/frontend/numparam/numparam.h

@ -19,13 +19,11 @@ extern const struct nupa_type S_nupa_real;
extern const struct nupa_type S_nupa_string;
extern const struct nupa_type S_nupa_subckt;
extern const struct nupa_type S_nupa_unknown;
extern const struct nupa_type S_nupa_model;
#define NUPA_REAL (&S_nupa_real)
#define NUPA_STRING (&S_nupa_string)
#define NUPA_SUBCKT (&S_nupa_subckt)
#define NUPA_UNKNOWN (&S_nupa_unknown)
#define NUPA_MODEL (&S_nupa_model)
typedef const struct nupa_type *nupa_type;
@ -59,7 +57,7 @@ typedef struct { /* the input scanner data structure */
void initdico(dico_t *);
int donedico(dico_t *);
void dico_free_entry(entry_t *);
bool defsubckt(dico_t *, struct card *, nupa_type categ);
bool defsubckt(dico_t *, struct card *);
int findsubckt(dico_t *, const char *s);
bool nupa_substitute(dico_t *, const char *s, char *r);
bool nupa_assignment(dico_t *, const char *s, char mode);

7
src/frontend/numparam/spicenum.c

@ -382,12 +382,9 @@ nupa_done(void)
/* SJB - Scan the line for subcircuits */
void
nupa_scan(struct card *card, int is_subckt)
nupa_scan(struct card *card)
{
if (is_subckt)
defsubckt(dicoS, card, NUPA_SUBCKT);
else
defsubckt(dicoS, card, NUPA_MODEL);
defsubckt(dicoS, card);
}

17
src/frontend/numparam/xpressn.c

@ -472,7 +472,7 @@ nupa_define(dico_t *dico,
c = entry->tp;
if ((c == NUPA_REAL) || (c == NUPA_STRING) || (c == NUPA_UNKNOWN)) {
if (c != NUPA_SUBCKT) {
entry->vl = z;
entry->tp = tpe;
@ -487,13 +487,9 @@ nupa_define(dico_t *dico,
warn = message(dico, "%s:%d overwritten.\n", t, entry->level);
} else {
/* suppress error message, resulting from multiple definition of
symbols (devices) in .model lines with same name, but in different subcircuits.
Subcircuit expansion is o.k., we have to deal with this numparam
behaviour later. (H. Vogt 090426)
*/
/* error message for redefinition of subcircuits */
if (0)
message(dico, "%s: cannot redefine\n", t);
message(dico, "subckt %s is already used,\n cannot be redefined\n", t);
}
return 0;
@ -501,9 +497,9 @@ nupa_define(dico_t *dico,
bool
defsubckt(dico_t *dico, struct card *card, nupa_type categ)
defsubckt(dico_t *dico, struct card *card)
/* called on 1st pass of spice source code,
to enter subcircuit (categ=U) and model (categ=O) names
to enter subcircuit names
*/
{
const char *s = card->line;
@ -531,7 +527,7 @@ defsubckt(dico_t *dico, struct card *card, nupa_type categ)
SPICE_DSTRING ustr; /* temp user string */
spice_dstring_init(&ustr);
pscopy(&ustr, s, s_end);
err = nupa_define(dico, spice_dstring_value(&ustr), ' ', categ, 0.0, w, NULL);
err = nupa_define(dico, spice_dstring_value(&ustr), ' ', NUPA_SUBCKT, 0.0, w, NULL);
spice_dstring_free(&ustr);
} else {
err = message(dico, "Subcircuit or Model without name.\n");
@ -1589,4 +1585,3 @@ const struct nupa_type S_nupa_real = { "NUPA_REAL" };
const struct nupa_type S_nupa_string = { "NUPA_STRING" };
const struct nupa_type S_nupa_subckt = { "NUPA_SUBCKT" };
const struct nupa_type S_nupa_unknown = { "NUPA_UNKNOWN" };
const struct nupa_type S_nupa_model = { "NUPA_MODEL" };

9
src/frontend/subckt.c

@ -232,13 +232,10 @@ inp_subcktexpand(struct card *deck) {
#endif
nupa_signal(NUPADECKCOPY);
/* get the subckt/model names from the deck */
for (c = deck; c; c = c->nextcard) { /* first Numparam pass */
/* get the subckt names from the deck */
for (c = deck; c; c = c->nextcard) /* first Numparam pass */
if (ciprefix(".subckt", c->line))
nupa_scan(c, TRUE);
if (ciprefix(".model", c->line))
nupa_scan(c, FALSE);
}
nupa_scan(c);
/* now copy instances */
for (c = deck; c; c = c->nextcard) /* first Numparam pass */
c->line = nupa_copy(c);

Loading…
Cancel
Save