2 * neatpost troff postscript postprocessor
4 * Copyright (C) 2013 Ali Gholami Rudi <ali at rudi dot ir>
6 * This program is released under the Modified BSD license.
20 static void back(int c
)
25 static int utf8len(int c
)
42 static int nextutf8(char *s
)
50 for (i
= 1; i
< l
; i
++)
57 static void nextskip(void)
66 static int nextnum(void)
80 if (c
< 0 || !isdigit(c
))
87 static int iseol(void)
97 /* skip until the end of line */
98 static void nexteol(void)
103 } while (c
>= 0 && c
!= '\n');
106 static void nextword(char *s
)
111 while (c
>= 0 && !isspace(c
)) {
121 static void readln(char *s
)
125 while (c
> 0 && c
!= '\n') {
134 static void postspline(int h1
, int v1
)
140 draws(h1
, v1
, h2
, v2
);
147 static void postdraw(void)
171 drawa(h1
, v1
, h2
, v2
);
186 static void postps(void)
192 if (!strcmp("PS", cmd
) || !strcmp("ps", cmd
))
194 if (!strcmp("BeginObject", cmd
))
196 if (!strcmp("EndObject", cmd
))
200 static char devpath
[PATHLEN
] = "devutf";
202 static void postx(void)
212 dev_mnt(pos
, dev
, dev
);
220 sprintf(devpath
, "%s/font/dev%s", TROFFROOT
, dev
);
231 static void postcmd(int c
)
235 outrel((c
- '0') * 10 + next() - '0', 0);
254 outrel(nextnum(), 0);
257 outrel(0, nextnum());
265 outcolor(clr_get(cs
));
297 fprintf(stderr
, "unknown command: %c\n", c
);
301 static void post(void)
304 while ((c
= next()) >= 0)
315 ps_trailer(o_pg
, o_fonts
);