7 |
|
* 9/23/88 |
8 |
|
*/ |
9 |
|
|
10 |
– |
#include "meta.h" |
11 |
– |
|
10 |
|
#include <ctype.h> |
11 |
|
|
12 |
+ |
#include "meta.h" |
13 |
+ |
#include "plot.h" |
14 |
+ |
#include "psplot.h" |
15 |
+ |
|
16 |
|
#ifdef SMALLAREA |
17 |
|
#define HMARGIN (0.2*72) /* horizontal margin */ |
18 |
|
#define VMARGIN (0.2*72) /* vertical margin */ |
43 |
|
|
44 |
|
static char buf[512]; |
45 |
|
|
46 |
+ |
static void endline(void); |
47 |
|
|
48 |
+ |
|
49 |
|
static char * |
50 |
|
convertname(s) /* convert to segment name */ |
51 |
|
char *s; |
69 |
|
|
70 |
|
|
71 |
|
static char * |
72 |
< |
convertstring(s) /* convert to acceptable string */ |
73 |
< |
register char *s; |
72 |
> |
convertstring( /* convert to acceptable string */ |
73 |
> |
register char *s |
74 |
> |
) |
75 |
|
{ |
76 |
|
register char *cp; |
77 |
|
|
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
< |
init(id) /* initialize */ |
96 |
< |
char *id; |
95 |
> |
void |
96 |
> |
init( /* initialize */ |
97 |
> |
char *id |
98 |
> |
) |
99 |
|
{ |
100 |
|
printf("%%!PS-Adobe-2.0 EPSF-2.0\n"); |
101 |
|
printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n", |
226 |
|
} |
227 |
|
|
228 |
|
|
229 |
< |
done() /* done with graphics */ |
229 |
> |
void |
230 |
> |
done(void) /* done with graphics */ |
231 |
|
{ |
232 |
|
printf("end\nrestore\ngrestore\n"); |
233 |
|
} |
234 |
|
|
235 |
|
|
236 |
< |
endpage() /* done with page */ |
236 |
> |
void |
237 |
> |
endpage(void) /* done with page */ |
238 |
|
{ |
239 |
|
checkline(); |
240 |
|
|
242 |
|
} |
243 |
|
|
244 |
|
|
245 |
< |
segopen(s) /* open a segment */ |
246 |
< |
char *s; |
245 |
> |
void |
246 |
> |
segopen( /* open a segment */ |
247 |
> |
char *s |
248 |
> |
) |
249 |
|
{ |
250 |
|
checkline(); |
251 |
|
|
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
< |
segclose() /* close a segment */ |
256 |
> |
void |
257 |
> |
segclose(void) /* close a segment */ |
258 |
|
{ |
259 |
|
checkline(); |
260 |
|
|
262 |
|
} |
263 |
|
|
264 |
|
|
265 |
< |
doseg(p) /* instance of a segment */ |
266 |
< |
register PRIMITIVE *p; |
265 |
> |
void |
266 |
> |
doseg( /* instance of a segment */ |
267 |
> |
register PRIMITIVE *p |
268 |
> |
) |
269 |
|
{ |
270 |
|
checkline(); |
271 |
|
|
277 |
|
} |
278 |
|
|
279 |
|
|
280 |
< |
printstr(p) /* print a string */ |
281 |
< |
register PRIMITIVE *p; |
280 |
> |
extern void |
281 |
> |
printstr( /* print a string */ |
282 |
> |
register PRIMITIVE *p |
283 |
> |
) |
284 |
|
{ |
285 |
|
checkline(); |
286 |
|
printf("(%s) %d %d %d %d mstr\n", convertstring(p->args), |
289 |
|
} |
290 |
|
|
291 |
|
|
292 |
< |
plotvstr(p) /* print a vector string */ |
293 |
< |
register PRIMITIVE *p; |
292 |
> |
void |
293 |
> |
plotvstr( /* print a vector string */ |
294 |
> |
register PRIMITIVE *p |
295 |
> |
) |
296 |
|
{ |
297 |
|
checkline(); |
298 |
|
|
303 |
|
} |
304 |
|
|
305 |
|
|
306 |
< |
plotlseg(p) /* plot a line segment */ |
307 |
< |
register PRIMITIVE *p; |
306 |
> |
void |
307 |
> |
plotlseg( /* plot a line segment */ |
308 |
> |
register PRIMITIVE *p |
309 |
> |
) |
310 |
|
{ |
311 |
|
static int right = FALSE; |
312 |
|
static int curx, cury; |
350 |
|
} |
351 |
|
|
352 |
|
|
353 |
< |
endline() /* close current line */ |
353 |
> |
void |
354 |
> |
endline(void) /* close current line */ |
355 |
|
{ |
356 |
|
printf("stroke\n"); |
357 |
|
inaline = 0; |
358 |
|
} |
359 |
|
|
360 |
|
|
361 |
< |
fillrect(p) /* fill a rectangle */ |
362 |
< |
register PRIMITIVE *p; |
361 |
> |
extern void |
362 |
> |
fillrect( /* fill a rectangle */ |
363 |
> |
register PRIMITIVE *p |
364 |
> |
) |
365 |
|
{ |
366 |
|
checkline(); |
367 |
|
|
370 |
|
} |
371 |
|
|
372 |
|
|
373 |
< |
filltri(p) /* fill a triangle */ |
374 |
< |
register PRIMITIVE *p; |
373 |
> |
extern void |
374 |
> |
filltri( /* fill a triangle */ |
375 |
> |
register PRIMITIVE *p |
376 |
> |
) |
377 |
|
{ |
378 |
< |
static short corn[4][2] = {XMN,YMX,XMN,YMN,XMX,YMN,XMX,YMX}; |
378 |
> |
static short corn[4][2] = {{XMN,YMX},{XMN,YMN},{XMX,YMN},{XMX,YMX}}; |
379 |
|
int orient; |
380 |
|
register int i; |
381 |
|
|
391 |
|
} |
392 |
|
|
393 |
|
|
394 |
< |
xform(xp, yp, p) /* transform a point according to p */ |
395 |
< |
register int *xp, *yp; |
396 |
< |
register PRIMITIVE *p; |
394 |
> |
void |
395 |
> |
xform( /* transform a point according to p */ |
396 |
> |
register int *xp, |
397 |
> |
register int *yp, |
398 |
> |
register PRIMITIVE *p |
399 |
> |
) |
400 |
|
{ |
401 |
< |
int x, y; |
401 |
> |
int x = 0, y = 0; |
402 |
|
|
403 |
|
switch (p->arg0 & 060) { |
404 |
|
case 0: /* right */ |
423 |
|
} |
424 |
|
|
425 |
|
|
426 |
+ |
extern void |
427 |
|
fillpoly(p) /* fill a polygon */ |
428 |
|
register PRIMITIVE *p; |
429 |
|
{ |
401 |
– |
extern char *nextscan(); |
430 |
|
register char *s; |
431 |
|
int curx, cury; |
432 |
|
|
435 |
|
printf("%s %d %d mark\n", p->arg0 & 0100 ? "false" : "true", |
436 |
|
p->arg0>>2 & 03, p->arg0 & 03); |
437 |
|
s = p->args; |
438 |
< |
while ((s = nextscan(nextscan(s, "%d", &curx), "%d", &cury)) != NULL) { |
438 |
> |
while ((s = nextscan(nextscan(s, "%d", (char*)&curx), "%d", (char*)&cury)) != NULL) { |
439 |
|
xform(&curx, &cury, p); |
440 |
|
printf("%d %d ", curx, cury); |
441 |
|
} |
443 |
|
} |
444 |
|
|
445 |
|
|
446 |
< |
set(attrib, val) /* set an attribute or context */ |
447 |
< |
int attrib; |
448 |
< |
char *val; |
446 |
> |
void |
447 |
> |
set( /* set an attribute or context */ |
448 |
> |
int attrib, |
449 |
> |
char *val |
450 |
> |
) |
451 |
|
{ |
452 |
|
checkline(); |
453 |
|
|
468 |
|
} |
469 |
|
|
470 |
|
|
471 |
< |
unset(attrib) /* unset an attribute or context */ |
472 |
< |
int attrib; |
471 |
> |
void |
472 |
> |
unset( /* unset an attribute or context */ |
473 |
> |
int attrib |
474 |
> |
) |
475 |
|
{ |
476 |
|
checkline(); |
477 |
|
|
494 |
|
} |
495 |
|
|
496 |
|
|
497 |
< |
reset(attrib) /* reset an attribute or context */ |
498 |
< |
int attrib; |
497 |
> |
void |
498 |
> |
reset( /* reset an attribute or context */ |
499 |
> |
int attrib |
500 |
> |
) |
501 |
|
{ |
502 |
|
checkline(); |
503 |
|
|