Patch to allow for vm(4,0) and similar.

This commit is contained in:
pnenzi 2005-08-08 19:08:23 +00:00
parent 3c0898d7ac
commit db294d26c3
2 changed files with 49 additions and 48 deletions

View File

@ -1,3 +1,11 @@
2005-08-08 Paolo Nenzi <p.nenzi@ieee.org>
* src/frontend/dotcards.c: Applied patch from Mike Waters
<M.Waters@bom.gov.au> to parse probes in the form:
vm(4,0) or vm(0,4). Where one of the nodes is ground ie. 0, if
the probe is "v" everything works but anything else ie. "vm", "vp",
etc. fails.
2005-08-06 Paolo Nenzi <p.nenzi@ieee.org>
* src/xspice/mif/mifsetup.c: Updated MIFunsetup to the latest version

View File

@ -441,64 +441,57 @@ fixem(char *string)
char *ss = string; /* Get rid of ss ? */
if (ciprefix("v(", string) &&strchr(string, ',')) {
for (s = string; *s && (*s != ','); s++)
;
*s++ = '\0';
for (t = s; *t && (*t != ')'); t++)
;
*t = '\0';
if (eq(s, "0"))
(void) sprintf(buf, "v(%s)", string + 2);
for (s = string; *s && (*s != ','); s++) ; *s++ = '\0';
for (t = s; *t && (*t != ')'); t++) ; *t = '\0';
if (eq(s, "0")) (void) sprintf(buf, "v(%s)", string + 2);
else if (eq(string + 2, "0"))
(void) sprintf(buf, "-v(%s)", s);
else
(void) sprintf(buf, "v(%s)-v(%s)", string + 2, s);
tfree(ss);
string = copy(buf);
(void) sprintf(buf, "-v(%s)", s);
else (void) sprintf(buf, "v(%s)-v(%s)", string + 2, s);
} else if (ciprefix("vm(", string)) {
for (s = string; *s && (*s != ')'); s++)
;
*s = '\0';
(void) sprintf(buf, "mag(v(%s))", string + 3);
tfree(ss);
string = copy(buf);
for (s = string; *s && (*s != ','); s++) ; *s++ = '\0';
for (t = s; *t && (*t != ')'); t++) ; *t = '\0';
if (eq(s, "0")) (void) sprintf(buf, "mag(v(%s))", string + 3);
else if (eq(string + 2, "0"))
(void) sprintf(buf, "mag(-v(%s))", s);
else (void) sprintf(buf, "mag(v(%s)-v(%s))", string + 3, s);
} else if (ciprefix("vp(", string)) {
for (s = string; *s && (*s != ')'); s++)
;
*s = '\0';
(void) sprintf(buf, "ph(v(%s))", string + 3);
tfree(ss);
string = copy(buf);
for (s = string; *s && (*s != ','); s++) ; *s++ = '\0';
for (t = s; *t && (*t != ')'); t++) ; *t = '\0';
if (eq(s, "0")) (void) sprintf(buf, "ph(v(%s))", string + 3);
else if (eq(string + 2, "0"))
(void) sprintf(buf, "ph(-v(%s))", s);
else (void) sprintf(buf, "ph(v(%s)-v(%s))", string + 3, s);
} else if (ciprefix("vi(", string)) {
for (s = string; *s && (*s != ')'); s++)
;
*s = '\0';
(void) sprintf(buf, "imag(v(%s))", string + 3);
tfree(ss);
string = copy(buf);
for (s = string; *s && (*s != ','); s++) ; *s++ = '\0';
for (t = s; *t && (*t != ')'); t++) ; *t = '\0';
if (eq(s, "0")) (void) sprintf(buf, "imag(v(%s))", string + 3);
else if (eq(string + 2, "0"))
(void) sprintf(buf, "imag(-v(%s))", s);
else (void) sprintf(buf, "imag(v(%s)-v(%s))", string + 3, s);
} else if (ciprefix("vr(", string)) {
for (s = string; *s && (*s != ')'); s++)
;
*s = '\0';
(void) sprintf(buf, "real(v(%s))", string + 3);
tfree(ss);
string = copy(buf);
for (s = string; *s && (*s != ','); s++) ; *s++ = '\0';
for (t = s; *t && (*t != ')'); t++) ; *t = '\0';
if (eq(s, "0")) (void) sprintf(buf, "real(v(%s))", string + 3);
else if (eq(string + 2, "0"))
(void) sprintf(buf, "real(-v(%s))", s);
else (void) sprintf(buf, "real(v(%s)-v(%s))", string + 3, s);
} else if (ciprefix("vdb(", string)) {
for (s = string; *s && (*s != ')'); s++)
;
*s = '\0';
(void) sprintf(buf, "db(v(%s))", string + 4);
tfree(ss);
string = copy(buf);
for (s = string; *s && (*s != ','); s++) ; *s++ = '\0';
for (t = s; *t && (*t != ')'); t++) ; *t = '\0';
if (eq(s, "0")) (void) sprintf(buf, "db(v(%s))", string + 4);
else if (eq(string + 2, "0"))
(void) sprintf(buf, "db(-v(%s))", s);
else (void) sprintf(buf, "db(v(%s)-v(%s))", string + 4, s);
} else if (ciprefix("i(", string)) {
for (s = string; *s && (*s != ')'); s++)
;
*s = '\0';
for (s = string; *s && (*s != ')'); s++) ; *s = '\0';
string += 2;
(void) sprintf(buf, "%s#branch", string);
tfree(ss);
string = copy(buf);
}
else return (string);
tfree(ss);
string = copy(buf);
return (string);
}