mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-04 00:31:02 +02:00
Implemented a return value for the cell read-in checks with an option
to stop the search whenever a cell is not found. Used this to implement a new option for GDS writes, "gds undefined allow|disallow" (default "disallow") controls whether or not GDS with undefined references will be allowed to be written. Similarly affects CIF and LEF writes, extraction, and DRC (when running "drc check" from the top).
This commit is contained in:
+19
-7
@@ -275,7 +275,8 @@ dbUnexpandFunc(scx, arg)
|
||||
* the given rectangle.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
* If "halt_on_error" is TRUE, then return 1 if any subcell could not
|
||||
* be read. Otherwise, return 0.
|
||||
*
|
||||
* Side effects:
|
||||
* May make new cells known to the database. Sets the CDAVAILABLE
|
||||
@@ -284,10 +285,11 @@ dbUnexpandFunc(scx, arg)
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void
|
||||
DBCellReadArea(rootUse, rootRect)
|
||||
int
|
||||
DBCellReadArea(rootUse, rootRect, halt_on_error)
|
||||
CellUse *rootUse; /* Root cell use from which search begins */
|
||||
Rect *rootRect; /* Area to be read, in root coordinates */
|
||||
bool halt_on_error; /* If TRUE, failure to find a cell causes a halt */
|
||||
{
|
||||
int dbReadAreaFunc();
|
||||
SearchContext scontext;
|
||||
@@ -295,30 +297,39 @@ DBCellReadArea(rootUse, rootRect)
|
||||
scontext.scx_use = rootUse;
|
||||
scontext.scx_trans = GeoIdentityTransform;
|
||||
scontext.scx_area = *rootRect;
|
||||
(void) dbReadAreaFunc(&scontext);
|
||||
if (dbReadAreaFunc(&scontext, halt_on_error) == 1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dbReadAreaFunc(scx)
|
||||
dbReadAreaFunc(scx, halt_on_error)
|
||||
SearchContext *scx; /* Pointer to context specifying
|
||||
* the cell use to be read in, and
|
||||
* an area to be recursively read in
|
||||
* coordinates of the cell use's def.
|
||||
*/
|
||||
bool halt_on_error; /* If TURE, failure to find a cell causes a halt */
|
||||
{
|
||||
CellDef *def = scx->scx_use->cu_def;
|
||||
|
||||
if ((def->cd_flags & CDAVAILABLE) == 0)
|
||||
{
|
||||
bool dereference = (def->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
(void) DBCellRead(def, (char *) NULL, TRUE, dereference, NULL);
|
||||
if (DBCellRead(def, (char *)NULL, TRUE, dereference, NULL) == FALSE)
|
||||
if (halt_on_error)
|
||||
return 1;
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
}
|
||||
|
||||
(void) DBCellSrArea(scx, dbReadAreaFunc, (ClientData) NULL);
|
||||
if (DBCellSrArea(scx, dbReadAreaFunc, (ClientData)halt_on_error))
|
||||
if (halt_on_error)
|
||||
return 1;
|
||||
|
||||
/* Be clever about handling arrays: if the search area covers this
|
||||
* whole definition, then there's no need to look at any other
|
||||
@@ -328,5 +339,6 @@ dbReadAreaFunc(scx)
|
||||
|
||||
if (GEO_SURROUND(&scx->scx_area, &scx->scx_use->cu_def->cd_bbox))
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-2
@@ -899,7 +899,7 @@ DBReadBackup(name)
|
||||
*
|
||||
* DBCellRead --
|
||||
*
|
||||
* This is the wrapper for DBCellReadDef. The routine has been divided into
|
||||
* This is the wrapper for dbCellReadDef. The routine has been divided into
|
||||
* parts so that a single backup file can be made and recovered, and in
|
||||
* preparation for allowing certain cell definitions to be in-lined into the
|
||||
* output file (such as polygonXXXXX cells generated by the gds read-in).
|
||||
@@ -2947,7 +2947,8 @@ DBCellWrite(cellDef, fileName)
|
||||
{
|
||||
bool dereference = (cellDef->cd_flags & CDDEREFERENCE) ? TRUE : FALSE;
|
||||
/* Re-aquire the lock on the new file by opening it. */
|
||||
DBCellRead(cellDef, NULL, TRUE, dereference, NULL);
|
||||
if (DBCellRead(cellDef, NULL, TRUE, dereference, NULL) == FALSE)
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -720,7 +720,7 @@ extern bool DBCellRead();
|
||||
extern bool DBTestOpen();
|
||||
extern char *DBGetTech();
|
||||
extern bool DBCellWrite();
|
||||
extern void DBCellReadArea();
|
||||
extern int DBCellReadArea();
|
||||
extern void DBFileRecovery();
|
||||
extern bool DBWriteBackup();
|
||||
extern bool DBReadBackup();
|
||||
|
||||
Reference in New Issue
Block a user