mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-04 08:33:55 +02:00
Corrected dereferencing of cell dependencies, which was being applied
only at the time of running the command "load". But cells are generally loaded only on an as-needed basis, so the dereferencing option must be saved as a flag in the cell and honored whenever its subcells are expanded or otherwise read at a later time.
This commit is contained in:
+37
-9
@@ -188,7 +188,10 @@ dbCellTileSrFunc(scx, fp)
|
||||
if (!DBDescendSubcell(scx->scx_use, fp->tf_xmask))
|
||||
return 0;
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL)) return 0;
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
context.tc_scx = scx;
|
||||
context.tc_filter = fp;
|
||||
@@ -307,7 +310,10 @@ dbCellUniqueTileSrFunc(scx, fp)
|
||||
if (!DBDescendSubcell(scx->scx_use, fp->tf_xmask))
|
||||
return 0;
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL)) return 0;
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
context.tc_scx = scx;
|
||||
context.tc_filter = fp;
|
||||
@@ -418,7 +424,10 @@ DBNoTreeSrTiles(scx, mask, xMask, func, cdarg)
|
||||
return 0;
|
||||
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL)) return 0;
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
filter.tf_func = func;
|
||||
filter.tf_arg = cdarg;
|
||||
@@ -526,7 +535,10 @@ DBTreeSrLabels(scx, mask, xMask, tpath, flags, func, cdarg)
|
||||
ASSERT(def != (CellDef *) NULL, "DBTreeSrLabels");
|
||||
if (!DBDescendSubcell(cellUse, xMask)) return 0;
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL)) return 0;
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
for (lab = def->cd_labels; lab; lab = lab->lab_next)
|
||||
{
|
||||
@@ -627,7 +639,10 @@ dbCellLabelSrFunc(scx, fp)
|
||||
ASSERT(def != (CellDef *) NULL, "dbCellLabelSrFunc");
|
||||
if (!DBDescendSubcell(scx->scx_use, fp->tf_xmask)) return 0;
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL)) return 0;
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
|
||||
if (fp->tf_tpath != (TerminalPath *) NULL)
|
||||
{
|
||||
@@ -741,8 +756,11 @@ DBTreeSrCells(scx, xMask, func, cdarg)
|
||||
if (!DBDescendSubcell(cellUse, xMask))
|
||||
return 0;
|
||||
if ((cellUse->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(cellUse->cu_def, (char *) NULL, TRUE, FALSE, NULL))
|
||||
{
|
||||
bool dereference = (cellUse->cu_def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(cellUse->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
return 0;
|
||||
}
|
||||
|
||||
context.tc_scx = scx;
|
||||
context.tc_filter = &filter;
|
||||
@@ -787,8 +805,11 @@ dbTreeCellSrFunc(scx, fp)
|
||||
else
|
||||
{
|
||||
if ((use->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(use->cu_def, (char *) NULL, TRUE, FALSE, NULL))
|
||||
{
|
||||
bool dereference = (use->cu_def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(use->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
return 0;
|
||||
}
|
||||
result = DBCellSrArea(scx, dbTreeCellSrFunc, (ClientData) fp);
|
||||
}
|
||||
return result;
|
||||
@@ -1039,8 +1060,12 @@ DBCellSrArea(scx, func, cdarg)
|
||||
context.tc_scx = scx;
|
||||
|
||||
if ((scx->scx_use->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(scx->scx_use->cu_def, (char *) NULL, TRUE, FALSE, NULL))
|
||||
{
|
||||
bool dereference = (scx->scx_use->cu_def->cd_flags & CDDEREFERENCE) ?
|
||||
TRUE : FALSE;
|
||||
if (!DBCellRead(scx->scx_use->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* In order to make this work with zero-size areas, we first expand
|
||||
* the area by before searching the tile plane. DbCellSrFunc will
|
||||
@@ -1215,7 +1240,10 @@ DBCellEnum(cellDef, func, cdarg)
|
||||
filter.tf_func = func;
|
||||
filter.tf_arg = cdarg;
|
||||
if ((cellDef->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(cellDef, (char *) NULL, TRUE, FALSE, NULL)) return 0;
|
||||
{
|
||||
bool dereference = (cellDef->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(cellDef, (char *) NULL, TRUE, dereference, NULL)) return 0;
|
||||
}
|
||||
if (TiSrArea((Tile *) NULL, cellDef->cd_planes[PL_CELL],
|
||||
&TiPlaneRect, dbEnumFunc, (ClientData) &filter))
|
||||
return 1;
|
||||
|
||||
@@ -73,8 +73,12 @@ DBDescendSubcell(use, xMask)
|
||||
|
||||
case CU_DESCEND_NO_SUBCKT:
|
||||
if ((use->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
if (!DBCellRead(use->cu_def, (char *) NULL, TRUE, FALSE, NULL))
|
||||
{
|
||||
bool dereference = (use->cu_def->cd_flags & CDDEREFERENCE) ?
|
||||
TRUE : FALSE;
|
||||
if (!DBCellRead(use->cu_def, (char *) NULL, TRUE, dereference, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
return (DBIsSubcircuit(use->cu_def)) ? FALSE : TRUE;
|
||||
|
||||
case CU_DESCEND_NO_LOCK:
|
||||
|
||||
+12
-4
@@ -37,6 +37,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
||||
*/
|
||||
struct expandArg
|
||||
{
|
||||
bool ea_deref; /* TRUE if root def dereference flag is set */
|
||||
int ea_xmask; /* Expand mask. */
|
||||
int (*ea_func)(); /* Function to call for each cell whose
|
||||
* status is changed.
|
||||
@@ -81,7 +82,8 @@ DBExpand(cellUse, expandMask, expandFlag)
|
||||
def = cellUse->cu_def;
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
if (!DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL))
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
if (!DBCellRead(def, (char *) NULL, 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
|
||||
@@ -142,9 +144,13 @@ DBExpandAll(rootUse, rootRect, expandMask, expandFlag, func, cdarg)
|
||||
int dbExpandFunc(), dbUnexpandFunc();
|
||||
SearchContext scontext;
|
||||
struct expandArg arg;
|
||||
bool dereference = (rootUse->cu_def->cd_flags & CDDEREFERENCE) ?
|
||||
TRUE : FALSE;
|
||||
|
||||
if ((rootUse->cu_def->cd_flags & CDAVAILABLE) == 0)
|
||||
(void) DBCellRead(rootUse->cu_def, (char *) NULL, TRUE, FALSE, NULL);
|
||||
{
|
||||
(void) DBCellRead(rootUse->cu_def, (char *) NULL, TRUE, dereference, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk through the area and set the expansion state
|
||||
@@ -154,6 +160,7 @@ DBExpandAll(rootUse, rootRect, expandMask, expandFlag, func, cdarg)
|
||||
arg.ea_xmask = expandMask;
|
||||
arg.ea_func = func;
|
||||
arg.ea_arg = cdarg;
|
||||
arg.ea_deref = dereference;
|
||||
|
||||
scontext.scx_use = rootUse;
|
||||
scontext.scx_trans = GeoIdentityTransform;
|
||||
@@ -193,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, FALSE, NULL))
|
||||
if(!DBCellRead(childUse->cu_def, (char *) NULL, TRUE, arg->ea_deref, NULL))
|
||||
{
|
||||
TxError("Cell %s is unavailable. It could not be expanded.\n",
|
||||
childUse->cu_def->cd_name);
|
||||
@@ -303,7 +310,8 @@ dbReadAreaFunc(scx)
|
||||
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL);
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, dereference, NULL);
|
||||
/* Note: we don't have to invoke DBReComputeBbox here because
|
||||
* if the bbox changed then there was a timestamp mismatch and
|
||||
* the timestamp code will take care of the bounding box later.
|
||||
|
||||
+5
-2
@@ -934,7 +934,7 @@ DBCellRead(cellDef, name, ignoreTech, dereference, errptr)
|
||||
* names do not match, but an attempt will be
|
||||
* made to read the file anyway.
|
||||
*/
|
||||
bool dereference; /* If TRUE, ignore path references in the input */
|
||||
bool dereference; /* If TRUE then ignore path argument to uses */
|
||||
int *errptr; /* Copy of errno set by file reading routine
|
||||
* is placed here, unless NULL.
|
||||
*/
|
||||
@@ -2855,8 +2855,11 @@ DBCellWrite(cellDef, fileName)
|
||||
|
||||
#ifdef FILE_LOCKS
|
||||
else
|
||||
{
|
||||
bool dereference = (cellDef->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
/* Re-aquire the lock on the new file by opening it. */
|
||||
DBCellRead(cellDef, NULL, TRUE, FALSE, NULL);
|
||||
DBCellRead(cellDef, NULL, TRUE, dereference, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
+8
-2
@@ -294,7 +294,10 @@ DBTreeFindUse(name, use, scx)
|
||||
* is read in from disk.
|
||||
*/
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL);
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, dereference, NULL);
|
||||
}
|
||||
|
||||
cp = name;
|
||||
he = HashLookOnly(&def->cd_idHash, name);
|
||||
@@ -343,7 +346,10 @@ DBTreeFindUse(name, use, scx)
|
||||
/* Ensure that the leaf cell is read in */
|
||||
def = use->cu_def;
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, FALSE, NULL);
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, dereference, NULL);
|
||||
}
|
||||
|
||||
scx->scx_use = use;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,8 @@ DBFixMismatch()
|
||||
|
||||
while (mismatch != NULL)
|
||||
{
|
||||
bool dereference;
|
||||
|
||||
/* Be careful to remove the front element from the mismatch
|
||||
* list before processing it, because while processing it we
|
||||
* may add new elements to the list.
|
||||
@@ -137,7 +139,8 @@ DBFixMismatch()
|
||||
mismatch = mismatch->mm_next;
|
||||
if (cellDef->cd_flags & CDPROCESSED) continue;
|
||||
|
||||
(void) DBCellRead(cellDef, (char *) NULL, TRUE, FALSE, NULL);
|
||||
dereference = (cellDef->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(cellDef, (char *) NULL, TRUE, dereference, NULL);
|
||||
|
||||
/* Jimmy up the cell's current bounding box, so the following
|
||||
* procedure call will absolutely and positively know that
|
||||
|
||||
Reference in New Issue
Block a user