Merge branch 'master' of https://github.com/RTimothyEdwards/magic into spice_hier

This commit is contained in:
Dan Moore 2021-02-12 11:17:25 -08:00
commit d12816b499
8 changed files with 75 additions and 26 deletions

View File

@ -1 +1 @@
8.3.124
8.3.125

View File

@ -244,7 +244,7 @@ done:
if (mw != NULL)
{
if (calmaLookCell(libname, NULL) != (CellDef *)NULL)
DBWloadWindow(mw, libname, FALSE, FALSE);
DBWloadWindow(mw, libname, 0);
}
freeMagic(libname);
}

View File

@ -3403,7 +3403,7 @@ CmdDown(w, cmd)
GeoTransRect(&EditToRootTransform, &(EditCellUse->cu_def->cd_bbox), &area);
(void) WindSearch(DBWclientID, (ClientData) NULL,
(Rect *) NULL, cmdEditRedisplayFunc, (ClientData) &area);
DBWloadWindow(w, EditCellUse->cu_def->cd_name, TRUE, FALSE, FALSE);
DBWloadWindow(w, EditCellUse->cu_def->cd_name, DBW_LOAD_IGNORE_TECH);
}
/* Search function to find the new edit cell: look for a cell use

View File

@ -313,6 +313,7 @@ CmdLabel(w, cmd)
#define LOAD_DEREFERENCE 1
#define LOAD_FORCE 2
#define LOAD_QUIET 3
#define LOAD_FAIL 4
/*
* ----------------------------------------------------------------------------
@ -322,7 +323,7 @@ CmdLabel(w, cmd)
* Implement the "load" command.
*
* Usage:
* load [name [scaled n [d]]] [-force] [-nowindow] [-dereference] [-quiet]
* load [name [scaled n [d]]] [-force] [-nowindow] [-dereference] [-quiet] [-fail]
*
* If name is supplied, then the window containing the point tool is
* remapped so as to edit the cell with the given name.
@ -364,7 +365,9 @@ CmdLoad(w, cmd)
bool noWindow = FALSE;
bool dereference = FALSE;
bool beQuiet = FALSE;
bool failNotFound = FALSE;
bool saveVerbose;
unsigned char flags;
int keepGoing(); /* forward declaration */
extern bool DBVerbose; /* from DBio.c */
@ -376,6 +379,7 @@ CmdLoad(w, cmd)
"-dereference use search paths and ignore embedded cell paths in file",
"-force load file even if tech in header does not match",
"-quiet no alert if file does not exist",
"-fail if file does not exist, do not create a new cell",
NULL
};
@ -396,6 +400,9 @@ CmdLoad(w, cmd)
case LOAD_QUIET:
beQuiet = TRUE;
break;
case LOAD_FAIL:
failNotFound = TRUE;
break;
default:
TxError("No such option \"%s\".\n", cmd->tx_argv[locargc - 1]);
}
@ -424,7 +431,7 @@ CmdLoad(w, cmd)
else if (!ignoreTech && !noWindow && !dereference)
{
TxError("Usage: %s name [scaled n [d]] [-force] "
"[-nowindow] [-dereference] [-quiet]\n",
"[-nowindow] [-dereference] [-quiet] [-fail]\n",
cmd->tx_argv[0]);
return;
}
@ -450,8 +457,13 @@ CmdLoad(w, cmd)
}
#endif
DBVerbose = !beQuiet;
DBWloadWindow((noWindow == TRUE) ? NULL : w, cmd->tx_argv[1],
ignoreTech, FALSE, dereference);
flags = 0;
if (ignoreTech) flags |= DBW_LOAD_IGNORE_TECH;
if (dereference) flags |= DBW_LOAD_DEREFERENCE;
if (failNotFound) flags |= DBW_LOAD_FAIL;
if (beQuiet) flags |= DBW_LOAD_QUIET;
DBWloadWindow((noWindow == TRUE) ? NULL : w, cmd->tx_argv[1], flags);
DBVerbose = saveVerbose;
if ((n > 1) || (d > 1))
@ -488,7 +500,7 @@ CmdLoad(w, cmd)
else
{
DBVerbose = !beQuiet;
DBWloadWindow(w, (char *) NULL, TRUE, FALSE, FALSE);
DBWloadWindow(w, (char *) NULL, DBW_LOAD_IGNORE_TECH);
DBVerbose = saveVerbose;
}
}

View File

