Modified GDS read output to avoid generating error messages on

unrecognized layers when the "readonly" read option is set.
Added support to scale elements (from the "element" command,
such as the measurement text and arrows) when the grid scales,
which was missing.  Corrected the output of persistent elements
in a .mag file so that they are correctly scaled by the scale
reducer.
This commit is contained in:
Tim Edwards 2020-05-12 12:03:38 -04:00
parent 838591bdf2
commit 55ff3fd1ff
7 changed files with 72 additions and 10 deletions

View File

@ -1 +1 @@
8.3.7
8.3.8

View File

@ -1143,6 +1143,15 @@ calmaLayerError(mesg, layer, dt)
CalmaLayerType clt;
HashEntry *he;
/* Ignore errors for cells that are marked as read-only, since */
/* these are normally expected to have unhandled layer types, */
/* since the purpose of read-only cells is to preserve exactly */
/* layout in the cell which may not be represented in the tech */
/* file. */
if ((cifReadCellDef->cd_flags & CDVENDORGDS) == CDVENDORGDS)
return;
clt.clt_layer = layer;
clt.clt_type = dt;
he = HashFind(&calmaLayerHash, (char *) &clt);

View File

@ -111,6 +111,16 @@ DBCellRename(cellname, newname)
return FALSE;
}
/* Disallow renaming if the cell has the READONLY flag set, */
/* because the cellname must match the name in the GDS */
/* file referenced. */
if ((celldef->cd_flags & CDVENDORGDS) == CDVENDORGDS)
{
TxError("Attempt to rename read-only cell \"%s\"\n", cellname);
return FALSE;
}
/* Good to go! */
UndoDisable();

View File

@ -30,6 +30,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/hash.h"
#include "database/database.h"
#include "database/databaseInt.h"
#include "dbwind/dbwind.h"
#include "textio/textio.h"
#include "utils/signals.h"
#include "windows/windows.h"
@ -1496,7 +1497,6 @@ DBScaleEverything(scalen, scaled)
int scalen, scaled;
{
void ToolScaleBox();
void DBWScaleCrosshair();
int dbCellDefEnumFunc();
LinkedCellDef *lhead, *lcd;
@ -1526,6 +1526,9 @@ DBScaleEverything(scalen, scaled)
lcd = lcd->cd_next;
}
/* Scale all elements */
DBWScaleElements(scalen, scaled);
/* Recovery of global plane pointers */
MZAttachHintPlanes();

View File

@ -2558,7 +2558,7 @@ DBCellWriteFile(cellDef, f)
}
/* Now any persistent elements */
estring = DBWPrintElements(cellDef, DBW_ELEMENT_PERSISTENT);
estring = DBWPrintElements(cellDef, DBW_ELEMENT_PERSISTENT, reducer);
if (estring != NULL)
{
FPRINTF(f, "<< elements >>\n");

View File

@ -168,9 +168,10 @@ void AppendFlag(char **rstr, bool *flagset, char *fname)
*/
char *
DBWPrintElements(cellDef, flagmask)
DBWPrintElements(cellDef, flagmask, reducer)
CellDef *cellDef;
unsigned char flagmask;
int reducer;
{
DBWElement *elem;
HashSearch hs;
@ -205,17 +206,17 @@ DBWPrintElements(cellDef, flagmask)
((sptr->next == NULL) ? " " : ","));
/* print start point */
sprintf(istr, "%d", elem->area.r_xbot);
sprintf(istr, "%d", elem->area.r_xbot / reducer);
AppendString(&rstr, istr, " ");
sprintf(istr, "%d", elem->area.r_ybot);
sprintf(istr, "%d", elem->area.r_ybot / reducer);
AppendString(&rstr, istr, " ");
switch (elem->type)
{
case ELEMENT_RECT:
/* end point */
sprintf(istr, "%d", elem->area.r_xtop);
sprintf(istr, "%d", elem->area.r_xtop / reducer);
AppendString(&rstr, istr, " ");
sprintf(istr, "%d", elem->area.r_ytop);
sprintf(istr, "%d", elem->area.r_ytop / reducer);
AppendString(&rstr, istr, "\n");
/* no flags to write. Only applicable flag is */
/* temporary/persistent, and temporary elements */
@ -223,9 +224,9 @@ DBWPrintElements(cellDef, flagmask)
break;
case ELEMENT_LINE:
/* end point */
sprintf(istr, "%d", elem->area.r_xtop);
sprintf(istr, "%d", elem->area.r_xtop / reducer);
AppendString(&rstr, istr, " ");
sprintf(istr, "%d", elem->area.r_ytop);
sprintf(istr, "%d", elem->area.r_ytop / reducer);
AppendString(&rstr, istr, NULL);
/* any non-default flags? */
flagset = FALSE;
@ -263,6 +264,42 @@ DBWPrintElements(cellDef, flagmask)
return rstr;
}
/*
* ----------------------------------------------------------------------------
*
* DBWScaleElements --
*
* Scale each element by the given integer numerator and denominator
*
* Results:
* None.
*
* Side Effects:
* Element values are modified.
* ----------------------------------------------------------------------------
*/
void
DBWScaleElements(n, d)
int n, d;
{
DBWElement *elem;
HashSearch hs;
HashEntry *he;
extern bool DBScalePoint(); /* Forward declaration */
HashStartSearch(&hs);
while (he = HashNext(&elementTable, &hs))
{
if (elem = (DBWElement *)HashGetValue(he))
{
/* scale area rectangle */
DBScalePoint(&elem->area.r_ll, n, d);
DBScalePoint(&elem->area.r_ur, n, d);
}
}
}
/*
* ----------------------------------------------------------------------------

View File

@ -219,6 +219,8 @@ extern void DBWElementNames();
extern void DBWElementInbox();
extern void DBWElementParseFlags();
extern char *DBWPrintElements();
extern void DBWScaleElements();
extern void DBWScaleCrosshair();
/* Random procedures used internally to this module. None of these
* should ever need to be called by the outside world.
@ -232,4 +234,5 @@ extern void DBWFeedbackShow();
extern void dbwElementInit();
extern void dbwCrosshairInit();
#endif /* _DBWIND_H */