blob: 89e20a6aa9f94e8539096fc59e245b51697a5e91 (
plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#include "defn.h"
#define USAGE "Usage: dxy2ps [-amr] [-l line sizes] [-s scale] [-x offset] [-y offset] [file]\n"
main(argc, argv)
int argc;
char *argv[];
{
extern int optind;
extern char *optarg;
char op;
int MANUAL_FEED = 0; /* DEFAULT: No manual feed */
PaperSize = "A3";
Mode = "DXY";
plotcoords(); /* Set up plotter coordinates */
plotinit(); /* Get other initialisations */
while ((ch = getopt(argc, argv, "al:ms:x:y:r")) != EOF)
{
switch (ch)
{
case 'a': /* DXY ISO A4 297mm * 210mm */
PaperSize = "A4";
plotcoords();
break;
case 'l':
changesizes(optarg);
break;
case 'm':
MANUAL_FEED = 1;
break;
case 'r':
LANDSCAPE = 0;
break;
case 's':
SCALE = atof(optarg);
if (SCALE < 0.1)
SCALE = 0.1;
else
if (SCALE > 3)
SCALE = 3;
break;
case 'x':
xoffset = atof(optarg);
break;
case 'y':
yoffset = atof(optarg);
break;
default:
fprintf(stderr, "%s\n", USAGE);
exit(1);
}
}
if (optind == argc)
stream = stdin;
else if ((stream = fopen(argv[optind], "r")) == NULL)
{
fprintf(stderr, "ERROR: cannot open \"%s\"\n", argv[optind]);
exit(1);
}
ps_macros(); /* Output PostScript Macros */
viewport(); /* Scale the viewport for the plot */
printf("/%s %g Font\n", font, char_height);
if (MANUAL_FEED)
manualfeed(1);
while ((op = getc(stream)) != EOF)
if ((isalpha(op) > 0) || op == '^')
dxycom(op);
end_draw();
printf("showpage\n");
if (MANUAL_FEED)
manualfeed(0);
}
|