diff --git a/ChangeLog b/ChangeLog
index a2577861b..ad68465c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-08-08 Paolo Nenzi
+
+ * src/frontend/dotcards.c: Applied patch from Mike Waters
+ 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
* src/xspice/mif/mifsetup.c: Updated MIFunsetup to the latest version
diff --git a/src/frontend/dotcards.c b/src/frontend/dotcards.c
index 12d80019c..232b35f8d 100644
--- a/src/frontend/dotcards.c
+++ b/src/frontend/dotcards.c
@@ -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);
}