explicit casts double -> int
This commit is contained in:
parent
e6c86b4d98
commit
3547fdc5f3
|
|
@ -3,7 +3,8 @@
|
||||||
hpgl.c linear.c misccoms.c options.c points.c rawfile.c
|
hpgl.c linear.c misccoms.c options.c points.c rawfile.c
|
||||||
spec.c spiceif.c variable.c complete.c clip.c graf.c
|
spec.c spiceif.c variable.c complete.c clip.c graf.c
|
||||||
plot5.c plotit.c spbuild.c dctrcurv.c distoan.c
|
plot5.c plotit.c spbuild.c dctrcurv.c distoan.c
|
||||||
noisean.c nbjttemp.c urcsetup.c ipc.c ipcstdio.c mifgetvalue.c:
|
noisean.c nbjttemp.c urcsetup.c ipc.c ipcstdio.c mifgetvalue.c
|
||||||
|
postsc.c grid.c hash.c cktsens.c:
|
||||||
remove compiler warnings by explicit casting double -> int etc.
|
remove compiler warnings by explicit casting double -> int etc.
|
||||||
|
|
||||||
============================ ngspice-23 ==================================
|
============================ ngspice-23 ==================================
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
delta = -delta;
|
delta = -delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
mag2 = floor(log10(fabs(hi - lo)));
|
mag2 = (int)floor(log10(fabs(hi - lo)));
|
||||||
tenpowmag2 = pow(10.0, (double) mag2);
|
tenpowmag2 = pow(10.0, (double) mag2);
|
||||||
|
|
||||||
/* Round lo down, and hi up */
|
/* Round lo down, and hi up */
|
||||||
|
|
@ -269,9 +269,9 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
hi = hmt * tenpowmag2;
|
hi = hmt * tenpowmag2;
|
||||||
|
|
||||||
if (fabs(hi) > fabs(lo))
|
if (fabs(hi) > fabs(lo))
|
||||||
mag = floor(log10(fabs(hi)));
|
mag = (int)floor(log10(fabs(hi)));
|
||||||
else
|
else
|
||||||
mag = floor(log10(fabs(lo)));
|
mag = (int)floor(log10(fabs(lo)));
|
||||||
|
|
||||||
if (mag >= 0)
|
if (mag >= 0)
|
||||||
mag3 = ((int) (mag / 3)) * 3;
|
mag3 = ((int) (mag / 3)) * 3;
|
||||||
|
|
@ -380,7 +380,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
step = div_list[i].step;
|
step = div_list[i].step;
|
||||||
nsp = (dst + step - 0.0001) / step;
|
nsp = (int)((dst + step - 0.0001) / step);
|
||||||
spacing = (max - margin) / nsp;
|
spacing = (max - margin) / nsp;
|
||||||
i += 1;
|
i += 1;
|
||||||
} while ((size_t) i < NUMELEMS(div_list) && spacing > 50);
|
} while ((size_t) i < NUMELEMS(div_list) && spacing > 50);
|
||||||
|
|
@ -394,7 +394,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
while (i > 0 && spacing < slim + 3) {
|
while (i > 0 && spacing < slim + 3) {
|
||||||
i -= 1;
|
i -= 1;
|
||||||
step = div_list[i].step;
|
step = div_list[i].step;
|
||||||
nsp = (dst + step - 0.0001) / step;
|
nsp = (int)((dst + step - 0.0001) / step);
|
||||||
spacing = (max - margin) / nsp;
|
spacing = (max - margin) / nsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,14 +413,14 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
lo = lmt * tenpowmag2;
|
lo = lmt * tenpowmag2;
|
||||||
hi = hmt * tenpowmag2;
|
hi = hmt * tenpowmag2;
|
||||||
|
|
||||||
nsp = (dst + step - 0.0001) / step;
|
nsp = (int)((dst + step - 0.0001) / step);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* The user told us where to put the grid lines. They will
|
/* The user told us where to put the grid lines. They will
|
||||||
* not be equally spaced in this case (i.e, the right edge
|
* not be equally spaced in this case (i.e, the right edge
|
||||||
* won't be a line).
|
* won't be a line).
|
||||||
*/
|
*/
|
||||||
nsp = (hi - lo) / delta;
|
nsp = (int)((hi - lo) / delta);
|
||||||
if (nsp > 100)
|
if (nsp > 100)
|
||||||
nsp = 100;
|
nsp = 100;
|
||||||
step = (max - margin) * delta / (hi - lo);
|
step = (max - margin) * delta / (hi - lo);
|
||||||
|
|
@ -433,9 +433,9 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
/* Reset the max coordinate to deal with round-off error. */
|
/* Reset the max coordinate to deal with round-off error. */
|
||||||
if (nsp && (delta == 0.0)) {
|
if (nsp && (delta == 0.0)) {
|
||||||
if (axis == x_axis)
|
if (axis == x_axis)
|
||||||
graph->viewport.width = spacing * nsp;
|
graph->viewport.width = (int)(spacing * nsp);
|
||||||
else
|
else
|
||||||
graph->viewport.height = spacing * nsp;
|
graph->viewport.height = (int)(spacing * nsp);
|
||||||
} else if (!nsp) {
|
} else if (!nsp) {
|
||||||
nsp = 1;
|
nsp = 1;
|
||||||
}
|
}
|
||||||
|
|
@ -454,7 +454,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
graph->grid.xaxis.lin.distance = dst;
|
graph->grid.xaxis.lin.distance = dst;
|
||||||
graph->grid.xaxis.lin.lowlimit = lmt;
|
graph->grid.xaxis.lin.lowlimit = lmt;
|
||||||
graph->grid.xaxis.lin.highlimit = hmt;
|
graph->grid.xaxis.lin.highlimit = hmt;
|
||||||
graph->grid.xaxis.lin.spacing = spacing;
|
graph->grid.xaxis.lin.spacing = (int)spacing;
|
||||||
graph->grid.xaxis.lin.numspace = nsp;
|
graph->grid.xaxis.lin.numspace = nsp;
|
||||||
} else {
|
} else {
|
||||||
graph->grid.ysized = 1;
|
graph->grid.ysized = 1;
|
||||||
|
|
@ -467,7 +467,7 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
|
||||||
graph->grid.yaxis.lin.distance = dst;
|
graph->grid.yaxis.lin.distance = dst;
|
||||||
graph->grid.yaxis.lin.lowlimit = lmt;
|
graph->grid.yaxis.lin.lowlimit = lmt;
|
||||||
graph->grid.yaxis.lin.highlimit = hmt;
|
graph->grid.yaxis.lin.highlimit = hmt;
|
||||||
graph->grid.yaxis.lin.spacing = spacing;
|
graph->grid.yaxis.lin.spacing = (int)spacing;
|
||||||
graph->grid.yaxis.lin.numspace = nsp;
|
graph->grid.yaxis.lin.numspace = nsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -494,7 +494,7 @@ drawlingrid(GRAPH *graph, char *units, int spacing, int nsp, double dst, double
|
||||||
for (i = 0, m = lmt * 100.0; m - 0.001 <= hmt * 100.0;
|
for (i = 0, m = lmt * 100.0; m - 0.001 <= hmt * 100.0;
|
||||||
i += spacing, m += step)
|
i += spacing, m += step)
|
||||||
{
|
{
|
||||||
j = m;
|
j = (int)m;
|
||||||
if (j == 0)
|
if (j == 0)
|
||||||
SetLinestyle(0);
|
SetLinestyle(0);
|
||||||
if (graph->grid.gridtype != GRID_NONE) {
|
if (graph->grid.gridtype != GRID_NONE) {
|
||||||
|
|
@ -576,16 +576,16 @@ loggrid(GRAPH *graph, double lo, double hi, int type, Axis axis)
|
||||||
* and lo are positive.
|
* and lo are positive.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
lmt = floor(mylog10(lo));
|
lmt = (int)floor(mylog10(lo));
|
||||||
hmt = ceil(mylog10(hi));
|
hmt = (int)ceil(mylog10(hi));
|
||||||
|
|
||||||
decs = hmt - lmt;
|
decs = hmt - lmt;
|
||||||
|
|
||||||
pp = 1;
|
pp = 1;
|
||||||
decsp = (max - margin) / decs;
|
decsp = (int)((max - margin) / decs);
|
||||||
|
|
||||||
if (decsp < 20) {
|
if (decsp < 20) {
|
||||||
pp = ceil(20.0 / decsp);
|
pp = (int)ceil(20.0 / decsp);
|
||||||
decsp *= pp;
|
decsp *= pp;
|
||||||
subs = 1;
|
subs = 1;
|
||||||
} else if (decsp > 50) {
|
} else if (decsp > 50) {
|
||||||
|
|
@ -605,9 +605,9 @@ loggrid(GRAPH *graph, double lo, double hi, int type, Axis axis)
|
||||||
subs = 1;
|
subs = 1;
|
||||||
|
|
||||||
/* Start at a line */
|
/* Start at a line */
|
||||||
lmt = floor((double) lmt / pp) * pp;
|
lmt = (int)(floor((double) lmt / pp) * pp);
|
||||||
decs = hmt - lmt;
|
decs = hmt - lmt;
|
||||||
decsp = (max - margin) / decs;
|
decsp = (int)((max - margin) / decs);
|
||||||
|
|
||||||
dd[0] = pow(10.0, (double) lmt);
|
dd[0] = pow(10.0, (double) lmt);
|
||||||
dd[1] = pow(10.0, (double) hmt);
|
dd[1] = pow(10.0, (double) hmt);
|
||||||
|
|
@ -620,7 +620,7 @@ loggrid(GRAPH *graph, double lo, double hi, int type, Axis axis)
|
||||||
|
|
||||||
if (axis == x_axis) {
|
if (axis == x_axis) {
|
||||||
(void) strcpy(graph->grid.xaxis.log.units, buf);
|
(void) strcpy(graph->grid.xaxis.log.units, buf);
|
||||||
graph->viewport.width = decs * decsp;
|
graph->viewport.width = (int)(decs * decsp);
|
||||||
graph->grid.xaxis.log.hmt = hmt;
|
graph->grid.xaxis.log.hmt = hmt;
|
||||||
graph->grid.xaxis.log.lmt = lmt;
|
graph->grid.xaxis.log.lmt = lmt;
|
||||||
graph->grid.xaxis.log.decsp = decsp;
|
graph->grid.xaxis.log.decsp = decsp;
|
||||||
|
|
@ -629,7 +629,7 @@ loggrid(GRAPH *graph, double lo, double hi, int type, Axis axis)
|
||||||
graph->grid.xsized = 1;
|
graph->grid.xsized = 1;
|
||||||
} else {
|
} else {
|
||||||
(void) strcpy(graph->grid.yaxis.log.units, buf);
|
(void) strcpy(graph->grid.yaxis.log.units, buf);
|
||||||
graph->viewport.height = decs * decsp;
|
graph->viewport.height = (int)(decs * decsp);
|
||||||
graph->grid.yaxis.log.hmt = hmt;
|
graph->grid.yaxis.log.hmt = hmt;
|
||||||
graph->grid.yaxis.log.lmt = lmt;
|
graph->grid.yaxis.log.lmt = lmt;
|
||||||
graph->grid.yaxis.log.decsp = decsp;
|
graph->grid.yaxis.log.decsp = decsp;
|
||||||
|
|
@ -698,8 +698,8 @@ drawloggrid(GRAPH *graph, char *units, int hmt, int lmt, int decsp, int subs, in
|
||||||
if (subs > 1) {
|
if (subs > 1) {
|
||||||
SetLinestyle(1);
|
SetLinestyle(1);
|
||||||
t = 10.0 / subs;
|
t = 10.0 / subs;
|
||||||
for (k = ceil(subs / 10.0) + 1; k < subs; k++) {
|
for (k = (int)ceil(subs / 10.0) + 1; k < subs; k++) {
|
||||||
m = i + decsp * log10((double) t * k);
|
m = (int)(i + decsp * log10((double) t * k));
|
||||||
if (graph->grid.gridtype != GRID_NONE) {
|
if (graph->grid.gridtype != GRID_NONE) {
|
||||||
if (axis == x_axis)
|
if (axis == x_axis)
|
||||||
DevDrawLine(graph->viewportxoff + m,
|
DevDrawLine(graph->viewportxoff + m,
|
||||||
|
|
@ -775,10 +775,10 @@ polargrid(GRAPH *graph)
|
||||||
&& (graph->data.xmin == graph->data.ymin))
|
&& (graph->data.xmin == graph->data.ymin))
|
||||||
centered = TRUE;
|
centered = TRUE;
|
||||||
|
|
||||||
mag = floor(mylog10(maxrad));
|
mag = (int)floor(mylog10(maxrad));
|
||||||
tenpowmag = pow(10.0, (double) mag);
|
tenpowmag = pow(10.0, (double) mag);
|
||||||
hmt = maxrad / tenpowmag;
|
hmt = (int)(maxrad / tenpowmag);
|
||||||
lmt = minrad / tenpowmag;
|
lmt = (int)(minrad / tenpowmag);
|
||||||
if (hmt * tenpowmag < maxrad)
|
if (hmt * tenpowmag < maxrad)
|
||||||
hmt++;
|
hmt++;
|
||||||
if (lmt * tenpowmag > minrad)
|
if (lmt * tenpowmag > minrad)
|
||||||
|
|
@ -838,15 +838,15 @@ drawpolargrid(GRAPH *graph)
|
||||||
pixperunit = graph->grid.xaxis.circular.radius * 2 /
|
pixperunit = graph->grid.xaxis.circular.radius * 2 /
|
||||||
(graph->datawindow.xmax - graph->datawindow.xmin);
|
(graph->datawindow.xmax - graph->datawindow.xmin);
|
||||||
|
|
||||||
relcx = - (graph->datawindow.xmin + graph->datawindow.xmax) / 2
|
relcx = - (int)((graph->datawindow.xmin + graph->datawindow.xmax) / 2
|
||||||
* pixperunit;
|
* pixperunit);
|
||||||
relcy = - (graph->datawindow.ymin + graph->datawindow.ymax) / 2
|
relcy = - (int)((graph->datawindow.ymin + graph->datawindow.ymax) / 2
|
||||||
* pixperunit;
|
* pixperunit);
|
||||||
|
|
||||||
/* The distance from the center of the plotting area to the center of
|
/* The distance from the center of the plotting area to the center of
|
||||||
* the logical area.
|
* the logical area.
|
||||||
*/
|
*/
|
||||||
dist = sqrt((double) (relcx * relcx + relcy * relcy));
|
dist = (int)sqrt((double) (relcx * relcx + relcy * relcy));
|
||||||
|
|
||||||
SetLinestyle(0);
|
SetLinestyle(0);
|
||||||
DevDrawArc(graph->grid.xaxis.circular.center,
|
DevDrawArc(graph->grid.xaxis.circular.center,
|
||||||
|
|
@ -857,7 +857,7 @@ drawpolargrid(GRAPH *graph)
|
||||||
|
|
||||||
/* Now draw the circles. */
|
/* Now draw the circles. */
|
||||||
for (i = lmt;
|
for (i = lmt;
|
||||||
(relrad = i * tenpowmag * pixperunit)
|
(relrad = (int)(i * tenpowmag * pixperunit))
|
||||||
<= dist + graph->grid.xaxis.circular.radius;
|
<= dist + graph->grid.xaxis.circular.radius;
|
||||||
i += step)
|
i += step)
|
||||||
{
|
{
|
||||||
|
|
@ -891,10 +891,10 @@ drawpolargrid(GRAPH *graph)
|
||||||
for (i = 0; i < 12; i++) {
|
for (i = 0; i < 12; i++) {
|
||||||
x1 = graph->grid.xaxis.circular.center + relcx;
|
x1 = graph->grid.xaxis.circular.center + relcx;
|
||||||
y1 = graph->grid.yaxis.circular.center + relcy;
|
y1 = graph->grid.yaxis.circular.center + relcy;
|
||||||
x2 = x1 + graph->grid.xaxis.circular.radius * 2
|
x2 = (int)(x1 + graph->grid.xaxis.circular.radius * 2
|
||||||
* cos(i * M_PI / 6);
|
* cos(i * M_PI / 6));
|
||||||
y2 = y1 + graph->grid.xaxis.circular.radius * 2
|
y2 = (int)(y1 + graph->grid.xaxis.circular.radius * 2
|
||||||
* sin(i * M_PI / 6);
|
* sin(i * M_PI / 6));
|
||||||
if (!clip_to_circle(&x1, &y1, &x2, &y2,
|
if (!clip_to_circle(&x1, &y1, &x2, &y2,
|
||||||
graph->grid.xaxis.circular.center,
|
graph->grid.xaxis.circular.center,
|
||||||
graph->grid.yaxis.circular.center,
|
graph->grid.yaxis.circular.center,
|
||||||
|
|
@ -930,8 +930,8 @@ drawpolargrid(GRAPH *graph)
|
||||||
for (i = 0; i < 360; i+= degs) {
|
for (i = 0; i < 360; i+= degs) {
|
||||||
x1 = graph->grid.xaxis.circular.center + relcx;
|
x1 = graph->grid.xaxis.circular.center + relcx;
|
||||||
y1 = graph->grid.yaxis.circular.center + relcy;
|
y1 = graph->grid.yaxis.circular.center + relcy;
|
||||||
x2 = x1 + dist * 2 * cos(i * M_PI / 180);
|
x2 = (int)(x1 + dist * 2 * cos(i * M_PI / 180));
|
||||||
y2 = y1 + dist * 2 * sin(i * M_PI / 180);
|
y2 = (int)(y1 + dist * 2 * sin(i * M_PI / 180));
|
||||||
if (!clip_to_circle(&x1, &y1, &x2, &y2,
|
if (!clip_to_circle(&x1, &y1, &x2, &y2,
|
||||||
graph->grid.xaxis.circular.center,
|
graph->grid.xaxis.circular.center,
|
||||||
graph->grid.yaxis.circular.center,
|
graph->grid.yaxis.circular.center,
|
||||||
|
|
@ -974,12 +974,12 @@ adddeglabel(GRAPH *graph, int deg, int x, int y, int cx, int cy, int lx, int ly)
|
||||||
return;
|
return;
|
||||||
(void) sprintf(buf, "%d", deg);
|
(void) sprintf(buf, "%d", deg);
|
||||||
w = graph->fontwidth * (int) (strlen(buf) + 1);
|
w = graph->fontwidth * (int) (strlen(buf) + 1);
|
||||||
h = graph->fontheight * 1.5;
|
h = (int)(graph->fontheight * 1.5);
|
||||||
angle = atan2((double) (y - ly), (double) (x - lx));
|
angle = atan2((double) (y - ly), (double) (x - lx));
|
||||||
d = fabs(cos(angle)) * w / 2 + fabs(sin(angle)) * h / 2 + LOFF;
|
d = (int)(fabs(cos(angle)) * w / 2 + fabs(sin(angle)) * h / 2 + LOFF);
|
||||||
|
|
||||||
x = x + d * cos(angle) - w / 2;
|
x = (int)(x + d * cos(angle) - w / 2);
|
||||||
y = y + d * sin(angle) - h / 2;
|
y = (int)(y + d * sin(angle) - h / 2);
|
||||||
|
|
||||||
DevDrawText(buf, x, y);
|
DevDrawText(buf, x, y);
|
||||||
DevDrawText("o", x + (int) strlen(buf) * graph->fontwidth,
|
DevDrawText("o", x + (int) strlen(buf) * graph->fontwidth,
|
||||||
|
|
@ -1120,20 +1120,20 @@ drawsmithgrid(GRAPH *graph)
|
||||||
maxrad = d + (graph->datawindow.xmax - graph->datawindow.xmin) / 2;
|
maxrad = d + (graph->datawindow.xmax - graph->datawindow.xmin) / 2;
|
||||||
minrad = d - (graph->datawindow.xmax - graph->datawindow.xmin) / 2;
|
minrad = d - (graph->datawindow.xmax - graph->datawindow.xmin) / 2;
|
||||||
|
|
||||||
mag = floor(mylog10(maxrad));
|
mag = (int)floor(mylog10(maxrad));
|
||||||
tenpowmag = pow(10.0, (double) mag);
|
tenpowmag = pow(10.0, (double) mag);
|
||||||
|
|
||||||
pixperunit = graph->viewport.width / (graph->datawindow.xmax -
|
pixperunit = graph->viewport.width / (graph->datawindow.xmax -
|
||||||
graph->datawindow.xmin);
|
graph->datawindow.xmin);
|
||||||
|
|
||||||
xoff = - pixperunit * (graph->datawindow.xmin + graph->datawindow.xmax) / 2;
|
xoff = - (int)(pixperunit * (graph->datawindow.xmin + graph->datawindow.xmax) / 2);
|
||||||
yoff = - pixperunit * (graph->datawindow.ymin + graph->datawindow.ymax) / 2;
|
yoff = - (int)(pixperunit * (graph->datawindow.ymin + graph->datawindow.ymax) / 2);
|
||||||
|
|
||||||
/* Sweep the range from 10e-20 to 10e20. If any arcs fall into the
|
/* Sweep the range from 10e-20 to 10e20. If any arcs fall into the
|
||||||
* picture, plot the arc set.
|
* picture, plot the arc set.
|
||||||
*/
|
*/
|
||||||
for (mag = -20; mag < 20; mag++) {
|
for (mag = -20; mag < 20; mag++) {
|
||||||
i = gr_radius * pow(10.0, (double) mag) / maxrad;
|
i = (int)(gr_radius * pow(10.0, (double) mag) / maxrad);
|
||||||
if (i > 10) {
|
if (i > 10) {
|
||||||
j = 1;
|
j = 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1163,7 +1163,7 @@ drawsmithgrid(GRAPH *graph)
|
||||||
mag -= 2;
|
mag -= 2;
|
||||||
j *= 10;
|
j *= 10;
|
||||||
while (mag < 20) {
|
while (mag < 20) {
|
||||||
i = j * pow(10.0, (double) mag) * pixperunit / 2;
|
i = (int)(j * pow(10.0, (double) mag) * pixperunit / 2);
|
||||||
if (i / 5 > gr_radius + ((xoff > 0) ? xoff : - xoff))
|
if (i / 5 > gr_radius + ((xoff > 0) ? xoff : - xoff))
|
||||||
break;
|
break;
|
||||||
rnorm[k] = j * pow(10.0, (double) (mag - basemag));
|
rnorm[k] = j * pow(10.0, (double) (mag - basemag));
|
||||||
|
|
@ -1246,7 +1246,7 @@ drawsmithgrid(GRAPH *graph)
|
||||||
kr[i] = ks[j];
|
kr[i] = ks[j];
|
||||||
|
|
||||||
if ((yoff > - gr_radius) && (yoff < gr_radius)) {
|
if ((yoff > - gr_radius) && (yoff < gr_radius)) {
|
||||||
zheight = gr_radius * cos(asin((double) yoff / gr_radius));
|
zheight = (int)(gr_radius * cos(asin((double) yoff / gr_radius)));
|
||||||
zheight = (zheight > 0) ? zheight : - zheight;
|
zheight = (zheight > 0) ? zheight : - zheight;
|
||||||
} else {
|
} else {
|
||||||
zheight = gr_radius;
|
zheight = gr_radius;
|
||||||
|
|
@ -1280,7 +1280,7 @@ drawsmithgrid(GRAPH *graph)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if ((yoff > - gr_radius) && (yoff < gr_radius)) {
|
if ((yoff > - gr_radius) && (yoff < gr_radius)) {
|
||||||
zheight = gr_radius * cos(asin((double) yoff / gr_radius));
|
zheight = (int)(gr_radius * cos(asin((double) yoff / gr_radius)));
|
||||||
if (zheight < 0)
|
if (zheight < 0)
|
||||||
zheight = - zheight;
|
zheight = - zheight;
|
||||||
DevDrawLine(gr_xcenter - zheight, gr_ycenter + yoff,
|
DevDrawLine(gr_xcenter - zheight, gr_ycenter + yoff,
|
||||||
|
|
@ -1344,8 +1344,8 @@ arcset(GRAPH *graph, double rad, double prevrad, double irad, double iprevrad, d
|
||||||
(double) (M_PI * 1.5 + 2 * iangle),
|
(double) (M_PI * 1.5 + 2 * iangle),
|
||||||
(double) (M_PI * 1.5 - 2 * iangle), centx, centy, maxrad, 1);
|
(double) (M_PI * 1.5 - 2 * iangle), centx, centy, maxrad, 1);
|
||||||
if ((aclip > M_PI / 180) && (pdeg > 1)) {
|
if ((aclip > M_PI / 180) && (pdeg > 1)) {
|
||||||
xlab = centx + xoffset + radoff + irad * cos(aclip);
|
xlab = (int)(centx + xoffset + radoff + irad * cos(aclip));
|
||||||
ylab = centy + yoffset + irad * (1 + sin(aclip));
|
ylab = (int)(centy + yoffset + irad * (1 + sin(aclip)));
|
||||||
if ((ylab - gr_ycenter) > graph->fontheight) {
|
if ((ylab - gr_ycenter) > graph->fontheight) {
|
||||||
SetColor(1);
|
SetColor(1);
|
||||||
adddeglabel(graph, pdeg, xlab, ylab,
|
adddeglabel(graph, pdeg, xlab, ylab,
|
||||||
|
|
@ -1364,8 +1364,8 @@ arcset(GRAPH *graph, double rad, double prevrad, double irad, double iprevrad, d
|
||||||
(double) (M_PI / 2 - 2 * iangle), centx, centy, maxrad,
|
(double) (M_PI / 2 - 2 * iangle), centx, centy, maxrad,
|
||||||
(iangle == 0)?2:0);
|
(iangle == 0)?2:0);
|
||||||
if ((aclip >= 0 && aclip < 2*M_PI - M_PI/180) && (pdeg < 359)) {
|
if ((aclip >= 0 && aclip < 2*M_PI - M_PI/180) && (pdeg < 359)) {
|
||||||
xlab = centx + xoffset + radoff + irad * cos(aclip);
|
xlab = (int)(centx + xoffset + radoff + irad * cos(aclip));
|
||||||
ylab = centy + yoffset + irad * (sin(aclip) - 1);
|
ylab = (int)(centy + yoffset + irad * (sin(aclip) - 1));
|
||||||
SetColor(1);
|
SetColor(1);
|
||||||
adddeglabel(graph, ndeg, xlab, ylab,
|
adddeglabel(graph, ndeg, xlab, ylab,
|
||||||
gr_xcenter, gr_ycenter, gr_xcenter, gr_ycenter);
|
gr_xcenter, gr_ycenter, gr_xcenter, gr_ycenter);
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ PS_Init(void)
|
||||||
|
|
||||||
/* plot size */
|
/* plot size */
|
||||||
if (!cp_getvar("hcopywidth", CP_STRING, pswidth)) {
|
if (!cp_getvar("hcopywidth", CP_STRING, pswidth)) {
|
||||||
dispdev->width = 7.75 * 72.0 * scale; /* (8 1/2 - 3/4) * 72 */
|
dispdev->width = (int)(7.75 * 72.0 * scale); /* (8 1/2 - 3/4) * 72 */
|
||||||
} else {
|
} else {
|
||||||
sscanf(pswidth, "%d", &(dispdev->width));
|
sscanf(pswidth, "%d", &(dispdev->width));
|
||||||
if (dispdev->width <= 100)
|
if (dispdev->width <= 100)
|
||||||
|
|
@ -141,21 +141,21 @@ PS_Init(void)
|
||||||
fontsize = 10;
|
fontsize = 10;
|
||||||
fontwidth = 6;
|
fontwidth = 6;
|
||||||
fontheight = 14;
|
fontheight = 14;
|
||||||
xtadj = XTADJ * scale;
|
xtadj = (int)(XTADJ * scale);
|
||||||
ytadj = YTADJ * scale;
|
ytadj = (int)(YTADJ * scale);
|
||||||
} else {
|
} else {
|
||||||
sscanf(psfontsize, "%d", &fontsize);
|
sscanf(psfontsize, "%d", &fontsize);
|
||||||
if ((fontsize < 10) || (fontsize > 14))
|
if ((fontsize < 10) || (fontsize > 14))
|
||||||
fontsize = 10;
|
fontsize = 10;
|
||||||
fontwidth = 0.5 + 0.6 * fontsize;
|
fontwidth = (int)(0.5 + 0.6 * fontsize);
|
||||||
fontheight = 2.5 + 1.2 * fontsize;
|
fontheight = (int)(2.5 + 1.2 * fontsize);
|
||||||
xtadj = XTADJ * scale * fontsize / 10;
|
xtadj = (int)(XTADJ * scale * fontsize / 10);
|
||||||
ytadj = YTADJ * scale * fontsize / 10;
|
ytadj = (int)(YTADJ * scale * fontsize / 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
screenflag = 0;
|
screenflag = 0;
|
||||||
dispdev->minx = XOFF / scale;
|
dispdev->minx = (int)(XOFF / scale);
|
||||||
dispdev->miny = YOFF / scale;
|
dispdev->miny = (int)(YOFF / scale);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
|
|
@ -181,8 +181,8 @@ PS_NewViewport(GRAPH *graph)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reasonable values, used in gr_ for placement */
|
/* reasonable values, used in gr_ for placement */
|
||||||
graph->fontwidth = fontwidth * scale; /* was 12, p.w.h. */
|
graph->fontwidth = (int)(fontwidth * scale); /* was 12, p.w.h. */
|
||||||
graph->fontheight = fontheight * scale; /* was 24, p.w.h. */
|
graph->fontheight = (int)(fontheight * scale); /* was 24, p.w.h. */
|
||||||
|
|
||||||
graph->absolute.width = dispdev->width;
|
graph->absolute.width = dispdev->width;
|
||||||
graph->absolute.height = dispdev->height;
|
graph->absolute.height = dispdev->height;
|
||||||
|
|
@ -190,13 +190,13 @@ PS_NewViewport(GRAPH *graph)
|
||||||
graph->viewportxoff = 8 * fontwidth;
|
graph->viewportxoff = 8 * fontwidth;
|
||||||
graph->viewportyoff = 4 * fontheight;
|
graph->viewportyoff = 4 * fontheight;
|
||||||
|
|
||||||
xoff = scale * XOFF;
|
xoff = (int)(scale * XOFF);
|
||||||
yoff = scale * YOFF;
|
yoff = (int)(scale * YOFF);
|
||||||
|
|
||||||
x1 = 0.75 * 72;
|
x1 = (int)(0.75 * 72);
|
||||||
y1 = x1;
|
y1 = x1;
|
||||||
x2 = graph->absolute.width + .75 * 72;
|
x2 = (int)(graph->absolute.width + .75 * 72);
|
||||||
y2 = graph->absolute.height + .75 * 72;
|
y2 = (int)(graph->absolute.height + .75 * 72);
|
||||||
/* start file off with a % */
|
/* start file off with a % */
|
||||||
fprintf(plotfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
|
fprintf(plotfile, "%%!PS-Adobe-3.0 EPSF-3.0\n");
|
||||||
fprintf(plotfile, "%%%%Creator: nutmeg\n");
|
fprintf(plotfile, "%%%%Creator: nutmeg\n");
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,7 @@ void * nghash_insert(NGHASHPTR hashtable, void * user_key, void * data)
|
||||||
|
|
||||||
if( hashtable->num_entries >= hashtable->need_resize ){
|
if( hashtable->num_entries >= hashtable->need_resize ){
|
||||||
int newsize ; /* new size of table */
|
int newsize ; /* new size of table */
|
||||||
newsize = hashtable->size * hashtable->growth_factor ;
|
newsize = (int)(hashtable->size * hashtable->growth_factor);
|
||||||
nghash_resize(hashtable, newsize ) ;
|
nghash_resize(hashtable, newsize ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,7 @@ count_steps(int type, double low, double high, int steps, double *stepsize)
|
||||||
low = 1e-3;
|
low = 1e-3;
|
||||||
if (high <= low)
|
if (high <= low)
|
||||||
high = 10.0 * low;
|
high = 10.0 * low;
|
||||||
n = steps * log10(high/low) + 1.01;
|
n = (int)(steps * log10(high/low) + 1.01);
|
||||||
s = pow(10.0, 1.0 / steps);
|
s = pow(10.0, 1.0 / steps);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -686,7 +686,7 @@ count_steps(int type, double low, double high, int steps, double *stepsize)
|
||||||
low = 1e-3;
|
low = 1e-3;
|
||||||
if (high <= low)
|
if (high <= low)
|
||||||
high = 2.0 * low;
|
high = 2.0 * low;
|
||||||
n = steps * log(high/low) / M_LOG2E + 1.01;
|
n = (int)(steps * log(high/low) / M_LOG2E + 1.01);
|
||||||
s = pow(2.0, 1.0 / steps);
|
s = pow(2.0, 1.0 / steps);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue