7 char devname
[20] = "utf";
17 * Interpret device control commands, ignoring any we don't recognize. The
18 * "x X ..." commands are a device dependent collection generated by troff's
22 void devcntl(struct ustr
*ustr
)
24 char cmd
[50], buf
[256], str
[MAXTOKENSIZE
];
26 ustr_str(ustr
, cmd
, 50);
28 fprintf(ferr
, "devcntl(cmd=%s)\n", cmd
);
30 case 'f': /* mount font in a position */
32 ustr_str(ustr
, str
, 100);
36 case 'i': /* initialize */
43 case 'r': /* resolution assumed when prepared */
44 ustr_int(ustr
, &resolution
);
45 ustr_int(ustr
, &minx
);
46 ustr_int(ustr
, &miny
);
50 case 't': /* trailer */
54 case 'H': /* char height */
64 case 'T': /* device name */
65 ustr_str(ustr
, devname
, 16);
67 fprintf(ferr
, "devname=%s\n", devname
);
71 case 'E': /* input encoding - not in troff yet */
72 ustr_str(ustr
, str
, 100);
75 case 'X': /* copy through - from troff */
76 if (ustr_str(ustr
, str
, MAXTOKENSIZE
- 1) <= 0)
77 error(FATAL
, "incomplete devcntl line\n");
78 if (ustr_line(ustr
, buf
, sizeof(buf
)) < 0)
79 error(FATAL
, "incomplete devcntl line\n");
82 if (str
[0] == 'P' && str
[1] == 'I' ||
83 strncmp(str
, "PictureInclusion", strlen("PictureInclusion")) == 0) {
85 } else if (strncmp(str
, "InlinePicture", strlen("InlinePicture")) == 0) {
86 error(FATAL
, "InlinePicture not implemented yet.\n");
87 /* inlinepic(inp, buf); */
88 } else if (strncmp(str
, "BeginPath", strlen("BeginPath")) == 0) {
89 beginpath(buf
, FALSE
);
90 } else if (strncmp(str
, "DrawPath", strlen("DrawPath")) == 0) {
92 } else if (strncmp(str
, "BeginObject", strlen("BeginObject")) == 0) {
94 } else if (strncmp(str
, "EndObject", strlen("EndObject")) == 0) {
96 } else if (strncmp(str
, "NewBaseline", strlen("NewBaseline")) == 0) {
97 error(FATAL
, "NewBaseline not implemented yet.\n");
98 /* newbaseline(buf); */
99 } else if (strncmp(str
, "DrawText", strlen("DrawText") - 1) == 0) {
100 error(FATAL
, "DrawText not implemented yet.\n");
102 } else if (strncmp(str
, "SetText", strlen("SetText")) == 0) {
103 error(FATAL
, "SetText not implemented yet.\n");
105 } else if (strncmp(str
, "SetColor", strlen("SetColor")) == 0) {
106 error(FATAL
, "SetColor not implemented yet.\n");
109 } else if (strncmp(str
, "INFO", strlen("INFO")) == 0) {
110 error(FATAL
, "INFO not implemented yet.\n");
111 } else if (strncmp(str
, "PS", strlen("PS")) == 0 ||
112 strncmp(str
, "PostScript", strlen("PostScript")) == 0) {
115 fprintf(fout
, "%s\n", buf
);
117 } else if (strncmp(str
, "ExportPS", strlen("ExportPS")) == 0) { /* dangerous!! */
118 error(FATAL
, "ExportPS not implemented yet.\n");