home *** CD-ROM | disk | FTP | other *** search
- /*
- * plot(3) clone. Implements the commands described in the the V7 UNIX
- * manual pages and produces a standard UNIX plotfile.
- *
- * The resulting plotfile is to be used with the plot(1) command.
- *
- * Author: Wietse Venema (wietse@wzv.UUCP)
- */
-
- #include <stdio.h>
-
- /* some shorthands... */
-
- #define Write(x) fwrite((char *) &x, sizeof(x), 1, stdout)
- #define Write2(a,b) Write(a); Write(b)
- #define Write3(a,b,c) Write2(a,b); Write(c)
- #define Write4(a,b,c,d) Write2(a,b); Write2(c,d)
- #define Write6(a,b,c,d,e,f) Write4(a,b,c,d); Write2(e,f)
-
- openpl()
- {
- #ifndef unix
- you may have to select binary mode for stdout
- #endif
- }
-
- move(x, y)
- {
- putchar('m');
- Write2(x, y);
- }
-
- cont(x, y)
- {
- putchar('n');
- Write2(x, y);
- }
-
- point(x, y)
- {
- putchar('p');
- Write2(x, y);
- }
-
- line(x1, y1, x2, y2)
- {
- putchar('l');
- Write4(x1, y1, x2, y2);
- }
-
- label(s)
- char *s;
- {
- putchar('t');
- fputs(s,stdout);
- putchar('\0');
- }
-
- arc(x, y, x0, y0, x1, y1)
- {
- putchar('a');
- Write6(x, y, x0, y0, x1, y1);
- }
-
- circle(x, y, r)
- {
- putchar('c');
- Write3(x, y, r);
- }
-
- erase()
- {
- putchar('e');
- }
-
- linemod(s)
- char *s;
- {
- putchar('f');
- puts(s);
- }
-
- space(x0, y0, x1, y1)
- {
- putchar('s');
- Write4(x0, y0, x1, y1);
- }
-
- closepl()
- {
- fflush(stdout);
- }
-