From 96d1badb0bbf75a5ebb956146dc9bd959139ab0f Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Tue, 28 Apr 2020 15:16:07 +0200 Subject: [PATCH] Add default model selection to diode, modify some commenmts --- src/frontend/inp.c | 2 +- src/frontend/inpcom.c | 2 +- src/spicelib/parser/inp2d.c | 9 ++++++++- src/spicelib/parser/inp2j.c | 6 ++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 73043ca4d..3916b8c4d 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -1158,7 +1158,7 @@ inp_dodeck( #endif if (dd->warning) { - out_printf("Caution for line %d :\n %s\n%s\n", + out_printf("Warning for line %d:\n %s\n%s\n", dd->linenum_orig, dd->line, dd->warning); } diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 619a4676e..4035fe0ba 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -8692,7 +8692,7 @@ static void inp_rem_unused_models(struct nscope *root, struct card *deck) mark_all_binned(m->model->level, elem_model_name); } else { - fprintf(stderr, "warning, can't find model %s\n\n", + fprintf(stderr, "\nWarning, can't find model %s\n", elem_model_name); } } diff --git a/src/spicelib/parser/inp2d.c b/src/spicelib/parser/inp2d.c index 706e9d439..898e56bb4 100644 --- a/src/spicelib/parser/inp2d.c +++ b/src/spicelib/parser/inp2d.c @@ -49,7 +49,14 @@ void INP2D(CKTcircuit *ckt, INPtables * tab, struct card *current) INPtermInsert(ckt, &nname2, tab, &node2); INPgetNetTok(&line, &model, 1); INPinsert(&model, tab); - current->error = INPgetMod(ckt, model, &thismodel, tab); + char* errormsg = INPgetMod(ckt, model, &thismodel, tab); + /* If ft_usedefmodel, just issue a warning and continue + with default model parameters */ + if (ft_usedefmodel) + current->warning = errormsg; + /* If current->error is set, ngspice will stop */ + else + current->error = errormsg; if (thismodel != NULL) { if ((mytype != thismodel->INPmodType) diff --git a/src/spicelib/parser/inp2j.c b/src/spicelib/parser/inp2j.c index dd9470c50..602f26f24 100644 --- a/src/spicelib/parser/inp2j.c +++ b/src/spicelib/parser/inp2j.c @@ -34,7 +34,6 @@ void INP2J(CKTcircuit *ckt, INPtables * tab, struct card *current) INPmodel *thismodel; /* pointer to model description for user's model */ GENmodel *mdfast; /* pointer to the actual model */ IFuid uid; /* uid of default model */ - char* errormsg; line = current->line; INPgetNetTok(&line, &name, 1); @@ -47,9 +46,12 @@ void INP2J(CKTcircuit *ckt, INPtables * tab, struct card *current) INPtermInsert(ckt, &nname3, tab, &node3); INPgetNetTok(&line, &model, 1); INPinsert(&model, tab); - errormsg = INPgetMod(ckt, model, &thismodel, tab); + char *errormsg = INPgetMod(ckt, model, &thismodel, tab); + /* If ft_usedefmodel, just issue a warning and continue + with default model parameters */ if (ft_usedefmodel) current->warning = errormsg; + /* If current->error is set, ngspice will stop */ else current->error = errormsg; if (thismodel != NULL) {