Super Plot (1 of 8)

Marc Majka majka at ubc-vision.UUCP
Mon Apr 28 08:46:50 AEST 1986


Here is a set of plot routines and associated stuff for a sort-of-extension
to the plot(5) format.  In this and the following postings, you will find a
shell archive containing:

* a library of C subroutines for writing plot files
* plot-file to text and text to plot-file filters
* a simple frame-buffer rendering program
* a plot-file to PostScript filter
* hooks into the recently distributed Hershey fonts for label drawing

You know the litany: cut on the dotted line and feed to "sh" not "csh".
Happy plotting!

---
Marc Majka  -  UBC Laboratory for computational Vision

- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 1 of 8
echo  
echo extracting file README
sed 's/^X//' > README <<'!FUNKY!STUFF!'
XHere is a package of plot routines which are based on a plot format similar
Xto the UNIX plot(5) format, but with many extensions.   
X
XAbsolutely none of the code in here is based on or copied from any code in
Xany version of UNIX in the entire world.  There is a program (pl5pl) which
Xconverts files from UNIX plot(5) format to my format.  I have used some of
Xthe same plot primitives, for example "c" for circle.  The vector generator
Xand the bspline generator are both based on algorithms published in Newman,
XW.M. and Sproull, R.F., "Principles of Interactive Computer Graphics",
XMcGraw-Hill, 1979.  They are credited here and in the code.
X
XIncluded in this package are:
X
Xfplot      Subroutine library for writing plot files from C
Xpl5pl      Convert UNIX Plot(5) to my plot format
Xrplot      Render a plot file in a raster
Xpltx       Print a readable (text) version of a plot file
Xtxpl       Inverse of pltx: Convert text form to plot file
Xplps       Convert plot files to PostScript
Xechofont   Convert a font file to text form
Xmkfont     Inverse of echofont: Convert text to font file
Xhform      Utility for Hershey fonts
Xhcat       Plot a Hershey font cataplogue
Xhfont      Create a plot-file compatible font from the Hershey fonts
X
XThe subdirectory vfont contains the file sr.e, which must be filtered
Xthrough mkfont to create the file vfont/sr.  This is a basic roman font for
Xplotting labels.  If you have the public domain Hershey fonts, you can use
Xhfont to create other label fonts.  The files mk.* in vfont are inputs to
Xhfont to create a number of useful fonts.
X
XFinally, there is a subdirectory containing some test data.  These files are
Xall stored in text format, and must be converted to plot format with txpl
Xto be useful to the plot filters.
X
XHave fun, and let me know it you have any problems.  I claim nothing for
Xthis package except that is works and is widely used here at UBC.  There are
Xprobably lots of bugs and misfeatures in some places.  I will try to answer
Xany questions e-mailed  to me (majka at ubc-vision.UUCP), and will endevour to
Xprovide bug fixes for serious flaws.  If you come up with any great ideas or
Xclever hacks, I would enjoy hearing about them.
X
XIt should be easy to write or convert existing plot filters to this format.
XLook at the code in rplfns.c and plpsfns.c for examples, inspiration and
Xcode to copy.  You will find that it is impossible to support every plot
Xprimitive on every device, but most things will go through.  I have my own
Xsource for filters for ImPress, an out-of-date NAPLPS, and a Raster
XTechnologies 1/25.  If you want any of them, let me know.
!FUNKY!STUFF!
echo extracting file Makefile
sed 's/^X//' > Makefile <<'!FUNKY!STUFF!'
X# makefile for plot routines
X
XOBJ = fplot.o driver.o labels.o rplfns.o txfns.o plpsfns.o
X
Xall: ${OBJ} pl5pl pltx rplot txpl plps echofont mkfont hform hfont hcat
X
Xpl5pl: pl5pl.c
X	cc -o pl5pl pl5pl.c
X
Xpltx: pltx.c txfns.o driver.o
X	cc -o pltx pltx.c txfns.o driver.o
X
Xtxpl: txpl.c
X	cc -o txpl txpl.c
X
Xrplot: rplot.c rplfns.o driver.o labels.o
X	cc -o rplot rplot.c rplfns.o driver.o labels.o -lm
X
Xplps: plps.c plpsfns.o driver.o labels.o
X	cc -o plps plps.c plpsfns.o driver.o labels.o -lm
X
Xechofont: echofont.c
X	cc -o echofont echofont.c
X
Xmkfont: mkfont.c
X	cc -o mkfont mkfont.c
X
Xhform: hform.c
X	cc -o hform hform.c
X
Xhfont: hfont.c
X	cc -o hfont hfont.c
X
Xhcat: hcat.c
X	cc -o hcat hcat.c fplot.o
X
Xclean:
X	rm *.o
!FUNKY!STUFF!
echo extracting file cribsheet
sed 's/^X//' > cribsheet <<'!FUNKY!STUFF!'
XPLOT FILE FORMAT 
X----------------
X
Xa arc     xc yc x1 y1 x2 y2
Xb bppout  b
Xc circle  x y r
Xd pensize p
Xe erase
Xf linemod str
Xg gray    g
X
Xh-i-j unused
X
Xk spline  k n x1 y1 x2 y2 ... xn yn
Xl line    x1 y1 x2 y2
Xm move    x y
Xn cont    x y
Xo polygon n x1 y1 x2 y2 ... xn yn
Xp point   x y
X
Xq-r unused
X
Xs space   x1 y1 x2 y2 hv
Xt label   str
X
Xu-v-w-x-y-z unused
X
XA area    x y
XB bppin   b
XC colour  r g b
X
XD-E unused
X
XF frame   r1 c1 r2 c2 hv
X
XG-H-I-J-K unused
X
XL chain   n x1 y1 x2 y2 ... xn yn
XM moverel x y
XN contrel x y
XO unused
XP fillpat pn nrows ncols str      
X
XQ-R unused
X
XS fspec   ws hs theta
XT setpat  pn
XU blabel  w h str
XV llabel  w h str
XW unused
XX font    str
X
XY-Z unused
X
X[ startp
X] endp
X; comment str
X% clabel  str
X
X
XPLOT PROGRAMS
X-------------
X
Xpl5pl      UNIX Plot(5) -> Plot
Xplps       Plot -> PostScript
Xpltx       Plot -> Text
Xrplot      Plot -> Raster
Xtxpl       Text -> Plot
X
X
XRELATED SOFTWARE
X------------- --
X
Xdriver     Plot file interpreter
Xechofont   Convert a font file to text form
Xfplot      Subroutine Library for writing plot files
Xhfont      Create a new label font from the Hershey fonts
Xhcat       Make a plotfile Hershey font catalogue
Xhform      Reformat Hershey fonts
Xlabels     Common subroutines for drawing labels
Xmkfont     Inverse of echofont: convert text file to font file format
Xplpsfns    Subroutine Library for PostScript conversion
Xrplfns     Subroutine Library for raster graphics
Xtxfns      Subroutines for pltx
!FUNKY!STUFF!
echo extracting file driver.c
sed 's/^X//' > driver.c <<'!FUNKY!STUFF!'
X/*************************************************************/
X/*                                                           */
X/*  Copyright (c) 1986                                       */
X/*  Marc S. Majka - UBC Laboratory for Computational Vision  */
X/*                                                           */
X/*  Permission is hereby granted to copy all or any part of  */
X/*  this program for free distribution.   The author's name  */
X/*  and this copyright notice must be included in any copy.  */
X/*                                                           */
X/*************************************************************/
X
X#include <stdio.h>
X
X/* read a plot-format file and call the appropriate plotting routines */
Xplotdriver(plt)
XFILE *plt;
X{
X    char str[1024], comm, c;
X    int i;
X    short ltop, lstack[1024][2];
X    double ws, hs, theta;
X    short x1, y1, x2, y2, x3, y3, r, gr, red, green, blue, hv, pn, b, n, k;
X
X    while (fscanf(plt, "%c", &comm) != EOF) {
X        switch (comm) {
X            case 'a': /* ARC */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fread(&x2,2,1,plt);
X                fread(&y2,2,1,plt);
X                fread(&x3,2,1,plt);
X                fread(&y3,2,1,plt);
X                arc(x1,y1,x2,y2,x3,y3);
X                break;
X            case 'b': /* BPPOUT */
X                fread(&b,2,1,plt);
X                bppout(b);
X                break;
X            case 'c': /* CIRCLE */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fread(&r,2,1,plt);
X                circle(x1,y1,r);
X                break;
X            case 'd': /* PENSIZE */
X                fread(&pn,2,1,plt);
X                pensize(pn);
X                break;
X            case 'e': /* ERASE */
X                erase();
X                break;
X            case 'f': /* LINEMOD */
X                fscanf(plt,"%s",str);
X                fscanf(plt,"%c",&c);
X                linemod(str);
X                break;
X            case 'g': /* GRAY */
X                fread(&gr,2,1,plt);
X                gray(gr);
X                break;
X            case 'l': /* LINE */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fread(&x2,2,1,plt);
X                fread(&y2,2,1,plt);
X                line(x1,y1,x2,y2);
X                break;
X            case 'm': /* MOVE */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                move(x1,y1);
X                break;
X            case 'n': /* CONT */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                cont(x1,y1);
X                break;
X            case 'k': /* BSPLINE */
X                fread(&k,2,1,plt);
X                fread(&n,2,1,plt);
X                for (i = 0; i < n; i++) {
X                    fread(&x1,2,1,plt);
X                    fread(&y1,2,1,plt);
X                    lstack[i][0] = x1; 
X                    lstack[i][1] = y1;
X                }
X                bspline(k,n,lstack);
X                break;
X            case 'o': /* POLYGON */
X                fread(&n,2,1,plt);
X                for (i = 0; i < n; i++) {
X                    fread(&x1,2,1,plt);
X                    fread(&y1,2,1,plt);
X                    lstack[i][0] = x1; 
X                    lstack[i][1] = y1;
X                }
X                polygon(n,lstack);
X                break;
X            case 'L': /* CHAIN */
X                fread(&n,2,1,plt);
X                for (i = 0; i < n; i++) {
X                    fread(&x1,2,1,plt);
X                    fread(&y1,2,1,plt);
X                    lstack[i][0] = x1; 
X                    lstack[i][1] = y1;
X                }
X                chain(n,lstack);
X                break;
X            case 'p': /* POINT */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                point(x1,y1);
X                break;
X            case 's': /* SPACE */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fread(&x2,2,1,plt);
X                fread(&y2,2,1,plt);
X                fread(&hv,2,1,plt);
X                space(x1,y1,x2,y2,hv);
X                break;
X            case 't': /* LABEL */
X                fscanf(plt,"%1s",&c);
X                i = 0;
X                while (c != '\n') {
X                    str[i++] = c;
X                    fscanf(plt,"%c",&c);
X                }
X                str[i] = '\0';
X                label(str);
X                break;
X            case '%': /* CLABEL */
X                fscanf(plt,"%1s",&c);
X                i = 0;
X                while (c != '\n') {
X                    str[i++] = c;
X                    fscanf(plt,"%c",&c);
X                }
X                str[i] = '\0';
X                clabel(str);
X                break;
X            case 'U': /* BLABEL */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fscanf(plt,"%1s",&c);
X                i = 0;
X                while (c != '\n') {
X                    str[i++] = c;
X                    fscanf(plt,"%c",&c);
X                }
X                str[i] = '\0';
X                blabel(x1,y1,str);
X                break;
X            case 'V': /* LLABEL */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fscanf(plt,"%1s",&c);
X                i = 0;
X                while (c != '\n') {
X                    str[i++] = c;
X                    fscanf(plt,"%c",&c);
X                }
X                str[i] = '\0';
X                llabel(x1,y1,str);
X                break;
X            case 'A': /* AREA */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                area(x1,y1);
X                break;
X            case 'B': /* BPPIN */
X                fread(&b,2,1,plt);
X                bppin(b);
X                break;
X            case 'C': /* COLOUR */
X                fread(&red,2,1,plt);
X                fread(&green,2,1,plt);
X                fread(&blue,2,1,plt);
X                colour(red,green,blue);
X                break;
X            case 'F': /* FRAME */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fread(&x2,2,1,plt);
X                fread(&y2,2,1,plt);
X                fread(&hv,2,1,plt);
X                frame(x1,y1,x2,y2,hv);
X                break;
X            case 'M': /* MOVEREL */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                moverel(x1,y1);
X                break;
X            case 'N': /* CONTREL */
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                contrel(x1,y1);
X                break;
X            case 'P': /* FILLPAT */
X                fread(&pn,2,1,plt);
X                fread(&x1,2,1,plt);
X                fread(&y1,2,1,plt);
X                fscanf(plt,"%1s",&c);
X                i = 0;
X                while (c != '\n') {
X                    str[i++] = c;
X                    fscanf(plt,"%c",&c);
X                }
X                str[i] = '\0';
X                fillpat(pn,x1,y1,str);
X                break;
X            case 'S': /* FSPEC */
X                fread(&ws,4,1,plt);
X                fread(&hs,4,1,plt);
X                fread(&theta,4,1,plt);
X                fspec(ws,hs,theta);
X                break;
X            case 'T': /* SETPAT */
X                fread(&pn,2,1,plt);
X                setpat(pn);
X                break;
X            case 'X': /* FONT */
X                fscanf(plt,"%1s",&c);
X                i = 0;
X                while (c != '\n') {
X                    str[i++] = c;
X                    fscanf(plt,"%c",&c);
X                }
X                str[i] = '\0';
X                font(str);
X                break;
X            case '[': /* STARTP */
X                startp();
X                break;
X            case ']': /* ENDP */
X                endp();
X                break;
X            case ';': /* COMMENT */
X                fscanf(plt,"%1s",&c);
X                i = 0;
X                while (c != '\n') {
X                    str[i++] = c;
X                    fscanf(plt,"%c",&c);
X                }
X                str[i] = '\0';
X                comment(str);
X                break;
X            default:
X                fprintf (stderr, "plot: unknown command %c\n", comm);
X                break;
X        }
X    }
X}
!FUNKY!STUFF!
echo extracting file echofont.c
sed 's/^X//' > echofont.c <<'!FUNKY!STUFF!'
X/*************************************************************/
X/*                                                           */
X/*  Copyright (c) 1986                                       */
X/*  Marc S. Majka - UBC Laboratory for Computational Vision  */
X/*                                                           */
X/*  Permission is hereby granted to copy all or any part of  */
X/*  this program for free distribution.   The author's name  */
X/*  and this copyright notice must be included in any copy.  */
X/*                                                           */
X/*************************************************************/
X
X#include <stdio.h>
X#define MAXF 32768
X
X/* read a font and print it out in plain text */
X/* the format for fonts is described in /usr/public/lib/vfont/FORMAT */
X/* fonts may be converted from text to their normal format by mkfont */
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X    FILE *fin, *fopen();
X    short x, y;
X    int cstart[256], cpt, spt, i;
X    char c, fstr[MAXF], clist[256];
X    
X    cpt = 0; spt = 0;
X    
X    if (argc < 2) fin = stdin;
X    else fin = fopen(argv[1],"r");
X    if (fin == NULL) {
X        fprintf(stderr,"echofont: can't open input font file!\n");
X        exit(1);
X    }
X
X    fread(&c,1,1,fin);
X    
X    while (c != '\0') {
X        fread(&spt,4,1,fin);
X        clist[cpt] = c;
X        cstart[cpt++] = spt;
X        fread(&c,1,1,fin);
X    }
X
X    i = 0;
X    while (fread(&fstr[i++],1,1,fin));
X    
X    for (i = 0; i < cpt; i++) {
X        printf("%c:\n",clist[i]);
X        spt = cstart[i];
X        while (fstr[spt] != '\0')
X            if (fstr[spt] == 'N') {
X                spt++;
X                x = fstr[spt++];
X                y = fstr[spt++];
X                printf("N %hd %hd\n",x,y);
X            }
X            else if (fstr[spt] == 'M') {
X                spt++;
X                x = fstr[spt++];
X                y = fstr[spt++];
X                printf("M %hd %hd\n",x,y);
X            }
X        printf("E\n");
X        }
X}
!FUNKY!STUFF!
echo extracting file fplot.c
sed 's/^X//' > fplot.c <<'!FUNKY!STUFF!'
X/*************************************************************/
X/*                                                           */
X/*  Copyright (c) 1986                                       */
X/*  Marc S. Majka - UBC Laboratory for Computational Vision  */
X/*                                                           */
X/*  Permission is hereby granted to copy all or any part of  */
X/*  this program for free distribution.   The author's name  */
X/*  and this copyright notice must be included in any copy.  */
X/*                                                           */
X/*************************************************************/
X
X#include <stdio.h>
Xstatic FILE *plotfd;
X
Xplotopen(fname)
Xchar *fname;
X{
X    if (fname[0] == '\0') plotfd = stdout;
X    else plotfd = fopen(fname,"w");
X    if (plotfd == NULL) {
X        fprintf(stderr,"plotopen: can't open %s for output\n",fname);
X        return(0);
X    }
X}
X
Xplotappend(fname)
Xchar *fname;
X{
X    if (fname[0] == '\0') plotfd = stdout;
X    else plotfd = fopen(fname,"a");
X    if (plotfd == NULL) {
X        fprintf(stderr,"plotappend: can't open %s for output\n",fname);
X        return(0);
X    }
X}
X
Xarc(xc,yc,x1,y1,x2,y2)
Xshort xc,yc,x1,y1,x2,y2;
X{
X    fwrite("a",1,1,plotfd);
X    fwrite(&xc,2,1,plotfd);
X    fwrite(&yc,2,1,plotfd);
X    fwrite(&x1,2,1,plotfd);
X    fwrite(&y1,2,1,plotfd);
X    fwrite(&x2,2,1,plotfd);
X    fwrite(&y2,2,1,plotfd);
X}
X
Xcircle(x,y,r)
Xshort x,y,r;
X{
X    fwrite("c",1,1,plotfd);
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X    fwrite(&r,2,1,plotfd);
X}
X
Xgray(g)
Xshort g;
X{
X    fwrite("g",1,1,plotfd);
X    fwrite(&g,2,1,plotfd);
X}
X
Xcolour(r,g,b)
Xshort r,g,b;
X{
X    fwrite("C",1,1,plotfd);
X    fwrite(&r,2,1,plotfd);
X    fwrite(&g,2,1,plotfd);
X    fwrite(&b,2,1,plotfd);
X}
X
Xerase()
X{
X    fwrite("e",1,1,plotfd);
X}
X
Xlinemod(mod)
Xchar *mod;
X{
X    fprintf(plotfd,"f%s\n",mod);
X}
X
Xline(x1,y1,x2,y2)
Xshort x1,y1,x2,y2;
X{
X    fwrite("l",1,1,plotfd);
X    fwrite(&x1,2,1,plotfd);
X    fwrite(&y1,2,1,plotfd);
X    fwrite(&x2,2,1,plotfd);
X    fwrite(&y2,2,1,plotfd);
X}
X
Xmove(x,y)
Xshort x,y;
X{
X    fwrite("m",1,1,plotfd);
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xcont(x,y)
Xshort x,y;
X{
X    fwrite("n",1,1,plotfd);
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xbspline(k,n,v)
Xshort k, n, *v;
X{
X    int indx, vert;
X    short x, y;
X
X    indx = 0;
X
X    fwrite("k",1,1,plotfd);
X    fwrite(&k,2,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X    for(vert = 0; vert < n; vert++) {
X        x = v[indx++];
X        y = v[indx++];
X        fwrite(&x,2,1,plotfd);
X        fwrite(&y,2,1,plotfd);
X    }
X}
X
Xbsplinehd(k,n)
Xshort n;
X{
X    fwrite("k",1,1,plotfd);
X    fwrite(&k,2,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X}
X
Xbsplinept(x,y)
Xshort x,y;
X{
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xpolygon(n,v)
Xshort n, *v;
X{
X    int indx, vert;
X    short x, y;
X
X    indx = 0;
X
X    fwrite("o",1,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X    for(vert = 0; vert < n; vert++) {
X        x = v[indx++];
X        y = v[indx++];
X        fwrite(&x,2,1,plotfd);
X        fwrite(&y,2,1,plotfd);
X    }
X}
X
Xpolyhd(n)
Xshort n;
X{
X    fwrite("o",1,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X}
X
Xpolypt(x,y)
Xshort x,y;
X{
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xchain(n,v)
Xshort n, *v;
X{
X    int indx, vert;
X    short x, y;
X
X    indx = 0;
X
X    fwrite("L",1,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X    for(vert = 0; vert < n; vert++) {
X        x = v[indx++];
X        y = v[indx++];
X        fwrite(&x,2,1,plotfd);
X        fwrite(&y,2,1,plotfd);
X    }
X}
X
Xchainhd(n)
Xshort n;
X{
X    fwrite("L",1,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X}
X
Xchainpt(x,y)
Xshort x,y;
X{
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X    
Xpoint(x,y)
Xshort x,y;
X{
X    fwrite("p",1,1,plotfd);
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xspace(x1,y1,x2,y2,hv)
Xshort x1,y1,x2,y2,hv;
X{
X    fwrite("s",1,1,plotfd);
X    fwrite(&x1,2,1,plotfd);
X    fwrite(&y1,2,1,plotfd);
X    fwrite(&x2,2,1,plotfd);
X    fwrite(&y2,2,1,plotfd);
X    fwrite(&hv,2,1,plotfd);
X}
X
Xlabel(str)
Xchar *str;
X{
X    fprintf(plotfd,"t%s\n",str);
X}
X
Xclabel(str)
Xchar *str;
X{
X    fprintf(plotfd,"%%%s\n",str);
X}
X
Xblabel(w,h,str)
Xshort w,h;
Xchar *str;
X{
X    fwrite("U",1,1,plotfd);
X    fwrite(&w,2,1,plotfd);
X    fwrite(&h,2,1,plotfd);
X    fprintf(plotfd,"%s\n",str);
X}
X
Xllabel(w,h,str)
Xshort w,h;
Xchar *str;
X{
X    fwrite("V",1,1,plotfd);
X    fwrite(&w,2,1,plotfd);
X    fwrite(&h,2,1,plotfd);
X    fprintf(plotfd,"%s\n",str);
X}
X
Xcomment(str)
Xchar *str;
X{
X    fprintf(plotfd,";%s\n",str);
X}
X
Xarea(x,y)
Xshort x, y;
X{
X    fwrite("A",1,1,plotfd);
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xbppin(b)
Xshort b;
X{
X    fwrite("B",1,1,plotfd);
X    fwrite(&b,2,1,plotfd);
X}
X
Xbppout(b)
Xshort b;
X{
X    fwrite("b",1,1,plotfd);
X    fwrite(&b,2,1,plotfd);
X}
X
Xframe(r1,c1,r2,c2,hv)
Xshort r1,c1,r2,c2,hv;
X{
X    fwrite("F",1,1,plotfd);
X    fwrite(&r1,2,1,plotfd);
X    fwrite(&c1,2,1,plotfd);
X    fwrite(&r2,2,1,plotfd);
X    fwrite(&c2,2,1,plotfd);
X    fwrite(&hv,2,1,plotfd);
X}
X
Xmoverel(x,y)
Xshort x,y;
X{
X    fwrite("M",1,1,plotfd);
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xcontrel(x,y)
Xshort x,y;
X{
X    fwrite("N",1,1,plotfd);
X    fwrite(&x,2,1,plotfd);
X    fwrite(&y,2,1,plotfd);
X}
X
Xfillpat(n,r,c,str)
Xshort n,r,c;
Xchar *str;
X{
X    fwrite("P",1,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X    fwrite(&r,2,1,plotfd);
X    fwrite(&c,2,1,plotfd);
X    fprintf(plotfd,"%s\n",str);
X}
X
Xsetpat(n)
Xshort n;
X{
X    fwrite("T",1,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X}
X
Xpensize(n)
Xshort n;
X{
X    fwrite("d",1,1,plotfd);
X    fwrite(&n,2,1,plotfd);
X}
X
Xfspec(w,h,t)
Xdouble w,h,t;
X{
X    fwrite("S",1,1,plotfd);
X    fwrite(&w,4,1,plotfd);  
X    fwrite(&h,4,1,plotfd);  
X    fwrite(&t,4,1,plotfd);
X}
X
Xfont(str)
Xchar *str;
X{
X    fprintf(plotfd,"X%s\n",str);
X}
X
Xstartp()
X{
X    fwrite("[",1,1,plotfd);
X}
X
Xendp()
X{
X    fwrite("]",1,1,plotfd);
X}
X
Xplotclose()
X{
X    fflush(plotfd);
X    fclose(plotfd);
X}
X
Xplotflush()
X{
X    fflush(plotfd);
X}
!FUNKY!STUFF!
echo  
echo finished part 1 of 8



More information about the Comp.sources.unix mailing list