6 |
|
* on simple drivers |
7 |
|
*/ |
8 |
|
|
9 |
+ |
#include <string.h> |
10 |
|
|
11 |
|
#include "meta.h" |
12 |
|
|
12 |
– |
|
13 |
|
/* vector characters file */ |
14 |
|
#define VINPUT "vchars.mta" |
15 |
|
|
26 |
|
|
27 |
|
static short *xlist; /* pointer to expansion list */ |
28 |
|
|
29 |
+ |
static void exfile(FILE *fp); |
30 |
+ |
static void exprim(PRIMITIVE *p); |
31 |
+ |
static void sendmstr(register PRIMITIVE *p); |
32 |
+ |
static void sendvstr(register PRIMITIVE *p); |
33 |
+ |
static void include(int code, char *fname); |
34 |
+ |
static void polyfill(PRIMITIVE *p); |
35 |
+ |
static void polyedge(PRIMITIVE *p, int x1, int y1, int x2, int y2); |
36 |
|
|
37 |
|
|
38 |
< |
expand(infp, exlist) /* expand requested commands */ |
39 |
< |
|
40 |
< |
FILE *infp; |
41 |
< |
short *exlist; |
42 |
< |
|
38 |
> |
void |
39 |
> |
expand( /* expand requested commands */ |
40 |
> |
FILE *infp, |
41 |
> |
short *exlist |
42 |
> |
) |
43 |
|
{ |
44 |
< |
static PRIMITIVE pincl = {PINCL, 02, -1, -1, -1, -1, VINPUT}; |
44 |
> |
static PRIMITIVE pincl = {PINCL, 02, {-1, -1, -1, -1}, VINPUT, NULL}; |
45 |
|
static short vcloaded = FALSE; |
46 |
|
|
47 |
|
xlist = exlist; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
< |
static |
65 |
< |
exfile(fp) /* expand the given file */ |
66 |
< |
|
67 |
< |
register FILE *fp; |
61 |
< |
|
64 |
> |
static void |
65 |
> |
exfile( /* expand the given file */ |
66 |
> |
register FILE *fp |
67 |
> |
) |
68 |
|
{ |
69 |
|
PRIMITIVE curp; |
70 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
< |
static |
82 |
< |
exprim(p) /* expand primitive */ |
83 |
< |
|
84 |
< |
register PRIMITIVE *p; |
79 |
< |
|
81 |
> |
static void |
82 |
> |
exprim( /* expand primitive */ |
83 |
> |
register PRIMITIVE *p |
84 |
> |
) |
85 |
|
{ |
86 |
|
int xflag = xlist[comndx(p->com)]; |
87 |
|
/* 1==expand, 0==pass, -1==discard */ |
88 |
< |
if (xflag != -1) |
88 |
> |
if (xflag != -1) { |
89 |
|
if (xflag == 1) |
90 |
|
switch (p->com) { |
91 |
|
|
126 |
|
segprim(p); |
127 |
|
else |
128 |
|
writep(p, stdout); |
129 |
< |
|
129 |
> |
} |
130 |
|
} |
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
< |
static |
136 |
< |
sendmstr(p) /* expand a matrix string */ |
137 |
< |
|
138 |
< |
register PRIMITIVE *p; |
134 |
< |
|
135 |
> |
static void |
136 |
> |
sendmstr( /* expand a matrix string */ |
137 |
> |
register PRIMITIVE *p |
138 |
> |
) |
139 |
|
{ |
140 |
|
PRIMITIVE pout; |
141 |
|
int cheight, cwidth, cthick, ccol; |
165 |
|
|
166 |
|
|
167 |
|
|
168 |
< |
static |
169 |
< |
sendvstr(p) /* expand a vector string */ |
170 |
< |
|
171 |
< |
register PRIMITIVE *p; |
168 |
< |
|
168 |
> |
static void |
169 |
> |
sendvstr( /* expand a vector string */ |
170 |
> |
register PRIMITIVE *p |
171 |
> |
) |
172 |
|
{ |
173 |
|
PRIMITIVE pout; |
174 |
< |
int xadv, yadv; |
174 |
> |
int xadv = 0, yadv = 0; |
175 |
|
char s[3]; |
176 |
|
register char *cp; |
177 |
|
|
236 |
|
|
237 |
|
|
238 |
|
|
239 |
< |
static |
240 |
< |
include(code, fname) /* load an include file */ |
241 |
< |
|
242 |
< |
int code; |
243 |
< |
char *fname; |
241 |
< |
|
239 |
> |
static void |
240 |
> |
include( /* load an include file */ |
241 |
> |
int code, |
242 |
> |
char *fname |
243 |
> |
) |
244 |
|
{ |
245 |
< |
register FILE *fp; |
245 |
> |
register FILE *fp = NULL; |
246 |
|
|
247 |
|
if (fname == NULL) |
248 |
|
error(USER, "missing include file name in include"); |
249 |
|
|
250 |
< |
if (code == 2 || (fp = fopen(fname, "r")) == NULL) |
250 |
> |
if (code == 2 || (fp = fopen(fname, "r")) == NULL) { |
251 |
|
if (code != 0) |
252 |
|
fp = mfopen(fname, "r"); |
253 |
|
else { |
254 |
|
sprintf(errmsg, "cannot open user include file \"%s\"", fname); |
255 |
|
error(USER, errmsg); |
256 |
|
} |
257 |
+ |
} |
258 |
|
|
259 |
|
exfile(fp); |
260 |
|
fclose(fp); |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
< |
static |
267 |
< |
polyfill(p) /* expand polygon fill command */ |
268 |
< |
|
269 |
< |
PRIMITIVE *p; |
267 |
< |
|
266 |
> |
static void |
267 |
> |
polyfill( /* expand polygon fill command */ |
268 |
> |
PRIMITIVE *p |
269 |
> |
) |
270 |
|
{ |
271 |
< |
char *nextscan(); |
272 |
< |
int firstx, firsty, lastx, lasty, x, y; |
271 |
> |
char firstx, firsty, x, y; |
272 |
> |
int lastx, lasty; |
273 |
|
register char *cp; |
274 |
|
|
275 |
|
if ((cp=nextscan(nextscan(p->args,"%d",&firstx),"%d",&firsty)) == NULL) { |
293 |
|
|
294 |
|
|
295 |
|
|
296 |
< |
static |
297 |
< |
polyedge(p, x1, y1, x2, y2) /* expand edge of polygon */ |
298 |
< |
|
299 |
< |
PRIMITIVE *p; |
300 |
< |
int x1, y1, x2, y2; |
299 |
< |
|
296 |
> |
static void |
297 |
> |
polyedge( /* expand edge of polygon */ |
298 |
> |
PRIMITIVE *p, |
299 |
> |
int x1, int y1, int x2, int y2 |
300 |
> |
) |
301 |
|
{ |
302 |
|
int reverse; |
303 |
|
PRIMITIVE pin, pout; |