9 |
|
|
10 |
|
#include <fcntl.h> |
11 |
|
|
12 |
+ |
#include "platform.h" |
13 |
+ |
#include "rtprocess.h" |
14 |
|
#include "meta.h" |
15 |
|
|
16 |
|
|
75 |
|
|
76 |
|
static PRIMITIVE nextp; |
77 |
|
|
78 |
+ |
static void init(void); |
79 |
+ |
static void plot(FILE *infp); |
80 |
+ |
static void doprim(register PRIMITIVE *p); |
81 |
+ |
static void doglobal(PRIMITIVE *g); |
82 |
+ |
static void longwait(int t); |
83 |
+ |
static void shortwait(int t); |
84 |
+ |
static void plotlseg(register PRIMITIVE *p); |
85 |
+ |
static void printstr(register PRIMITIVE *p); |
86 |
+ |
static void fillrect(register PRIMITIVE *p); |
87 |
+ |
static void setcolor(int cn); |
88 |
+ |
static void move(int x, int y); |
89 |
+ |
static void draw(int x, int y); |
90 |
+ |
static void aedcoord(register int x, register int y); |
91 |
|
|
92 |
|
|
93 |
+ |
int |
94 |
|
main(argc, argv) |
95 |
|
int argc; |
96 |
|
char **argv; |
97 |
|
{ |
98 |
< |
FILE *fp, *popen(); |
98 |
> |
FILE *fp; |
99 |
|
char comargs[200], shcom[300]; |
100 |
|
short condonly = FALSE, conditioned = FALSE; |
101 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
+ |
static void |
159 |
+ |
plot( /* plot meta-file */ |
160 |
+ |
FILE *infp |
161 |
+ |
) |
162 |
|
|
143 |
– |
plot(infp) /* plot meta-file */ |
144 |
– |
|
145 |
– |
FILE *infp; |
146 |
– |
|
163 |
|
{ |
164 |
|
|
165 |
|
do { |
179 |
|
|
180 |
|
|
181 |
|
|
182 |
+ |
static void |
183 |
+ |
doglobal( /* execute a global command */ |
184 |
+ |
PRIMITIVE *g |
185 |
+ |
) |
186 |
|
|
167 |
– |
doglobal(g) /* execute a global command */ |
168 |
– |
|
169 |
– |
PRIMITIVE *g; |
170 |
– |
|
187 |
|
{ |
188 |
|
int tty; |
189 |
|
char c; |
230 |
|
|
231 |
|
|
232 |
|
|
233 |
+ |
static void |
234 |
+ |
doprim( /* plot primitive */ |
235 |
+ |
register PRIMITIVE *p |
236 |
+ |
) |
237 |
|
|
218 |
– |
doprim(p) /* plot primitive */ |
219 |
– |
|
220 |
– |
register PRIMITIVE *p; |
221 |
– |
|
238 |
|
{ |
239 |
|
|
240 |
|
if (newpage) { /* clear screen */ |
269 |
|
|
270 |
|
|
271 |
|
|
272 |
+ |
static void |
273 |
+ |
printstr( /* output a string */ |
274 |
+ |
register PRIMITIVE *p |
275 |
+ |
) |
276 |
|
|
257 |
– |
printstr(p) /* output a string */ |
258 |
– |
|
259 |
– |
register PRIMITIVE *p; |
260 |
– |
|
277 |
|
{ |
278 |
|
static int hsp[4] = {6, 5, 4, 3}; |
279 |
|
char font, size; |
313 |
|
|
314 |
|
|
315 |
|
|
316 |
+ |
static void |
317 |
+ |
plotlseg( /* plot a line segment */ |
318 |
+ |
register PRIMITIVE *p |
319 |
+ |
) |
320 |
|
|
301 |
– |
plotlseg(p) /* plot a line segment */ |
302 |
– |
|
303 |
– |
register PRIMITIVE *p; |
304 |
– |
|
321 |
|
{ |
322 |
|
static short right = FALSE; |
323 |
|
int y1, y2; |
344 |
|
draw(p->xy[XMX], y2); |
345 |
|
else if (p->xy[XMX] == curx && y2 == cury) |
346 |
|
draw(p->xy[XMN], y1); |
347 |
< |
else if (right = !right) { |
347 |
> |
else if ((right = !right)) { |
348 |
|
move(p->xy[XMN], y1); |
349 |
|
draw(p->xy[XMX], y2); |
350 |
|
} else { |
354 |
|
} |
355 |
|
|
356 |
|
|
357 |
< |
fillrect(p) |
357 |
> |
static void |
358 |
> |
fillrect( |
359 |
> |
register PRIMITIVE *p |
360 |
> |
) |
361 |
|
|
343 |
– |
register PRIMITIVE *p; |
344 |
– |
|
362 |
|
{ |
363 |
|
|
364 |
|
setcolor(p->arg0 & 03); |
370 |
|
|
371 |
|
} |
372 |
|
|
373 |
< |
init() /* initialize terminal */ |
373 |
> |
static void |
374 |
> |
init(void) /* initialize terminal */ |
375 |
|
{ |
376 |
|
/* Reset AED and tell it the data format */ |
377 |
|
command(RST); |
383 |
|
} |
384 |
|
|
385 |
|
|
386 |
< |
setcolor(cn) /* set color */ |
387 |
< |
int cn; |
386 |
> |
static void |
387 |
> |
setcolor( /* set color */ |
388 |
> |
int cn |
389 |
> |
) |
390 |
|
{ |
391 |
|
if (cn != curcol) { |
392 |
|
command(SEC); |
396 |
|
} |
397 |
|
|
398 |
|
|
399 |
< |
move(x, y) /* move to coordinate (x,y) */ |
400 |
< |
int x, y; |
399 |
> |
static void |
400 |
> |
move( /* move to coordinate (x,y) */ |
401 |
> |
int x, |
402 |
> |
int y |
403 |
> |
) |
404 |
|
{ |
405 |
|
command(MOV); |
406 |
|
aedcoord(xconv(x), yconv(y)); |
409 |
|
} |
410 |
|
|
411 |
|
|
412 |
< |
draw(x, y) /* draw vector from CAP to (x,y) */ |
413 |
< |
int x, y; |
412 |
> |
static void |
413 |
> |
draw( /* draw vector from CAP to (x,y) */ |
414 |
> |
int x, |
415 |
> |
int y |
416 |
> |
) |
417 |
|
{ |
418 |
|
command(DVA); |
419 |
|
aedcoord(xconv(x), yconv(y)); |
426 |
|
* aedcoord - puts out an (x, y) coordinate in AED 8 bit format. |
427 |
|
*/ |
428 |
|
|
429 |
< |
aedcoord(x, y) |
430 |
< |
register int x, y; |
429 |
> |
static void |
430 |
> |
aedcoord( |
431 |
> |
register int x, |
432 |
> |
register int y |
433 |
> |
) |
434 |
|
{ |
435 |
|
putc(((x >> 4) & 0x30) | ((y >> 8) & 0x3), stdout); |
436 |
|
putc(x & 0xff, stdout); |
438 |
|
} |
439 |
|
|
440 |
|
|
441 |
< |
longwait(t) /* longer wait */ |
442 |
< |
int t; |
441 |
> |
static void |
442 |
> |
longwait( /* longer wait */ |
443 |
> |
int t |
444 |
> |
) |
445 |
|
{ |
446 |
|
fflush(stdout); |
447 |
|
sleep(t); |
448 |
|
} |
449 |
|
|
450 |
|
|
451 |
< |
shortwait(t) /* shorter wait */ |
452 |
< |
int t; |
451 |
> |
static void |
452 |
> |
shortwait( /* shorter wait */ |
453 |
> |
int t |
454 |
> |
) |
455 |
|
{ |
456 |
|
register long l = t*1000; |
457 |
|
|