remove bugs in processing of lines

This commit is contained in:
h_vogt 2010-05-16 11:55:07 +00:00
parent 63c6260696
commit 1cf306f8e8
3 changed files with 59 additions and 38 deletions

View File

@ -1,3 +1,8 @@
2010-05-15 Holger Vogt
* inpcom.c exclude comment lines from stripping EOL comments
subckt.c: exclude *, . and .control ... .endc lines from processing to
getting rid of ( ) around node lists
2010-05-14 Holger Vogt 2010-05-14 Holger Vogt
* dllitf.h, cplsetup.c, cmexport.c, int/udnfunc.c, real/udnfunc.c, xspice.c: * dllitf.h, cplsetup.c, cmexport.c, int/udnfunc.c, real/udnfunc.c, xspice.c:
tmalloc patch by R Larice tmalloc patch by R Larice

View File

@ -1712,8 +1712,8 @@ inp_stripcomments_line(char * s)
{ {
char c = ' '; /* anything other than a comment character */ char c = ' '; /* anything other than a comment character */
char * d = s; char * d = s;
if(*s=='\0') return; /* empty line */ if(*s=='\0') return; /* empty line */
if(*s=='*') return; /* line is already a comment */
/* look for comments */ /* look for comments */
while((c=*d)!='\0') { while((c=*d)!='\0') {
d++; d++;
@ -4055,6 +4055,7 @@ static void inp_bsource_compat(struct line *deck)
new_str = wl_flatten(wlist); new_str = wl_flatten(wlist);
wl_free(wlist); wl_free(wlist);
wlist = NULL;
wl = NULL; wl = NULL;
tmp_char = copy(curr_line); tmp_char = copy(curr_line);

View File

@ -156,7 +156,7 @@ inp_subcktexpand(struct line *deck)
{ {
struct line *ll, *c; struct line *ll, *c;
char *s; char *s;
int ok = 0; int ok = 0, skip_control = 0;
char *t; char *t;
int i; int i;
wordlist *wl; wordlist *wl;
@ -269,43 +269,58 @@ inp_subcktexpand(struct line *deck)
}/* if(ciprefix.. */ }/* if(ciprefix.. */
} /* for(c=deck.. */ } /* for(c=deck.. */
/* Let's do a few cleanup things... Get rid of ( ) around node /* Let's do a few cleanup things... Get rid of ( ) around node lists... */
* lists... for (c = deck; c; c = c->li_next) { /* iterate on lines in deck */
*/ /* exclude any line inside .control ... .endc */
for (c = deck; c; c = c->li_next) { /* iterate on lines in deck */ if ( ciprefix(".control", c->li_line) ) {
if (ciprefix(start, c->li_line)) { /* if we find .subckt . . . */ skip_control ++;
continue;
} else if( ciprefix(".endc", c->li_line) ) {
skip_control --;
continue;
} else if(skip_control > 0) {
continue;
}
if (ciprefix(start, c->li_line)) { /* if we find .subckt . . . */
#ifdef TRACE #ifdef TRACE
/* SDB debug statement */ /* SDB debug statement */
printf("In inp_subcktexpand, found a .subckt: %s\n", c->li_line); printf("In inp_subcktexpand, found a .subckt: %s\n", c->li_line);
#endif /* TRACE */ #endif /* TRACE */
for (s = c->li_line; *s && (*s != '('); s++) /* Iterate charwise along line until ( is found */ for (s = c->li_line; *s && (*s != '('); s++) /* Iterate charwise along line until ( is found */
; ;
if (*s) { if (*s) {
while (s[0] && (s[1] != ')')) { while (s[0] && (s[1] != ')')) {
s[0] = s[1]; s[0] = s[1];
s++; s++;
} }
while (s[1]) { while (s[1]) {
s[0] = s[2]; s[0] = s[2];
s++; s++;
} }
} /* if (*s) . . . */ } /* if (*s) . . . */
} else { }
for (s = c->li_line; *s && !isspace(*s); s++) /* Iterate charwise along line until space is found */ else if ((*(c->li_line)=='*') || (*(c->li_line)=='.')) {
; continue;
while (isspace(*s)) }
s++; else { /* any other line . . . */
if (*s == '(') { /* Iterate charwise along line until first space is found */
while (s[0] && (s[1] != ')')) { for (s = c->li_line; *s && !isspace(*s); s++)
s[0] = s[1]; ;
s++; while (isspace(*s))
} s++;
while (s[1]) { /* continure here only if '(' follows after the first space */
s[0] = s[2]; if (*s == '(') {
s++; while (s[0] && (s[1] != ')')) {
} /* while */ s[0] = s[1];
} /* if (*s == '(' . . . */ s++;
} }
while (s[1]) {
s[0] = s[2];
s++;
} /* while */
} /* if (*s == '(' . . . */
} /* any other line */
} /* for (c = deck . . . */ } /* for (c = deck . . . */