From c2bf9a8fb42f0e46ee93d66f39bbc053fe0304dd Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 21 Mar 2020 20:57:11 -0400 Subject: [PATCH] Added new command option "extract do local" to force all .ext files to be written to the local directory instead of the directory where the .mag file is located. --- commands/CmdE.c | 7 ++++++- extract/ExtCell.c | 10 ++++++++-- extract/ExtMain.c | 1 - extract/extract.h | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/commands/CmdE.c b/commands/CmdE.c index 80bb83cf..7cabc1ae 100644 --- a/commands/CmdE.c +++ b/commands/CmdE.c @@ -878,7 +878,8 @@ cmdExpandFunc(use, windowMask) #define DOCAPACITANCE 2 #define DOCOUPLING 3 #define DOLENGTH 4 -#define DORESISTANCE 5 +#define DOLOCAL 5 +#define DORESISTANCE 6 #define LENCLEAR 0 #define LENDRIVER 1 @@ -900,6 +901,7 @@ CmdExtract(w, cmd) CellDef *selectedDef; bool dolist = FALSE; bool doforall = FALSE; + bool doLocal = FALSE; int argc = cmd->tx_argc; char **argv = cmd->tx_argv; @@ -918,6 +920,7 @@ CmdExtract(w, cmd) "capacitance extract substrate capacitance", "coupling extract coupling capacitance", "length compute driver-receiver pathlengths", + "local put all generated files in the current directory", "resistance estimate resistance", NULL }; @@ -1136,6 +1139,7 @@ CmdExtract(w, cmd) TxPrintf("%s capacitance\n", OPTSET(EXT_DOCAPACITANCE)); TxPrintf("%s coupling\n", OPTSET(EXT_DOCOUPLING)); TxPrintf("%s length\n", OPTSET(EXT_DOLENGTH)); + TxPrintf("%s local\n", OPTSET(EXT_DOLOCAL)); TxPrintf("%s resistance\n", OPTSET(EXT_DORESISTANCE)); return; #undef OPTSET @@ -1163,6 +1167,7 @@ CmdExtract(w, cmd) case DOCAPACITANCE: option = EXT_DOCAPACITANCE; break; case DOCOUPLING: option = EXT_DOCOUPLING; break; case DOLENGTH: option = EXT_DOLENGTH; break; + case DOLOCAL: option = EXT_DOLOCAL; break; case DORESISTANCE: option = EXT_DORESISTANCE; break; } if (no) ExtOptions &= ~option; diff --git a/extract/ExtCell.c b/extract/ExtCell.c index a34f27e1..4aa8fb2a 100644 --- a/extract/ExtCell.c +++ b/extract/ExtCell.c @@ -95,8 +95,11 @@ ExtCell(def, outName, doLength) { char *filename; FILE *f; + bool doLocal; - f = extFileOpen(def, outName, "w", &filename); + doLocal = (ExtOptions & EXT_DOLOCAL) ? TRUE : FALSE; + + f = extFileOpen(def, outName, "w", doLocal, &filename); TxPrintf("Extracting %s into %s:\n", def->cd_name, filename); @@ -149,7 +152,7 @@ ExtCell(def, outName, doLength) */ FILE * -extFileOpen(def, file, mode, prealfile) +extFileOpen(def, file, mode, doLocal, prealfile) CellDef *def; /* Cell whose .ext file is to be written */ char *file; /* If non-NULL, open 'name'.ext; otherwise, * derive filename from 'def' as described @@ -158,6 +161,7 @@ extFileOpen(def, file, mode, prealfile) char *mode; /* Either "r" or "w", the mode in which the .ext * file is to be opened. */ + bool doLocal; /* If true, always write to local directory */ char **prealfile; /* If this is non-NULL, it gets set to point to * a string holding the name of the .ext file. */ @@ -167,6 +171,8 @@ extFileOpen(def, file, mode, prealfile) FILE *rfile, *testf; if (file) name = file; + else if (doLocal) + name = def->cd_name; /* No path component, so save locally */ else if (def->cd_file) { name = def->cd_file; diff --git a/extract/ExtMain.c b/extract/ExtMain.c index 2eba659f..65887b5a 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -632,7 +632,6 @@ closeit: void extExtractStack(stack, doExtract, rootDef) Stack *stack; - bool doExtract; CellDef *rootDef; { int fatal = 0, warnings = 0; diff --git a/extract/extract.h b/extract/extract.h index 82e143d5..57332f89 100644 --- a/extract/extract.h +++ b/extract/extract.h @@ -66,6 +66,7 @@ extern char *extDevTable[]; #define EXT_DORESISTANCE 0x08 /* Extract resistance */ #define EXT_DOLENGTH 0x10 /* Extract pathlengths */ #define EXT_DOALL 0x1f /* ALL OF THE ABOVE */ +#define EXT_DOLOCAL 0x20 /* Write to local directory only */ extern int ExtOptions; /* Bitmask of above */