Cleaned up an inconsistency with GDS read-in that generates

informational output that references a (non-existing) CIF file.
This commit is contained in:
Tim Edwards 2019-07-23 08:45:42 -04:00
parent c229139150
commit d08593997a
9 changed files with 113 additions and 79 deletions

View File

@ -141,7 +141,7 @@ calmaSetPosition(sname)
return originalPos; return originalPos;
} }
calmaReadError("Cell \"%s\" is used but not defined in this file.\n", sname); CalmaReadError("Cell \"%s\" is used but not defined in this file.\n", sname);
return originalPos; return originalPos;
} }
@ -318,23 +318,23 @@ calmaParseStructure(filename)
if (!CalmaPostOrder) if (!CalmaPostOrder)
{ {
calmaReadError("Cell \"%s\" was already defined in this file.\n", CalmaReadError("Cell \"%s\" was already defined in this file.\n",
strname); strname);
calmaReadError("Ignoring duplicate definition\n"); CalmaReadError("Ignoring duplicate definition\n");
} }
calmaNextCell(); calmaNextCell();
return TRUE; return TRUE;
} }
else else
{ {
calmaReadError("Cell \"%s\" was already defined in this file.\n", CalmaReadError("Cell \"%s\" was already defined in this file.\n",
strname); strname);
for (suffix = 1; HashGetValue(he) != NULL; suffix++) for (suffix = 1; HashGetValue(he) != NULL; suffix++)
{ {
(void) sprintf(newname, "%s_%d", strname, suffix); (void) sprintf(newname, "%s_%d", strname, suffix);
he = HashFind(&calmaDefInitHash, newname); he = HashFind(&calmaDefInitHash, newname);
} }
calmaReadError("Giving this cell a new name: %s\n", newname); CalmaReadError("Giving this cell a new name: %s\n", newname);
strncpy(strname, newname, CALMANAMELENGTH*2); strncpy(strname, newname, CALMANAMELENGTH*2);
} }
} }
@ -437,7 +437,7 @@ calmaParseStructure(filename)
* the appropriate cell of the database. * the appropriate cell of the database.
*/ */
CIFPaintCurrent(); CIFPaintCurrent(FILE_CALMA);
} }
DBAdjustLabelsNew(cifReadCellDef, &TiPlaneRect, DBAdjustLabelsNew(cifReadCellDef, &TiPlaneRect,
@ -508,7 +508,7 @@ calmaParseElement(filename, pnsrefs, pnpaths)
READRH(nbytes, rtype); READRH(nbytes, rtype);
if (nbytes < 0) if (nbytes < 0)
{ {
calmaReadError("Unexpected EOF.\n"); CalmaReadError("Unexpected EOF.\n");
return (FALSE); return (FALSE);
} }
@ -536,7 +536,7 @@ calmaParseElement(filename, pnsrefs, pnpaths)
calmaElementText(); calmaElementText();
break; break;
case CALMA_NODE: case CALMA_NODE:
calmaReadError("NODE elements not supported: skipping.\n"); CalmaReadError("NODE elements not supported: skipping.\n");
calmaSkipSet(node); calmaSkipSet(node);
break; break;
default: default:
@ -664,10 +664,10 @@ calmaElementSref(filename)
if (DBIsAncestor(def, cifReadCellDef)) if (DBIsAncestor(def, cifReadCellDef))
{ {
calmaReadError("Cell %s is an ancestor of %s", CalmaReadError("Cell %s is an ancestor of %s",
def->cd_name, cifReadCellDef->cd_name); def->cd_name, cifReadCellDef->cd_name);
calmaReadError(" and can't be used as a subcell.\n"); CalmaReadError(" and can't be used as a subcell.\n");
calmaReadError("(Use skipped)\n"); CalmaReadError("(Use skipped)\n");
return -1; return -1;
} }
@ -722,12 +722,12 @@ calmaElementSref(filename)
nref = nbytes / 8; nref = nbytes / 8;
if (nref > 3) if (nref > 3)
{ {
calmaReadError("Too many points (%d) in SREF/AREF\n", nref); CalmaReadError("Too many points (%d) in SREF/AREF\n", nref);
nref = 3; nref = 3;
} }
else if (nref < 1) else if (nref < 1)
{ {
calmaReadError("Missing reference points in SREF/AREF (using 0,0)\n"); CalmaReadError("Missing reference points in SREF/AREF (using 0,0)\n");
refarray[0].p_x = refarray[0].p_y = 0; refarray[0].p_x = refarray[0].p_y = 0;
refarray[1].p_x = refarray[1].p_y = 0; refarray[1].p_x = refarray[1].p_y = 0;
refarray[2].p_x = refarray[2].p_y = 0; refarray[2].p_x = refarray[2].p_y = 0;
@ -856,8 +856,8 @@ calmaElementSref(filename)
if (p.p_x % cols) if (p.p_x % cols)
{ {
n = (p.p_x + (cols+1)/2) / cols; n = (p.p_x + (cols+1)/2) / cols;
calmaReadError("# cols doesn't divide displacement ref pt\n"); CalmaReadError("# cols doesn't divide displacement ref pt\n");
calmaReadError(" %d / %d -> %d\n", p.p_x, cols, n); CalmaReadError(" %d / %d -> %d\n", p.p_x, cols, n);
xsep = n; xsep = n;
} }
else xsep = p.p_x / cols; else xsep = p.p_x / cols;
@ -868,8 +868,8 @@ calmaElementSref(filename)
if (p.p_y % rows) if (p.p_y % rows)
{ {
n = (p.p_y + (rows+1)/2) / rows; n = (p.p_y + (rows+1)/2) / rows;
calmaReadError("# rows doesn't divide displacement ref pt\n"); CalmaReadError("# rows doesn't divide displacement ref pt\n");
calmaReadError(" %d / %d -> %d\n", p.p_y, rows, n); CalmaReadError(" %d / %d -> %d\n", p.p_y, rows, n);
ysep = n; ysep = n;
} }
ysep = p.p_y / rows; ysep = p.p_y / rows;

View File

@ -110,8 +110,8 @@ calmaReadTransform(ptrans, name)
if (dmag != (double)((int)(dmag + 0.5))) if (dmag != (double)((int)(dmag + 0.5)))
{ {
calmaReadError("Non-integer magnification (%g) in transform\n", dmag); CalmaReadError("Non-integer magnification (%g) in transform\n", dmag);
calmaReadError("Rounding to %d.\n", (int)(dmag + 0.5)); CalmaReadError("Rounding to %d.\n", (int)(dmag + 0.5));
} }
GeoScaleTrans(ptrans, (int)(dmag + 0.5), &t); GeoScaleTrans(ptrans, (int)(dmag + 0.5), &t);
*ptrans = t; *ptrans = t;
@ -144,13 +144,13 @@ calmaReadTransform(ptrans, name)
case 0: case 90: case 180: case 270: case 0: case 90: case 180: case 270:
break; break;
default: default:
calmaReadError("Non-Manhattan angle (%d) in transform\n", angle); CalmaReadError("Non-Manhattan angle (%d) in transform\n", angle);
if (angle < 45) angle = 0; if (angle < 45) angle = 0;
else if (angle < 135) angle = 90; else if (angle < 135) angle = 90;
else if (angle < 225) angle = 180; else if (angle < 225) angle = 180;
else if (angle < 315) angle = 270; else if (angle < 315) angle = 270;
else angle = 0; else angle = 0;
calmaReadError(" Rounding to %d degrees.\n", angle); CalmaReadError(" Rounding to %d degrees.\n", angle);
} }
/* /*
@ -223,7 +223,7 @@ calmaReadI2Record(type, pvalue)
return (TRUE); return (TRUE);
eof: eof:
calmaReadError("Unexpected EOF.\n"); CalmaReadError("Unexpected EOF.\n");
return (FALSE); return (FALSE);
} }
@ -268,7 +268,7 @@ calmaReadI4Record(type, pvalue)
return (TRUE); return (TRUE);
eof: eof:
calmaReadError("Unexpected EOF.\n"); CalmaReadError("Unexpected EOF.\n");
return (FALSE); return (FALSE);
} }
@ -317,7 +317,7 @@ calmaReadStringRecord(type, str)
return (TRUE); return (TRUE);
eof: eof:
calmaReadError("Unexpected EOF.\n"); CalmaReadError("Unexpected EOF.\n");
return (FALSE); return (FALSE);
} }
@ -478,7 +478,7 @@ calmaSkipExact(type)
return (TRUE); return (TRUE);
eof: eof:
calmaReadError("Unexpected EOF.\n"); CalmaReadError("Unexpected EOF.\n");
return (FALSE); return (FALSE);
} }

View File

@ -143,7 +143,7 @@ calmaReadPoint(p, iscale)
rescale = calmaReadScale2 / FindGCF(calmaReadScale2, abs(p->p_x)); rescale = calmaReadScale2 / FindGCF(calmaReadScale2, abs(p->p_x));
if ((calmaReadScale1 * rescale) > CIFRescaleLimit) if ((calmaReadScale1 * rescale) > CIFRescaleLimit)
{ {
calmaReadError("Warning: calma units at max scale; value rounded\n"); CalmaReadError("Warning: calma units at max scale; value rounded\n");
if (p->p_x < 0) if (p->p_x < 0)
p->p_x -= ((calmaReadScale2 - 1) >> 1); p->p_x -= ((calmaReadScale2 - 1) >> 1);
else else
@ -165,7 +165,7 @@ calmaReadPoint(p, iscale)
rescale = calmaReadScale2 / FindGCF(calmaReadScale2, abs(p->p_y)); rescale = calmaReadScale2 / FindGCF(calmaReadScale2, abs(p->p_y));
if ((calmaReadScale1 * rescale) > CIFRescaleLimit) if ((calmaReadScale1 * rescale) > CIFRescaleLimit)
{ {
calmaReadError("Warning: calma units at max scale; value rounded\n"); CalmaReadError("Warning: calma units at max scale; value rounded\n");
if (p->p_y < 0) if (p->p_y < 0)
p->p_y -= ((calmaReadScale2 - 1) >> 1); p->p_y -= ((calmaReadScale2 - 1) >> 1);
else else
@ -216,7 +216,7 @@ calmaElementBoundary()
if (!calmaReadI2Record(CALMA_LAYER, &layer) if (!calmaReadI2Record(CALMA_LAYER, &layer)
|| !calmaReadI2Record(CALMA_DATATYPE, &dt)) || !calmaReadI2Record(CALMA_DATATYPE, &dt))
{ {
calmaReadError("Missing layer or datatype in boundary/box.\n"); CalmaReadError("Missing layer or datatype in boundary/box.\n");
return; return;
} }
@ -234,7 +234,7 @@ calmaElementBoundary()
if (!calmaReadPath(&pathheadp, (plane == NULL) ? 0 : 1)) if (!calmaReadPath(&pathheadp, (plane == NULL) ? 0 : 1))
{ {
if (plane != NULL) if (plane != NULL)
calmaReadError("Error while reading path for boundary/box; ignored.\n"); CalmaReadError("Error while reading path for boundary/box; ignored.\n");
return; return;
} }
@ -329,7 +329,7 @@ calmaElementBoundary()
if (cifCurReadPlanes == cifEditCellPlanes) if (cifCurReadPlanes == cifEditCellPlanes)
{ {
CIFPaintCurrent(); CIFPaintCurrent(FILE_CALMA);
DBReComputeBbox(cifReadCellDef); DBReComputeBbox(cifReadCellDef);
DRCCheckThis(cifReadCellDef, TT_CHECKPAINT, &cifReadCellDef->cd_bbox); DRCCheckThis(cifReadCellDef, TT_CHECKPAINT, &cifReadCellDef->cd_bbox);
DBWAreaChanged(cifReadCellDef, &cifReadCellDef->cd_bbox, DBWAreaChanged(cifReadCellDef, &cifReadCellDef->cd_bbox,
@ -383,7 +383,7 @@ calmaElementBox()
if (!calmaReadI2Record(CALMA_LAYER, &layer) if (!calmaReadI2Record(CALMA_LAYER, &layer)
|| !calmaReadI2Record(CALMA_BOXTYPE, &dt)) || !calmaReadI2Record(CALMA_BOXTYPE, &dt))
{ {
calmaReadError("Missing layer or datatype in boundary/box.\n"); CalmaReadError("Missing layer or datatype in boundary/box.\n");
return; return;
} }
@ -407,7 +407,7 @@ calmaElementBox()
READRH(nbytes, rtype); READRH(nbytes, rtype);
if (nbytes < 0) if (nbytes < 0)
{ {
calmaReadError("EOF when reading box.\n"); CalmaReadError("EOF when reading box.\n");
return; return;
} }
if (rtype != CALMA_XY) if (rtype != CALMA_XY)
@ -420,7 +420,7 @@ calmaElementBox()
npoints = (nbytes - CALMAHEADERLENGTH) / 8; npoints = (nbytes - CALMAHEADERLENGTH) / 8;
if (npoints != 5) if (npoints != 5)
{ {
calmaReadError("Box doesn't have 5 points.\n"); CalmaReadError("Box doesn't have 5 points.\n");
(void) calmaSkipBytes(nbytes - CALMAHEADERLENGTH); (void) calmaSkipBytes(nbytes - CALMAHEADERLENGTH);
return; return;
} }
@ -491,7 +491,7 @@ calmaElementPath()
if (pathtype != CALMAPATH_SQUAREFLUSH && pathtype != CALMAPATH_SQUAREPLUS && if (pathtype != CALMAPATH_SQUAREFLUSH && pathtype != CALMAPATH_SQUAREPLUS &&
pathtype != CALMAPATH_CUSTOM) pathtype != CALMAPATH_CUSTOM)
{ {
calmaReadError("Warning: pathtype %d unsupported (ignored).\n", pathtype); CalmaReadError("Warning: pathtype %d unsupported (ignored).\n", pathtype);
pathtype = CALMAPATH_SQUAREFLUSH; pathtype = CALMAPATH_SQUAREFLUSH;
} }
@ -505,13 +505,13 @@ calmaElementPath()
{ {
if (!calmaReadI4Record(CALMA_WIDTH, &width)) if (!calmaReadI4Record(CALMA_WIDTH, &width))
{ {
calmaReadError("Error in reading WIDTH in calmaElementPath()\n") ; CalmaReadError("Error in reading WIDTH in calmaElementPath()\n") ;
return; return;
} }
} }
width *= calmaReadScale1; width *= calmaReadScale1;
if (width % calmaReadScale2 != 0) if (width % calmaReadScale2 != 0)
calmaReadError("Wire width snapped to nearest integer boundary.\n"); CalmaReadError("Wire width snapped to nearest integer boundary.\n");
width /= calmaReadScale2; width /= calmaReadScale2;
@ -528,12 +528,12 @@ calmaElementPath()
if (nbytes > 0 && rtype == CALMA_BGNEXTN) if (nbytes > 0 && rtype == CALMA_BGNEXTN)
{ {
if (!calmaReadI4Record(CALMA_BGNEXTN, &extend1)) if (!calmaReadI4Record(CALMA_BGNEXTN, &extend1))
calmaReadError("Error in reading BGNEXTN in path (ignored)\n") ; CalmaReadError("Error in reading BGNEXTN in path (ignored)\n") ;
else else
{ {
extend1 *= calmaReadScale1; extend1 *= calmaReadScale1;
if (extend1 % calmaReadScale2 != 0) if (extend1 % calmaReadScale2 != 0)
calmaReadError("Wire extension snapped to nearest integer boundary.\n"); CalmaReadError("Wire extension snapped to nearest integer boundary.\n");
extend1 *= 2; extend1 *= 2;
extend1 /= calmaReadScale2; extend1 /= calmaReadScale2;
} }
@ -543,12 +543,12 @@ calmaElementPath()
if (nbytes > 0 && rtype == CALMA_ENDEXTN) if (nbytes > 0 && rtype == CALMA_ENDEXTN)
{ {
if (!calmaReadI4Record(CALMA_ENDEXTN, &extend2)) if (!calmaReadI4Record(CALMA_ENDEXTN, &extend2))
calmaReadError("Error in reading ENDEXTN in path (ignored)\n") ; CalmaReadError("Error in reading ENDEXTN in path (ignored)\n") ;
else else
{ {
extend2 *= calmaReadScale1; extend2 *= calmaReadScale1;
if (extend2 % calmaReadScale2 != 0) if (extend2 % calmaReadScale2 != 0)
calmaReadError("Wire extension snapped to nearest integer boundary.\n"); CalmaReadError("Wire extension snapped to nearest integer boundary.\n");
extend2 *= 2; extend2 *= 2;
extend2 /= calmaReadScale2; extend2 /= calmaReadScale2;
} }
@ -558,7 +558,7 @@ calmaElementPath()
savescale = calmaReadScale1; savescale = calmaReadScale1;
if (!calmaReadPath(&pathheadp, 2)) if (!calmaReadPath(&pathheadp, 2))
{ {
calmaReadError("Improper path; ignored.\n"); CalmaReadError("Improper path; ignored.\n");
return; return;
} }
if (savescale != calmaReadScale1) if (savescale != calmaReadScale1)
@ -656,7 +656,7 @@ calmaElementPath()
if (cifCurReadPlanes == cifEditCellPlanes) if (cifCurReadPlanes == cifEditCellPlanes)
{ {
CIFPaintCurrent(); CIFPaintCurrent(FILE_CALMA);
DBReComputeBbox(cifReadCellDef); DBReComputeBbox(cifReadCellDef);
DRCCheckThis(cifReadCellDef, TT_CHECKPAINT, &cifReadCellDef->cd_bbox); DRCCheckThis(cifReadCellDef, TT_CHECKPAINT, &cifReadCellDef->cd_bbox);
DBWAreaChanged(cifReadCellDef, &cifReadCellDef->cd_bbox, DBWAreaChanged(cifReadCellDef, &cifReadCellDef->cd_bbox,
@ -781,12 +781,12 @@ calmaElementText()
/* Use WIDTH value to set the font size */ /* Use WIDTH value to set the font size */
if (!calmaReadI4Record(CALMA_WIDTH, &width)) if (!calmaReadI4Record(CALMA_WIDTH, &width))
{ {
calmaReadError("Error in reading WIDTH in calmaElementText()\n") ; CalmaReadError("Error in reading WIDTH in calmaElementText()\n") ;
return; return;
} }
width *= calmaReadScale1; width *= calmaReadScale1;
if (width % calmaReadScale2 != 0) if (width % calmaReadScale2 != 0)
calmaReadError("Text width snapped to nearest integer boundary.\n"); CalmaReadError("Text width snapped to nearest integer boundary.\n");
width /= calmaReadScale2; width /= calmaReadScale2;
@ -840,7 +840,7 @@ calmaElementText()
nbytes -= CALMAHEADERLENGTH; nbytes -= CALMAHEADERLENGTH;
if (nbytes < 8) if (nbytes < 8)
{ {
calmaReadError("Not enough bytes in point record.\n"); CalmaReadError("Not enough bytes in point record.\n");
} }
else else
{ {
@ -890,15 +890,15 @@ calmaElementText()
} }
} }
if (changed) { if (changed) {
calmaReadError("Warning: improper characters fixed in label '%s'\n", CalmaReadError("Warning: improper characters fixed in label '%s'\n",
savstring); savstring);
if (!algmsg) { if (!algmsg) {
algmsg = TRUE; algmsg = TRUE;
calmaReadError(" (algorithm used: trailing <CR> dropped, " CalmaReadError(" (algorithm used: trailing <CR> dropped, "
"<CR> and ' ' changed to '_', \n" "<CR> and ' ' changed to '_', \n"
" other non-printables changed to '?')\n"); " other non-printables changed to '?')\n");
} }
calmaReadError(" modified label is '%s'\n", textbody); CalmaReadError(" modified label is '%s'\n", textbody);
freeMagic(savstring); freeMagic(savstring);
} }
} }
@ -908,7 +908,7 @@ calmaElementText()
/* Place the label */ /* Place the label */
if (strlen(textbody) == 0) if (strlen(textbody) == 0)
{ {
calmaReadError("Warning: Ignoring empty string label at (%d, %d)\n", CalmaReadError("Warning: Ignoring empty string label at (%d, %d)\n",
r.r_ll.p_x * cifCurReadStyle->crs_scaleFactor, r.r_ll.p_x * cifCurReadStyle->crs_scaleFactor,
r.r_ll.p_y * cifCurReadStyle->crs_scaleFactor); r.r_ll.p_y * cifCurReadStyle->crs_scaleFactor);
} }
@ -920,7 +920,7 @@ calmaElementText()
} }
else if (type < 0) else if (type < 0)
{ {
calmaReadError("Warning: label \"%s\" at (%d, %d) is on unhandled" CalmaReadError("Warning: label \"%s\" at (%d, %d) is on unhandled"
" layer:purpose pair %d:%d and will be discarded.\n", textbody, " layer:purpose pair %d:%d and will be discarded.\n", textbody,
r.r_ll.p_x * cifCurReadStyle->crs_scaleFactor, r.r_ll.p_x * cifCurReadStyle->crs_scaleFactor,
r.r_ll.p_y * cifCurReadStyle->crs_scaleFactor, layer, textt); r.r_ll.p_y * cifCurReadStyle->crs_scaleFactor, layer, textt);
@ -1036,7 +1036,7 @@ calmaReadPath(pathheadpp, iscale)
READRH(nbytes, rtype); READRH(nbytes, rtype);
if (nbytes < 0) if (nbytes < 0)
{ {
calmaReadError("EOF when reading path.\n"); CalmaReadError("EOF when reading path.\n");
return (FALSE); return (FALSE);
} }
if (rtype != CALMA_XY) if (rtype != CALMA_XY)
@ -1063,7 +1063,7 @@ calmaReadPath(pathheadpp, iscale)
} }
} }
if (ABS(path.cifp_x) > 0x0fffffff || ABS(path.cifp_y) > 0x0fffffff) { if (ABS(path.cifp_x) > 0x0fffffff || ABS(path.cifp_y) > 0x0fffffff) {
calmaReadError("Warning: Very large point in path: (%d, %d)\n", CalmaReadError("Warning: Very large point in path: (%d, %d)\n",
path.cifp_x, path.cifp_y); path.cifp_x, path.cifp_y);
} }
if (feof(calmaInputFile)) if (feof(calmaInputFile))
@ -1141,6 +1141,6 @@ calmaLayerError(mesg, layer, dt)
if (HashGetValue(he) == NULL) if (HashGetValue(he) == NULL)
{ {
HashSetValue(he, (ClientData) 1); HashSetValue(he, (ClientData) 1);
calmaReadError("%s, layer=%d type=%d\n", mesg, layer, dt); CalmaReadError("%s, layer=%d type=%d\n", mesg, layer, dt);
} }
} }

