1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include "defn.h"
#define MAXDRAWPOINTS 100
plotps(type)
char *type;
{
if (type == MOVE || type == RMOVE)
{
while (SIGNED_NUMERIC)
{
if (type == MOVE)
{
end_draw();
absX = lastXmove = getval() * XSCALE;
absY = lastYmove = getval() * YSCALE;
} else
if (type == RMOVE)
{
end_draw();
lastXmove = absX += getval() * XSCALE;
lastYmove = absY += getval() * YSCALE;
}
}
}
else /* Must be a DRAW or RDRAW */
{
while (SIGNED_NUMERIC)
{
if (dcount++ >= MAXDRAWPOINTS)
{
end_draw();
printf("newpath\n");
printf(" %g %g %s\n", absX, absY, MOVE);
DRAW_FLAG = 1;
fprintf(stderr, "Warning exceeded 100 draw points\n");
}
xval = getval() * XSCALE;
yval = getval() * YSCALE;
if (!DRAW_FLAG)
{
printf("newpath\n");
printf(" %g %g %s\n", absX, absY, MOVE);
DRAW_FLAG = 1;
}
if (type == RDRAW)
{
absX += xval;
absY += yval;
printf(" %g %g %s\n", xval, yval, RDRAW);
} else
if (type == DRAW)
{
absX = xval;
absY = yval;
printf(" %g %g %s\n", absX, absY, DRAW);
} else
{
fprintf(stderr, "Error: expecting draw command not %s\n", type);
exit(1);
}
}
}
}
|