Revert "re-write inp_rep_ixx(), catch all known cases,"

This reverts commit 55c4f16134.
This commit is contained in:
Holger Vogt 2020-03-08 11:12:24 +01:00
parent 55c4f16134
commit a463d0563f
1 changed files with 5 additions and 10 deletions

View File

@ -1762,26 +1762,22 @@ static void inp_rep_ixx(struct card* deck) {
}
char* new_str = NULL;
bool strsave = FALSE;
while (line) {
char* s = strstr(line, "i(v");
if (s && (s > line) && (isspace_c(s[-1]) || is_arith_char(s[-1])
|| isquote(s[-1]) || (s[-1] == '=') || (s[-1] == '.'))) {
char* s = strstr(line, " i(v");
if (s) {
char* beg_str, *end_str, *t;
line = s;
/* replace i(vxx) by vxx#branch */
if (get_r_paren(&line) == 1) {
fprintf(stderr, "Error: missing ')' in line\n %s\n", c->line);
break;
}
/* token containing name of voltage source to be measured */
t = copy_substring(s + 2, line - 1);
t = copy_substring(s + 3, line - 1);
/* change line, convert i(XXX) to XXX#branch */
beg_str = copy_substring(beg, s);
end_str = copy(line);
tfree(new_str);
new_str = tprintf("%s%s%s%s", beg_str, t, "#branch", end_str);
strsave = TRUE;
new_str = tprintf("%s %s%s %s", beg_str, t, "#branch", end_str);
beg = line = new_str;
tfree(beg_str);
tfree(end_str);
@ -1791,10 +1787,9 @@ static void inp_rep_ixx(struct card* deck) {
break;
}
}
if (strsave) {
if (new_str) {
tfree(c->line);
c->line = new_str;
strsave = FALSE;
}
}
}