View File

@ -232,7 +232,7 @@ done:
freeMagic(libname); freeMagic(libname);
} }
CIFReadCellCleanup(1); CIFReadCellCleanup(FILE_CALMA);
HashKill(&calmaDefInitHash); HashKill(&calmaDefInitHash);
UndoEnable(); UndoEnable();
@ -330,7 +330,7 @@ calmaParseUnits()
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* calmaReadError -- * CalmaReadError --
* *
* This procedure is called to print out error messages during * This procedure is called to print out error messages during
* Calma file reading. * Calma file reading.
@ -349,7 +349,7 @@ calmaParseUnits()
void void
/*VARARGS1*/ /*VARARGS1*/
calmaReadError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) CalmaReadError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
char *format; char *format;
char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10; char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10;
{ {
@ -408,7 +408,7 @@ calmaUnexpected(wanted, got)
int wanted; /* Type of record we wanted */ int wanted; /* Type of record we wanted */
int got; /* Type of record we got */ int got; /* Type of record we got */
{ {
calmaReadError("Unexpected record type in input: \n"); CalmaReadError("Unexpected record type in input: \n");
if (CIFWarningLevel == CIF_WARN_NONE) return; if (CIFWarningLevel == CIF_WARN_NONE) return;
if (calmaTotalErrors < 100 || (CIFWarningLevel != CIF_WARN_LIMIT)) if (calmaTotalErrors < 100 || (CIFWarningLevel != CIF_WARN_LIMIT))

View File

@ -42,5 +42,6 @@ extern bool CalmaWrite();
extern void CalmaReadFile(); extern void CalmaReadFile();
extern void CalmaTechInit(); extern void CalmaTechInit();
extern bool CalmaGenerateArray(); extern bool CalmaGenerateArray();
extern void CalmaReadError();
#endif /* _CALMA_H */ #endif /* _CALMA_H */

View File

@ -557,7 +557,8 @@ cifCopyPaintFunc(tile, cifCopyRec)
*/ */
int int
CIFPaintCurrent() CIFPaintCurrent(filetype)
bool filetype;
{ {
extern int cifMakeBoundaryFunc(); /* Forward declaration. */ extern int cifMakeBoundaryFunc(); /* Forward declaration. */
extern int cifPaintCurrentFunc(); /* Forward declaration. */ extern int cifPaintCurrentFunc(); /* Forward declaration. */
@ -658,7 +659,7 @@ CIFPaintCurrent()
&DBAllButSpaceBits, cifCheckPaintFunc, &DBAllButSpaceBits, cifCheckPaintFunc,
(ClientData)NULL) == 1)) (ClientData)NULL) == 1))
DBSrPaintArea((Tile *) NULL, plane, &TiPlaneRect, DBSrPaintArea((Tile *) NULL, plane, &TiPlaneRect,
&CIFSolidBits, cifMakeBoundaryFunc, (ClientData)NULL); &CIFSolidBits, cifMakeBoundaryFunc, (ClientData)filetype);
} }
/* Swap planes */ /* Swap planes */
@ -692,7 +693,7 @@ CIFPaintCurrent()
int int
cifMakeBoundaryFunc(tile, clientdata) cifMakeBoundaryFunc(tile, clientdata)
Tile *tile; /* Tile of CIF information. */ Tile *tile; /* Tile of CIF information. */
ClientData clientdata; /* Not used */ ClientData clientdata; /* Pass the file type (CIF or CALMA) */
{ {
/* It is assumed that there is one rectangle for the boundary. */ /* It is assumed that there is one rectangle for the boundary. */
/* If there are multiple rectangles defined with the boundary */ /* If there are multiple rectangles defined with the boundary */
@ -701,6 +702,7 @@ cifMakeBoundaryFunc(tile, clientdata)
Rect area; Rect area;
char propertyvalue[128], *storedvalue; char propertyvalue[128], *storedvalue;
int savescale; int savescale;
bool filetype = (bool)clientdata;
TiToRect(tile, &area); TiToRect(tile, &area);
area.r_xtop = CIFScaleCoord(area.r_xtop, COORD_EXACT); area.r_xtop = CIFScaleCoord(area.r_xtop, COORD_EXACT);
@ -727,8 +729,35 @@ cifMakeBoundaryFunc(tile, clientdata)
} }
if (cifReadCellDef->cd_flags & CDFIXEDBBOX) if (cifReadCellDef->cd_flags & CDFIXEDBBOX)
CIFReadError("Warning: Cell %s boundary was redefined.\n", {
cifReadCellDef->cd_name); char *propvalue;
bool found;
/* Only flag a warning if the redefined boundary was */
/* different from the original. */
propvalue = (char *)DBPropGet(cifReadCellDef, "FIXED_BBOX", &found);
if (found)
{
Rect bbox;
if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot,
&bbox.r_xtop, &bbox.r_ytop) == 4)
{
if ((bbox.r_xbot != area.r_xbot) ||
(bbox.r_ybot != area.r_ybot) ||
(bbox.r_xtop != area.r_xtop) ||
(bbox.r_ytop != area.r_ytop))
{
if (filetype == FILE_CIF)
CIFReadError("Warning: Cell %s boundary was redefined.\n",
cifReadCellDef->cd_name);
else
CalmaError("Warning: Cell %s boundary was redefined.\n",
cifReadCellDef->cd_name);
}
}
}
}
sprintf(propertyvalue, "%d %d %d %d", sprintf(propertyvalue, "%d %d %d %d",
area.r_xbot, area.r_ybot, area.r_xtop, area.r_ytop); area.r_xbot, area.r_ybot, area.r_xtop, area.r_ytop);
@ -841,7 +870,7 @@ CIFParseFinish()
* layer info. * layer info.
*/ */
CIFPaintCurrent(); CIFPaintCurrent(FILE_CIF);
DBAdjustLabels(cifReadCellDef, &TiPlaneRect); DBAdjustLabels(cifReadCellDef, &TiPlaneRect);
DBReComputeBbox(cifReadCellDef); DBReComputeBbox(cifReadCellDef);
@ -1389,8 +1418,8 @@ CIFParseUser()
*/ */
void void
CIFReadCellCleanup(type) CIFReadCellCleanup(filetype)
int type; // 0 = CIF, 1 = GDS, because routine is used by both bool filetype;
{ {
HashEntry *h; HashEntry *h;
HashSearch hs; HashSearch hs;
@ -1400,10 +1429,10 @@ CIFReadCellCleanup(type)
if (cifSubcellBeingRead) if (cifSubcellBeingRead)
{ {
if (type == 0) if (filetype == FILE_CIF)
CIFReadError("CIF ended partway through a symbol definition.\n"); CIFReadError("CIF ended partway through a symbol definition.\n");
else else
calmaReadError("GDS ended partway through a symbol definition.\n"); CalmaReadError("GDS ended partway through a symbol definition.\n");
(void) CIFParseFinish(); (void) CIFParseFinish();
} }
@ -1416,24 +1445,24 @@ CIFReadCellCleanup(type)
def = (CellDef *) HashGetValue(h); def = (CellDef *) HashGetValue(h);
if (def == NULL) if (def == NULL)
{ {
if (type == 0) if (filetype == FILE_CIF)
CIFReadError("cell table has NULL entry (Magic error).\n"); CIFReadError("cell table has NULL entry (Magic error).\n");
else else
calmaReadError("cell table has NULL entry (Magic error).\n"); CalmaReadError("cell table has NULL entry (Magic error).\n");
continue; continue;
} }
flags = def->cd_flags; flags = def->cd_flags;
if (!(flags & CDAVAILABLE)) if (!(flags & CDAVAILABLE))
{ {
if (type == 0) if (filetype == FILE_CIF)
CIFReadError("cell %s was used but not defined.\n", def->cd_name); CIFReadError("cell %s was used but not defined.\n", def->cd_name);
else else
calmaReadError("cell %s was used but not defined.\n", def->cd_name); CalmaReadError("cell %s was used but not defined.\n", def->cd_name);
} }
def->cd_flags &= ~CDPROCESSEDGDS; def->cd_flags &= ~CDPROCESSEDGDS;
if ((type == 0 && CIFNoDRCCheck == FALSE) || if ((filetype == FILE_CIF && CIFNoDRCCheck == FALSE) ||
(type == 1 && CalmaNoDRCCheck == FALSE)) (filetype == 1 && CalmaNoDRCCheck == FALSE))
DRCCheckThis(def, TT_CHECKPAINT, &def->cd_bbox); DRCCheckThis(def, TT_CHECKPAINT, &def->cd_bbox);
DBWAreaChanged(def, &def->cd_bbox, DBW_ALLWINDOWS, &DBAllButSpaceBits); DBWAreaChanged(def, &def->cd_bbox, DBW_ALLWINDOWS, &DBAllButSpaceBits);
DBCellSetModified(def, TRUE); DBCellSetModified(def, TRUE);
@ -1441,7 +1470,7 @@ CIFReadCellCleanup(type)
/* Do geometrical processing on the top-level cell. */ /* Do geometrical processing on the top-level cell. */
CIFPaintCurrent(); CIFPaintCurrent(FILE_CIF);
DBAdjustLabels(EditCellUse->cu_def, &TiPlaneRect); DBAdjustLabels(EditCellUse->cu_def, &TiPlaneRect);
DBReComputeBbox(EditCellUse->cu_def); DBReComputeBbox(EditCellUse->cu_def);
DBWAreaChanged(EditCellUse->cu_def, &EditCellUse->cu_def->cd_bbox, DBWAreaChanged(EditCellUse->cu_def, &EditCellUse->cu_def->cd_bbox,
@ -1485,7 +1514,7 @@ CIFReadCellCleanup(type)
if (!(def->cd_flags & CDFLATTENED)) if (!(def->cd_flags & CDFLATTENED))
CIFReadError("%s read error: Unresolved geometry in cell" CIFReadError("%s read error: Unresolved geometry in cell"
" %s maps to no magic layers\n", " %s maps to no magic layers\n",
(type == 0) ? "CIF" : "GDS", def->cd_name); (filetype == FILE_CIF) ? "CIF" : "GDS", def->cd_name);
#if 0 #if 0
/* Remove the cell if it has no parents, no children, and no geometry */ /* Remove the cell if it has no parents, no children, and no geometry */
@ -1498,11 +1527,11 @@ CIFReadCellCleanup(type)
if (DBCellDeleteDef(def) == FALSE) if (DBCellDeleteDef(def) == FALSE)
{ {
CIFReadError("%s read error: Unable to delete cell %s\n", CIFReadError("%s read error: Unable to delete cell %s\n",
(type == 0) ? "CIF" : "GDS", savename); (filetype == FILE_CIF) ? "CIF" : "GDS", savename);
} }
else else
{ {
if (type == 0) if (filetype == FILE_CIF)
TxPrintf("CIF read: Removed flattened cell %s\n", savename); TxPrintf("CIF read: Removed flattened cell %s\n", savename);
else else
TxPrintf("GDS read: Removed flattened cell %s\n", savename); TxPrintf("GDS read: Removed flattened cell %s\n", savename);

View File

@ -1660,6 +1660,6 @@ CIFReadFile(file)
CIFReadError("no \"End\" statement.\n"); CIFReadError("no \"End\" statement.\n");
done: done:
CIFReadCellCleanup(0); CIFReadCellCleanup(FILE_CIF);
UndoEnable(); UndoEnable();
} }

View File

@ -30,6 +30,10 @@
* depends on the size of the layout. * depends on the size of the layout.
*/ */
/* Passed to CIFPaintCurrent() for print statement formatting */
#define FILE_CIF 0
#define FILE_CALMA 1
/* Exported global variables (commands/CmdCD.c) */ /* Exported global variables (commands/CmdCD.c) */
extern int CIFWarningLevel; extern int CIFWarningLevel;

View File

@ -3802,7 +3802,7 @@ cmdDumpParseArgs(cmdName, w, cmd, dummy, scx)
char *propvalue; char *propvalue;
bool found; bool found;
propvalue = DBPropGet(def, "FIXED_BBOX", &found); propvalue = (char *)DBPropGet(def, "FIXED_BBOX", &found);
if (found) if (found)
{ {
if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot, if (sscanf(propvalue, "%d %d %d %d", &bbox.r_xbot, &bbox.r_ybot,