Skip to content

Commit

Permalink
Corrected a crash condition caused by yesterday's commit, if the
Browse files Browse the repository at this point in the history
new CIF operator is used in a tech file.  Reworked yesterday's
commit to add more related operators, so there are now four new
ones (also renamed them):  interacting, noninteracting, overlapping,
and nonoverlapping.  "interacting" now means overlapping or touching;
so the four cases allow all variations of adjacency between the two
material types.
  • Loading branch information
RTimothyEdwards committed Feb 5, 2025
1 parent a5653c8 commit 619191c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.516
8.3.517
26 changes: 20 additions & 6 deletions cif/CIFgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -4664,8 +4664,8 @@ cifBridgeLimFunc2(
* cifInteractingRegions --
*
* Process each disjoint region and copy the entire content of each
* region for which any part of the region overlaps with <...>
* to the current CIF plane.
* region for which any part of the region overlaps with co_cifMask
* or co_paintMask to the current CIF plane.
*
* Results:
* None.
Expand Down Expand Up @@ -4714,6 +4714,19 @@ cifInteractingRegions(
/* Get tile area for interaction search */
TiToRect(t, &area);

/* "interacting" includes touching as well as overlapping, so expand
* search by one unit in every direction and then check overlap.
* NOTE: This catches catecorner-touching material, which is
* assumed not to be an issue.
*/
if ((pointertype)op->co_client & CIFOP_INT_TOUCHING)
{
area.r_xbot -= 1;
area.r_xtop += 1;
area.r_ybot -= 1;
area.r_ytop += 1;
}

/* Check if this tile interacts with the rule's types, or skip */
/* if already known to be interacting. */

Expand Down Expand Up @@ -4752,11 +4765,12 @@ cifInteractingRegions(
}
}

/* op->co_client is an invert bit indicating the rule is "not-interact",
* so invert the sense of "interacts". Then the non-interacting regions
* will be kept and the interacting regions will be discarded.
/* op->co_client has an invert bit indicating the rule is "not interacting"
* or "not-overlapping", so invert the sense of "interacts". Then the non-
* interacting/overlapping regions will be kept and the interacting/
* overlapping regions will be discarded.
*/
if (op->co_client == (ClientData)1)
if ((pointertype)op->co_client & CIFOP_INT_NOT)
interacts = (interacts) ? FALSE : TRUE;

/* Clear the tiles that were processed in this set, first copying them */
Expand Down
3 changes: 3 additions & 0 deletions cif/CIFint.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ typedef struct cifop
#define CIFOP_BRIDGELIM 23
#define CIFOP_MASKHINTS 24

/* Definitions of bit fields used in the value of co_client for CIFOP_INTERACT */
#define CIFOP_INT_NOT 0x1 /* Inverted sense (not interacting) */
#define CIFOP_INT_TOUCHING 0x2 /* Include both touching and overlapping */

/* Added by Tim 10/21/2004 */
/* The following structure is used to pass information on how to draw
Expand Down
17 changes: 14 additions & 3 deletions cif/CIFtech.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,12 +1095,22 @@ CIFTechLine(
newOp->co_opcode = CIFOP_BRIDGE;
else if (strcmp(argv[0], "bridge-lim") == 0)
newOp->co_opcode = CIFOP_BRIDGELIM;
else if (strcmp(argv[0], "interact") == 0)
else if (strcmp(argv[0], "overlapping") == 0)
newOp->co_opcode = CIFOP_INTERACT;
else if (strcmp(argv[0], "not-interact") == 0)
else if (strcmp(argv[0], "nonoverlapping") == 0)
{
newOp->co_opcode = CIFOP_INTERACT;
newOp->co_client = (ClientData)1;
newOp->co_client = (ClientData)CIFOP_INT_NOT;
}
else if (strcmp(argv[0], "interacting") == 0)
{
newOp->co_opcode = CIFOP_INTERACT;
newOp->co_client = (ClientData)CIFOP_INT_TOUCHING;
}
else if (strcmp(argv[0], "noninteracting") == 0)
{
newOp->co_opcode = CIFOP_INTERACT;
newOp->co_client = (ClientData)(CIFOP_INT_TOUCHING | CIFOP_INT_NOT);
}
else
{
Expand Down Expand Up @@ -2463,6 +2473,7 @@ CIFTechOutputScale(
case CIFOP_MASKHINTS:
case CIFOP_MAXRECT:
case CIFOP_NET:
case CIFOP_INTERACT:
break;
case CIFOP_BRIDGELIM:
case CIFOP_BRIDGE:
Expand Down

0 comments on commit 619191c

Please sign in to comment.