(1) Corrected an error with extraction in which terminal area and

perimeter are not initialized, and if a terminal perimeter/area
calculation is missed (which is happening on devices with terminals
in planes other than the plane of the identifying type), then the
perimeter/area of a previously handled device will get output.
(2) Corrected an error with "flatten -inplace" in which the command
fails to deal with instance arrays.
This commit is contained in:
Tim Edwards 2023-06-07 08:06:18 -04:00
parent 666c3c2c97
commit 6caab5da37
3 changed files with 105 additions and 36 deletions

View File

@ -1 +1 @@
8.3.400 8.3.401

View File

@ -458,15 +458,16 @@ dbCopyMaskHintsFunc(key, value, puds)
*----------------------------------------------------------------------------- *-----------------------------------------------------------------------------
*/ */
void void
DBCellCopyMaskHints(child, parent) DBCellCopyMaskHints(child, parent, transform)
CellUse *child; CellUse *child;
CellDef *parent; CellDef *parent;
Transform *transform;
{ {
struct propUseDefStruct puds; struct propUseDefStruct puds;
puds.puds_source = child->cu_def; puds.puds_source = child->cu_def;
puds.puds_dest = parent; puds.puds_dest = parent;
puds.puds_trans = &child->cu_transform; puds.puds_trans = transform;
DBPropEnum(child->cu_def, dbCopyMaskHintsFunc, (ClientData)&puds); DBPropEnum(child->cu_def, dbCopyMaskHintsFunc, (ClientData)&puds);
} }
@ -561,6 +562,7 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels)
{ {
Label *lab; Label *lab;
SearchContext scx; SearchContext scx;
int xsep, ysep, xbase, ybase;
if (dest == NULL) if (dest == NULL)
{ {
@ -569,64 +571,117 @@ DBFlattenInPlace(use, dest, xMask, dolabels, toplabels)
} }
scx.scx_use = use; scx.scx_use = use;
scx.scx_trans = use->cu_transform;
scx.scx_area = use->cu_def->cd_bbox; scx.scx_area = use->cu_def->cd_bbox;
/* Mark labels in the subcell top level for later handling */ /* Mark labels in the subcell top level for later handling */
for (lab = scx.scx_use->cu_def->cd_labels; lab; lab = lab->lab_next) for (lab = scx.scx_use->cu_def->cd_labels; lab; lab = lab->lab_next)
lab->lab_flags |= LABEL_GENERATE; lab->lab_flags |= LABEL_GENERATE;
DBCellCopyAllPaint(&scx, &DBAllButSpaceAndDRCBits, xMask, dest); scx.scx_x = use->cu_xlo;
if (dolabels) scx.scx_y = use->cu_ylo;
FlatCopyAllLabels(&scx, &DBAllTypeBits, xMask, dest);
else if (toplabels) while (TRUE)
{ {
int savemask = scx.scx_use->cu_expandMask; if ((use->cu_xlo == use->cu_xhi) && (use->cu_ylo == use->cu_yhi))
scx.scx_use->cu_expandMask = CU_DESCEND_SPECIAL; scx.scx_trans = use->cu_transform;
DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest); else
scx.scx_use->cu_expandMask = savemask;
}
if (xMask != CU_DESCEND_ALL)
DBCellCopyAllCells(&scx, xMask, dest, (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 = dest->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) if (use->cu_xlo > use->cu_xhi) xsep = -use->cu_xsep;
else xsep = use->cu_xsep;
if (use->cu_ylo > use->cu_yhi) ysep = -use->cu_ysep;
else ysep = use->cu_ysep;
xbase = xsep * (scx.scx_x - use->cu_xlo);
ybase = ysep * (scx.scx_y - use->cu_ylo);
GeoTransTranslate(xbase, ybase, &use->cu_transform, &scx.scx_trans);
}
DBCellCopyAllPaint(&scx, &DBAllButSpaceAndDRCBits, xMask, dest);
if (dolabels)
FlatCopyAllLabels(&scx, &DBAllTypeBits, xMask, dest);
else if (toplabels)
{
int savemask = scx.scx_use->cu_expandMask;
scx.scx_use->cu_expandMask = CU_DESCEND_SPECIAL;
DBCellCopyAllLabels(&scx, &DBAllTypeBits, CU_DESCEND_SPECIAL, dest);
scx.scx_use->cu_expandMask = savemask;
}
if (xMask != CU_DESCEND_ALL)
DBCellCopyAllCells(&scx, xMask, dest, (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 = dest->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); + strlen(scx.scx_use->cu_id) + 2);
sprintf(newtext, "%s/%s", scx.scx_use->cu_id, lab->lab_text); if ((use->cu_xlo != use->cu_xhi) && (use->cu_ylo != use->cu_yhi))
sprintf(newtext, "%s[%d][%d]/%s", scx.scx_use->cu_id,
scx.scx_x, scx.scx_y, lab->lab_text);
else if (use->cu_xlo != use->cu_xhi)
sprintf(newtext, "%s[%d]/%s", scx.scx_use->cu_id,
scx.scx_x, lab->lab_text);
else if (use->cu_ylo != use->cu_yhi)
sprintf(newtext, "%s[%d]/%s", scx.scx_use->cu_id,
scx.scx_y, lab->lab_text);
else
sprintf(newtext, "%s/%s", scx.scx_use->cu_id, lab->lab_text);
DBPutFontLabel(dest->cu_def, DBPutFontLabel(dest->cu_def,
&lab->lab_rect, lab->lab_font, lab->lab_size, &lab->lab_rect, lab->lab_font, lab->lab_size,
lab->lab_rotate, &lab->lab_offset, lab->lab_just, lab->lab_rotate, &lab->lab_offset, lab->lab_just,
newtext, lab->lab_type, 0, 0); newtext, lab->lab_type, 0, 0);
DBEraseLabelsByContent(dest->cu_def, &lab->lab_rect, DBEraseLabelsByContent(dest->cu_def, &lab->lab_rect,
-1, lab->lab_text); -1, lab->lab_text);
freeMagic(newtext); freeMagic(newtext);
}
}
/* Copy and transform mask hints from child to parent */
DBCellCopyMaskHints(scx.scx_use, dest->cu_def, &scx.scx_trans);
/* Stop processing if the use is not arrayed. */
if ((scx.scx_x == use->cu_xhi) && (scx.scx_y == use->cu_yhi))
break;
if (use->cu_xlo < use->cu_xhi)
scx.scx_x++;
else if (use->cu_xlo > use->cu_xhi)
scx.scx_x--;
if (((use->cu_xlo < use->cu_xhi) && (scx.scx_x > use->cu_xhi)) ||
((use->cu_xlo > use->cu_xhi) && (scx.scx_x < use->cu_xhi)))
{
if (use->cu_ylo < use->cu_yhi)
{
scx.scx_y++;
scx.scx_x = use->cu_xlo;
}
else if (use->cu_yhi > use->cu_yhi)
{
scx.scx_y--;
scx.scx_x = use->cu_xlo;
}
} }
} }
/* Unmark labels in the subcell top level */ /* Unmark labels in the subcell top level */
for (lab = scx.scx_use->cu_def->cd_labels; lab; lab = lab->lab_next) for (lab = scx.scx_use->cu_def->cd_labels; lab; lab = lab->lab_next)
lab->lab_flags &= ~LABEL_GENERATE; lab->lab_flags &= ~LABEL_GENERATE;
/* Copy and transform mask hints from child to parent */
DBCellCopyMaskHints(scx.scx_use, dest->cu_def);
/* Remove the use from the parent def */ /* Remove the use from the parent def */
DBDeleteCell(scx.scx_use); DBDeleteCell(scx.scx_use);
DBWAreaChanged(dest->cu_def, &scx.scx_use->cu_def->cd_bbox, /* Was: &scx.scx_use->cu_def->cd_bbox */
DBWAreaChanged(dest->cu_def, &scx.scx_use->cu_bbox,
DBW_ALLWINDOWS, &DBAllButSpaceAndDRCBits); DBW_ALLWINDOWS, &DBAllButSpaceAndDRCBits);
} }

View File

@ -1838,6 +1838,20 @@ extOutputDevices(def, transList, outFile)
extTransRec.tr_plane = reg->treg_pnum; /* Save this value! */ extTransRec.tr_plane = reg->treg_pnum; /* Save this value! */
extTransRec.tr_subsnode = (NodeRegion *)NULL; extTransRec.tr_subsnode = (NodeRegion *)NULL;
for (i = 0; i < MAXSD; i++)
{
extTransRec.tr_termnode[i] = NULL;
extTransRec.tr_termlen[i] = 0;
extTransRec.tr_termarea[i] = 0;
extTransRec.tr_termperim[i] = 0;
extTransRec.tr_termshared[i] = 0;
extTransRec.tr_termvector[i].p_x = 0;
extTransRec.tr_termvector[i].p_y = 0;
extTransRec.tr_termpos[i].pnum = 0;
extTransRec.tr_termpos[i].pt.p_x = 0;
extTransRec.tr_termpos[i].pt.p_y = 0;
}
arg.fra_def = def; arg.fra_def = def;
arg.fra_connectsTo = ExtCurStyle->exts_deviceConn; arg.fra_connectsTo = ExtCurStyle->exts_deviceConn;