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.
This commit is contained in:
Tim Edwards 2020-03-21 20:57:11 -04:00
parent ae6b627df7
commit c2bf9a8fb4
4 changed files with 15 additions and 4 deletions

View File

@ -878,7 +878,8 @@ cmdExpandFunc(use, windowMask)
#define DOCAPACITANCE 2 #define DOCAPACITANCE 2
#define DOCOUPLING 3 #define DOCOUPLING 3
#define DOLENGTH 4 #define DOLENGTH 4
#define DORESISTANCE 5 #define DOLOCAL 5
#define DORESISTANCE 6
#define LENCLEAR 0 #define LENCLEAR 0
#define LENDRIVER 1 #define LENDRIVER 1
@ -900,6 +901,7 @@ CmdExtract(w, cmd)
CellDef *selectedDef; CellDef *selectedDef;
bool dolist = FALSE; bool dolist = FALSE;
bool doforall = FALSE; bool doforall = FALSE;
bool doLocal = FALSE;
int argc = cmd->tx_argc; int argc = cmd->tx_argc;
char **argv = cmd->tx_argv; char **argv = cmd->tx_argv;
@ -918,6 +920,7 @@ CmdExtract(w, cmd)
"capacitance extract substrate capacitance", "capacitance extract substrate capacitance",
"coupling extract coupling capacitance", "coupling extract coupling capacitance",
"length compute driver-receiver pathlengths", "length compute driver-receiver pathlengths",
"local put all generated files in the current directory",
"resistance estimate resistance", "resistance estimate resistance",
NULL NULL
}; };
@ -1136,6 +1139,7 @@ CmdExtract(w, cmd)
TxPrintf("%s capacitance\n", OPTSET(EXT_DOCAPACITANCE)); TxPrintf("%s capacitance\n", OPTSET(EXT_DOCAPACITANCE));
TxPrintf("%s coupling\n", OPTSET(EXT_DOCOUPLING)); TxPrintf("%s coupling\n", OPTSET(EXT_DOCOUPLING));
TxPrintf("%s length\n", OPTSET(EXT_DOLENGTH)); TxPrintf("%s length\n", OPTSET(EXT_DOLENGTH));
TxPrintf("%s local\n", OPTSET(EXT_DOLOCAL));
TxPrintf("%s resistance\n", OPTSET(EXT_DORESISTANCE)); TxPrintf("%s resistance\n", OPTSET(EXT_DORESISTANCE));
return; return;
#undef OPTSET #undef OPTSET
@ -1163,6 +1167,7 @@ CmdExtract(w, cmd)
case DOCAPACITANCE: option = EXT_DOCAPACITANCE; break; case DOCAPACITANCE: option = EXT_DOCAPACITANCE; break;
case DOCOUPLING: option = EXT_DOCOUPLING; break; case DOCOUPLING: option = EXT_DOCOUPLING; break;
case DOLENGTH: option = EXT_DOLENGTH; break; case DOLENGTH: option = EXT_DOLENGTH; break;
case DOLOCAL: option = EXT_DOLOCAL; break;
case DORESISTANCE: option = EXT_DORESISTANCE; break; case DORESISTANCE: option = EXT_DORESISTANCE; break;
} }
if (no) ExtOptions &= ~option; if (no) ExtOptions &= ~option;

View File

@ -95,8 +95,11 @@ ExtCell(def, outName, doLength)
{ {
char *filename; char *filename;
FILE *f; 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); TxPrintf("Extracting %s into %s:\n", def->cd_name, filename);
@ -149,7 +152,7 @@ ExtCell(def, outName, doLength)
*/ */
FILE * FILE *
extFileOpen(def, file, mode, prealfile) extFileOpen(def, file, mode, doLocal, prealfile)
CellDef *def; /* Cell whose .ext file is to be written */ CellDef *def; /* Cell whose .ext file is to be written */
char *file; /* If non-NULL, open 'name'.ext; otherwise, char *file; /* If non-NULL, open 'name'.ext; otherwise,
* derive filename from 'def' as described * 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 char *mode; /* Either "r" or "w", the mode in which the .ext
* file is to be opened. * 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 char **prealfile; /* If this is non-NULL, it gets set to point to
* a string holding the name of the .ext file. * a string holding the name of the .ext file.
*/ */
@ -167,6 +171,8 @@ extFileOpen(def, file, mode, prealfile)
FILE *rfile, *testf; FILE *rfile, *testf;
if (file) name = file; if (file) name = file;
else if (doLocal)
name = def->cd_name; /* No path component, so save locally */
else if (def->cd_file) else if (def->cd_file)
{ {
name = def->cd_file; name = def->cd_file;

View File

@ -632,7 +632,6 @@ closeit:
void void
extExtractStack(stack, doExtract, rootDef) extExtractStack(stack, doExtract, rootDef)
Stack *stack; Stack *stack;
bool doExtract;
CellDef *rootDef; CellDef *rootDef;
{ {
int fatal = 0, warnings = 0; int fatal = 0, warnings = 0;

View File

@ -66,6 +66,7 @@ extern char *extDevTable[];
#define EXT_DORESISTANCE 0x08 /* Extract resistance */ #define EXT_DORESISTANCE 0x08 /* Extract resistance */
#define EXT_DOLENGTH 0x10 /* Extract pathlengths */ #define EXT_DOLENGTH 0x10 /* Extract pathlengths */
#define EXT_DOALL 0x1f /* ALL OF THE ABOVE */ #define EXT_DOALL 0x1f /* ALL OF THE ABOVE */
#define EXT_DOLOCAL 0x20 /* Write to local directory only */
extern int ExtOptions; /* Bitmask of above */ extern int ExtOptions; /* Bitmask of above */