mirror of
https://git.freebsd.org/ports.git
synced 2025-04-28 09:36:41 -04:00
Applied several patches from this website: http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/secD.html specifically fixes for: - Where command causes crashes - Recognition of scale factors in arbitrary source - Current Controlled Switch in subckt, parsing error - Noise analysis bug - Save segmentation faults - BSIM1 model xpart parameter random - Tran analysis default TSTEP PR: ports/143727 Submitted by: "Pedro F. Giffuni" <giffunip@tutopia.com>
41 lines
1.4 KiB
Text
41 lines
1.4 KiB
Text
--- src/lib/inp/inpgtok.c.orig 2010-02-09 15:39:09.000000000 +0000
|
|
+++ src/lib/inp/inpgtok.c 2010-02-09 15:43:10.000000000 +0000
|
|
@@ -27,6 +27,7 @@
|
|
int gobble; /* eat non-whitespace trash AFTER token? */
|
|
{
|
|
char * point;
|
|
+ int signstate;
|
|
|
|
/* scan along throwing away garbage characters */
|
|
for(point = *line;*point != '\0' ; point++ ) {
|
|
@@ -41,6 +42,7 @@
|
|
/* mark beginning of token */
|
|
*line = point;
|
|
/* now find all good characters */
|
|
+ signstate = 0;
|
|
for(point = *line;*point!='\0';point++) {
|
|
if(*point == ' ') break;
|
|
if(*point == '\t') break;
|
|
@@ -48,6 +50,22 @@
|
|
if(*point == '(') break;
|
|
if(*point == ')') break;
|
|
if(*point == ',') break;
|
|
+ /* This is not complex enough to catch all errors, but it will
|
|
+ get the "good" parses */
|
|
+ if(*point == '+' && (signstate == 1 || signstate == 3)) break;
|
|
+ if(*point == '-' && (signstate == 1 || signstate == 3)) break;
|
|
+ if(*point == '*') break;
|
|
+ if(*point == '/') break;
|
|
+ if(*point == '^') break;
|
|
+ if (isdigit(*point) || *point == '.') {
|
|
+ if (signstate > 1)
|
|
+ signstate = 3;
|
|
+ else
|
|
+ signstate = 1;
|
|
+ } else if (tolower(*point) == 'e' && signstate == 1)
|
|
+ signstate = 2;
|
|
+ else
|
|
+ signstate = 3;
|
|
}
|
|
if (point == *line && *point) /* Weird items, 1 char */
|
|
point++;
|