From 22fbb2865682485b9c4a1a5803af65d44c3585c6 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sun, 6 Aug 2023 16:53:07 -0400 Subject: [PATCH] Corrected one major error which will cause magic to fail to find the ".res.ext" file from "extresist" after using "extract do local" (and probably with "extract path" as well). Fixed this, and also made sure that "extresist" writes the ".res.ext" file to the same location as ".ext" always, so that handling is consistent throughout the full R-C extraction process, across the use of "extract", "ext2sim", "extresist", and "ext2spice". --- VERSION | 2 +- extflat/EFread.c | 30 ++++++++++++++++++++++++++++-- resis/ResRex.c | 12 +++++++++++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 33d1d865..0cea723e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.421 +8.3.422 diff --git a/extflat/EFread.c b/extflat/EFread.c index 9ea115ba..0d472350 100644 --- a/extflat/EFread.c +++ b/extflat/EFread.c @@ -623,13 +623,39 @@ resistChanged: break; } } - (void) fclose(inf); + fclose(inf); + inf = (FILE *)NULL; /* Is there an "extresist" extract file? */ if (DoResist) { DoResist = FALSE; /* do this only once */ - inf = PaOpen(name, "r", ".res.ext", EFSearchPath, EFLibPath, &efReadFileName); + if (EFSearchPath != NULL) + inf = PaOpen(name, "r", ".res.ext", EFSearchPath, + EFLibPath, &efReadFileName); + + if ((inf == NULL) && (dbdef = DBCellLookDef(name)) != NULL) + { + /* If cell is in main database, check if there is a file path set. */ + if (dbdef->cd_file != NULL) + { + char *filepath, *sptr; + + filepath = StrDup((char **)NULL, dbdef->cd_file); + sptr = strrchr(filepath, '/'); + if (sptr) { + *sptr = '\0'; + inf = PaOpen(name, "r", ".res.ext", filepath, + EFLibPath, &efReadFileName); + } + freeMagic(filepath); + } + } + + /* Try with the standard search path */ + if ((inf == NULL) && (EFSearchPath == NULL)) + inf = PaOpen(name, "r", ".res.ext", Path, EFLibPath, &efReadFileName); + if (inf != NULL) goto readfile; } diff --git a/resis/ResRex.c b/resis/ResRex.c index 2b3a93b3..e2ad134c 100644 --- a/resis/ResRex.c +++ b/resis/ResRex.c @@ -975,7 +975,17 @@ ResCheckSimNodes(celldef, resisdata) if (ResOptionsFlags & ResOpt_DoExtFile) { - ResExtFile = PaOpen(outfile,"w",".res.ext",".",(char *) NULL, (char **) NULL); + if (ExtLocalPath != NULL) + if (strcmp(ExtLocalPath, ".")) + { + char *namebuf; + namebuf = mallocMagic(strlen(ExtLocalPath) + strlen(celldef->cd_name) + + 2); + sprintf(namebuf, "%s/%s", ExtLocalPath, celldef->cd_name); + outfile = namebuf; + } + ResExtFile = PaOpen(outfile, "w", ".res.ext", ".", (char *)NULL, (char **)NULL); + if (outfile != celldef->cd_name) freeMagic(outfile); } else {