From eb27a18ae3e32962a503441707e176a2e409ce4b Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Wed, 3 Jan 2024 21:21:03 -0500 Subject: [PATCH] Corrected two different errors: (1) When a comment line follows a ".subckt" line, and the comment line is empty or all whitespace, then the following line would be ignored. This condition appears to be very specific and was solved simply by detecting it and handling it. (2) Occasionally the "M" parameter of a subcircuit will be recorded as type double, and this was not being anticipated by the code that checks if "M=1" matches a corresponding entry with no "M" parameter. Simple fix to check the condition where the "M" parameter is type double. --- VERSION | 2 +- base/netcmp.c | 4 +++- base/netfile.c | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 3b66ac4..7d14180 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.264 +1.5.265 diff --git a/base/netcmp.c b/base/netcmp.c index 94e52a8..6809a5c 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -6124,7 +6124,9 @@ PropertyMatch(struct Element *E1, struct Element *E2, if (kl2 != NULL) break; // Property is required } - else if (vl2->value.ival != 1) + else if ((vl2->type == PROP_INTEGER) && (vl2->value.ival != 1)) + break; // Property M != 1 or S != 1 is a mismatch. + else if ((vl2->type == PROP_DOUBLE) && (vl2->value.dval != 1)) break; // Property M != 1 or S != 1 is a mismatch. } if (vl2->type != PROP_ENDLIST) { diff --git a/base/netfile.c b/base/netfile.c index d9e6262..ff1781b 100644 --- a/base/netfile.c +++ b/base/netfile.c @@ -587,6 +587,12 @@ void SkipTokNoNewline(char *delimiter) /* */ /* Modified 3/30/2015 to include the condition where a comment line is */ /* in the middle of a series of continuation lines. */ +/* */ +/* Modified 1/3/2024 to avoid skipping two lines if a line has only the */ +/* comment character '*' followed by a newline. It seems that '\n' is */ +/* being ignored in WHITESPACE_DELIMITER, but it's easier to write the */ +/* code to find the exception rather than track down the problem in */ +/* GetNextLine(). */ /*----------------------------------------------------------------------*/ void SpiceTokNoNewline(void) @@ -598,8 +604,14 @@ void SpiceTokNoNewline(void) while (nexttok == NULL) { contline = getc(infile); if (contline == '*') { - GetNextLine(WHITESPACE_DELIMITER); - SkipNewLine(NULL); + char testline = ' '; + while ((testline == ' ') || (testline == '\t')) + testline = getc(infile); + if (testline != '\n') { + ungetc(testline, infile); + GetNextLine(WHITESPACE_DELIMITER); + SkipNewLine(NULL); + } continue; } else if (contline != '+') {