Compare commits

...

5 Commits

Author SHA1 Message Date
Torleif Skår 5a41914d85
Merge d825f6cafe into 969137d1e2 2025-11-06 00:20:47 +00:00
R. Timothy Edwards 969137d1e2 Corrected an unfortunate error from the previous commit due to
missing copying one line with a conditional.  The error results
in "bloat-all" DRC checks reporting false positive errors.  This
commit fixes that error.
2025-11-03 15:06:54 -05:00
R. Timothy Edwards f3adea8c65 Made a few corrections to recent code additions. Also added
more points to accept interrupts during DRC checks, and
modified the tech file parser to allow the full syntax for
magic layers that is allowed elsewhere (e.g., "(*ndiff,poly)/a")
(this applies to magic layers, not GDS layers).  Fixed a
clipping error in the bloat-all function which was causing
non-manhattan geometry to produce bad results, which would
cause false-positive DRC errors when used in a CIF-DRC rule.
2025-10-31 17:37:02 -04:00
Torleif Skår d825f6cafe textio/txInput.c: Refactor header includes
Rather than being dependent on OS-level defines,
refactor to use feature-level defines.
2025-07-31 20:13:45 +02:00
Torleif Skår 388572c1ff utils/magsgtty.h: Refactor header includes 2025-07-31 20:10:22 +02:00
6 changed files with 123 additions and 115 deletions

View File

@ -1 +1 @@
8.3.571
8.3.573

View File

