Merge branch 'master' into magic-8.2

This commit is contained in:
Tim Edwards 2020-03-22 03:00:06 -04:00
commit eaf1ad4827
23 changed files with 79 additions and 73 deletions

View File

@ -1 +1 @@
8.2.199
8.2.200

View File

@ -1048,7 +1048,7 @@ calmaFindCell(name, was_called)
def = DBCellLookDef(name);
if (def == NULL)
{
def = DBCellNewDef(name, (char *) NULL);
def = DBCellNewDef(name);
/*
* Tricky point: call DBReComputeBbox here to make SURE

View File

@ -1416,7 +1416,7 @@ calmaGetContactCell(type, lookOnly)
def = DBCellLookDef(contactCellName);
if ((def == (CellDef *) NULL) && (lookOnly == FALSE))
{
def = DBCellNewDef(contactCellName, (char *) NULL);
def = DBCellNewDef(contactCellName);
def->cd_flags &= ~(CDMODIFIED|CDGETNEWSTAMP);
def->cd_flags |= CDAVAILABLE;
}

View File

@ -112,7 +112,7 @@ CIFInitCells()
CIFTotalDef = DBCellLookDef("__CIF__");
if (CIFTotalDef == (CellDef *) NULL)
{
CIFTotalDef = DBCellNewDef ("__CIF__",(char *) NULL);
CIFTotalDef = DBCellNewDef("__CIF__");
ASSERT(CIFTotalDef != (CellDef *) NULL, "cifMakeCell");
DBCellSetAvail(CIFTotalDef);
CIFTotalDef->cd_flags |= CDINTERNAL;
@ -124,7 +124,7 @@ CIFInitCells()
CIFComponentDef = DBCellLookDef("__CIF2__");
if (CIFComponentDef == (CellDef *) NULL)
{
CIFComponentDef = DBCellNewDef ("__CIF2__",(char *) NULL);
CIFComponentDef = DBCellNewDef("__CIF2__");
ASSERT(CIFComponentDef != (CellDef *) NULL, "cifMakeCell");
DBCellSetAvail(CIFComponentDef);
CIFComponentDef->cd_flags |= CDINTERNAL;

View File

@ -273,7 +273,7 @@ cifFindCell(cifNum)
def = DBCellLookDef(name);
if (def == NULL)
{
def = DBCellNewDef(name, (char *) NULL);
def = DBCellNewDef(name);
/* Tricky point: call DBReComputeBbox here to make SURE
* that the cell has a valid bounding box. Otherwise,

View File

@ -896,14 +896,12 @@ CmdCellname(w, cmd)
{
char *fullpath;
fullpath = (char *)mallocMagic(strlen(filepath) +
strlen(cellDef->cd_name) + 6);
sprintf(fullpath, "%s/%s.mag", filepath, cellDef->cd_name);
strlen(cellDef->cd_name) + 2);
sprintf(fullpath, "%s/%s", filepath, cellDef->cd_name);
if (cellDef->cd_file != NULL)
{
freeMagic(cellDef->cd_file);
cellDef->cd_file = NULL;
}
cellDef->cd_file = fullpath;
}
}
@ -945,7 +943,7 @@ CmdCellname(w, cmd)
newDef = DBCellLookDef(cellname);
if (newDef == (CellDef *) NULL)
{
newDef = DBCellNewDef(cellname, (char *) NULL);
newDef = DBCellNewDef(cellname);
DBCellSetAvail(newDef);
}
break;
@ -1442,7 +1440,7 @@ CmdCif(w, cmd)
paintDef = DBCellLookDef(argv[4]);
if (paintDef == (CellDef *)NULL)
{
paintDef = DBCellNewDef(argv[4], (char *)NULL);
paintDef = DBCellNewDef(argv[4]);
DBCellSetAvail(paintDef);
}
}
@ -3699,8 +3697,7 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
if ((cellnameptr = strrchr(cmd->tx_argv[1], '/')) != NULL)
{
cellnameptr++;
/* Allocate extra space for cellname in case it needs an extension */
fullpathname = (char *)mallocMagic(strlen(cmd->tx_argv[1]) + 10);
fullpathname = (char *)mallocMagic(strlen(cmd->tx_argv[1]) + 2);
strcpy(fullpathname, cmd->tx_argv[1]);
}
else
@ -3723,7 +3720,7 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
def = DBCellLookDef(cellnameptr);
if (def == (CellDef *) NULL)
def = DBCellNewDef(cellnameptr, (char *) NULL);
def = DBCellNewDef(cellnameptr);
if (fullpathname != NULL)
{
@ -3749,7 +3746,7 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
uniqchar++;
}
TxError("Renaming cell to \"%s\" to avoid conflict.", newcellname);
def = DBCellNewDef(cellnameptr, (char *)NULL);
def = DBCellNewDef(cellnameptr);
def->cd_file = StrDup(&def->cd_file, fullpathname);
freeMagic(newcellname);
}
@ -3777,7 +3774,7 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
dummy->cu_expandMask = CU_DESCEND_SPECIAL;
if (DBIsAncestor(def, EditCellUse->cu_def))
{
TxError("The edit cell is already a desecendant of \"%s\",\n",
TxError("The edit cell is already a descendant of \"%s\",\n",
cmd->tx_argv[1]);
TxError(" which means that you're trying to create a circular\n");
TxError(" structure. This isn't legal.\n");

View File

@ -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;

View File

@ -1943,7 +1943,7 @@ CmdFlatten(w, cmd)
TxError("%s already exists\n",destname);
return;
}
newdef = DBCellNewDef(destname, (char *) NULL);
newdef = DBCellNewDef(destname);
ASSERT(newdef, "CmdFlatten");
DBCellSetAvail(newdef);
newuse = DBCellNewUse(newdef, (char *) NULL);

View File

@ -665,7 +665,7 @@ cmdSaveCell(cellDef, newName, noninteractive, tryRename)
}
cleanup:
if (fileName != newName)
if ((fileName != newName) && (fileName != cellDef->cd_name))
freeMagic(fileName);
return;
}

View File

@ -1245,14 +1245,12 @@ DBCellLookDef(cellName)
*/
CellDef *
DBCellNewDef(cellName, cellFileName)
DBCellNewDef(cellName)
char *cellName; /* Name by which the cell is known */
char *cellFileName; /* Name of disk file in which the cell
* should be kept when written out.
*/
{
CellDef *cellDef;
HashEntry *entry;
char *dotptr;
if (cellName == (char *) NULL)
cellName = UNNAMED;
@ -1264,10 +1262,12 @@ DBCellNewDef(cellName, cellFileName)
cellDef = DBCellDefAlloc();
HashSetValue(entry, (ClientData) cellDef);
cellDef->cd_name = StrDup((char **) NULL, cellName);
if (cellFileName == (char *) NULL)
cellDef->cd_file = cellFileName;
else
cellDef->cd_file = StrDup((char **) NULL, cellFileName);
/* Strip any .mag extension off of the cell name */
dotptr = strrchr(cellDef->cd_name, '.');
if (dotptr && !strcmp(dotptr, ".mag")) *dotptr = '\0';
cellDef->cd_file = NULL;
return (cellDef);
}
@ -2081,7 +2081,7 @@ DBNewYank(yname, pyuse, pydef)
*pydef = DBCellLookDef(yname);
if (*pydef == (CellDef *) NULL)
{
*pydef = DBCellNewDef (yname,(char *) NULL);
*pydef = DBCellNewDef(yname);
ASSERT(*pydef != (CellDef *) NULL, "DBNewYank");
DBCellSetAvail(*pydef);
(*pydef)->cd_flags |= CDINTERNAL;

View File

@ -859,7 +859,7 @@ DBReadBackup(name)
cellDef = DBCellLookDef(rootname);
if (cellDef == (CellDef *)NULL)
cellDef = DBCellNewDef(rootname, (char *)NULL);
cellDef = DBCellNewDef(rootname);
cellDef->cd_flags &= ~CDNOTFOUND;
cellDef->cd_flags |= CDAVAILABLE;
@ -1054,23 +1054,22 @@ dbReadOpen(cellDef, name, setFileName, errptr)
if (f != NULL)
{
if (pptr != NULL) *pptr = '.';
/* NOTE: May not want to present this as an error, as */
/* it is a common technique to read files from, say, a */
/* LEF file but not save them locally, and then expect */
/* that the layout views will be picked up from */
/* somewhere else in the search paths. */
if (pptr != NULL) *pptr = '.';
TxError("Warning: Parent cell lists instance of \"%s\" at bad file "
"path %s.\n", cellDef->cd_name, cellDef->cd_file);
TxError("The cell exists in the search paths at %s.\n", filename);
TxError("The discovered version will be used.\n");
/* Write the new path to cd_file or else magic will */
/* generate another error later. */
cellDef->cd_file = StrDup(&cellDef->cd_file, filename);
TxError("The cell exists in the search paths at %s.\n", filename);
TxError("The discovered version will be used.\n");
}
}
@ -1353,7 +1352,7 @@ badTransform:
subCellDef = DBCellLookDef(cellname);
if (subCellDef == (CellDef *) NULL)
{
subCellDef = DBCellNewDef(cellname, (char *)NULL);
subCellDef = DBCellNewDef(cellname);
subCellDef->cd_timestamp = childStamp;
/* Make sure rectangle is non-degenerate */
@ -2722,29 +2721,25 @@ DBCellWrite(cellDef, fileName)
/*
* Figure out the name of the file we will eventually write.
*/
if (fileName)
if (!fileName)
{
realname = (char *) mallocMagic(strlen(fileName) + strlen(DBSuffix) + 1);
(void) sprintf(realname, "%s%s", fileName, DBSuffix);
if (cellDef->cd_file)
fileName = cellDef->cd_file;
else if (cellDef->cd_name)
fileName = cellDef->cd_name;
else
return FALSE;
}
/* Bug fix: 7/17/99, Michael D. Godfrey: Forces */
/* cd_name and cd_file to ALWAYS be the same, otherwise ugly */
/* surprises can occur after saving a file as a different */
/* filename. */
/* Bug fix: 7/17/99, Michael D. Godfrey: Forces */
/* cd_name and cd_file to ALWAYS be the same, otherwise ugly */
/* surprises can occur after saving a file as a different */
/* filename. */
cellDef->cd_file = StrDup(&cellDef->cd_file, realname);
}
else if (cellDef->cd_file)
{
realname = StrDup((char **) NULL, cellDef->cd_file);
}
else if (cellDef->cd_name)
{
realname = (char *) mallocMagic((unsigned) (strlen(cellDef->cd_name)
+ strlen(DBSuffix) + 1));
(void) sprintf(realname, "%s%s", cellDef->cd_name, DBSuffix);
}
else return (FALSE);
cellDef->cd_file = StrDup(&cellDef->cd_file, fileName);
realname = (char *) mallocMagic(strlen(fileName) + strlen(DBSuffix) + 1);
(void) sprintf(realname, "%s%s", fileName, DBSuffix);
/*
* Expand the filename, removing the leading ~, if any.

View File

@ -328,7 +328,7 @@ DBWloadWindow(window, name, ignoreTech, expand, dereference)
newEditDef = DBCellLookDef(UNNAMED);
if (newEditDef == (CellDef *) NULL)
{
newEditDef = DBCellNewDef(UNNAMED, (char *) NULL);
newEditDef = DBCellNewDef(UNNAMED);
DBCellSetAvail(newEditDef);
}
}
@ -397,7 +397,7 @@ DBWloadWindow(window, name, ignoreTech, expand, dereference)
}
}
if (newEditDef == (CellDef *) NULL)
newEditDef = DBCellNewDef(rootname, (char *) NULL);
newEditDef = DBCellNewDef(rootname);
if (dereference) newEditDef->cd_flags |= CDDEREFERENCE;
@ -431,7 +431,7 @@ DBWloadWindow(window, name, ignoreTech, expand, dereference)
newEditDef = DBCellLookDef(UNNAMED);
if (newEditDef == (CellDef *) NULL)
{
newEditDef = DBCellNewDef(UNNAMED, (char *) NULL);
newEditDef = DBCellNewDef(UNNAMED);
DBCellSetAvail(newEditDef);
}
}

View File

@ -345,7 +345,7 @@ DRCInit()
DRCdef = DBCellLookDef(DRCYANK);
if (DRCdef == (CellDef *) NULL)
{
DRCdef = DBCellNewDef (DRCYANK,(char *) NULL);
DRCdef = DBCellNewDef(DRCYANK);
ASSERT(DRCdef != (CellDef *) NULL, "DRCInit");
DBCellSetAvail(DRCdef);
DRCdef->cd_flags |= CDINTERNAL;

View File

@ -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;

View File

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

View File

@ -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 */

View File

@ -1220,6 +1220,9 @@ DefReadVias(f, sname, oscale, total)
LefEstimate(processed++, total, "vias");
/* If not otherwise specified, rows and columns default to 1 */
rows = cols = 1;
/* Get via name */
token = LefNextToken(f, TRUE);
if (sscanf(token, "%2047s", vianame) != 1)
@ -1538,7 +1541,7 @@ DefReadComponents(f, rootDef, sname, oscale, total)
/* Before giving up, assume that this cell has a */
/* magic .mag layout file. */
defMacro = DBCellNewDef(token, (char *)NULL);
defMacro = DBCellNewDef(token);
defMacro->cd_flags &= ~CDNOTFOUND;
dereference = (defMacro->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
if (!DBCellRead(defMacro, (char *)NULL, TRUE, dereference, NULL))

View File

@ -572,7 +572,7 @@ lefFindCell(name)
def = DBCellLookDef(name);
if (def == NULL)
{
def = DBCellNewDef(name, (char *)NULL);
def = DBCellNewDef(name);
DBReComputeBbox(def);
}
HashSetValue(h, def);

View File

@ -675,7 +675,7 @@ lefWriteMacro(def, f, scale, hide)
lefFlatDef = DBCellLookDef("__lefFlat__");
if (lefFlatDef == (CellDef *)NULL)
lefFlatDef = DBCellNewDef("__lefFlat__", (char *)NULL);
lefFlatDef = DBCellNewDef("__lefFlat__");
DBCellSetAvail(lefFlatDef);
lefFlatDef->cd_flags |= CDINTERNAL;
@ -828,7 +828,7 @@ lefWriteMacro(def, f, scale, hide)
lc.lefYank = DBCellLookDef("__lefYank__");
if (lc.lefYank == (CellDef *)NULL)
lc.lefYank = DBCellNewDef("__lefYank__", (char *)NULL);
lc.lefYank = DBCellNewDef("__lefYank__");
DBCellSetAvail(lc.lefYank);
lc.lefYank->cd_flags |= CDINTERNAL;

View File

@ -235,7 +235,7 @@ nmGetShowCell()
nmscShowDef = DBCellLookDef("__SHOW__");
if (nmscShowDef == NULL)
{
nmscShowDef = DBCellNewDef("__SHOW__", (char *) NULL);
nmscShowDef = DBCellNewDef("__SHOW__");
ASSERT (nmscShowDef != (CellDef *) NULL, "nmGetShowCell");
DBCellSetAvail(nmscShowDef);
nmscShowDef->cd_flags |= CDINTERNAL;

View File

@ -113,7 +113,7 @@ ResGetReCell()
ResDef = DBCellLookDef("__RESIS__");
if (ResDef == NULL)
{
ResDef = DBCellNewDef("__RESIS__", (char *) NULL);
ResDef = DBCellNewDef("__RESIS__");
ASSERT (ResDef != (CellDef *) NULL, "ResGetReCell");
DBCellSetAvail(ResDef);
ResDef->cd_flags |= CDINTERNAL;

View File

@ -271,7 +271,7 @@ RtrFindChannelDef()
/* Create our target cell */
if ((def = DBCellLookDef("__CHANNEL__")) == (CellDef *) NULL)
{
def = DBCellNewDef("__CHANNEL__", (char *) NULL);
def = DBCellNewDef("__CHANNEL__");
DBCellSetAvail(def);
def->cd_flags |= CDINTERNAL;
}

View File

@ -108,7 +108,7 @@ SelectInit()
SelectDef = DBCellLookDef("__SELECT__");
if (SelectDef == (CellDef *) NULL)
{
SelectDef = DBCellNewDef("__SELECT__",(char *) NULL);
SelectDef = DBCellNewDef("__SELECT__");
ASSERT(SelectDef != (CellDef *) NULL, "SelectInit");
DBCellSetAvail(SelectDef);
SelectDef->cd_flags |= CDINTERNAL;
@ -122,7 +122,7 @@ SelectInit()
Select2Def = DBCellLookDef("__SELECT2__");
if (Select2Def == (CellDef *) NULL)
{
Select2Def = DBCellNewDef("__SELECT2__",(char *) NULL);
Select2Def = DBCellNewDef("__SELECT2__");
ASSERT(Select2Def != (CellDef *) NULL, "SelectInit");
DBCellSetAvail(Select2Def);
Select2Def->cd_flags |= CDINTERNAL;