From 516c9d76357ee8739db656e7bf6ed94404131c75 Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Fri, 2 Jan 2026 20:12:37 -0500 Subject: [PATCH] First cut of pulling the TT_SIDE bit out of the tile database and forcing it to be passed as an argument to all the callback functions for the search routines that require it. Magic now compiles and runs with the new code, but there are a number of known issues that need to be fixed up. Committing now so that I can rebase on the last update to the master branch. --- README | 123 +++++++++++++++++++ calma/CalmaRdcl.c | 21 ++-- calma/CalmaWrite.c | 18 +-- calma/CalmaWriteZ.c | 18 +-- cif/CIFgen.c | 270 ++++++++++++++++++++++++++--------------- cif/CIFhier.c | 30 +++-- cif/CIFint.h | 2 +- cif/CIFrdcl.c | 20 +-- cif/CIFsee.c | 15 ++- cif/CIFwrite.c | 10 +- commands/CmdCD.c | 30 +++-- commands/CmdFI.c | 22 +++- commands/CmdTZ.c | 10 +- commands/CmdWizard.c | 19 ++- database/DBcellcopy.c | 67 +++++----- database/DBcellsrch.c | 21 ++-- database/DBconnect.c | 136 ++++++++++++--------- database/DBio.c | 13 +- database/DBlabel.c | 13 +- database/DBpaint.c | 5 +- database/DBpaint2.c | 5 +- database/DBtiles.c | 38 +++--- database/database.h.in | 15 ++- dbwind/DBWdisplay.c | 19 +-- dbwind/DBWfdback.c | 5 +- dbwind/DBWhlights.c | 3 +- dbwind/DBWtools.c | 5 +- drc/DRCbasic.c | 38 +++--- drc/DRCcif.c | 20 +-- drc/DRCcontin.c | 21 ++-- drc/DRCextend.c | 5 +- drc/DRCmain.c | 10 +- drc/DRCsubcell.c | 10 +- extflat/EFantenna.c | 13 +- extract/ExtArray.c | 4 +- extract/ExtBasic.c | 184 ++++++++++++++++------------ extract/ExtCouple.c | 34 ++---- extract/ExtHard.c | 8 +- extract/ExtHier.c | 29 +++-- extract/ExtInter.c | 3 +- extract/ExtLength.c | 11 +- extract/ExtMain.c | 12 +- extract/ExtNghbors.c | 39 +++--- extract/ExtPerim.c | 10 +- extract/ExtRegion.c | 9 +- extract/ExtSubtree.c | 48 ++++---- extract/ExtTest.c | 4 +- extract/ExtTimes.c | 8 +- extract/extract.h | 2 +- extract/extractInt.h | 33 +++-- garouter/gaChannel.c | 8 +- garouter/gaSimple.c | 3 +- garouter/gaStem.c | 4 +- garouter/gaTest.c | 3 +- graphics/W3Dmain.c | 31 +++-- graphics/grClip.c | 21 ++-- grouter/grouteChan.c | 35 ++++-- lef/defRead.c | 1 + lef/defWrite.c | 28 ++++- lef/lefRead.c | 4 +- lef/lefWrite.c | 19 ++- lisp/lispMagic.c | 3 +- mzrouter/mzBlock.c | 30 +++-- mzrouter/mzDebug.c | 3 +- mzrouter/mzEstimate.c | 33 +++-- mzrouter/mzHint.c | 3 +- mzrouter/mzStart.c | 2 +- mzrouter/mzSubrs.c | 3 +- netmenu/NMshowcell.c | 7 +- netmenu/NMshowpt.c | 2 +- plot/plotGremln.c | 3 +- plot/plotPNM.c | 18 +-- plot/plotPS.c | 17 +-- plot/plotPixels.c | 5 +- plot/plotVers.c | 22 ++-- plow/PlowMain.c | 2 +- plow/PlowRandom.c | 2 +- plow/PlowRules2.c | 3 +- plow/PlowRules3.c | 3 +- plow/PlowWidth.c | 12 +- plow/PlowYank.c | 13 +- resis/ResBasic.c | 21 ++-- resis/ResMain.c | 20 +-- resis/ResMakeRes.c | 30 +++-- resis/ResUtils.c | 40 +++--- router/rtrChannel.c | 3 +- router/rtrCmd.c | 4 +- router/rtrDcmpose.c | 6 +- router/rtrMain.c | 3 +- router/rtrSide.c | 7 +- router/rtrStem.c | 7 +- router/rtrTravers.c | 12 +- router/rtrVia.c | 9 +- select/selCreate.c | 45 ++++--- select/selDisplay.c | 21 ++-- select/selEnum.c | 16 ++- select/selOps.c | 20 +-- select/selUnselect.c | 6 +- sim/SimDBstuff.c | 35 +++--- sim/SimExtract.c | 140 +++++++++++---------- sim/SimSelect.c | 9 +- sim/sim.h | 2 +- tiles/tile.h | 15 ++- utils/maxrect.c | 3 +- utils/touchtypes.c | 3 +- windows/windDisp.c | 10 +- 106 files changed, 1463 insertions(+), 875 deletions(-) create mode 100644 README diff --git a/README b/README new file mode 100644 index 00000000..643382ac --- /dev/null +++ b/README @@ -0,0 +1,123 @@ +Having abandoned the attempt to redefine a split tile as +two separate tile entries, I am returning to the problem +of removing TT_SIDE from the database. + +TT_SIDE has been used to pass information to callback +routines to indicate which side of a tile should be +processed. This should never have been done, because +it causes the database to be altered during searches, +which prevents searches from being parallelized. + +To remove this dependency: + +All the basic search functions will require an +additional argument which is a boolean and indicates +which side of a split tile is to be processed by the +callback. It is probably fine to treat the argument +like "dinfo", which is to make it a TileType and +set TT_DIAGONAL, TT_SIDE, and TT_DIRECTION as +needed. For the basic use of callbacks, it will +generally suffice to set only TT_SIDE. + +----------- + +Both TT_SIDE and SplitSide() are used frequently. +Which is why I have not done this before. + +First, enumerate all callback functions which use each +of the above, and the search routine that will require +the extra argument. + +Search functions or functions needing changes: +(Followed by the number of occurrences) + DBSrPaintArea() 401 + DBTreeSrTiles() 99 + DBSrPaintNMArea() 16 + DBSrPaintClient() 15 + SimTreeSrTiles() + + SelEnumPaint() + GrClipTriangle() + GrDrawTriangleEdge() + GrDiagonal() + DBTransformDiagonal() + GrBox() + +SplitSide(): + + calmaMergePaintFunc() --- Comment, unused, remove. + calmaWritePaintFunc() + calmaMergePaintFuncZ() --- Comment, unused, remove. + calmaWritePaintFuncZ() + cifHierCopyFunc() + cifHierErrorFunc() + cmdDropPaintCell() + +To be fixed: STACKPUSH/STACKPOP stuff in resis/ResUtils.c + resAddField will need to do something similar to + extract to handle two clientData records for split tiles + in ResAddPlumbing and ResRemovePlumbing. + + dbcUnconnectFunc() --- Need to handle side, or is this already handled? + + extConnFindFunc() --- Select proper region depending on side + extInterSubtreeTile() --- Should handle non-Manhattan tiles. + lefConnectFunc() --- write polygons to LEF? + resExpandDevFunc() --- Probably needs to handle split types and replace STACKPUSH. + (Lots to do in ResUtils.c) + touchingTypesFunc() --- Should distinguish types between sides, and handle + triangle geometry. + + cifInteractingRegions() --- Uses the cifSquares code, but cifSquares does not + handle non-Manhattan geometry, and interacting/overlapping + methods must. + + antennaAccumFunc() --- Needs to handle non-Manhattan geometry. + + extTransPerimFunc() --- Needs to set TT_SIDE based on boundary direction + before calling DBSrConnectOnePlane (ExtBasic.c:3882) + ResMultiPlaneFunc() --- Needs to call ResNewSDDevice() with dinfo information + +Any routine that does not use "dinfo" should do "if (dinfo & TT_SIDE) return 0". + +Ought to create a single function for simply returning "1" and replace all the +assorted functions that do that individually. + +--------------------- +First pass is done, minus issues reported above that need to be worked on. The +basic issue of adding an extra argument to all the callback functions is basically +completed. + +Moving on to compiling. . . +CIFgen.c has lots of warnings around PUSHTILE(). Probably an incorrect cast, but +I need to check all of the uses of PUSH and POP everywhere, anyway. + +1/2/2026: +Compiles now! +Debug. . . +Errors in dbwind (missed a DBSrPaintArea() call) +Need to pass dinfo to GrBox() and GrBoxOutline() + +Issue: Paint square on top of diagonal edge, ends up with one part of the tile +not properly split at the edge; the tile goes to infinity and has a non-space +type. + +Reminder: Need to check for all instances of SplitSide(), as there should not +be any. There are still 38 references that need to be removed. + +Fix: extWalkTop (Bottom, Right, Left). . . type should not have been set by +the split side of tile "tp". Should be according to the side being searched +and the diagonal directions of "tile" and "tp". + +ResUtils: Cannot use STACKPUSH and STACKPOP + +A number of remaining uses of SplitSide() are in routines that were not fixed +for dinfo or are not directly called from modified search functions, so will +need to fix each one in turn. + +Add dinfo to extSubtreeTileToNode() and extSubtreeHardNode() +extNodeToTile needs to return dinfo. . . + +extGetRegion() will need to be handled but only when I'm done with this and +working on being able to attach two regions to a split tile. + diff --git a/calma/CalmaRdcl.c b/calma/CalmaRdcl.c index 42800e2e..0e4d4f0d 100644 --- a/calma/CalmaRdcl.c +++ b/calma/CalmaRdcl.c @@ -245,7 +245,9 @@ calmaExact(void) int pNum; Plane *newplane; Plane **parray; - int gdsCopyPaintFunc(Tile *tile, GDSCopyRec *gdsCopyRec); /* Forward reference */ + + /* Forward reference */ + int gdsCopyPaintFunc(Tile *tile, TileType dinfo, GDSCopyRec *gdsCopyRec); parray = (Plane **)mallocMagic(MAXCIFRLAYERS * sizeof(Plane *)); @@ -751,6 +753,7 @@ calmaParseElement( int calmaEnumFunc( Tile *tile, + TileType dinfo, int *plane) { return 1; @@ -789,12 +792,13 @@ calmaElementSref( Point refarray[3], refunscaled[3], p; CellUse *use; CellDef *def; - int gdsCopyPaintFunc(Tile *tile, GDSCopyRec *gdsCopyRec); /* Forward reference */ - int gdsHasUses(CellUse *use, ClientData clientdata); /* Forward reference */ - /* Added by NP */ char *useid = NULL, *arraystr = NULL; int propAttrType; + /* Forward reference */ + int gdsCopyPaintFunc(Tile *tile, TileType dinfo, GDSCopyRec *gdsCopyRec); + int gdsHasUses(CellUse *use, ClientData clientdata); + /* Skip CALMA_ELFLAGS, CALMA_PLEX */ calmaSkipSet(calmaElementIgnore); @@ -1289,27 +1293,28 @@ gdsHasUses( int gdsCopyPaintFunc( Tile *tile, + TileType dinfo, GDSCopyRec *gdsCopyRec) { int pNum; - TileType dinfo; + TileType newdinfo; Rect sourceRect, targetRect; Transform *trans = gdsCopyRec->trans; Plane *plane = gdsCopyRec->plane; - dinfo = TiGetTypeExact(tile); + newdinfo = TiGetTypeExact(tile) | dinfo; if (trans) { TiToRect(tile, &sourceRect); GeoTransRect(trans, &sourceRect, &targetRect); if (IsSplit(tile)) - dinfo = DBTransformDiagonal(TiGetTypeExact(tile), trans); + newdinfo = DBTransformDiagonal(TiGetTypeExact(tile), trans); } else TiToRect(tile, &targetRect); - DBNMPaintPlane(plane, dinfo, &targetRect, CIFPaintTable, + DBNMPaintPlane(plane, newdinfo, &targetRect, CIFPaintTable, (PaintUndoInfo *)NULL); return 0; diff --git a/calma/CalmaWrite.c b/calma/CalmaWrite.c index b5446193..26136ff1 100644 --- a/calma/CalmaWrite.c +++ b/calma/CalmaWrite.c @@ -97,10 +97,10 @@ typedef struct { /* Forward declarations */ extern int calmaWriteInitFunc(CellDef *def); -extern int calmaWritePaintFunc(Tile *tile, calmaOutputStruct *cos); -extern int calmaMergePaintFunc(Tile *tile, calmaOutputStruct *cos); +extern int calmaWritePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos); +extern int calmaMergePaintFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos); extern int calmaWriteUseFunc(CellUse *use, FILE *f); -extern int calmaPaintLabelFunc(Tile *tile, calmaOutputStruct *cos); +extern int calmaPaintLabelFunc(Tile *tile, TileType dinfo, calmaOutputStruct *cos); extern void calmaWriteContacts(FILE *f); extern void calmaDelContacts(void); extern void calmaOutFunc(CellDef *def, FILE *f, const Rect *cliprect); @@ -2464,6 +2464,7 @@ calmaProcessBoundary( int calmaMergePaintFunc( Tile *tile, /* Tile to be written out. */ + TileType dinfo, /* Split tile information (unused) */ calmaOutputStruct *cos) /* Information needed by algorithm */ { FILE *f = cos->f; @@ -2494,11 +2495,10 @@ calmaMergePaintFunc( split_type = -1; if (IsSplit(t)) { - /* If we use SplitSide, then we need to set it when the */ + /* If we use TT_SIDE, then we need to set it when the */ /* tile is pushed. Since these are one-or-zero mask layers */ /* I assume it is okay to just check which side is TT_SPACE */ - /* split_type = (SplitSide(t) << 1) | SplitDirection(t); */ split_type = SplitDirection(t); if (TiGetLeftType(t) == TT_SPACE) split_type |= 2; num_points = 2; @@ -2721,7 +2721,9 @@ right_search: done_searches: if (intedges == 0) { - calmaWritePaintFunc(t, cos); + calmaWritePaintFunc(t, + (split_type & 2) ? (TileType)TT_SIDE : (TileType)0, + cos); /* Although calmaWritePaintFunc is called only on isolated */ /* tiles, we may have expanded it. This could use a LOT of */ @@ -2791,6 +2793,7 @@ done_searches: int calmaWritePaintFunc( Tile *tile, /* Tile to be written out. */ + TileType dinfo, /* Split tile information */ calmaOutputStruct *cos) /* File for output and clipping area */ { FILE *f = cos->f; @@ -2826,7 +2829,7 @@ calmaWritePaintFunc( /* Coordinates */ calmaOutRH(36, CALMA_XY, CALMA_I4, f); - switch ((SplitSide(tile) << 1) | SplitDirection(tile)) + switch (((dinfo & TT_SIDE) ? 2 : 0) | SplitDirection(tile)) { case 0x0: calmaOutI4(r.r_xbot, f); calmaOutI4(r.r_ybot, f); @@ -3067,6 +3070,7 @@ calmaWriteLabelFunc( int calmaPaintLabelFunc( Tile *tile, /* Tile contains area for label. */ + TileType dinfo, /* Split tile information (unused) */ calmaOutputStruct *cos) /* File for output and clipping area */ { FILE *f = cos->f; diff --git a/calma/CalmaWriteZ.c b/calma/CalmaWriteZ.c index 554fe761..bb6ccf2e 100644 --- a/calma/CalmaWriteZ.c +++ b/calma/CalmaWriteZ.c @@ -107,10 +107,10 @@ typedef struct { } calmaOutputStructZ; /* Forward declarations */ -extern int calmaWritePaintFuncZ(Tile *tile, calmaOutputStructZ *cos); -extern int calmaMergePaintFuncZ(Tile *tile, calmaOutputStructZ *cos); +extern int calmaWritePaintFuncZ(Tile *tile, TileType dinfo, calmaOutputStructZ *cos); +extern int calmaMergePaintFuncZ(Tile *tile, TileType dinfo, calmaOutputStructZ *cos); extern int calmaWriteUseFuncZ(CellUse *use, gzFile f); -extern int calmaPaintLabelFuncZ(Tile *tile, calmaOutputStructZ *cos); +extern int calmaPaintLabelFuncZ(Tile *tile, TileType dinfo, calmaOutputStructZ *cos); extern void calmaWriteContactsZ(gzFile f); extern void calmaOutFuncZ(CellDef *def, gzFile f, const Rect *cliprect); extern void calmaOutStructNameZ(int type, CellDef *def, gzFile f); @@ -1899,6 +1899,7 @@ calmaProcessBoundaryZ( int calmaMergePaintFuncZ( Tile *tile, /* Tile to be written out. */ + TileType dinfo, /* Split tile information (unused) */ calmaOutputStructZ *cos) /* Information needed by algorithm */ { gzFile f = cos->f; @@ -1929,11 +1930,10 @@ calmaMergePaintFuncZ( split_type = -1; if (IsSplit(t)) { - /* If we use SplitSide, then we need to set it when the */ + /* If we use TT_SIDE, then we need to set it when the */ /* tile is pushed. Since these are one-or-zero mask layers */ /* I assume it is okay to just check which side is TT_SPACE */ - /* split_type = (SplitSide(t) << 1) | SplitDirection(t); */ split_type = SplitDirection(t); if (TiGetLeftType(t) == TT_SPACE) split_type |= 2; num_points = 2; @@ -2156,7 +2156,9 @@ right_search: done_searches: if (intedges == 0) { - calmaWritePaintFuncZ(t, cos); + calmaWritePaintFuncZ(t, + (split_type & 2) ? (TileType)TT_SIDE : (TileType)0, + cos); /* Although calmaWritePaintFunc is called only on isolated */ /* tiles, we may have expanded it. This could use a LOT of */ @@ -2226,6 +2228,7 @@ done_searches: int calmaWritePaintFuncZ( Tile *tile, /* Tile to be written out. */ + TileType dinfo, /* Split tile information */ calmaOutputStructZ *cos) /* File for output and clipping area */ { gzFile f = cos->f; @@ -2261,7 +2264,7 @@ calmaWritePaintFuncZ( /* Coordinates */ calmaOutRHZ(36, CALMA_XY, CALMA_I4, f); - switch ((SplitSide(tile) << 1) | SplitDirection(tile)) + switch (((dinfo & TT_SIDE) ? 2 : 0) | SplitDirection(tile)) { case 0x0: calmaOutI4Z(r.r_xbot, f); calmaOutI4Z(r.r_ybot, f); @@ -2502,6 +2505,7 @@ calmaWriteLabelFuncZ( int calmaPaintLabelFuncZ( Tile *tile, /* Tile contains area for label. */ + TileType dinfo, /* Split tile information (unused) */ calmaOutputStructZ *cos) /* File for output and clipping area */ { gzFile f = cos->f; diff --git a/cif/CIFgen.c b/cif/CIFgen.c index 0d74098f..95a923c0 100644 --- a/cif/CIFgen.c +++ b/cif/CIFgen.c @@ -103,7 +103,8 @@ extern void cifGenClip(const Rect *area, Rect *expanded, Rect *clip); int cifPaintFunc( Tile *tile, - PaintResultType *table) /* Used for painting. */ + TileType dinfo, /* Split tile information */ + PaintResultType *table) /* Used for painting. */ { Rect area; @@ -113,7 +114,7 @@ cifPaintFunc( area.r_ybot *= cifScale; area.r_ytop *= cifScale; - DBNMPaintPlane(cifPlane, TiGetTypeExact(tile), &area, table, + DBNMPaintPlane(cifPlane, TiGetTypeExact(tile) | dinfo, &area, table, (PaintUndoInfo *) NULL); CIFTileOps += 1; return 0; @@ -137,8 +138,9 @@ cifPaintFunc( int cifInteractFunc( - Tile *tile, - ClientData clientdata) /* Unused */ + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { return 1; } @@ -323,6 +325,7 @@ SetMinBoxGrid( int cifGrowMinFunc( Tile *tile, + TileType dinfo, PaintResultType *table) /* Table to be used for painting. */ { Rect area, parea; @@ -498,6 +501,7 @@ cifGrowMinFunc( int cifGrowGridFunc( Tile *tile, + TileType dinfo, PaintResultType *table) /* Table to be used for painting. */ { Rect area; @@ -574,11 +578,12 @@ cifGrowGridFunc( int cifGrowEuclideanFunc( Tile *tile, + TileType dinfo, const PaintResultType *table) /* Table to be used for painting. */ { Tile *tp; Rect area, rtmp; - TileType oldType = TiGetTypeExact(tile); + TileType oldType = TiGetTypeExact(tile) | dinfo; unsigned char growDirs = GROW_NORTH | GROW_SOUTH | GROW_EAST | GROW_WEST; unsigned char cornerDirs = 0; @@ -787,10 +792,11 @@ cifGrowEuclideanFunc( int cifGrowFunc( Tile *tile, + TileType dinfo, const PaintResultType *table) /* Table to be used for painting. */ { Rect area; - TileType oldType = TiGetTypeExact(tile); + TileType oldType = TiGetTypeExact(tile) | dinfo; TiToRect(tile, &area); @@ -916,6 +922,7 @@ cifGrowFunc( int cifBloatFunc( Tile *tile, + TileType dinfo, ClientData clientData) { Rect tileArea, cifArea, bloat; @@ -925,7 +932,7 @@ cifBloatFunc( BloatData *bloats = (BloatData *)clientData; int *bloatTable = (int *)bloats->bl_distance; - oldType = TiGetTypeExact(tile); + oldType = TiGetTypeExact(tile) | dinfo; TiToRect(tile, &tileArea); /* Output the original area of the tile. */ @@ -951,7 +958,7 @@ cifBloatFunc( if (CIFCurStyle->cs_flags & CWF_GROW_EUCLIDEAN) { growDistance = dist; - cifGrowEuclideanFunc(tile, CIFPaintTable); + cifGrowEuclideanFunc(tile, dinfo, CIFPaintTable); } else { @@ -1222,10 +1229,35 @@ endbloat: #define CIF_PROCESSED 1 #define CIF_IGNORE 2 -#define PUSHTILE(tp, stack) \ +/* Conditional push (if tile is unprocessed) */ +#define PUSHTILE(tp, dinfo, stack) \ if (TiGetClient(tp) == CIF_UNPROCESSED) { \ TiSetClientINT(tp, CIF_PENDING); \ - STACKPUSH((ClientData) (tp), stack); \ + STACKPUSH((ClientData)(tp), stack); \ + STACKPUSH((ClientData)(dinfo), stack); \ + } + +/* Unconditional push */ +#define PUSHTILEALWAYS(tp, dinfo, stack) { \ + STACKPUSH((ClientData)(tp), stack); \ + STACKPUSH((ClientData)(dinfo), stack); \ + } + +#define POPTILE(tp, dinfo, stack) { \ + dinfo = (TileType)STACKPOP(stack); \ + tp = (Tile *)STACKPOP(stack); \ + } + +/* For routines that don't require split tile information */ + +#define PUSHTILEONLY(tp, stack) \ + if (TiGetClient(tp) == CIF_UNPROCESSED) { \ + TiSetClientINT(tp, CIF_PENDING); \ + STACKPUSH((ClientData)(tp), stack); \ + } + +#define POPTILEONLY(tp, stack) { \ + tp = (Tile *)STACKPOP(stack); \ } /* @@ -1243,7 +1275,8 @@ endbloat: int cifProcessResetFunc( Tile *tile, - ClientData clientData) /* unused */ + TileType dinfo, /* (unused) */ + ClientData clientData) /* (unused) */ { TiSetClient(tile, CIF_UNPROCESSED); return 0; @@ -1263,8 +1296,9 @@ cifProcessResetFunc( */ int -cifProcessSelectiveResetFunc(tile, clipArea) +cifProcessSelectiveResetFunc(tile, dinfo, clipArea) Tile *tile; + TileType dinfo; /* (unused) */ Rect *clipArea; { Rect area; @@ -1297,11 +1331,12 @@ cifProcessSelectiveResetFunc(tile, clipArea) int cifFoundFunc( Tile *tile, + TileType dinfo, Stack **BloatStackPtr) { if (TiGetClient(tile) == CIF_UNPROCESSED) { - PUSHTILE(tile, *BloatStackPtr); + PUSHTILE(tile, dinfo, *BloatStackPtr); return 1; } else @@ -1338,6 +1373,7 @@ typedef struct _bloatStruct { int cifBloatAllFunc( Tile *tile, /* The tile to be processed. */ + TileType dinfo, /* Split tile information */ BloatStruct *bls) { Rect area, clipArea; @@ -1371,8 +1407,9 @@ cifBloatAllFunc( /* processed that belongs to the connect mask, and use that as the */ /* starting tile. */ - t = tile; - type = TiGetType(tile); + type = TiGetType(tile); /* NOTE: This does not correctly handls + * split tiles. + */ if (type == CIF_SOLIDTYPE) { @@ -1445,8 +1482,8 @@ cifBloatAllFunc( } else { - PUSHTILE(t, BloatStack); - firstTile = t; + PUSHTILE(tile, dinfo, BloatStack); + firstTile = tile; } /* Note: if op->co_distance is 0 then bloat distance is arbitrarily large */ @@ -1465,7 +1502,9 @@ cifBloatAllFunc( while (!StackEmpty(BloatStack)) { - t = (Tile *) STACKPOP(BloatStack); + TileType tt; + + POPTILE(t, dinfo, BloatStack); if (TiGetClientINT(t) != CIF_PENDING) continue; TiSetClientINT(t, CIF_PROCESSED); @@ -1492,6 +1531,7 @@ cifBloatAllFunc( * is difficult to find an optimal method. */ STACKPUSH(t, ResetStack); + STACKPUSH(dinfo, ResetStack); GeoClip(&cifarea, &clipArea); if (GEO_RECTNULL(&cifarea)) continue; @@ -1504,18 +1544,18 @@ cifBloatAllFunc( if (IsSplit(t)) { - TileType tt; - tt = TiGetTypeExact(t); + tt = TiGetTypeExact(t) | dinfo; if ((tt & TT_SIDE) && (TTMaskHasType(connect, TiGetLeftType(t)))) DBPaintPlane(cifPlane, &area, CIFPaintTable, (PaintUndoInfo *) NULL); else if (!(tt & TT_SIDE) && (TTMaskHasType(connect, TiGetRightType(t)))) DBPaintPlane(cifPlane, &area, CIFPaintTable, (PaintUndoInfo *) NULL); else - DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, + DBNMPaintPlane(cifPlane, TiGetTypeExact(t) | dinfo, &area, CIFPaintTable, (PaintUndoInfo *) NULL); } else { + tt = TiGetTypeExact(t); if (op->co_distance > 0) GeoClip(&area, &clipArea); DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area, @@ -1525,22 +1565,28 @@ cifBloatAllFunc( /* Top */ for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp)) if (TTMaskHasType(connect, TiGetBottomType(tp))) - PUSHTILE(tp, BloatStack); + PUSHTILE(tp, + (SplitDirection(tp) == ((tt & TT_DIRECTION) ? 1 : 0)) ? + (TileType)0 : (TileType)TT_SIDE, + BloatStack); /* Left */ for (tp = BL(t); BOTTOM(tp) < TOP(t); tp = RT(tp)) if (TTMaskHasType(connect, TiGetRightType(tp))) - PUSHTILE(tp, BloatStack); + PUSHTILE(tp, (TileType)TT_SIDE, BloatStack); /* Bottom */ for (tp = LB(t); LEFT(tp) < RIGHT(t); tp = TR(tp)) if (TTMaskHasType(connect, TiGetTopType(tp))) - PUSHTILE(tp, BloatStack); + PUSHTILE(tp, + (SplitDirection(tp) == ((tt & TT_DIRECTION) ? 1 : 0)) ? + (TileType)TT_SIDE : (TileType)0, + BloatStack); /* Right */ for (tp = TR(t); TOP(tp) > BOTTOM(t); tp = LB(tp)) if (TTMaskHasType(connect, TiGetLeftType(tp))) - PUSHTILE(tp, BloatStack); + PUSHTILE(tp, (TileType)0, BloatStack); } /* Clear self */ @@ -1557,7 +1603,7 @@ cifBloatAllFunc( while (!StackEmpty(ResetStack)) { - t = (Tile *)STACKPOP(ResetStack); + POPTILE(t, dinfo, ResetStack); TiSetClient(t, CIF_UNPROCESSED); } @@ -1792,6 +1838,7 @@ GetExpandedAreaGrid( int cifBridgeFunc1( Tile *tile, + TileType dinfo, BridgeStruct *brs) { Plane *plane = brs->plane; @@ -1800,7 +1847,9 @@ cifBridgeFunc1( int width = brs->bridge->br_width; int spacing = growDistance; BridgeCheckStruct brcs; - int cifBridgeCheckFunc(Tile *tile, BridgeCheckStruct *brcs); /* Forward reference */ + + /* Forward reference */ + int cifBridgeCheckFunc(Tile *tile, TileType dinfo, BridgeCheckStruct *brcs); /* If tile is marked, then it has been handled, so ignore it */ if (TiGetClient(tile) != CIF_UNPROCESSED) return 0; @@ -1914,6 +1963,7 @@ cifBridgeFunc1( int cifBridgeFunc2( Tile *tile, + TileType dinfo, BridgeStruct *brs) { Plane *plane = brs->plane; @@ -1923,7 +1973,9 @@ cifBridgeFunc2( int wtest; int spacing = growDistance; BridgeCheckStruct brcs; - int cifBridgeCheckFunc(Tile *tile, BridgeCheckStruct *brcs); /* Forward reference */ + + /* Forward reference */ + int cifBridgeCheckFunc(Tile *tile, TileType dinfo, BridgeCheckStruct *brcs); /* If tile is marked, then it has been handled, so ignore it */ if (TiGetClient(tile) != CIF_UNPROCESSED) return 0; @@ -2014,6 +2066,7 @@ cifBridgeFunc2( int cifBridgeCheckFunc( Tile *tile, + TileType dinfo, BridgeCheckStruct *brcs) { int dir = brcs->direction; @@ -2087,10 +2140,11 @@ cifBridgeCheckFunc( int cifOrthogonalFunc( Tile *tile, + TileType dinfo, const PaintResultType *table) /* Table to be used for painting. */ { Rect area; - TileType oldType = TiGetTypeExact(tile); + TileType oldType = TiGetTypeExact(tile) | dinfo; TiToRect(tile, &area); @@ -2137,11 +2191,12 @@ cifOrthogonalFunc( int cifCloseFunc( Tile *tile, + TileType dinfo, Plane *plane) { Rect area, newarea; int atotal; - int cifGatherFunc(Tile *tile, int *atotal, int mode); + int cifGatherFunc(Tile *tile, TileType dinfo, int *atotal, int mode); /* If tile is marked, then it has been handled, so ignore it */ if (TiGetClient(tile) != CIF_UNPROCESSED) return 0; @@ -2152,7 +2207,7 @@ cifCloseFunc( /* total area. If any connected tile borders infinity, then stop */ /* searching because the area is not enclosed. */ - cifGatherFunc(tile, &atotal, CLOSE_SEARCH); + cifGatherFunc(tile, dinfo, &atotal, CLOSE_SEARCH); /* If the total area is smaller than the rule area, then paint all */ /* the tile areas into the destination plane. A rule area of zero */ @@ -2161,11 +2216,11 @@ cifCloseFunc( if ((atotal != INFINITY) && ((atotal < growDistance) || (growDistance == 0))) { - cifGatherFunc(tile, &atotal, CLOSE_FILL); + cifGatherFunc(tile, dinfo, &atotal, CLOSE_FILL); } else { - cifGatherFunc(tile, &atotal, CLOSE_DONE); + cifGatherFunc(tile, dinfo, &atotal, CLOSE_DONE); } return 0; } @@ -2173,6 +2228,7 @@ cifCloseFunc( int cifGatherFunc( Tile *tile, + TileType dinfo, int *atotal, int mode) { @@ -2188,10 +2244,13 @@ cifGatherFunc( if (GatherStack == (Stack *)NULL) GatherStack = StackNew(64); - STACKPUSH(tile, GatherStack); + PUSHTILE(tile, dinfo, GatherStack); while (!StackEmpty(GatherStack)) { - tile = (Tile *)STACKPOP(GatherStack); + TileType newdinfo; + + POPTILE(tile, dinfo, GatherStack); + newdinfo = TiGetTypeExact(tile) | dinfo; /* Ignore if tile has already been processed */ if (TiGetClient(tile) != cdata) continue; @@ -2226,8 +2285,6 @@ cifGatherFunc( } else if (mode == CLOSE_FILL) { - TileType dinfo = TiGetTypeExact(tile); - /* The tile type cannot be depended on to have the TT_SIDE bit set */ /* for the side of the tile that is TT_SPACE. So set the side bit */ /* manually. */ @@ -2235,12 +2292,13 @@ cifGatherFunc( if (IsSplit(tile)) { if (TiGetLeftType(tile) == TT_SPACE) - dinfo &= ~TT_SIDE; + newdinfo &= ~TT_SIDE; else - dinfo |= TT_SIDE; + newdinfo |= TT_SIDE; } - DBNMPaintPlane(cifPlane, dinfo, &area, CIFPaintTable, (PaintUndoInfo *)NULL); + DBNMPaintPlane(cifPlane, newdinfo, &area, CIFPaintTable, + (PaintUndoInfo *)NULL); CIFTileOps++; } @@ -2255,7 +2313,10 @@ cifGatherFunc( for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp)) if (TiGetClient(tp) == cdata && TiGetBottomType(tp) == TT_SPACE) { - STACKPUSH(tp, GatherStack); + PUSHTILEALWAYS(tp, + ((newdinfo & TT_DIRECTION) != (TiGetTypeExact(tp) & TT_DIRECTION)) ? + (TileType)TT_SIDE : (TileType)0, + GatherStack); } /* Check bottom */ @@ -2263,7 +2324,10 @@ cifGatherFunc( for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp)) if (TiGetClient(tp) == cdata && TiGetTopType(tp) == TT_SPACE) { - STACKPUSH(tp, GatherStack); + PUSHTILEALWAYS(tp, + ((newdinfo & TT_DIRECTION) == (TiGetTypeExact(tp) & TT_DIRECTION)) ? + (TileType)TT_SIDE : (TileType)0, + GatherStack); } /* Check left */ @@ -2271,7 +2335,7 @@ cifGatherFunc( for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp)) if (TiGetClient(tp) == cdata && TiGetRightType(tp) == TT_SPACE) { - STACKPUSH(tp, GatherStack); + PUSHTILEALWAYS(tp, (TileType)TT_SIDE, GatherStack); } /* Check right */ @@ -2279,7 +2343,7 @@ cifGatherFunc( for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp)) if (TiGetClient(tp) == cdata && TiGetLeftType(tp) == TT_SPACE) { - STACKPUSH(tp, GatherStack); + PUSHTILEALWAYS(tp, (TileType)0, GatherStack); } } return 0; @@ -2323,9 +2387,10 @@ typedef struct */ int -cifSquaresInitFunc(tile, clientData) +cifSquaresInitFunc(tile, dinfo, clientData) Tile *tile; - ClientData clientData; + TileType dinfo; /* (unused) */ + ClientData clientData; /* (unused) */ { if (TiGetClient(tile) == CIF_UNPROCESSED) return 1; @@ -2350,6 +2415,7 @@ cifSquaresInitFunc(tile, clientData) int cifSquaresStripFunc( Tile *tile, + TileType dinfo, /* (unused) */ StripsData *stripsData) { bool vertical; @@ -2477,7 +2543,8 @@ cifSquaresStripFunc( int cifUnconnectFunc( Tile *tile, - ClientData clientData) /* unused */ + TileType dinfo, /* (unused) */ + ClientData clientData) /* (unused) */ { TileType t = TiGetTypeExact(tile); if (t == TT_SPACE) return 1; @@ -2531,10 +2598,10 @@ cifRectBoundingBox( tile = PlaneGetHint(plane); TiToRect(tile, &bbox); - PUSHTILE(tile, BoxStack); + PUSHTILEONLY(tile, BoxStack); while (!StackEmpty(BoxStack)) { - t = (Tile *) STACKPOP(BoxStack); + POPTILEONLY(t, BoxStack); if (TiGetClientINT(t) != CIF_PENDING) continue; TiSetClientINT(t, CIF_PROCESSED); @@ -2549,7 +2616,7 @@ cifRectBoundingBox( if (TTMaskHasType(&CIFSolidBits, TiGetBottomType(tp))) { simple = FALSE; - PUSHTILE(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } /* Left */ @@ -2557,7 +2624,7 @@ cifRectBoundingBox( if (TTMaskHasType(&CIFSolidBits, TiGetRightType(tp))) { simple = FALSE; - PUSHTILE(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } /* Bottom */ @@ -2565,7 +2632,7 @@ cifRectBoundingBox( if (TTMaskHasType(&CIFSolidBits, TiGetTopType(tp))) { simple = FALSE; - PUSHTILE(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } /* Right */ @@ -2573,7 +2640,7 @@ cifRectBoundingBox( if (TTMaskHasType(&CIFSolidBits, TiGetLeftType(tp))) { simple = FALSE; - PUSHTILE(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } } @@ -2600,17 +2667,17 @@ cifRectBoundingBox( /* Clear the tiles that were processed in this set */ TiSetClientINT(tile, CIF_IGNORE); - STACKPUSH(tile, BoxStack); + PUSHTILEONLY(tile, BoxStack); while (!StackEmpty(BoxStack)) { - t = (Tile *) STACKPOP(BoxStack); + POPTILEONLY(t, BoxStack); /* Top */ for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp)) if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } /* Left */ @@ -2618,7 +2685,7 @@ cifRectBoundingBox( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } /* Bottom */ @@ -2626,7 +2693,7 @@ cifRectBoundingBox( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } /* Right */ @@ -2634,7 +2701,7 @@ cifRectBoundingBox( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, BoxStack); + PUSHTILEONLY(tp, BoxStack); } } } @@ -2802,10 +2869,10 @@ cifSquaresFillArea( tile = PlaneGetHint(plane); TiToRect(tile, &bbox); - PUSHTILE(tile, CutStack); + PUSHTILEONLY(tile, CutStack); while (!StackEmpty(CutStack)) { - t = (Tile *) STACKPOP(CutStack); + POPTILEONLY(t, CutStack); if (TiGetClientINT(t) != CIF_PENDING) continue; TiSetClientINT(t, CIF_PROCESSED); @@ -2820,7 +2887,7 @@ cifSquaresFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetBottomType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Left */ @@ -2828,7 +2895,7 @@ cifSquaresFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetRightType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Bottom */ @@ -2836,7 +2903,7 @@ cifSquaresFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetTopType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Right */ @@ -2844,7 +2911,7 @@ cifSquaresFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetLeftType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } } @@ -2933,17 +3000,17 @@ cifSquaresFillArea( /* Clear the tiles that were processed */ TiSetClientINT(tile, CIF_IGNORE); - STACKPUSH(tile, CutStack); + PUSHTILEONLY(tile, CutStack); while (!StackEmpty(CutStack)) { - t = (Tile *) STACKPOP(CutStack); + POPTILEONLY(t, CutStack); /* Top */ for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp)) if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Left */ @@ -2951,7 +3018,7 @@ cifSquaresFillArea( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Bottom */ @@ -2959,7 +3026,7 @@ cifSquaresFillArea( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Right */ @@ -2967,7 +3034,7 @@ cifSquaresFillArea( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } } } @@ -3146,10 +3213,10 @@ cifSlotsFillArea( tile = PlaneGetHint(plane); TiToRect(tile, &bbox); - PUSHTILE(tile, CutStack); + PUSHTILEONLY(tile, CutStack); while (!StackEmpty(CutStack)) { - t = (Tile *) STACKPOP(CutStack); + POPTILEONLY(t, CutStack); if (TiGetClientINT(t) != CIF_PENDING) continue; TiSetClientINT(t, CIF_PROCESSED); @@ -3164,7 +3231,7 @@ cifSlotsFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetBottomType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Left */ @@ -3172,7 +3239,7 @@ cifSlotsFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetRightType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Bottom */ @@ -3180,7 +3247,7 @@ cifSlotsFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetTopType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Right */ @@ -3188,7 +3255,7 @@ cifSlotsFillArea( if (TTMaskHasType(&CIFSolidBits, TiGetLeftType(tp))) { simple = FALSE; - PUSHTILE(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } } @@ -3298,17 +3365,17 @@ cifSlotsFillArea( /* Clear the tiles that were processed */ TiSetClientINT(tile, CIF_IGNORE); - STACKPUSH(tile, CutStack); + PUSHTILEONLY(tile, CutStack); while (!StackEmpty(CutStack)) { - t = (Tile *) STACKPOP(CutStack); + POPTILEONLY(t, CutStack); /* Top */ for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp)) if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Left */ @@ -3316,7 +3383,7 @@ cifSlotsFillArea( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Bottom */ @@ -3324,7 +3391,7 @@ cifSlotsFillArea( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } /* Right */ @@ -3332,7 +3399,7 @@ cifSlotsFillArea( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, CutStack); + PUSHTILEONLY(tp, CutStack); } } } @@ -3368,6 +3435,7 @@ cifSlotsFillArea( int cifBloatMaxFunc( Tile *tile, /* The tile to be processed. */ + TileType dinfo, /* Split tile information */ CIFOp *op) /* Describes the operation to be performed * (all we care about is the opcode and * bloat table). @@ -3474,7 +3542,7 @@ cifBloatMaxFunc( CIFError(&area, "tile inverted by shrink"); } else - DBNMPaintPlane(cifPlane, TiGetTypeExact(tile), &area, + DBNMPaintPlane(cifPlane, TiGetTypeExact(tile) | dinfo, &area, CIFPaintTable, (PaintUndoInfo *) NULL); CIFTileOps += 1; @@ -3560,6 +3628,7 @@ inside_triangle( int cifContactFunc( Tile *tile, /* Tile to be diced up. */ + TileType dinfo, /* Split tile information (unused) */ CIFSquaresInfo *csi) /* Describes how to generate squares. */ { Rect area; @@ -4146,6 +4215,7 @@ typedef struct _bridgeLimCheckStruct { int bridgeLimFound( Tile *tile, + TileType dinfo, /* (unused) */ bool calcOverlap) { if (calcOverlap) @@ -4229,6 +4299,7 @@ bridgeLimSrTiles( int cifBridgeLimFunc0( Tile *tile, + TileType dinfo, /* (unused) */ BridgeLimStruct *brlims) { Plane *plane = brlims->plane; @@ -4305,6 +4376,7 @@ cifBridgeLimFunc0( int bridgeLimCheckFunc( Tile *tile, + TileType dinfo, /* (unused) */ BridgeLimCheckStruct *brlimcs) { int dir = brlimcs->direction; @@ -4423,6 +4495,7 @@ bridgeErase( int cifBridgeLimFunc1( Tile *tile, + TileType dinfo, /* (unused) */ BridgeLimStruct *brlims) { Plane *plane = brlims->plane; @@ -4585,6 +4658,7 @@ cifBridgeLimFunc1( int cifBridgeLimFunc2( Tile *tile, + TileType dinfo, /* (unused) */ BridgeLimStruct *brlims) { Plane *plane = brlims->plane; @@ -4739,12 +4813,16 @@ cifInteractingRegions( /* to the destination plane or not depending on whether any */ /* part of the region overlapped the specified type(s). */ + /* NOTE: Currently reusing code from cifSquares, but cifSquares */ + /* does not handle non-Manhattan geometry, whereas overlap and */ + /* interaction detection must. */ + interacts = FALSE; tile = PlaneGetHint(plane); - PUSHTILE(tile, RegStack); + PUSHTILEONLY(tile, RegStack); while (!StackEmpty(RegStack)) { - t = (Tile *) STACKPOP(RegStack); + POPTILEONLY(t, RegStack); if (TiGetClientINT(t) != CIF_PENDING) continue; TiSetClientINT(t, CIF_PROCESSED); @@ -4777,28 +4855,28 @@ cifInteractingRegions( for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp)) if (TTMaskHasType(&CIFSolidBits, TiGetBottomType(tp))) { - PUSHTILE(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } /* Left */ for (tp = BL(t); BOTTOM(tp) < TOP(t); tp = RT(tp)) if (TTMaskHasType(&CIFSolidBits, TiGetRightType(tp))) { - PUSHTILE(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } /* Bottom */ for (tp = LB(t); LEFT(tp) < RIGHT(t); tp = TR(tp)) if (TTMaskHasType(&CIFSolidBits, TiGetTopType(tp))) { - PUSHTILE(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } /* Right */ for (tp = TR(t); TOP(tp) > BOTTOM(t); tp = LB(tp)) if (TTMaskHasType(&CIFSolidBits, TiGetLeftType(tp))) { - PUSHTILE(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } } @@ -4815,10 +4893,10 @@ cifInteractingRegions( /* op->co_paintMask (op->co_cifMask) */ TiSetClientINT(tile, CIF_IGNORE); - STACKPUSH(tile, RegStack); + PUSHTILEONLY(tile, RegStack); while (!StackEmpty(RegStack)) { - t = (Tile *) STACKPOP(RegStack); + POPTILEONLY(t, RegStack); if (interacts) { @@ -4831,7 +4909,7 @@ cifInteractingRegions( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } /* Left */ @@ -4839,7 +4917,7 @@ cifInteractingRegions( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } /* Bottom */ @@ -4847,7 +4925,7 @@ cifInteractingRegions( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } /* Right */ @@ -4855,7 +4933,7 @@ cifInteractingRegions( if (TiGetClientINT(tp) == CIF_PROCESSED) { TiSetClientINT(tp, CIF_IGNORE); - STACKPUSH(tp, RegStack); + PUSHTILEONLY(tp, RegStack); } } diff --git a/cif/CIFhier.c b/cif/CIFhier.c index a7376abb..6a75bc6c 100644 --- a/cif/CIFhier.c +++ b/cif/CIFhier.c @@ -433,15 +433,16 @@ cifHierCopyMaskHints( int cifHierCopyFunc( Tile *tile, /* Pointer to tile to copy. */ + TileType dinfo, /* Split tile information */ TreeContext *cxp) /* Describes context of search, including * transform and client data. */ { - TileType type = TiGetTypeExact(tile); + TileType type = TiGetTypeExact(tile) | dinfo; Rect sourceRect, targetRect; int pNum; CellDef *def = (CellDef *) cxp->tc_filter->tf_arg; - int dinfo = 0; + TileType newdinfo = 0; /* Ignore tiles in vendor GDS, unless this is specifically */ /* overridden by the "see-vendor" option. */ @@ -457,8 +458,8 @@ cifHierCopyFunc( if (IsSplit(tile)) { - dinfo = DBTransformDiagonal(type, &cxp->tc_scx->scx_trans); - type = (SplitSide(tile)) ? SplitRightType(tile) : + newdinfo = DBTransformDiagonal(type, &cxp->tc_scx->scx_trans); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); } @@ -473,7 +474,7 @@ cifHierCopyFunc( { if (DBPaintOnPlane(type, pNum)) { - DBNMPaintPlane(def->cd_planes[pNum], dinfo, &targetRect, + DBNMPaintPlane(def->cd_planes[pNum], newdinfo, &targetRect, DBStdPaintTbl(type, pNum), (PaintUndoInfo *) NULL); } } @@ -562,9 +563,11 @@ cifHierCellFunc( int cifHierErrorFunc( Tile *tile, /* Tile that covers area it shouldn't. */ + TileType dinfo, /* Split tile information */ Rect *checkArea) /* Intersection of this and tile is error. */ { Rect area; + bool side = (dinfo & TT_SIDE) ? TRUE : FALSE; TiToRect(tile, &area); @@ -572,8 +575,8 @@ cifHierErrorFunc( * space bounds the checkArea. */ if (IsSplit(tile)) - if (((area.r_xbot == checkArea->r_xbot) && !SplitSide(tile)) || - ((area.r_xtop == checkArea->r_xtop) && SplitSide(tile))) + if (((area.r_xbot == checkArea->r_xbot) && !side) || + ((area.r_xtop == checkArea->r_xtop) && side)) return 0; GeoClip(&area, checkArea); @@ -604,6 +607,7 @@ cifHierErrorFunc( int cifHierCheckFunc( Tile *tile, /* Tile containing CIF. */ + TileType dinfo, /* Split tile information */ Plane *plane) /* Plane to check against and modify. */ { Rect area; @@ -612,7 +616,7 @@ cifHierCheckFunc( if (IsSplit(tile)) { - DBSrPaintNMArea((Tile *)NULL, plane, TiGetTypeExact(tile), + DBSrPaintNMArea((Tile *)NULL, plane, TiGetTypeExact(tile) | dinfo, &area, &DBSpaceBits, cifHierErrorFunc, (ClientData) &area); DBNMPaintPlane(plane, TiGetTypeExact(tile), &area, CIFEraseTable, @@ -651,6 +655,7 @@ cifHierCheckFunc( int cifHierTempCheckFunc( Tile *tile, /* Tile containing CIF. */ + TileType dinfo, /* Information about split tiles */ Plane *plane) /* Plane to check against and modify. */ { Rect area; @@ -658,7 +663,7 @@ cifHierTempCheckFunc( TiToRect(tile, &area); if (IsSplit(tile)) - DBNMPaintPlane(plane, TiGetTypeExact(tile), &area, CIFEraseTable, + DBNMPaintPlane(plane, TiGetTypeExact(tile) | dinfo, &area, CIFEraseTable, (PaintUndoInfo *) NULL); else DBPaintPlane(plane, &area, CIFEraseTable, (PaintUndoInfo *) NULL); @@ -686,6 +691,7 @@ cifHierTempCheckFunc( int cifHierPaintFunc( Tile *tile, + TileType dinfo, /* Information about split tiles */ Plane *plane) /* Plane in which to paint CIF over tile's * area. */ @@ -695,7 +701,7 @@ cifHierPaintFunc( TiToRect(tile, &area); if (CIFCurStyle->cs_flags & CWF_GROW_SLIVERS) cifGrowSliver(tile, &area); if (IsSplit(tile)) - DBNMPaintPlane(plane, TiGetTypeExact(tile), &area, CIFPaintTable, + DBNMPaintPlane(plane, TiGetTypeExact(tile) | dinfo, &area, CIFPaintTable, (PaintUndoInfo *) NULL); else DBPaintPlane(plane, &area, CIFPaintTable, (PaintUndoInfo *) NULL); @@ -1127,7 +1133,9 @@ cifGrowSliver( int cifHierPaintArrayFunc( - Tile *tile) + Tile *tile, + TileType dinfo, + ClientData clientdata) /* (unused) */ { Rect area; int i, j, xbot, xtop; diff --git a/cif/CIFint.h b/cif/CIFint.h index 4f4f4a43..0803b7c9 100644 --- a/cif/CIFint.h +++ b/cif/CIFint.h @@ -335,7 +335,7 @@ extern void CIFClearPlanes(Plane **planes); extern Plane *CIFGenLayer(CIFOp *op, const Rect *area, CellDef *cellDef, CellDef *origDef, Plane *temps[], bool hier, ClientData clientdata); extern void CIFInitCells(void); -extern int cifHierCopyFunc(Tile *tile, TreeContext *cxp); +extern int cifHierCopyFunc(Tile *tile, TileType dinfo, TreeContext *cxp); extern int cifHierCopyMaskHints(SearchContext *scx, ClientData clientData); extern void CIFLoadStyle(char *stylename); extern void CIFCopyMaskHints(SearchContext *scx, CellDef *targetDef); diff --git a/cif/CIFrdcl.c b/cif/CIFrdcl.c index 867d5ba4..f0cf56f4 100644 --- a/cif/CIFrdcl.c +++ b/cif/CIFrdcl.c @@ -505,6 +505,7 @@ CIFParseStart(void) int cifCheckPaintFunc( Tile *tile, + TileType dinfo, ClientData clientData) { return 1; @@ -515,27 +516,28 @@ int cifCheckPaintFunc( int cifCopyPaintFunc( Tile *tile, + TileType dinfo, CIFCopyRec *cifCopyRec) { int pNum; - TileType dinfo; + TileType newdinfo; Rect sourceRect, targetRect; Transform *trans = cifCopyRec->trans; Plane *plane = cifCopyRec->plane; - dinfo = TiGetTypeExact(tile); + newdinfo = TiGetTypeExact(tile) | dinfo; if (trans) { TiToRect(tile, &sourceRect); GeoTransRect(trans, &sourceRect, &targetRect); if (IsSplit(tile)) - dinfo = DBTransformDiagonal(TiGetTypeExact(tile), trans); + newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, trans); } else TiToRect(tile, &targetRect); - DBNMPaintPlane(plane, dinfo, &targetRect, CIFPaintTable, + DBNMPaintPlane(plane, newdinfo, &targetRect, CIFPaintTable, (PaintUndoInfo *)NULL); return 0; @@ -561,6 +563,7 @@ cifCopyPaintFunc( int cifMaskHintFunc( Tile *tile, + TileType dinfo, /* Unused, do not support non-manhattan hints */ LinkedRect **lrecp) { Rect r; @@ -597,8 +600,9 @@ int CIFPaintCurrent( int filetype) { - extern int cifMakeBoundaryFunc(Tile *tile, ClientData clientdata); /* Forward declaration. */ - extern int cifPaintCurrentFunc(Tile *tile, TileType type); /* Forward declaration. */ + /* Forward declarations. */ + extern int cifMakeBoundaryFunc(Tile *tile, TileType dinfo, ClientData clientdata); + extern int cifPaintCurrentFunc(Tile *tile, TileType dinfo, TileType type); Plane *plane, *swapplane; int i; @@ -891,6 +895,7 @@ CIFPaintCurrent( int cifMakeBoundaryFunc( Tile *tile, /* Tile of CIF information. */ + TileType dinfo, /* Split tile information (unused) */ ClientData clientdata) /* Pass the file type (CIF or CALMA) */ { /* It is assumed that there is one rectangle for the boundary. */ @@ -970,6 +975,7 @@ cifMakeBoundaryFunc( int cifPaintCurrentFunc( Tile *tile, /* Tile of CIF information. */ + TileType dinfo, /* Split tile information */ TileType type) /* Magic type to be painted. */ { Rect area; @@ -1019,7 +1025,7 @@ cifPaintCurrentFunc( for (pNum = PL_PAINTBASE; pNum < DBNumPlanes; pNum++) if (DBPaintOnPlane(type, pNum)) { - DBNMPaintPlane(cifReadCellDef->cd_planes[pNum], TiGetTypeExact(tile), + DBNMPaintPlane(cifReadCellDef->cd_planes[pNum], TiGetTypeExact(tile) | dinfo, &area, DBStdPaintTbl(type, pNum), (PaintUndoInfo *) NULL); } diff --git a/cif/CIFsee.c b/cif/CIFsee.c index 06ce9f78..f8b9c1d9 100644 --- a/cif/CIFsee.c +++ b/cif/CIFsee.c @@ -78,6 +78,7 @@ typedef struct { int cifPaintDBFunc( Tile *tile, /* Tile of CIF information. */ + TileType dinfo, PaintLayerData *pld) { Rect area; @@ -106,7 +107,7 @@ cifPaintDBFunc( if (DBPaintOnPlane(type, pNum)) { ui.pu_pNum = pNum; - DBNMPaintPlane(paintDef->cd_planes[pNum], TiGetTypeExact(tile), + DBNMPaintPlane(paintDef->cd_planes[pNum], TiGetTypeExact(tile) | dinfo, &area, DBStdPaintTbl(type, pNum), (PaintUndoInfo *) &ui); } @@ -219,6 +220,7 @@ CIFPaintLayer( int cifSeeFunc( Tile *tile, /* Tile to be entered as feedback. */ + TileType dinfo, /* Split tile information */ SeeLayerData *sld) /* Layer and explanation for the feedback. */ { Rect area; @@ -233,10 +235,10 @@ cifSeeFunc( (float)area.r_ybot / (float)CIFCurStyle->cs_scaleFactor); } + /* (NOTE: Preserve information about the geometry of a diagonal tile) */ DBWFeedbackAdd(&area, sld->text, cifSeeDef, CIFCurStyle->cs_scaleFactor, - sld->style | - (TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE))); - /* (preserve information about the geometry of a diagonal tile) */ + sld->style | ((TiGetTypeExact(tile) | dinfo) & + (TT_DIAGONAL | TT_DIRECTION | TT_SIDE))); return 0; } @@ -438,9 +440,11 @@ CIFCoverageLayer( SearchContext scx; TileTypeBitMask mask, depend; float fcover; - int cifCoverageFunc(Tile *tile, ClientData *arg); bool doBox = (area != &rootDef->cd_bbox) ? TRUE : FALSE; + /* Forward declaration */ + int cifCoverageFunc(Tile *tile, TileType dinfo, ClientData *arg); + /* Check out the CIF layer name. */ if (!CIFNameToMask(layer, &mask, &depend)) return; @@ -512,6 +516,7 @@ CIFCoverageLayer( int cifCoverageFunc( Tile *tile, + TileType dinfo, /* (unused) */ ClientData *arg) { coverstats *cstats = (coverstats *)arg; diff --git a/cif/CIFwrite.c b/cif/CIFwrite.c index e7d5cc21..4599bb75 100644 --- a/cif/CIFwrite.c +++ b/cif/CIFwrite.c @@ -46,8 +46,8 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi /* Forward declarations */ extern int cifWriteInitFunc(CellDef *def); extern int cifWriteMarkFunc(CellUse *use); -extern int cifWritePaintFunc(Tile *tile, FILE *f); -extern int cifWriteLabelFunc(Tile *tile, FILE *f); +extern int cifWritePaintFunc(Tile *tile, TileType dinfo, FILE *f); +extern int cifWriteLabelFunc(Tile *tile, TileType dinfo, FILE *f); extern int cifWriteUseFunc(CellUse *use, FILE *f); extern void cifOutPreamble(FILE *outf, CellDef *cell); extern void cifOut(FILE *outf); @@ -584,6 +584,7 @@ cifWriteUseFunc( int cifWriteLabelFunc( Tile *tile, /* Tile to be written out. */ + TileType dinfo, /* Split tile information (unused) */ FILE *f) /* File in which to write. */ { Rect r; @@ -643,7 +644,8 @@ cifWriteLabelFunc( int cifWritePaintFunc( Tile *tile, /* Tile to be written out. */ - FILE *f) /* File in which to write. */ + TileType dinfo, /* Split tile information */ + FILE *f) /* File in which to write. */ { Rect r; @@ -662,7 +664,7 @@ cifWritePaintFunc( Point points[5]; int i, np; - GrClipTriangle(&r, NULL, FALSE, TiGetTypeExact(tile), points, &np); + GrClipTriangle(&r, NULL, FALSE, TiGetTypeExact(tile) | dinfo, points, &np); /* Write triangle as a CIF polygon */ diff --git a/commands/CmdCD.c b/commands/CmdCD.c index 05839a0a..e9fa40eb 100644 --- a/commands/CmdCD.c +++ b/commands/CmdCD.c @@ -2396,8 +2396,10 @@ CmdContact( CCStruct ccs; Rect area; LinkedRect *lr = NULL; - int cmdContactFunc(Tile *tile, CCStruct *ccs); /* Forward declaration */ - int cmdContactEraseFunc(Tile *tile, LinkedRect **lr); /* Forward declaration */ + + /* Forward declarations */ + int cmdContactFunc(Tile *tile, TileType dinfo, CCStruct *ccs); + int cmdContactEraseFunc(Tile *tile, TileType dinfo, LinkedRect **lr); windCheckOnlyWindow(&w, DBWclientID); if ((w == (MagWindow *) NULL) || (w->w_client != DBWclientID)) @@ -2531,11 +2533,14 @@ CmdContact( int cmdContactFunc( Tile *tile, + TileType dinfo, CCStruct *ccs) { TileType stype; TileTypeBitMask smask; - int cmdContactFunc2(Tile *tile, CCStruct *ccs); /* Forward declaration */ + + /* Forward declaration */ + int cmdContactFunc2(Tile *tile, TileType dinfo, CCStruct *ccs); TiToRect(tile, &ccs->area); GeoClip(&ccs->area, &ccs->clip); @@ -2545,7 +2550,7 @@ cmdContactFunc( break; TTMaskSetOnlyType(&smask, stype); - DBSrPaintArea((Tile *) NULL, ccs->rootDef->cd_planes[DBPlane(stype)], + DBSrPaintNMArea((Tile *)NULL, ccs->rootDef->cd_planes[DBPlane(stype)], dinfo, &ccs->area, &smask, cmdContactFunc2, (ClientData)ccs); return 0; } @@ -2553,6 +2558,7 @@ cmdContactFunc( int cmdContactFunc2( Tile *tile, + TileType dinfo, /* (unused) */ CCStruct *ccs) { LinkedRect *newlr; @@ -2575,6 +2581,7 @@ cmdContactFunc2( int cmdContactEraseFunc( Tile *tile, + TileType dinfo, /* (unused) */ LinkedRect **lr) { LinkedRect *newlr; @@ -2828,14 +2835,15 @@ CmdCorner( TileTypeBitMask maskBits; Rect editBox; SearchContext scx; - extern int cmdCornerFunc(Tile *tile, TreeContext *cxp); bool hasErr = FALSE; int locargc = cmd->tx_argc; - - extern int cmdBevelFunc(Tile *tile, TreeContext *cxp); bool dobevel = FALSE; NMCornerPath cmdPathList; + /* Forward declarations */ + extern int cmdCornerFunc(Tile *tile, TileType dinfo, TreeContext *cxp); + extern int cmdBevelFunc(Tile *tile, TileType dinfo, TreeContext *cxp); + if (cmd->tx_argc < 3 || cmd->tx_argc > 5) { TxError("Usage: %s direction1 direction2 [layers]\n", @@ -3030,6 +3038,7 @@ CmdCorner( int cmdCornerFunc( Tile *tile, /* Tile to fill with. */ + TileType dinfo, /* Split tile information (unused) */ TreeContext *cxp) /* Describes state of search. */ { Rect r1, r2, r3; @@ -3196,6 +3205,7 @@ AddNewPoint( int cmdBevelFunc( Tile *tile, /* Tile to fill with. */ + TileType dinfo, /* Split tile information (unused) */ TreeContext *cxp) /* Describes state of search. */ { Rect r1, r2, r3; @@ -4585,6 +4595,7 @@ CmdDrc( int cmdDropPaintCell( Tile *tile, + TileType dinfo, TreeContext *cxp) { CellDef *cellDef = cxp->tc_scx->scx_use->cu_def; @@ -4593,7 +4604,7 @@ cmdDropPaintCell( TileType type; Rect area; - if (SplitSide(tile)) + if (dinfo & TT_SIDE) type = SplitRightType(tile); else type = SplitLeftType(tile); @@ -4626,6 +4637,7 @@ cmdDropPaintCell( int cmdDropFunc( Tile *tile, + TileType dinfo, ClientData clientData) { TileTypeBitMask tMask, *lMask = (TileTypeBitMask *)clientData; @@ -4636,7 +4648,7 @@ cmdDropFunc( scx.scx_use = EditCellUse; scx.scx_trans = GeoIdentityTransform; - if (SplitSide(tile)) + if (dinfo & TT_SIDE) type = SplitRightType(tile); else type = SplitLeftType(tile); diff --git a/commands/CmdFI.c b/commands/CmdFI.c index 93a5aebd..8b62460a 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -102,15 +102,17 @@ struct cmdFPArg int feedPolyFunc( Tile *tile, + TileType dinfo, struct cmdFPArg *arg) { Rect area; TiToRect(tile, &area); + /* (NOTE: Preserve information about the geometry of a diagonal tile) */ DBWFeedbackAdd(&area, arg->text, arg->def, FEEDMAGNIFY, arg->style | - (TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE))); - /* (preserve information about the geometry of a diagonal tile) */ + ((TiGetTypeExact(tile) | dinfo) & + (TT_DIAGONAL | TT_DIRECTION | TT_SIDE))); return 0; } @@ -507,13 +509,15 @@ struct cmdFillArea *cmdFillList; /* List of areas to fill. */ void CmdFill( - MagWindow *w, /* Window in which command was invoked. */ + MagWindow *w, /* Window in which command was invoked. */ TxCommand *cmd) /* Describes the command that was invoked. */ { TileTypeBitMask maskBits; Rect editBox; SearchContext scx; - extern int cmdFillFunc(Tile *tile, TreeContext *cxp); + + /* Forward declaration */ + extern int cmdFillFunc(Tile *tile, TileType dinfo, TreeContext *cxp); if (cmd->tx_argc < 2 || cmd->tx_argc > 3) { @@ -603,11 +607,16 @@ CmdFill( * paint here it may mess up the search. Instead, the procedures * save areas on a list. The list is post-processed to paint the * areas once the search is finished. + * + * Split tile information is unused because there is no obvious + * meaning to "filling" from a split tile, although probably reasonable + * methods could be worked out. */ int cmdFillFunc( Tile *tile, /* Tile to fill with. */ + TileType dinfo, /* Split tile information (unused) */ TreeContext *cxp) /* Describes state of search. */ { Rect r1, r2; @@ -1707,7 +1716,7 @@ checklocal: if (locvalid == TRUE) { - int findTile(Tile *tile, TileType *rtype); + int findTile(Tile *tile, TileType dinfo, TileType *rtype); CellDef *targetdef = use->cu_def; Plane *plane = targetdef->cd_planes[pnum]; @@ -1841,13 +1850,14 @@ CmdGoto( int findTile( Tile *tile, + TileType dinfo, TileType *rtype) { TileType ttype; if (IsSplit(tile)) { - if (SplitSide(tile)) + if (dinfo & TT_SIDE) ttype = SplitRightType(tile); else ttype = SplitLeftType(tile); diff --git a/commands/CmdTZ.c b/commands/CmdTZ.c index 23206ca6..3fa43752 100644 --- a/commands/CmdTZ.c +++ b/commands/CmdTZ.c @@ -61,7 +61,9 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi int existFunc( - Tile *tile) + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { return 1; } @@ -839,7 +841,8 @@ struct linked_id { int cmdWhatPrintCell( - Tile *tile, + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ TreeContext *cxp) { struct linked_id **lid = (struct linked_id **)cxp->tc_filter->tf_arg; @@ -894,6 +897,7 @@ static LabelStore *labelBlockTop, *labelEntry; int cmdFindWhatTileFunc( Tile *tile, + TileType dinfo, ClientData clientData) { struct linked_id **lid = (struct linked_id **)clientData; @@ -905,7 +909,7 @@ cmdFindWhatTileFunc( scx.scx_use = EditCellUse; scx.scx_trans = GeoIdentityTransform; - if (SplitSide(tile)) + if (dinfo & TT_SIDE) type = SplitRightType(tile); else type = SplitLeftType(tile); diff --git a/commands/CmdWizard.c b/commands/CmdWizard.c index e746943d..e971cb6b 100644 --- a/commands/CmdWizard.c +++ b/commands/CmdWizard.c @@ -211,7 +211,8 @@ CmdExtractTest( int tileCountProc( - Tile *tile, + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ int *tcount) { (*tcount)++; @@ -800,11 +801,13 @@ cmdStatsCount( CellDef *def, struct countClient *cc) { - int cmdStatsCountTile(Tile *tile, struct cellInfo *ci); int pNum; struct cellInfo *ci; TileType t; + /* Forward declaration */ + int cmdStatsCountTile(Tile *tile, TileType dinfo, struct cellInfo *ci); + if (def->cd_client) return (1); @@ -829,6 +832,7 @@ cmdStatsCount( int cmdStatsCountTile( Tile *tile, + TileType dinfo, /* (unused) */ struct cellInfo *ci) { TileType type = TiGetType(tile); @@ -1099,17 +1103,18 @@ CmdTsearch( MagWindow *w, TxCommand *cmd) { - int cmdTsrFunc(Tile *tp); - char *RunStats(int flags, struct tms *lastt, struct tms *deltat); char *rstatp; static TileTypeBitMask mask; static struct tms tlast, tdelta; Rect rtool, rsearch; - /**** Rect *ebox; ****/ Plane *plane; int i, pNum, count; int usPerSearch, usPerTile, usPerL2, us, boxarea; + /* Forward declarations */ + int cmdTsrFunc(Tile *tp, TileType dinfo, ClientData clientdata); + char *RunStats(int flags, struct tms *lastt, struct tms *deltat); + if (cmd->tx_argc < 3 || cmd->tx_argc > 5) { TxError("Usage: tsearch plane count [mask [new|mayo]]\n"); @@ -1209,7 +1214,9 @@ CmdTsearch( int cmdTsrFunc( - Tile *tp) + Tile *tp, + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { if (cmdTsearchDebug) TxPrintf("%lx\n", (intptr_t) tp); diff --git a/database/DBcellcopy.c b/database/DBcellcopy.c index 9ff7cd72..59d5665d 100644 --- a/database/DBcellcopy.c +++ b/database/DBcellcopy.c @@ -967,14 +967,15 @@ DBCellGenerateSimpleSubstrate(scx, subType, notSubMask, targetDef) */ int -dbEraseSubFunc(tile, cxp) +dbEraseSubFunc(tile, dinfo, cxp) Tile *tile; /* Pointer to source tile with shield type */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* Context from DBTreeSrTiles */ { SearchContext *scx; Rect sourceRect, targetRect; int pNum; - TileType dinfo, loctype, subType; + TileType newdinfo, loctype, subType; Plane *plane; struct dbCopySubData *csd; /* Client data */ @@ -983,12 +984,11 @@ dbEraseSubFunc(tile, cxp) plane = csd->csd_plane; pNum = csd->csd_pNum; subType = csd->csd_subtype; - dinfo = TiGetTypeExact(tile); if (IsSplit(tile)) { - loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); if (loctype == TT_SPACE) return 0; - dinfo = DBTransformDiagonal(dinfo, &scx->scx_trans); + newdinfo = DBTransformDiagonal(dinfo, &scx->scx_trans); } /* Construct the rect for the tile */ @@ -999,7 +999,7 @@ dbEraseSubFunc(tile, cxp) csd->csd_modified = TRUE; - return DBNMPaintPlane(plane, dinfo, &targetRect, DBStdEraseTbl(subType, pNum), + return DBNMPaintPlane(plane, newdinfo, &targetRect, DBStdEraseTbl(subType, pNum), (PaintUndoInfo *)NULL); } @@ -1011,14 +1011,15 @@ dbEraseSubFunc(tile, cxp) */ int -dbPaintSubFunc(tile, cxp) +dbPaintSubFunc(tile, dinfo, cxp) Tile *tile; /* Pointer to source tile with shield type */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* Context from DBTreeSrTiles */ { SearchContext *scx; Rect sourceRect, targetRect; int pNum; - TileType dinfo, loctype, subType; + TileType newdinfo, loctype, subType; Plane *plane; struct dbCopySubData *csd; /* Client data */ @@ -1027,12 +1028,11 @@ dbPaintSubFunc(tile, cxp) plane = csd->csd_plane; pNum = csd->csd_pNum; subType = csd->csd_subtype; - dinfo = TiGetTypeExact(tile); if (IsSplit(tile)) { - loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); if (loctype == TT_SPACE) return 0; - dinfo = DBTransformDiagonal(dinfo, &scx->scx_trans); + newdinfo = DBTransformDiagonal(dinfo, &scx->scx_trans); } /* Construct the rect for the tile */ @@ -1043,7 +1043,7 @@ dbPaintSubFunc(tile, cxp) csd->csd_modified = TRUE; - return DBNMPaintPlane(plane, dinfo, &targetRect, DBStdPaintTbl(subType, pNum), + return DBNMPaintPlane(plane, newdinfo, &targetRect, DBStdPaintTbl(subType, pNum), (PaintUndoInfo *)NULL); } @@ -1056,14 +1056,15 @@ dbPaintSubFunc(tile, cxp) */ int -dbEraseNonSub(tile, cxp) +dbEraseNonSub(tile, dinfo, cxp) Tile *tile; /* Pointer to tile to erase from target */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* Context from DBTreeSrTiles */ { SearchContext *scx; Rect sourceRect, targetRect; Plane *plane; /* Plane of target data */ - TileType dinfo, loctype, subType; + TileType newdinfo, loctype, subType; struct dbCopySubData *csd; int pNum; @@ -1074,12 +1075,11 @@ dbEraseNonSub(tile, cxp) scx = cxp->tc_scx; - dinfo = TiGetTypeExact(tile); if (IsSplit(tile)) { - loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); if (loctype == TT_SPACE) return 0; - dinfo = DBTransformDiagonal(dinfo, &scx->scx_trans); + newdinfo = DBTransformDiagonal(dinfo, &scx->scx_trans); } /* Construct the rect for the tile */ @@ -1089,7 +1089,7 @@ dbEraseNonSub(tile, cxp) GEOTRANSRECT(&scx->scx_trans, &sourceRect, &targetRect); /* Erase the substrate type from the area of this tile in the target plane. */ - return DBNMPaintPlane(plane, dinfo, &targetRect, DBStdEraseTbl(subType, pNum), + return DBNMPaintPlane(plane, newdinfo, &targetRect, DBStdEraseTbl(subType, pNum), (PaintUndoInfo *)NULL); } @@ -1101,8 +1101,9 @@ dbEraseNonSub(tile, cxp) */ int -dbCopySubFunc(tile, csd) +dbCopySubFunc(tile, dinfo, csd) Tile *tile; /* Pointer to tile to erase from target */ + TileType dinfo; /* Split tile information */ struct dbCopySubData *csd; /* Client data */ { Rect rect; @@ -1112,10 +1113,10 @@ dbCopySubFunc(tile, csd) plane = csd->csd_plane; pNum = csd->csd_pNum; - type = TiGetTypeExact(tile); + type = TiGetTypeExact(tile) | dinfo; if (IsSplit(tile)) { - loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); if (loctype == TT_SPACE) return 0; } else @@ -1436,8 +1437,9 @@ DBCellCopyLabels(scx, mask, xMask, targetUse, pArea) ***/ int -dbCopyManhattanPaint(tile, cxp) - Tile *tile; /* Pointer to tile to copy */ +dbCopyManhattanPaint(tile, dinfo, cxp) + Tile *tile; /* Pointer to tile to copy */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* Context from DBTreeSrTiles */ { SearchContext *scx = cxp->tc_scx; @@ -1483,8 +1485,9 @@ dbCopyManhattanPaint(tile, cxp) ***/ int -dbCopyAllPaint(tile, cxp) - Tile *tile; /* Pointer to tile to copy */ +dbCopyAllPaint(tile, dinfo, cxp) + Tile *tile; /* Pointer to tile to copy */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* Context from DBTreeSrTiles */ { SearchContext *scx = cxp->tc_scx; @@ -1492,7 +1495,7 @@ dbCopyAllPaint(tile, cxp) Rect sourceRect, targetRect; PaintUndoInfo ui; CellDef *def; - TileType type = TiGetTypeExact(tile); + TileType type = TiGetTypeExact(tile) | dinfo; int pNum = cxp->tc_plane; int result; TileTypeBitMask *typeMask; @@ -1505,13 +1508,13 @@ dbCopyAllPaint(tile, cxp) */ bool splittile = FALSE; - TileType dinfo = 0; + TileType newdinfo = 0; if (IsSplit(tile)) { splittile = TRUE; - dinfo = DBTransformDiagonal(type, &scx->scx_trans); - type = (SplitSide(tile)) ? SplitRightType(tile) : + newdinfo = DBTransformDiagonal(type, &scx->scx_trans); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); } @@ -1571,7 +1574,7 @@ dbCopyAllPaint(tile, cxp) Rect rrect, orect; int np, i, j; - GrClipTriangle(&targetRect, &arg->caa_rect, TRUE, dinfo, points, &np); + GrClipTriangle(&targetRect, &arg->caa_rect, TRUE, newdinfo, points, &np); if (np == 0) return(0); @@ -1600,7 +1603,7 @@ dbCopyAllPaint(tile, cxp) rrect.r_ybot = points[0].p_y; rrect.r_ytop = points[2].p_y; GeoCanonicalRect(&rrect, &targetRect); - dinfo = 0; + newdinfo = 0; } else if (np >= 4) /* Process extra rectangles in the area */ { @@ -1657,7 +1660,7 @@ topbottom: splitdone: - result = (*dbCurPaintPlane)(def, pNum, dinfo | type, &targetRect, &ui); + result = (*dbCurPaintPlane)(def, pNum, newdinfo | type, &targetRect, &ui); if ((result != 0) && (arg->caa_func != NULL)) { /* result == 1 used exclusively for DRC off-grid error flagging */ diff --git a/database/DBcellsrch.c b/database/DBcellsrch.c index db15c6d6..83ae001c 100644 --- a/database/DBcellsrch.c +++ b/database/DBcellsrch.c @@ -120,6 +120,7 @@ DBSrCellPlaneArea(BPlane *plane, const Rect *rect, int (*func)(), ClientData arg * int * func(tile, cxp) * Tile *tile; + * TileType dinfo; * TreeContext *cxp; * { * } @@ -416,6 +417,7 @@ dbCellUniqueTileSrFunc(scx, fp) * int * func(tile, cxp) * Tile *tile; + * TileType dinfo; * TreeContext *cxp; * { * } @@ -914,8 +916,9 @@ DBSeeTypesAll(rootUse, rootRect, xMask, mask) */ int -dbSeeTypesAllSrFunc(tile, cxp) +dbSeeTypesAllSrFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; TreeContext *cxp; { Rect tileRect; @@ -926,7 +929,7 @@ dbSeeTypesAllSrFunc(tile, cxp) if (GEO_OVERLAP((&tileRect), area)) { if (IsSplit(tile)) - TTMaskSetType(mask, SplitSide(tile) ? + TTMaskSetType(mask, (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile)); else TTMaskSetType(mask, TiGetType(tile)); @@ -1607,8 +1610,9 @@ dbScalePlane(oldplane, newplane, pnum, scalen, scaled, doCIF) */ int -dbTileScaleFunc(tile, scvals) +dbTileScaleFunc(tile, dinfo, scvals) Tile *tile; + TileType dinfo; struct scaleArg *scvals; { TileType type; @@ -1631,10 +1635,10 @@ dbTileScaleFunc(tile, scvals) return 0; } - type = TiGetTypeExact(tile); + type = TiGetTypeExact(tile) | dinfo; exact = type; if (IsSplit(tile)) - type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); DBNMPaintPlane(scvals->ptarget, exact, &targetRect, ( #ifdef CIF_MODULE @@ -1689,8 +1693,9 @@ dbMovePlane(oldplane, newplane, pnum, origx, origy) */ int -dbTileMoveFunc(tile, mvvals) +dbTileMoveFunc(tile, dinfo, mvvals) Tile *tile; + TileType dinfo; struct moveArg *mvvals; { TileType type; @@ -1703,10 +1708,10 @@ dbTileMoveFunc(tile, mvvals) DBMovePoint(&targetRect.r_ll, mvvals->origx, mvvals->origy); DBMovePoint(&targetRect.r_ur, mvvals->origx, mvvals->origy); - type = TiGetTypeExact(tile); + type = TiGetTypeExact(tile) | dinfo; exact = type; if (IsSplit(tile)) - type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); DBNMPaintPlane(mvvals->ptarget, exact, &targetRect, DBStdPaintTbl(type, mvvals->pnum), (PaintUndoInfo *)NULL); diff --git a/database/DBconnect.c b/database/DBconnect.c index d5e0fc0f..1dab796d 100644 --- a/database/DBconnect.c +++ b/database/DBconnect.c @@ -148,6 +148,7 @@ DBInvTransformDiagonal(oldtype, trans) * int * func(tile, clientData) * Tile *tile; + * TileType dinfo; * ClientData clientData; * { * } @@ -166,8 +167,9 @@ DBInvTransformDiagonal(oldtype, trans) */ int -DBSrConnectOnePlane(startTile, connect, func, clientData) +DBSrConnectOnePlane(startTile, dinfo, connect, func, clientData) Tile *startTile; /* Starting tile for search */ + TileType dinfo; /* Split tile information */ TileTypeBitMask *connect; /* Pointer to a table indicating what tile * types connect to what other tile types. * Each entry gives a mask of types that @@ -192,7 +194,7 @@ DBSrConnectOnePlane(startTile, connect, func, clientData) csa.csa_clear = FALSE; csa.csa_connect = connect; csa.csa_pNum = -1; - if (dbSrConnectFunc(startTile, PTR2CD(&csa)) != 0) result = 1; + if (dbSrConnectFunc(startTile, dinfo, PTR2CD(&csa)) != 0) result = 1; /* Pass 2. Don't call any client function, just clear the marks. * Don't allow any interruptions. @@ -201,7 +203,7 @@ DBSrConnectOnePlane(startTile, connect, func, clientData) SigDisableInterrupts(); csa.csa_clientFunc = NULL; csa.csa_clear = TRUE; - (void) dbSrConnectFunc(startTile, PTR2CD(&csa)); + (void) dbSrConnectFunc(startTile, dinfo, PTR2CD(&csa)); SigEnableInterrupts(); return result; @@ -276,7 +278,7 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) { struct conSrArg csa; int startPlane, result; - Tile *startTile; /* Starting tile for search. */ + TileAndDinfo start_tad; /* Starting tile and split information */ result = 0; csa.csa_def = def; @@ -287,17 +289,17 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) * the tile address and returns. */ - startTile = NULL; + start_tad.tad_tile = NULL; for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++) { csa.csa_pNum = startPlane; if (DBSrPaintArea((Tile *) NULL, def->cd_planes[startPlane], startArea, mask, - dbSrConnectStartFunc, PTR2CD(&startTile)) != 0) break; + dbSrConnectStartFunc, PTR2CD(&start_tad)) != 0) break; } - if (startTile == NULL) return 0; + if (start_tad.tad_tile == NULL) return 0; /* The following lets us call DBSrConnect recursively */ - else if (startTile->ti_client == (ClientData)1) return 0; + else if (start_tad.tad_tile->ti_client == (ClientData)1) return 0; /* Pass 1. During this pass the client function gets called. */ @@ -306,7 +308,8 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) csa.csa_clientDefault = CLIENTDEFAULT; csa.csa_clear = FALSE; csa.csa_connect = connect; - if (dbSrConnectFunc(startTile, PTR2CD(&csa)) != 0) result = 1; + if (dbSrConnectFunc(start_tad.tad_tile, start_tad.tad_dinfo, + PTR2CD(&csa)) != 0) result = 1; /* Pass 2. Don't call any client function, just clear the marks. * Don't allow any interruptions. @@ -315,7 +318,7 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) SigDisableInterrupts(); csa.csa_clientFunc = NULL; csa.csa_clear = TRUE; - (void) dbSrConnectFunc(startTile, PTR2CD(&csa)); + (void) dbSrConnectFunc(start_tad.tad_tile, start_tad.tad_dinfo, PTR2CD(&csa)); SigEnableInterrupts(); return result; @@ -325,11 +328,12 @@ DBSrConnect(def, startArea, mask, connect, bounds, func, clientData) int dbSrConnectStartFunc( Tile *tile, /* This will be the starting tile. */ - ClientData cdata) /* We store tile's address here. */ - /* (Tile **pTile) */ + TileType dinfo, /* (unused) */ + ClientData cdata) /* We store tile and split info here. */ { - Tile **pTile = (Tile **)CD2PTR(cdata); - *pTile = tile; + TileAndDinfo *tad = (TileAndDinfo *)CD2PTR(cdata); + tad->tad_tile = tile; + tad->tad_dinfo = dinfo; return 1; } @@ -367,7 +371,7 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData) { struct conSrArg csa; int startPlane, result; - Tile *startTile; /* Starting tile for search. */ + TileAndDinfo tad; result = 0; csa.csa_def = def; @@ -378,17 +382,17 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData) * the tile address and returns. */ - startTile = NULL; + tad.tad_tile = NULL; for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++) { csa.csa_pNum = startPlane; if (DBSrPaintArea((Tile *) NULL, def->cd_planes[startPlane], startArea, mask, - dbSrConnectStartFunc, PTR2CD(&startTile)) != 0) break; + dbSrConnectStartFunc, PTR2CD(&tad)) != 0) break; } - if (startTile == NULL) return 0; + if (tad.tad_tile == NULL) return 0; /* The following lets us call DBSrConnect recursively */ - else if (startTile->ti_client == (ClientData)1) return 0; + else if (tad.tad_tile->ti_client == (ClientData)1) return 0; /* Pass 1. During this pass the client function gets called. */ @@ -397,7 +401,7 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData) csa.csa_clientDefault = CLIENTDEFAULT; csa.csa_clear = FALSE; csa.csa_connect = connect; - if (dbSrConnectFunc(startTile, PTR2CD(&csa)) != 0) result = 1; + if (dbSrConnectFunc(tad.tad_tile, tad.tad_dinfo, PTR2CD(&csa)) != 0) result = 1; return result; } @@ -420,12 +424,15 @@ DBSrConnectOnePass(def, startArea, mask, connect, bounds, func, clientData) */ int -dbcFindTileFunc(tile, arg) +dbcFindTileFunc(tile, dinfo, arg) Tile *tile; + TileType dinfo; ClientData arg; { - Tile **tptr = (Tile **)arg; - *tptr = tile; + TileAndDinfo *tad = (TileAndDinfo *)arg; + + tad->tad_tile = tile; + tad->tad_dinfo = dinfo; return 1; } @@ -465,6 +472,7 @@ dbcFindTileFunc(tile, arg) int dbSrConnectFunc( Tile *tile, /* Tile that is connected. */ + TileType dinfo, /* Split tile information */ ClientData cdata) /* Contains information about the search. */ /* (struct conSrArg *csa) */ { @@ -484,11 +492,13 @@ dbSrConnectFunc( /* Drop the first entry on the stack */ pNum = csa->csa_pNum; STACKPUSH(INT2CD(tile), dbConnectStack); + STACKPUSH(INT2CD(dinfo), dbConnectStack); STACKPUSH(INT2CD(pNum), dbConnectStack); while (!StackEmpty(dbConnectStack)) { pNum = (int)CD2INT(STACKPOP(dbConnectStack)); + dinfo = (int)CD2INT(STACKPOP(dbConnectStack)); tile = (Tile *)CD2INT(STACKPOP(dbConnectStack)); if (result == 1) continue; @@ -522,7 +532,7 @@ dbSrConnectFunc( if (callClient && (csa->csa_clientFunc != NULL)) { - if ((*csa->csa_clientFunc)(tile, pNum, csa->csa_clientData) != 0) + if ((*csa->csa_clientFunc)(tile, dinfo, pNum, csa->csa_clientData) != 0) { result = 1; continue; @@ -536,7 +546,7 @@ dbSrConnectFunc( if (IsSplit(tile)) { - if (SplitSide(tile)) + if (dinfo & TT_SIDE) loctype = SplitRightType(tile); else loctype = SplitLeftType(tile); @@ -547,7 +557,7 @@ dbSrConnectFunc( /* Left side: */ - if (IsSplit(tile) && SplitSide(tile)) goto bottomside; + if (IsSplit(tile) && (dinfo & TT_SIDE)) goto bottomside; for (t2 = BL(tile); BOTTOM(t2) < tileArea.r_ytop; t2 = RT(t2)) { @@ -564,9 +574,11 @@ dbSrConnectFunc( if (t2->ti_client == csa->csa_clientDefault) continue; } else if (t2->ti_client == (ClientData) 1) continue; - if (IsSplit(t2)) - TiSetBody(t2, INT2CD(CD2INT(t2->ti_body) | TT_SIDE)); /* bit set */ STACKPUSH(INT2CD(t2), dbConnectStack); + if (IsSplit(t2)) + STACKPUSH(INT2CD((TileType)TT_SIDE), dbConnectStack); + else + STACKPUSH(INT2CD(0), dbConnectStack); STACKPUSH(INT2CD(pNum), dbConnectStack); } } @@ -574,7 +586,7 @@ dbSrConnectFunc( /* Bottom side: */ bottomside: - if (IsSplit(tile) && (!(SplitSide(tile) ^ SplitDirection(tile)))) + if (IsSplit(tile) && ((!((dinfo & TT_SIDE) ? 1 : 0)) ^ SplitDirection(tile))) goto rightside; for (t2 = LB(tile); LEFT(t2) < tileArea.r_xtop; t2 = TR(t2)) @@ -592,16 +604,17 @@ bottomside: if (t2->ti_client == csa->csa_clientDefault) continue; } else if (t2->ti_client == (ClientData) 1) continue; + STACKPUSH(INT2CD(t2), dbConnectStack); if (IsSplit(t2)) { if (SplitDirection(t2)) - /* bit set */ - TiSetBody(t2, INT2CD(CD2INT(t2->ti_body) | TT_SIDE)); + STACKPUSH(INT2CD((TileType)TT_SIDE), dbConnectStack); else /* bit clear */ - TiSetBody(t2, INT2CD(CD2INT(t2->ti_body) & ~TT_SIDE)); + STACKPUSH(INT2CD(0), dbConnectStack); } - STACKPUSH(INT2CD(t2), dbConnectStack); + else + STACKPUSH(INT2CD(0), dbConnectStack); STACKPUSH(INT2CD(pNum), dbConnectStack); } } @@ -609,7 +622,7 @@ bottomside: /* Right side: */ rightside: - if (IsSplit(tile) && !SplitSide(tile)) goto topside; + if (IsSplit(tile) && !(dinfo & TT_SIDE)) goto topside; for (t2 = TR(tile); ; t2 = LB(t2)) { @@ -626,9 +639,8 @@ rightside: if (t2->ti_client == csa->csa_clientDefault) goto nextRight; } else if (t2->ti_client == (ClientData) 1) goto nextRight; - if (IsSplit(t2)) - TiSetBody(t2, INT2CD(CD2INT(t2->ti_body) & ~TT_SIDE)); /* bit clear */ STACKPUSH(INT2CD(t2), dbConnectStack); + STACKPUSH(INT2CD(0), dbConnectStack); STACKPUSH(INT2CD(pNum), dbConnectStack); } nextRight: if (BOTTOM(t2) <= tileArea.r_ybot) break; @@ -637,7 +649,8 @@ rightside: /* Top side: */ topside: - if (IsSplit(tile) && (SplitSide(tile) ^ SplitDirection(tile))) goto donesides; + if (IsSplit(tile) && (((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) + goto donesides; for (t2 = RT(tile); ; t2 = BL(t2)) { @@ -654,16 +667,18 @@ topside: if (t2->ti_client == csa->csa_clientDefault) goto nextTop; } else if (t2->ti_client == (ClientData) 1) goto nextTop; + STACKPUSH(INT2CD(t2), dbConnectStack); if (IsSplit(t2)) { if (SplitDirection(t2)) /* bit clear */ - TiSetBody(t2, INT2CD(CD2INT(t2->ti_body) & ~TT_SIDE)); + STACKPUSH(INT2CD(0), dbConnectStack); else /* bit set */ - TiSetBody(t2, INT2CD(CD2INT(t2->ti_body) | TT_SIDE)); + STACKPUSH(INT2CD((TileType)TT_SIDE), dbConnectStack); } - STACKPUSH(INT2CD(t2), dbConnectStack); + else + STACKPUSH(INT2CD(0), dbConnectStack); STACKPUSH(INT2CD(pNum), dbConnectStack); } nextTop: if (LEFT(t2) <= tileArea.r_xbot) break; @@ -682,6 +697,7 @@ donesides: { Rect newArea; GEO_EXPAND(&tileArea, 1, &newArea); + TileAndDinfo tad; for (i = PL_TECHDEPBASE; i < DBNumPlanes; i++) { @@ -690,17 +706,19 @@ donesides: { if (DBSrPaintNMArea((Tile *) NULL, csa->csa_def->cd_planes[i], TiGetTypeExact(tile), &newArea, connectMask, - dbcFindTileFunc, (ClientData)&t2) != 0) + dbcFindTileFunc, (ClientData)&tad) != 0) { - STACKPUSH(INT2CD(t2), dbConnectStack); + STACKPUSH(PTR2CD(tad.tad_tile), dbConnectStack); + STACKPUSH(INT2CD(tad.tad_dinfo), dbConnectStack); STACKPUSH(INT2CD(i), dbConnectStack); } } else if (DBSrPaintArea((Tile *) NULL, csa->csa_def->cd_planes[i], &newArea, connectMask, dbcFindTileFunc, - (ClientData)&t2) != 0) + (ClientData)&tad) != 0) { - STACKPUSH(INT2CD(t2), dbConnectStack); + STACKPUSH(PTR2CD(tad.tad_tile), dbConnectStack); + STACKPUSH(INT2CD(tad.tad_dinfo), dbConnectStack); STACKPUSH(INT2CD(i), dbConnectStack); } } @@ -734,9 +752,10 @@ donesides: /** @typedef cb_database_srpaintnmarea_t */ /** @typedef cb_database_srpaintarea_t */ int -dbcUnconnectFunc(tile, clientData) +dbcUnconnectFunc(tile, dinfo, clientData) Tile *tile; /* Current tile */ - ClientData clientData; /* Unused. */ + TileType dinfo; /* Split tile information, unused */ + ClientData clientData; /* Unused. */ { return 1; @@ -949,8 +968,9 @@ dbcConnectLabelFunc(scx, lab, tpath, csa2) */ int -dbcConnectFunc(tile, cx) +dbcConnectFunc(tile, dinfo, cx) Tile *tile; /* Tile found. */ + TileType dinfo; /* Split tile information */ TreeContext *cx; /* Describes context of search. The client * data is a pointer to a conSrArg2 record * containing various required information. @@ -963,8 +983,8 @@ dbcConnectFunc(tile, cx) Rect *srArea; SearchContext *scx = cx->tc_scx; SearchContext scx2; - TileType loctype = TiGetTypeExact(tile); - TileType dinfo = 0; + TileType loctype = TiGetTypeExact(tile) | dinfo; + TileType newdinfo = 0; int retval, i, pNum = cx->tc_plane; CellDef *def; @@ -996,8 +1016,8 @@ dbcConnectFunc(tile, cx) if (IsSplit(tile)) { - dinfo = DBTransformDiagonal(loctype, &scx->scx_trans); - loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + newdinfo = DBTransformDiagonal(loctype, &scx->scx_trans); + loctype = ((dinfo & TT_SIDE)) ? SplitRightType(tile) : SplitLeftType(tile); } /* See if the destination cell contains stuff over the whole @@ -1035,7 +1055,7 @@ dbcConnectFunc(tile, cx) def = csa2->csa2_use->cu_def; retval = 1; if (DBSrPaintNMArea((Tile *) NULL, def->cd_planes[pNum], - dinfo, &newarea, ¬ConnectMask, dbcUnconnectFunc, + newdinfo, &newarea, ¬ConnectMask, dbcUnconnectFunc, (ClientData) NULL) == 0) retval = 0; @@ -1044,7 +1064,7 @@ dbcConnectFunc(tile, cx) * the storage for the current list element. */ - DBNMPaintPlane(def->cd_planes[pNum], dinfo, + DBNMPaintPlane(def->cd_planes[pNum], newdinfo, &newarea, DBStdPaintTbl(loctype, pNum), (PaintUndoInfo *) NULL); @@ -1061,14 +1081,14 @@ dbcConnectFunc(tile, cx) /* Only extend those sides bordering the diagonal tile */ - if (dinfo & TT_DIAGONAL) + if (newdinfo & TT_DIAGONAL) { - if (dinfo & TT_SIDE) /* right */ + if (newdinfo & TT_SIDE) /* right */ newarea.r_xtop += 1; else /* left */ newarea.r_xbot -= 1; - if (((dinfo & TT_SIDE) >> 1) - == (dinfo & TT_DIRECTION)) /* top */ + if (((newdinfo & TT_SIDE) >> 1) + == (newdinfo & TT_DIRECTION)) /* top */ newarea.r_ytop += 1; else /* bottom */ newarea.r_ybot -= 1; @@ -1108,7 +1128,7 @@ dbcConnectFunc(tile, cx) csa2->csa2_list[csa2->csa2_top].area = newarea; csa2->csa2_list[csa2->csa2_top].connectMask = connectMask; - csa2->csa2_list[csa2->csa2_top].dinfo = dinfo; + csa2->csa2_list[csa2->csa2_top].dinfo = newdinfo; return 0; } diff --git a/database/DBio.c b/database/DBio.c index e4396a53..8da3b556 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -3228,8 +3228,9 @@ DBCellFindScale(cellDef) } int -dbFindGCFFunc(tile, ggcf) +dbFindGCFFunc(tile, dinfo, ggcf) Tile *tile; + TileType dinfo; /* (unused) */ int *ggcf; { Rect r; @@ -4218,8 +4219,9 @@ ioerror: */ int -dbWritePaintCommandsFunc(tile, cdarg) +dbWritePaintCommandsFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; ClientData cdarg; { char pstring[256]; @@ -4242,7 +4244,7 @@ dbWritePaintCommandsFunc(tile, cdarg) if (IsSplit(tile)) { - diridx = (SplitDirection(tile) << 1) + SplitSide(tile); + diridx = (SplitDirection(tile) << 1) + ((dinfo & TT_SIDE) ? 1 : 0); fprintf(f, "box values %d %d %d %d\n", LEFT(tile), BOTTOM(tile), RIGHT(tile), TOP(tile)); @@ -4707,8 +4709,9 @@ cleanup: */ int -dbWritePaintFunc(tile, cdarg) +dbWritePaintFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; /* (unused) */ ClientData cdarg; { char pstring[256]; @@ -4770,7 +4773,7 @@ dbWritePaintFunc(tile, cdarg) sprintf(pstring, "rect %d %d %d %d\n", LEFT(tile) / arg->wa_reducer, BOTTOM(tile) / arg->wa_reducer, RIGHT(tile) / arg->wa_reducer, TOP(tile) / arg->wa_reducer); - FPUTSR(arg->wa_file,pstring); + FPUTSR(arg->wa_file, pstring); return 0; } diff --git a/database/DBlabel.c b/database/DBlabel.c index d6c89d30..a77bdf18 100644 --- a/database/DBlabel.c +++ b/database/DBlabel.c @@ -583,8 +583,9 @@ DBReOrientLabel(cellDef, area, newPos) */ int -dbGetLabelArea(tile, area) +dbGetLabelArea(tile, dinfo, area) Tile *tile; /* Tile found. */ + TileType dinfo; /* Split tile information (unused) */ Rect *area; /* Area to be modified. */ { Rect r; @@ -1085,14 +1086,15 @@ DBPickLabelLayer(def, lab, doCalma) */ int -dbPickFunc1(tile, mask) +dbPickFunc1(tile, dinfo, mask) Tile *tile; /* Tile found. */ + TileType dinfo; /* Split tile information */ TileTypeBitMask *mask; /* Mask to be modified. */ { TileType type; if (IsSplit(tile)) - type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else type = TiGetType(tile); @@ -1111,15 +1113,16 @@ dbPickFunc1(tile, mask) */ int -dbPickFunc2(tile, mask) +dbPickFunc2(tile, dinfo, mask) Tile *tile; /* Tile found. */ + TileType dinfo; /* Split tile information */ TileTypeBitMask *mask; /* Mask to be modified. */ { TileType type; TileTypeBitMask tmp, *rMask; if (IsSplit(tile)) - type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else type = TiGetType(tile); diff --git a/database/DBpaint.c b/database/DBpaint.c index dd8cbdc6..37371de6 100644 --- a/database/DBpaint.c +++ b/database/DBpaint.c @@ -1820,14 +1820,15 @@ nextrect: */ int -dbNMEnumFunc(tile, arg) +dbNMEnumFunc(tile, dinfo, arg) Tile *tile; + TileType dinfo; LinkedRect **arg; { LinkedRect *lr; /* Ignore the second call to any diagonal---only count once! */ - if (IsSplit(tile) && SplitSide(tile)) return 0; + if (IsSplit(tile) && (dinfo & TT_SIDE)) return 0; lr = (LinkedRect *) mallocMagic(sizeof(LinkedRect)); TiToRect(tile, &lr->r_r); diff --git a/database/DBpaint2.c b/database/DBpaint2.c index aa82305b..8a90cb01 100644 --- a/database/DBpaint2.c +++ b/database/DBpaint2.c @@ -119,8 +119,9 @@ DBPaint (cellDef, rect, type) */ int -dbResolveImages(tile, cellDef) +dbResolveImages(tile, dinfo, cellDef) Tile *tile; + TileType dinfo; CellDef *cellDef; { Rect rect; @@ -130,7 +131,7 @@ dbResolveImages(tile, cellDef) /* Recursive call back to DBPaint---this will ensure that */ /* all of the planes of the image type are painted. */ - DBPaint(cellDef, &rect, TiGetTypeExact(tile)); + DBPaint(cellDef, &rect, TiGetTypeExact(tile) | dinfo); return 0; } diff --git a/database/DBtiles.c b/database/DBtiles.c index 14b5135b..30dd0fd4 100644 --- a/database/DBtiles.c +++ b/database/DBtiles.c @@ -56,6 +56,7 @@ int dbCheckMaxHFunc(), dbCheckMaxVFunc(); * int * func(tile, cdata) * Tile *tile; + * TileType dinfo; * ClientData cdata; * { * } @@ -266,17 +267,15 @@ nm_enum: if (!(ignore_sides & IGNORE_LEFT)) { - TiSetBody(tp, INT2CD(tpt & ~TT_SIDE)); /* bit clear */ - if ((*func)(tp, arg)) return (1); + if ((*func)(tp, (TileType)TT_DIAGONAL, arg)) return (1); } if (!(ignore_sides & IGNORE_RIGHT)) { - TiSetBody(tp, INT2CD(tpt | TT_SIDE)); /* bit set */ - if ((*func)(tp, arg)) return (1); + if ((*func)(tp, (TileType)TT_DIAGONAL | TT_SIDE, arg)) return (1); } } else - if (TTMaskHasType(mask, TiGetType(tp)) && (*func)(tp, arg)) + if (TTMaskHasType(mask, TiGetType(tp)) && (*func)(tp, (TileType)0, arg)) return (1); enum_next: @@ -325,6 +324,7 @@ enum_next: * int * func(tile, cdata) * Tile *tile; + * TileType dinfo; * ClientData cdata; * { * } @@ -416,9 +416,7 @@ enumerate: (dlong)(rect->r_xbot - LEFT(tp)) * theight : DLONG_MIN; if (SplitDirection(tp) ? (f1 > f4) : (f2 > f4)) { - TiSetBody(tp, INT2CD((TileType)CD2INT(TiGetBody(tp)) - & ~TT_SIDE)); /* bit clear */ - if ((*func)(tp, arg)) return (1); + if ((*func)(tp, (TileType)TT_DIAGONAL, arg)) return (1); } } @@ -429,14 +427,12 @@ enumerate: (dlong)(RIGHT(tp) - rect->r_xtop) * theight : DLONG_MIN; if (SplitDirection(tp) ? (f2 > f3) : (f1 > f3)) { - TiSetBody(tp, INT2CD((TileType)CD2INT(TiGetBody(tp)) - | TT_SIDE)); /* bit set */ - if ((*func)(tp, arg)) return (1); + if ((*func)(tp, (TileType)TT_DIAGONAL | TT_SIDE, arg)) return (1); } } } else - if (TTMaskHasType(mask, TiGetType(tp)) && (*func)(tp, arg)) + if (TTMaskHasType(mask, TiGetType(tp)) && (*func)(tp, (TileType)0, arg)) return (1); tpnew = TR(tp); @@ -485,6 +481,7 @@ enumerate: * int * func(tile, cdata) * Tile *tile; + * TileType dinfo; * ClientData cdata; * { * } @@ -576,9 +573,7 @@ enumerate: (dlong)(rect->r_xbot - LEFT(tp)) * (dlong)theight : DLONG_MIN; if (SplitDirection(tp) ? (f1 > f4) : (f2 > f4)) { - TiSetBody(tp, INT2CD((TileType)CD2INT(TiGetBody(tp)) - & ~TT_SIDE)); /* bit clear */ - if ((tp->ti_client == client) && (*func)(tp, arg)) + if ((tp->ti_client == client) && (*func)(tp, (TileType)TT_DIAGONAL, arg)) return (1); } } @@ -590,16 +585,15 @@ enumerate: (dlong)(RIGHT(tp) - rect->r_xtop) * (dlong)theight : DLONG_MIN; if (SplitDirection(tp) ? (f2 > f3) : (f1 > f3)) { - TiSetBody(tp, INT2CD((TileType)CD2INT(TiGetBody(tp)) - | TT_SIDE)); /* bit set */ - if ((tp->ti_client == client) && (*func)(tp, arg)) + if ((tp->ti_client == client) && (*func)(tp, (TileType)TT_DIAGONAL + | TT_SIDE, arg)) return (1); } } } else if (TTMaskHasType(mask, TiGetType(tp)) && tp->ti_client == client - && (*func)(tp, arg)) + && (*func)(tp, (TileType)0, arg)) return (1); tpnew = TR(tp); @@ -918,8 +912,9 @@ DBCheckMaxHStrips(plane, area, proc, cdata) */ int -dbCheckMaxHFunc(tile, dbc) +dbCheckMaxHFunc(tile, dinfo, dbc) Tile *tile; + TileType dinfo; /* (unused) */ struct dbCheck *dbc; { Tile *tp; @@ -1010,8 +1005,9 @@ DBCheckMaxVStrips(plane, area, proc, cdata) */ int -dbCheckMaxVFunc(tile, dbc) +dbCheckMaxVFunc(tile, dinfo, dbc) Tile *tile; + TileType dinfo; /* (unused) */ struct dbCheck *dbc; { Tile *tp; diff --git a/database/database.h.in b/database/database.h.in index 9e6cdcfc..3c0c0172 100644 --- a/database/database.h.in +++ b/database/database.h.in @@ -551,6 +551,15 @@ typedef struct diag_info bool side; } DiagInfo; +/* Where search functions need to return a Tile pointer and tile split */ +/* information, use this structure. */ + +typedef struct tile_and_dinfo +{ + Tile *tad_tile; + TileType tad_dinfo; +} TileAndDinfo; + /* This would normally go in geometry.h except that it uses TileType. */ /* Used in selOps.c but also passed back to CmdRS.c for select command. */ @@ -920,9 +929,9 @@ extern int DBArraySr(); extern bool DBNearestLabel(); extern int DBSrLabelLoc(); extern TileType DBTransformDiagonal(); -extern int dbcUnconnectFunc(Tile *tile, ClientData clientData); /* (notused) */ -extern int dbSrConnectFunc(Tile *tile, ClientData clientData); /* (struct conSrArg *csa) */ -extern int dbSrConnectStartFunc(Tile *tile, ClientData clientData); /* cb_database_srpaintarea_t (Tile **pTile) */ +extern int dbcUnconnectFunc(Tile *tile, TileType dinfo, ClientData clientData); /* (notused) */ +extern int dbSrConnectFunc(Tile *tile, TileType dinfo, ClientData clientData); /* (struct conSrArg *csa) */ +extern int dbSrConnectStartFunc(Tile *tile, TileType dinfo, ClientData clientData); /* cb_database_srpaintarea_t (Tile **pTile) */ /* C99 compat */ extern void DBEraseValid(); diff --git a/dbwind/DBWdisplay.c b/dbwind/DBWdisplay.c index 54d828f2..0903b796 100644 --- a/dbwind/DBWdisplay.c +++ b/dbwind/DBWdisplay.c @@ -571,8 +571,9 @@ DBWredisplay(w, rootArea, clipArea) */ int -dbwPaintFunc(tile, cxp) - Tile *tile; /* Tile to be redisplayed. */ +dbwPaintFunc(tile, dinfo, cxp) + Tile *tile; /* Tile to be redisplayed. */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* From DBTreeSrTiles */ { SearchContext *scx = cxp->tc_scx; @@ -652,7 +653,7 @@ dbwPaintFunc(tile, cxp) /* whether to render the outline with a fast rectangle- */ /* drawing routine or to render it segment by segment. */ - GrBox(dbwWindow, &scx->scx_trans, tile); + GrBox(dbwWindow, &scx->scx_trans, tile, dinfo); return 0; } @@ -1075,8 +1076,10 @@ dbwBBoxFunc(scx) */ int -dbwTileFunc(tile) +dbwTileFunc(tile, dinfo, clientdata) Tile *tile; /* A tile to be redisplayed. */ + TileType dinfo; /* Split tile information (unused) */ + ClientData clientdata; /* (unused) */ { Rect r, r2; int xoffset, yoffset; @@ -1113,7 +1116,7 @@ dbwTileFunc(tile) if (dbwSeeTypes) { - (void) sprintf(string, "%s",DBTypeShortName(TiGetType(tile))); + (void) sprintf(string, "%s", DBTypeShortName(TiGetType(tile))); } else { @@ -1129,7 +1132,7 @@ dbwTileFunc(tile) #define XYOFFSET 12 - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { xoffset = 0; yoffset = 0; @@ -1172,13 +1175,13 @@ dbwTileFunc(tile) yoffset = temp; } - if ( (dbwWatchTrans.t_a < 0) || (dbwWatchTrans.t_b < 0) ) + if ((dbwWatchTrans.t_a < 0) || (dbwWatchTrans.t_b < 0)) { /* mirror in x */ xoffset = -xoffset; } - if ( (dbwWatchTrans.t_d < 0) || (dbwWatchTrans.t_e < 0) ) + if ((dbwWatchTrans.t_d < 0) || (dbwWatchTrans.t_e < 0)) { /* mirror in y */ yoffset = -yoffset; diff --git a/dbwind/DBWfdback.c b/dbwind/DBWfdback.c index 8cf3269e..56d392cc 100644 --- a/dbwind/DBWfdback.c +++ b/dbwind/DBWfdback.c @@ -249,7 +249,10 @@ DBWFeedbackRedraw(window, plane) } int -dbwFeedbackAlways1() +dbwFeedbackAlways1( + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { return 1; } diff --git a/dbwind/DBWhlights.c b/dbwind/DBWhlights.c index 06054e4d..e1356c7e 100644 --- a/dbwind/DBWhlights.c +++ b/dbwind/DBWhlights.c @@ -392,8 +392,9 @@ DBWHLRedrawWind(window) */ int -dbwhlEraseFunc(tile, window) +dbwhlEraseFunc(tile, dinfo, window) Tile *tile; /* Tile describing area to be erased. */ + TileType dinfo; /* Split tile information (unused) */ MagWindow *window; /* Window that is being altered. */ { Rect area; diff --git a/dbwind/DBWtools.c b/dbwind/DBWtools.c index 16cbb6be..5722a661 100644 --- a/dbwind/DBWtools.c +++ b/dbwind/DBWtools.c @@ -764,7 +764,10 @@ DBWDrawBox(window, plane) } int -dbwBoxAlways1() +dbwBoxAlways1( + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { return 1; } diff --git a/drc/DRCbasic.c b/drc/DRCbasic.c index 5ae98496..983342a5 100644 --- a/drc/DRCbasic.c +++ b/drc/DRCbasic.c @@ -140,8 +140,9 @@ drcCifPointToSegment(px, py, s1x, s1y, s2x, s2y) */ int -areaCheck(tile, arg) +areaCheck(tile, dinfo, arg) Tile *tile; + TileType dinfo; struct drcClientData *arg; { Rect rect; /* Area where error is to be recorded. */ @@ -195,7 +196,7 @@ areaCheck(tile, arg) - arg->dCD_constraint->r_ytop + sdist) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && !SplitDirection(tile) && !SplitSide(tile)) + else if (IsSplit(tile) && !SplitDirection(tile) && !(dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xbot + sdist, arg->dCD_constraint->r_ytop - sdist, @@ -210,7 +211,7 @@ areaCheck(tile, arg) - arg->dCD_constraint->r_ytop + sdist) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && SplitDirection(tile) && SplitSide(tile)) + else if (IsSplit(tile) && SplitDirection(tile) && (dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xtop - sdist, arg->dCD_constraint->r_ytop - sdist, @@ -226,7 +227,7 @@ areaCheck(tile, arg) + sdist - rect.r_ytop) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && SplitDirection(tile) && !SplitSide(tile)) + else if (IsSplit(tile) && SplitDirection(tile) && !(dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xbot + sdist, arg->dCD_constraint->r_ybot + sdist, @@ -242,7 +243,7 @@ areaCheck(tile, arg) + sdist - rect.r_ytop) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && !SplitDirection(tile) && SplitSide(tile)) + else if (IsSplit(tile) && !SplitDirection(tile) && (dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xtop - sdist, arg->dCD_constraint->r_ybot + sdist, @@ -306,8 +307,9 @@ areaCheck(tile, arg) */ int -areaNMReject(tile, arg) +areaNMReject(tile, dinfo, arg) Tile *tile; + TileType dinfo; ClientData *arg; { Tile *checktile = (Tile *)arg; @@ -337,8 +339,9 @@ areaNMReject(tile, arg) */ int -areaNMCheck(tile, arg) +areaNMCheck(tile, dinfo, arg) Tile *tile; + TileType dinfo; struct drcClientData *arg; { Rect rect; /* Area where error is to be recorded. */ @@ -492,8 +495,9 @@ DRCBasicCheck (celldef, checkRect, clipRect, function, cdata) */ int -drcTile (tile, arg) - Tile *tile; /* Tile being examined */ +drcTile (tile, dinfo, arg) + Tile *tile; /* Tile being examined */ + TileType dinfo; /* Split tile information */ struct drcClientData *arg; { DRCCookie *cptr; /* Current design rule on list */ @@ -533,7 +537,7 @@ drcTile (tile, arg) /* DRC searches only one direction on regular tiles, the split */ /* tiles are only processed for one of the two cases. */ - if (IsSplit(tile) && !SplitSide(tile)) + if (IsSplit(tile) && !(dinfo & TT_SIDE)) { int deltax, deltay; TileType tt, to; @@ -555,7 +559,7 @@ drcTile (tile, arg) { int deltax, deltay, w, h; double r; - TileType dinfo, dsplit; + TileType newdinfo, dsplit; /* Work to be done: Handle triggering rules for non-Manhattan */ /* edges; especially important for the wide-spacing rule. */ @@ -605,7 +609,7 @@ drcTile (tile, arg) if (SplitDirection(tile) == 0) deltay = -deltay; - dinfo = TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION); + newdinfo = TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION); if (!(cptr->drcc_flags & DRC_REVERSE)) { /* Forward case is behind the triangle */ @@ -613,19 +617,19 @@ drcTile (tile, arg) deltay = -deltay; /* Split side changes in the reverse case */ - dinfo |= TT_SIDE; + newdinfo |= TT_SIDE; } /* The area to check is bounded between the diagonals of * tile and errRect (which is the tile area, offset). - * Pass errRect and dinfo to areaNMCheck using the + * Pass errRect and newdinfo to areaNMCheck using the * ClientData structure arg->dCD_rlist and arg->dCD_entries, * which are not used by areaNMCheck. */ arg->dCD_rlist = (Rect *)mallocMagic(sizeof(Rect)); *(arg->dCD_rlist) = errRect; - arg->dCD_entries = dinfo; - if (dinfo & TT_SIDE) + arg->dCD_entries = newdinfo; + if (newdinfo & TT_SIDE) arg->dCD_entries &= ~TT_SIDE; else arg->dCD_entries |= TT_SIDE; @@ -637,7 +641,7 @@ drcTile (tile, arg) errRect.r_ytop += deltay; DBSrPaintNMArea((Tile *) NULL, - arg->dCD_celldef->cd_planes[cptr->drcc_plane], dinfo, + arg->dCD_celldef->cd_planes[cptr->drcc_plane], newdinfo, &errRect, &tmpMask, areaNMCheck, (ClientData) arg); arg->dCD_entries = 0; diff --git a/drc/DRCcif.c b/drc/DRCcif.c index 6275524e..8e32ebb5 100644 --- a/drc/DRCcif.c +++ b/drc/DRCcif.c @@ -603,8 +603,9 @@ drcCifCheck(arg) */ int -drcCifTile (tile, arg) - Tile *tile; /* Tile being examined */ +drcCifTile (tile, dinfo, arg) + Tile *tile; /* Tile being examined */ + TileType dinfo; /* Split tile information */ struct drcClientData *arg; { DRCCookie *cptr; /* Current design rule on list */ @@ -628,7 +629,7 @@ drcCifTile (tile, arg) /* check. */ if (IsSplit(tile)) - if (SplitSide(tile)) + if (dinfo & TT_SIDE) goto tbcheck; /* @@ -826,7 +827,7 @@ tbcheck: /* bottom check. */ if (IsSplit(tile)) - if (SplitSide(tile) == SplitDirection(tile)) + if (((dinfo & TT_SIDE) ? 1 : 0) == SplitDirection(tile)) return 0; /* @@ -1031,8 +1032,9 @@ tbcheck: */ int -areaCifCheck(tile, arg) +areaCifCheck(tile, dinfo, arg) Tile *tile; + TileType dinfo; struct drcClientData *arg; { Rect rect; /* Area where error is to be recorded. */ @@ -1085,7 +1087,7 @@ areaCifCheck(tile, arg) - arg->dCD_constraint->r_ytop + sdist) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && !SplitDirection(tile) && !SplitSide(tile)) + else if (IsSplit(tile) && !SplitDirection(tile) && !(dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xbot + sdist, arg->dCD_constraint->r_ytop - sdist, @@ -1100,7 +1102,7 @@ areaCifCheck(tile, arg) - arg->dCD_constraint->r_ytop + sdist) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && SplitDirection(tile) && SplitSide(tile)) + else if (IsSplit(tile) && SplitDirection(tile) && (dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xtop - sdist, arg->dCD_constraint->r_ytop - sdist, @@ -1116,7 +1118,7 @@ areaCifCheck(tile, arg) + sdist - cifrect.r_ytop) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && SplitDirection(tile) && !SplitSide(tile)) + else if (IsSplit(tile) && SplitDirection(tile) && !(dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xbot + sdist, arg->dCD_constraint->r_ybot + sdist, @@ -1132,7 +1134,7 @@ areaCifCheck(tile, arg) + sdist - cifrect.r_ytop) >= 0) && ((sqx * sqx + sqy * sqy) >= ssdist)) return 0; - else if (IsSplit(tile) && !SplitDirection(tile) && SplitSide(tile)) + else if (IsSplit(tile) && !SplitDirection(tile) && (dinfo & TT_SIDE)) { sstest = drcCifPointToSegment(arg->dCD_constraint->r_xtop - sdist, arg->dCD_constraint->r_ybot + sdist, diff --git a/drc/DRCcontin.c b/drc/DRCcontin.c index 5cc80499..5501bcc4 100644 --- a/drc/DRCcontin.c +++ b/drc/DRCcontin.c @@ -639,9 +639,10 @@ checkDone: /* ARGSUSED */ int -drcCheckTile(tile, arg) - Tile * tile; /* tile in DRC_CHECK plane */ - ClientData arg; /* Not used. */ +drcCheckTile(tile, dinfo, arg) + Tile *tile; /* Tile in DRC_CHECK plane */ + TileType dinfo; /* Split tile information (unused) */ + ClientData arg; /* Not used. */ { Rect square; /* Square area of the checkerboard * being processed right now. @@ -767,13 +768,15 @@ drcCheckTile(tile, arg) */ int -drcXorFunc(tile) +drcXorFunc(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; + ClientData clientdata; { Rect area; TiToRect(tile, &area); - DBPaintPlane(drcDisplayPlane, &area, drcXorTable, (PaintUndoInfo *) NULL); + DBNMPaintPlane(drcDisplayPlane, dinfo, &area, drcXorTable, (PaintUndoInfo *) NULL); return 0; } @@ -782,14 +785,15 @@ drcXorFunc(tile) */ int -drcPutBackFunc(tile, cellDef) +drcPutBackFunc(tile, dinfo, cellDef) Tile *tile; /* Error tile, from drcTempPlane. */ + TileType dinfo; /* Split tile information */ CellDef *cellDef; /* Celldef in which to paint error. */ { Rect area; TiToRect(tile, &area); - DBPaintPlane(cellDef->cd_planes[PL_DRC_ERROR], &area, + DBNMPaintPlane(cellDef->cd_planes[PL_DRC_ERROR], dinfo, &area, DBStdPaintTbl(TiGetType(tile), PL_DRC_ERROR), (PaintUndoInfo *) NULL); return 0; @@ -816,8 +820,9 @@ drcPutBackFunc(tile, cellDef) */ int -drcIncludeArea(tile, rect) +drcIncludeArea(tile, dinfo, rect) Tile *tile; + TileType dinfo; /* (unused) */ Rect *rect; /* Rectangle in which to record total area. */ { Rect dum; diff --git a/drc/DRCextend.c b/drc/DRCextend.c index 38fab13d..5855babb 100644 --- a/drc/DRCextend.c +++ b/drc/DRCextend.c @@ -468,8 +468,9 @@ drcCheckRectSize(starttile, arg, cptr) int MaxRectsExclude( - Tile *tile, - ClientData clientdata) + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { return 1; } diff --git a/drc/DRCmain.c b/drc/DRCmain.c index b7631feb..323d02e5 100644 --- a/drc/DRCmain.c +++ b/drc/DRCmain.c @@ -957,9 +957,10 @@ drcCountFunc(scx, dupTable) } int -drcCountFunc2(tile, countptr) - Tile *tile; /* Tile found in error plane. */ - int *countptr; /* Address of count word. */ +drcCountFunc2(tile, dinfo, countptr) + Tile *tile; /* Tile found in error plane. */ + TileType dinfo; /* Split tile information (unused) */ + int *countptr; /* Address of count word. */ { if (TiGetType(tile) != (TileType) TT_SPACE) (*countptr)++; return 0; @@ -1106,8 +1107,9 @@ drcFindFunc(scx, finddata) } int -drcFindFunc2(tile, finddata) +drcFindFunc2(tile, dinfo, finddata) Tile *tile; /* Tile in error plane. */ + TileType dinfo; /* Split tile information (unused) */ Sindx *finddata; /* Information about error to find */ { diff --git a/drc/DRCsubcell.c b/drc/DRCsubcell.c index 5f698aeb..3c714d3e 100644 --- a/drc/DRCsubcell.c +++ b/drc/DRCsubcell.c @@ -317,7 +317,9 @@ drcSubcellFunc(subUse, dsa) */ int -drcAlwaysOne() +drcAlwaysOne(Tile *tile, + TileType dinfo, + ClientData clientdata) { return 1; } @@ -540,8 +542,9 @@ DRCFindInteractions(def, area, radius, interaction) */ int -drcExactOverlapCheck(tile, arg) +drcExactOverlapCheck(tile, dinfo, arg) Tile *tile; /* Tile to check. */ + TileType dinfo; /* Split tile information (unused) */ struct drcClientData *arg; /* How to detect and process errors. */ { Rect rect; @@ -579,8 +582,9 @@ drcExactOverlapCheck(tile, arg) */ int -drcExactOverlapTile(tile, cxp) +drcExactOverlapTile(tile, dinfo, cxp) Tile *tile; /* Tile that must overlap exactly. */ + TileType dinfo; /* Split tile information (unused) */ TreeContext *cxp; /* Tells how to translate out of subcell. * The client data must be a drcClientData * record, and the caller must have filled diff --git a/extflat/EFantenna.c b/extflat/EFantenna.c index 40537b49..393ddc4b 100644 --- a/extflat/EFantenna.c +++ b/extflat/EFantenna.c @@ -754,8 +754,9 @@ antennacheckVisit( */ int -areaMarkFunc(tile, ams) +areaMarkFunc(tile, dinfo, ams) Tile *tile; + TileType dinfo; AntennaMarkStruct *ams; { Rect rect; @@ -778,8 +779,9 @@ areaMarkFunc(tile, ams) */ int -areaAccumFunc(tile, gdas) +areaAccumFunc(tile, dinfo, gdas) Tile *tile; + TileType dinfo; GateDiffAccumStruct *gdas; { Rect *rect = &(gdas->r); @@ -788,7 +790,7 @@ areaAccumFunc(tile, gdas) /* Avoid double-counting the area of contacts */ if (IsSplit(tile)) - type = SplitSide(tile) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else type = TiGetType(tile); @@ -798,6 +800,7 @@ areaAccumFunc(tile, gdas) TiToRect(tile, rect); area = (dlong)(rect->r_xtop - rect->r_xbot) * (dlong)(rect->r_ytop - rect->r_ybot); + if (IsSplit(tile)) area /= 2; gdas->accum += area; return 0; } @@ -816,8 +819,9 @@ areaAccumFunc(tile, gdas) */ int -antennaAccumFunc(tile, aaptr) +antennaAccumFunc(tile, dinfo, aaptr) Tile *tile; + TileType dinfo; /* Not used, but should be handled */ AntennaAccumStruct *aaptr; { Rect *rect = &(aaptr->r); @@ -1003,6 +1007,7 @@ antennaAccumFunc(tile, aaptr) TiToRect(tile, rect); area = (dlong)(rect->r_xtop - rect->r_xbot) * (dlong)(rect->r_ytop - rect->r_ybot); + if (IsSplit(tile)) area /= 2; typeareas[type] += area; } diff --git a/extract/ExtArray.c b/extract/ExtArray.c index 9262912e..589eb503 100644 --- a/extract/ExtArray.c +++ b/extract/ExtArray.c @@ -714,11 +714,11 @@ extArrayNodeName(np, ha, et1, et2) { Tile *tp; - tp = extNodeToTile(np, et1); + tp = extNodeToTile(np, et1, NULL); if (tp && TiGetType(tp) != TT_SPACE && extHasRegion(tp, extUnInit)) return (extArrayTileToNode(tp, np->nreg_pnum, et1, ha, TRUE)); - tp = extNodeToTile(np, et2); + tp = extNodeToTile(np, et2, NULL); if (tp && TiGetType(tp) != TT_SPACE && extHasRegion(tp, extUnInit)) return (extArrayTileToNode(tp, np->nreg_pnum, et2, ha, TRUE)); diff --git a/extract/ExtBasic.c b/extract/ExtBasic.c index e0d5c002..3d06c32c 100644 --- a/extract/ExtBasic.c +++ b/extract/ExtBasic.c @@ -166,8 +166,9 @@ bool extLabType(); /* that is not in the topmost def of the search. */ int -extFoundFunc(tile, cxp) +extFoundFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; // Unused TreeContext *cxp; { CellDef *def = (CellDef *)cxp->tc_filter->tf_arg; @@ -2113,8 +2114,9 @@ extDevFindParamMatch(devptr, length, width) * ---------------------------------------------------------------------------- */ int -extSDTileFunc(tile, pNum) +extSDTileFunc(tile, dinfo, pNum) Tile *tile; + TileType dinfo; /* (unused) */ int pNum; { LinkedTile *newdevtile; @@ -2143,13 +2145,14 @@ extSDTileFunc(tile, pNum) * ---------------------------------------------------------------------------- */ int -extTransFindTermArea(tile, eapd) +extTransFindTermArea(tile, dinfo, eapd) Tile *tile; + TileType dinfo; ExtAreaPerimData *eapd; { int extTermAPFunc(); /* Forward declaration */ - DBSrConnectOnePlane(tile, DBConnectTbl, extTermAPFunc, (ClientData)eapd); + DBSrConnectOnePlane(tile, dinfo, DBConnectTbl, extTermAPFunc, (ClientData)eapd); return 1; } @@ -2262,13 +2265,13 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData) extTransRec.tr_gatenode; arg.fra_region = (ExtRegion *) reg; arg.fra_each = extTransTileFunc; - ntiles = ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + ntiles = ExtFindNeighbors(reg->treg_tile, reg->treg_type, arg.fra_pNum, &arg); /* Re-mark with extTransRec.tr_gatenode */ arg.fra_uninit = (ClientData) reg; arg.fra_region = (ExtRegion *) extTransRec.tr_gatenode; arg.fra_each = (int (*)()) NULL; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, arg.fra_pNum, &arg); /* Are the terminal types on a compeletely different */ /* plane than the top type? If so, do an area search */ @@ -2345,12 +2348,14 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData)extTransRec.tr_gatenode; arg.fra_region = (ExtRegion *)reg; arg.fra_each = extSDTileFunc; - ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); arg.fra_uninit = (ClientData) reg; arg.fra_region = (ExtRegion *) extTransRec.tr_gatenode; arg.fra_each = (int (*)()) NULL; - ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); for (lt = extSpecialDevice; lt; lt = lt->t_next) { @@ -2672,7 +2677,8 @@ extOutputDevices(def, transList, outFile) arg.fra_region = (ExtRegion *) reg; arg.fra_each = extAnnularTileFunc; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); extSeparateBounds(n - 1); /* Handle MOScaps (if necessary) */ extComputeEffectiveLW(&length, &width, n, @@ -2695,7 +2701,8 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData) reg; arg.fra_region = (ExtRegion *) extTransRec.tr_gatenode; arg.fra_each = (int (*)()) NULL; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); } @@ -2761,7 +2768,8 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData) extTransRec.tr_gatenode; arg.fra_region = (ExtRegion *) reg; arg.fra_each = extAnnularTileFunc; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); if (extComputeCapLW(&length, &width) == FALSE) { @@ -2790,7 +2798,8 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData) reg; arg.fra_region = (ExtRegion *) extTransRec.tr_gatenode; arg.fra_each = (int (*)()) NULL; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); } } @@ -2855,7 +2864,8 @@ extOutputDevices(def, transList, outFile) arg.fra_each = extAnnularTileFunc; else arg.fra_each = extResistorTileFunc; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); if (extSpecialBounds[0] != NULL) { @@ -2892,7 +2902,8 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData) reg; arg.fra_region = (ExtRegion *) extTransRec.tr_gatenode; arg.fra_each = (int (*)()) NULL; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); } else { @@ -3015,7 +3026,8 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData) extTransRec.tr_gatenode; arg.fra_region = (ExtRegion *) reg; arg.fra_each = extAnnularTileFunc; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); if (extComputeCapLW(&length, &width) == FALSE) { @@ -3044,7 +3056,8 @@ extOutputDevices(def, transList, outFile) arg.fra_uninit = (ClientData) reg; arg.fra_region = (ExtRegion *) extTransRec.tr_gatenode; arg.fra_each = (int (*)()) NULL; - (void) ExtFindNeighbors(reg->treg_tile, arg.fra_pNum, &arg); + (void) ExtFindNeighbors(reg->treg_tile, reg->treg_type, + arg.fra_pNum, &arg); } if (devptr->exts_deviceClass == DEV_CSUBCKT) @@ -3173,8 +3186,9 @@ extTransFindSubs(tile, t, mask, def, sn, layerptr) } int -extTransFindSubsFunc1(tile, noderecptr) +extTransFindSubsFunc1(tile, dinfo, noderecptr) Tile *tile; + TileType dinfo; NodeAndType *noderecptr; { TileType type; @@ -3193,7 +3207,7 @@ extTransFindSubsFunc1(tile, noderecptr) tile->ti_ll.p_x, tile->ti_ll.p_y); if (IsSplit(tile)) { - type = (SplitSide(tile)) ? SplitRightType(tile): SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); if (type == TT_SPACE) return 0; /* Ignore space in split tiles */ } else @@ -3232,15 +3246,16 @@ extTransFindId(tile, mask, def, idtypeptr) } int -extTransFindIdFunc1(tile, idtypeptr) +extTransFindIdFunc1(tile, dinfo, idtypeptr) Tile *tile; + TileType dinfo; TileType *idtypeptr; { /* * ID Layer found overlapping device area, so return 1 to halt search. */ if (IsSplit(tile)) - *idtypeptr = (SplitSide(tile)) ? SplitRightType(tile): SplitLeftType(tile); + *idtypeptr = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); else *idtypeptr = TiGetTypeExact(tile); @@ -3350,8 +3365,9 @@ extDevFindMatch(deventry, t) */ int -extTransTileFunc(tile, pNum, arg) +extTransTileFunc(tile, dinfo, pNum, arg) Tile *tile; + TileType dinfo; int pNum; FindRegion *arg; { @@ -3384,7 +3400,7 @@ extTransTileFunc(tile, pNum, arg) */ if (IsSplit(tile)) { - loctype = (SplitSide(tile)) ? SplitRightType(tile): SplitLeftType(tile); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); // return (0); /* Hack alert! We must properly handle diagonals! */ } else @@ -3397,7 +3413,7 @@ extTransTileFunc(tile, pNum, arg) /* The AMD target gcc compile works and the Intel target gcc */ /* compile doesn't! The following code works the same on both. */ - perim = extEnumTilePerim(tile, &mask, pNum, + perim = extEnumTilePerim(tile, dinfo, &mask, pNum, extTransPerimFunc, (ClientData)NULL); extTransRec.tr_perim += perim; @@ -3610,8 +3626,9 @@ extAddSharedDevice(eapd, node) */ int -extTermAPFunc(tile, pNum, eapd) +extTermAPFunc(tile, dinfo, pNum, eapd) Tile *tile; /* Tile extending a device terminal */ + TileType dinfo; /* Split tile information */ int pNum; /* Plane of tile (unused, set to -1) */ ExtAreaPerimData *eapd; /* Area and perimeter totals for terminal */ { @@ -3626,7 +3643,7 @@ extTermAPFunc(tile, pNum, eapd) if (IsSplit(tile)) { int w, h, l; - type = (SplitSide(tile)) ? SplitLeftType(tile): SplitRightType(tile); + type = (dinfo & TT_SIDE) ? SplitLeftType(tile): SplitRightType(tile); w = RIGHT(tile) - LEFT(tile); h = TOP(tile) - BOTTOM(tile); l = w * w + h * h; @@ -3864,7 +3881,10 @@ extTransPerimFunc(bp) eapd.eapd_gatenode = (NodeRegion *)extGetRegion(bp->b_inside); eapd.eapd_shared = NULL; - DBSrConnectOnePlane(bp->b_outside, DBConnectTbl, + /* Fix me: Set dinfo based on split tile and boundary + * direction. + */ + DBSrConnectOnePlane(bp->b_outside, (TileType)0, DBConnectTbl, extTermAPFunc, (ClientData)&eapd); shared = 1; @@ -4005,8 +4025,9 @@ extTransPerimFunc(bp) */ int -extAnnularTileFunc(tile, pNum) +extAnnularTileFunc(tile, dinfo, pNum) Tile *tile; + TileType dinfo; int pNum; { TileTypeBitMask mask; @@ -4018,14 +4039,14 @@ extAnnularTileFunc(tile, pNum) */ if (IsSplit(tile)) { - loctype = (SplitSide(tile)) ? SplitRightType(tile): SplitLeftType(tile); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); } else loctype = TiGetTypeExact(tile); mask = ExtCurStyle->exts_deviceConn[loctype]; TTMaskCom(&mask); - extEnumTilePerim(tile, &mask, pNum, extSpecialPerimFunc, (ClientData) TRUE); + extEnumTilePerim(tile, dinfo, &mask, pNum, extSpecialPerimFunc, (ClientData) TRUE); return (0); } @@ -4054,8 +4075,9 @@ extAnnularTileFunc(tile, pNum) */ int -extResistorTileFunc(tile, pNum) +extResistorTileFunc(tile, dinfo, pNum) Tile *tile; + TileType dinfo; int pNum; { TileTypeBitMask mask; @@ -4068,7 +4090,7 @@ extResistorTileFunc(tile, pNum) */ if (IsSplit(tile)) { - loctype = (SplitSide(tile)) ? SplitRightType(tile): SplitLeftType(tile); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); } else loctype = TiGetTypeExact(tile); @@ -4083,7 +4105,7 @@ extResistorTileFunc(tile, pNum) TTMaskSetMask(&mask, &devptr->exts_deviceSDTypes[0]); TTMaskCom(&mask); - extEnumTilePerim(tile, &mask, pNum, extSpecialPerimFunc, (ClientData)FALSE); + extEnumTilePerim(tile, dinfo, &mask, pNum, extSpecialPerimFunc, (ClientData)FALSE); if (extSpecialBounds[0] != NULL) break; devptr = devptr->exts_next; @@ -4459,13 +4481,15 @@ extLabType(text, typeMask) * Returns a pointer to the tile * * Side effects: - * None. + * The information about which side of a split tile is the node of + * interest is passed back in the "dinfo" pointer. * ---------------------------------------------------------------------------- */ -Tile *extNodeToTile(np, et) +Tile *extNodeToTile(np, et, dinfo) NodeRegion *np; ExtTree *et; + TileType *dinfo; /* Pass back TT_SIDE information here */ { Tile *tp; Plane *myplane; @@ -4476,13 +4500,13 @@ Tile *extNodeToTile(np, et) GOTOPOINT(tp, &np->nreg_ll); PlaneSetHint(myplane, tp); - if (IsSplit(tp)) + if (IsSplit(tp) && (dinfo != NULL)) { TileType tpt = TiGetTypeExact(tp); if ((tpt & TT_LEFTMASK) == (np->nreg_type & TT_LEFTMASK)) - TiSetBody(tp, tpt & ~TT_SIDE); + *dinfo = (TileType)0; else - TiSetBody(tp, tpt | TT_SIDE); + *dinfo = (TileType)TT_SIDE; } return tp; @@ -4510,10 +4534,11 @@ Tile *extNodeToTile(np, et) */ void -extSetNodeNum(reg, plane, tile) +extSetNodeNum(reg, plane, tile, dinfo) LabRegion *reg; int plane; Tile *tile; + TileType dinfo; { TileType type; @@ -4522,14 +4547,14 @@ extSetNodeNum(reg, plane, tile) /* Only consider split tiles if the lower-left-hand corner */ /* is only the type under consideration. */ - if (!SplitSide(tile) && SplitDirection(tile)) - type = SplitSide(tile) ? SplitRightType(tile) : SplitLeftType(tile); + if (!(dinfo & TT_SIDE) && SplitDirection(tile)) + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else { - type = SplitSide(tile) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); /* (Are these type checks necessary?) */ if ((type == TT_SPACE) || !TTMaskHasType(&DBPlaneTypes[plane], type)) - type = SplitSide(tile) ? SplitLeftType(tile) : SplitRightType(tile); + type = (dinfo & TT_SIDE) ? SplitLeftType(tile) : SplitRightType(tile); if ((type == TT_SPACE) || !TTMaskHasType(&DBPlaneTypes[plane], type)) return; } @@ -4583,8 +4608,9 @@ extSetNodeNum(reg, plane, tile) */ ExtRegion * -extTransFirst(tile, arg) +extTransFirst(tile, dinfo, arg) Tile *tile; + TileType dinfo; FindRegion *arg; { TransRegion *reg; @@ -4597,7 +4623,7 @@ extTransFirst(tile, arg) reg->treg_pnum = DBNumPlanes; if (IsSplit(tile)) - reg->treg_type = SplitSide(tile) ? SplitRightType(tile) : SplitLeftType(tile); + reg->treg_type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else reg->treg_type = TiGetTypeExact(tile); @@ -4609,8 +4635,9 @@ extTransFirst(tile, arg) /*ARGSUSED*/ int -extTransEach(tile, pNum, arg) +extTransEach(tile, dinfo, pNum, arg) Tile *tile; + TileType dinfo; /* unused, should be handled */ int pNum; FindRegion *arg; { @@ -4631,7 +4658,7 @@ extTransEach(tile, pNum, arg) if (pNum < reg->treg_pnum) reg->treg_area = 0; - extSetNodeNum((LabRegion *) reg, pNum, tile); + extSetNodeNum((LabRegion *) reg, pNum, tile, dinfo); if (pNum == reg->treg_pnum) reg->treg_area += area; @@ -4769,18 +4796,19 @@ extFindNodes(def, clipArea, subonly) if (!StackEmpty(extNodeStack)) { Tile *tile; + TileType dinfo; int tilePlaneNum; - POPTILE(tile, tilePlaneNum); + POPTILE(tile, dinfo, tilePlaneNum); arg.fra_pNum = tilePlaneNum; - extNodeAreaFunc(tile, &arg); + extNodeAreaFunc(tile, dinfo, &arg); temp_subsnode = (NodeRegion *)arg.fra_region; } else if (ExtCurStyle->exts_globSubstratePlane != -1) { NodeRegion *loc_subsnode; - extNodeAreaFunc((Tile *)NULL, (FindRegion *)&arg); + extNodeAreaFunc((Tile *)NULL, (TileType)0, (FindRegion *)&arg); loc_subsnode = (NodeRegion *)arg.fra_region; loc_subsnode->nreg_pnum = ExtCurStyle->exts_globSubstratePlane; loc_subsnode->nreg_type = TT_SPACE; @@ -4811,8 +4839,9 @@ extFindNodes(def, clipArea, subonly) } int -extSubsFunc(tile, arg) +extSubsFunc(tile, dinfo, arg) Tile *tile; + TileType dinfo; FindRegion *arg; { int pNum; @@ -4823,7 +4852,7 @@ extSubsFunc(tile, arg) if (IsSplit(tile)) { - type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); if (type == TT_SPACE) return 0; /* Should not happen */ } @@ -4834,20 +4863,21 @@ extSubsFunc(tile, arg) smask = &ExtCurStyle->exts_globSubstrateShieldTypes; for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) if (TTMaskIntersect(&DBPlaneTypes[pNum], smask)) - if (DBSrPaintArea((Tile *) NULL, arg->fra_def->cd_planes[pNum], + if (DBSrPaintArea((Tile *)NULL, arg->fra_def->cd_planes[pNum], &tileArea, smask, extSubsFunc3, (ClientData)NULL) != 0) return (0); /* Mark this tile as pending and push it */ - PUSHTILE(tile, arg->fra_pNum); + PUSHTILE(tile, dinfo, arg->fra_pNum); /* That's all we do */ return (0); } int -extSubsFunc2(tile, arg) +extSubsFunc2(tile, dinfo, arg) Tile *tile; + TileType dinfo; // Unused FindRegion *arg; { int pNum; @@ -4878,22 +4908,25 @@ extSubsFunc2(tile, arg) extSubsFunc3, (ClientData)NULL) == 0) { /* Mark this tile as pending and push it */ - PUSHTILE(tile, arg->fra_pNum); + PUSHTILE(tile, dinfo, arg->fra_pNum); } return (0); } int -extSubsFunc3(tile) - Tile *tile; +extSubsFunc3(tile, dinfo, clientdata) + Tile *tile; /* (unused) */ + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { /* Stops the search because something that was not space was found */ return 1; } int -extNodeAreaFunc(tile, arg) +extNodeAreaFunc(tile, dinfo, arg) Tile *tile; + TileType dinfo; FindRegion *arg; { int tilePlaneNum, pNum, len, resistClass, n, nclasses; @@ -4910,7 +4943,7 @@ extNodeAreaFunc(tile, arg) if (tile && IsSplit(tile)) { - type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); if (type == TT_SPACE) return 0; /* Should not happen */ } @@ -4939,12 +4972,12 @@ extNodeAreaFunc(tile, arg) if (tile == NULL) return 1; /* Mark this tile as pending and push it */ - PUSHTILE(tile, arg->fra_pNum); + PUSHTILE(tile, dinfo, arg->fra_pNum); /* Continue processing tiles until there are none left */ while (!StackEmpty(extNodeStack)) { - POPTILE(tile, tilePlaneNum); + POPTILE(tile, dinfo, tilePlaneNum); /* * Since tile was pushed on the stack, we know that it @@ -4960,7 +4993,7 @@ extNodeAreaFunc(tile, arg) if (IsSplit(tile)) { - type = (SplitSide(tile)) ? SplitRightType(tile): + type = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); } else @@ -4982,7 +5015,7 @@ extNodeAreaFunc(tile, arg) * node name that does not depend on any other nodes * in this cell. */ - extSetNodeNum((LabRegion *) reg, tilePlaneNum, tile); + extSetNodeNum((LabRegion *) reg, tilePlaneNum, tile, dinfo); /* * Keep track of the total area of this node, and the @@ -5023,7 +5056,7 @@ extNodeAreaFunc(tile, arg) } /* Find the type on the other side of the tile */ - t = (SplitSide(tile)) ? SplitLeftType(tile): + t = (dinfo & TT_SIDE) ? SplitLeftType(tile): SplitRightType(tile); tres = (DBIsContact(t)) ? DBPlaneToResidue(t, tilePlaneNum) : t; if ((capval = ExtCurStyle->exts_perimCap[residue][tres]) != (CapValue) 0) @@ -5042,7 +5075,8 @@ extNodeAreaFunc(tile, arg) /* Top */ topside: - if (IsSplit(tile) && (SplitSide(tile) ^ SplitDirection(tile))) goto leftside; + if (IsSplit(tile) && (((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) + goto leftside; for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp)) { @@ -5075,7 +5109,7 @@ topside: t = TiGetTypeExact(tp); if (ticlient == extUnInit && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } tres = (DBIsContact(t)) ? DBPlaneToResidue(t, tilePlaneNum) : t; @@ -5088,7 +5122,7 @@ topside: /* Left */ leftside: - if (IsSplit(tile) && SplitSide(tile)) goto bottomside; + if (IsSplit(tile) && (dinfo & TT_SIDE)) goto bottomside; for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp)) { @@ -5121,7 +5155,7 @@ leftside: t = TiGetTypeExact(tp); if (ticlient == extUnInit && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } tres = (DBIsContact(t)) ? DBPlaneToResidue(t, tilePlaneNum) : t; @@ -5134,7 +5168,7 @@ leftside: /* Bottom */ bottomside: - if (IsSplit(tile) && (!(SplitSide(tile) ^ SplitDirection(tile)))) + if (IsSplit(tile) && (!((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) goto rightside; for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp)) @@ -5168,7 +5202,7 @@ bottomside: t = TiGetTypeExact(tp); if (ticlient == extUnInit && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } tres = (DBIsContact(t)) ? DBPlaneToResidue(t, tilePlaneNum) : t; @@ -5181,7 +5215,7 @@ bottomside: /* Right */ rightside: - if (IsSplit(tile) && !SplitSide(tile)) goto donesides; + if (IsSplit(tile) && !(dinfo & TT_SIDE)) goto donesides; for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp)) { @@ -5214,7 +5248,7 @@ rightside: t = TiGetTypeExact(tp); if (ticlient == extUnInit && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } tres = (DBIsContact(t)) ? DBPlaneToResidue(t, tilePlaneNum) : t; @@ -5248,7 +5282,7 @@ donesides: /* tp and tile should have the same geometry for a contact */ if (IsSplit(tile) && IsSplit(tp)) { - if (SplitSide(tile)) + if (dinfo & TT_SIDE) { t = SplitRightType(tp); if (TTMaskHasType(mask, t)) @@ -5284,7 +5318,7 @@ donesides: t = TiGetTypeExact(tp); if (TTMaskHasType(mask, t)) { - PUSHTILE(tp, pNum); + PUSHTILE(tp, (TileType)0, pNum); } } } @@ -5314,7 +5348,7 @@ donesides: if (is_split) DBSrPaintNMArea((Tile *) NULL, arg->fra_def->cd_planes[pNum], - TiGetTypeExact(tile) & + (TiGetTypeExact(tile) | dinfo) & (TT_DIAGONAL | TT_SIDE | TT_DIRECTION), &biggerArea, mask, extNbrPushFunc, (ClientData) &pla); diff --git a/extract/ExtCouple.c b/extract/ExtCouple.c index 6f8d847f..97e88641 100644 --- a/extract/ExtCouple.c +++ b/extract/ExtCouple.c @@ -311,8 +311,9 @@ extOutputCoupling(table, outFile) */ int -extBasicOverlap(tile, ecs) +extBasicOverlap(tile, dinfo, ecs) Tile *tile; + TileType dinfo; extCapStruct *ecs; { int thisType; @@ -325,7 +326,7 @@ extBasicOverlap(tile, ecs) extCoupleStruct ecpls; if (IsSplit(tile)) - thisType = (SplitSide(tile)) ? SplitRightType(tile) : + thisType = ((dinfo & TT_SIDE)) ? SplitRightType(tile) : SplitLeftType(tile); else thisType = TiGetTypeExact(tile); @@ -764,11 +765,12 @@ extSubtractSideOverlap2(tile, sov) */ int -extBasicCouple(tile, ecs) +extBasicCouple(tile, dinfo, ecs) Tile *tile; + TileType dinfo; extCapStruct *ecs; { - (void) extEnumTilePerim(tile, &ExtCurStyle->exts_sideEdges[TiGetType(tile)], + (void) extEnumTilePerim(tile, dinfo, &ExtCurStyle->exts_sideEdges[TiGetType(tile)], ecs->plane, extAddCouple, (ClientData) ecs); return (0); } @@ -1478,11 +1480,7 @@ extWalkTop(area, mask, func, bp, esws) tp = tile; while (RIGHT(tp) > area->r_xbot) { - if (IsSplit(tp)) - ttype = (SplitSide(tp)) ? SplitRightType(tp) : SplitLeftType(tp); - else - ttype = TiGetTypeExact(tp); - + ttype = TiGetBottomType(tp); if (TTMaskHasType(mask, ttype)) { bool lookLeft, lookRight; @@ -1590,11 +1588,7 @@ extWalkBottom(area, mask, func, bp, esws) tp = tile; while (LEFT(tp) < area->r_xtop) { - if (IsSplit(tp)) - ttype = (SplitSide(tp)) ? SplitRightType(tp) : SplitLeftType(tp); - else - ttype = TiGetTypeExact(tp); - + ttype = TiGetTopType(tp); if (TTMaskHasType(mask, ttype)) { bool lookLeft, lookRight; @@ -1702,11 +1696,7 @@ extWalkRight(area, mask, func, bp, esws) tp = tile; while (TOP(tp) > area->r_ybot) { - if (IsSplit(tp)) - ttype = (SplitSide(tp)) ? SplitRightType(tp) : SplitLeftType(tp); - else - ttype = TiGetTypeExact(tp); - + ttype = TiGetLeftType(tp); if (TTMaskHasType(mask, ttype)) { bool lookDown, lookUp; @@ -1814,11 +1804,7 @@ extWalkLeft(area, mask, func, bp, esws) tp = tile; while (BOTTOM(tp) < area->r_ytop) { - if (IsSplit(tp)) - ttype = (SplitSide(tp)) ? SplitRightType(tp) : SplitLeftType(tp); - else - ttype = TiGetTypeExact(tp); - + ttype = TiGetRightType(tp); if (TTMaskHasType(mask, ttype)) { bool lookDown, lookUp; diff --git a/extract/ExtHard.c b/extract/ExtHard.c index a8f5beaf..f4be36ce 100644 --- a/extract/ExtHard.c +++ b/extract/ExtHard.c @@ -71,8 +71,9 @@ bool extHardSetLabel(); */ ExtRegion * -extLabFirst(tile, arg) +extLabFirst(tile, dinfo, arg) Tile *tile; + TileType dinfo; /* (unused) */ FindRegion *arg; { TransRegion *reg; @@ -91,8 +92,9 @@ extLabFirst(tile, arg) /*ARGSUSED*/ int -extLabEach(tile, pNum, arg) +extLabEach(tile, dinfo, pNum, arg) Tile *tile; + TileType dinfo; /* (unused) */ int pNum; FindRegion *arg; { @@ -109,7 +111,7 @@ extLabEach(tile, pNum, arg) TransRegion *reg = (TransRegion *) arg->fra_region; if (reg->treg_area == DBNumPlanes) reg->treg_area = pNum; - extSetNodeNum((LabRegion *)reg, pNum, tile); + extSetNodeNum((LabRegion *)reg, pNum, tile, dinfo); return (0); } diff --git a/extract/ExtHier.c b/extract/ExtHier.c index cd2a1b0a..96e54ff7 100644 --- a/extract/ExtHier.c +++ b/extract/ExtHier.c @@ -69,8 +69,10 @@ Node *extHierNewNode(); /*----------------------------------------------------------------------*/ int -extHierSubShieldFunc(tile) - Tile *tile; +extHierSubShieldFunc(tile, dinfo, clientdata) + Tile *tile; /* (unused) */ + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { return 1; } @@ -325,8 +327,9 @@ extHierConnections(ha, cumFlat, oneFlat) */ int -extHierConnectFunc1(oneTile, ha) +extHierConnectFunc1(oneTile, dinfo, ha) Tile *oneTile; /* Comes from 'oneFlat' in extHierConnections */ + TileType dinfo; /* Split tile information (unused) */ HierExtractArg *ha; /* Extraction context */ { CellDef *cumDef = extHierCumFlat->et_use->cu_def; @@ -475,8 +478,9 @@ extHierConnectFunc1(oneTile, ha) */ int -extHierConnectFunc2(cum, ha) +extHierConnectFunc2(cum, dinfo, ha) Tile *cum; /* Comes from extHierCumFlat->et_use->cu_def */ + TileType dinfo; /* Split tile information */ HierExtractArg *ha; /* Extraction context */ { HashTable *table = &ha->ha_connHash; @@ -507,7 +511,7 @@ extHierConnectFunc2(cum, ha) ttype = TiGetTypeExact(cum); if (IsSplit(cum)) - ttype = (ttype & TT_SIDE) ? SplitRightType(cum) : SplitLeftType(cum); + ttype = (dinfo & TT_SIDE) ? SplitRightType(cum) : SplitLeftType(cum); if (extConnectsTo(ha->hierType, ttype, ExtCurStyle->exts_nodeConn)) { @@ -584,8 +588,9 @@ extHierConnectFunc2(cum, ha) */ int -extHierConnectFunc3(cum, ha) +extHierConnectFunc3(cum, dinfo, ha) Tile *cum; /* Comes from extHierCumFlat->et_use->cu_def */ + TileType dinfo; /* Split tile information */ HierExtractArg *ha; /* Extraction context */ { HashTable *table = &ha->ha_connHash; @@ -616,7 +621,7 @@ extHierConnectFunc3(cum, ha) ttype = TiGetTypeExact(cum); if (IsSplit(cum)) - ttype = (ttype & TT_SIDE) ? SplitRightType(cum) : SplitLeftType(cum); + ttype = (dinfo & TT_SIDE) ? SplitRightType(cum) : SplitLeftType(cum); if (extConnectsTo(ha->hierType, ttype, ExtCurStyle->exts_nodeConn)) { @@ -774,7 +779,7 @@ extHierAdjustments(ha, cumFlat, oneFlat, lookFlat) /* Ignore orphaned nodes (non-Manhattan shards outside the clip box) */ if (np->nreg_pnum == DBNumPlanes) continue; - tp = extNodeToTile(np, lookFlat); + tp = extNodeToTile(np, lookFlat, NULL); /* Ignore regions that do not participate in extraction */ if (!extHasRegion(tp, extUnInit)) continue; @@ -946,8 +951,9 @@ extHierNewNode(he) /*ARGSUSED*/ ExtRegion * -extHierLabFirst(tile, arg) +extHierLabFirst(tile, dinfo, arg) Tile *tile; + TileType dinfo; /* (unused) */ FindRegion *arg; { LabRegion *new; @@ -966,15 +972,16 @@ extHierLabFirst(tile, arg) /*ARGSUSED*/ int -extHierLabEach(tile, pNum, arg) +extHierLabEach(tile, dinfo, pNum, arg) Tile *tile; + TileType dinfo; int pNum; FindRegion *arg; { LabRegion *reg; reg = (LabRegion *) arg->fra_region; - extSetNodeNum(reg, pNum, tile); + extSetNodeNum(reg, pNum, tile, dinfo); return (0); } diff --git a/extract/ExtInter.c b/extract/ExtInter.c index aa302daa..080f241c 100644 --- a/extract/ExtInter.c +++ b/extract/ExtInter.c @@ -270,8 +270,9 @@ extInterSubtreeElement(use, trans, x, y, r) */ int -extInterSubtreeTile(tile, cxp) +extInterSubtreeTile(tile, dinfo, cxp) Tile *tile; + TileType dinfo; TreeContext *cxp; { SearchContext newscx; diff --git a/extract/ExtLength.c b/extract/ExtLength.c index 5b019a96..f245107b 100644 --- a/extract/ExtLength.c +++ b/extract/ExtLength.c @@ -434,8 +434,9 @@ extLengthYank(use, labList) */ int -extLengthLabels(tile, rootUse) - Tile *tile; /* Some tile in extPathDef */ +extLengthLabels(tile, dinfo, rootUse) + Tile *tile; /* Some tile in extPathDef */ + TileType dinfo; /* Split tile information (unused) */ CellUse *rootUse; /* The original root cell */ { char name[MAXNAMESIZE]; @@ -727,8 +728,9 @@ extPathResetClient(tile) */ int -extPathPairFunc(tile, epa) +extPathPairFunc(tile, dinfo, epa) Tile *tile; + TileType dinfo; // Unused struct extPathArg *epa; { Point startPoint; @@ -909,8 +911,9 @@ extPathFlood(tile, p, distance, epa) } int -extPathFloodFunc(dstTile, epfa) +extPathFloodFunc(dstTile, dinfo, epfa) Tile *dstTile; + TileType dinfo; // Unused struct extPathFloodArg *epfa; { Rect srcRect, dstRect; diff --git a/extract/ExtMain.c b/extract/ExtMain.c index 407b5032..ac476302 100644 --- a/extract/ExtMain.c +++ b/extract/ExtMain.c @@ -209,9 +209,10 @@ extIsUsedFunc(use, clientData) */ int -extEnumFunc(tile, plane) - Tile *tile; - int *plane; +extEnumFunc(tile, dinfo, clientdata) + Tile *tile; /* (unused) */ + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { return 1; } @@ -854,7 +855,10 @@ extContainsCellFunc( } int -extContainsPaintFunc() +extContainsPaintFunc( + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { return (1); } diff --git a/extract/ExtNghbors.c b/extract/ExtNghbors.c index 44f027a1..03a0f710 100644 --- a/extract/ExtNghbors.c +++ b/extract/ExtNghbors.c @@ -74,8 +74,9 @@ ClientData extNbrUn; */ int -ExtFindNeighbors(tile, tilePlaneNum, arg) +ExtFindNeighbors(tile, dinfo, tilePlaneNum, arg) Tile *tile; + TileType dinfo; int tilePlaneNum; FindRegion *arg; { @@ -95,15 +96,15 @@ ExtFindNeighbors(tile, tilePlaneNum, arg) extNodeStack = StackNew(64); /* Mark this tile as pending and push it */ - PUSHTILE(tile, tilePlaneNum); + PUSHTILE(tile, dinfo, tilePlaneNum); while (!StackEmpty(extNodeStack)) { - POPTILE(tile, tilePlaneNum); + POPTILE(tile, dinfo, tilePlaneNum); if (IsSplit(tile)) { - type = (SplitSide(tile)) ? SplitRightType(tile): + type = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); } else @@ -126,7 +127,8 @@ ExtFindNeighbors(tile, tilePlaneNum, arg) /* Top */ topside: - if (IsSplit(tile) && (SplitSide(tile) ^ SplitDirection(tile))) goto leftside; + if (IsSplit(tile) && ((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile)) + goto leftside; for (tp = RT(tile); RIGHT(tp) > LEFT(tile); tp = BL(tp)) { if (IsSplit(tp)) @@ -143,14 +145,14 @@ topside: t = TiGetTypeExact(tp); if (TiGetClient(tp) == extNbrUn && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } } /* Left */ leftside: - if (IsSplit(tile) && SplitSide(tile)) goto bottomside; + if (IsSplit(tile) && (dinfo & TT_SIDE)) goto bottomside; for (tp = BL(tile); BOTTOM(tp) < TOP(tile); tp = RT(tp)) { if (IsSplit(tp)) @@ -167,14 +169,14 @@ leftside: t = TiGetTypeExact(tp); if (TiGetClient(tp) == extNbrUn && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } } /* Bottom */ bottomside: - if (IsSplit(tile) && (!(SplitSide(tile) ^ SplitDirection(tile)))) + if (IsSplit(tile) && (!(((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile)))) goto rightside; for (tp = LB(tile); LEFT(tp) < RIGHT(tile); tp = TR(tp)) { @@ -192,14 +194,14 @@ bottomside: t = TiGetTypeExact(tp); if (TiGetClient(tp) == extNbrUn && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } } /* Right */ rightside: - if (IsSplit(tile) && !SplitSide(tile)) goto donesides; + if (IsSplit(tile) && !(dinfo & TT_SIDE)) goto donesides; for (tp = TR(tile); TOP(tp) > BOTTOM(tile); tp = LB(tp)) { if (IsSplit(tp)) @@ -216,7 +218,7 @@ rightside: t = TiGetTypeExact(tp); if (TiGetClient(tp) == extNbrUn && TTMaskHasType(mask, t)) { - PUSHTILE(tp, tilePlaneNum); + PUSHTILE(tp, (TileType)0, tilePlaneNum); } } } @@ -224,7 +226,7 @@ rightside: donesides: /* Apply the client's filter procedure if one exists */ if (arg->fra_each) - if ((*arg->fra_each)(tile, tilePlaneNum, arg)) + if ((*arg->fra_each)(tile, dinfo, tilePlaneNum, arg)) goto fail; /* If this is a contact, visit all the other planes */ @@ -248,7 +250,7 @@ donesides: /* tp and tile should have the same geometry for a contact */ if (IsSplit(tile) && IsSplit(tp)) { - if (SplitSide(tile)) + if (dinfo & TT_SIDE) { t = SplitRightType(tp); if (TTMaskHasType(mask, t)) @@ -283,7 +285,7 @@ donesides: t = TiGetTypeExact(tp); if (TTMaskHasType(mask, t)) { - PUSHTILE(tp, pNum); + PUSHTILE(tp, (TileType)0, pNum); } } } @@ -319,7 +321,7 @@ fail: /* Flush the stack */ while (!StackEmpty(extNodeStack)) { - POPTILE(tile, tilePlaneNum); + POPTILE(tile, dinfo, tilePlaneNum); TiSetClientPTR(tile, arg->fra_region); } return -1; @@ -349,8 +351,9 @@ fail: */ int -extNbrPushFunc(tile, pla) +extNbrPushFunc(tile, dinfo, pla) Tile *tile; + TileType dinfo; PlaneAndArea *pla; { Rect *tileArea; @@ -372,7 +375,7 @@ extNbrPushFunc(tile, pla) } /* Push tile on the stack and mark as being visited */ - PUSHTILE(tile, pla->plane); + PUSHTILE(tile, dinfo, pla->plane); return 0; } diff --git a/extract/ExtPerim.c b/extract/ExtPerim.c index 58cabfe4..424cbeb0 100644 --- a/extract/ExtPerim.c +++ b/extract/ExtPerim.c @@ -81,6 +81,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ int extEnumTilePerim( Tile *tpIn, + TileType dinfo, const TileTypeBitMask *maskp, int pNum, /* Plane of perimeter */ int (*func)(), @@ -100,8 +101,8 @@ extEnumTilePerim( /* Diagonal */ if (IsSplit(tpIn)) { - TileType otype = (SplitSide(tpIn)) ? SplitLeftType(tpIn): SplitRightType(tpIn); - TileType itype = (SplitSide(tpIn)) ? SplitRightType(tpIn): SplitLeftType(tpIn); + TileType otype = (dinfo & TT_SIDE) ? SplitLeftType(tpIn): SplitRightType(tpIn); + TileType itype = (dinfo & TT_SIDE) ? SplitRightType(tpIn): SplitLeftType(tpIn); origType = TiGetTypeExact(tpIn); if (TTMaskHasType(&mask, otype)) { @@ -110,8 +111,9 @@ extEnumTilePerim( perimCorrect = width * width + height * height; perimCorrect = (int)sqrt((double)perimCorrect); } - sides = (SplitSide(tpIn)) ? BD_LEFT : BD_RIGHT; - sides |= (SplitSide(tpIn) == SplitDirection(tpIn)) ? BD_BOTTOM : BD_TOP; + sides = (dinfo & TT_SIDE) ? BD_LEFT : BD_RIGHT; + sides |= (((dinfo & TT_SIDE) ? 1 : 0) == SplitDirection(tpIn)) ? + BD_BOTTOM : BD_TOP; TiSetBody(tpIn, itype); } else diff --git a/extract/ExtRegion.c b/extract/ExtRegion.c index ff216114..8003058e 100644 --- a/extract/ExtRegion.c +++ b/extract/ExtRegion.c @@ -53,6 +53,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ * ExtRegion * * (*first)(tile, arg) * Tile *tile; /# Tile is on plane arg->fra_pNum #/ + * TileType dinfo; /# Split tile information #/ * FindRegion *arg; * { * } @@ -62,6 +63,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ * * (*each)(tile, planeNum, arg) * Tile *tile; + * TileType dinfo; /# Split tile information #/ * int planeNum; /# May be different than arg->fra_pNum #/ * FindRegion *arg; * { @@ -155,19 +157,20 @@ ExtFindRegions(def, area, mask, connectsTo, uninit, first, each) */ int -extRegionAreaFunc(tile, arg) +extRegionAreaFunc(tile, dinfo, arg) Tile *tile; + TileType dinfo; FindRegion *arg; { /* Allocate a new region */ if (arg->fra_first) - (void) (*arg->fra_first)(tile, arg); + (void) (*arg->fra_first)(tile, dinfo, arg); if (DebugIsSet(extDebugID, extDebAreaEnum)) extShowTile(tile, "area enum", 0); /* Recursively visit all tiles surrounding this one that we connect to */ - (void) ExtFindNeighbors(tile, arg->fra_pNum, arg); + (void) ExtFindNeighbors(tile, dinfo, arg->fra_pNum, arg); return (0); } diff --git a/extract/ExtSubtree.c b/extract/ExtSubtree.c index d9a23752..613fc61f 100644 --- a/extract/ExtSubtree.c +++ b/extract/ExtSubtree.c @@ -345,8 +345,9 @@ done: #ifdef exactinteractions int -extSubtreeCopyPlane(tile, plane) +extSubtreeCopyPlane(tile, dinfo, plane) Tile *tile; + TileType dinfo; Plane *plane; { Rect r; @@ -358,8 +359,9 @@ extSubtreeCopyPlane(tile, plane) } int -extSubtreeShrinkPlane(tile, plane) +extSubtreeShrinkPlane(tile, dinfo, plane) Tile *tile; + TileType dinfo; Plane *plane; { Rect r; @@ -374,8 +376,9 @@ extSubtreeShrinkPlane(tile, plane) } int -extSubtreeInterFunc(tile, ha) +extSubtreeInterFunc(tile, dinfo, ha) Tile *tile; + TileType dinfo; HierExtractArg *ha; { TITORECT(tile, &ha->ha_interArea); @@ -690,12 +693,14 @@ extSubtreeOutputCoupling(ha) ck = (CoupleKey *) he->h_key.h_words; - tp = extNodeToTile(ck->ck_1, &ha->ha_cumFlat); - name = extSubtreeTileToNode(tp, ck->ck_1->nreg_pnum, &ha->ha_cumFlat, ha, TRUE); + tp = extNodeToTile(ck->ck_1, &ha->ha_cumFlat, NULL); + name = extSubtreeTileToNode(tp, (TileType)0, ck->ck_1->nreg_pnum, + &ha->ha_cumFlat, ha, TRUE); fprintf(ha->ha_outf, "cap \"%s\" ", name); - tp = extNodeToTile(ck->ck_2, &ha->ha_cumFlat); - name = extSubtreeTileToNode(tp, ck->ck_2->nreg_pnum, &ha->ha_cumFlat, ha, TRUE); + tp = extNodeToTile(ck->ck_2, &ha->ha_cumFlat, NULL); + name = extSubtreeTileToNode(tp, (TileType)0, ck->ck_2->nreg_pnum, + &ha->ha_cumFlat, ha, TRUE); fprintf(ha->ha_outf, "\"%s\" %lg\n", name, cap); } } @@ -713,8 +718,9 @@ extSubtreeOutputCoupling(ha) */ int -extFoundProc(tile, clientData) +extFoundProc(tile, dinfo, clientData) Tile *tile; + TileType dinfo; ClientData clientData; { return 1; @@ -1040,9 +1046,10 @@ extSubstrateFunc(scx, ha) */ char * -extSubtreeTileToNode(tp, pNum, et, ha, doHard) - Tile *tp; /* Tile whose node name is to be found */ - int pNum; /* Plane of the tile */ +extSubtreeTileToNode(tp, dinfo, pNum, et, ha, doHard) + Tile *tp; /* Tile whose node name is to be found */ + TileType dinfo; /* Split tile information */ + int pNum; /* Plane of the tile */ ExtTree *et; /* Yank buffer to search */ HierExtractArg *ha; /* Extraction context */ bool doHard; /* If TRUE, we look up this node's name the hard way @@ -1080,12 +1087,7 @@ extSubtreeTileToNode(tp, pNum, et, ha, doHard) * can cause problems. */ if (IsSplit(tp)) - { - if (SplitSide(tp)) - ttype = SplitRightType(tp); - else - ttype = SplitLeftType(tp); - } + ttype = (dinfo & TT_SIDE) ? SplitRightType(tp) : SplitLeftType(tp); else ttype = TiGetTypeExact(tp); @@ -1120,7 +1122,7 @@ extSubtreeTileToNode(tp, pNum, et, ha, doHard) /* We have to do it the hard way */ if (!doHard) return ((char *) NULL); if (extHasRegion(tp, extUnInit) - && (reg = extSubtreeHardNode(tp, pNum, et, ha))) + && (reg = extSubtreeHardNode(tp, dinfo, pNum, et, ha))) { if (ExtDoWarn & EXTWARN_LABELS) { @@ -1154,13 +1156,14 @@ extSubtreeTileToNode(tp, pNum, et, ha, doHard) */ int -extConnFindFunc(tp, preg) +extConnFindFunc(tp, dinfo, preg) Tile *tp; + TileType dinfo; // Unused, but needs to be handled LabRegion **preg; { if (extHasRegion(tp, extUnInit)) { - *preg = (LabRegion *) extGetRegion(tp); + *preg = (LabRegion *)extGetRegion(tp); return (1); } @@ -1198,8 +1201,9 @@ extConnFindFunc(tp, preg) */ LabRegion * -extSubtreeHardNode(tp, pNum, et, ha) +extSubtreeHardNode(tp, dinfo, pNum, et, ha) Tile *tp; + TileType dinfo; int pNum; ExtTree *et; HierExtractArg *ha; @@ -1215,7 +1219,7 @@ extSubtreeHardNode(tp, pNum, et, ha) if (IsSplit(tp)) { - if (SplitSide(tp)) + if (dinfo & TT_SIDE) ttype = SplitRightType(tp); else ttype = SplitLeftType(tp); diff --git a/extract/ExtTest.c b/extract/ExtTest.c index 92b7743d..80ea15bf 100644 --- a/extract/ExtTest.c +++ b/extract/ExtTest.c @@ -316,8 +316,10 @@ ExtractTest(w, cmd) } int -extShowInter(tile) +extShowInter(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { Rect r; diff --git a/extract/ExtTimes.c b/extract/ExtTimes.c index 3cdaf178..747c7236 100644 --- a/extract/ExtTimes.c +++ b/extract/ExtTimes.c @@ -396,8 +396,9 @@ extTimesCellFunc(cs) */ int -extCountTiles(tile, cs) - Tile *tile; /* UNUSED */ +extCountTiles(tile, dinfo, cs) + Tile *tile; /* (unused) */ + TileType dinfo; /* (unused) */ struct cellStats *cs; { cs->cs_rects++; @@ -1115,8 +1116,9 @@ extInterAreaFunc(use, f) } int -extInterCountFunc(tile, pArea) +extInterCountFunc(tile, dinfo, pArea) Tile *tile; + TileType dinfo; /* (unused) */ int *pArea; { Rect r; diff --git a/extract/extract.h b/extract/extract.h index 72748778..fd3d27ea 100644 --- a/extract/extract.h +++ b/extract/extract.h @@ -108,7 +108,7 @@ extern void ExtGetZAxis(); extern void ExtDumpCaps(); -extern int extEnumTilePerim(Tile *tpIn, const TileTypeBitMask *maskp, int pNum, int (*func)(), ClientData cdata); +extern int extEnumTilePerim(Tile *tpIn, TileType dinfo, const TileTypeBitMask *maskp, int pNum, int (*func)(), ClientData cdata); extern Plane *extPrepSubstrate(); /* C99 compat */ diff --git a/extract/extractInt.h b/extract/extractInt.h index ff4711b7..ead7658f 100644 --- a/extract/extractInt.h +++ b/extract/extractInt.h @@ -989,44 +989,43 @@ extern ClientData extUnInit; /* because the search algorithm can overwrite it between the */ /* time the tile is pushed and the time that it is popped. */ -#define PUSHTILE(tp, pl) \ +#define PUSHTILE(tp, di, pl) \ (tp)->ti_client = VISITPENDING; \ - STACKPUSH((ClientData)(pointertype)(pl | \ - ((TileType)(spointertype)(tp)->ti_body & TT_SIDE)), extNodeStack); \ + STACKPUSH((ClientData)(pointertype)pl, extNodeStack); \ + STACKPUSH((ClientData)(pointertype)di, extNodeStack); \ STACKPUSH((ClientData)(pointertype)tp, extNodeStack) -#define POPTILE(tp, pl) \ +#define POPTILE(tp, di, pl) \ tp = (Tile *) STACKPOP(extNodeStack); \ - pl = (spointertype) STACKPOP(extNodeStack); \ - if (pl & TT_SIDE) { \ - TiSetBody((tp), TiGetTypeExact(tp) | TT_SIDE); \ - pl &= (~TT_SIDE); \ - } \ - else \ - TiSetBody((tp), TiGetTypeExact(tp) & (~TT_SIDE)) + di = (spointertype) STACKPOP(extNodeStack); \ + pl = (spointertype) STACKPOP(extNodeStack) /* Variations of "pushtile" to force a specific value on TT_SIDE */ #define PUSHTILEBOTTOM(tp, pl) \ (tp)->ti_client = VISITPENDING; \ - STACKPUSH((ClientData)(pointertype)(pl | \ - ((SplitDirection(tp)) ? 0 : TT_SIDE)), extNodeStack) ;\ + STACKPUSH((ClientData)(pointertype)pl, extNodeStack); \ + STACKPUSH((ClientData)(pointertype) \ + ((SplitDirection(tp)) ? 0 : TT_SIDE), extNodeStack) ;\ STACKPUSH((ClientData)(pointertype)tp, extNodeStack) #define PUSHTILETOP(tp, pl) \ (tp)->ti_client = VISITPENDING; \ - STACKPUSH((ClientData)(pointertype)(pl | \ - ((SplitDirection(tp)) ? TT_SIDE : 0)), extNodeStack) ;\ + STACKPUSH((ClientData)(pointertype)pl, extNodeStack); \ + STACKPUSH((ClientData)(pointertype) \ + ((SplitDirection(tp)) ? TT_SIDE : 0), extNodeStack) ;\ STACKPUSH((ClientData)(pointertype)tp, extNodeStack) #define PUSHTILELEFT(tp, pl) \ (tp)->ti_client = VISITPENDING; \ STACKPUSH((ClientData)(pointertype)(pl), extNodeStack); \ + STACKPUSH((ClientData)(pointertype)0, extNodeStack); \ STACKPUSH((ClientData)(pointertype)tp, extNodeStack) #define PUSHTILERIGHT(tp, pl) \ (tp)->ti_client = VISITPENDING; \ - STACKPUSH((ClientData)(pointertype)(pl | TT_SIDE), extNodeStack); \ + STACKPUSH((ClientData)(pointertype)pl, extNodeStack); \ + STACKPUSH((ClientData)(pointertype)TT_SIDE, extNodeStack); \ STACKPUSH((ClientData)(pointertype)tp, extNodeStack) /* ------------------------- Region finding --------------------------- */ @@ -1058,7 +1057,7 @@ extern Tile *extNodeToTile(); Tile *tp; \ \ (nnew) = (NodeRegion *) NULL; \ - tp = extNodeToTile((nold), (et)); \ + tp = extNodeToTile((nold), (et), (TileType)NULL); \ if (tp && extHasRegion(tp, extUnInit)) \ (nnew) = (NodeRegion *) extGetRegion(tp); \ } diff --git a/garouter/gaChannel.c b/garouter/gaChannel.c index 56e4432e..d1ea44cf 100644 --- a/garouter/gaChannel.c +++ b/garouter/gaChannel.c @@ -482,8 +482,9 @@ gaPropagateBlockages(list) */ int -gaSetClient(tile, cdata) +gaSetClient(tile, dinfo, cdata) Tile *tile; + TileType dinfo; /* (unused) */ ClientData cdata; { tile->ti_client = (ClientData) cdata; @@ -511,8 +512,9 @@ gaSetClient(tile, cdata) */ int -gaSplitTile(tile, r) +gaSplitTile(tile, dinfo, r) Tile *tile; + TileType dinfo; /* (unused) */ Rect *r; { Tile *tp; @@ -632,7 +634,7 @@ gaInitRiverBlockages(routeUse, ch) } int -gaAlwaysOne() +gaAlwaysOne(Tile *tile, TileType dinfo, ClientData clientdata) { return (1); } diff --git a/garouter/gaSimple.c b/garouter/gaSimple.c index eafb98bd..c3b82e93 100644 --- a/garouter/gaSimple.c +++ b/garouter/gaSimple.c @@ -572,8 +572,9 @@ gaIsClear(use, r, mask) */ int -gaIsClearFunc(tile, cxp) +gaIsClearFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; TreeContext *cxp; { return 1; diff --git a/garouter/gaStem.c b/garouter/gaStem.c index 58f4e951..88ddaf00 100644 --- a/garouter/gaStem.c +++ b/garouter/gaStem.c @@ -322,6 +322,7 @@ overlap: } /* + * ---------------------------------------------------------------------------- * gaStemContainingChannelFunc -- * * Called via DBSrPaintArea on behalf of gaStemContainingChannel above @@ -341,8 +342,9 @@ overlap: */ int -gaStemContainingChannelFunc(tile, pCh) +gaStemContainingChannelFunc(tile, dinfo, pCh) Tile *tile; + TileType dinfo; /* (unused) */ GCRChannel **pCh; { GCRChannel *ch; diff --git a/garouter/gaTest.c b/garouter/gaTest.c index 3e6eca29..6fbb020f 100644 --- a/garouter/gaTest.c +++ b/garouter/gaTest.c @@ -254,8 +254,9 @@ GAGenChans(chanType, area, f) */ int -gaSplitOut(tile, f) +gaSplitOut(tile, dinfo, f) Tile *tile; + TileType dinfo; /* (unused) */ FILE *f; { Rect r; diff --git a/graphics/W3Dmain.c b/graphics/W3Dmain.c index b6a4bf42..0fb2cc3f 100644 --- a/graphics/W3Dmain.c +++ b/graphics/W3Dmain.c @@ -231,9 +231,10 @@ w3dFillDiagonal(x1, y1, x2, y2, ztop, zbot) } void -w3dFillOps(trans, tile, cliprect, ztop, zbot) +w3dFillOps(trans, tile, dinfo, cliprect, ztop, zbot) Transform *trans; Tile *tile; + TileType dinfo; Rect *cliprect; float ztop; float zbot; @@ -254,15 +255,15 @@ w3dFillOps(trans, tile, cliprect, ztop, zbot) if (IsSplit(tile)) { Rect fullr; - TileType dinfo; + TileType newdinfo; - dinfo = DBTransformDiagonal(TiGetTypeExact(tile), trans); + newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, trans); fullr = r; if (cliprect != NULL) GeoClip(&r, cliprect); - GrClipTriangle(&fullr, &r, cliprect != NULL, dinfo, p, &np); + GrClipTriangle(&fullr, &r, cliprect != NULL, newdinfo, p, &np); if (np > 0) { @@ -289,7 +290,7 @@ w3dFillOps(trans, tile, cliprect, ztop, zbot) /* Find tile outline and render sides */ - if (GrBoxOutline(tile, &tilesegs)) + if (GrBoxOutline(tile, dinfo, &tilesegs)) { xbot = (float)r.r_xbot; ybot = (float)r.r_ybot; @@ -380,8 +381,9 @@ w3dFillOps(trans, tile, cliprect, ztop, zbot) } void -w3dRenderVolume(tile, trans, cliprect) +w3dRenderVolume(tile, dinfo, trans, cliprect) Tile *tile; + TileType dinfo; Transform *trans; Rect *cliprect; { @@ -403,7 +405,7 @@ w3dRenderVolume(tile, trans, cliprect) if ((grCurFill == GR_STSOLID) || (grCurFill == GR_STSTIPPLE)) { - w3dFillOps(trans, tile, cliprect, ztop, zbot); + w3dFillOps(trans, tile, dinfo, cliprect, ztop, zbot); } /* To do: Outlines and contact crosses */ @@ -411,8 +413,9 @@ w3dRenderVolume(tile, trans, cliprect) } void -w3dRenderCIF(tile, layer, trans) +w3dRenderCIF(tile, dinfo, layer, trans) Tile *tile; + TileType dinfo; CIFLayer *layer; Transform *trans; { @@ -435,7 +438,7 @@ w3dRenderCIF(tile, layer, trans) if ((grCurFill == GR_STSOLID) || (grCurFill == GR_STSTIPPLE)) { - w3dFillOps(trans, tile, NULL, ztop, zbot); + w3dFillOps(trans, tile, dinfo, NULL, ztop, zbot); } /* To do: Outlines */ @@ -543,8 +546,9 @@ w3dSetProjection(w) /* Magic layer tile painting function */ int -w3dPaintFunc(tile, cxp) +w3dPaintFunc(tile, dinfo, cxp) Tile *tile; /* Tile to be displayed */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* From DBTreeSrTiles */ { SearchContext *scx = cxp->tc_scx; @@ -582,15 +586,16 @@ w3dPaintFunc(tile, cxp) w3dNeedStyle = FALSE; } - w3dRenderVolume(tile, &scx->scx_trans, &scx->scx_area); + w3dRenderVolume(tile, dinfo, &scx->scx_trans, &scx->scx_area); return 0; /* keep the search going! */ } /* CIF layer tile painting function */ int -w3dCIFPaintFunc(tile, arg) +w3dCIFPaintFunc(tile, dinfo, arg) Tile *tile; /* Tile to be displayed */ + TileType dinfo; /* Split tile information */ ClientData *arg; /* is NULL */ { CIFLayer *layer = (CIFLayer *)arg; @@ -626,7 +631,7 @@ w3dCIFPaintFunc(tile, arg) w3dNeedStyle = FALSE; } - w3dRenderCIF(tile, layer, &GeoIdentityTransform); + w3dRenderCIF(tile, dinfo, layer, &GeoIdentityTransform); return 0; /* keep the search going! */ } diff --git a/graphics/grClip.c b/graphics/grClip.c index 680f68c9..42378a9d 100644 --- a/graphics/grClip.c +++ b/graphics/grClip.c @@ -571,8 +571,9 @@ grAddSegment(llx, lly, urx, ury, segments) */ bool -GrBoxOutline(tile, tilesegs) +GrBoxOutline(tile, dinfo, tilesegs) Tile *tile; + TileType dinfo; LinkedRect **tilesegs; { Rect rect; @@ -586,7 +587,7 @@ GrBoxOutline(tile, tilesegs) *tilesegs = NULL; TiToRect(tile, &rect); - if (IsSplit(tile) && SplitSide(tile)) + if (IsSplit(tile) && (dinfo & TT_SIDE)) isolate |= 0x1; else { @@ -620,7 +621,7 @@ GrBoxOutline(tile, tilesegs) } } } - if (IsSplit(tile) && !SplitSide(tile)) + if (IsSplit(tile) && !(dinfo & TT_SIDE)) isolate |= 0x2; else { @@ -656,7 +657,7 @@ GrBoxOutline(tile, tilesegs) } if (IsSplit(tile) && - (SplitSide(tile) == SplitDirection(tile))) + (((dinfo & TT_SIDE) ? 1 : 0) == SplitDirection(tile))) isolate |= 0x4; else { @@ -692,7 +693,7 @@ GrBoxOutline(tile, tilesegs) } if (IsSplit(tile) && - (SplitSide(tile) != SplitDirection(tile))) + (((dinfo & TT_SIDE) ? 1 : 0) != SplitDirection(tile))) isolate |= 0x8; else { @@ -773,7 +774,7 @@ GrBoxOutline(tile, tilesegs) *--------------------------------------------------------- */ void -GrBox(MagWindow *mw, Transform *trans, Tile *tile) +GrBox(MagWindow *mw, Transform *trans, Tile *tile, TileType dinfo) { Rect r, r2, clipr; bool needClip, needObscure, simpleBox; @@ -813,16 +814,16 @@ GrBox(MagWindow *mw, Transform *trans, Tile *tile) if (IsSplit(tile)) { /* Perform matrix transformations on split tiles */ - TileType dinfo; + TileType newdinfo; Rect fullr; - dinfo = DBTransformDiagonal(TiGetTypeExact(tile), trans); + newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, trans); clipr = fullr = r; if (needClip) GeoClip(&clipr, &grCurClip); - GrClipTriangle(&fullr, &clipr, needClip, dinfo, polyp, &np); + GrClipTriangle(&fullr, &clipr, needClip, newdinfo, polyp, &np); if ((grCurFill == GR_STSOLID) || (grCurFill == GR_STSTIPPLE) || (grCurFill == GR_STGRID) ) @@ -891,7 +892,7 @@ GrBox(MagWindow *mw, Transform *trans, Tile *tile) if (grCurOutline != 0) { - if (GrBoxOutline(tile, &tilesegs)) + if (GrBoxOutline(tile, dinfo, &tilesegs)) { /* simple box (from GrFastBox)*/ diff --git a/grouter/grouteChan.c b/grouter/grouteChan.c index 29b8f98d..081861cb 100644 --- a/grouter/grouteChan.c +++ b/grouter/grouteChan.c @@ -235,8 +235,10 @@ glChanBuildMap(chanList) */ int -glChanFeedFunc(tile) +glChanFeedFunc(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { char *mesg; Rect r; @@ -342,8 +344,9 @@ glChanCheckCover(chanList, mask) */ int -glChanCheckFunc(tile, ch) +glChanCheckFunc(tile, dinfo, ch) Tile *tile; + TileType dinfo; /* (unused) */ GCRChannel *ch; { char mesg[1024]; @@ -454,8 +457,10 @@ glChanShowTiles(mesg) } int -glChanShowFunc(tile) +glChanShowFunc(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { GCRChannel *ch; char mesg[1024]; @@ -498,8 +503,9 @@ glChanShowFunc(tile) */ int -glChanClipFunc(tile, area) +glChanClipFunc(tile, dinfo, area) Tile *tile; + TileType dinfo; /* (unused) */ Rect *area; { ClientData tileClient = tile->ti_client; @@ -567,8 +573,10 @@ glChanClipFunc(tile, area) */ int -glChanMergeFunc(tile) +glChanMergeFunc(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { GCRChannel *ch = (GCRChannel *) tile->ti_client; Tile *delayed = NULL; /* delayed free to extend lifetime */ @@ -774,8 +782,9 @@ glChanBlockDens(ch) } int -glChanPaintFunc(tile, type) +glChanPaintFunc(tile, dinfo, type) Tile *tile; + TileType dinfo; /* (unused) */ TileType type; { static TileType changeTable[4][4] = { @@ -869,8 +878,9 @@ glChanFlood(area, type) } int -glChanFloodVFunc(tile, area) +glChanFloodVFunc(tile, dinfo, area) Tile *tile; + TileType dinfo; /* (unused) */ Rect *area; { PaintArea *pa; @@ -888,8 +898,9 @@ glChanFloodVFunc(tile, area) } int -glChanFloodHFunc(tile, area) +glChanFloodHFunc(tile, dinfo, area) Tile *tile; + TileType dinfo; /* (unused) */ Rect *area; { PaintArea *pa; @@ -928,8 +939,10 @@ glChanFloodHFunc(tile, area) */ int -glChanSplitRiver(tile) +glChanSplitRiver(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { ClientData tileClient = tile->ti_client; Tile *tp, *newTile; @@ -1009,8 +1022,10 @@ glChanSplitRiver(tile) */ int -glChanRiverBlock(tile) +glChanRiverBlock(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { GCRPin *pin, *pinLast; GCRChannel *ch; diff --git a/lef/defRead.c b/lef/defRead.c index e103e883..61d3a8b1 100644 --- a/lef/defRead.c +++ b/lef/defRead.c @@ -1010,6 +1010,7 @@ DefReadNonDefaultRules( int defFoundOneFunc( Tile *tile, + TileType dinfo, /* (unused) */ Tile **tret) { *tret = tile; diff --git a/lef/defWrite.c b/lef/defWrite.c index 88659873..ba877b33 100644 --- a/lef/defWrite.c +++ b/lef/defWrite.c @@ -668,7 +668,9 @@ defnodeVisit( TileType magictype; LinkedRect *lr; EFNodeName *thisnn; - int defNetGeometryFunc(Tile *tile, int plane, DefData *defdata); /* Forward declaration */ + + /* Forward declaration */ + int defNetGeometryFunc(Tile *tile, TileType dinfo, int plane, DefData *defdata); /* For regular nets, only count those nodes having port */ /* connections. For special nets, only count those nodes */ @@ -781,7 +783,9 @@ defnodeVisit( Rect rport; SearchContext scx; - int defPortTileFunc(Tile *tile, TreeContext *cx); /* Fwd declaration */ + + /* Forward declaration */ + int defPortTileFunc(Tile *tile, TileType dinfo, TreeContext *cx); scx.scx_area = node->efnode_loc; scx.scx_use = def->cd_parents; @@ -842,6 +846,7 @@ defnodeVisit( int defMaxWireFunc( Tile *tile, + TileType dinfo, /* (unused) */ int *yclip) { if (BOTTOM(tile) < (*yclip)) *yclip = BOTTOM(tile); @@ -854,6 +859,7 @@ defMaxWireFunc( int defMinWireFunc( Tile *tile, + TileType dinfo, /* (unused) */ int *yclip) { if (TOP(tile) > (*yclip)) *yclip = TOP(tile); @@ -871,6 +877,7 @@ defMinWireFunc( int defExemptWireFunc( Tile *tile, + TileType dinfo, /* (unused) */ Rect *rect) { Rect r; @@ -896,6 +903,7 @@ defExemptWireFunc( int defPortTileFunc( Tile *tile, + TileType dinfo, /* (unused) */ TreeContext *cx) { SearchContext *scx = cx->tc_scx; @@ -921,6 +929,7 @@ defPortTileFunc( int defNetGeometryFunc( Tile *tile, /* Tile being visited */ + TileType dinfo, /* Split tile information (unused) */ int plane, /* Plane of the tile being visited */ DefData *defdata) /* Data passed to this function */ { @@ -1654,7 +1663,9 @@ defCountVias( TileType ttype, stype; int pNum; CViaData cviadata; - int defCountViaFunc(Tile *tile, CViaData *cviadata); + + /* Forward declaration */ + int defCountViaFunc(Tile *tile, TileType dinfo, CViaData *cviadata); cviadata.scale = oscale; cviadata.total = 0; @@ -1699,7 +1710,9 @@ defCountVias( int defCheckFunc( - Tile *tile) + Tile *tile, + TileType dinfo, /* (unused) */ + ClientData clientdata) /* (unused) */ { return 1; } @@ -1709,6 +1722,7 @@ defCheckFunc( int defCountViaFunc( Tile *tile, + TileType dinfo, /* (unused) */ CViaData *cviadata) { TileType ttype = TiGetType(tile), ctype, rtype; @@ -2459,7 +2473,8 @@ defWriteBlockages( HashEntry *he; TileTypeBitMask ExtraObsLayersMask; - int defSimpleBlockageFunc(Tile *tile, DefObsData *defobsdata); /* Forward declaration */ + /* Forward declarations */ + int defSimpleBlockageFunc(Tile *tile, TileType dinfo, DefObsData *defobsdata); int defblockageVisit(EFNode *node, int res, EFCapValue cap, DefObsData *defobsdata); defobsdata.def = rootDef; @@ -2680,9 +2695,10 @@ defBlockageGeometryFunc( int defSimpleBlockageFunc( Tile *tile, /* Tile being visited */ + TileType dinfo, /* Split tile information */ DefObsData *defobsdata) /* Data passed to this function */ { - TileType ttype = TiGetTypeExact(tile); + TileType ttype = TiGetTypeExact(tile) | dinfo; TileType loctype; Rect r; LinkedRect *lr; diff --git a/lef/lefRead.c b/lef/lefRead.c index 91e304b6..48659397 100644 --- a/lef/lefRead.c +++ b/lef/lefRead.c @@ -1156,6 +1156,7 @@ typedef struct _plane_type { int lefConnectFunc( Tile *tile, + TileType dinfo, // Not handled, but should be. TreeContext *cxp) { SearchContext *scx = cxp->tc_scx; @@ -1189,7 +1190,8 @@ lefConnectFunc( int lefUnconnectFunc( - Tile *tile, + Tile *tile, /* (unused) */ + TileType dinfo, /* (unused) */ ClientData clientdata) /* (unused) */ { return 1; diff --git a/lef/lefWrite.c b/lef/lefWrite.c index a82f60de..98b20418 100644 --- a/lef/lefWrite.c +++ b/lef/lefWrite.c @@ -499,6 +499,7 @@ typedef struct int lefEraseGeometry( Tile *tile, + TileType dinfo, ClientData cdata) { lefClient *lefdata = (lefClient *)cdata; @@ -508,7 +509,7 @@ lefEraseGeometry( TiToRect(tile, &area); - otype = TiGetTypeExact(tile); + otype = TiGetTypeExact(tile) | dinfo; if (IsSplit(tile)) ttype = (otype & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); @@ -541,6 +542,7 @@ lefEraseGeometry( int lefGetBound( Tile *tile, + TileType dinfo, /* (unused) */ ClientData cdata) { Rect *boundary = (Rect *)cdata; @@ -569,6 +571,7 @@ lefGetBound( int lefHasPaint( Tile *tile, + TileType dinfo, ClientData clientData) { return 1; @@ -588,14 +591,18 @@ lefHasPaint( int lefAccumulateArea( Tile *tile, + TileType dinfo, /* (unused) */ ClientData cdata) { int *area = (int *)cdata; + int locarea; Rect rarea; TiToRect(tile, &rarea); - *area += (rarea.r_xtop - rarea.r_xbot) * (rarea.r_ytop - rarea.r_ybot); + locarea = (rarea.r_xtop - rarea.r_xbot) * (rarea.r_ytop - rarea.r_ybot); + if (IsSplit(tile)) locarea /= 2; + *area += locarea; return 0; } @@ -614,6 +621,7 @@ lefAccumulateArea( int lefFindTopmost( Tile *tile, + TileType dinfo, ClientData cdata) { return 1; /* Stop processing on the first tile found */ @@ -636,6 +644,7 @@ lefFindTopmost( int lefYankGeometry( Tile *tile, + TileType dinfo, ClientData cdata) { lefClient *lefdata = (lefClient *)cdata; @@ -648,7 +657,7 @@ lefYankGeometry( /* Ignore marked tiles */ if (TiGetClient(tile) != CLIENTDEFAULT) return 0; - otype = TiGetTypeExact(tile); + otype = TiGetTypeExact(tile) | dinfo; if (IsSplit(tile)) ttype = (otype & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); @@ -727,6 +736,7 @@ lefYankGeometry( int lefYankContacts( Tile *tile, + TileType dinfo, /* (unused) */ ClientData cdata) { lefClient *lefdata = (lefClient *)cdata; @@ -795,13 +805,14 @@ lefYankContacts( int lefWriteGeometry( Tile *tile, + TileType dinfo, ClientData cdata) { lefClient *lefdata = (lefClient *)cdata; FILE *f = lefdata->file; float scale = lefdata->oscale; char leffmt[6][16]; - TileType ttype, otype = TiGetTypeExact(tile); + TileType ttype, otype = TiGetTypeExact(tile) | dinfo; LefMapping *lefMagicToLefLayer = lefdata->lefMagicMap; /* Ignore tiles that have already been output */ diff --git a/lisp/lispMagic.c b/lisp/lispMagic.c index 862a340d..e94e8398 100644 --- a/lisp/lispMagic.c +++ b/lisp/lispMagic.c @@ -169,8 +169,9 @@ LispGetPoint (name,s,f) *----------------------------------------------------------------------------- */ static int -lispprinttile (tile,cxp) +lispprinttile (tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { TileType type; diff --git a/mzrouter/mzBlock.c b/mzrouter/mzBlock.c index d9e4bbdf..afb5baa7 100644 --- a/mzrouter/mzBlock.c +++ b/mzrouter/mzBlock.c @@ -234,9 +234,9 @@ mzBuildMaskDataBlocks(buildArea) */ int -mzBuildBlockFunc(tile, cxp) - +mzBuildBlockFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; // Unused TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; @@ -317,7 +317,7 @@ mzBlockSubcellsFunc(scx, cdarg) */ int -mzPaintSameNodeFunc(Tile *t, Rect *buildArea) +mzPaintSameNodeFunc(Tile *t, TileType dinfo, Rect *buildArea) { Rect r; TileType ttype; @@ -580,8 +580,9 @@ mzBuildFenceBlocks(buildArea) */ int -mzBuildFenceBlocksFunc(tile, buildArea) +mzBuildFenceBlocksFunc(tile, dinfo, buildArea) Tile *tile; + TileType dinfo; Rect *buildArea; /* clip to this area before painting */ { RouteType *rT; @@ -723,8 +724,9 @@ mzExtendBlockBoundsR(rect) */ int -mzExtendBlockFunc(tile, cdarg) +mzExtendBlockFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; ClientData cdarg; { Rect area; @@ -932,8 +934,9 @@ mzBuildDestAreaBlocks() */ int -mzDestAreaFunc(tile, cxp) +mzDestAreaFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; @@ -1011,8 +1014,9 @@ mzDestAreaFunc(tile, cxp) */ int -mzDestWalksFunc(tile, cxp) +mzDestWalksFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; @@ -1096,8 +1100,9 @@ mzDestWalksFunc(tile, cxp) */ int -mzHWalksFunc(tile, cdarg) +mzHWalksFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; ClientData cdarg; { RouteType *rT = (RouteType *) cdarg; @@ -1184,8 +1189,9 @@ mzHWalksFunc(tile, cdarg) */ int -mzVWalksFunc(tile, cdarg) +mzVWalksFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; ClientData cdarg; { RouteType *rT = (RouteType *) cdarg; @@ -1282,8 +1288,9 @@ typedef struct walkContactFuncData */ int -mzLRCWalksFunc(tile, cdarg) +mzLRCWalksFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; /* (unused) */ ClientData cdarg; { RouteType *rT = (RouteType *) cdarg; /* RouteType of this dest area */ @@ -1365,8 +1372,9 @@ mzLRCWalksFunc(tile, cdarg) */ int -mzUDCWalksFunc(tile, cdarg) +mzUDCWalksFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; /* (unused) */ ClientData cdarg; { RouteType *rT = (RouteType *) cdarg; /* RouteType of this dest area */ diff --git a/mzrouter/mzDebug.c b/mzrouter/mzDebug.c index 5f32f0ff..8ac6be73 100644 --- a/mzrouter/mzDebug.c +++ b/mzrouter/mzDebug.c @@ -526,8 +526,9 @@ mzDumpTags(area) */ int -mzDumpTagsFunc(tile, cxp) +mzDumpTagsFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; diff --git a/mzrouter/mzEstimate.c b/mzrouter/mzEstimate.c index 5da125f8..451c9ede 100644 --- a/mzrouter/mzEstimate.c +++ b/mzrouter/mzEstimate.c @@ -487,8 +487,9 @@ mzCleanEstimate() */ int -mzReclaimTCFunc(tile, notUsed) +mzReclaimTCFunc(tile, dinfo, notUsed) Tile *tile; + TileType dinfo; ClientData notUsed; { if (tile->ti_client != (ClientData)CLIENTDEFAULT) @@ -536,8 +537,9 @@ mzReclaimTCFunc(tile, notUsed) */ int -mzProcessDestEstFunc(tile, cxp) +mzProcessDestEstFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; @@ -608,8 +610,9 @@ mzProcessDestEstFunc(tile, cxp) */ int -mzDestTileEstFunc(tile, cdarg) +mzDestTileEstFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; ClientData cdarg; { Rect rect; @@ -658,8 +661,9 @@ mzDestTileEstFunc(tile, cdarg) */ int -mzAddSubcellEstFunc(scx, cdarg) +mzAddSubcellEstFunc(scx, dinfo, cdarg) SearchContext *scx; + TileType dinfo; ClientData cdarg; { Rect r, rDest; @@ -699,8 +703,9 @@ mzAddSubcellEstFunc(scx, cdarg) */ int -mzAddFenceEstFunc(tile, buildArea) +mzAddFenceEstFunc(tile, dinfo, buildArea) Tile *tile; + TileType dinfo; Rect *buildArea; /* currently ignored */ { Rect r; @@ -737,8 +742,9 @@ mzAddFenceEstFunc(tile, buildArea) */ int -mzBuildSolidsListFunc(tile, listPtr) +mzBuildSolidsListFunc(tile, dinfo, listPtr) Tile *tile; + TileType dinfo; List **listPtr; /* pointer to list to add tile to */ { LIST_ADD(tile,*listPtr); @@ -764,8 +770,9 @@ mzBuildSolidsListFunc(tile, listPtr) * ---------------------------------------------------------------------------- */ int -mzAssignCostsFunc(tile, spaceCosts) +mzAssignCostsFunc(tile, dinfo, spaceCosts) Tile *tile; + TileType dinfo; TileCosts *spaceCosts; /* costs to assign to space tiles */ { Tile *tRight, *tUp; @@ -862,8 +869,9 @@ mzAssignCostsFunc(tile, spaceCosts) * ---------------------------------------------------------------------------- */ int -mzDestInitialAssignFunc(tile, cdarg) +mzDestInitialAssignFunc(tile, dinfo, cdarg) Tile *tile; + TileType dinfo; ClientData cdarg; { Heap *adjHeap = (Heap *) cdarg; @@ -904,8 +912,9 @@ mzDestInitialAssignFunc(tile, cdarg) */ int -mzBuildEstimatesFunc(tile, notUsed) +mzBuildEstimatesFunc(tile, dinfo, notUsed) Tile *tile; + TileType dinfo; ClientData notUsed; { @@ -1316,8 +1325,9 @@ AlwaysAsGood(est1, est2, tile) */ int -mzTrimEstimatesFunc(tile, notUsed) +mzTrimEstimatesFunc(tile, dinfo, notUsed) Tile *tile; + TileType dinfo; ClientData notUsed; { TileCosts *tc = (TileCosts *) (tile->ti_client); @@ -1966,8 +1976,9 @@ mzDumpEstimates(area,fd) */ int -mzDumpEstFunc(tile, fd) +mzDumpEstFunc(tile, dinfo, fd) Tile *tile; + TileType dinfo; FILE *fd; { Rect r; diff --git a/mzrouter/mzHint.c b/mzrouter/mzHint.c index 0f3aca70..46009f75 100644 --- a/mzrouter/mzHint.c +++ b/mzrouter/mzHint.c @@ -141,8 +141,9 @@ mzBuildHFR(srcUse, area) */ int -mzBuildHFRFunc(tile, cxp) +mzBuildHFRFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; diff --git a/mzrouter/mzStart.c b/mzrouter/mzStart.c index 76e50314..7ee8e37a 100644 --- a/mzrouter/mzStart.c +++ b/mzrouter/mzStart.c @@ -59,7 +59,7 @@ extern bool mzAddInitialContacts(); */ int -mzFindSamenodeFunc(Tile *tile, Point *point) +mzFindSamenodeFunc(Tile *tile, TileType dinfo, Point *point) { *point = tile->ti_ll; return 1; diff --git a/mzrouter/mzSubrs.c b/mzrouter/mzSubrs.c index e2ec6294..48fde74e 100644 --- a/mzrouter/mzSubrs.c +++ b/mzrouter/mzSubrs.c @@ -412,8 +412,9 @@ mzMarkConnectedTiles(rect, type, expandType) */ int -mzConnectedTileFunc(tile, cxp) +mzConnectedTileFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { /* If tile not marked, mark it, add it to marked list, and add diff --git a/netmenu/NMshowcell.c b/netmenu/NMshowcell.c index 854996e2..f74e249c 100644 --- a/netmenu/NMshowcell.c +++ b/netmenu/NMshowcell.c @@ -122,15 +122,16 @@ NMRedrawCell(window, plane) } int -nmscRedrawFunc(tile, window) +nmscRedrawFunc(tile, dinfo, window) Tile *tile; /* Tile to be redisplayed on highlight layer.*/ + TileType dinfo; /* Split tile information */ MagWindow *window; /* Window in which to redisplay. */ { Rect area, screenArea; extern int nmscAlways1(); /* Forward reference. */ TiToRect(tile, &area); - if (!DBSrPaintArea((Tile *) NULL, nmscPlane, &area, + if (!DBSrPaintNMArea((Tile *)NULL, nmscPlane, dinfo, &area, &DBAllButSpaceBits, nmscAlways1, (ClientData) NULL)) return 0; WindSurfaceToScreen(window, &area, &screenArea); @@ -139,7 +140,7 @@ nmscRedrawFunc(tile, window) } int -nmscAlways1() +nmscAlways1(Tile *tile, TileType dinfo, ClientData clientdata) { return 1; } diff --git a/netmenu/NMshowpt.c b/netmenu/NMshowpt.c index 4a34bc74..82bb950d 100644 --- a/netmenu/NMshowpt.c +++ b/netmenu/NMshowpt.c @@ -147,7 +147,7 @@ NMRedrawPoints(window, plane) } int -nmspAlways1() +nmspAlways1(Tile *tile, TileType dinfo, ClientData clientdata) { return 1; } diff --git a/plot/plotGremln.c b/plot/plotGremln.c index b05f6929..030ef4cf 100644 --- a/plot/plotGremln.c +++ b/plot/plotGremln.c @@ -362,8 +362,9 @@ plotGremlinRect(rect, lineStyle) */ int -plotGremlinPaint(tile, cxp) +plotGremlinPaint(tile, dinfo, cxp) Tile *tile; /* Tile that's of type to be output. */ + TileType dinfo; /* Split tile information (unused) */ TreeContext *cxp; /* Describes search in progress. */ { Rect tileArea, edge, rootArea; diff --git a/plot/plotPNM.c b/plot/plotPNM.c index 5f91f630..5bfd486c 100644 --- a/plot/plotPNM.c +++ b/plot/plotPNM.c @@ -311,8 +311,9 @@ pnmRenderRegion(scale, scale_over_2, normal, temp, func, arg) */ int -pnmBBOX (tile,cxp) +pnmBBOX (tile, dinfo, cxp) Tile *tile; + TileType dinfo; TreeContext *cxp; { Rect targetRect, sourceRect; @@ -368,8 +369,9 @@ pnmBBOX (tile,cxp) */ int -pnmTile (tile, cxp) +pnmTile (tile, dinfo, cxp) Tile *tile; + TileType dinfo; TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; @@ -397,11 +399,11 @@ pnmTile (tile, cxp) /* Handle non-Manhattan geometry */ if (IsSplit(tile)) { - TileType dinfo; + TileType newdinfo; int w, h, llx, lly, urx, ury; Rect scaledClip; - type = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); if (type == TT_SPACE) return 0; else if (PaintStyles[type].wmask == 0) return 0; @@ -430,15 +432,15 @@ pnmTile (tile, cxp) /* The following structures could be much better */ /* written for considerable speedup. . . */ - dinfo = DBTransformDiagonal(TiGetTypeExact(tile), &scx->scx_trans); - if (((dinfo & TT_SIDE) >> 1) != (dinfo & TT_DIRECTION)) + newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, &scx->scx_trans); + if (((newdinfo & TT_SIDE) >> 1) != (newdinfo & TT_DIRECTION)) { /* work top to bottom */ for (y = ury - 1; y >= lly; y--) { if (y >= scaledClip.r_ytop) continue; else if (y < scaledClip.r_ybot) break; - if (dinfo & TT_SIDE) /* work right to left */ + if (newdinfo & TT_SIDE) /* work right to left */ { for (x = urx - 1; x >= llx; x--) { @@ -468,7 +470,7 @@ pnmTile (tile, cxp) { if (y < scaledClip.r_ybot) continue; else if (y >= scaledClip.r_ytop) break; - if (dinfo & TT_SIDE) /* work right to left */ + if (newdinfo & TT_SIDE) /* work right to left */ { for (x = urx; x >= llx; x--) { diff --git a/plot/plotPS.c b/plot/plotPS.c index f6699e0c..b4a22c30 100644 --- a/plot/plotPS.c +++ b/plot/plotPS.c @@ -513,8 +513,9 @@ plotPSRect(rect, style) */ int -plotPSPaint(tile, cxp) +plotPSPaint(tile, dinfo, cxp) Tile *tile; /* Tile that's of type to be output. */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* Describes search in progress. */ { Rect tileArea, edge, rootArea; @@ -554,7 +555,7 @@ plotPSPaint(tile, cxp) if (IsSplit(tile)) { int np, i, j; - TileType dinfo; + TileType newdinfo; Point polyp[5]; plotPSFlushRect(curStyle->grs_stipple); @@ -563,12 +564,12 @@ plotPSPaint(tile, cxp) /* Side and direction are altered by geometric transformations */ - dinfo = DBTransformDiagonal(TiGetTypeExact(tile), &scx->scx_trans); + newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, &scx->scx_trans); /* Use GrClipTriangle() routine to get the n-sided polygon that */ /* results from clipping a triangle to the clip region. */ - GrClipTriangle(&rootArea, &bbox, TRUE, dinfo, polyp, &np); + GrClipTriangle(&rootArea, &bbox, TRUE, newdinfo, polyp, &np); for (i = 0; i < np; i++) { polyp[i].p_x -= bbox.r_xbot; @@ -651,7 +652,7 @@ plotPSPaint(tile, cxp) * (This code is essentially a duplicate of selRedisplayFunc()) */ - if (IsSplit(tile) && (!(SplitSide(tile) ^ SplitDirection(tile)))) + if (IsSplit(tile) && (!((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) goto searchleft; /* nothing on bottom of split */ if (tileArea.r_ybot > TiPlaneRect.r_ybot) @@ -676,7 +677,7 @@ plotPSPaint(tile, cxp) */ searchleft: - if (IsSplit(tile) && SplitSide(tile)) + if (IsSplit(tile) && (dinfo & TT_SIDE)) goto searchtop; /* Nothing on left side of tile */ if (tileArea.r_xbot > TiPlaneRect.r_xbot) @@ -699,7 +700,7 @@ searchleft: /* Same thing for the tile's top border. */ searchtop: - if (IsSplit(tile) && (SplitSide(tile) ^ SplitDirection(tile))) + if (IsSplit(tile) && (((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) goto searchright; /* Nothing on top side of tile */ if (tileArea.r_ytop < TiPlaneRect.r_ytop) @@ -722,7 +723,7 @@ searchtop: /* Finally, the right border. */ searchright: - if (IsSplit(tile) && !SplitSide(tile)) + if (IsSplit(tile) && !(dinfo & TT_SIDE)) return 0; /* Nothing on right side of tile */ if (tileArea.r_xtop < TiPlaneRect.r_xtop) diff --git a/plot/plotPixels.c b/plot/plotPixels.c index 3ee0063c..ba848b60 100644 --- a/plot/plotPixels.c +++ b/plot/plotPixels.c @@ -525,8 +525,9 @@ plotPixRect(area, widen, style) */ int -plotPixTile(tile, cxp) - Tile *tile; /* Tile that's of type to be output. */ +plotPixTile(tile, dinfo, cxp) + Tile *tile; /* Tile that's of type to be output. */ + TileType dinfo; /* Split tile information (unhandled) */ TreeContext *cxp; /* Describes search in progress. */ { Rect tileArea, rootArea, swathArea; diff --git a/plot/plotVers.c b/plot/plotVers.c index 5dc129a8..5eab30dd 100644 --- a/plot/plotVers.c +++ b/plot/plotVers.c @@ -664,8 +664,9 @@ plotVersRect(area, widen, raster) */ int -plotVersTile(tile, cxp) - Tile *tile; /* Tile that's of type to be output. */ +plotVersTile(tile, dinfo, cxp) + Tile *tile; /* Tile that's of type to be output. */ + TileType dinfo; /* Split tile information */ TreeContext *cxp; /* Describes search in progress. */ { Rect tileArea, rootArea, swathArea, edge; @@ -701,18 +702,19 @@ plotVersTile(tile, cxp) if (IsSplit(tile)) { int i, j; - TileType dinfo; + TileType newdinfo; Rect r; - dinfo = DBTransformDiagonal(TiGetTypeExact(tile), &cxp->tc_scx->scx_trans); + newdinfo = DBTransformDiagonal(TiGetTypeExact(tile) | dinfo, + &cxp->tc_scx->scx_trans); if (!(curStyle->vs_flags & VS_BORDER) && !(curStyle->vs_flags & VS_CROSS)) - PlotPolyRaster(raster, &swathArea, &swathClip, dinfo, + PlotPolyRaster(raster, &swathArea, &swathClip, newdinfo, curStyle->vs_stipple); /* Diagonal is always drawn (clipping handled in plotVersLine) */ r = rootArea; - if (dinfo & TT_DIRECTION) + if (newdinfo & TT_DIRECTION) { /* swap X to make diagonal go the other way */ r.r_xbot = r.r_xtop; @@ -740,7 +742,7 @@ plotVersTile(tile, cxp) * (unless it is at infinity). */ - if (IsSplit(tile) && (!(SplitSide(tile) ^ SplitDirection(tile)))) + if (IsSplit(tile) && (!((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) goto searchleft; /* nothing on bottom of split */ if (tileArea.r_ybot > TiPlaneRect.r_ybot) @@ -761,7 +763,7 @@ plotVersTile(tile, cxp) } searchleft: - if (IsSplit(tile) && (SplitSide(tile))) + if (IsSplit(tile) && (dinfo & TT_SIDE)) goto searchtop; /* Nothing on left side of split */ /* Now go along the tile's left border, doing the same thing. Ignore @@ -788,7 +790,7 @@ searchleft: /* Same thing for the tile's top border. */ searchtop: - if (IsSplit(tile) && (SplitSide(tile) ^ SplitDirection(tile))) + if (IsSplit(tile) && (((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) goto searchright; /* Nothing on top side of tile */ if (tileArea.r_ytop < TiPlaneRect.r_ytop) @@ -811,7 +813,7 @@ searchtop: /* Finally, the right border. */ searchright: - if (IsSplit(tile) && !(SplitSide(tile))) + if (IsSplit(tile) && !(dinfo & TT_SIDE)) return 0; /* Nothing on right side of tile */ if (tileArea.r_xtop < TiPlaneRect.r_xtop) diff --git a/plow/PlowMain.c b/plow/PlowMain.c index 9b2275d7..2f73f591 100644 --- a/plow/PlowMain.c +++ b/plow/PlowMain.c @@ -305,7 +305,7 @@ PlowRedrawBound(window, plane) } int -plowBoundAlways1() +plowBoundAlways1(Tile *tile, TileType dinfo, ClientData clientdata) { return 1; } diff --git a/plow/PlowRandom.c b/plow/PlowRandom.c index e62c13b6..6c84c698 100644 --- a/plow/PlowRandom.c +++ b/plow/PlowRandom.c @@ -189,7 +189,7 @@ PlowRandomTest(def) */ int -plowFindFirstError() +plowFindFirstError(Tile *tile, TileType dinfo, ClientData clientdata) { return (1); } diff --git a/plow/PlowRules2.c b/plow/PlowRules2.c index c4b70b0f..9c6595cf 100644 --- a/plow/PlowRules2.c +++ b/plow/PlowRules2.c @@ -962,8 +962,9 @@ prCell(edge) */ int -plowCellDragPaint(tile, ar) +plowCellDragPaint(tile, dinfo, ar) Tile *tile; + TileType dinfo; /* (unused) */ struct applyRule *ar; { Edge *movingEdge = ar->ar_moving; diff --git a/plow/PlowRules3.c b/plow/PlowRules3.c index bd731553..74f3052f 100644 --- a/plow/PlowRules3.c +++ b/plow/PlowRules3.c @@ -111,8 +111,9 @@ prInSliver(edge) } int -plowInSliverProc(tile, inarg) +plowInSliverProc(tile, dinfo, inarg) Tile *tile; + TileType dinfo; /* (unused) */ struct inarg *inarg; { Edge *movingEdge = inarg->ina_moving; diff --git a/plow/PlowWidth.c b/plow/PlowWidth.c index 5de5ff6d..f95e8044 100644 --- a/plow/PlowWidth.c +++ b/plow/PlowWidth.c @@ -168,11 +168,12 @@ plowFindWidth( */ int -plowInitWidthFunc(tile, wc) +plowInitWidthFunc(tile, dinfo, wc) Tile *tile; /* Tile whose type is not among the types * passed to plowFindWidth(), whose LHS will * provide the right-hand boundary. */ + TileType dinfo; /* (unused) */ struct wclip *wc; /* Contains original edge and area to clip */ { Edge *edge = wc->wc_edge; @@ -217,13 +218,14 @@ plowInitWidthFunc(tile, wc) */ int -plowWidthFunc(tile, wc) +plowWidthFunc(tile, dinfo, wc) Tile *tile; /* Tile whose type is not among the types * passed to plowFindWidth(), which will be * clipped out of the area wc->wc_area in * such a way that the original edge will * remain a part of wc->wc_area. */ + TileType dinfo; /* (unused) */ struct wclip *wc; /* Contains original edge and area to clip */ { Edge *edge = wc->wc_edge; @@ -423,11 +425,12 @@ plowFindWidthBack( */ int -plowInitWidthBackFunc(tile, wc) +plowInitWidthBackFunc(tile, dinfo, wc) Tile *tile; /* Tile whose type is not among the types * passed to plowFindWidthBack(), whose RHS will * provide the left-hand boundary. */ + TileType dinfo; /* (unused) */ struct wclip *wc; /* Contains original edge and area to clip */ { Edge *edge = wc->wc_edge; @@ -472,13 +475,14 @@ plowInitWidthBackFunc(tile, wc) */ int -plowWidthBackFunc(tile, wc) +plowWidthBackFunc(tile, dinfo, wc) Tile *tile; /* Tile whose type is not among the types * passed to plowFindWidth(), which will be * clipped out of the area wc->wc_area in * such a way that the original edge will * remain a part of wc->wc_area. */ + TileType dinfo; /* (unused) */ struct wclip *wc; /* Contains original edge and area to clip */ { Edge *edge = wc->wc_edge; diff --git a/plow/PlowYank.c b/plow/PlowYank.c index eb89deaf..b3599d0e 100644 --- a/plow/PlowYank.c +++ b/plow/PlowYank.c @@ -280,8 +280,9 @@ plowYankUpdateCell(yankChildUse) */ int -plowYankUpdatePaint(yankTp, pNum) +plowYankUpdatePaint(yankTp, dinfo, pNum) Tile *yankTp; + TileType dinfo; /* (unused) */ int pNum; { Tile *spareTp; @@ -399,8 +400,9 @@ plowUpdateLabels(yankDef, origDef, origArea) } int -plowCheckLabel(tile, lu) +plowCheckLabel(tile, dinfo, lu) Tile *tile; + TileType dinfo; /* (unused) */ struct labelUpdate *lu; { int adjust; @@ -532,12 +534,13 @@ plowUpdateCell(use, origDef) */ int -plowUpdatePaintTile(tile, ui) +plowUpdatePaintTile(tile, dinfo, ui) Tile *tile; /* Tile in yanked, plowed def */ + TileType dinfo; /* Split tile information */ PaintUndoInfo *ui; /* Identifies original cell and plane being searched */ { Rect r, rtrans; - TileType type = TiGetTypeExact(tile); + TileType type = TiGetTypeExact(tile) | dinfo; int pNum, pMask; r.r_ybot = BOTTOM(tile); @@ -553,7 +556,7 @@ plowUpdatePaintTile(tile, ui) if (PlaneMaskHasPlane(pMask, pNum)) { ui->pu_pNum = pNum; - DBPaintPlane(ui->pu_def->cd_planes[pNum], + DBNMPaintPlane(ui->pu_def->cd_planes[pNum], type, &rtrans, DBWriteResultTbl[type], ui); } } diff --git a/resis/ResBasic.c b/resis/ResBasic.c index a8e5a685..6e45a953 100644 --- a/resis/ResBasic.c +++ b/resis/ResBasic.c @@ -127,8 +127,10 @@ resAllPortNodes(tile, list) */ int -ResMultiPlaneFunc(tile, tpptr) - Tile *tile, **tpptr; +ResMultiPlaneFunc(tile, dinfo, tpptr) + Tile *tile; + TileType dinfo; /* Not used, but needs to be handled */ + Tile **tpptr; { Tile *tp = *tpptr; int xj, yj; @@ -158,8 +160,10 @@ ResMultiPlaneFunc(tile, tpptr) */ int -ResSubstrateFunc(tile, tpptr) - Tile *tile, **tpptr; +ResSubstrateFunc(tile, dinfo, tpptr) + Tile *tile; + TileType dinfo; + Tile **tpptr; { Tile *tp = *tpptr; int xj, yj; @@ -188,9 +192,10 @@ ResSubstrateFunc(tile, tpptr) */ bool -ResEachTile(tile, startpoint) +ResEachTile(tile, dinfo, startpoint) Tile *tile; - Point *startpoint; + TileType dinfo; + Point *startpoint; { Tile *tp; @@ -209,7 +214,7 @@ ResEachTile(tile, startpoint) if (IsSplit(tile)) { - t1 = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + t1 = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); } else t1 = TiGetTypeExact(tile); @@ -473,7 +478,7 @@ ResEachTile(tile, startpoint) resAllPortNodes(tile, &ResNodeQueue); - merged = ResCalcTileResistance(tile, tstructs, &ResNodeQueue, + merged = ResCalcTileResistance(tile, dinfo, tstructs, &ResNodeQueue, &ResNodeList); return(merged); diff --git a/resis/ResMain.c b/resis/ResMain.c index 25a459ac..ab3535bd 100644 --- a/resis/ResMain.c +++ b/resis/ResMain.c @@ -351,8 +351,9 @@ ResMakeLabelBreakpoints(def, goodies) */ int -ResAddBreakpointFunc(tile, node) +ResAddBreakpointFunc(tile, dinfo, node) Tile *tile; + TileType dinfo; /* (unused) */ ResSimNode *node; { tileJunk *junk; @@ -741,8 +742,9 @@ ResCalcPerimOverlap(tile, dev) */ int -resMakeDevFunc(tile, cx) +resMakeDevFunc(tile, dinfo, cx) Tile *tile; + TileType dinfo; TreeContext *cx; { ResDevTile *thisDev = (ResDevTile *)cx->tc_filter->tf_arg; @@ -753,7 +755,7 @@ resMakeDevFunc(tile, cx) GeoTransRect(&cx->tc_scx->scx_trans, &devArea, &thisDev->area); if (IsSplit(tile)) - ttype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + ttype = ((dinfo & TT_SIDE)) ? SplitRightType(tile) : SplitLeftType(tile); else ttype = TiGetType(tile); @@ -795,8 +797,9 @@ resMakeDevFunc(tile, cx) #define DEV_PROCESSED 1 int -resExpandDevFunc(tile, cx) +resExpandDevFunc(tile, dinfo, cx) Tile *tile; + TileType dinfo; /* Split tile information (unused) */ TreeContext *cx; { ResDevTile *thisDev = (ResDevTile *)cx->tc_filter->tf_arg; @@ -918,8 +921,9 @@ resExpandDevFunc(tile, cx) */ int -ResShaveContacts(tile, def) +ResShaveContacts(tile, dinfo, def) Tile *tile; + TileType dinfo; /* (unused, see comment below) */ CellDef *def; { TileType ttype; @@ -1287,8 +1291,10 @@ ResCleanUpEverything() */ int -ResGetTileFunc(tile, tpptr) - Tile *tile, **tpptr; +ResGetTileFunc(tile, dinfo, tpptr) + Tile *tile; + TileType dinfo; /* (unused) */ + Tile **tpptr; { if (TiGetType(tile) != TT_SPACE) { diff --git a/resis/ResMakeRes.c b/resis/ResMakeRes.c index 360f2296..97d22afe 100644 --- a/resis/ResMakeRes.c +++ b/resis/ResMakeRes.c @@ -52,8 +52,9 @@ bool ResCalcEastWest(); */ bool -ResCalcTileResistance(tile, junk, pendingList, doneList) +ResCalcTileResistance(tile, dinfo, junk, pendingList, doneList) Tile *tile; + TileType dinfo; tileJunk *junk; resNode **pendingList, **doneList; @@ -87,15 +88,15 @@ ResCalcTileResistance(tile, junk, pendingList, doneList) if (device) { - merged |= ResCalcNearDevice(tile, pendingList, doneList, &ResResList); + merged |= ResCalcNearDevice(tile, dinfo, pendingList, doneList, &ResResList); } else if (MaxY-MinY > MaxX-MinX) { - merged |= ResCalcNorthSouth(tile, pendingList, doneList, &ResResList); + merged |= ResCalcNorthSouth(tile, dinfo, pendingList, doneList, &ResResList); } else { - merged |= ResCalcEastWest(tile, pendingList, doneList, &ResResList); + merged |= ResCalcEastWest(tile, dinfo, pendingList, doneList, &ResResList); } /* @@ -120,8 +121,9 @@ ResCalcTileResistance(tile, junk, pendingList, doneList) */ bool -ResCalcEastWest(tile, pendingList, doneList, resList) +ResCalcEastWest(tile, dinfo, pendingList, doneList, resList) Tile *tile; + TileType dinfo; resNode **pendingList, **doneList; resResistor **resList; { @@ -243,7 +245,7 @@ ResCalcEastWest(tile, pendingList, doneList, resList) if (IsSplit(tile)) { - resistor->rr_tt = (SplitSide(tile)) ? SplitRightType(tile) + resistor->rr_tt = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); resistor->rr_status = RES_DIAGONAL; resistor->rr_status |= (SplitDirection(tile)) ? RES_NS @@ -291,8 +293,9 @@ ResCalcEastWest(tile, pendingList, doneList, resList) */ bool -ResCalcNorthSouth(tile, pendingList, doneList, resList) +ResCalcNorthSouth(tile, dinfo, pendingList, doneList, resList) Tile *tile; + TileType dinfo; resNode **pendingList, **doneList; resResistor **resList; { @@ -411,7 +414,7 @@ ResCalcNorthSouth(tile, pendingList, doneList, resList) resistor->rr_width = width; if (IsSplit(tile)) { - resistor->rr_tt = (SplitSide(tile)) ? SplitRightType(tile) + resistor->rr_tt = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); resistor->rr_status = RES_DIAGONAL; resistor->rr_status |= (SplitDirection(tile)) ? RES_NS @@ -463,8 +466,9 @@ ResCalcNorthSouth(tile, pendingList, doneList, resList) */ bool -ResCalcNearDevice(tile, pendingList, doneList, resList) +ResCalcNearDevice(tile, dinfo, pendingList, doneList, resList) Tile *tile; + TileType dinfo; resNode **pendingList, **doneList; resResistor **resList; @@ -642,11 +646,11 @@ ResCalcNearDevice(tile, pendingList, doneList, resList) } if (deltay > deltax) { - return ResCalcNorthSouth(tile, pendingList, doneList, resList); + return ResCalcNorthSouth(tile, dinfo, pendingList, doneList, resList); } else { - return ResCalcEastWest(tile, pendingList, doneList, resList); + return ResCalcEastWest(tile, dinfo, pendingList, doneList, resList); } } @@ -712,7 +716,7 @@ ResCalcNearDevice(tile, pendingList, doneList, resList) } } } - return ResCalcNorthSouth(tile, pendingList, doneList, resList); + return ResCalcNorthSouth(tile, dinfo, pendingList, doneList, resList); } else { @@ -752,7 +756,7 @@ ResCalcNearDevice(tile, pendingList, doneList, resList) } } } - return ResCalcEastWest(tile, pendingList, doneList, resList); + return ResCalcEastWest(tile, dinfo, pendingList, doneList, resList); } } } diff --git a/resis/ResUtils.c b/resis/ResUtils.c index 054dd26f..383cc36f 100644 --- a/resis/ResUtils.c +++ b/resis/ResUtils.c @@ -45,8 +45,9 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/ */ ExtRegion * -ResFirst(tile, arg) +ResFirst(tile, dinfo, arg) Tile *tile; + TileType dinfo; FindRegion *arg; { ResContactPoint *reg; @@ -55,7 +56,7 @@ ResFirst(tile, arg) if (IsSplit(tile)) { - t = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + t = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); } else t = TiGetType(tile); @@ -98,7 +99,10 @@ ResFirst(tile, arg) */ int -resMultiPlaneTerm(Tile *tile, tileJunk *junk2) +resMultiPlaneTerm( + Tile *tile, + TileType dinfo, // Unused (but should be handled) + tileJunk *junk2) { tileJunk *Junk; @@ -119,7 +123,10 @@ resMultiPlaneTerm(Tile *tile, tileJunk *junk2) */ int -resSubstrateTerm(Tile *tile) +resSubstrateTerm( + Tile *tile, + TileType dinfo, + ClientData clientdata) /* (unused) */ { tileJunk *Junk; @@ -144,15 +151,16 @@ resSubstrateTerm(Tile *tile) */ int -ResEach(tile, pNum, arg) +ResEach(tile, dinfo, pNum, arg) Tile *tile; + TileType dinfo; int pNum; FindRegion *arg; { if (((ResContactPoint *)(arg->fra_region))->cp_contactTile != tile) { - ResFirst(tile, arg); + ResFirst(tile, dinfo, arg); } return(0); } @@ -175,8 +183,9 @@ ResEach(tile, pNum, arg) */ int -ResAddPlumbing(tile, arg) +ResAddPlumbing(tile, dinfo, arg) Tile *tile; + TileType dinfo; ClientData *arg; { tileJunk *Junk, *junk2; @@ -193,7 +202,7 @@ ResAddPlumbing(tile, arg) if (TiGetClient(tile) == CLIENTDEFAULT) { if (IsSplit(tile)) - loctype = (SplitSide(tile)) ? SplitRightType(tile) : + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else loctype = TiGetTypeExact(tile); @@ -220,7 +229,7 @@ ResAddPlumbing(tile, arg) */ nterms += 2; - resDev = (resDevice *) mallocMagic((unsigned)(sizeof(resDevice))); + resDev = (resDevice *)mallocMagic((unsigned)(sizeof(resDevice))); resDev->rd_nterms = nterms; resDev->rd_terminals = (resNode **) mallocMagic(nterms * sizeof(resNode *)); for (i = 0; i != nterms; i++) @@ -238,7 +247,7 @@ ResAddPlumbing(tile, arg) resDev->rd_perim = 0; resDev->rd_area = 0; resDev->rd_status = 0; - resDev->rd_nextDev = (resDevice *) *arg; + resDev->rd_nextDev = (resDevice *)*arg; *arg = (ClientData)resDev; junk2->deviceList = resDev; junk2->tj_status |= RES_TILE_DEV; @@ -340,7 +349,7 @@ ResAddPlumbing(tile, arg) tp1 = (Tile *) STACKPOP(resDevStack); if (IsSplit(tp1)) { - t1 = (SplitSide(tp1)) ? SplitRightType(tp1) : + t1 = (dinfo & TT_SIDE) ? SplitRightType(tp1) : SplitLeftType(tp1); } else @@ -426,11 +435,11 @@ ResAddPlumbing(tile, arg) tp1 = (Tile *) STACKPOP(resDevStack); if (IsSplit(tp1)) { - t1 = (SplitSide(tp1)) ? SplitRightType(tp1) : + t1 = (dinfo & TT_SIDE) ? SplitRightType(tp1) : SplitLeftType(tp1); /* Check in case this is the wrong side */ if (ExtCurStyle->exts_device[t1] == NULL) - t1 = (SplitSide(tp1)) ? SplitLeftType(tp1) : + t1 = (dinfo & TT_SIDE) ? SplitLeftType(tp1) : SplitRightType(tp1); } else @@ -574,7 +583,7 @@ ResAddPlumbing(tile, arg) tp1 = (Tile *) STACKPOP(resDevStack); if (IsSplit(tp1)) { - t1 = (SplitSide(tp1)) ? SplitRightType(tp1) : + t1 = (dinfo & TT_SIDE) ? SplitRightType(tp1) : SplitLeftType(tp1); } else @@ -651,8 +660,9 @@ ResAddPlumbing(tile, arg) */ int -ResRemovePlumbing(tile, arg) +ResRemovePlumbing(tile, dinfo, arg) Tile *tile; + TileType dinfo; // Unused, but should be handled. ClientData *arg; { diff --git a/router/rtrChannel.c b/router/rtrChannel.c index adb1bb25..7231627b 100644 --- a/router/rtrChannel.c +++ b/router/rtrChannel.c @@ -412,8 +412,9 @@ rtrChannelObstaclePins(ch) */ int -rtrChannelObstacleMark(tile, cxp) +rtrChannelObstacleMark(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { short **mcol, *mrow, *mrowend, mask; diff --git a/router/rtrCmd.c b/router/rtrCmd.c index c651e3f8..8ed6a168 100644 --- a/router/rtrCmd.c +++ b/router/rtrCmd.c @@ -227,8 +227,10 @@ CmdChannel(w, cmd) } int -cmdChannelFunc(tile) +cmdChannelFunc(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { Rect area, rootArea; diff --git a/router/rtrDcmpose.c b/router/rtrDcmpose.c index f6f757d8..275c5899 100644 --- a/router/rtrDcmpose.c +++ b/router/rtrDcmpose.c @@ -522,8 +522,9 @@ rtrSplitToArea(area, def) */ int -rtrSrClear(tile, area) +rtrSrClear(tile, dinfo, area) Tile *tile; + TileType dinfo; Rect *area; { /* Clear all */ @@ -580,8 +581,9 @@ rtrSrClear(tile, area) */ int -rtrSrFunc(tile, plane) +rtrSrFunc(tile, dinfo, plane) Tile *tile; /* Candidate cell tile */ + TileType dinfo; /* Split tile information (unused) */ Plane *plane; /* Plane in which searches take place */ { Tile *tiles[3]; diff --git a/router/rtrMain.c b/router/rtrMain.c index 32860d80..ea86c37e 100644 --- a/router/rtrMain.c +++ b/router/rtrMain.c @@ -171,11 +171,12 @@ done: */ int -rtrMakeChannel(tile, clipBox) +rtrMakeChannel(tile, dinfo, clipBox) Tile *tile; /* Potential channel tile; we create a channel whose * area is equal to that of this tile if the type of * this tile is TT_SPACE. */ + TileType dinfo; /* Split tile information (unused) */ Rect *clipBox; /* If non-NULL, clip the channel area to this box */ { int length, width; diff --git a/router/rtrSide.c b/router/rtrSide.c index 681f6624..66195627 100644 --- a/router/rtrSide.c +++ b/router/rtrSide.c @@ -285,8 +285,9 @@ rtrSideProcess(use, side, area, trans) */ int -rtrSideInitClient(tile, client) +rtrSideInitClient(tile, dinfo, client) Tile *tile; + TileType dinfo; /* (unused) */ ClientData client; { TiSetClient(tile, client); @@ -315,8 +316,10 @@ rtrSideInitClient(tile, client) */ int -rtrEnumSidesFunc(tile) +rtrEnumSidesFunc(tile, dinfo, clientdata) Tile *tile; + TileType dinfo; /* (unused) */ + ClientData clientdata; /* (unused) */ { int ybot, ytop, yprev, sep, x, origin; Tile *tp, *tpB; diff --git a/router/rtrStem.c b/router/rtrStem.c index affa719d..02923b53 100644 --- a/router/rtrStem.c +++ b/router/rtrStem.c @@ -403,7 +403,7 @@ fail: /* Routine to expand rectangle into touching tiles of a label's type. */ int -rtrStemExpandFunc(Tile *t, TreeContext *cxp) +rtrStemExpandFunc(Tile *t, TileType dinfo, TreeContext *cxp) { SearchContext *scx = cxp->tc_scx; Rect rsrc; @@ -518,8 +518,9 @@ rtrStemTip(loc, si, use) */ int -rtrAbort(tile) - Tile *tile; +rtrAbort(Tile *tile, + TileType dinfo, + ClientData cliendata) { return 1; } diff --git a/router/rtrTravers.c b/router/rtrTravers.c index 4edf18bd..53eecfb9 100644 --- a/router/rtrTravers.c +++ b/router/rtrTravers.c @@ -197,8 +197,9 @@ rtrSrTraverse(def, startArea, mask, connect, bounds, func, clientData) } int -rtrSrTraverseStartFunc(tile, pTile) +rtrSrTraverseStartFunc(tile, dinfo, pTile) Tile *tile; /* This will be the starting tile. */ + TileType dinfo; /* Split tile information (unused) */ Tile **pTile; /* We store tile's address here. */ { *pTile = tile; @@ -238,8 +239,9 @@ rtrSrTraverseStartFunc(tile, pTile) */ int -rtrSrTraverseFunc(tile, ts) +rtrSrTraverseFunc(tile, dinfo, ts) Tile *tile; /* Tile that is connected. */ + TileType dinfo; /* Split tile information (unused) */ struct rtrTileStack *ts; /* Contains information about the search. */ { Tile *t2; @@ -401,8 +403,9 @@ rtrSrTraverseFunc(tile, ts) */ int -rtrExamineTile(tile, cdata) +rtrExamineTile(tile, dinfo, cdata) Tile *tile; + TileType dinfo; /* (unused) */ ClientData cdata; { if ( TiGetType(tile) == rtrTarget ) @@ -439,8 +442,9 @@ rtrExamineTile(tile, cdata) */ int -rtrExamineStack(tile, ts) +rtrExamineStack(tile, dinfo, ts) Tile *tile; + TileType dinfo; /* (unused) */ struct rtrTileStack *ts; { int i; diff --git a/router/rtrVia.c b/router/rtrVia.c index ec862d00..f15f4fa1 100644 --- a/router/rtrVia.c +++ b/router/rtrVia.c @@ -182,8 +182,9 @@ rtrFollowName(name, firstInNet, area) */ int -rtrCheckTypes(tile, cdata) +rtrCheckTypes(tile, dinfo, cdata) Tile *tile; + TileType dinfo; /* (unused) */ ClientData cdata; { int type; @@ -259,8 +260,9 @@ rtrExtend(tile,area,stub) */ int -rtrStubGen(tile, si) +rtrStubGen(tile, dinfo, si) Tile *tile; + TileType dinfo; /* (unused) */ struct srinfo *si; { Rect area; @@ -305,8 +307,9 @@ rtrStubGen(tile, si) int -rtrReferenceTile(tile, si) +rtrReferenceTile(tile, dinfo, si) Tile *tile; + TileType dinfo; /* (unused) */ struct srinfo *si; { si->si_tile = tile; diff --git a/select/selCreate.c b/select/selCreate.c index a7ed2cb9..dfa6c433 100644 --- a/select/selCreate.c +++ b/select/selCreate.c @@ -265,15 +265,17 @@ selClearFunc(scx) */ int -selIntersectPaintFunc2(tile, rect) +selIntersectPaintFunc2(tile, dinfo, rect) Tile *tile; /* The tile to copy paint from. */ + TileType dinfo; /* Split tile information */ Rect *rect; /* Area to clip to */ { Rect r; TiToRect(tile, &r); GEOCLIP(&r, rect); /* Clip out the intersection area */ - DBPaint(SelectDef, &r, TiGetTypeExact(tile)); /* Paint back into SelectDef */ + /* Paint back into SelectDef */ + DBPaint(SelectDef, &r, TiGetTypeExact(tile) | dinfo); return 0; /* Keep the search going. */ } @@ -288,8 +290,10 @@ selIntersectPaintFunc2(tile, rect) */ int -selIntersectPaintFunc(tile) +selIntersectPaintFunc(tile, dinfo, clientdata) Tile *tile; /* The tile to copy paint from. */ + TileType dinfo; /* Split tile information */ + ClientData clientdata; /* (unused) */ { TileTypeBitMask tMask; Rect r; @@ -299,9 +303,10 @@ selIntersectPaintFunc(tile) for (pNum = 0; pNum < DBNumPlanes; pNum++) { - DBSrPaintArea((Tile *)NULL, Select2Def->cd_planes[pNum], &r, - &DBAllButSpaceAndDRCBits, selIntersectPaintFunc2, - (ClientData)&r); + DBSrPaintNMArea((Tile *)NULL, Select2Def->cd_planes[pNum], + TiGetTypeExact(tile) | dinfo, &r, + &DBAllButSpaceAndDRCBits, selIntersectPaintFunc2, + (ClientData)&r); } return 0; /* Keep the search going. */ } @@ -628,8 +633,9 @@ selFindChunk(plane, wrongTypes, searchArea, containedArea, bestMin, */ int -selSplitFunc(tile, cxp) +selSplitFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused) */ TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; @@ -651,8 +657,9 @@ selSplitFunc(tile, cxp) */ int -selChunkFunc(tile, wrong) +selChunkFunc(tile, dinfo, wrong) Tile *tile; /* The offending tile. */ + TileType dinfo; /* Split tile information (unused) */ Rect *wrong; /* Place to store the tile's area. */ { TiToRect(tile, wrong); @@ -1323,8 +1330,9 @@ typedef struct { */ int -selACPaintFunc(tile, plane) +selACPaintFunc(tile, dinfo, plane) Tile *tile; /* Tile in Select2Def. */ + TileType dinfo; /* Split tile information */ int plane; /* Index of plane this tile came from. */ { Rect area, editArea; @@ -1336,7 +1344,7 @@ selACPaintFunc(tile, plane) selACarg.editClip = &area; GeoTransRect(&RootToEditTransform, &area, &editArea); - selACarg.ttype = TiGetTypeExact(tile); + selACarg.ttype = TiGetTypeExact(tile) | dinfo; if (IsSplit(tile)) { @@ -1361,23 +1369,24 @@ selACPaintFunc(tile, plane) */ int -selACPaintFunc2(tile, selACarg) +selACPaintFunc2(tile, dinfo, selACarg) Tile *tile; /* Tile in edit cell. */ + TileType dinfo; /* Split tile information */ acparg *selACarg; /* Contains edit-cell area to clip to * before painting into selection. */ { Rect *editClip = selACarg->editClip; Rect area, selArea; - TileType type = TiGetTypeExact(tile); + TileType type = TiGetTypeExact(tile) | dinfo; TileTypeBitMask tmask, *rmask; TileType ttype, rtype; - TileType dinfo = selACarg->ttype & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE); + TileType newdinfo = selACarg->ttype & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE); TiToRect(tile, &area); GeoTransRect(&EditToRootTransform, &area, &selArea); - if ((dinfo & TT_DIAGONAL) || (type & TT_DIAGONAL)) + if ((newdinfo & TT_DIAGONAL) || (type & TT_DIAGONAL)) { /* If the select area is triangular, then we need to */ /* clip in a more complicated manner. */ @@ -1406,11 +1415,11 @@ selACPaintFunc2(tile, selACarg) TTMaskSetOnlyType(&tmask, rtype); - type = (dinfo & TT_SIDE) ? (rtype << 14) : rtype; - type |= dinfo; + type = (newdinfo & TT_SIDE) ? (rtype << 14) : rtype; + type |= newdinfo; - if (dinfo & TT_DIAGONAL) - GrClipTriangle(editClip, &selArea, TRUE, dinfo, points, &np); + if (newdinfo & TT_DIAGONAL) + GrClipTriangle(editClip, &selArea, TRUE, newdinfo, points, &np); else GrClipTriangle(&selArea, editClip, TRUE, type, points, &np); diff --git a/select/selDisplay.c b/select/selDisplay.c index 98fb5358..e22ae8c3 100644 --- a/select/selDisplay.c +++ b/select/selDisplay.c @@ -195,7 +195,7 @@ SelRedisplay(window, plane) */ int -selAlways1() +selAlways1(Tile *tile, TileType dinfo, ClientData clientdata) { return 1; } @@ -206,8 +206,9 @@ selAlways1() */ int -selRedisplayFunc(tile, window) +selRedisplayFunc(tile, dinfo, window) Tile *tile; /* Tile to be drawn on highlight layer. */ + TileType dinfo; /* Split tile information */ MagWindow *window; /* Window in which to redisplay. */ { Rect area, edge, screenEdge, tmpr; @@ -245,13 +246,13 @@ selRedisplayFunc(tile, window) WindSurfaceToScreenNoClip(window, &tmpr, &screenEdge); if (screenEdge.r_ll.p_x != screenEdge.r_ur.p_x && screenEdge.r_ll.p_y != screenEdge.r_ur.p_y) - GrDrawTriangleEdge(&screenEdge, TiGetTypeExact(tile)); - loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + GrDrawTriangleEdge(&screenEdge, TiGetTypeExact(tile) | dinfo); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); } else loctype = TiGetTypeExact(tile); - if (IsSplit(tile) && (!(SplitSide(tile) ^ SplitDirection(tile)))) + if (IsSplit(tile) && (!((dinfo & TT_SIDE) ? 1 : 0) ^ SplitDirection(tile))) goto searchleft; /* nothing on bottom of split */ if (area.r_ybot > TiPlaneRect.r_ybot) @@ -278,7 +279,7 @@ selRedisplayFunc(tile, window) */ searchleft: - if (IsSplit(tile) && SplitSide(tile)) return 0; + if (IsSplit(tile) && (dinfo & TT_SIDE)) return 0; if (area.r_xbot > TiPlaneRect.r_xbot) { @@ -452,17 +453,19 @@ SelCopyToFeedback(celldef, seluse, style, text) /*----------------------------------------------------------------------*/ int -selFeedbackFunc(tile, fld) +selFeedbackFunc(tile, dinfo, fld) Tile *tile; + TileType dinfo; FeedLayerData *fld; { Rect area; TiToRect(tile, &area); + /* (preserve information about the geometry of a diagonal tile) */ DBWFeedbackAdd(&area, fld->text, selDisRoot, 1, fld->style | - (TiGetTypeExact(tile) & (TT_DIAGONAL | TT_DIRECTION | TT_SIDE))); - /* (preserve information about the geometry of a diagonal tile) */ + ((TiGetTypeExact(tile) | dinfo) & + (TT_DIAGONAL | TT_DIRECTION | TT_SIDE))); return 0; } diff --git a/select/selEnum.c b/select/selEnum.c index 218f3781..749b2fe1 100644 --- a/select/selEnum.c +++ b/select/selEnum.c @@ -180,8 +180,9 @@ SelEnumPaint(layers, editOnly, foundNonEdit, func, clientData) */ int -selEnumPFunc1(tile, arg) +selEnumPFunc1(tile, dinfo, arg) Tile *tile; /* Tile of matching type. */ + TileType dinfo; /* Split tile information */ struct searg *arg; /* Describes the current search. */ { Rect editRect, rootRect; @@ -193,8 +194,9 @@ selEnumPFunc1(tile, arg) if (IsSplit(tile)) { - arg->sea_type = TiGetTypeExact(tile) & (TT_DIAGONAL | TT_SIDE | TT_DIRECTION); - if (SplitSide(tile)) + arg->sea_type = (TiGetTypeExact(tile) | dinfo) & + (TT_DIAGONAL | TT_SIDE | TT_DIRECTION); + if (dinfo & TT_SIDE) loctype = SplitRightType(tile); else loctype = SplitLeftType(tile); @@ -273,8 +275,9 @@ selEnumPFunc1(tile, arg) */ int -selEnumPFunc2(tile, arg) +selEnumPFunc2(tile, dinfo, arg) Tile *tile; /* Tile found in the edit cell */ + TileType dinfo; /* Split tile information */ struct searg *arg; /* Describes our search */ { ExtRectList *lr; @@ -282,7 +285,7 @@ selEnumPFunc2(tile, arg) TileType seltype; if (IsSplit(tile)) - ttype = SplitSide(tile) ? SplitRightType(tile) : SplitLeftType(tile); + ttype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else ttype = TiGetTypeExact(tile); seltype = arg->sea_type & TT_LEFTMASK; @@ -480,7 +483,8 @@ topbottom: /* purposes, it suffices to copy the tile if the */ /* triangles are similar and to compute the */ /* rectangular union are if opposite. */ - if ((arg->sea_type & TT_SIDE) == (TiGetTypeExact(tile) & TT_SIDE)) + + if ((arg->sea_type & TT_SIDE) == (dinfo & TT_SIDE)) lr->r_type = ttype | (arg->sea_type & (TT_DIAGONAL | TT_SIDE | TT_DIRECTION)); else diff --git a/select/selOps.c b/select/selOps.c index ee538560..59ce84be 100644 --- a/select/selOps.c +++ b/select/selOps.c @@ -410,8 +410,9 @@ typedef struct _shortsearchdata { */ int -selShortTileProc(tile, ssd) +selShortTileProc(tile, dinfo, ssd) Tile *tile; + TileType dinfo; /* (unused) */ ShortSearchData *ssd; { const int curr = (int)TiGetClientINT(tile); @@ -1629,8 +1630,9 @@ SelectStretch(x, y) */ int -selStretchEraseFunc(tile, plane) +selStretchEraseFunc(tile, dinfo, plane) Tile *tile; /* Tile being moved in a stretch operation. */ + TileType dinfo; /* Split tile information */ int *plane; /* Plane of tiles being searched */ { Rect area, editArea; @@ -1643,7 +1645,7 @@ selStretchEraseFunc(tile, plane) extern int selStretchEraseFunc2(); if (IsSplit(tile)) - type = (SplitSide(tile)) ? SplitRightType(tile) : + type = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); else type = TiGetType(tile); @@ -1763,8 +1765,9 @@ selStretchEraseFunc(tile, plane) } int -selStretchEraseFunc2(tile, pa) +selStretchEraseFunc2(tile, dinfo, pa) Tile *tile; + TileType dinfo; /* (unused) */ planeAndArea *pa; { TileType type = TT_SPACE; @@ -1805,8 +1808,9 @@ selStretchEraseFunc2(tile, pa) */ int -selStretchFillFunc(tile, plane) +selStretchFillFunc(tile, dinfo, plane) Tile *tile; /* Tile in the old selection. */ + TileType dinfo; /* Split tile information (unused) */ int *plane; /* Plane of tile being searched */ { Rect area; @@ -1873,10 +1877,11 @@ selStretchFillFunc(tile, plane) */ int -selStretchFillFunc2(tile, area) +selStretchFillFunc2(tile, dinfo, area) Tile *tile; /* Space tile that borders selected * paint. */ + TileType dinfo; /* Split tile information (unused) */ Rect *area; /* A one-unit wide strip along the * border (i.e. the area in which * we're interested in space). @@ -1921,10 +1926,11 @@ selStretchFillFunc2(tile, area) */ int -selStretchFillFunc3(tile, area) +selStretchFillFunc3(tile, dinfo, area) Tile *tile; /* Tile of edit material that's about to * be left behind selection. */ + TileType dinfo; /* Split tile information (unused) */ Rect *area; /* The border area we're interested in, * in root coords. */ diff --git a/select/selUnselect.c b/select/selUnselect.c index bcc4ceb1..effc9e0b 100644 --- a/select/selUnselect.c +++ b/select/selUnselect.c @@ -44,8 +44,9 @@ */ int -selUnselFunc(tile, arg) +selUnselFunc(tile, dinfo, arg) Tile *tile; + TileType dinfo; /* unused, but should be handled */ ClientData *arg; { TileType type; @@ -210,8 +211,9 @@ SelRemoveArea(area, mask, globmatch) */ int -selRemoveLabelPaintFunc(tile, label) +selRemoveLabelPaintFunc(tile, dinfo, label) Tile *tile; + TileType dinfo; /* (unused) */ Label *label; { (void) DBPutFontLabel(Select2Def, &label->lab_rect, label->lab_font, diff --git a/sim/SimDBstuff.c b/sim/SimDBstuff.c index fdbb44b0..39ad65be 100644 --- a/sim/SimDBstuff.c +++ b/sim/SimDBstuff.c @@ -78,6 +78,7 @@ static char bestName[256]; int SimConnectFunc( Tile *tile, /* Tile found. */ + TileType dinfo, /* Split tile information */ TreeContext *cx) /* Describes context of search. The client * data is a pointer to the list head of * the conSrArg2's describing the areas @@ -90,7 +91,7 @@ SimConnectFunc( TileTypeBitMask notConnectMask; const TileTypeBitMask *connectMask; TileType loctype, ctype; - TileType dinfo = 0; + TileType newdinfo = 0; int i, pNum; static char nodeName[256]; CellDef *def; @@ -132,7 +133,7 @@ SimConnectFunc( char c = *n; SigDisableInterrupts(); - strcpy(nodeName, SimGetNodeName(cx->tc_scx, tile, tpath->tp_first)); + strcpy(nodeName, SimGetNodeName(cx->tc_scx, tile, dinfo, tpath->tp_first)); SigEnableInterrupts(); *n = c; @@ -149,8 +150,8 @@ SimConnectFunc( if (IsSplit(tile)) { - dinfo = DBTransformDiagonal(loctype, &scx->scx_trans); - loctype = (SplitSide(tile)) ? SplitRightType(tile) : SplitLeftType(tile); + newdinfo = DBTransformDiagonal(loctype | dinfo, &scx->scx_trans); + loctype = (dinfo & TT_SIDE) ? SplitRightType(tile) : SplitLeftType(tile); } /* See if the destination cell contains stuff over the whole @@ -197,13 +198,13 @@ SimConnectFunc( def = csa2->csa2_use->cu_def; if (DBSrPaintNMArea((Tile *) NULL, def->cd_planes[pNum], - dinfo, &newarea, ¬ConnectMask, dbcUnconnectFunc, + newdinfo, &newarea, ¬ConnectMask, dbcUnconnectFunc, (ClientData) connectMask) == 0) return 0; /* Paint this tile into the destination cell. */ - DBNMPaintPlane(def->cd_planes[pNum], dinfo, &newarea, + DBNMPaintPlane(def->cd_planes[pNum], newdinfo, &newarea, DBStdPaintTbl(loctype, pNum), (PaintUndoInfo *) NULL); /* Since the whole area of this tile hasn't been recorded, @@ -217,14 +218,14 @@ SimConnectFunc( /* Only extend those sides bordering the diagonal tile */ - if (dinfo & TT_DIAGONAL) + if (newdinfo & TT_DIAGONAL) { - if (dinfo & TT_SIDE) /* right */ + if (newdinfo & TT_SIDE) /* right */ newarea.r_xtop += 1; else /* left */ newarea.r_xbot -= 1; - if (((dinfo & TT_SIDE) >> 1) - == (dinfo & TT_DIRECTION)) /* top */ + if (((newdinfo & TT_SIDE) >> 1) + == (newdinfo & TT_DIRECTION)) /* top */ newarea.r_ytop += 1; else /* bottom */ newarea.r_ybot -= 1; @@ -277,7 +278,7 @@ SimConnectFunc( csa2->csa2_list[csa2->csa2_top].area = newarea; csa2->csa2_list[csa2->csa2_top].connectMask = connectMask; - csa2->csa2_list[csa2->csa2_top].dinfo = dinfo; + csa2->csa2_list[csa2->csa2_top].dinfo = newdinfo; return 0; } @@ -527,6 +528,7 @@ efPreferredName( * int * func(tile, clientData) * Tile *tile; + * TileType dinfo; * ClientData clientData; * { * } @@ -574,7 +576,7 @@ SimSrConnect( { struct conSrArg csa; int startPlane, result; - Tile *startTile; /* Starting tile for search. */ + TileAndDinfo tad; result = 0; csa.csa_def = def; @@ -585,14 +587,14 @@ SimSrConnect( * the tile address and returns. */ - startTile = NULL; + tad.tad_tile = NULL; for (startPlane = PL_TECHDEPBASE; startPlane < DBNumPlanes; startPlane++) { if (DBSrPaintArea((Tile *) NULL, def->cd_planes[startPlane], startArea, mask, - dbSrConnectStartFunc, PTR2CD(&startTile)) != 0) break; + dbSrConnectStartFunc, PTR2CD(&tad)) != 0) break; } - if (startTile == NULL) return 0; + if (tad.tad_tile == NULL) return 0; /* Pass 1. During this pass the client function gets called. */ @@ -601,7 +603,7 @@ SimSrConnect( csa.csa_clear = FALSE; csa.csa_connect = connect; csa.csa_pNum = startPlane; - if (dbSrConnectFunc(startTile, PTR2CD(&csa)) != 0) result = 1; + if (dbSrConnectFunc(tad.tad_tile, tad.tad_dinfo, PTR2CD(&csa)) != 0) result = 1; return result; } @@ -622,6 +624,7 @@ SimSrConnect( * int * func(tile, cxp) * Tile *tile; + * TileType dinfo; * TreeContext *cxp; * { * } diff --git a/sim/SimExtract.c b/sim/SimExtract.c index 90b77187..94874d62 100644 --- a/sim/SimExtract.c +++ b/sim/SimExtract.c @@ -63,7 +63,6 @@ typedef struct def_list_elt * finished. */ - static DefListElt *DefList = (DefListElt *) NULL; /* list of cell defs used in the node name search */ @@ -168,7 +167,7 @@ SimInitDefList(void) DefListElt *p, *q; p = q = DefList; - while (p != (DefListElt *) NULL) { + while (p != (DefListElt *)NULL) { q = p; p = p->dl_next; ExtResetTiles(q->dl_def, extUnInit); @@ -197,7 +196,7 @@ void SimAddNodeList( NodeRegion *newnode) { - if( NodeRegList != (NodeRegion *) NULL ) + if (NodeRegList != (NodeRegion *)NULL) newnode->nreg_next = NodeRegList; NodeRegList = newnode; } @@ -224,10 +223,10 @@ SimFreeNodeRegs(void) { NodeRegion *p, *q; - if( NodeRegList != (NodeRegion *) NULL ) /* sanity */ - ExtFreeLabRegions((LabRegion *) NodeRegList ); + if (NodeRegList != (NodeRegion *) NULL) /* sanity */ + ExtFreeLabRegions((LabRegion *)NodeRegList); - NodeRegList = (NodeRegion *) NULL; + NodeRegList = (NodeRegion *)NULL; } @@ -239,6 +238,7 @@ SimFreeNodeRegs(void) * to the region being searched. *---------------------------------------------------------------- */ + int SimInitConnTables(void) { @@ -247,15 +247,15 @@ SimInitConnTables(void) SimTransMask = ExtCurStyle->exts_deviceMask; - TTMaskZero( &SimSDMask ); - for( t = TT_TECHDEPBASE; t < DBNumTypes; t++ ) + TTMaskZero(&SimSDMask); + for (t = TT_TECHDEPBASE; t < DBNumTypes; t++) { devptr = ExtCurStyle->exts_device[t]; for (i = 0; !TTMaskHasType(&devptr->exts_deviceSDTypes[i], TT_SPACE); i++) { - TTMaskSetMask( &SimSDMask, &devptr->exts_deviceSDTypes[i] ); - TTMaskZero( &SimFetMask[t] ); + TTMaskSetMask(&SimSDMask, &devptr->exts_deviceSDTypes[i]); + TTMaskZero(&SimFetMask[t]); } } @@ -283,8 +283,8 @@ SimInitConnTables(void) return 0; } -#define IsTransGate( T ) ( TTMaskHasType( &SimTransMask, T ) ) -#define IsTransTerm( T ) ( TTMaskHasType( &SimSDMask, T ) ) +#define IsTransGate(T) (TTMaskHasType(&SimTransMask, T)) +#define IsTransTerm(T) (TTMaskHasType(&SimSDMask, T)) typedef struct @@ -307,14 +307,18 @@ typedef struct } SimTrans; +/* NOTE: This is lazy; these should not be global variables */ + static Tile *gateTile; /* Set to point to a transistor tile * whose gate is connected to the * node being searched */ +static TileType gateDinfo; /* Split tile information, if needed */ static Tile *sdTile; /* Set to point to a transistor tile * whose source/drain is connected * to the node being searched */ +static TileType sdDinfo; /* Split tile information, if needed */ static SimTrans transistor; /* Transistor being extracted */ @@ -351,20 +355,22 @@ SimTxtorLabel( r1.r_xtop = r1.r_xbot + 1; r1.r_ytop = r1.r_ybot + 1; GeoTransRect( tm, &r1, &r2 ); - if( nterm > 1 ) + if (nterm > 1) nterm = 1; - sprintf( name, "@=%c%d,%d", "gsd"[nterm+1], r2.r_xbot, r2.r_ybot ); + sprintf(name, "@=%c%d,%d", "gsd"[nterm+1], r2.r_xbot, r2.r_ybot); - return( name ); + return name; } int SimSDTransFunc( Tile *tile, - Tile **ptile) + TileType dinfo) { - *ptile = tile; - return( 1 ); + /* See above; these should not be global variables! */ + sdTile = tile; + sdDinfo = dinfo; + return 1; } @@ -477,6 +483,7 @@ SimTermNum( int SimTransistorTile( Tile *tile, + TileType dinfo, int pNum, FindRegion *arg) { @@ -484,15 +491,15 @@ SimTransistorTile( TileType t; ExtDevice *devptr; - extSetNodeNum((LabRegion *)&transistor, pNum, tile); + extSetNodeNum((LabRegion *)&transistor, pNum, tile, dinfo); if (transistor.t_do_terms) { t = TiGetType(tile); devptr = ExtCurStyle->exts_device[t]; for (i = 0; !TTMaskHasType(&devptr->exts_deviceSDTypes[i], TT_SPACE); i++) - extEnumTilePerim(tile, &devptr->exts_deviceSDTypes[i], pNum, - SimTransTerms, (ClientData) &transistor ); + extEnumTilePerim(tile, dinfo, &devptr->exts_deviceSDTypes[i], + pNum, SimTransTerms, (ClientData) &transistor ); } return (0); @@ -502,39 +509,41 @@ SimTransistorTile( int SimFindTxtor( Tile *tile, + TileType dinfo, int pNum, FindRegion *arg) { TileType type; - extSetNodeNum( (LabRegion *) arg->fra_region, pNum, tile ); + extSetNodeNum((LabRegion *)arg->fra_region, pNum, tile, dinfo); - if( ! SimUseCoords ) /* keep searching, forget transistors */ - return( 0 ); + if (!SimUseCoords) /* keep searching, forget transistors */ + return 0; - type = TiGetType( tile ); + type = TiGetType(tile); - if( IsTransGate( type ) ) + if (IsTransGate(type)) { gateTile = tile; /* found a transistor gate, stop searching */ + gateDinfo = dinfo; return( 1 ); } - else if( IsTransTerm( type ) && sdTile == (Tile *) NULL ) + else if (IsTransTerm(type) && (sdTile == (Tile *)NULL)) { Rect area; - TITORECT( tile, &area ); - GEO_EXPAND( &area, 1, &area ); - for( pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++ ) - if( PlaneMaskHasPlane( SimFetPlanes, pNum ) ) + TITORECT(tile, &area); + GEO_EXPAND(&area, 1, &area); + for (pNum = PL_TECHDEPBASE; pNum < DBNumPlanes; pNum++) + if (PlaneMaskHasPlane(SimFetPlanes, pNum)) { - if( DBSrPaintArea((Tile *) NULL, - arg->fra_def->cd_planes[pNum], &area, &SimFetMask[type], - SimSDTransFunc, (ClientData) &sdTile ) ) + if (DBSrPaintArea((Tile *)NULL, + arg->fra_def->cd_planes[pNum], &area, &SimFetMask[type], + SimSDTransFunc, (ClientData)NULL)) break; } } - return( 0 ); + return 0; } @@ -557,7 +566,8 @@ SimFindTxtor( NodeSpec * SimFindOneNode( SearchContext *sx, - Tile *tile) + Tile *tile, + TileType dinfo) { CellDef *def = sx->scx_use->cu_def; NodeRegion *reg; @@ -565,7 +575,7 @@ SimFindOneNode( TileType type, loctype; static NodeSpec ret; - /* Allocate a new node */ + /* Allocate a new node */ reg = (NodeRegion *) mallocMagic((unsigned) (sizeof(NodeRegion) )); reg->nreg_labels = (LabelList *) NULL; reg->nreg_cap = 0; @@ -573,14 +583,15 @@ SimFindOneNode( reg->nreg_pnum = DBNumPlanes; reg->nreg_next = (NodeRegion *) NULL; - gateTile = sdTile = (Tile *) NULL; + gateTile = sdTile = (Tile *)NULL; + gateDinfo = sdDinfo = (TileType)0; - /* Find all connected paint in this cell */ + /* Find all connected paint in this cell */ arg.fra_connectsTo = ExtCurStyle->exts_nodeConn; arg.fra_def = def; if (IsSplit(tile)) - type = SplitSide(tile) ? TiGetRightType(tile) : TiGetLeftType(tile); + type = (dinfo & TT_SIDE) ? TiGetRightType(tile) : TiGetLeftType(tile); else type = TiGetTypeExact(tile); @@ -588,9 +599,9 @@ SimFindOneNode( arg.fra_uninit = (ClientData) extUnInit; arg.fra_region = (ExtRegion *) reg; arg.fra_each = SimFindTxtor; - (void) ExtFindNeighbors( tile, arg.fra_pNum, &arg ); + (void) ExtFindNeighbors(tile, dinfo, arg.fra_pNum, &arg); - if( gateTile != (Tile *) NULL ) + if (gateTile != (Tile *)NULL) { /* Determine the transistor position (leftmost-lowest tile) */ transistor.t_pnum = DBNumPlanes; @@ -600,7 +611,7 @@ SimFindOneNode( arg.fra_connectsTo = &SimTransMask; if (IsSplit(tile)) - loctype = SplitSide(gateTile) ? TiGetRightType(gateTile) + loctype = (gateDinfo & TT_SIDE) ? TiGetRightType(gateTile) : TiGetLeftType(gateTile); else loctype = TiGetTypeExact(gateTile); @@ -609,7 +620,7 @@ SimFindOneNode( arg.fra_uninit = (ClientData) extUnInit; arg.fra_region = (ExtRegion *) reg; arg.fra_each = SimTransistorTile; - (void) ExtFindNeighbors( gateTile, arg.fra_pNum, &arg ); + (void) ExtFindNeighbors(gateTile, gateDinfo, arg.fra_pNum, &arg); /* Unmark current region since not all paint was traced */ arg.fra_connectsTo = ExtCurStyle->exts_nodeConn; @@ -617,19 +628,19 @@ SimFindOneNode( arg.fra_uninit = (ClientData) reg; arg.fra_region = (ExtRegion *) extUnInit; arg.fra_each = (int (*)()) NULL; - (void) ExtFindNeighbors( tile, arg.fra_pNum, &arg ); + (void) ExtFindNeighbors(tile, dinfo, arg.fra_pNum, &arg); freeMagic( reg ); - ret.nd_name = SimTxtorLabel( -1, &sx->scx_trans, &transistor ); + ret.nd_name = SimTxtorLabel(-1, &sx->scx_trans, &transistor); ret.nd_what = ND_NAME; } - else if( sdTile != (Tile *) NULL ) + else if (sdTile != (Tile *)NULL) { int tNum; - SimAddNodeList( reg ); - SimAddDefList( def ); + SimAddNodeList(reg); + SimAddDefList(def); transistor.t_pnum = DBNumPlanes; transistor.t_nterm = 0; @@ -638,44 +649,44 @@ SimFindOneNode( /* collect the transistor position, and its terminals */ arg.fra_connectsTo = &SimTransMask; - if (IsSplit(tile)) - loctype = SplitSide(sdTile) ? TiGetRightType(sdTile) + if (IsSplit(sdTile)) + loctype = (sdDinfo & TT_SIDE) ? TiGetRightType(sdTile) : TiGetLeftType(sdTile); else loctype = TiGetTypeExact(sdTile); arg.fra_pNum = DBPlane(loctype); arg.fra_uninit = TiGetClient(sdTile); - arg.fra_region = (ExtRegion *) &ret; + arg.fra_region = (ExtRegion *)&ret; arg.fra_each = SimTransistorTile; - (void) ExtFindNeighbors( sdTile, arg.fra_pNum, &arg ); + (void) ExtFindNeighbors(sdTile, sdDinfo, arg.fra_pNum, &arg); /* Unmark the transitor, since its not part of this region */ arg.fra_region = (ExtRegion *) arg.fra_uninit; arg.fra_uninit = (ClientData) &ret; arg.fra_each = (int (*)()) NULL; - (void) ExtFindNeighbors( sdTile, arg.fra_pNum, &arg ); + (void) ExtFindNeighbors(sdTile, sdDinfo, arg.fra_pNum, &arg); - if( (tNum = SimTermNum( &transistor, reg )) < 0 ) + if ((tNum = SimTermNum(&transistor, reg)) < 0) { - TxPrintf( "\tSimFindOneNode: bad transistor terminal number\n" ); + TxPrintf("\tSimFindOneNode: bad transistor terminal number\n"); goto use_name; } - ret.nd_name = SimTxtorLabel( tNum, &sx->scx_trans, &transistor ); + ret.nd_name = SimTxtorLabel(tNum, &sx->scx_trans, &transistor); ret.nd_what = ND_NAME; } else /* no transistors found, get the regions labels */ { - SimAddNodeList( reg ); - SimAddDefList( def ); + SimAddNodeList(reg); + SimAddDefList(def); use_name: - ExtLabelOneRegion( def, ExtCurStyle->exts_nodeConn, reg ); + ExtLabelOneRegion(def, ExtCurStyle->exts_nodeConn, reg); ret.nd_region = reg; ret.nd_what = ND_REGION; } - return( &ret ); + return &ret; } @@ -707,6 +718,7 @@ SimGetNodeName( Tile *tp, /* tile in this cell which is part * of the node */ + TileType dinfo, /* Split tile information */ const char *path) /* path name of hierarchy of search */ { CellDef *def = sx->scx_use->cu_def; @@ -719,7 +731,7 @@ SimGetNodeName( SimSawAbortString = FALSE; - if( SimUseCoords && simExtStyle != ExtCurStyle ) + if (SimUseCoords && simExtStyle != ExtCurStyle) SimInitConnTables(); /* check to see if this tile has been extracted before */ @@ -728,11 +740,11 @@ SimGetNodeName( { NodeSpec *ns; - ns = SimFindOneNode(sx, tp); + ns = SimFindOneNode(sx, tp, dinfo); if( ns->nd_what == ND_NAME ) { SimSawAbortString = TRUE; - return( ns->nd_name ); + return ns->nd_name; } nodeList = ns->nd_region; } diff --git a/sim/SimSelect.c b/sim/SimSelect.c index a331c92a..30c65536 100644 --- a/sim/SimSelect.c +++ b/sim/SimSelect.c @@ -262,7 +262,7 @@ SimSelectArea( const Rect * __unused__(rect)) { int plane; - int SimSelectFunc(Tile *tile, ClientData cdata); /* cb_database_srpaintarea_t (TileListElt **pHead) */ + int SimSelectFunc(Tile *tile, TileType dinfo, ClientData cdata); /* cb_database_srpaintarea_t (TileListElt **pHead) */ /* only need to extract node names if the selection has changed or * if node aliases are to be printed. @@ -322,6 +322,7 @@ SimSelectArea( int SimSelectFunc( Tile *tile, /* Tile in SelectDef. */ + TileType dinfo, /* Split tile information */ ClientData cdata) /* list of node names found (TileListElt **pHead) */ { TileListElt **pHead = (TileListElt **)CD2PTR(cdata); @@ -345,7 +346,7 @@ SimSelectFunc( if (IsSplit(tile)) { - type = (SplitSide(tile)) ? SplitRightType(tile): + type = (dinfo & TT_SIDE) ? SplitRightType(tile): SplitLeftType(tile); } else @@ -359,9 +360,9 @@ SimSelectFunc( /* corner of a split tile. */ if (IsSplit(tile)) { - if (SplitSide(tile)) + if (dinfo & TT_SIDE) scx.scx_area.r_xbot = scx.scx_area.r_xtop - 1; - if (!(SplitDirection(tile) ^ SplitSide(tile))) + if (!(SplitDirection(tile) ^ ((dinfo & TT_SIDE) ? 1 : 0))) scx.scx_area.r_ybot = scx.scx_area.r_ytop - 1; } diff --git a/sim/sim.h b/sim/sim.h index 08c7fcc5..865af166 100644 --- a/sim/sim.h +++ b/sim/sim.h @@ -6,7 +6,7 @@ #include "windows/windows.h" /* MagWindow */ extern const char *SimGetNodeCommand(const char *cmd); -extern char *SimGetNodeName(SearchContext *sx, Tile *tp, const char *path); +extern char *SimGetNodeName(SearchContext *sx, Tile *tp, TileType dinfo, const char *path); extern char *SimSelectNode(SearchContext *scx, TileType type, int xMask, char *buffer); extern bool SimGetReplyLine(char **replyLine); extern void SimRsimIt(const char *cmd, const char *nodeName); diff --git a/tiles/tile.h b/tiles/tile.h index 3acc23f0..cc2f1586 100644 --- a/tiles/tile.h +++ b/tiles/tile.h @@ -205,7 +205,7 @@ extern Tile *TiSrPoint(Tile *hint, Plane *plane, const Point *point); /* * Non-Manhattan split tiles are defined as follows: - * d = SplitDirection, s = SplitSide + * d = SplitDirection, s = split side * * d=1 d=0 * +---+ +---+ @@ -224,10 +224,21 @@ extern Tile *TiSrPoint(Tile *hint, Plane *plane, const Point *point); * */ +/* NOTE: TT_SIDE is redundant in a tile because left and right sides are already + * declared in the body. However, it can be useful to add TT_SIDE to indicate + * which side of the tile is being processed. This is the way TT_SIDE was + * originally used. But the tile type should not be modified in the database + * because that means that the database gets modified during a search, and + * prevents searches from being parallelized. Therefore TT_SIDE is never used + * within a tile in the database. TT_DIAGONAL, TT_SIDE, and TT_DIRECTION may + * be used in a TileType variable to pass information between routines. TT_SIDE + * could be removed to recover an extra bit for TileType, but that is just extra + * work. + */ + #define TiGetType(tp) ((TileType)(spointertype)((tp)->ti_body) & TT_LEFTMASK) #define TiGetTypeExact(tp) ((TileType)(spointertype) (tp)->ti_body) #define SplitDirection(tp) ((TileType)(spointertype)((tp)->ti_body) & TT_DIRECTION ? 1 : 0) -#define SplitSide(tp) ((TileType)(spointertype)((tp)->ti_body) & TT_SIDE ? 1 : 0) #define IsSplit(tp) ((TileType)(spointertype)((tp)->ti_body) & TT_DIAGONAL ? TRUE : FALSE) #define SplitLeftType(tp) ((TileType)(spointertype)((tp)->ti_body) & TT_LEFTMASK) diff --git a/utils/maxrect.c b/utils/maxrect.c index 34e4908a..5d2fa315 100644 --- a/utils/maxrect.c +++ b/utils/maxrect.c @@ -95,8 +95,9 @@ genCanonicalMaxwidth(bbox, starttile, plane, mask) */ int -FindMaxRects(tile, mrd) +FindMaxRects(tile, dinfo, mrd) Tile *tile; + TileType dinfo; /* (unused) */ MaxRectsData *mrd; { Rect area; diff --git a/utils/touchtypes.c b/utils/touchtypes.c index 93bb04ed..b6a4923b 100644 --- a/utils/touchtypes.c +++ b/utils/touchtypes.c @@ -138,8 +138,9 @@ TouchingTypes(cellUse, expansionMask, point) */ int -touchingTypesFunc(tile, cxp) +touchingTypesFunc(tile, dinfo, cxp) Tile *tile; + TileType dinfo; /* (unused, but should be handled) */ TreeContext *cxp; { SearchContext *scx = cxp->tc_scx; diff --git a/windows/windDisp.c b/windows/windDisp.c index 10a0958f..498b8398 100644 --- a/windows/windDisp.c +++ b/windows/windDisp.c @@ -896,9 +896,10 @@ WindUpdate() */ int -windUpdateFunc(tile, w) +windUpdateFunc(tile, dinfo, w) Tile *tile; /* Tile in the redisplay plane. */ - MagWindow *w; /* Window we're currently interested in. */ + TileType dinfo; /* Split tile information (unused) */ + MagWindow *w; /* Window we're currently interested in. */ { Rect area; @@ -963,9 +964,10 @@ windUpdateFunc(tile, w) /* ARGSUSED */ int -windBackgroundFunc(tile, notUsed) +windBackgroundFunc(tile, dinfo, notUsed) Tile *tile; - ClientData notUsed; + TileType dinfo; /* (unused) */ + ClientData notUsed; /* (unused) */ { Rect area;