Modified the behavior of cell reading, mainly with respect to
dereferencing, and making the behavior of "load" on the command line (i.e., loading a cell from a file) the same as the behavior of loading a cell as a result of expanding an unloaded instance. In both cases, if "load -dereference" is used, and a cell does not exist in any search path but does exist in the original location, without dereferencing, then the cell will be loaded from the original location. Also: Corrected an error that has existed since adding the capability to read compressed files, which causes magic to crash when attempting to run the "crash recover" command (because that routine was mixing compressed and regular file stream calls).
This commit is contained in:
parent
10448788f9
commit
d8f926865d
|
|
@ -892,7 +892,7 @@ calmaProcessDef(def, outf, do_library)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL))
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -843,7 +843,7 @@ calmaProcessDefZ(def, outf, do_library)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL))
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ cifOut(outf)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) continue;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) continue;
|
||||
}
|
||||
|
||||
/* Add any subcells to the stack. This must be done before
|
||||
|
|
|
|||
|
|
@ -4741,7 +4741,7 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
|
|||
*/
|
||||
def->cd_flags &= ~CDNOTFOUND;
|
||||
dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL))
|
||||
return (FALSE);
|
||||
DBReComputeBbox(def);
|
||||
dummy->cu_def = def;
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ CmdEdit(w, cmd)
|
|||
{
|
||||
bool dereference = (EditCellUse->cu_def->cd_flags & CDDEREFERENCE) ?
|
||||
TRUE : FALSE;
|
||||
DBCellRead(EditCellUse->cu_def, (char *)NULL, TRUE, dereference, NULL);
|
||||
DBCellRead(EditCellUse->cu_def, TRUE, dereference, NULL);
|
||||
}
|
||||
|
||||
if (EditCellUse->cu_def->cd_flags & CDNOEDIT)
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ cmdFlushCell(def, force_deref)
|
|||
DBCellClearDef(def);
|
||||
DBCellClearAvail(def);
|
||||
dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, dereference, NULL);
|
||||
(void) DBCellRead(def, TRUE, dereference, NULL);
|
||||
DBCellSetAvail(def);
|
||||
DBReComputeBbox(def);
|
||||
DBCellSetModified(def, FALSE);
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ dbCellPlaneSrFunc(scx, fp)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
context.tc_scx = scx;
|
||||
|
|
@ -366,7 +366,7 @@ dbCellUniqueTileSrFunc(scx, fp)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
context.tc_scx = scx;
|
||||
|
|
@ -478,7 +478,7 @@ DBNoTreeSrTiles(scx, mask, xMask, func, cdarg)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
filter.tf_func = func;
|
||||
|
|
@ -589,7 +589,7 @@ DBTreeSrLabels(scx, mask, xMask, tpath, flags, func, cdarg)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
for (lab = def->cd_labels; lab; lab = lab->lab_next)
|
||||
|
|
@ -696,7 +696,7 @@ dbCellLabelSrFunc(scx, fp)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
/* Do not add a path name of a top level window */
|
||||
|
|
@ -820,7 +820,7 @@ DBTreeSrCells(scx, xMask, func, cdarg)
|
|||
if ((cellUse->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (cellUse->cu_def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(cellUse->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(cellUse->cu_def, TRUE, dereference, NULL))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ dbTreeCellSrFunc(scx, fp)
|
|||
if ((use->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (use->cu_def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(use->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(use->cu_def, TRUE, dereference, NULL))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1129,7 +1129,7 @@ DBCellSrArea(scx, func, cdarg)
|
|||
{
|
||||
bool dereference = (scx->scx_use->cu_def->cd_flags & CDDEREFERENCE) ?
|
||||
TRUE : FALSE;
|
||||
if (!DBCellRead(scx->scx_use->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(scx->scx_use->cu_def, TRUE, dereference, NULL))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1255,7 +1255,7 @@ DBCellEnum(cellDef, func, cdarg)
|
|||
if ((cellDef->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (cellDef->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(cellDef, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(cellDef, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
if (DBSrCellPlaneArea(cellDef->cd_cellPlane,
|
||||
&TiPlaneRect, dbEnumFunc, (ClientData) &filter))
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ DBDescendSubcell(use, xMask)
|
|||
{
|
||||
bool dereference = (use->cu_def->cd_flags & CDDEREFERENCE) ?
|
||||
TRUE : FALSE;
|
||||
if (!DBCellRead(use->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(use->cu_def, TRUE, dereference, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
return (DBIsSubcircuit(use->cu_def)) ? FALSE : TRUE;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ DBExpand(cellUse, expandMask, expandFlag)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL))
|
||||
return;
|
||||
/* Note: we don't have to recompute the bbox here, because
|
||||
* if it changed, then a timestamp violation must have occurred
|
||||
|
|
@ -149,7 +149,7 @@ DBExpandAll(rootUse, rootRect, expandMask, expandFlag, func, cdarg)
|
|||
|
||||
if ((rootUse->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
(void) DBCellRead(rootUse->cu_def, (char *) NULL, TRUE, dereference, NULL);
|
||||
(void) DBCellRead(rootUse->cu_def, TRUE, dereference, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -200,7 +200,7 @@ dbExpandFunc(scx, arg)
|
|||
/* If the cell is unavailable, then don't expand it.
|
||||
*/
|
||||
if ((childUse->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
if(!DBCellRead(childUse->cu_def, (char *) NULL, TRUE, arg->ea_deref, NULL))
|
||||
if(!DBCellRead(childUse->cu_def, TRUE, arg->ea_deref, NULL))
|
||||
{
|
||||
TxError("Cell %s is unavailable. It could not be expanded.\n",
|
||||
childUse->cu_def->cd_name);
|
||||
|
|
@ -317,7 +317,7 @@ dbReadAreaFunc(scx, halt_on_error)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (DBCellRead(def, (char *)NULL, TRUE, dereference, NULL) == FALSE)
|
||||
if (DBCellRead(def, TRUE, dereference, NULL) == FALSE)
|
||||
if (halt_on_error)
|
||||
return 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -414,13 +414,9 @@ DBAddStandardCellPaths(pathptr, level)
|
|||
*/
|
||||
|
||||
bool
|
||||
dbCellReadDef(f, cellDef, name, ignoreTech, dereference)
|
||||
dbCellReadDef(f, cellDef, ignoreTech, dereference)
|
||||
FILETYPE f; /* The file, already opened by the caller */
|
||||
CellDef *cellDef; /* Pointer to definition of cell to be read in */
|
||||
char *name; /* Name of file from which to read definition.
|
||||
* If NULL, then use cellDef->cd_file; if that
|
||||
* is NULL try the name of the cell.
|
||||
*/
|
||||
bool ignoreTech; /* If FALSE then the technology of the file MUST
|
||||
* match the current technology, or else the
|
||||
* subroutine will return an error condition
|
||||
|
|
@ -1088,13 +1084,13 @@ bool
|
|||
DBReadBackup(name)
|
||||
char *name; /* Name of the backup file */
|
||||
{
|
||||
FILE *f;
|
||||
FILETYPE f;
|
||||
char *filename, *rootname, *chrptr;
|
||||
char line[256];
|
||||
CellDef *cellDef;
|
||||
bool result = TRUE;
|
||||
|
||||
if ((f = PaOpen(name, "r", NULL, "", NULL, NULL)) == NULL)
|
||||
if ((f = PaZOpen(name, "r", NULL, "", NULL, NULL)) == NULL)
|
||||
{
|
||||
TxError("Cannot open backup file \"%s\"\n", name);
|
||||
return FALSE;
|
||||
|
|
@ -1136,7 +1132,7 @@ DBReadBackup(name)
|
|||
cellDef->cd_flags &= ~CDNOTFOUND;
|
||||
cellDef->cd_flags |= CDAVAILABLE;
|
||||
|
||||
if (dbCellReadDef(f, cellDef, filename, TRUE, FALSE) == FALSE)
|
||||
if (dbCellReadDef(f, cellDef, TRUE, FALSE) == FALSE)
|
||||
return FALSE;
|
||||
|
||||
if (dbFgets(line, sizeof(line), f) == NULL)
|
||||
|
|
@ -1192,12 +1188,8 @@ DBReadBackup(name)
|
|||
*/
|
||||
|
||||
bool
|
||||
DBCellRead(cellDef, name, ignoreTech, dereference, errptr)
|
||||
DBCellRead(cellDef, ignoreTech, dereference, errptr)
|
||||
CellDef *cellDef; /* Pointer to definition of cell to be read in */
|
||||
char *name; /* Name of file from which to read definition.
|
||||
* If NULL, then use cellDef->cd_file; if that
|
||||
* is NULL try the name of the cell.
|
||||
*/
|
||||
bool ignoreTech; /* If FALSE then the technology of the file MUST
|
||||
* match the current technology, or else the
|
||||
* subroutine will return an error condition
|
||||
|
|
@ -1219,12 +1211,12 @@ DBCellRead(cellDef, name, ignoreTech, dereference, errptr)
|
|||
if (cellDef->cd_flags & CDAVAILABLE)
|
||||
result = TRUE;
|
||||
|
||||
else if ((f = dbReadOpen(cellDef, name, TRUE, dereference, errptr)) == NULL)
|
||||
else if ((f = dbReadOpen(cellDef, TRUE, dereference, errptr)) == NULL)
|
||||
result = FALSE;
|
||||
|
||||
else
|
||||
{
|
||||
result = (dbCellReadDef(f, cellDef, name, ignoreTech, dereference));
|
||||
result = (dbCellReadDef(f, cellDef, ignoreTech, dereference));
|
||||
|
||||
#ifdef FILE_LOCKS
|
||||
/* Close files that were locked by another user */
|
||||
|
|
@ -1244,7 +1236,7 @@ DBCellRead(cellDef, name, ignoreTech, dereference, errptr)
|
|||
* dbReadOpen --
|
||||
*
|
||||
* Open the file containing the cell we are going to read.
|
||||
* If a filename for the cell is specified ('name' is non-NULL),
|
||||
* If a filename for the cell is being dereferenced,
|
||||
* we try to open it somewhere in the search path. Otherwise,
|
||||
* we try the filename already associated with the cell, or the
|
||||
* name of the cell itself as the name of the file containing
|
||||
|
|
@ -1270,9 +1262,8 @@ DBCellRead(cellDef, name, ignoreTech, dereference, errptr)
|
|||
*/
|
||||
|
||||
FILETYPE
|
||||
dbReadOpen(cellDef, name, setFileName, dereference, errptr)
|
||||
dbReadOpen(cellDef, setFileName, dereference, errptr)
|
||||
CellDef *cellDef; /* Def being read */
|
||||
char *name; /* Name if specified, or NULL */
|
||||
bool setFileName; /* If TRUE then cellDef->cd_file should be updated
|
||||
* to point to the name of the file from which the
|
||||
* cell was loaded.
|
||||
|
|
@ -1297,13 +1288,7 @@ dbReadOpen(cellDef, name, setFileName, dereference, errptr)
|
|||
|
||||
if (errptr != NULL) *errptr = 0; // No error, by default
|
||||
|
||||
if (name != (char *) NULL)
|
||||
{
|
||||
f = PaLockZOpen(name, "r", DBSuffix, Path,
|
||||
CellLibPath, &filename, &is_locked, &fd);
|
||||
if (errptr != NULL) *errptr = errno;
|
||||
}
|
||||
else if (cellDef->cd_file != (char *) NULL)
|
||||
if (cellDef->cd_file != (char *) NULL)
|
||||
{
|
||||
/* Do not send a name with a file extension to PaLockZOpen(),
|
||||
* otherwise that routine must handle it and then cannot
|
||||
|
|
@ -1392,17 +1377,13 @@ dbReadOpen(cellDef, name, setFileName, dereference, errptr)
|
|||
if (cellDef->cd_flags & CDNOTFOUND)
|
||||
return ((FILETYPE) NULL);
|
||||
|
||||
if (name != (char *) NULL)
|
||||
{
|
||||
if (DBVerbose >= DB_VERBOSE_ERR)
|
||||
TxError("File %s%s couldn't be read\n", name, DBSuffix);
|
||||
}
|
||||
else if (cellDef->cd_file != (char *) NULL)
|
||||
if (cellDef->cd_file != (char *) NULL)
|
||||
{
|
||||
if (DBVerbose >= DB_VERBOSE_ERR)
|
||||
TxError("File %s couldn't be read\n", cellDef->cd_file);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (DBVerbose >= DB_VERBOSE_ERR)
|
||||
TxError("Cell %s couldn't be read\n", cellDef->cd_name);
|
||||
realname = (char *) mallocMagic((unsigned) (strlen(cellDef->cd_name)
|
||||
|
|
@ -1582,7 +1563,13 @@ dbReadUse(cellDef, line, len, f, scalen, scaled, dereference, dbUseTable)
|
|||
|
||||
pathptr = &path[0];
|
||||
while (*pathptr == ' ' || *pathptr == '\t') pathptr++;
|
||||
if ((dereference == TRUE) || (*pathptr == '\n')) *pathptr = '\0';
|
||||
|
||||
/* NOTE: Removed the truncating of the path when dereferencing, */
|
||||
/* 3/20/2023. This allows the original location to be recovered if */
|
||||
/* dereferencing is used, but the cell does not exist in the search */
|
||||
/* paths and only exists in the original location. */
|
||||
|
||||
if (*pathptr == '\n') *pathptr = '\0';
|
||||
|
||||
locked = (useid[0] == CULOCKCHAR) ? TRUE : FALSE;
|
||||
|
||||
|
|
@ -1772,10 +1759,11 @@ badTransform:
|
|||
/* or "~" and cellDef->cd_file has path components, then the path */
|
||||
/* should be interpreted relative to the path of the parent cell. */
|
||||
|
||||
/* If there is no pathptr, then the situation is one of these two: */
|
||||
/* If there is no pathptr, then one of these three things are true: */
|
||||
/* (1) The instance is not the first time the cell was encountered */
|
||||
/* in the file, or (2) The cell is in the same path as the parent. */
|
||||
/* Only case (2) needs to be handled. */
|
||||
/* in the file, (2) "-dereference" has been selected on the current */
|
||||
/* file, but the subcell was already loaded, or (3) the cell is in */
|
||||
/* the same path as the parent. Only case (3) needs to be handled. */
|
||||
|
||||
if ((firstUse == TRUE) && ((*pathptr == '\0') ||
|
||||
((*pathptr != '/') && (*pathptr != '~'))))
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ DBTreeFindUse(name, use, scx)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, dereference, NULL);
|
||||
(void) DBCellRead(def, TRUE, dereference, NULL);
|
||||
}
|
||||
|
||||
cp = name;
|
||||
|
|
@ -348,7 +348,7 @@ DBTreeFindUse(name, use, scx)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, dereference, NULL);
|
||||
(void) DBCellRead(def, TRUE, dereference, NULL);
|
||||
}
|
||||
|
||||
scx->scx_use = use;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ DBFixMismatch()
|
|||
if (cellDef->cd_flags & CDPROCESSED) continue;
|
||||
|
||||
dereference = (cellDef->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(cellDef, (char *) NULL, TRUE, dereference, NULL);
|
||||
(void) DBCellRead(cellDef, TRUE, dereference, NULL);
|
||||
|
||||
/* Jimmy up the cell's current bounding box, so the following
|
||||
* procedure call will absolutely and positively know that
|
||||
|
|
|
|||
|
|
@ -354,6 +354,9 @@ DBWloadWindow(window, name, flags)
|
|||
|
||||
char *dotptr;
|
||||
|
||||
/* Strip any leading "./" from the name */
|
||||
if (!strncmp(name, "./", 2)) name += 2;
|
||||
|
||||
rootname = strrchr(name, '/');
|
||||
if (rootname == NULL)
|
||||
rootname = name;
|
||||
|
|
@ -376,14 +379,20 @@ DBWloadWindow(window, name, flags)
|
|||
|
||||
newEditDef = DBCellLookDef(rootname);
|
||||
|
||||
if ((newEditDef != (CellDef *)NULL) && (newEditDef->cd_file != NULL))
|
||||
/* If "rootname" is the same as "name", then a cell was requested
|
||||
* by name and was found in memory, and all is good. If not, then
|
||||
* "name" implies some specific location and needs to be checked
|
||||
* against the existing cell's file path.
|
||||
*/
|
||||
if ((newEditDef != (CellDef *)NULL) && (newEditDef->cd_file != NULL) &&
|
||||
strcmp(name, rootname))
|
||||
{
|
||||
/* If the cellname exists already, check if we are really */
|
||||
/* looking at the same file. If not, and two files in two */
|
||||
/* different paths have the same root cellname, then keep */
|
||||
/* the full pathname for the new cellname. */
|
||||
/* different paths have the same root cellname, then fail. */
|
||||
|
||||
char *fullpath;
|
||||
bool badFile = FALSE;
|
||||
struct stat statbuf;
|
||||
ino_t inode;
|
||||
|
||||
|
|
@ -392,40 +401,68 @@ DBWloadWindow(window, name, flags)
|
|||
if (stat(fullpath, &statbuf) == 0)
|
||||
{
|
||||
inode = statbuf.st_ino;
|
||||
if (stat(newEditDef->cd_file, &statbuf) == 0)
|
||||
char *full_cdfile;
|
||||
|
||||
full_cdfile = (char *)mallocMagic(strlen(newEditDef->cd_file) +
|
||||
strlen(DBSuffix) + 1);
|
||||
|
||||
/* cd_file is not supposed to have the file extension, */
|
||||
/* but check just in case. */
|
||||
|
||||
if (strstr(newEditDef->cd_file, DBSuffix) != NULL)
|
||||
sprintf(full_cdfile, "%s", newEditDef->cd_file);
|
||||
else
|
||||
sprintf(full_cdfile, "%s%s", newEditDef->cd_file, DBSuffix);
|
||||
|
||||
if (stat(full_cdfile, &statbuf) == 0)
|
||||
{
|
||||
if (inode != statbuf.st_ino)
|
||||
newEditDef = (CellDef *)NULL;
|
||||
badFile = TRUE;
|
||||
}
|
||||
else if ((dofail == FALSE) &&
|
||||
(!(newEditDef->cd_flags & CDAVAILABLE)))
|
||||
{
|
||||
/* Exception: If the cell can be found and the */
|
||||
/* existing file has not been loaded yet, then keep */
|
||||
/* the same behavior of "expand" and rename the cell */
|
||||
/* and flag a warning. */
|
||||
|
||||
TxError("Warning: Existing cell %s points to invalid path "
|
||||
"\"%s\". Cell was found at location \"%s\" and "
|
||||
"this location will be used.\n",
|
||||
rootname, newEditDef->cd_file, fullpath);
|
||||
freeMagic(newEditDef->cd_file);
|
||||
newEditDef->cd_file = NULL;
|
||||
}
|
||||
else
|
||||
newEditDef = (CellDef *)NULL;
|
||||
badFile = TRUE;
|
||||
|
||||
freeMagic(full_cdfile);
|
||||
}
|
||||
else
|
||||
newEditDef = (CellDef *)NULL;
|
||||
badFile = TRUE;
|
||||
|
||||
}
|
||||
else
|
||||
newEditDef = (CellDef *)NULL;
|
||||
badFile = TRUE;
|
||||
|
||||
/* If the cells have the same name but different */
|
||||
/* paths, then give the new cell the full path name */
|
||||
/* paths, then fail. */
|
||||
|
||||
if (newEditDef == NULL)
|
||||
if (badFile == TRUE)
|
||||
{
|
||||
if (dofail)
|
||||
{
|
||||
if (!beQuiet)
|
||||
TxError("No file \"%s\" found or readable.\n", name);
|
||||
return;
|
||||
}
|
||||
rootname = name;
|
||||
newEditDef = DBCellLookDef(rootname);
|
||||
TxError("File \"%s\": The cell was already read and points "
|
||||
"to conflicting location \"%s\".\n", name,
|
||||
newEditDef->cd_file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (newEditDef == (CellDef *) NULL)
|
||||
{
|
||||
/* "-fail" option: If no file is readable, then do not */
|
||||
/* create a new cell. */
|
||||
if (dofail)
|
||||
|
||||
if (dofail && !DBTestOpen(name, NULL))
|
||||
{
|
||||
if (!beQuiet)
|
||||
TxError("No file \"%s\" found or readable.\n", name);
|
||||
|
|
@ -434,9 +471,15 @@ DBWloadWindow(window, name, flags)
|
|||
newEditDef = DBCellNewDef(rootname);
|
||||
}
|
||||
|
||||
if (dereference) newEditDef->cd_flags |= CDDEREFERENCE;
|
||||
/* If the name differs from the root name, then set the file */
|
||||
/* path to be the same as "name". */
|
||||
|
||||
if (!DBCellRead(newEditDef, name, ignoreTech, dereference, &error_val))
|
||||
if (dereference)
|
||||
newEditDef->cd_flags |= CDDEREFERENCE;
|
||||
else if ((newEditDef->cd_file == NULL) && strcmp(name, rootname))
|
||||
newEditDef->cd_file = StrDup((char **)NULL, name);
|
||||
|
||||
if (!DBCellRead(newEditDef, ignoreTech, dereference, &error_val))
|
||||
{
|
||||
if (error_val == ENOENT)
|
||||
{
|
||||
|
|
@ -448,7 +491,7 @@ DBWloadWindow(window, name, flags)
|
|||
{
|
||||
/* File exists but some error has occurred like
|
||||
* file is unreadable or max file descriptors
|
||||
* was reached, in which csae we don't want to
|
||||
* was reached, in which case we don't want to
|
||||
* create a new cell, so delete the new celldef
|
||||
* and return.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -974,7 +974,7 @@ drcFindFunc(scx, finddata)
|
|||
HashSetValue(h, 1);
|
||||
|
||||
dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, dereference, NULL);
|
||||
(void) DBCellRead(def, TRUE, dereference, NULL);
|
||||
|
||||
if (DBSrPaintArea((Tile *) NULL, def->cd_planes[PL_DRC_ERROR],
|
||||
&def->cd_bbox, &DBAllButSpaceBits, drcFindFunc2,
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ extTreeSrPaintArea(scx, func, cdarg)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
filter.tf_func = func;
|
||||
|
|
@ -466,7 +466,7 @@ extTreeSrFunc(scx, fp)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return (0);
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return (0);
|
||||
}
|
||||
|
||||
context.tc_scx = scx;
|
||||
|
|
|
|||
|
|
@ -1399,7 +1399,7 @@ W3DloadWindow(window, name)
|
|||
return FALSE;
|
||||
|
||||
dereference = (newEditDef->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(newEditDef, (char *)NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(newEditDef, TRUE, dereference, NULL))
|
||||
return FALSE;
|
||||
|
||||
DBReComputeBbox(newEditDef);
|
||||
|
|
|
|||
|
|
@ -2222,7 +2222,7 @@ DefReadComponents(f, rootDef, sname, oscale, total)
|
|||
defMacro->cd_flags &= ~CDNOTFOUND;
|
||||
dereference = (defMacro->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
|
||||
if (!DBCellRead(defMacro, (char *)NULL, TRUE, dereference, NULL))
|
||||
if (!DBCellRead(defMacro, TRUE, dereference, NULL))
|
||||
{
|
||||
LefError(DEF_ERROR, "Cell %s is not defined. Maybe you "
|
||||
"have not read the corresponding LEF file?\n",
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ SimCellTileSrFunc(scx, fp)
|
|||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
if (!DBCellRead(def, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
context.tc_scx = scx;
|
||||
|
|
|
|||
Loading…
Reference in New Issue