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
* dllitf.h, cplsetup.c, cmexport.c, int/udnfunc.c, real/udnfunc.c, xspice.c:
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 * 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 */
while((c=*d)!='\0') {
d++;
@ -4055,6 +4055,7 @@ static void inp_bsource_compat(struct line *deck)
new_str = wl_flatten(wlist);
wl_free(wlist);
wlist = NULL;
wl = NULL;
tmp_char = copy(curr_line);

View File

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