diff --git a/VERSION b/VERSION index 99db6869..defd1141 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.354 +8.3.355 diff --git a/commands/CmdFI.c b/commands/CmdFI.c index 1f318501..5d4e1a29 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -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); diff --git a/database/DBexpand.c b/database/DBexpand.c index f93aaa67..71cb6b79 100644 --- a/database/DBexpand.c +++ b/database/DBexpand.c @@ -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; diff --git a/extract/ExtHier.c b/extract/ExtHier.c index 509cc5c5..506f6e8d 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -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. diff --git a/extract/ExtMain.c b/extract/ExtMain.c index a87fcd82..1068a89b 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -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 ---------------------------- */