@ -1885,9 +1885,9 @@ CmdXload(w, cmd)
{
if (CmdIllegalChars(cmd->tx_argv[1], "[],", "Cell name"))
return;
DBWloadWindow(w, cmd->tx_argv[1], FALSE, TRUE, FALSE);
DBWloadWindow(w, cmd->tx_argv[1], DBW_LOAD_EXPAND);
}
else DBWloadWindow(w, (char *) NULL, FALSE, TRUE, FALSE);
else DBWloadWindow(w, (char *) NULL, DBW_LOAD_EXPAND);
}
/*

View File

@ -127,10 +127,10 @@ DBWcreate(window, argc, argv)
window->w_clientData = (ClientData) crec;
if (argc > 0)
DBWloadWindow(window, argv[0], TRUE, FALSE, FALSE);
DBWloadWindow(window, argv[0], DBW_LOAD_IGNORE_TECH);
else if (ToolGetBox(&boxDef, &box))
{
DBWloadWindow(window, boxDef->cd_name, TRUE, FALSE, FALSE);
DBWloadWindow(window, boxDef->cd_name, DBW_LOAD_IGNORE_TECH);
/* Zoom in on the box, leaving a 10% border or at least 2 units
* on each side.
@ -148,7 +148,7 @@ DBWcreate(window, argc, argv)
}
else
{
DBWloadWindow(window, (char *) NULL, TRUE, FALSE, FALSE);
DBWloadWindow(window, (char *) NULL, DBW_LOAD_IGNORE_TECH);
}
return TRUE;
}
@ -249,11 +249,10 @@ dbwReloadFunc(w, name)
MagWindow *w;
char *name;
{
DBWloadWindow(w, name, TRUE, FALSE, FALSE);
DBWloadWindow(w, name, DBW_LOAD_IGNORE_TECH);
return (0);
}
/*
* ----------------------------------------------------------------------------
*
@ -273,21 +272,19 @@ dbwReloadFunc(w, name)
* to the topmost cell in the new window. Otherwise, the edit
* cell doesn't change.
*
* Flags:
* If "expand" is true, unexpands all subcells of the root cell.
* If "dereference" is true, ignore path reference in the input file.
* If "fail" is true, do not create a new cell if no file is found.
*
* ----------------------------------------------------------------------------
*/
void
DBWloadWindow(window, name, ignoreTech, expand, dereference)
MagWindow *window; /* Identifies window to which cell is to be bound */
char *name; /* Name of new cell to be bound to this window */
bool ignoreTech; /* If FALSE, indicates that the technology of
* the layout must match the current technology.
*/
bool expand; /* Indicates whether or not to expand the cell */
bool dereference; /* If TRUE, ignore path references in the input */
DBWloadWindow(window, name, flags)
MagWindow *window; /* Identifies window to which cell is to be bound */
char *name; /* Name of new cell to be bound to this window */
unsigned char flags; /* See flags below */
{
CellDef *newEditDef, *deleteDef;
CellUse *newEditUse;
@ -299,12 +296,26 @@ DBWloadWindow(window, name, ignoreTech, expand, dereference)
bool isUnnamed;
int UnexpandFunc(); /* forward declaration */
bool ignoreTech; /* If FALSE, indicates that the technology of
* the layout must match the current technology.
*/
bool expand; /* Indicates whether or not to expand the cell */
bool dereference; /* If TRUE, ignore path references in the input */
bool dofail; /* If TRUE, do not create a cell if file not found */
bool beQuiet; /* If TRUE, do not print messages during load */
ignoreTech = ((flags & DBW_LOAD_IGNORE_TECH) == 0) ? FALSE : TRUE;
expand = ((flags & DBW_LOAD_EXPAND) == 0) ? FALSE : TRUE;
dereference = ((flags & DBW_LOAD_DEREFERENCE) == 0) ? FALSE : TRUE;
dofail = ((flags & DBW_LOAD_FAIL) == 0) ? FALSE : TRUE;
beQuiet = ((flags & DBW_LOAD_QUIET) == 0) ? FALSE : TRUE;
loadBox.r_xbot = loadBox.r_ybot = 0;
loadBox.r_xtop = loadBox.r_ytop = 1;
/* See if we're to change the edit cell */
newEdit = !WindSearch((WindClient) DBWclientID, (ClientData) NULL,
(Rect *) NULL, dbwLoadFunc, (ClientData) window);
(Rect *) NULL, dbwLoadFunc, (ClientData) window);
/* The (UNNAMED) cell generally gets in the way, so delete it if */
/* any new cell is loaded and (UNNAMED) has no contents. */
@ -392,12 +403,28 @@ DBWloadWindow(window, name, ignoreTech, expand, dereference)
if (newEditDef == NULL)
{
if (dofail)
{
if (!beQuiet)
TxError("No file \"%s\" found or readable.\n", name);
return;
}
rootname = name;
newEditDef = DBCellLookDef(rootname);
}
}
if (newEditDef == (CellDef *) NULL)
{
/* "-fail" option: If no file is readable, then do not */
/* create a new cell. */
if (dofail)
{
if (!beQuiet)
TxError("No file \"%s\" found or readable.\n", name);
return;
}
newEditDef = DBCellNewDef(rootname);
}
if (dereference) newEditDef->cd_flags |= CDDEREFERENCE;
@ -405,7 +432,8 @@ DBWloadWindow(window, name, ignoreTech, expand, dereference)
{
if (error_val == ENOENT)
{
TxPrintf("Creating new cell\n");
if (!beQuiet)
TxPrintf("Creating new cell\n");
DBCellSetAvail(newEditDef);
}
else

View File

@ -146,6 +146,14 @@ extern char *DBWChangeButtonHandler();
extern void DBWPrintButtonDoc();
extern void DBWBoxHandler();
/* The following values are flags passed to DBWloadWindow() */
#define DBW_LOAD_IGNORE_TECH 1 /* Force load even if tech line does not match */
#define DBW_LOAD_EXPAND 2 /* Expand cell after loading */
#define DBW_LOAD_DEREFERENCE 4 /* Dereference instance file paths when loading */
#define DBW_LOAD_FAIL 8 /* Do not create new cell if file is not loadable */
#define DBW_LOAD_QUIET 16 /* Suppress error messages during load */
/* The following defines are used to indicate corner positions
* of the box:
*/

View File

@ -30,6 +30,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header$";
#include "graphics/graphics.h"
#include "windows/windInt.h"
#include "textio/textio.h"
#include "dbwind/dbwind.h"
extern void windNewView();
@ -95,7 +96,7 @@ WindUnload(surfaceID)
for (mw = windTopWindow; mw != NULL; mw = mw->w_nextWindow)
if (mw->w_surfaceID == surfaceID)
DBWloadWindow(mw, (char *)NULL, TRUE, FALSE, FALSE);
DBWloadWindow(mw, (char *)NULL, DBW_LOAD_IGNORE_TECH);
}
/*