Modified the "load" command so that "-quiet" is promoted to

"-silent", and "-quiet" now produces relatively little output
except for important warnings and errors.
This commit is contained in:
Tim Edwards 2022-12-19 11:20:50 -05:00
parent a0f502501e
commit 23b8d08f86
5 changed files with 95 additions and 71 deletions

View File

@ -1 +1 @@
8.3.355 8.3.356

View File

@ -347,7 +347,8 @@ CmdLabel(w, cmd)
#define LOAD_DEREFERENCE 1 #define LOAD_DEREFERENCE 1
#define LOAD_FORCE 2 #define LOAD_FORCE 2
#define LOAD_QUIET 3 #define LOAD_QUIET 3
#define LOAD_FAIL 4 #define LOAD_SILENT 4
#define LOAD_FAIL 5
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
@ -398,12 +399,12 @@ CmdLoad(w, cmd)
bool ignoreTech = FALSE; bool ignoreTech = FALSE;
bool noWindow = FALSE; bool noWindow = FALSE;
bool dereference = FALSE; bool dereference = FALSE;
bool beQuiet = FALSE; char verbose = DB_VERBOSE_WARN;
bool failNotFound = FALSE; bool failNotFound = FALSE;
bool saveVerbose; unsigned char saveVerbose;
unsigned char flags; unsigned char flags;
int keepGoing(); /* forward declaration */ int keepGoing(); /* forward declaration */
extern bool DBVerbose; /* from DBio.c */ extern unsigned char DBVerbose; /* from DBio.c */
saveVerbose = DBVerbose; saveVerbose = DBVerbose;
@ -412,7 +413,8 @@ CmdLoad(w, cmd)
"-nowindow load file but do not display in the layout window", "-nowindow load file but do not display in the layout window",
"-dereference use search paths and ignore embedded cell paths in file", "-dereference use search paths and ignore embedded cell paths in file",
"-force load file even if tech in header does not match", "-force load file even if tech in header does not match",
"-quiet no alert if file does not exist", "-quiet only errors printed",
"-silent no alert if file does not exist",
"-fail if file does not exist, do not create a new cell", "-fail if file does not exist, do not create a new cell",
NULL NULL
}; };
@ -432,7 +434,10 @@ CmdLoad(w, cmd)
ignoreTech = TRUE; ignoreTech = TRUE;
break; break;
case LOAD_QUIET: case LOAD_QUIET:
beQuiet = TRUE; verbose = DB_VERBOSE_ERR;
break;
case LOAD_SILENT:
verbose = DB_VERBOSE_NONE;
break; break;
case LOAD_FAIL: case LOAD_FAIL:
failNotFound = TRUE; failNotFound = TRUE;
@ -490,12 +495,12 @@ CmdLoad(w, cmd)
*(cmd->tx_argv[1] + strlen(cmd->tx_argv[1]) - 1) = '\0'; *(cmd->tx_argv[1] + strlen(cmd->tx_argv[1]) - 1) = '\0';
} }
#endif #endif
DBVerbose = !beQuiet; DBVerbose = verbose;
flags = 0; flags = 0;
if (ignoreTech) flags |= DBW_LOAD_IGNORE_TECH; if (ignoreTech) flags |= DBW_LOAD_IGNORE_TECH;
if (dereference) flags |= DBW_LOAD_DEREFERENCE; if (dereference) flags |= DBW_LOAD_DEREFERENCE;
if (failNotFound) flags |= DBW_LOAD_FAIL; if (failNotFound) flags |= DBW_LOAD_FAIL;
if (beQuiet) flags |= DBW_LOAD_QUIET; if (verbose < DB_VERBOSE_WARN) flags |= DBW_LOAD_QUIET;
DBWloadWindow((noWindow == TRUE) ? NULL : w, cmd->tx_argv[1], flags); DBWloadWindow((noWindow == TRUE) ? NULL : w, cmd->tx_argv[1], flags);
DBVerbose = saveVerbose; DBVerbose = saveVerbose;
@ -533,7 +538,7 @@ CmdLoad(w, cmd)
} }
else else
{ {
DBVerbose = !beQuiet; DBVerbose = verbose;
DBWloadWindow(w, (char *) NULL, DBW_LOAD_IGNORE_TECH); DBWloadWindow(w, (char *) NULL, DBW_LOAD_IGNORE_TECH);
DBVerbose = saveVerbose; DBVerbose = saveVerbose;
} }

