plowInitRule() pass by-pointer const TileTypeBitMask* instead of by-value

sizeof(TileTypeBitMask) == 32
This commit is contained in:
Darryl L. Miles 2025-02-17 10:00:46 +00:00 committed by Tim Edwards
parent 93054eb4e6
commit 97ff043c1a
2 changed files with 39 additions and 35 deletions

View File

@ -154,7 +154,8 @@ bool plowPropagateRect(CellDef *def, Rect *userRect, const TileTypeBitMask *lcp,
PlowRule *plowBuildWidthRules(); PlowRule *plowBuildWidthRules();
void plowMergeBottom(Tile *, Plane *); void plowMergeBottom(Tile *, Plane *);
void plowInitRule(); void plowInitRule(RuleTableEntry *rtePtr, RuleTableEntry *rteEnd, int whichRules, int (*proc)(), const char *name,
const TileTypeBitMask *ltypesp, const TileTypeBitMask *rtypesp);
extern void PlowRedrawBound(); extern void PlowRedrawBound();
extern void PlowClearBound(); extern void PlowClearBound();
@ -2081,7 +2082,7 @@ PlowAfterTech()
plowInitRule(&plowRuleInitial, (&plowRuleInitial) + 1, RTE_NULL, plowInitRule(&plowRuleInitial, (&plowRuleInitial) + 1, RTE_NULL,
(int (*)()) NULL, (int (*)()) NULL,
"initial edge", "initial edge",
DBZeroTypeBits, DBZeroTypeBits); &DBZeroTypeBits, &DBZeroTypeBits);
/* Cell rules */ /* Cell rules */
rp = plowCellRulesPtr; rp = plowCellRulesPtr;
@ -2089,7 +2090,7 @@ PlowAfterTech()
/* Drag geometry with cells */ /* Drag geometry with cells */
plowInitRule(rp++, re, RTE_NULL, prCell, plowInitRule(rp++, re, RTE_NULL, prCell,
"drag paint with cells", "drag paint with cells",
allBits, cellTypes); &allBits, &cellTypes);
if (rp >= re) rp = re; if (rp >= re) rp = re;
plowCellRulesPtr = rp; plowCellRulesPtr = rp;
@ -2098,97 +2099,97 @@ PlowAfterTech()
re = &plowSearchRulesTbl[MAXRULES]; re = &plowSearchRulesTbl[MAXRULES];
/* Clear the umbra */ /* Clear the umbra */
plowInitRule(rp++, re, RTE_NULL, prClearUmbra, "clear umbra", plowInitRule(rp++, re, RTE_NULL, prClearUmbra, "clear umbra",
allBits, allButSpace); &allBits, &allButSpace);
plowInitRule(rp++, re, RTE_REALWIDTH, prUmbra, "umbra width", plowInitRule(rp++, re, RTE_REALWIDTH, prUmbra, "umbra width",
widthL, widthR); &widthL, &widthR);
plowInitRule(rp++, re, RTE_SPACING, prUmbra, "umbra spacing", plowInitRule(rp++, re, RTE_SPACING, prUmbra, "umbra spacing",
spaceL, spaceR); &spaceL, &spaceR);
/* Clear the penumbra */ /* Clear the penumbra */
plowInitRule(rp++, re, RTE_REALWIDTH, prPenumbraTop, plowInitRule(rp++, re, RTE_REALWIDTH, prPenumbraTop,
"top penumbra width", "top penumbra width",
widthL, widthR); &widthL, &widthR);
plowInitRule(rp++, re, RTE_SPACING, prPenumbraTop, plowInitRule(rp++, re, RTE_SPACING, prPenumbraTop,
"top penumbra spacing", "top penumbra spacing",
spaceL, spaceR); &spaceL, &spaceR);
plowInitRule(rp++, re, RTE_REALWIDTH, prPenumbraBot, plowInitRule(rp++, re, RTE_REALWIDTH, prPenumbraBot,
"bottom penumbra width", "bottom penumbra width",
widthL, widthR); &widthL, &widthR);
plowInitRule(rp++, re, RTE_SPACING, prPenumbraBot, plowInitRule(rp++, re, RTE_SPACING, prPenumbraBot,
"bottom penumbra spacing", "bottom penumbra spacing",
spaceL, spaceR); &spaceL, &spaceR);
/* Special penumbra searching when RHS is fixed */ /* Special penumbra searching when RHS is fixed */
plowInitRule(rp++, re, RTE_NOSPACING, prFixedPenumbraTop, plowInitRule(rp++, re, RTE_NOSPACING, prFixedPenumbraTop,
"top penumbra spacing (RHS fixed-width)", "top penumbra spacing (RHS fixed-width)",
allBits, PlowFixedTypes); &allBits, &PlowFixedTypes);
plowInitRule(rp++, re, RTE_NOSPACING, prFixedPenumbraBot, plowInitRule(rp++, re, RTE_NOSPACING, prFixedPenumbraBot,
"bottom penumbra spacing (RHS fixed-width)", "bottom penumbra spacing (RHS fixed-width)",
allBits, PlowFixedTypes); &allBits, &PlowFixedTypes);
/* Avoid introducing slivers */ /* Avoid introducing slivers */
plowInitRule(rp++, re, RTE_MINWIDTH, prSliverTop, plowInitRule(rp++, re, RTE_MINWIDTH, prSliverTop,
"top width slivers", "top width slivers",
widthL, widthR); &widthL, &widthR);
plowInitRule(rp++, re, RTE_SPACING, prSliverTop, plowInitRule(rp++, re, RTE_SPACING, prSliverTop,
"top spacing slivers", "top spacing slivers",
spaceL, spaceR); &spaceL, &spaceR);
plowInitRule(rp++, re, RTE_MINWIDTH, prSliverBot, plowInitRule(rp++, re, RTE_MINWIDTH, prSliverBot,
"bottom width slivers", "bottom width slivers",
widthL, widthR); &widthL, &widthR);
plowInitRule(rp++, re, RTE_SPACING, prSliverBot, plowInitRule(rp++, re, RTE_SPACING, prSliverBot,
"bottom spacing slivers", "bottom spacing slivers",
spaceL, spaceR); &spaceL, &spaceR);
/* Inside slivers (plow too small) */ /* Inside slivers (plow too small) */
TTMaskCom2(&mask, &PlowFixedTypes); TTMaskCom2(&mask, &PlowFixedTypes);
plowInitRule(rp++, re, RTE_NULL, prInSliver, plowInitRule(rp++, re, RTE_NULL, prInSliver,
"inside slivers", "inside slivers",
mask, mask); &mask, &mask);
/* Avoid introducing illegal edges */ /* Avoid introducing illegal edges */
plowInitRule(rp++, re, RTE_NULL, prIllegalTop, plowInitRule(rp++, re, RTE_NULL, prIllegalTop,
"top illegal edges", "top illegal edges",
allBits, allBits); &allBits, &allBits);
plowInitRule(rp++, re, RTE_NULL, prIllegalBot, plowInitRule(rp++, re, RTE_NULL, prIllegalBot,
"bottom illegal edges", "bottom illegal edges",
allBits, allBits); &allBits, &allBits);
/* Avoid uncovering "covered" materials (e.g, fets) */ /* Avoid uncovering "covered" materials (e.g, fets) */
plowInitRule(rp++, re, RTE_NULL, prCoverTop, plowInitRule(rp++, re, RTE_NULL, prCoverTop,
"top covering", "top covering",
PlowCoveredTypes, allBits); &PlowCoveredTypes, &allBits);
plowInitRule(rp++, re, RTE_NULL, prCoverBot, plowInitRule(rp++, re, RTE_NULL, prCoverBot,
"bottom covering", "bottom covering",
PlowCoveredTypes, allBits); &PlowCoveredTypes, &allBits);
/* Preserve fixed-width objects */ /* Preserve fixed-width objects */
plowInitRule(rp++, re, RTE_NULL, prFixedLHS, plowInitRule(rp++, re, RTE_NULL, prFixedLHS,
"LHS is fixed", "LHS is fixed",
PlowFixedTypes, allBits); &PlowFixedTypes, &allBits);
plowInitRule(rp++, re, RTE_NULL, prFixedRHS, plowInitRule(rp++, re, RTE_NULL, prFixedRHS,
"RHS is fixed", "RHS is fixed",
allBits, PlowFixedTypes); &allBits, &PlowFixedTypes);
/* Fixed-width objects drag trailing stubs */ /* Fixed-width objects drag trailing stubs */
TTMaskCom2(&mask, &PlowDragTypes); TTMaskCom2(&mask, &PlowDragTypes);
TTMaskClearType(&mask, TT_SPACE); TTMaskClearType(&mask, TT_SPACE);
plowInitRule(rp++, re, RTE_NULL, prFixedDragStubs, plowInitRule(rp++, re, RTE_NULL, prFixedDragStubs,
"RHS fixed dragging stubs", "RHS fixed dragging stubs",
mask, PlowDragTypes); &mask, &PlowDragTypes);
/* Couple contacts */ /* Couple contacts */
plowInitRule(rp++, re, RTE_NULL, prContactLHS, plowInitRule(rp++, re, RTE_NULL, prContactLHS,
"LHS is contact", "LHS is contact",
PlowContactTypes, allBits); &PlowContactTypes, &allBits);
plowInitRule(rp++, re, RTE_NULL, prContactRHS, plowInitRule(rp++, re, RTE_NULL, prContactRHS,
"RHS is contact", "RHS is contact",
allBits, PlowContactTypes); &allBits, &PlowContactTypes);
/* Move cells out of the way */ /* Move cells out of the way */
plowInitRule(rp++, re, RTE_NULL, prFindCells, plowInitRule(rp++, re, RTE_NULL, prFindCells,
"find cells", "find cells",
allBits, allBits); &allBits, &allBits);
if (rp >= re) rp = re; if (rp >= re) rp = re;
plowSearchRulesPtr = rp; plowSearchRulesPtr = rp;
@ -2201,14 +2202,17 @@ PlowAfterTech()
} }
void void
plowInitRule(rtePtr, rteEnd, whichRules, proc, name, ltypes, rtypes) plowInitRule(
RuleTableEntry *rtePtr; /* Pointer to entry to be added */ RuleTableEntry *rtePtr, /* Pointer to entry to be added */
RuleTableEntry *rteEnd; /* Pointer to one past last entry in table */ RuleTableEntry *rteEnd, /* Pointer to one past last entry in table */
int whichRules; /* Which rules to use (RTE_* from earlier) */ int whichRules, /* Which rules to use (RTE_* from earlier) */
int (*proc)(); /* Procedure implementing the rule */ int (*proc)(), /* Procedure implementing the rule */
char *name; /* Name of this rule */ const char *name, /* Name of this rule */
TileTypeBitMask ltypes, rtypes; const TileTypeBitMask *ltypesp,
const TileTypeBitMask *rtypesp)
{ {
TileTypeBitMask ltypes = *ltypesp; /* TTMaskCopy(&ltypes, ltypesp) */
TileTypeBitMask rtypes = *rtypesp; /* TTMaskCopy(&rtypes, rtypesp) */
if (rtePtr >= rteEnd) if (rtePtr >= rteEnd)
{ {
TxError("Too many rules in PlowMain.c (maximum %d)\n", MAXRULES); TxError("Too many rules in PlowMain.c (maximum %d)\n", MAXRULES);

View File

@ -50,7 +50,7 @@ typedef struct
TileTypeBitMask rte_rtypes; /* Apply if RHS type is in this set */ TileTypeBitMask rte_rtypes; /* Apply if RHS type is in this set */
int rte_whichRules;/* See below */ int rte_whichRules;/* See below */
int (*rte_proc)(); /* Procedure implementing rule */ int (*rte_proc)(); /* Procedure implementing rule */
char *rte_name; /* Name of rule (for debugging) */ const char *rte_name; /* Name of rule (for debugging) */
} RuleTableEntry; } RuleTableEntry;
#define MAXRULES 100 /* Ridiculously high */ #define MAXRULES 100 /* Ridiculously high */