@ -28,6 +28,7 @@ static const char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magi
#include "utils/magic.h"
#include "utils/geometry.h"
#include "utils/signals.h"
#include "tiles/tile.h"
#include "utils/hash.h"
#include "database/database.h"
@ -1478,19 +1479,28 @@ cifBloatAllFunc(
if (op->co_distance > 0)
{
Rect cifarea;
cifarea.r_xbot = area.r_xbot;
cifarea.r_ybot = area.r_ybot;
cifarea.r_xtop = area.r_xtop;
cifarea.r_ytop = area.r_ytop;
/* Note: This is non-optimal, as it causes all tiles
* in the "bloat" group to be re-processed for each
* tile processed in the search group. However, it
* is difficult to find an optimal method.
*/
STACKPUSH(t, ResetStack);
GeoClip(&area, &clipArea);
if (GEO_RECTNULL(&area))
GeoClip(&cifarea, &clipArea);
if (GEO_RECTNULL(&cifarea))
continue;
}
/* Diagonal: If expanding across the edge of a diagonal, */
/* then just fill the whole tile. */
/* Diagonal: If expanding across the edge of a diagonal, then */
/* just fill the whole tile. Note that diagonal tiles are not */
/* clipped; the clipping only determines if the tile is */
/* outside the clip area. */
if (IsSplit(t))
{
@ -1505,8 +1515,12 @@ cifBloatAllFunc(
CIFPaintTable, (PaintUndoInfo *) NULL);
}
else
{
if (op->co_distance > 0)
GeoClip(&area, &clipArea);
DBNMPaintPlane(cifPlane, TiGetTypeExact(t), &area,
CIFPaintTable, (PaintUndoInfo *) NULL);
}
/* Top */
for (tp = RT(t); RIGHT(tp) > LEFT(t); tp = BL(tp))
@ -1547,6 +1561,7 @@ cifBloatAllFunc(
TiSetClient(t, CIF_UNPROCESSED);
}
if (SigInterruptPending) return 1;
return 0; /* Keep the search alive. . . */
}
@ -4695,12 +4710,13 @@ cifBridgeLimFunc2(
void
cifInteractingRegions(
CIFOp *op,
const Rect *area, /* Area of interest to check */
CellDef *cellDef,
Plane *temps[], /* Planes to use for temporaries. */
Plane *plane)
{
Tile *tile = NULL, *t, *tp;
Rect area;
Rect rect;
int i;
TileType type;
bool interacts;
@ -4709,7 +4725,7 @@ cifInteractingRegions(
if (RegStack == (Stack *)NULL)
RegStack = StackNew(64);
while (DBSrPaintArea((Tile *)tile, plane, &TiPlaneRect, &CIFSolidBits,
while (DBSrPaintArea((Tile *)tile, plane, area, &CIFSolidBits,
cifSquaresInitFunc, (ClientData)NULL) != 0)
{
/* Now, search for (nontrivially) connected tiles in all */
@ -4729,7 +4745,10 @@ cifInteractingRegions(
TiSetClientINT(t, CIF_PROCESSED);
/* Get tile area for interaction search */
TiToRect(t, &area);
TiToRect(t, &rect);
/* Ignore tiles outside of the search area */
if (!GEO_SURROUND(area, &rect)) continue;
/* "interacting" includes touching as well as overlapping, so expand
* search by one unit in every direction and then check overlap.
@ -4738,10 +4757,10 @@ cifInteractingRegions(
*/
if ((pointertype)op->co_client & CIFOP_INT_TOUCHING)
{
area.r_xbot -= 1;
area.r_xtop += 1;
area.r_ybot -= 1;
area.r_ytop += 1;
rect.r_xbot -= 1;
rect.r_xtop += 1;
rect.r_ybot -= 1;
rect.r_ytop += 1;
}
/* Check if this tile interacts with the rule's types, or skip */
@ -4749,7 +4768,7 @@ cifInteractingRegions(
if (!interacts)
{
if (cifSrTiles2(op, &area, cellDef, temps, cifInteractFunc, (ClientData)NULL))
if (cifSrTiles2(op, &rect, cellDef, temps, cifInteractFunc, (ClientData)NULL))
interacts = TRUE;
}
@ -4802,8 +4821,8 @@ cifInteractingRegions(
if (interacts)
{
TiToRect(t, &area);
DBPaintPlane(cifPlane, &area, CIFPaintTable, (PaintUndoInfo *)NULL);
TiToRect(t, &rect);
DBPaintPlane(cifPlane, &rect, CIFPaintTable, (PaintUndoInfo *)NULL);
}
/* Top */
@ -4838,6 +4857,9 @@ cifInteractingRegions(
STACKPUSH(tp, RegStack);
}
}
/* Allow interrupts here */
if (SigInterruptPending) break;
}
}
@ -5313,7 +5335,7 @@ CIFGenLayer(
DBClearPaintPlane(nextPlane);
cifPlane = nextPlane;
cifInteractingRegions(op, cellDef, temps, curPlane);
cifInteractingRegions(op, area, cellDef, temps, curPlane);
temp = curPlane;
curPlane = nextPlane;
nextPlane = temp;

View File

@ -234,7 +234,7 @@ cifParseLayers(
*/
{
TileTypeBitMask curCifMask, curPaintMask;
char curLayer[40], *p, *cp;
char curLayer[512], *p, *cp;
TileType paintType;
int i;
bool allResidues;
@ -246,6 +246,10 @@ cifParseLayers(
{
p = curLayer;
if (*string == '(')
while ((*string != ')') && (*string != 0))
*p++ = *string++;
if (*string == '*')
{
allResidues = TRUE;
@ -263,7 +267,22 @@ cifParseLayers(
if (paintMask != NULL)
{
paintType = DBTechNameTypes(curLayer, &curPaintMask);
if (*curLayer == '(')
{
TileType t;
/* Layer groups with parentheses can only be paint types,
* and will be parsed accordingly. Residues will be
* handled within the group. Set paintType to -3, which
* is flagged and handled below.
*/
DBTechNoisyNameMask(curLayer, &curPaintMask);
paintType = -3;
allResidues = FALSE;
}
else
paintType = DBTechNameTypes(curLayer, &curPaintMask);
if (paintType >= 0) goto okpaint;
}
else paintType = -2;
@ -299,7 +318,7 @@ okpaint:
TechError("Ambiguous layer (type) \"%s\".\n", curLayer);
continue;
}
if (paintType >= 0)
if ((paintType >= 0) || (paintType == -3))
{
if (paintType == TT_SPACE && spaceOK ==0)
TechError("\"Space\" layer not permitted in CIF rules.\n");

View File

@ -27,6 +27,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#include "utils/magic.h"
#include "textio/textio.h"
#include "utils/signals.h"
#include "utils/geometry.h"
#include "tiles/tile.h"
#include "utils/hash.h"
@ -134,7 +135,7 @@ drcFindOtherCells(use, area)
* different for "drc why" commands than for "drc check".
*
* Returns:
* 0 to keep the search going.
* 0 to keep the search going. In case of an interrupt, return 1.
*
* ----------------------------------------------------------------------------
*/
@ -156,6 +157,9 @@ drcSubCopyErrors(tile, cxp)
arg->dCD_clientData);
(*(arg->dCD_errors))++;
/* Allow a break here */
if (SigInterruptPending) return 1;
return 0;
}

View File

@ -1225,36 +1225,29 @@ TxGetLine(
* ----------------------------------------------------------------------------
*/
#if defined(SYSV) || defined(CYGWIN)
void
txGetTermState(
struct termio *buf)
{
ioctl( fileno( stdin ), TCGETA, buf);
}
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
void
txGetTermState(
struct termios *buf)
{
(void) tcgetattr(fileno(stdin), buf);
}
#if defined(HAVE_TERMIOS_H)
struct termios *buf
#elif defined(HAVE_TERMIO_H)
struct termio *buf
#else
void
txGetTermState(
txTermState *buf)
txTermState *buf
#endif
)
{
#if defined(HAVE_TERMIOS_H) /* POSIX */
(void) tcgetattr(fileno(stdin), buf);
#elif defined(HAVE_TERMIO_H) /* SYSV */
ioctl( fileno( stdin ), TCGETA, buf);
#else /* fallback to sgtty-style */
ASSERT(TxStdinIsatty, "txGetTermState");
/* save the current terminal characteristics */
(void) ioctl(fileno(stdin), TIOCGETP, (char *) &(buf->tx_i_sgtty) );
(void) ioctl(fileno(stdin), TIOCGETC, (char *) &(buf->tx_i_tchars) );
#endif
}
#endif /* SYSV */
/*
@ -1273,24 +1266,24 @@ txGetTermState(
void
txSetTermState(
#if defined(SYSV) || defined(CYGWIN)
struct termio *buf
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
#if defined(HAVE_TERMIOS_H)
struct termios *buf
#elif defined(HAVE_TERMIO_H)
struct termio *buf
#else
txTermState *buf
#endif /* SYSV */
)
#endif
)
{
#if defined(SYSV) || defined(CYGWIN)
ioctl( fileno(stdin), TCSETAF, buf );
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
#if defined(HAVE_TERMIOS_H) /* POSIX */
(void) tcsetattr( fileno(stdin), TCSANOW, buf );
#else
#elif defined(HAVE_TERMIO_H) /* SYSV */
ioctl( fileno(stdin), TCSETAF, buf );
#else /* fallback to sgtty-style */
/* set the current terminal characteristics */
(void) ioctl(fileno(stdin), TIOCSETN, (char *) &(buf->tx_i_sgtty) );
(void) ioctl(fileno(stdin), TIOCSETC, (char *) &(buf->tx_i_tchars) );
#endif /* SYSV */
#endif
}
@ -1313,37 +1306,36 @@ txSetTermState(
void
txInitTermRec(
#if defined(SYSV) || defined(CYGWIN)
struct termio *buf
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
#if defined(HAVE_TERMIOS_H)
struct termios *buf
#elif defined(HAVE_TERMIO_H)
struct termio *buf
#else
txTermState *buf
#endif /* SYSV */
)
#endif
)
{
#if defined(SYSV) || defined(CYGWIN) || defined(__OpenBSD__) || defined(EMSCRIPTEN)
#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
buf->c_lflag = ISIG; /* raw: no echo and no processing, allow signals */
buf->c_cc[ VMIN ] = 1;
buf->c_cc[ VTIME ] = 0;
#else
#else /* sgtty-style interface */
/* set things up for us, turn off echo, turn on cbreak, no EOF */
buf->tx_i_sgtty.sg_flags |= CBREAK;
buf->tx_i_sgtty.sg_flags &= ~ECHO;
buf->tx_i_tchars.t_eofc = -1;
#endif /* SYSV */
#endif
}
#if defined(SYSV) || defined(CYGWIN)
struct termio closeTermState;
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
#if defined(HAVE_TERMIOS_H)
struct termios closeTermState;
#elif defined(HAVE_TERMIO_H)
struct termio closeTermState;
#else
static txTermState closeTermState;
#endif /* SYSV */
#endif
static bool haveCloseState = FALSE;
@ -1366,21 +1358,18 @@ static bool haveCloseState = FALSE;
void
txSaveTerm(void)
{
#if defined(SYSV) || defined(CYGWIN)
ioctl( fileno( stdin ), TCGETA, &closeTermState);
txEraseChar = closeTermState.c_cc[VERASE];
txKillChar = closeTermState.c_cc[VKILL];
TxEOFChar = closeTermState.c_cc[VEOF];
TxInterruptChar = closeTermState.c_cc[VINTR];
haveCloseState = TRUE;
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
# if defined(HAVE_TERMIOS_H)
(void) tcgetattr( fileno( stdin ), &closeTermState);
# else /* HAVE_TERMIO_H */
ioctl( fileno( stdin ), TCGETA, &closeTermState);
# endif /* HAVE_TERMIOS_H || HAVE_TERMIO_H */
txEraseChar = closeTermState.c_cc[VERASE];
txKillChar = closeTermState.c_cc[VKILL];
TxEOFChar = closeTermState.c_cc[VEOF];
TxInterruptChar = closeTermState.c_cc[VINTR];
haveCloseState = TRUE;
#else
#else /* sgtty-style interface */
struct ltchars lt;
txGetTermState(&closeTermState);
(void) ioctl(fileno(stdin), TIOCGLTC, (char *) &lt);
@ -1393,7 +1382,7 @@ txSaveTerm(void)
TxEOFChar = closeTermState.tx_i_tchars.t_eofc;
TxInterruptChar = closeTermState.tx_i_tchars.t_intrc;
haveCloseState = TRUE;
#endif /* SYSV */
#endif
}
@ -1414,13 +1403,13 @@ txSaveTerm(void)
void
TxSetTerminal(void)
{
#if defined(SYSV) || defined(CYGWIN)
struct termio buf;
#elif defined (__OpenBSD__) || defined(EMSCRIPTEN)
#if defined(HAVE_TERMIOS_H)
struct termios buf;
#elif defined(HAVE_TERMIO_H)
struct termio buf;
#else
txTermState buf;
#endif /* SYSV */
#endif
#ifdef MAGIC_WRAPPER
/* If using Tk console, don't mess with the terminal settings; */

View File

@ -21,44 +21,18 @@
#ifndef _MAGIC__UTILS__MAGSGTTY_H
#define _MAGIC__UTILS__MAGSGTTY_H
/* maybe this can be #ifndef HAVE_TERMIO_H */
#if !defined(SYSV) && !defined(CYGWIN)
# ifdef ALPHA
# undef MAX
# undef MIN
#if defined(HAVE_TERMIOS_H) /* POSIX */
# include <termios.h>
#elif defined(HAVE_TERMIO_H) /* SYSV */
# include <termio.h>
# include <sys/ioctl.h>
#else /* Fallback for older BSD/V7 systems */
# if defined(HAVE_SGTTY_H)
# include <sgtty.h>
# elif defined(HAVE_SYS_IOCTL_COMPAT_H)
# include <sys/ioctl_compat.h>
# endif
/* unclear what platform requires this OpenBSD/FreeBSD ? */
# ifndef COMPAT_43TTY
# define COMPAT_43TTY
# endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
# include <sys/ioctl.h>
#endif
#if defined(HAVE_TERMIOS_H)
#include <termios.h>
#elif defined(HAVE_SYS_IOCTL_COMPAT_H)
/* unclear which platform(s) require <sys/ioctl_compat.h> and the structure
* of this file is such that it will try to include it by default, better
* to invert the #if and only select this on the known platforms that need
* it so that <termios.h> goes by default, which exists on MacOSX, Linux, etc..
* many possible solutions to make this work by default:
* HAVE_SYS_IOCTL_COMPAT_H ? HAVE_TERMIOS_H ? !defined(linux) at top (MaxOSX is BSD type)
*/
#include <sys/ioctl_compat.h> /* replaced sgtty.h */
#elif defined(HAVE_SGTTY_H)
#include <sgtty.h> /* legacy - struct sgttyb{} defn */
#endif
#else
#if defined(HAVE_TERMIO_H)
#include <termio.h>
#endif
#endif /* !SYSV && !CYGWIN */
#endif /* _MAGIC__UTILS__MAGSGTTY_H */