8 |
|
*/ |
9 |
|
|
10 |
|
#include "meta.h" |
11 |
+ |
#include "plot.h" |
12 |
|
|
13 |
|
|
14 |
|
#define RIGHT 0 |
25 |
|
static int cury = 0; |
26 |
|
static int cura0 = 0; |
27 |
|
static int inpoly = FALSE; |
28 |
< |
static char curargs[MAXARGS] = ""; |
28 |
> |
static char curargs[6*MAXARGS] = ""; |
29 |
|
static char *cap; |
30 |
|
|
31 |
|
|
32 |
< |
mendpage() /* end of page */ |
32 |
> |
static int let_dir( register int c); |
33 |
> |
static void closepoly(void); |
34 |
> |
static void polyval( register int x, register int y); |
35 |
> |
static void decival( register int v); |
36 |
> |
|
37 |
> |
|
38 |
> |
void |
39 |
> |
mendpage(void) /* end of page */ |
40 |
|
{ |
41 |
|
pflush(); |
42 |
|
pglob(PEOP, 0200, NULL); |
43 |
|
} |
44 |
|
|
45 |
< |
|
46 |
< |
mdone() /* end of graphics metafile */ |
45 |
> |
void |
46 |
> |
mdone(void) /* end of graphics metafile */ |
47 |
|
{ |
48 |
|
pflush(); |
49 |
|
pglob(PEOF, 0200, NULL); |
50 |
|
} |
51 |
|
|
52 |
< |
|
53 |
< |
minclude(fname) /* include a file */ |
54 |
< |
char *fname; |
52 |
> |
void |
53 |
> |
minclude( /* include a file */ |
54 |
> |
char *fname |
55 |
> |
) |
56 |
|
{ |
57 |
|
pflush(); |
58 |
|
pglob(PINCL, 1, fname); |
59 |
|
} |
60 |
|
|
61 |
< |
|
62 |
< |
msetpat(pn, pat) /* set a pattern */ |
63 |
< |
int pn; |
64 |
< |
char *pat; |
61 |
> |
void |
62 |
> |
msetpat( /* set a pattern */ |
63 |
> |
int pn, |
64 |
> |
char *pat |
65 |
> |
) |
66 |
|
{ |
67 |
|
pflush(); |
68 |
|
pglob(PSET, pn+4, pat); |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
< |
mopenseg(sname) /* open a segment */ |
73 |
< |
char *sname; |
72 |
> |
void |
73 |
> |
mopenseg( /* open a segment */ |
74 |
> |
char *sname |
75 |
> |
) |
76 |
|
{ |
77 |
|
pflush(); |
78 |
|
pglob(POPEN, 0, sname); |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
< |
mcloseseg() /* close current segment */ |
82 |
> |
void |
83 |
> |
mcloseseg(void) /* close current segment */ |
84 |
|
{ |
85 |
|
pflush(); |
86 |
|
pglob(PCLOSE, 0200, NULL); |
87 |
|
} |
88 |
|
|
89 |
|
|
90 |
< |
mline(x, y, type, thick, color) /* start a line */ |
91 |
< |
int x, y; |
92 |
< |
int type, thick, color; |
90 |
> |
void |
91 |
> |
mline( /* start a line */ |
92 |
> |
int x, int y, |
93 |
> |
int type, int thick, int color |
94 |
> |
) |
95 |
|
{ |
96 |
|
pflush(); |
97 |
|
cura0 = (type<<4 & 060) | (thick<<2 & 014) | (color & 03); |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
< |
mrectangle(xmin, ymin, xmax, ymax, pat, color) /* fill a rectangle */ |
104 |
< |
int xmin, ymin, xmax, ymax; |
105 |
< |
int pat, color; |
103 |
> |
void |
104 |
> |
mrectangle( /* fill a rectangle */ |
105 |
> |
int xmin, int ymin, int xmax, int ymax, |
106 |
> |
int pat, int color |
107 |
> |
) |
108 |
|
{ |
109 |
|
pflush(); |
110 |
|
cura0 = (pat<<2 & 014) | (color & 03); |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
< |
mtriangle(xmin, ymin, xmax, ymax, d, pat, color) /* fill a triangle */ |
116 |
< |
int xmin, ymin, xmax, ymax; |
117 |
< |
int d, pat, color; |
115 |
> |
void |
116 |
> |
mtriangle( /* fill a triangle */ |
117 |
> |
int xmin, int ymin, int xmax, int ymax, |
118 |
> |
int d, int pat, int color |
119 |
> |
) |
120 |
|
{ |
121 |
|
pflush(); |
122 |
|
cura0 = (let_dir(d)<<4 & 060) | (pat<<2 & 014) | (color & 03); |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
< |
mpoly(x, y, border, pat, color) /* start a polygon */ |
128 |
< |
int x, y; |
129 |
< |
int border, pat, color; |
127 |
> |
void |
128 |
> |
mpoly( /* start a polygon */ |
129 |
> |
int x, int y, |
130 |
> |
int border, int pat, int color |
131 |
> |
) |
132 |
|
{ |
133 |
|
pflush(); |
134 |
|
cura0 = (border<<6 & 0100) | (pat<<2 & 014) | (color & 03); |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
< |
mtext(x, y, s, cpi, color) /* matrix string */ |
144 |
< |
int x, y; |
145 |
< |
char *s; |
146 |
< |
int cpi; |
147 |
< |
int color; |
143 |
> |
void |
144 |
> |
mtext( /* matrix string */ |
145 |
> |
int x, int y, |
146 |
> |
char *s, |
147 |
> |
int cpi, |
148 |
> |
int color |
149 |
> |
) |
150 |
|
{ |
151 |
|
pflush(); |
152 |
|
cura0 = (color & 03); |
164 |
|
} |
165 |
|
|
166 |
|
|
167 |
< |
mvstr(xmin, ymin, xmax, ymax, s, d, thick, color) /* vector string */ |
168 |
< |
int xmin, ymin, xmax, ymax; |
169 |
< |
char *s; |
170 |
< |
int d, thick, color; |
167 |
> |
void |
168 |
> |
mvstr( /* vector string */ |
169 |
> |
int xmin, int ymin, int xmax, int ymax, |
170 |
> |
char *s, |
171 |
> |
int d, int thick, int color |
172 |
> |
) |
173 |
|
{ |
174 |
|
pflush(); |
175 |
|
cura0 = (let_dir(d)<<4 & 060) | (thick<<2 & 014) | (color & 03); |
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
< |
msegment(xmin, ymin, xmax, ymax, sname, d, thick, color) /* segment */ |
181 |
< |
int xmin, ymin, xmax, ymax; |
182 |
< |
char *sname; |
183 |
< |
int d, thick, color; |
180 |
> |
void |
181 |
> |
msegment( /* segment */ |
182 |
> |
int xmin, int ymin, int xmax, int ymax, |
183 |
> |
char *sname, |
184 |
> |
int d, int thick, int color |
185 |
> |
) |
186 |
|
{ |
187 |
|
pflush(); |
188 |
|
cura0 = (let_dir(d)<<4 & 060) | (thick<<2 & 014) | (color & 03); |
190 |
|
} |
191 |
|
|
192 |
|
|
193 |
< |
mdraw(x, y) /* draw to next point */ |
194 |
< |
int x, y; |
193 |
> |
void |
194 |
> |
mdraw( /* draw to next point */ |
195 |
> |
int x, int y |
196 |
> |
) |
197 |
|
{ |
198 |
|
if (inpoly) { |
199 |
|
polyval(x, y); |
205 |
|
} |
206 |
|
|
207 |
|
|
208 |
< |
static |
209 |
< |
decival(v) /* add value to polygon */ |
210 |
< |
register int v; |
208 |
> |
static void |
209 |
> |
decival( /* add value to polygon */ |
210 |
> |
register int v |
211 |
> |
) |
212 |
|
{ |
213 |
|
if (!v) |
214 |
|
return; |
217 |
|
} |
218 |
|
|
219 |
|
|
220 |
< |
static |
221 |
< |
polyval(x, y) /* add vertex to a polygon */ |
222 |
< |
register int x, y; |
220 |
> |
static void |
221 |
> |
polyval( /* add vertex to a polygon */ |
222 |
> |
register int x, |
223 |
> |
register int y |
224 |
> |
) |
225 |
|
{ |
226 |
|
*cap++ = ' '; |
227 |
|
putdec(x); |
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
< |
static |
234 |
< |
closepoly() /* close current polygon */ |
233 |
> |
static void |
234 |
> |
closepoly(void) /* close current polygon */ |
235 |
|
{ |
236 |
|
*cap = '\0'; |
237 |
|
pprim(PPFILL, cura0, 0, 0, XYSIZE-1, XYSIZE-1, curargs); |
240 |
|
|
241 |
|
|
242 |
|
static int |
243 |
< |
let_dir(c) /* convert letter to corresponding direction */ |
244 |
< |
register int c; |
243 |
> |
let_dir( /* convert letter to corresponding direction */ |
244 |
> |
register int c |
245 |
> |
) |
246 |
|
{ |
247 |
|
switch (c) { |
248 |
|
case 'R': |