diff --git a/cif/CIFgen.c b/cif/CIFgen.c index 65822fd3..c03ba4bf 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -3431,7 +3431,7 @@ CIFGenLayer(op, area, cellDef, temps, clientdata) scx.scx_use = CIFDummyUse; scx.scx_trans = GeoIdentityTransform; DBTreeCopyConnect(&scx, &DBConnectTbl[ttype], 0, - DBConnectTbl, &TiPlaneRect, Select2Use); + DBConnectTbl, &TiPlaneRect, FALSE, Select2Use); cifSrTiles(op, area, Select2Def, temps, cifPaintFunc, (ClientData) CIFPaintTable); DBCellClearDef(Select2Def); diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index 25bc55b7..a398ffa8 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -1795,6 +1795,7 @@ dbScaleCell(cellDef, scalen, scaled) LinkedTile *lhead, *lt; LinkedCellUse *luhead, *lu; Plane *newplane; + BPlane *cellPlane, *cellPlaneOrig; /* DBCellEnum() attempts to read unavailable celldefs. We don't */ /* want to do that here, so check CDAVAILABLE flag first. */ @@ -1811,6 +1812,7 @@ dbScaleCell(cellDef, scalen, scaled) (void) DBCellEnum(cellDef, dbCellUseEnumFunc, (ClientData) &luhead); + cellPlane = BPNew(); lu = luhead; while (lu != NULL) { @@ -1838,9 +1840,16 @@ dbScaleCell(cellDef, scalen, scaled) DBScaleValue(&use->cu_array.ar_xsep, scalen, scaled); DBScaleValue(&use->cu_array.ar_ysep, scalen, scaled); + BPAdd(cellPlane, use); + lu = lu->cu_next; } + /* Swap the CellDef's cell plane */ + cellPlaneOrig = cellDef->cd_cellPlane; + cellDef->cd_cellPlane = cellPlane; + BPFree(cellPlaneOrig); + /* Free this linked cellUse structure */ lu = luhead; while (lu != NULL) @@ -2010,6 +2019,7 @@ DBMoveCell(cellDef, origx, origy) LinkedTile *lhead, *lt; LinkedCellUse *luhead, *lu; Plane *newplane; + BPlane *cellPlane, *cellPlaneOrig; /* Unlike dbScaleCell(), this routine is only run on valid edit defs */ @@ -2022,6 +2032,7 @@ DBMoveCell(cellDef, origx, origy) (void) DBCellEnum(cellDef, dbCellUseEnumFunc, (ClientData) &luhead); + cellPlane = BPNew(); lu = luhead; while (lu != NULL) { @@ -2046,9 +2057,16 @@ DBMoveCell(cellDef, origx, origy) use->cu_transform.t_c -= origx; use->cu_transform.t_f -= origy; + BPAdd(cellPlane, use); + lu = lu->cu_next; } + /* Swap the CellDef's cell plane */ + cellPlaneOrig = cellDef->cd_cellPlane; + cellDef->cd_cellPlane = cellPlane; + BPFree(cellPlaneOrig); + /* Free this linked cellUse structure */ lu = luhead; while (lu != NULL) diff --git a/database/DBconnect.c b/database/DBconnect.c index 69da4d56..a7772c0e 100644 --- a/database/DBconnect.c +++ b/database/DBconnect.c @@ -994,7 +994,7 @@ dbcConnectFunc(tile, cx) */ void -DBTreeCopyConnect(scx, mask, xMask, connect, area, destUse) +DBTreeCopyConnect(scx, mask, xMask, connect, area, doLabels, destUse) SearchContext *scx; /* Describes starting area. The * scx_use field gives the root of * the hierarchy to search, and the @@ -1018,6 +1018,10 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, destUse) * clipped to this area. Pass * TiPlaneRect to get everything. */ + bool doLabels; /* If TRUE, copy connected labels + * and paint. If FALSE, copy only + * connected paint. + */ CellUse *destUse; /* Result use in which to place * anything connected to material of * type mask in area of rootUse. @@ -1093,7 +1097,8 @@ DBTreeCopyConnect(scx, mask, xMask, connect, area, destUse) searchtype |= TF_LABEL_ATTACH_NOT_SE; } } - DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype, + if (doLabels) + DBTreeSrLabels(scx, newmask, xMask, &tpath, searchtype, dbcConnectLabelFunc, (ClientData) &csa2); } freeMagic((char *)csa2.csa2_list); diff --git a/extflat/EFantenna.c b/extflat/EFantenna.c index e7af529a..60cc1078 100644 --- a/extflat/EFantenna.c +++ b/extflat/EFantenna.c @@ -83,14 +83,14 @@ static int efAntennaDebug = FALSE; TileType *EFDeviceTypes; typedef struct _aas { - int *accum; /* Pointer to array of accumulated areas per type */ + dlong *accum; /* Pointer to array of accumulated areas per type */ int pNum; /* Plane of check */ Rect r; /* Holds any one visited rectangle */ CellDef *def; /* CellDef for adding feedback */ } AntennaAccumStruct; typedef struct _gdas { - int accum; /* Accumulated area of all gates/diff */ + dlong accum; /* Accumulated area of all gates/diff */ Rect r; /* Holds any one visited rectangle */ CellDef *def; /* CellDef for adding feedback */ } GateDiffAccumStruct; @@ -345,10 +345,11 @@ antennacheckVisit(dev, hierName, scale, trans, editUse) { DevTerm *gate; TileType t, conType; - int pos, pNum, pNum2, pmax, p, i, j, gatearea, diffarea, total; + int pos, pNum, pNum2, pmax, p, i, j, total; + dlong gatearea, diffarea; double anttotal; float saveRatio, ratioTotal; - int *antennaarea; + dlong *antennaarea; Rect r, gaterect; EFNode *gnode; SearchContext scx; @@ -360,7 +361,7 @@ antennacheckVisit(dev, hierName, scale, trans, editUse) extern int areaAccumFunc(), antennaAccumFunc(), areaMarkFunc(); - antennaarea = (int *)mallocMagic(DBNumTypes * sizeof(int)); + antennaarea = (dlong *)mallocMagic(DBNumTypes * sizeof(dlong)); switch(dev->dev_class) { @@ -482,7 +483,7 @@ antennacheckVisit(dev, hierName, scale, trans, editUse) break; } - for (i = 0; i < DBNumTypes; i++) antennaarea[i] = 0; + for (i = 0; i < DBNumTypes; i++) antennaarea[i] = (dlong)0; gatearea = 0; diffarea = 0; @@ -496,10 +497,10 @@ antennacheckVisit(dev, hierName, scale, trans, editUse) /* To do: Mark tiles so area count can be progressive */ DBTreeCopyConnect(&scx, &DBConnectTbl[t], 0, - DBConnectTbl, &TiPlaneRect, extPathUse); + DBConnectTbl, &TiPlaneRect, FALSE, extPathUse); /* Search planes of tie types and accumulate all tiedown areas */ - gdas.accum = 0; + gdas.accum = (dlong)0; for (p = 0; p < DBNumPlanes; p++) DBSrPaintArea((Tile *)NULL, extPathUse->cu_def->cd_planes[p], &TiPlaneRect, &ExtCurStyle->exts_antennaTieTypes, @@ -507,7 +508,7 @@ antennacheckVisit(dev, hierName, scale, trans, editUse) diffarea = gdas.accum; /* Search plane of gate type and accumulate all gate area */ - gdas.accum = 0; + gdas.accum = (dlong)0; DBSrPaintArea((Tile *)NULL, extPathUse->cu_def->cd_planes[pNum], &TiPlaneRect, &gatemask, areaAccumFunc, (ClientData)&gdas); gatearea = gdas.accum; @@ -667,10 +668,11 @@ areaAccumFunc(tile, gdas) GateDiffAccumStruct *gdas; { Rect *rect = &(gdas->r); - int area, type; + int type; + dlong area; TiToRect(tile, rect); - area = (rect->r_xtop - rect->r_xbot) * (rect->r_ytop - rect->r_ybot); + area = (dlong)(rect->r_xtop - rect->r_xbot) * (dlong)(rect->r_ytop - rect->r_ybot); gdas->accum += area; return 0; } @@ -694,9 +696,9 @@ antennaAccumFunc(tile, aaptr) AntennaAccumStruct *aaptr; { Rect *rect = &(aaptr->r); - int area; + dlong area; int type; - int *typeareas = aaptr->accum; + dlong *typeareas = aaptr->accum; int plane = aaptr->pNum; float thick; @@ -773,7 +775,7 @@ antennaAccumFunc(tile, aaptr) if (DBTypeOnPlane(ttype, plane)) { thick = ExtCurStyle->exts_thick[ttype]; - typeareas[ttype] += (int)((float)perimeter * thick); + typeareas[ttype] += (dlong)((float)perimeter * thick); } if (type >= DBNumUserLayers) @@ -784,27 +786,28 @@ antennaAccumFunc(tile, aaptr) if (DBTypeOnPlane(ttype, plane)) { thick = ExtCurStyle->exts_thick[ttype]; - typeareas[ttype] += (int)((float)perimeter * thick); + typeareas[ttype] += (dlong)((float)perimeter * thick); break; } } else { thick = ExtCurStyle->exts_thick[type]; - typeareas[type] += (int)((float)perimeter * thick); + typeareas[type] += (dlong)((float)perimeter * thick); } } else { /* Area is perimeter times layer thickness */ thick = ExtCurStyle->exts_thick[type]; - typeareas[type] += (int)((float)perimeter * thick); + typeareas[type] += (dlong)((float)perimeter * thick); } } else if (ExtCurStyle->exts_antennaRatio[type].areaType & ANTENNAMODEL_SURFACE) { /* Simple tile area calculation */ - area = (rect->r_xtop - rect->r_xbot) * (rect->r_ytop - rect->r_ybot); + area = (dlong)(rect->r_xtop - rect->r_xbot) + * (dlong)(rect->r_ytop - rect->r_ybot); /* If type is a contact, then add area to both residues as well */ /* as the contact type. */ diff --git a/extract/ExtLength.c b/extract/ExtLength.c index a0661a35..148eeac5 100644 --- a/extract/ExtLength.c +++ b/extract/ExtLength.c @@ -368,7 +368,7 @@ extLengthYank(use, labList) scx.scx_trans = GeoIdentityTransform; GEO_EXPAND(&lab->lab_rect, 1, &scx.scx_area); DBTreeCopyConnect(&scx, &DBConnectTbl[lab->lab_type], 0, - DBConnectTbl, &TiPlaneRect, extPathUse); + DBConnectTbl, &TiPlaneRect, TRUE, extPathUse); } if (DebugIsSet(extDebugID, extDebLength)) diff --git a/netmenu/NMshowcell.c b/netmenu/NMshowcell.c index 7434edcd..aab56daf 100644 --- a/netmenu/NMshowcell.c +++ b/netmenu/NMshowcell.c @@ -294,7 +294,7 @@ NMShowUnderBox() &DBAllButSpaceBits); DBCellClearDef(nmscShowUse->cu_def); DBTreeCopyConnect(&scx, &DBAllButSpaceAndDRCBits, 0, - DBConnectTbl, &TiPlaneRect, nmscShowUse); + DBConnectTbl, &TiPlaneRect, TRUE, nmscShowUse); DBWAreaChanged(nmscShowDef, &nmscShowDef->cd_bbox, DBW_ALLWINDOWS, &DBAllButSpaceBits); NMShowCell(nmscShowUse, rootDef); @@ -418,6 +418,6 @@ nmSRNFunc(rect, name, label, cdarg) scx.scx_trans = GeoIdentityTransform; DBTreeCopyConnect(&scx, &DBConnectTbl[label->lab_type], 0, - DBConnectTbl, &TiPlaneRect, nmscShowUse); + DBConnectTbl, &TiPlaneRect, TRUE, nmscShowUse); return(0); } diff --git a/select/selCreate.c b/select/selCreate.c index 47ef8b41..16d77417 100644 --- a/select/selCreate.c +++ b/select/selCreate.c @@ -749,7 +749,7 @@ SelectRegion(scx, type, xMask, pArea, less) UndoDisable(); DBCellClearDef(Select2Def); DBTreeCopyConnect(scx, &connections[type], xMask, connections, - &TiPlaneRect, Select2Use); + &TiPlaneRect, TRUE, Select2Use); UndoEnable(); /* Now transfer what we found into the main selection cell. Pick @@ -850,7 +850,7 @@ SelectNet(scx, type, xMask, pArea, less) UndoDisable(); DBCellClearDef(Select2Def); DBTreeCopyConnect(scx, &mask, xMask, DBConnectTbl, - &TiPlaneRect, Select2Use); + &TiPlaneRect, TRUE, Select2Use); UndoEnable(); /* Network undo method added by Nishit and Tim, July 8-10, 2004 */