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
+23 -19
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();
+49 -41
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);
+8 -1
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 ------------------- */