Corrected the method of "flatten in place" from the previous

commit to prevent port labels from being copied up from the
flattened cell into the parent, and prefixing the instance
name to text in the instance top level so that there will be
no port or label collisions in the parent cell after flattening
the child cell in place.  Also:  Changed "extract dolabelcheck"
to be the default setting.
This commit is contained in:
Tim Edwards 2022-12-16 12:03:38 -05:00
parent 3b396d65f0
commit a0f502501e
5 changed files with 56 additions and 14 deletions

View File

@ -1 +1 @@
8.3.354
8.3.355

View File

@ -2044,6 +2044,7 @@ CmdFlatten(w, cmd)
if (doinplace)
{
HashEntry *he;
Label *lab;
if (EditCellUse == NULL)
{
@ -2058,9 +2059,13 @@ CmdFlatten(w, cmd)
return;
}
scx.scx_use = (CellUse *)HashGetValue(he);
scx.scx_trans = GeoIdentityTransform;
scx.scx_trans = scx.scx_use->cu_transform;
scx.scx_area = scx.scx_use->cu_def->cd_bbox;
/* Mark labels in the subcell top level for later handling */
for (lab = scx.scx_use->cu_def->cd_labels; lab; lab = lab->lab_next)
lab->lab_flags |= LABEL_GENERATE;
UndoDisable();
DBCellCopyAllPaint(&scx, &DBAllButSpaceAndDRCBits, xMask, EditCellUse);
@ -2077,6 +2082,36 @@ CmdFlatten(w, cmd)
if (xMask != CU_DESCEND_ALL)
DBCellCopyAllCells(&scx, xMask, EditCellUse, (Rect *)NULL);
/* Marked labels coming from the subcell top level must not be */
/* ports, and text should be prefixed with the subcell name. */
for (lab = EditCellUse->cu_def->cd_labels; lab; lab = lab->lab_next)
{
Label *newlab;
char *newtext;
if (lab->lab_flags & LABEL_GENERATE)
{
newtext = mallocMagic(strlen(lab->lab_text)
+ strlen(scx.scx_use->cu_id) + 2);
sprintf(newtext, "%s/%s", scx.scx_use->cu_id, lab->lab_text);
DBPutFontLabel(EditCellUse->cu_def,
&lab->lab_rect, lab->lab_font, lab->lab_size,
lab->lab_rotate, &lab->lab_offset, lab->lab_just,
newtext, lab->lab_type, 0, 0);
DBEraseLabelsByContent(EditCellUse->cu_def, &lab->lab_rect,
-1, lab->lab_text);
freeMagic(newtext);
}
}
/* Unmark labels in the subcell top level */
for (lab = scx.scx_use->cu_def->cd_labels; lab; lab = lab->lab_next)
lab->lab_flags &= ~LABEL_GENERATE;
/* Remove the use */
DBDeleteCell(scx.scx_use);

View File

@ -310,7 +310,7 @@ dbReadAreaFunc(scx, halt_on_error)
* 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 */
bool halt_on_error; /* If TRUE, failure to find a cell causes a halt */
{
CellDef *def = scx->scx_use->cu_def;

View File

@ -287,19 +287,26 @@ extHierConnections(ha, cumFlat, oneFlat)
for (lab = sourceDef->cd_labels; lab; lab = lab->lab_next)
{
CellDef *cumDef = cumFlat->et_use->cu_def;
Rect r = lab->lab_rect;
TileTypeBitMask *connected = &DBConnectTbl[lab->lab_type];
int i = DBPlane(lab->lab_type);
CellDef *cumDef;
Rect r;
TileTypeBitMask *connected;
if (!(lab->lab_flags & LABEL_STICKY)) continue;
r = lab->lab_rect;
GEOCLIP(&r, &ha->ha_subArea);
if (GEO_RECTNULL(&r)) continue;
cumDef = cumFlat->et_use->cu_def;
connected = &DBConnectTbl[lab->lab_type];
pNum = DBPlane(lab->lab_type);
ha->hierOneTile = (Tile *)lab; /* Blatant hack recasting */
ha->hierType = lab->lab_type;
ha->hierPNumBelow = i;
ha->hierPNumBelow = pNum;
GEOCLIP(&r, &ha->ha_subArea);
if (lab->lab_flags & LABEL_STICKY)
DBSrPaintArea((Tile *) NULL,
cumFlat->et_use->cu_def->cd_planes[i], &r,
DBSrPaintArea((Tile *) NULL,
cumFlat->et_use->cu_def->cd_planes[pNum], &r,
connected, extHierConnectFunc3, (ClientData) ha);
}
}
@ -381,7 +388,7 @@ extHierConnectFunc1(oneTile, ha)
// name may refer to a range of array elements, and the generated
// node only describes a single point.
for (lab = cumDef->cd_labels; lab; lab = lab->lab_next)
for (lab = cumDef->cd_labels; lab; lab = lab->lab_next)
{
// All sticky labels are at the front of the list in cumDef, so
// stop when we see the first non-sticky label.

View File

@ -55,7 +55,7 @@ extern FILE *extFileOpen();
* reported.
*/
int ExtDoWarn = EXTWARN_DUP|EXTWARN_FETS;
int ExtOptions = EXT_DOALL;
int ExtOptions = EXT_DOALL|EXT_DOLABELCHECK;
/* --------------------------- Global data ---------------------------- */