Modified the "gds subcell polygon" command option to split into

three types:  "none", "temporary", and "keep" (instead of "true"
or "false").  "none" now reverts back to the original behavior,
because it was found that saving polygons in subcells prevents
them from participating in boolean operations.  The "keep"
option is the original option (polygons kept in subcells), and
"temporary" is the one recently introduced (which puts polygons
in subcells and then flattens them).  This restores the original
method while retaining the recently implemented method.  However,
a proper solution needs to be found that deals with the problem
of boolean operators.
This commit is contained in:
Tim Edwards 2023-01-17 20:14:38 -05:00
parent 05ad386500
commit be59d787a1
6 changed files with 53 additions and 19 deletions

View File

@ -1 +1 @@
8.3.362
8.3.363

View File

@ -606,7 +606,8 @@ calmaParseStructure(filename)
*/
DBEraseLabelsByContent(cifReadCellDef, NULL, -1, "");
if ((!CalmaSubcellPolygons) && (locPolygonCount < CalmaPolygonCount))
if ((CalmaSubcellPolygons == CALMA_POLYGON_TEMP) &&
(locPolygonCount < CalmaPolygonCount))
DBCellEnum(cifReadCellDef, calmaFlattenPolygonFunc, (ClientData)cifReadCellDef);
DBAdjustLabelsNew(cifReadCellDef, &TiPlaneRect,

View File

@ -247,13 +247,13 @@ calmaElementBoundary()
/* so we need to set it again. */
if (ciftype >= 0) plane = cifCurReadPlanes[ciftype];
/* Convert the polygon to rectangles. */
/* NOTE: This was previously contingent on CalmaSubcellPolygons. */
/* However, in practice it has been found to be much faster to read */
/* polygons into subcells and then flatten into the layout instead */
/* of reading polygons directly into the layout. I am unsure why. */
/* Save non-Manhattan polygons in their own subcells. */
/* NOTE: CALMA_POLYGON_TEMP and CALMA_POLYGON_KEEP read in polygons much
* faster, but that interferes with boolean processing. This method
* needs to be reworked.
*/
if (calmaNonManhattan > 0)
if ((CalmaSubcellPolygons != CALMA_POLYGON_NONE) && (calmaNonManhattan > 0))
{
/* Place the polygon in its own subcell */
char newname[] = "polygonXXXXX";
@ -281,6 +281,8 @@ calmaElementBoundary()
}
}
/* Convert the polygon to rectangles. */
rp = CIFPolyToRects(pathheadp, plane, CIFPaintTable, (PaintUndoInfo *)NULL);
CIFFreePath(pathheadp);

View File

@ -55,9 +55,8 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
/* Globals for Calma reading */
FILETYPE calmaInputFile = NULL; /* Read from this stream */
FILE *calmaErrorFile = NULL; /* Write error output here */
bool CalmaSubcellPolygons = FALSE; /* Put non-Manhattan polygons
* in their own subcells.
*/
unsigned char CalmaSubcellPolygons = CALMA_POLYGON_NONE;
/* Read non-Manhattan polygons as-is */
int CalmaPolygonCount;
bool CalmaSubcellPaths = FALSE; /* Put paths in their own subcells. */
int CalmaPathCount;

View File

@ -25,7 +25,7 @@
#include "utils/magic.h"
/* Externally visible variables */
extern bool CalmaSubcellPolygons;
extern unsigned char CalmaSubcellPolygons;
extern bool CalmaSubcellPaths;
extern bool CalmaDoLabels;
extern bool CalmaDoLibrary;
@ -49,6 +49,15 @@ extern bool CalmaPostOrder;
extern bool CalmaAllowUndefined;
extern bool CalmaAllowAbstract;
/* Definitions used by the return value for CalmaSubcellPolygons */
/* CALMA_POLYGON_NONE: Process polygons immediately */
/* CALMA_POLYGON_TEMP: Create temporary polygon subcells */
/* CALMA_POLYGON_KEEP: Keep polygons in subcells */
#define CALMA_POLYGON_NONE 0
#define CALMA_POLYGON_TEMP 1
#define CALMA_POLYGON_KEEP 2
/* Externally-visible procedures: */
extern bool CalmaWrite();
extern void CalmaReadFile();

View File

@ -143,6 +143,7 @@ CmdCalma(w, cmd)
static char *cmdCalmaYesNo[] = {
"no", "false", "off", "0", "yes", "true", "on", "1", 0 };
static char *cmdCalmaAllowDisallow[] = {"disallow", "0", "allow", "1", 0};
static char *cmdCalmaPolygonType[] = {"none", "temporary", "keep", 0};
static char *cmdCalmaWarnOptions[] = { "default", "none", "align",
"limit", "redirect", "help", 0 };
static char *cmdCalmaOption[] =
@ -672,22 +673,44 @@ CmdCalma(w, cmd)
if (cmd->tx_argc == 3)
{
#ifdef MAGIC_WRAPPER
Tcl_SetObjResult(magicinterp, Tcl_NewBooleanObj(CalmaSubcellPolygons));
switch (CalmaSubcellPolygons)
{
case CALMA_POLYGON_NONE:
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj("none", 0));
break;
case CALMA_POLYGON_TEMP:
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj("temporary", 0));
break;
case CALMA_POLYGON_KEEP:
Tcl_SetObjResult(magicinterp, Tcl_NewStringObj("keep", 0));
break;
}
#else
if (CalmaSubcellPolygons)
TxPrintf("Non-manhattan polygons placed in subcells.\n");
else
if (CalmaSubcellPolygons == CALMA_POLYGON_NONE)
TxPrintf("Non-manhattan polygons read as-is.\n");
else if (CalmaSubcellPolygons == CALMA_POLYGON_TEMP)
TxPrintf("Non-manhattan polygons placed in temporary subcells.\n");
else
TxPrintf("Non-manhattan polygons placed in subcells.\n");
#endif
return;
}
else if (cmd->tx_argc != 4)
goto wrongNumArgs;
option = Lookup(cmd->tx_argv[3], cmdCalmaYesNo);
option = Lookup(cmd->tx_argv[3], cmdCalmaPolygonType);
if (option < 0)
goto wrongNumArgs;
CalmaSubcellPolygons = (option < 4) ? FALSE : TRUE;
{
option = Lookup(cmd->tx_argv[3], cmdCalmaYesNo);
if (option < 0)
goto wrongNumArgs;
else if (option < 4)
CalmaSubcellPolygons = (unsigned char)CALMA_POLYGON_NONE;
else
CalmaSubcellPolygons = (unsigned char)CALMA_POLYGON_KEEP;
}
else
CalmaSubcellPolygons = (unsigned char)option;
return;
case CALMA_NO_DUP: