Applied a patch from Ahmed Ghazy to correct the last change to
"lef write", which had one typo in the formatting, plus was using a static string method for generating the formatted output that was implementation-dependent on fprintf(). These have been fixed.
This commit is contained in:
parent
d0febe7614
commit
f1c432585a
|
|
@ -81,10 +81,9 @@ int LEFdbUnits = 1000;
|
||||||
* ---------------------------------------------------------------------
|
* ---------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
lefPrint(float invalue)
|
lefPrint(char *leffmt, float invalue)
|
||||||
{
|
{
|
||||||
static char leffmt[10];
|
|
||||||
float value, r, l;
|
float value, r, l;
|
||||||
|
|
||||||
r = (invalue < 0.0) ? -0.5 : 0.5;
|
r = (invalue < 0.0) ? -0.5 : 0.5;
|
||||||
|
|
@ -110,7 +109,7 @@ lefPrint(float invalue)
|
||||||
break;
|
break;
|
||||||
case 20000:
|
case 20000:
|
||||||
value = (float)(truncf((invalue * l) + r) / l);
|
value = (float)(truncf((invalue * l) + r) / l);
|
||||||
sprintf(leffmt, "%.5", value);
|
sprintf(leffmt, "%.5f", value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
value = (float)(truncf((invalue * 100000.) + r) / 100000.);
|
value = (float)(truncf((invalue * 100000.) + r) / 100000.);
|
||||||
|
|
@ -697,6 +696,7 @@ lefWriteGeometry(tile, cdata)
|
||||||
lefClient *lefdata = (lefClient *)cdata;
|
lefClient *lefdata = (lefClient *)cdata;
|
||||||
FILE *f = lefdata->file;
|
FILE *f = lefdata->file;
|
||||||
float scale = lefdata->oscale;
|
float scale = lefdata->oscale;
|
||||||
|
char leffmt[6][10];
|
||||||
TileType ttype, otype = TiGetTypeExact(tile);
|
TileType ttype, otype = TiGetTypeExact(tile);
|
||||||
LefMapping *lefMagicToLefLayer = lefdata->lefMagicMap;
|
LefMapping *lefMagicToLefLayer = lefdata->lefMagicMap;
|
||||||
|
|
||||||
|
|
@ -756,46 +756,70 @@ lefWriteGeometry(tile, cdata)
|
||||||
{
|
{
|
||||||
if (otype & TT_DIRECTION)
|
if (otype & TT_DIRECTION)
|
||||||
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
||||||
lefPrint(scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[0], scale * (float)(LEFT(tile)
|
||||||
lefPrint(scale * (float)(TOP(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_x)),
|
||||||
lefPrint(scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[1], scale * (float)(TOP(tile)
|
||||||
lefPrint(scale * (float)(TOP(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_y)),
|
||||||
lefPrint(scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[2], scale * (float)(RIGHT(tile)
|
||||||
lefPrint(scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)));
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[3], scale * (float)(TOP(tile)
|
||||||
|
- lefdata->origin.p_y)),
|
||||||
|
lefPrint(leffmt[4], scale * (float)(RIGHT(tile)
|
||||||
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[5], scale * (float)(BOTTOM(tile)
|
||||||
|
- lefdata->origin.p_y)));
|
||||||
else
|
else
|
||||||
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
||||||
lefPrint(scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[0], scale * (float)(RIGHT(tile)
|
||||||
lefPrint(scale * (float)(TOP(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_x)),
|
||||||
lefPrint(scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[1], scale * (float)(TOP(tile)
|
||||||
lefPrint(scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_y)),
|
||||||
lefPrint(scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[2], scale * (float)(RIGHT(tile)
|
||||||
lefPrint(scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)));
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[3], scale * (float)(BOTTOM(tile)
|
||||||
|
- lefdata->origin.p_y)),
|
||||||
|
lefPrint(leffmt[4], scale * (float)(LEFT(tile)
|
||||||
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[5], scale * (float)(BOTTOM(tile)
|
||||||
|
- lefdata->origin.p_y)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (otype & TT_DIRECTION)
|
if (otype & TT_DIRECTION)
|
||||||
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
||||||
lefPrint(scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[0], scale * (float)(LEFT(tile)
|
||||||
lefPrint(scale * (float)(TOP(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_x)),
|
||||||
lefPrint(scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[1], scale * (float)(TOP(tile)
|
||||||
lefPrint(scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_y)),
|
||||||
lefPrint(scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[2], scale * (float)(RIGHT(tile)
|
||||||
lefPrint(scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)));
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[3], scale * (float)(BOTTOM(tile)
|
||||||
|
- lefdata->origin.p_y)),
|
||||||
|
lefPrint(leffmt[4], scale * (float)(LEFT(tile)
|
||||||
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[5], scale * (float)(BOTTOM(tile)
|
||||||
|
- lefdata->origin.p_y)));
|
||||||
else
|
else
|
||||||
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
fprintf(f, IN3 "POLYGON " POINT " " POINT " " POINT " ;\n",
|
||||||
lefPrint(scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[0], scale * (float)(LEFT(tile)
|
||||||
lefPrint(scale * (float)(TOP(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_x)),
|
||||||
lefPrint(scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[1], scale * (float)(TOP(tile)
|
||||||
lefPrint(scale * (float)(TOP(tile) - lefdata->origin.p_y)),
|
- lefdata->origin.p_y)),
|
||||||
lefPrint(scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[2], scale * (float)(RIGHT(tile)
|
||||||
lefPrint(scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)));
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[3], scale * (float)(TOP(tile)
|
||||||
|
- lefdata->origin.p_y)),
|
||||||
|
lefPrint(leffmt[4], scale * (float)(LEFT(tile)
|
||||||
|
- lefdata->origin.p_x)),
|
||||||
|
lefPrint(leffmt[5], scale * (float)(BOTTOM(tile)
|
||||||
|
- lefdata->origin.p_y)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf(f, IN3 "RECT " POINT " " POINT " ;\n",
|
fprintf(f, IN3 "RECT " POINT " " POINT " ;\n",
|
||||||
lefPrint(scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[0], scale * (float)(LEFT(tile) - lefdata->origin.p_x)),
|
||||||
lefPrint(scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)),
|
lefPrint(leffmt[1], scale * (float)(BOTTOM(tile) - lefdata->origin.p_y)),
|
||||||
lefPrint(scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
lefPrint(leffmt[2], scale * (float)(RIGHT(tile) - lefdata->origin.p_x)),
|
||||||
lefPrint(scale * (float)(TOP(tile) - lefdata->origin.p_y)));
|
lefPrint(leffmt[3], scale * (float)(TOP(tile) - lefdata->origin.p_y)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1008,6 +1032,7 @@ lefWriteMacro(def, f, scale, hide)
|
||||||
TileType ttype;
|
TileType ttype;
|
||||||
lefClient lc;
|
lefClient lc;
|
||||||
int idx, pNum, maxport, curport;
|
int idx, pNum, maxport, curport;
|
||||||
|
char leffmt[2][10];
|
||||||
char *LEFtext;
|
char *LEFtext;
|
||||||
HashSearch hs;
|
HashSearch hs;
|
||||||
HashEntry *he;
|
HashEntry *he;
|
||||||
|
|
@ -1162,12 +1187,14 @@ lefWriteMacro(def, f, scale, hide)
|
||||||
/* zeros" in the output. */
|
/* zeros" in the output. */
|
||||||
|
|
||||||
fprintf(f, IN0 "ORIGIN " POINT " ;\n",
|
fprintf(f, IN0 "ORIGIN " POINT " ;\n",
|
||||||
lefPrint(0.0 - lc.oscale * (float)boundary.r_xbot),
|
lefPrint(leffmt[0], 0.0 - lc.oscale * (float)boundary.r_xbot),
|
||||||
lefPrint(0.0 - lc.oscale * (float)boundary.r_ybot));
|
lefPrint(leffmt[1], 0.0 - lc.oscale * (float)boundary.r_ybot));
|
||||||
|
|
||||||
fprintf(f, IN0 "SIZE " FP " BY " FP " ;\n",
|
fprintf(f, IN0 "SIZE " FP " BY " FP " ;\n",
|
||||||
lefPrint(lc.oscale * (float)(boundary.r_xtop - boundary.r_xbot)),
|
lefPrint(leffmt[0], lc.oscale * (float)(boundary.r_xtop
|
||||||
lefPrint(lc.oscale * (float)(boundary.r_ytop - boundary.r_ybot)));
|
- boundary.r_xbot)),
|
||||||
|
lefPrint(leffmt[1], lc.oscale * (float)(boundary.r_ytop
|
||||||
|
- boundary.r_ybot)));
|
||||||
|
|
||||||
lc.origin.p_x = 0;
|
lc.origin.p_x = 0;
|
||||||
lc.origin.p_y = 0;
|
lc.origin.p_y = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue