diff --git a/ChangeLog b/ChangeLog index 4f07d6c8c..48a360560 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-05-16 Holger Vogt + * inpcom.c lines 2940ff fix case 'q' + * inp.c:788 error message with original line number from + input deck + * inp2q.c:155 error message if no model is found and default + BJT is selected instead + 2009-05-12 Holger Vogt * inpcom.c fcn inp_fix_gnd_name() remove excessive white spaces after replacing gnd by 0 diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 979451176..b0c60de65 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -785,7 +785,7 @@ inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse, if (p == dd->li_error) out_printf("Error on line %d : %s\n\t%s\n", - dd->li_linenum, dd->li_line, dd->li_error); + dd->li_linenum_orig, dd->li_line, dd->li_error); else out_printf("\t%s\n", p); diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index c0d54ef67..93257409e 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2899,7 +2899,7 @@ static int get_number_terminals( char *c ) { int i, j, k; - char *name[10]; + char *name[12]; char nam_buf[33]; bool area_found = FALSE; @@ -2938,16 +2938,32 @@ get_number_terminals( char *c ) return i-j-2; break; case 'q': /* recognition of 3/4 terminal bjt's needed */ + /* QXXXXXXX NC NB NE MNAME */ + /* 12 tokens maximum */ i = j = 0; - while ( (i < 10) && (*c != '\0') ) { + while ( (i < 12) && (*c != '\0') ) { + char* comma; name[i] = gettok_instance(&c); if (strstr(name[i], "off") || strstr(name[i], "=")) j++; + /* If we have IC=VBE, VCE instead of IC=VBE,VCE we need to inc j */ + if ((comma = strstr(name[i], ",")) && ( *(++comma) == NULL)) j++; + /* If we have IC=VBE , VCE we need to inc j */ + if (eq(name[i], ",")) j++; i++; } i--; area_found = FALSE; for (k = i; k > i-j-1; k--) { - if (isdigit(*name[k])) area_found = TRUE; + bool only_digits = TRUE; + char* nametmp = name[k]; + /* MNAME has to contain at least one alpha character. AREA may be assumed + if we have a token with only digits, and where the previous token does not + end with a ',' */ + while (*nametmp) { + if (isalpha(*nametmp) || (*nametmp == ',')) only_digits = FALSE; + nametmp++; + } + if (only_digits && (strstr(name[k-1],",") == NULL)) area_found = TRUE; } if (area_found) { return i-j-2; diff --git a/src/spicelib/parser/inp2q.c b/src/spicelib/parser/inp2q.c index 50ababcf2..3528ed50a 100644 --- a/src/spicelib/parser/inp2q.c +++ b/src/spicelib/parser/inp2q.c @@ -141,15 +141,21 @@ void INP2Q(void *ckt, INPtables * tab, card * current, void *gnode) type = (thismodel->INPmodType); mdfast = (thismodel->INPmodfast); } else { - type = INPtypelook("BJT"); + /* no model found */ + type = INPtypelook("BJT"); if (type < 0) { LITERR("Device type BJT not supported by this binary\n"); return; } if (!tab->defQmod) { /* create default Q model */ + char *err; IFnewUid(ckt, &uid, (IFuid) NULL, "Q", UID_MODEL, (void **) NULL); IFC(newModel, (ckt, type, &(tab->defQmod), uid)); + err = (char *) MALLOC((70 + strlen(model)) * sizeof(char)); + (void) sprintf(err, "Unable to find definition of model %s - default BJT assumed \n", model); + LITERR(err); + tfree(err); } mdfast = tab->defQmod; }