From d149c83a8a1097e2d254e5d311db2749fa3cee28 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 17 Feb 2025 09:53:05 +0000 Subject: [PATCH] plowSrOutline() pass by-pointer const TileTypeBitMask* instead of by-value sizeof(TileTypeBitMask) == 32 --- plow/PlowJogs.c | 4 ++-- plow/PlowRules1.c | 12 ++++++------ plow/PlowRules2.c | 8 ++++---- plow/PlowSearch.c | 17 +++++++++-------- plow/PlowTest.c | 2 +- plow/plowInt.h | 2 +- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/plow/PlowJogs.c b/plow/PlowJogs.c index 3df6c452..b079663e 100644 --- a/plow/PlowJogs.c +++ b/plow/PlowJogs.c @@ -278,7 +278,7 @@ plowProcessJogFunc(edge, area) startPoint.p_y = edge->e_ytop; jogTopPoint = startPoint; jogTopDir = J_N; - plowSrOutline(edge->e_pNum, &startPoint, mask, GEO_NORTH, + plowSrOutline(edge->e_pNum, &startPoint, &mask, GEO_NORTH, GMASK_NORTH|GMASK_WEST|GMASK_EAST, plowJogTopProc, (ClientData) NULL); @@ -287,7 +287,7 @@ plowProcessJogFunc(edge, area) startPoint.p_y = edge->e_ybot; jogBotPoint = startPoint; jogBotDir = J_N; - plowSrOutline(edge->e_pNum, &startPoint, mask, GEO_SOUTH, + plowSrOutline(edge->e_pNum, &startPoint, &mask, GEO_SOUTH, GMASK_SOUTH|GMASK_WEST|GMASK_EAST, plowJogBotProc, (ClientData) NULL); diff --git a/plow/PlowRules1.c b/plow/PlowRules1.c index 0dfb8fdb..17d96ae5 100644 --- a/plow/PlowRules1.c +++ b/plow/PlowRules1.c @@ -231,7 +231,7 @@ prPenumbraTop(edge, rules) ar.ar_rule = pr; ar.ar_clip.p_x = edge->e_newx + pr->pr_dist; ar.ar_clip.p_y = edge->e_ytop + pr->pr_dist; - plowSrOutline(edge->e_pNum, &startPoint, pr->pr_ltypes, GEO_NORTH, + plowSrOutline(edge->e_pNum, &startPoint, &pr->pr_ltypes, GEO_NORTH, GMASK_WEST|GMASK_NORTH|GMASK_SOUTH, plowPenumbraTopProc, (ClientData) &ar); } @@ -256,7 +256,7 @@ prPenumbraBot(edge, rules) ar.ar_clip.p_x = edge->e_newx + pr->pr_dist; ar.ar_clip.p_y = edge->e_ybot - pr->pr_dist; TTMaskCom2(&insideTypes, &pr->pr_ltypes); - plowSrOutline(edge->e_pNum, &startPoint, insideTypes, GEO_SOUTH, + plowSrOutline(edge->e_pNum, &startPoint, &insideTypes, GEO_SOUTH, GMASK_WEST|GMASK_NORTH|GMASK_SOUTH, plowPenumbraBotProc, (ClientData) &ar); } @@ -512,7 +512,7 @@ prSliverTop(edge, rules) */ ar.ar_slivtype = (TileType) -1; ar.ar_lastx = ar.ar_mustmove = edge->e_x; - plowSrOutline(edge->e_pNum, &startPoint, pr->pr_ltypes, GEO_NORTH, + plowSrOutline(edge->e_pNum, &startPoint, &pr->pr_ltypes, GEO_NORTH, GMASK_NORTH|GMASK_EAST|GMASK_SOUTH, plowSliverTopExtent, (ClientData) &ar); @@ -524,7 +524,7 @@ prSliverTop(edge, rules) * ar_lastx, or ar_clip. */ if (ar.ar_mustmove > edge->e_x) - plowSrOutline(edge->e_pNum, &startPoint, pr->pr_ltypes, GEO_NORTH, + plowSrOutline(edge->e_pNum, &startPoint, &pr->pr_ltypes, GEO_NORTH, GMASK_SOUTH|GMASK_NORTH, plowSliverTopMove, (ClientData) &ar); } @@ -568,7 +568,7 @@ prSliverBot(edge, rules) ar.ar_slivtype = (TileType) -1; ar.ar_lastx = ar.ar_mustmove = edge->e_x; TTMaskCom2(&insideTypes, &pr->pr_ltypes); - plowSrOutline(edge->e_pNum, &startPoint, insideTypes, GEO_SOUTH, + plowSrOutline(edge->e_pNum, &startPoint, &insideTypes, GEO_SOUTH, GMASK_NORTH|GMASK_EAST|GMASK_SOUTH, plowSliverBotExtent, (ClientData) &ar); @@ -580,7 +580,7 @@ prSliverBot(edge, rules) * ar_lastx, or ar_clip. */ if (ar.ar_mustmove > edge->e_x) - plowSrOutline(edge->e_pNum, &startPoint, insideTypes, GEO_SOUTH, + plowSrOutline(edge->e_pNum, &startPoint, &insideTypes, GEO_SOUTH, GMASK_SOUTH|GMASK_NORTH, plowSliverBotMove, (ClientData) &ar); } diff --git a/plow/PlowRules2.c b/plow/PlowRules2.c index 3cd8a84c..b3b3f81e 100644 --- a/plow/PlowRules2.c +++ b/plow/PlowRules2.c @@ -577,7 +577,7 @@ prIllegalTop(edge) ar.ar_slivtype = (TileType) -1; ar.ar_clip.p_x = edge->e_newx; - plowSrOutline(edge->e_pNum, &startPoint, insideTypes, GEO_NORTH, + plowSrOutline(edge->e_pNum, &startPoint, &insideTypes, GEO_NORTH, GMASK_EAST|GMASK_WEST|GMASK_NORTH|GMASK_SOUTH, plowIllegalTopProc, (ClientData) &ar); if (ar.ar_slivtype == (TileType) -1) @@ -586,7 +586,7 @@ prIllegalTop(edge) startPoint.p_x = ar.ar_mustmove; TTMaskSetOnlyType(&insideTypes, ar.ar_slivtype); TTMaskCom(&insideTypes); - plowSrOutline(edge->e_pNum, &startPoint, insideTypes, GEO_NORTH, + plowSrOutline(edge->e_pNum, &startPoint, &insideTypes, GEO_NORTH, GMASK_WEST|GMASK_NORTH|GMASK_SOUTH, plowCoverTopProc, (ClientData) &ar); } @@ -606,7 +606,7 @@ prIllegalBot(edge) ar.ar_slivtype = (TileType) -1; ar.ar_clip.p_x = edge->e_newx; - plowSrOutline(edge->e_pNum, &startPoint, insideTypes, GEO_SOUTH, + plowSrOutline(edge->e_pNum, &startPoint, &insideTypes, GEO_SOUTH, GMASK_EAST|GMASK_WEST|GMASK_NORTH|GMASK_SOUTH, plowIllegalBotProc, (ClientData) &ar); if (ar.ar_slivtype == (TileType) -1) @@ -614,7 +614,7 @@ prIllegalBot(edge) startPoint.p_x = ar.ar_mustmove; TTMaskSetOnlyType(&insideTypes, ar.ar_slivtype); - plowSrOutline(edge->e_pNum, &startPoint, insideTypes, GEO_SOUTH, + plowSrOutline(edge->e_pNum, &startPoint, &insideTypes, GEO_SOUTH, GMASK_WEST|GMASK_NORTH|GMASK_SOUTH, plowCoverBotProc, (ClientData) &ar); return 0; diff --git a/plow/PlowSearch.c b/plow/PlowSearch.c index af4b6e85..199e2a1f 100644 --- a/plow/PlowSearch.c +++ b/plow/PlowSearch.c @@ -779,26 +779,27 @@ plowAtomize(pNum, rect, proc, cdata) */ void -plowSrOutline(pNum, startPoint, insideTypes, initialDir, dirMask, proc, cdata) - int pNum; /* Plane # in plowYankDef to search */ - Point *startPoint; /* Point on boundary; material of types +plowSrOutline( + int pNum, /* Plane # in plowYankDef to search */ + Point *startPoint, /* Point on boundary; material of types * in insideTypes should be to the * inside (as determined by initialDir * below). */ - TileTypeBitMask insideTypes; /* Mask of types inside the region + const TileTypeBitMask *insideTypesp,/* Mask of types inside the region * whose outline is being traced. */ - int initialDir; /* Initial direction to go from the + int initialDir, /* Initial direction to go from the * starting point. One of GEO_NORTH, * or GEO_SOUTH. */ - int dirMask; /* Mask of those directions for which + int dirMask, /* Mask of those directions for which * we will call the client procedure. */ - int (*proc)(); /* Client procedure */ - ClientData cdata; /* Argument to client procedure */ + int (*proc)(), /* Client procedure */ + ClientData cdata) /* Argument to client procedure */ { + TileTypeBitMask insideTypes = *insideTypesp; /* TTMaskCopy(&insideTypes, insideTypesp) */ Outline outline; /* diff --git a/plow/PlowTest.c b/plow/PlowTest.c index 49b3fcd3..999415df 100644 --- a/plow/PlowTest.c +++ b/plow/PlowTest.c @@ -193,7 +193,7 @@ PlowTest(w, cmd) } if (!CmdParseLayers(cmd->tx_argv[3], &okTypes)) return; - (void) plowSrOutline(PL_TECHDEPBASE, &editArea.r_ll, okTypes, dir, + (void) plowSrOutline(PL_TECHDEPBASE, &editArea.r_ll, &okTypes, dir, GMASK_NORTH|GMASK_SOUTH|GMASK_EAST|GMASK_WEST, plowShowOutline, (ClientData) &editArea); break; diff --git a/plow/plowInt.h b/plow/plowInt.h index fbd0d575..996491cb 100644 --- a/plow/plowInt.h +++ b/plow/plowInt.h @@ -263,7 +263,7 @@ extern int plowGenRandom(); extern void plowQueueDone(); extern void plowQueueInit(); extern int plowSrFinalArea(); -extern void plowSrOutline(); +extern void plowSrOutline(int pNum, Point *startPoint, const TileTypeBitMask *insideTypesp, int initialDir, int dirMask, int (*proc)(), ClientData cdata); extern int plowSrShadow(); extern int plowSrShadowBack(); extern int plowSrShadowInitial();