View File

@ -91,8 +91,8 @@ char *DBSuffix = ".mag";
/* Magic units per lambda (2 integers, representing (n / d) */ /* Magic units per lambda (2 integers, representing (n / d) */
int DBLambda[2] = {1, 1}; int DBLambda[2] = {1, 1};
/* If set to FALSE, don't print warning messages. */ /* See database.h for verbose levels */
bool DBVerbose = TRUE; unsigned char DBVerbose = DB_VERBOSE_WARN;
/* Global name of backup file for this session */ /* Global name of backup file for this session */
static char *DBbackupFile = (char *)NULL; static char *DBbackupFile = (char *)NULL;
@ -657,21 +657,25 @@ dbCellReadDef(f, cellDef, name, ignoreTech, dereference)
#endif #endif
DBScaleEverything(d, 1); DBScaleEverything(d, 1);
DBLambda[1] *= d; DBLambda[1] *= d;
if (DBVerbose >= DB_VERBOSE_ALL)
TxPrintf("Input cell %s scales magic internal geometry by factor of %d\n", TxPrintf("Input cell %s scales magic internal geometry by factor of %d\n",
cellDef->cd_name, d); cellDef->cd_name, d);
d = 1; d = 1;
} }
if (n > 1) if (n > 1)
{ {
if (DBVerbose >= DB_VERBOSE_ALL)
TxPrintf("Scaled magic input cell %s geometry by factor of %d", TxPrintf("Scaled magic input cell %s geometry by factor of %d",
cellDef->cd_name, n); cellDef->cd_name, n);
if (d > 1) if (d > 1)
{ {
if (DBVerbose >= DB_VERBOSE_ALL)
TxPrintf("/ %d\n", d); TxPrintf("/ %d\n", d);
if (DBVerbose >= DB_VERBOSE_WARN)
TxError("Warning: Geometry may be lost because internal grid" TxError("Warning: Geometry may be lost because internal grid"
" cannot be reduced.\n"); " cannot be reduced.\n");
} }
else else if (DBVerbose >= DB_VERBOSE_ALL)
TxPrintf("\n"); TxPrintf("\n");
} }
@ -783,7 +787,7 @@ nextrect:
if (!GetRect(f, 4, rp, n, d)) goto badfile; if (!GetRect(f, 4, rp, n, d)) goto badfile;
} }
if ((++rectCount % rectReport == 0) && DBVerbose) if ((++rectCount % rectReport == 0) && (DBVerbose >= DB_VERBOSE_ALL))
{ {
TxPrintf("%s: %d rects\n", cellDef->cd_name, rectCount); TxPrintf("%s: %d rects\n", cellDef->cd_name, rectCount);
fflush(stdout); fflush(stdout);
@ -1253,7 +1257,7 @@ DBCellRead(cellDef, name, ignoreTech, dereference, errptr)
* Notes: * Notes:
* Global variable DBVerbose determines whether or not error * Global variable DBVerbose determines whether or not error
* messages are generated by this routine. This can be controlled * messages are generated by this routine. This can be controlled
* by "load -quiet". * by "load -quiet" or "load -silent".
* *
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
@ -1333,7 +1337,7 @@ dbReadOpen(cellDef, name, setFileName, dereference, errptr)
/* somewhere else in the search paths. */ /* somewhere else in the search paths. */
if (pptr != NULL) *pptr = '.'; if (pptr != NULL) *pptr = '.';
if (DBVerbose) if (DBVerbose >= DB_VERBOSE_WARN)
if (!dereference) if (!dereference)
TxError("Warning: Parent cell lists instance of \"%s\" at " TxError("Warning: Parent cell lists instance of \"%s\" at "
"bad file path %s.\n", "bad file path %s.\n",
@ -1343,7 +1347,7 @@ dbReadOpen(cellDef, name, setFileName, dereference, errptr)
/* generate another error later. */ /* generate another error later. */
StrDup(&cellDef->cd_file, filename); StrDup(&cellDef->cd_file, filename);
if (DBVerbose) if (DBVerbose >= DB_VERBOSE_WARN)
if (!dereference) if (!dereference)
{ {
TxError("The cell exists in the search paths at %s.\n", TxError("The cell exists in the search paths at %s.\n",
@ -1383,23 +1387,23 @@ dbReadOpen(cellDef, name, setFileName, dereference, errptr)
if (name != (char *) NULL) if (name != (char *) NULL)
{ {
if (DBVerbose) if (DBVerbose >= DB_VERBOSE_ERR)
TxError("File %s%s couldn't be read\n", name, DBSuffix); TxError("File %s%s couldn't be read\n", name, DBSuffix);
} }
else if (cellDef->cd_file != (char *) NULL) else if (cellDef->cd_file != (char *) NULL)
{ {
if (DBVerbose) if (DBVerbose >= DB_VERBOSE_ERR)
TxError("File %s couldn't be read\n", cellDef->cd_file); TxError("File %s couldn't be read\n", cellDef->cd_file);
} }
else { else {
if (DBVerbose) if (DBVerbose >= DB_VERBOSE_ERR)
TxError("Cell %s couldn't be read\n", cellDef->cd_name); TxError("Cell %s couldn't be read\n", cellDef->cd_name);
realname = (char *) mallocMagic((unsigned) (strlen(cellDef->cd_name) realname = (char *) mallocMagic((unsigned) (strlen(cellDef->cd_name)
+ strlen(DBSuffix) + 1)); + strlen(DBSuffix) + 1));
(void) sprintf(realname, "%s%s", cellDef->cd_name, DBSuffix); (void) sprintf(realname, "%s%s", cellDef->cd_name, DBSuffix);
StrDup(&cellDef->cd_file, realname); StrDup(&cellDef->cd_file, realname);
} }
if (errptr && DBVerbose) TxError("%s\n", strerror(*errptr)); if (errptr && (DBVerbose >= DB_VERBOSE_ERR)) TxError("%s\n", strerror(*errptr));
cellDef->cd_flags |= CDNOTFOUND; cellDef->cd_flags |= CDNOTFOUND;
return ((FILETYPE) NULL); return ((FILETYPE) NULL);
@ -1411,7 +1415,7 @@ dbReadOpen(cellDef, name, setFileName, dereference, errptr)
if (file_is_not_writeable(filename) || (is_locked == TRUE)) if (file_is_not_writeable(filename) || (is_locked == TRUE))
{ {
cellDef->cd_flags |= CDNOEDIT; cellDef->cd_flags |= CDNOEDIT;
if ((is_locked == FALSE) && DBVerbose) if ((is_locked == FALSE) && (DBVerbose >= DB_VERBOSE_WARN))
TxPrintf("Warning: cell <%s> from file %s is not writeable\n", TxPrintf("Warning: cell <%s> from file %s is not writeable\n",
cellDef->cd_name, filename); cellDef->cd_name, filename);
} }
@ -1425,7 +1429,7 @@ dbReadOpen(cellDef, name, setFileName, dereference, errptr)
cellDef->cd_flags &= ~CDNOTFOUND; cellDef->cd_flags &= ~CDNOTFOUND;
} }
#else #else
if (file_is_not_writeable(filename) && DBVerbose) if (file_is_not_writeable(filename) && (DBVerbose >= DB_VERBOSE_WARN))
TxPrintf("Warning: cell <%s> from file %s is not writeable\n", TxPrintf("Warning: cell <%s> from file %s is not writeable\n",
cellDef->cd_name, filename); cellDef->cd_name, filename);
TxFlushOut(); TxFlushOut();

View File

@ -601,11 +601,12 @@ DBAdjustLabels(def, area)
newType = DBPickLabelLayer(def, lab, 0); newType = DBPickLabelLayer(def, lab, 0);
if (newType == lab->lab_type) continue; if (newType == lab->lab_type) continue;
if (lab->lab_flags & LABEL_STICKY) continue; if (lab->lab_flags & LABEL_STICKY) continue;
if (DBVerbose && ((def->cd_flags & CDINTERNAL) == 0)) { if ((DBVerbose >= DB_VERBOSE_ALL) && ((def->cd_flags & CDINTERNAL) == 0))
{
TxPrintf("Moving label \"%s\" from %s to %s in cell %s.\n", TxPrintf("Moving label \"%s\" from %s to %s in cell %s.\n",
lab->lab_text, DBTypeLongName(lab->lab_type), lab->lab_text, DBTypeLongName(lab->lab_type),
DBTypeLongName(newType), def->cd_name); DBTypeLongName(newType), def->cd_name);
}; }
DBUndoEraseLabel(def, lab); DBUndoEraseLabel(def, lab);
lab->lab_type = newType; lab->lab_type = newType;
DBUndoPutLabel(def, lab); DBUndoPutLabel(def, lab);
@ -617,9 +618,10 @@ DBAdjustLabels(def, area)
/* /*
* Extended version of DBAdjustLabels. If noreconnect==0, * Extended version of DBAdjustLabels. If noreconnect == 0,
* this is supposed to be the same as DBAdjustlabels() above. * this is supposed to be the same as DBAdjustlabels() above.
*/ */
void void
DBAdjustLabelsNew(def, area, noreconnect) DBAdjustLabelsNew(def, area, noreconnect)
CellDef *def; /* Cell whose paint was changed. */ CellDef *def; /* Cell whose paint was changed. */
@ -641,15 +643,18 @@ DBAdjustLabelsNew(def, area, noreconnect)
while (lab != NULL) while (lab != NULL)
{ {
int locnoreconnect = noreconnect; int locnoreconnect = noreconnect;
if (!GEO_TOUCH(&lab->lab_rect, area)) { if (!GEO_TOUCH(&lab->lab_rect, area))
{
goto nextLab; goto nextLab;
} }
if (lab->lab_type == TT_SPACE) locnoreconnect = FALSE; if (lab->lab_type == TT_SPACE) locnoreconnect = FALSE;
newType = DBPickLabelLayer(def, lab, locnoreconnect); newType = DBPickLabelLayer(def, lab, locnoreconnect);
if (newType == lab->lab_type) { if (newType == lab->lab_type)
{
goto nextLab; goto nextLab;
} }
if(newType < 0 && !(lab->lab_flags & LABEL_STICKY)) { if (newType < 0 && !(lab->lab_flags & LABEL_STICKY))
{
TxPrintf("Deleting ambiguous-layer label \"%s\" from %s in cell %s.\n", TxPrintf("Deleting ambiguous-layer label \"%s\" from %s in cell %s.\n",
lab->lab_text, DBTypeLongName(lab->lab_type), lab->lab_text, DBTypeLongName(lab->lab_type),
def->cd_name); def->cd_name);
@ -666,8 +671,11 @@ DBAdjustLabelsNew(def, area, noreconnect)
lab = lab->lab_next; lab = lab->lab_next;
modified = TRUE; modified = TRUE;
continue; continue;
} else if (!(lab->lab_flags & LABEL_STICKY)) { }
if (DBVerbose && ((def->cd_flags & CDINTERNAL) == 0)) { else if (!(lab->lab_flags & LABEL_STICKY))
{
if ((DBVerbose >= DB_VERBOSE_ALL) && ((def->cd_flags & CDINTERNAL) == 0))
{
TxPrintf("Moving label \"%s\" from %s to %s in cell %s.\n", TxPrintf("Moving label \"%s\" from %s to %s in cell %s.\n",
lab->lab_text, DBTypeLongName(lab->lab_type), lab->lab_text, DBTypeLongName(lab->lab_type),
DBTypeLongName(newType), def->cd_name); DBTypeLongName(newType), def->cd_name);
@ -677,7 +685,7 @@ DBAdjustLabelsNew(def, area, noreconnect)
DBUndoPutLabel(def, lab); DBUndoPutLabel(def, lab);
modified = TRUE; modified = TRUE;
} }
nextLab: nextLab:
labPrev = lab; labPrev = lab;
lab = lab->lab_next; lab = lab->lab_next;
} }

View File

@ -1028,7 +1028,14 @@ extern char *DBSuffix; /* Suffix appended to all Magic cell names */
/* -------------------- User Interface Stuff -------------------------- */ /* -------------------- User Interface Stuff -------------------------- */
extern bool DBVerbose; /* If FALSE, don't print warning messages */ extern unsigned char DBVerbose; /* If 0, don't print any messages */
/* If 1, print only error messages */
/* If 2, print errors and warnings */
/* If > 2, print all messages */
#define DB_VERBOSE_NONE 0
#define DB_VERBOSE_ERR 1
#define DB_VERBOSE_WARN 2
#define DB_VERBOSE_ALL 3
/* ------------------ Exported technology variables ------------------- */ /* ------------------ Exported technology variables ------------------- */