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_FORCE 2
#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 noWindow = FALSE;
bool dereference = FALSE;
bool beQuiet = FALSE;
char verbose = DB_VERBOSE_WARN;
bool failNotFound = FALSE;
bool saveVerbose;
unsigned char saveVerbose;
unsigned char flags;
int keepGoing(); /* forward declaration */
extern bool DBVerbose; /* from DBio.c */
extern unsigned char DBVerbose; /* from DBio.c */
saveVerbose = DBVerbose;
@ -412,7 +413,8 @@ CmdLoad(w, cmd)
"-nowindow load file but do not display in the layout window",
"-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",
"-quiet only errors printed",
"-silent no alert if file does not exist",
"-fail if file does not exist, do not create a new cell",
NULL
};
@ -432,7 +434,10 @@ CmdLoad(w, cmd)
ignoreTech = TRUE;
break;
case LOAD_QUIET:
beQuiet = TRUE;
verbose = DB_VERBOSE_ERR;
break;
case LOAD_SILENT:
verbose = DB_VERBOSE_NONE;
break;
case LOAD_FAIL:
failNotFound = TRUE;
@ -490,12 +495,12 @@ CmdLoad(w, cmd)
*(cmd->tx_argv[1] + strlen(cmd->tx_argv[1]) - 1) = '\0';
}
#endif
DBVerbose = !beQuiet;
DBVerbose = verbose;
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;
if (verbose < DB_VERBOSE_WARN) flags |= DBW_LOAD_QUIET;
DBWloadWindow((noWindow == TRUE) ? NULL : w, cmd->tx_argv[1], flags);
DBVerbose = saveVerbose;
@ -533,7 +538,7 @@ CmdLoad(w, cmd)
}
else
{
DBVerbose = !beQuiet;
DBVerbose = verbose;
DBWloadWindow(w, (char *) NULL, DBW_LOAD_IGNORE_TECH);
DBVerbose = saveVerbose;
}

View File

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

View File

@ -601,11 +601,12 @@ DBAdjustLabels(def, area)
newType = DBPickLabelLayer(def, lab, 0);
if (newType == lab->lab_type) 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",
lab->lab_text, DBTypeLongName(lab->lab_type),
DBTypeLongName(newType), def->cd_name);
};
}
DBUndoEraseLabel(def, lab);
lab->lab_type = newType;
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.
*/
void
DBAdjustLabelsNew(def, area, noreconnect)
CellDef *def; /* Cell whose paint was changed. */
@ -640,46 +642,52 @@ DBAdjustLabelsNew(def, area, noreconnect)
lab = def->cd_labels;
while (lab != NULL)
{
int locnoreconnect = noreconnect;
if (!GEO_TOUCH(&lab->lab_rect, area)) {
goto nextLab;
}
if (lab->lab_type == TT_SPACE) locnoreconnect = FALSE;
newType = DBPickLabelLayer(def, lab, locnoreconnect);
if (newType == lab->lab_type) {
goto nextLab;
}
if(newType < 0 && !(lab->lab_flags & LABEL_STICKY)) {
TxPrintf("Deleting ambiguous-layer label \"%s\" from %s in cell %s.\n",
lab->lab_text, DBTypeLongName(lab->lab_type),
def->cd_name);
int locnoreconnect = noreconnect;
if (!GEO_TOUCH(&lab->lab_rect, area))
{
goto nextLab;
}
if (lab->lab_type == TT_SPACE) locnoreconnect = FALSE;
newType = DBPickLabelLayer(def, lab, locnoreconnect);
if (newType == lab->lab_type)
{
goto nextLab;
}
if (newType < 0 && !(lab->lab_flags & LABEL_STICKY))
{
TxPrintf("Deleting ambiguous-layer label \"%s\" from %s in cell %s.\n",
lab->lab_text, DBTypeLongName(lab->lab_type),
def->cd_name);
if (labPrev == NULL)
def->cd_labels = lab->lab_next;
else
labPrev->lab_next = lab->lab_next;
if (def->cd_lastLabel == lab)
def->cd_lastLabel = labPrev;
DBUndoEraseLabel(def, lab);
DBWLabelChanged(def, lab, DBW_ALLWINDOWS);
freeMagic((char *) lab);
lab = lab->lab_next;
modified = TRUE;
continue;
} else if (!(lab->lab_flags & LABEL_STICKY)) {
if (DBVerbose && ((def->cd_flags & CDINTERNAL) == 0)) {
TxPrintf("Moving label \"%s\" from %s to %s in cell %s.\n",
lab->lab_text, DBTypeLongName(lab->lab_type),
DBTypeLongName(newType), def->cd_name);
}
DBUndoEraseLabel(def, lab);
lab->lab_type = newType;
DBUndoPutLabel(def, lab);
modified = TRUE;
}
nextLab:
labPrev = lab;
if (labPrev == NULL)
def->cd_labels = lab->lab_next;
else
labPrev->lab_next = lab->lab_next;
if (def->cd_lastLabel == lab)
def->cd_lastLabel = labPrev;
DBUndoEraseLabel(def, lab);
DBWLabelChanged(def, lab, DBW_ALLWINDOWS);
freeMagic((char *) lab);
lab = lab->lab_next;
modified = TRUE;
continue;
}
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",
lab->lab_text, DBTypeLongName(lab->lab_type),
DBTypeLongName(newType), def->cd_name);
}
DBUndoEraseLabel(def, lab);
lab->lab_type = newType;
DBUndoPutLabel(def, lab);
modified = TRUE;
}
nextLab:
labPrev = lab;
lab = lab->lab_next;
}
if (modified) DBCellSetModified(def, TRUE);

View File

@ -1028,7 +1028,14 @@ extern char *DBSuffix; /* Suffix appended to all Magic cell names */
/* -------------------- 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 ------------------- */