From 04163aedcc9ae6601c50d7db35af8989dfb92b57 Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Wed, 12 Nov 2025 11:32:18 -0500 Subject: [PATCH 1/2] One hopefully final modification to ensure that Tcl_InitStubs() uses the Tcl version that the program has been compiled to. This should work with both Tcl 8.X and Tcl 9.X. --- tcltk/tclnetgen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcltk/tclnetgen.c b/tcltk/tclnetgen.c index 2c6c70f..c4abfcc 100644 --- a/tcltk/tclnetgen.c +++ b/tcltk/tclnetgen.c @@ -4570,7 +4570,7 @@ int Tclnetgen_Init(Tcl_Interp *interp) /* Remember the interpreter */ netgeninterp = interp; - if (Tcl_InitStubs(interp, "8.5", 0) == NULL) return TCL_ERROR; + if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) return TCL_ERROR; for (n = 0; netgen_cmds[n].name != NULL; n++) { sprintf(keyword, "netgen::%s", netgen_cmds[n].name); From 72d7d55bbe65305e050d30599234dd4b38e29aad Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Fri, 21 Nov 2025 15:52:14 -0500 Subject: [PATCH 2/2] Corrected an issue with the "-noflatten" switch to "lvs", which is also a problem with the underlying "flatten prohibit" command option; in one place, the cell's subcircuits were being prohibited from being flattened, causing issues including a potential infinite loop. --- VERSION | 2 +- base/flatten.c | 44 ++++++++++++++++++++++++-------------------- base/netcmp.c | 2 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/VERSION b/VERSION index 8c4fe4a..6e82e37 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.308 +1.5.309 diff --git a/base/flatten.c b/base/flatten.c index 8828eea..ba9117e 100644 --- a/base/flatten.c +++ b/base/flatten.c @@ -300,8 +300,6 @@ int flattenInstancesOf(char *name, int fnum, char *instance) return 0; } } - /* Placeholder cells must not be flattened */ - if (ThisCell->flags & CELL_PLACEHOLDER) return 0; FreeNodeNames(ThisCell); @@ -339,6 +337,10 @@ int flattenInstancesOf(char *name, int fnum, char *instance) LastObj = ParentParams; continue; } + if (ChildCell->flags & CELL_PLACEHOLDER) { + LastObj = ParentParams; + continue; // Placeholder cells must not be flattened + } if (ChildCell == ThisCell) { LastObj = ParentParams; continue; // Avoid infinite loop @@ -1753,8 +1755,8 @@ PrematchLists(char *name1, int file1, char *name2, int file2) Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" " makes a better match\n", ecomp->cell1->name, name1, file1); - flattenInstancesOf(name1, file1, ecomp->cell1->name); - modified1++; + if (flattenInstancesOf(name1, file1, ecomp->cell1->name) > 0) + modified1++; } else if (ecomp->cell1 && (ecomp->num1 > 0)) { Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" @@ -1766,8 +1768,8 @@ PrematchLists(char *name1, int file1, char *name2, int file2) Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" " makes a better match\n", ecomp->cell2->name, name2, file2); - flattenInstancesOf(name2, file2, ecomp->cell2->name); - modified2++; + if (flattenInstancesOf(name2, file2, ecomp->cell2->name) > 0) + modified2++; } else if (ecomp->cell2 && (ecomp->num2 > 0)) { Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" @@ -1861,8 +1863,8 @@ PrematchLists(char *name1, int file1, char *name2, int file2) Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" " makes a better match\n", ecomp->cell2->name, name2, file2); - flattenInstancesOf(name2, file2, ecomp->cell2->name); - modified2++; + if (flattenInstancesOf(name2, file2, ecomp->cell2->name) > 0) + modified2++; } else if (ecomp->cell2) { Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" @@ -1932,8 +1934,8 @@ PrematchLists(char *name1, int file1, char *name2, int file2) Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" " makes a better match\n", ecomp->cell1->name, name1, file1); - flattenInstancesOf(name1, file1, ecomp->cell1->name); - modified1++; + if (flattenInstancesOf(name1, file1, ecomp->cell1->name) > 0) + modified1++; } else if (ecomp->cell1) { Fprintf(stdout, "Flattening instances of %s in cell %s (%d)" @@ -2295,11 +2297,12 @@ PrematchLists(char *name1, int file1, char *name2, int file2) Fprintf(stdout, "Flattening instances of %s in cell" " %s (%d) makes a better match\n", ecompX0->cell1->name, name1, file1); - flattenInstancesOf(name1, file1, - ecompX0->cell1->name); - ecompX0->num1 = 0; - ecomp0X->num1 += ecompX0->num1; - modified1++; + if (flattenInstancesOf(name1, file1, + ecompX0->cell1->name) > 0) { + ecompX0->num1 = 0; + ecomp0X->num1 += ecompX0->num1; + modified1++; + } } else { @@ -2331,11 +2334,12 @@ PrematchLists(char *name1, int file1, char *name2, int file2) Fprintf(stdout, "Flattening instances of %s in cell" " %s (%d) makes a better match\n", ecomp0X->cell2->name, name2, file2); - flattenInstancesOf(name2, file2, - ecomp0X->cell2->name); - ecomp0X->num2 = 0; - ecompX0->num2 += ecomp0X->num2; - modified2++; + if (flattenInstancesOf(name2, file2, + ecomp0X->cell2->name) > 0) { + ecomp0X->num2 = 0; + ecompX0->num2 += ecomp0X->num2; + modified2++; + } } else { Fprintf(stdout, "Flattening instances of %s in " diff --git a/base/netcmp.c b/base/netcmp.c index d19dc2e..38774c8 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -3582,7 +3582,7 @@ int FlattenUnmatched(struct nlist *tc, char *parent, int stoplevel, int loclevel tc->name, parent, tc->file); changed = flattenInstancesOf(parent, tc->file, tc->name); Fprintf(stdout, "(%d instance%s)\n", changed, ((changed == 1) ? "" : "s")); - return 1; + return (changed != 0); } if (tc->cell == NULL) return 0;