majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
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@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 8majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 2 of 8
echo
echo extracting file fplot.man
sed 's/^X//' > fplot.man <<'!FUNKY!STUFF!'
XFPLOT(3) UNIX Programmer's Manual FPLOT(3)
X
XNAME
X fplot: graphics interface.
X
XSYNOPSIS
X plotopen(fname)
X char *fname;
X
X plotappend(fname)
X char *fname;
X
X plotflush()
X
X plotclose()
X
X area(x1,y1)
X short x1,y1;
X
X arc(x1,y1,x2,y2,x3,y3)
X short x1,y1,x2,y2,x3,y3;
X
X blabel(w,h,str)
X short w,h;
X char *str;
X
X bppin(b)
X short b;
X
X bppout(b)
X short b;
X
X bspline(k,n,v)
X short k, n, *v;
X
X chain(n,v)
X short n, *v;
X
X circle(x1,y1,r)
X short x1,y1,r;
X
X clabel(str)
X char *str;
X
X colour(red,green,blue)
X short red,green,blue;
X
X comment(str)
X char *str;
X
X cont(x1,y1)
X short x1,y1;
X
X contrel(x1,y1)
X short x1,y1;
X
X endp()
X
X erase()
X
X fillpat(pn,x1,y1,str)
X short pn,x1,y1;
X char *str;
X
X font(str)
X char *str;
X
X frame(x1,y1,x2,y2,hv)
X short x1,y1,x2,y2,hv;
X
X fspec(ws,hs,theta)
X double ws,hs,theta;
X
X gray(g)
X short g;
X
X label(str)
X char *str;
X
X line(x1,y1,x2,y2)
X short x1,y1,x2,y2;
X
X linemod(str)
X char *str;
X
X llabel(w,h,str)
X short w,h;
X char *str;
X
X move(x1,y1)
X short x1,y1;
X
X moverel(x1,y1)
X short x1,y1;
X
X pensize(pn)
X short pn;
X
X point(x1,y1)
X short x1,y1;
X
X polygon(n,v)
X short n, *v;
X
X setpat(pn)
X short pn;
X
X space(x1,y1,x2,y2,hv)
X short x1,y1,x2,y2,hv;
X
X startp()
X
XDESCRIPTION
X These routines write plot commands to an output file named
X in the plotopen(fname) call, or to standard output if no
X name is given. plotappend(fname) opens the plot file in
X append mode. plotflush() flushes the output stream. Plot
X commands in the output file are identified by a single
X character, followed by their arguments. The plot file
X should be closed with a call to plotclose().
X
XPLOT FILE FORMAT
X a arc xc yc x1 y1 x2 y2: draw a circular arc centered at
X (xc yc), from (x1 y1) to (x2 y2). Arcs are drawn clock-
X wise. (x2 y2) becomes the current point.
X
X b bppout b: scale output gray and colour values to a b
X bit per pixel range. Specifies the output device's gray-
X scale range.
X
X c circle x y r: draw a circle of radius r with centre
X (x y). The centre becomes the current point.
X
X d pensize n: set the diameter of the pen.
X
X e erase: clear the image to the current gray or current
X colour value.
X
X f linemod str: change the line mask used by the vector
X generator. Str is be a string of 0s an 1s. The line gen-
X erator will set pixels marked by a 1 in the string. For
X example, to produce a dotted line, a string like 11000
X might be used. The line generator cycles through the
X mask. The mask pointer is not reset on n (cont) instruc-
X tions, so the pattern will continue to the next segment,
X if desired. The initial line mask is 1, which generates
X solid lines.
X
X g gray g: set the current gray level to g from the user's
X gray scale range. This value will be scaled to the output
X gray scale range.
X
X k bspline k n x1 y1 x2 y2 ... xn yn: draw an order k
X B-spline. The n points are control points. The spline
X does not interpolate between the points. The algorithm
X is taken from "Principles of Interactive Computer Graph-
X ics" by Newmann and Sproull, page 323.
X
X l line x1 y1 x2 y2: draw a line from (x1 y1) to (x2 y2).
X (x2 y2) becomes the current point.
X
X m move x y: (x y) becomes the current point.
X
X n cont x y: draw a line from the current point to (x y).
X (x y) becomes the current point.
X
X o polygon n x1 y1 x2 y2 ... xn yn: draw a filled polygon.
X The polygon has n vertices, x1 y1 ... xn yn. The polygon
X subroutine expects the value of n, and a pointer to an
X array of 2*n values, which are used as x y pairs.
X
X p point x y: set the point (x y). It becomes the
X current point.
X
X s space x1 y1 x2 y2 hv: define the user's co-
X ordinates. (x1 y1) and (x2 y2) define the ends of a diag-
X onal through the space. If hv is one, then the first
X coordinate (x) will be regarded as horizontal, and the
X second as vertical. Otherwise, the first coordinate will
X be regarded as vertical and the second as horizontal.
X
X t label str: write the text string, up to a newline,
X starting at the current point. The text is written using
X the current font, with the current width scale, height
X scale and rotation angle.
X
X A area x y: fill an area starting at the seed point (x y).
X All 4-connected points having the same gray level as the
X seed point will be set to the current gray level. The
X boundary thus consists of pixels with a gray level dif-
X ferent from the seed point gray level, or the edge of the
X defined space.
X
X B bppin b: input gray and colour values will be drawn
X from a b bit per pixel range.
X
X C colour red green blue: set the current red green
X and blue values from the user's input range.
X
X F frame r1 c1 r2 r2 hv: define the device coordi-
X nate system. The point (x1 y1) from the user's coordinate
X system (from the space command) will be mapped to
X (r1 c1), and (x2 y2) will be mapped to (r2 c2). If hv is
X one, the device's first coordinate is horizontal.
X
X L chain n x1 y1 x2 y2 ... xn yn: draw a polyline (or
X chain). The line has n vertices, x1 y1 ... xn yn. The
X chain subroutine expects the value of n, and a pointer to
X an array of 2*n values, which are used as x y pairs.
X
X M moverel dx dy: displace the current point by dx and
X dy.
X
X N contrel dx dy: draw a line from the current point to
X a new current point displaced by dx and dy.
X
X P fillpat n r c str: the string str is used as an r
X row by c column pattern, which may be used for area,
X fill, and erase commands. Pixels under a 1 in the pattern
X are set to the current gray level. The pattern is labeled
X n. This label is used to refer to the pattern.
X
X S fspec ws hs theta: change the width scale (ws),
X height scale(hs), and rotation angle (theta) for labels
X in the current font. The angle theta is in radians, meas-
X ured anticlockwise from 0.0.
X
X T setpat n: set the current fill pattern to n.
X
X U blabel w h str: draws the string as a label, but scales
X the characters to fit in a box w units wide by h units
X high, with the current point at the upper left corner.
X
X V llabel w h str: like blabel, except that the height scale
X is based on the maximum height of caracters in the entire
X current font.
X
X X font str: change the current font to that named by str.
X See the section on fonts below.
X
X [ startp: start a filled polygon. Any closed figure
X drawn with the current gray level, will be filled using
X the current gray level and fill pattern. The end of the
X polygon must be marked by a ] (endp) plot command.
X
X ] endp: end a filled polygon. This command must be pre-
X ceeded by a [ (startp) plot command. The polygon is
X filled when this command is encountered.
X
X ; comment str: all characters up to a newline are taken
X as a comment. No action is taken.
X
X % clabel str: draws the string so that it is horizontally
X and vertically centered at the current point.
X
XFONTS
X Labels are plotted using the current font, using the current
X width and height scales, and rotation angle. The initial
X font is Simplex Roman, the width and height scales are 1.0,
X and the rotation angle is 0.0. Label characters not in the
X font are ignored.
X
X Caveat Scriptor
X Characters are plotted relative to the current point.
X This point is usually near the upper left corner of the
X character. However, characters may extend above and to
X the left of the current point. Some experimentation may
X be necessary for correct label placement.
X
X The following fonts are available:
X
X sr Simplex Roman
X dr Duplex Roman
X cr Complex Roman
X tr Triplex Roman
X ci Complex Italic
X ti Triplex Italic
X ss Simplex Script
X cs Complex Script
X ge Gothic English
X gg Gothic German
X gi Gothic Italian
X
X If the font name begins with the character /, the name is
X taken to be a file name containing an alternate font.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo extracting file hcat.c
sed 's/^X//' > hcat.c <<'!FUNKY!STUFF!'
X#include<stdio.h>
X#define TB "vfont/hf.table"
X#define CL "vfont/hf.clist"
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X short glyph;
X int g, x, y, i, xc, yc, rc, index, f;
X char c, cx, cy, gn[8], fn[32];
X FILE *tb, *cl, *fopen();
X
X tb = fopen(TB,"r");
X cl = fopen(CL,"r");
X
X if (tb == NULL) {
X fprintf(stderr,"Can't open %s!\n",TB);
X exit(0);
X }
X if (cl == NULL) {
X fprintf(stderr,"Can't open %s!\n",CL);
X exit(0);
X }
X
X f = 0;
X sprintf(fn,"hfcat.%d\0",f++);
X
X fprintf(stderr,"[%d",f-1);
X fflush(stderr);
X
X plotopen(fn);
X space(0,0,680,680,1);
X font("sr");
X fspec(0.5,-0.5,0.0);
X
X xc = 40; yc = 40;
X move(xc,yc);
X
X rc = fread(&glyph,2,1,tb);
X
X while (rc > 0) {
X rc = fread(&index,4,1,tb);
X rc = fseek(cl,index,0);
X if (rc < 0) fprintf(stderr,"cl fseek failed! offset = %d\n",index);
X c = getc(cl);
X while (c != '\0') {
X cx = getc(cl);
X cy = getc(cl);
X x = cx; y = -1 * cy;
X if (c == 'M') moverel(x,y);
X else if (c == 'N') contrel(x,y);
X c = getc(cl);
X }
X move(xc,yc+30);
X sprintf(gn,"%d\0",glyph);
X label(gn);
X xc += 80;
X if (xc > 640) {
X xc = 40;
X yc += 80;
X if (yc > 640) {
X plotclose();
X yc = 40;
X sprintf(fn,"hfcat.%d\0",f++);
X fprintf(stderr,"] [%d",f-1);
X fflush(stderr);
X plotopen(fn);
X space(0,0,680,680,1);
X font("sr");
X fspec(0.5,-0.5,0.0);
X }
X }
X move(xc,yc);
X
X rc = fread(&glyph,2,1,tb);
X }
X plotclose();
X fprintf(stderr,"]\n");
X}
!FUNKY!STUFF!
echo extracting file hcat.man
sed 's/^X//' > hcat.man <<'!FUNKY!STUFF!'
XHCAT(1) UNIX Programmer's Manual HCAT(1)
X
XNAME
X hcat - make Hershey font catalogue
X
XSYNOPSIS
X hcat
X
XDESCRIPTION
X hcat creates a set of plot files which form a catalogue for
X the Hershey fonts. The program hform must be run before this
X routine in order to create the necessary files. hcat creates
X the files hfcat.0 - hfcat.24. Each is a single page contain-
X ing 64 numbered glyphs from the Hershey fonts.
X
XAUTHOR
X Marc Majka
X
!FUNKY!STUFF!
echo extracting file hfont.c
sed 's/^X//' > hfont.c <<'!FUNKY!STUFF!'
X#include<stdio.h>
X#define TB "vfont/hf.table"
X#define CL "vfont/hf.clist"
X#define MAXF 32768
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X short glyph;
X int g, x, y, i, dx, dy;
X int rc, index, gx[256], cn, cpt, spt, cstart[256];
X char c, cx, cy, fstr[MAXF];
X FILE *tb, *cl, *fopen();
X
X tb = fopen(TB,"r");
X cl = fopen(CL,"r");
X
X if (tb == NULL) {
X fprintf(stderr,"Can't open %s!\n",TB);
X exit(1);
X }
X if (cl == NULL) {
X fprintf(stderr,"Can't open %s!\n",CL);
X exit(1);
X }
X
X for (i = 0; i < 256; i++) gx[i] = -1;
X
X scanf("%d %d%*[^\n]%*c",&dx,&dy);
X
X c = getchar();
X while (c != EOF) {
X scanf("%d%*[^\n]%*c",&g);
X cn = (unsigned)c;
X
X fseek(tb,0,0);
X rc = fread(&glyph,2,1,tb);
X
X while ((rc > 0) && (g != glyph)) {
X rc = fread(&index,4,1,tb);
X rc = fread(&glyph,2,1,tb);
X }
X
X if (rc == 0) {
X fprintf(stderr,"Glyph %d not found (char \'%c\')!\n",g,c);
X fclose(tb);
X tb = fopen(TB,"r");
X
X if (tb == NULL) {
X fprintf(stderr,"Can't open %s!\n",TB);
X exit(1);
X }
X }
X
X else {
X rc = fread(&index,4,1,tb);
X gx[cn] = index;
X }
X c = getchar();
X }
X
X spt = 0;
X
X for (i = 0; i < 256; i++) {
X if (gx[i] >= 0) {
X rc = fseek(cl,gx[i],0);
X if (rc < 0) {
X fprintf(stderr,"cl fseek failed! offset = %d\n",gx[i]);
X exit(1);
X }
X
X cstart[i] = spt;
X
X c = getc(cl);
X cx = getc(cl);
X cy = getc(cl);
X fstr[spt++] = c;
X fstr[spt++] = cx + dx;
X fstr[spt++] = cy + dy;
X c = getc(cl);
X
X while (c != '\0') {
X cx = getc(cl);
X cy = getc(cl);
X fstr[spt++] = c;
X fstr[spt++] = cx;
X fstr[spt++] = cy;
X c = getc(cl);
X }
X
X fstr[spt-2] -= dx;
X fstr[spt-1] -= dy;
X
X fstr[spt++] = '\0';
X }
X }
X
X for (i = 0; i < 256; i++) {
X if (gx[i] >= 0) {
X c = i;
X fwrite(&c,1,1,stdout);
X fwrite(&cstart[i],4,1,stdout);
X }
X }
X
X c = '\0';
X fwrite(&c,1,1,stdout);
X for (i = 0; i < spt; i++) fwrite(&fstr[i],1,1,stdout);
X
X exit(0);
X}
!FUNKY!STUFF!
echo extracting file hfont.man
sed 's/^X//' > hfont.man <<'!FUNKY!STUFF!'
XHFONT(1) UNIX Programmer's Manual HFONT(1)
X
XNAME
X hfont - make a plot-file font from the Hershey fonts
X
XSYNOPSIS
X hfont
X
XDESCRIPTION
X hfont creates a font file compatibe with the new plot rou-
X tines. Glyphs are selected from the Hershey font catalogue,
X and associated with single characters in the new font. hfont
X reads a list of character - glyph number pairs from standard
X input, and writes the new vector font file on standard out-
X put. The first line of the input file must contain 2
X integer values. These are x and y offsets for the character
X coordinate systems. A positive value will cause each char-
X acter to be shifted to the left and up for x and y respec-
X tively. Each successive line in the input must contain a
X single character, a blank, and an integer value, followed by
X a newline. The integer must be a Hershey glyph number,
X which will be associated with the character in the font.
X For example, if the input file contained the lines:
X
X S 741
X H 742
X D 743
X C 744
X
X Then the font would contain the glyphs for the playing-card
X symbols for Spades, Hearts, Diamonds, and Clubs attached to
X the characters S, H, D, and C.
X
X Copies of the Hershey font catalogue may be created with hcat.
X
XAUTHOR
X Marc Majka
X
!FUNKY!STUFF!
echo extracting file hform.c
sed 's/^X//' > hform.c <<'!FUNKY!STUFF!'
X#include <stdio.h>
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X short glyph;
X int np, x[256], y[256], i, mflag, xl, xr;
X short xc, yc, x0, y0;
X int index, d;
X char cg[6],cnp[4], c, dx, dy;
X FILE *ff, *tb, *cl, *fopen();
X
X ff = stdin;
X tb = fopen("vfont/hf.table","w");
X cl = fopen("vfont/hf.clist","w");
X
X index = 0;
X
X xc = 0; yc = 0;
X
X cg[0] = getc(ff);
X if (cg[0] == '\n') cg[0] = getc(ff);
X while (cg[0] != EOF) {
X /* first 5 chars: glyph number */
X
X for (i = 1; i < 5; i++) cg[i] = getc(ff);
X cg[i] = '\0';
X glyph = atoi(cg);
X if (glyph == 0) fprintf(stderr,"%d! \"%s\"\n",glyph,cg);
X
X /* next 3 chars: number of pairs */
X for (i = 0; i < 3; i++) cnp[i] = getc(ff);
X cnp[i] = '\0';
X np = atoi(cnp);
X
X /* left and right (X) boundaries */
X xl = getc(ff) - 'R';
X xr = getc(ff) - 'R';
X np--;
X
X /* points + skip commands */
X for (i = 0; i < np; i++) {
X if ((i == 31) || (i == 67) || (i == 103) || (i == 139))
X c = getc(ff);
X x[i] = getc(ff) - 'R';
X y[i] = getc(ff) - 'R';
X }
X
X /* extra char(s) at end */
X while ('\n' != (c = getc(ff)));
X
X xc = 0;
X yc = 0;
X
X /* write the table entry */
X if (glyph == d) {
X fprintf(stderr,"glyph %d index %d\n",glyph,index);
X fprintf(stderr,"xl %d xr %d\n",xl,xr);
X }
X
X fwrite(&glyph,2,1,tb);
X fwrite(&index,4,1,tb);
X
X /* write the plot list */
X /* first point is a skip */
X dx = xc - x[0] + xl;
X dy = yc - y[0];
X xc = x[0];
X yc = y[0];
X dx *= -1;
X
X fwrite("M",1,1,cl);
X fwrite(&dx,1,1,cl);
X fwrite(&dy,1,1,cl);
X
X index += 3;
X mflag = 0;
X
X for (i = 1; i < np; i++) {
X if (x[i] == -50) mflag = 1;
X else if (mflag) {
X dx = xc - x[i];
X dy = yc - y[i];
X xc = x[i];
X yc = y[i];
X dx *= -1;
X fwrite("M",1,1,cl);
X fwrite(&dx,1,1,cl);
X fwrite(&dy,1,1,cl);
X index += 3;
X mflag = 0;
X }
X else {
X dx = xc - x[i];
X dy = yc - y[i];
X xc = x[i];
X yc = y[i];
X dx *= -1;
X fwrite("N",1,1,cl);
X fwrite(&dx,1,1,cl);
X fwrite(&dy,1,1,cl);
X index += 3;
X }
X }
X dx = xc - xr;
X dy = yc - 0;
X dx *= -1;
X fwrite("M",1,1,cl);
X fwrite(&dx,1,1,cl);
X fwrite(&dy,1,1,cl);
X index += 3;
X xc = xr;
X yc = 0;
X fwrite(&yc,1,1,cl);
X index += 1;
X
X cg[0] = getc(ff);
X if (cg[0] == '\n') cg[0] = getc(ff);
X }
X fclose(ff);
X fclose(tb);
X fclose(cl);
X exit(0);
X}
!FUNKY!STUFF!
echo
echo finished part 2 of 8majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 3 of 8
echo
echo extracting file hform.man
sed 's/^X//' > hform.man <<'!FUNKY!STUFF!'
XHFORM(1) UNIX Programmer's Manual HFORM(1)
X
XNAME
X hform - reformat the public distribution of the Hershey fonts
X
XSYNOPSIS
X hform
X
XDESCRIPTION
X hform reads in a concatination of the Hershey fonts they
X come out of the public distribution in mod.sources. The
X program produces two files, vfont/hf.table and
X vfont/hf.clist. The table file contains a glyph-number
X offset list. The offset is a character offset into the
X clist file. This file contains, for each glyph, a list
X of relative moves and draws for rendering that glyph.
X Lists are terminated by a single null (0) character.
X
X These two files are used by the programs hcat and hfont.
X
XAUTHOR
X Marc Majka
X
!FUNKY!STUFF!
echo extracting file labels.c
sed 's/^X//' > labels.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/*************************************************************/
X/* */
X/* This file contains a common set of label drawing and */
X/* font manipulation routines. They depend on there being */
X/* three routines compiled in with them: */
X/* */
X/* dblmoverel(x,y) To do a relative move, but */
X/* double x,y; take doubles as input. */
X/* */
X/* dblcontrel(x,y) To do a relative draw, but */
X/* double x,y; take doubles as input. */
X/* */
X/* donelabel() Doesn't need to do anything, but a */
X/* device filter may want to know. */
X/* */
X/*************************************************************/
X
X#include <math.h>
X#include <stdio.h>
X
X#define MAXF 32000
X
X/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
X/* THIS IS WHERE THE FONTS ARE KEPT: MODIFY FOR LOCAL CONFIGURATION */
X/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
X#define FONTS "vfont/"
X
Xextern int errno;
X
Xstruct fontstruct {
X char name[256], clist[256], draw[MAXF];
X int nchars, cstart[256];
X double wscale, hscale, theta;
X double sinth, costh;
X};
X
Xstatic struct fontstruct fontst;
X
Xfont(fname)
Xchar *fname;
X{
X FILE *fin, *fopen();
X int spt, i;
X char c, fontfile[256];
X
X fontst.nchars = 0;
X spt = 0;
X
X /* open the font file */
X
X if (fname[0] == '/')
X strcpy(fontfile,fname);
X else {
X strcpy(fontfile,FONTS);
X strcat(fontfile,fname);
X }
X
X errno = 0;
X
X fin = fopen(fontfile,"r");
X if (fin == NULL) {
X fprintf(stderr,"\ncan't open font file: \"%s\"\n",fontfile);
X if (errno == 0) fprintf(stderr,"Too many open files\n");
X else perror(0);
X exit(1);
X }
X strcpy(fontst.name,fname);
X
X /* read the character index */
X fread(&c,1,1,fin);
X while (c != '\0') {
X fread(&spt,4,1,fin);
X fontst.clist[fontst.nchars] = c;
X fontst.cstart[fontst.nchars++] = spt;
X fread(&c,1,1,fin);
X }
X fontst.clist[fontst.nchars] = '\0';
X
X /* read the plot list */
X i = 0;
X while (fread(&fontst.draw[i++],1,1,fin));
X fclose(fin);
X}
X
Xfspec(w,h,t)
Xdouble w, h, t;
X{
X double sin(), cos();
X fontst.wscale = w;
X fontst.hscale = h;
X fontst.theta = t;
X fontst.costh = cos(t);
X fontst.sinth = sin(t);
X}
X
Xlabel(str)
Xchar *str;
X{
X int i;
X for (i = 0; str[i] != '\0'; imchar(str[i++]));
X donelabel();
X}
X
Ximlabelsize(str,x,y)
Xchar *str;
Xdouble *x,*y;
X{
X /* This code is krufty. It runs through the input string
X and collects the "size" of the label. There are too many
X coordinate systems in here to imagine. Bleech! */
X
X int cpt, spt, i;
X double csxc, csyc, x1, y1, x2, y2, csdx, csdy;
X char c;
X
X csxc = 0.0; csyc = 0.0;
X x1 = 0.0; y1 = 0.0;
X x2 = 0.0; y2 = 0.0;
X
X for (i = 0; str[i] != '\0'; i++) {
X c = str[i];
X cpt = 0;
X while ((c != fontst.clist[cpt]) && (cpt < fontst.nchars)) cpt++;
X
X if (cpt < fontst.nchars) {
X spt = fontst.cstart[cpt];
X while (fontst.draw[spt++] != '\0') {
X csdx = fontst.wscale * (double)(fontst.draw[spt++]);
X csdy = fontst.hscale * (double)(fontst.draw[spt++]);
X csxc += csdx; csyc += csdy;
X if (csxc < x1) x1 = csxc;
X if (csyc < y1) y1 = csyc;
X if (csxc > x2) x2 = csxc;
X if (csyc > y2) y2 = csyc;
X }
X }
X }
X
X *x = x2 - x1;
X *y = y2 - y1;
X}
X
Xclabel(str)
Xchar *str;
X{
X double dx,dy,odx,ody;
X
X imlabelsize(str,&dx,&dy);
X dx /= -2.0; dy /= 2.0;
X odx = (dx * fontst.costh) - (dy * fontst.sinth);
X ody = (dx * fontst.sinth) + (dy * fontst.costh);
X dblmoverel(odx,ody);
X
X label(str);
X}
X
Xblabel(lx,ly,str)
Xshort lx,ly;
Xchar *str;
X{
X double dx,dy,d0;
X double ow, oh, t;
X
X ow = fontst.wscale;
X oh = fontst.hscale;
X
X fontst.wscale = 1.0;
X fontst.hscale = 1.0;
X if (ow < 0) fontst.wscale *= -1.0;
X if (oh < 0) fontst.hscale *= -1.0;
X
X imlabelsize(str,&dx,&dy);
X
X if (dx == 0.0) dx = 1.0;
X if (dy == 0.0) dy = 1.0;
X
X fontst.wscale = (double)lx / dx;
X fontst.hscale = (double)ly / dy;
X
X label(str);
X
X fontst.wscale = ow;
X fontst.hscale = oh;
X}
X
Xllabel(lx,ly,str)
Xshort lx,ly;
Xchar *str;
X{
X double dx,dy,d0;
X double ow, oh, t;
X
X ow = fontst.wscale;
X oh = fontst.hscale;
X
X fontst.wscale = 1.0;
X fontst.hscale = 1.0;
X if (ow < 0) fontst.wscale *= -1.0;
X if (oh < 0) fontst.hscale *= -1.0;
X
X imlabelsize(str,&dx,&d0);
X imlabelsize(fontst.clist,&d0,&dy);
X
X if (dx == 0.0) dx = 1.0;
X if (dy == 0.0) dy = 1.0;
X
X fontst.wscale = (double)lx / dx;
X fontst.hscale = (double)ly / dy;
X
X label(str);
X
X fontst.wscale = ow;
X fontst.hscale = oh;
X}
X
Ximchar(c)
Xchar c;
X{
X int cpt, spt, contf;
X double csdx, csdy, odx, ody;
X
X cpt = 0;
X while ((c != fontst.clist[cpt]) && (cpt < fontst.nchars)) cpt++;
X
X if (cpt < fontst.nchars) {
X spt = fontst.cstart[cpt];
X while (fontst.draw[spt] != '\0') {
X if (fontst.draw[spt++] == 'N') contf = 1;
X else contf = 0;
X
X csdx = fontst.wscale * (double)(fontst.draw[spt++]);
X csdy = fontst.hscale * (double)(fontst.draw[spt++]);
X
X odx = (csdx * fontst.costh) - (csdy * fontst.sinth);
X ody = (csdx * fontst.sinth) + (csdy * fontst.costh);
X
X if (contf) dblcontrel(odx,ody);
X else dblmoverel(odx,ody);
X }
X }
X if (c == ' ') donelabel();
X}
!FUNKY!STUFF!
echo extracting file mkfont.c
sed 's/^X//' > mkfont.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
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X FILE *fin, *fout, *fopen();
X short x, y;
X int cstart[256], cpt, spt, i;
X char comm[32], fstr[MAXF], clist[256], xc, yc;
X
X cpt = 0; spt = 0;
X if (argc < 2) {
X fin = stdin;
X fout = stdout;
X }
X else if (argc < 3) {
X fin = fopen(argv[1],"r");
X fout = stdout;
X }
X else {
X fin = fopen(argv[1],"r");
X fout = fopen(argv[2],"w");
X }
X
X if (fin == NULL) {
X fprintf(stderr,"mkfont: can't open input file!\n");
X exit(1);
X }
X
X if (fout == NULL) {
X fprintf(stderr,"mkfont: can't open output file!\n");
X exit(1);
X }
X
X fscanf(fin,"%c%c",&comm[0],&comm[1]);
X
X while (comm[1] == ':') {
X clist[cpt] = comm[0];
X cstart[cpt++] = spt;
X fscanf(fin,"%s",comm);
X while (comm[0] != 'E') {
X if (comm[0] == 'N') {
X fscanf(fin,"%hd %hd",&x,&y);
X xc = x; yc = y;
X fstr[spt++] = 'N';
X fstr[spt++] = xc; fstr[spt++] = yc;
X }
X else if (comm[0] == 'M') {
X fscanf(fin,"%hd %hd",&x,&y);
X xc = x; yc = y;
X fstr[spt++] = 'M';
X fstr[spt++] = xc; fstr[spt++] = yc;
X }
X fscanf(fin,"%s",comm);
X }
X fstr[spt++] = '\0';
X
X while (getc(fin) != '\n');
X
X fscanf(fin,"%c%c",&comm[0],&comm[1]);
X }
X for (i = 0; i < cpt; i++) {
X fwrite(&clist[i],1,1,fout);
X fwrite(&cstart[i],4,1,fout);
X }
X xc = '\0';
X fwrite(&xc,1,1,fout);
X for (i = 0; i < spt; i++) fwrite(&fstr[i],1,1,fout);
X fclose(fin);
X fclose(fout);
X}
!FUNKY!STUFF!
echo extracting file pl5pl.c
sed 's/^X//' > pl5pl.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
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X char str[1024], comm, nl, c;
X int i, patn;
X short x1, y1, x2, y2, x3, y3, r, gray, red, green, blue, hv, pn, n, k;
X FILE *tfp, *pfp, *fopen();
X double ws, hs, theta;
X
X hv = 0;
X
X if (argc > 1) tfp = fopen(argv[1],"r");
X else tfp = stdin;
X
X if (tfp == NULL) {
X fprintf(stderr,"stpl: can't open input plot file\n");
X exit(1);
X }
X
X if (argc > 2) pfp = fopen(argv[2],"w");
X else pfp = stdout;
X
X if (pfp == NULL) {
X fprintf(stderr,"stpl: can't open output plot file\n");
X exit(1);
X }
X
X fprintf(pfp,"Xsr\n");
X ws = 5.0; hs = 5.0; theta = 0.0;
X fprintf(pfp,"S");
X fwrite(&ws,4,1,pfp);
X fwrite(&hs,4,1,pfp);
X fwrite(&theta,4,1,pfp);
X fflush(pfp);
X
X while (fscanf(tfp, "%c", &comm) != EOF) {
X switch (comm) {
X case 'm': /* MOVE */
X fread(&x1,2,1,tfp);
X fread(&y1,2,1,tfp);
X fprintf(pfp,"m");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X break;
X case 'n': /* CONT */
X fread(&x1,2,1,tfp);
X fread(&y1,2,1,tfp);
X fprintf(pfp,"n");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X break;
X case 'p': /* POINT */
X fread(&x1,2,1,tfp);
X fread(&y1,2,1,tfp);
X fprintf(pfp,"p");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X break;
X case 'l': /* LINE */
X fread(&x1,2,1,tfp);
X fread(&y1,2,1,tfp);
X fread(&x2,2,1,tfp);
X fread(&y2,2,1,tfp);
X fprintf(pfp,"l");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fflush(pfp);
X break;
X case 't': /* LABEL */
X fscanf(tfp,"%1s",&c);
X i = 0;
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"t%s\n",str);
X fflush(pfp);
X break;
X case 'a': /* ARC */
X fread(&x1,2,1,tfp);
X fread(&y1,2,1,tfp);
X fread(&x2,2,1,tfp);
X fread(&y2,2,1,tfp);
X fread(&x3,2,1,tfp);
X fread(&y3,2,1,tfp);
X fprintf(pfp,"a");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&x3,2,1,pfp);
X fwrite(&y3,2,1,pfp);
X fflush(pfp);
X break;
X case 'c': /* CIRCLE */
X fread(&x1,2,1,tfp);
X fread(&y1,2,1,tfp);
X fread(&r,2,1,tfp);
X fprintf(pfp,"c");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&r,2,1,pfp);
X fflush(pfp);
X break;
X case 'e': /* ERASE */
X gray = 0;
X fprintf(pfp,"g");
X fwrite(&gray,2,1,pfp);
X fprintf(pfp,"e");
X gray = 255;
X fprintf(pfp,"g");
X fwrite(&gray,2,1,pfp);
X fflush(pfp);
X break;
X case 'f': /* LINEMOD */
X fscanf(tfp,"%s",str);
X fscanf(tfp,"%c",&c);
X if (!strcmp(str,"dotted"))
X strcpy(str,"11000000");
X else if (!strcmp(str,"solid"))
X strcpy(str,"1");
X else if (!strcmp(str,"longdashed"))
X strcpy(str,"11111100");
X else if (!strcmp(str,"shortdashed"))
X strcpy(str,"11110000");
X else if (!strcmp(str,"dotdashed"))
X strcpy(str,"1100001111110000");
X else strcpy(str,"1");
X fprintf(pfp,"f%s\n",str);
X fflush(pfp);
X break;
X case 's': /* SPACE */
X fread(&x1,2,1,tfp);
X fread(&y1,2,1,tfp);
X fread(&x2,2,1,tfp);
X fread(&y2,2,1,tfp);
X fprintf(pfp,"s");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&hv,2,1,pfp);
X fflush(pfp);
X break;
X default:
X fprintf(stderr,"stpl: unknown command %s\n", comm);
X break;
X }
X }
X
X fclose(pfp);
X fclose(tfp);
X exit(0);
X}
X
!FUNKY!STUFF!
echo extracting file pl5pl.man
sed 's/^X//' > pl5pl.man <<'!FUNKY!STUFF!'
XPL5PL(1) UNIX Programmer's Manual PL5PL(1)
X
XNAME
X pl5pl - converts standard UNIX plot(5) files to plot file
X format.
X
XSYNOPSIS
X pl5pl [in [out]]
X
XDESCRIPTION
X pl5pl reads a plot file in the format specified by plot(5),
X and writes it in the local format. The space command has a
X 0 hv flag attached. Linemods are translated into something
X sensible. and erase is interpreted as clear to black.
X
X See the manual page for fplot(3) for a specification of plot
X files.
X
XAUTHOR
X Marc Majka
X
XSEE ALSO
X plot(5)
!FUNKY!STUFF!
echo extracting file plps.c
sed 's/^X//' > plps.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
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X FILE *pfp, *fopen();
X int argn, sqr, plt, bin, win, man, leg;
X int x1, y1, x2, y2, r1, c1, r2, c2;
X
X man = 0;
X leg = 0;
X sqr = 0;
X win = 0;
X bin = 0;
X plt = 0;
X
X for (argn = 1; argn < argc; argn++) {
X if (argv[argn][0] == '-') {
X switch (argv[argn][1]) {
X case 's': sqr = 1; break;
X case 'm': man = 1; break;
X case 'l': leg = 1; break;
X case 'b': bin = 1; break;
X case 'w':
X win = argn;
X r1 = atoi(argv[++win]);
X c1 = atoi(argv[++win]);
X r2 = atoi(argv[++win]);
X c2 = atoi(argv[++win]);
X x1 = c1;
X y1 = 3300 - r1;
X x2 = c2;
X y2 = 3300 - r2;
X win = 1;
X argn += 4;
X break;
X default:
X printf("plps [file] [-w r1 c1 r2 c2] [-s][-b][-m][-l]\n");
X exit(0);
X }
X }
X else {
X if (plt) {
X printf("plps [file] [-w r1 c1 r2 c2] [-s][-b][-m][-l]\n");
X exit(0);
X }
X plt = 1;
X pfp = fopen(argv[argn],"r");
X if (pfp == NULL) {
X printf("can't open plt file %s\n",argv[argn]);
X exit(1);
X }
X }
X }
X
X if (!plt) pfp = stdin;
X
X plotopen("");
X if (man) manfeed();
X if (leg) legal();
X if (sqr) frame(100,3200,2400,800,1);
X if (win) frame(x1,y1,x2,y2,1);
X if (bin) bppout(0);
X else bppout(1);
X plotdriver(pfp);
X plotclose();
X exit(0);
X}
!FUNKY!STUFF!
echo
echo finished part 3 of 8majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 4 of 8
echo
echo extracting file plps.man
sed 's/^X//' > plps.man <<'!FUNKY!STUFF!'
XPLPS(1) UNIX Programmer's Manual PLPS(1)
X
XNAME
X plps - convert plot files to PostScript
X
XSYNOPSIS
X plps [plotfile] [-s] [-b] [-w r1 c1 r2 c2]
X
XDESCRIPTION
X plps converts a plot file into postcript language, which may
X then be printed on a LaserWriter. The conversion is fast,
X making use of many of PostScript's wonderful features.
X
X The following options are recognized:
X
X -s The image will be square. This option casues plps to
X use only the upper 8 1/2 inch square on the page.
X
X -b Prints all gray levels as black, supressing
X PostScript's halftoning.
X
X -w plots in a window with upper left corner (r1 c1) and
X lower right corner (r2 c2). At 300dpi, a normal page
X goes from (0 0) to (3300 2550), although a margin at
X the edges of the pages does not get inked.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo extracting file plpsfns.c
sed 's/^X//' > plpsfns.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 MAXPATS 128
X#define FPMAX 32
X
Xstruct implstruct {
X double x1, y1, x2, y2; /* min and max points */
X double xr, yr; /* x and y range */
X double xc, yc; /* current point */
X int uhv; /* user space is hv */
X int ubpp; /* user bits per pixel */
X double ubppr; /* user bpp range */
X int gray; /* current gray level */
X int fpn; /* current fill pattern */
X int dot; /* current pen size */
X double r1, c1, r2, c2; /* max and min row and col */
X double rr, cr; /* row and col range */
X double rc, cc; /* current row and col */
X int dhv; /* frame hv */
X int fbpp; /* image bits per pixel */
X int fill, fstat; /* fill mode */
X};
Xstruct implstruct impl;
X
Xstruct fpstruct {
X char grid[FPMAX][FPMAX];
X int nr, nc;
X};
Xstruct fpstruct fpat[MAXPATS];
X
X#define FILLMAX 2048
Xstatic double fstack[FILLMAX][2];
Xstatic short knotn, knotk;
Xstatic int ftop;
X
XFILE *pfp;
X
Xmanfeed()
X{
X fprintf(pfp,"statusdict /manualfeed true put\n");
X}
X
Xlegal()
X{
X fprintf(pfp,"legal initmatrix\n");
X fprintf(pfp,"0.24 0.24 scale\n");
X fprintf(pfp,"0 900 translate\n");
X}
X
X/************************************************************************/
X/* plotopen: open file for output, initialize plot structure */
X/************************************************************************/
X
Xplotopen(fname)
Xchar *fname;
X{
X FILE *fopen();
X
X if (fname == 0 || fname[0] == '\0') pfp = stdout;
X else pfp = fopen(fname);
X if (pfp == NULL) {
X fprintf(stderr,"plotopen: can't write to ps file: %s\n",fname);
X exit(1);
X }
X
X prologue();
X
X space(100,3200,2500,100,1);
X frame(100,3200,2500,100,1);
X bppin(8);
X bppout(1);
X gray(255);
X linemod("1");
X fillpat(0,1,8,"1");
X font("sr");
X fspec(1.0,1.0,0.0);
X impl.fill = 0;
X impl.fstat = 0;
X
X}
X
X/************************************************************************/
X/* frame: specify frame buffer coordinate system */
X/************************************************************************/
X
Xframe(x1,y1,x2,y2,hv)
Xshort x1,y1,x2,y2,hv;
X{
X impl.r1 = x1; impl.c1 = y1;
X impl.r2 = x2; impl.c2 = y2;
X impl.dhv = hv;
X impl.rr = x2 - x1; impl.cr = y2 - y1;
X}
X
Xhvmatch()
X{
X if (impl.uhv = impl.dhv) return(1);
X return(0);
X}
X
X/************************************************************************/
X/* bppout: set number of bits per pixel for output */
X/************************************************************************/
X
Xbppout(b)
Xshort b;
X{
X if (b) impl.fbpp = 1;
X else impl.fbpp = 0;
X}
X
X/************************************************************************/
X/* bppin: set number of bits per pixel for input */
X/************************************************************************/
X
Xbppin(b)
Xshort b;
X{
X impl.ubpp = b;
X impl.ubppr = (1 << b) - 1;
X}
X
X/************************************************************************/
X/* plotclose: end it all */
X/************************************************************************/
X
Xplotclose()
X{
X epilogue();
X fclose(pfp);
X}
X
X/************************************************************************/
X/* space: define user coordinate system */
X/************************************************************************/
X
Xspace(x1,y1,x2,y2,hv)
Xshort x1, y1, x2, y2, hv;
X{
X impl.x1 = x1; impl.y1 = y1;
X impl.x2 = x2; impl.y2 = y2;
X impl.xr = x2 - x1;
X impl.yr = y2 - y1;
X impl.uhv = hv;
X}
X
X/************************************************************************/
X/* erase: reset frame buffer */
X/************************************************************************/
X
Xerase()
X{
X fprintf(pfp,"showpage\n");
X}
X
X/************************************************************************/
X/* move: change the current point to (x, y). */
X/************************************************************************/
X
Xmove(x,y)
Xshort x, y;
X{
X impl.xc = x; impl.yc = y;
X dblmove();
X}
X
Xdblmove()
X{
X scale(impl.xc,impl.yc);
X
X if ((impl.fill) && (impl.fstat)) {
X fstack[ftop][0] = impl.rc;
X fstack[ftop][1] = impl.cc;
X ftop++;
X impl.fstat = 0;
X }
X PSmoveto(impl.rc,impl.cc);
X}
X
X/************************************************************************/
X/* scale: convert user coordinates to frame coordinates */
X/************************************************************************/
X
Xscale(x,y)
Xdouble x,y;
X{
X if (impl.uhv != impl.dhv) {
X impl.cc = impl.c1 + (x - impl.x1) * (impl.cr / impl.xr);
X impl.rc = impl.r1 + (y - impl.y1) * (impl.rr / impl.yr);
X }
X else {
X impl.rc = impl.r1 + (x - impl.x1) * (impl.rr / impl.xr);
X impl.cc = impl.c1 + (y - impl.y1) * (impl.cr / impl.yr);
X }
X}
X
X/************************************************************************/
X/* point: plot a point */
X/************************************************************************/
X
Xpoint(x,y)
Xshort x, y;
X{
X scale((double)x,(double)y);
X
X PSpoint(impl.rc,impl.cc);
X PSstroke();
X}
X
X/************************************************************************/
X/* cont: line generator. Draws a line from current point to (x, y) */
X/* uses the line mask to decide when to set pixels. */
X/************************************************************************/
X
Xcont(x,y)
Xshort x, y;
X{
X double r1, c1, r2, c2;
X
X r1 = impl.rc; c1 = impl.cc;
X scale((double)x,(double)y);
X r2 = impl.rc; c2 = impl.cc;
X imdraw(r1,c1,r2,c2);
X PSstroke();
X}
X
Ximdraw(r1,c1,r2,c2)
Xdouble r1,c1,r2,c2;
X{
X double rinc, cinc, length, tlen, r, c, fabs();
X int i, state;
X
X /* if the this line is part of a polygon, stack the point for later fill */
X if (impl.fill) {
X fstack[ftop][0] = r2;
X fstack[ftop][1] = c2;
X ftop++;
X if (ftop >= FILLMAX) {
X fprintf(stderr,"plvfs: fill stack overflow\n");
X exit(1);
X }
X }
X
X PSlineto(r2,c2);
X}
X
X/************************************************************************/
X/* line: draw a line */
X/************************************************************************/
X
Xline(x1,y1,x2,y2)
Xshort x1, y1, x2, y2;
X{
X move(x1,y1);
X cont(x2,y2);
X}
X
X/************************************************************************/
X/* polygon: filled polygon */
X/************************************************************************/
X
Xpolygon(n,v)
Xshort n, *v;
X{
X int i, p;
X double x, y;
X
X ftop = n;
X p = 0;
X
X for (i = 0; i < n; i++) {
X x = v[p++]; y = v[p++];
X scale(x,y);
X fstack[i][0] = impl.rc;
X fstack[i][1] = impl.cc;
X }
X
X drawpolygon(ftop,fstack);
X}
X
Xdrawpolygon(top,stack)
Xshort top;
Xdouble *stack;
X{
X short p, i;
X double x,y;
X
X p = impl.fpn;
X
X fprintf(pfp,"gsave\n");
X fprintf(pfp,"pat%d %d %d 300 32 div setpattern\n",
X p,fpat[p].nr,fpat[p].nc / 8);
X
X p = 0;
X x = stack[p++]; y = stack[p++];
X PSmoveto(x,y);
X for (i = 1; i < top; i++) {
X x = stack[p++];
X y = stack[p++];
X PSlineto(x,y);
X }
X
X PSfill();
X fprintf(pfp,"grestore\n");
X}
X
X/************************************************************************/
X/* bspline: order k spline from Newmann & Sproull */
X/************************************************************************/
X
Xbspline(k,n,v)
Xshort k,n,*v;
X{
X double u, du, ufin, x, y, x0,y0;
X short nn;
X
X nn = n - 1;
X ufin = (double)(nn - k + 2);
X du = ufin / (500.0 + (double)nn);
X
X u = 0.0;
X Bpoint(&x,&y,0.0,nn,k,v);
X scale(x,y);
X PSmoveto(impl.rc,impl.cc);
X x0 = impl.rc, y0 = impl.cc;
X
X while (u <= ufin) {
X u = u + du;
X Bpoint(&x,&y,u,n,k,v);
X scale(x,y);
X imdraw(impl.rc,impl.cc,x0,y0);
X x0 = impl.rc, y0 = impl.cc;
X }
X x = v[nn*2];
X y = v[nn*2 + 1];
X scale(x,y);
X imdraw(impl.rc,impl.cc,x0,y0);
X PSstroke();
X}
X
XBpoint(x,y,u,n,k,v)
Xdouble *x,*y,u;
Xint n,k;
Xshort *v;
X{
X int i, m;
X double b, Bnblend();
X
X *x = 0.0; *y = 0.0;
X m = 0;
X knotk = k;
X knotn = n;
X
X for (i = 0; i <= n; i++) {
X b = Bnblend(i,k,u);
X *x = *x + (double)(v[m]) * b;
X *y = *y + (double)(v[m+1]) * b;
X m += 2;
X }
X}
X
XBknot(i)
Xint i;
X{
X if (i < knotk) return(0);
X else if (i > knotn) return(knotn - knotk + 2);
X else return(i - knotk + 1);
X}
X
Xdouble Bnblend(i,k,u)
Xint i,k;
Xdouble u;
X{
X double v, v1, v2, t1, t2, abs();
X
X v1 = 0.0; v2 = 0.0; t1 = 0.0; t2 = 0.0;
X
X if (k == 1) {
X if ((Bknot(i) <= u) && (u < Bknot(i+1))) v = 1.0;
X else v = 0.0;
X }
X else {
X t1 = Bknot(i+k-1) - Bknot(i);
X if (t1 != 0) v1 = (u - Bknot(i)) * Bnblend(i,k-1,u) / t1;
X
X t2 = Bknot(i+k) - Bknot(i+1);
X if (t2 != 0) v2 = (Bknot(i+k) - u) * Bnblend(i+1,k-1,u) / t2;
X
X v = v1 + v2;
X }
X return(v);
X}
X
X/************************************************************************/
X/* chain: polyline */
X/************************************************************************/
X
Xchain(n,v)
Xshort n, *v;
X{
X int i, p;
X short x, y;
X double r1,c1,r2,c2;
X
X p = 0;
X x = v[p++]; y = v[p++];
X move(x,y);
X r1 = impl.rc; c1 = impl.cc;
X
X for (i = 1; i < n; i++) {
X x = v[p++]; y = v[p++];
X scale((double)x,(double)y);
X r2 = impl.rc; c2 = impl.cc;
X imdraw(r1,c1,r2,c2);
X r1 = r2; c1 = c2;
X }
X PSstroke();
X}
X
X/************************************************************************/
X/* moverel: relative move */
X/************************************************************************/
X
Xmoverel(x,y)
Xshort x, y;
X{
X impl.xc += (double)x; impl.yc += (double)y;
X dblmove(impl.xc,impl.yc);
X}
X
Xdblmoverel(x,y)
Xdouble x, y;
X{
X impl.xc += x; impl.yc += y;
X dblmove(impl.xc,impl.yc);
X}
X
X/************************************************************************/
X/* contrel: relative cont */
X/************************************************************************/
X
Xcontrel(x,y)
Xshort x, y;
X{
X double r1, c1, r2, c2;
X
X r1 = impl.rc; c1 = impl.cc;
X impl.xc += (double)x; impl.yc += (double)y;
X scale(impl.xc,impl.yc);
X r2 = impl.rc; c2 = impl.cc;
X imdraw(r1,c1,r2,c2);
X PSstroke();
X}
X
Xdblcontrel(x,y)
Xdouble x, y;
X{
X double r1, c1, r2, c2;
X
X r1 = impl.rc; c1 = impl.cc;
X impl.xc += x; impl.yc += y;
X scale(impl.xc,impl.yc);
X r2 = impl.rc; c2 = impl.cc;
X imdraw(r1,c1,r2,c2);
X}
X
X/************************************************************************/
X/* gray: set the current gray level */
X/************************************************************************/
X
Xgray(g)
Xshort g;
X{
X double og;
X if (impl.fbpp) {
X og = (255.0 - (double)g) / 255.0;
X fprintf(pfp,"%.2f setgray\n",og);
X }
X else if (g) fprintf(pfp,"0 setgray\n");
X else fprintf(pfp,"1 setgray\n");
X}
X
X/************************************************************************/
X/* colour: set the current colour */
X/************************************************************************/
X
Xcolour(r,g,b)
Xshort r,g,b;
X{
X double og;
X
X if (impl.fbpp) {
X og = (765.0 - (double)(r+g+b)) / 765.0;
X fprintf(pfp,"%.2f setgray\n",og);
X }
X else if (r+g+b) fprintf(pfp,"0 setgray\n");
X else fprintf(pfp,"1 setgray\n");
X}
X
X/************************************************************************/
X/* pensize: set the pen size */
X/************************************************************************/
X
Xpensize(p)
Xshort p;
X{
X impl.dot = p;
X PSsetlinewidth(p);
X}
X
X/************************************************************************/
X/* linemod: change the line generator mask */
X/* this mask should be a string of 1s and 0s. The line */
X/* generator (imcont) will set the pixels under a "1". */
X/************************************************************************/
X
Xlinemod(str)
Xchar *str;
X{
X int l,p,s,nz;
X
X nz = 1;
X s = 1;
X l = 0;
X
X fprintf(pfp,"[");
X for (p = 0; str[p] != '\0'; p++) {
X if (s) {
X if (str[p] == '1') l++;
X else {
X fprintf(pfp,"%d ",l);
X l = 1;
X s = 0;
X nz = 0;
X }
X }
X else {
X if (str[p] != '1') l++;
X else {
X fprintf(pfp,"%d ",l);
X l = 1;
X s = 1;
X }
X }
X }
X if (nz) fprintf(pfp,"]");
X else if (s) fprintf(pfp,"%d 0]",l);
X else fprintf(pfp,"%d]",l);
X
X fprintf(pfp," 0 setdash\n",l);
X}
X
X/************************************************************************/
X/* startp: start filled polygon */
X/************************************************************************/
X
Xstartp()
X{
X impl.fill = 1;
X impl.fstat = 1;
X ftop = 0;
X}
X
X/************************************************************************/
X/* endp: end filled polygon */
X/************************************************************************/
X
Xendp()
X{
X drawpolygon(ftop,fstack);
X impl.fill = 0;
X ftop = 0;
X}
X
X/************************************************************************/
X/* arc: draw an arc from x1 y1 to x2 y2, with center at xc xy */
X/************************************************************************/
X
Xarc(xc,yc,x1,y1,x2,y2)
Xshort xc,yc,x1,y1,x2,y2;
X{
X double a1, a2, rad, pi, hypot(), acos();
X double r1, c1, r2, c2, rr, rc;
X
X pi = acos(-1.0);
X
X rad = hypot((double)(x1-xc),(double)(y1-yc));
X
X /* find the angles a1 and a2 */
X
X if (y1 >= yc) a1 = acos((x1-xc)/rad);
X else a1 = pi + acos((xc-x1)/rad);
X
X if (y2 >= yc) a2 = acos((x2-xc)/rad);
X else a2 = pi + acos((xc-x2)/rad);
X
X scale((double)xc,(double)yc);
X r1 = impl.rc; c1 = impl.cc;
X scale((double)xc+rad,(double)yc+rad);
X r2 = impl.rc; c2 = impl.cc;
X
X rr = r2 - r1; rc = c2 - c1;
X
X if (rr < 0) rr *= -1.0;
X if (rc < 0) rc *= -1.0;
X
X fprintf(pfp,"newpath %.2f %.2f %.2f %.2f %.2f %.2f ellipse\n",
X c1,r1,rc,rr,a1,a2);
X PSstroke();
X}
X
X/************************************************************************/
X/* circle: simple incremental circle generator */
X/************************************************************************/
X
Xcircle(x1,y1,r)
Xshort x1,y1,r;
X{
X arc(x1,y1,x1-r,y1,x1+r,y1);
X arc(x1,y1,x1+r,y1,x1-r,y1);
X}
X
X/************************************************************************/
X/* fillpat: set fill pattern */
X/************************************************************************/
X
Xfillpat(n,r,c,str)
Xshort n, r, c;
Xchar *str;
X{
X int pr, pc, p, pat[32][32], nbyte, byte;
X unsigned int bval;
X
X if (c % 8) {
X fprintf(stderr,"fillpat %d %d %c: ncols must be a multiple of 8\n",
X n,r,c);
X return(0);
X }
X
X fpat[n].nr = r;
X fpat[n].nc = c;
X p = 0;
X
X for (pr = 0; pr < r; pr++)
X for (pc = 0; pc < c; pc++) {
X if (str[p++] == '1') fpat[n].grid[pr][pc] = 1;
X else fpat[n].grid[pr][pc] = 0;
X if (str[p] == '\0') p = 0;
X }
X
X fprintf(pfp,"/pat%d <",n);
X
X p = 0;
X nbyte = r * c / 8;
X
X for (byte = 0; byte < nbyte; byte++) {
X bval = 0;
X for (pc = 7; pc >= 0; pc--) {
X if (str[p++] == '1') bval |= 1 << pc;
X if (str[p] == '\0') p = 0;
X }
X if (bval < 16) fprintf(pfp,"0");
X fprintf(pfp,"%x",bval);
X }
X fprintf(pfp,"> def\n",n);
X
X setpat(n);
X}
X
X/************************************************************************/
X/* setpat: set texture */
X/************************************************************************/
X
Xsetpat(p)
Xshort p;
X{
X impl.fpn = p;
X}
X
X/************************************************************************/
X/* area: fill area from seed point - boundary is non-current value */
X/************************************************************************/
X
Xarea(x,y)
Xshort x, y;
X{
X/* AREA NOT IMPLEMENTED */
X}
X
Xcomment(str)
Xchar *str;
X{
X PScomment(str);
X}
X
Xdonelabel()
X{
X PSstroke();
X}
X
XPSerasepage()
X{
X fprintf(pfp,"erasepage\n");
X}
X
XPSmoveto(x,y)
Xdouble x,y;
X{
X fprintf(pfp,"%.2f %.2f moveto\n",x,y);
X}
X
XPSpoint(x,y)
Xdouble x,y;
X{
X fprintf(pfp,"%.2f %.2f point\n",x,y);
X}
X
XPSlineto(x,y)
Xdouble x,y;
X{
X fprintf(pfp,"%.2f %.2f lineto\n",x,y);
X}
X
XPSstroke()
X{
X fprintf(pfp,"stroke\n");
X fprintf(pfp,"%.2f %.2f moveto\n",impl.rc,impl.cc);
X}
X
XPSfill()
X{
X fprintf(pfp,"fill\n");
X fprintf(pfp,"%.2f %.2f moveto\n",impl.rc,impl.cc);
X}
X
XPSsetlinewidth(w)
Xshort w;
X{
X fprintf(pfp,"%d setlinewidth\n",w);
X}
X
XPScomment(str)
Xchar *str;
X{
X fprintf(pfp,"%% %s\n",str);
X}
X
Xprologue()
X{
X fprintf(pfp,"gsave\n");
X fprintf(pfp,"initgraphics\n");
X fprintf(pfp,"0.24 0.24 scale\n");
X fprintf(pfp,"/mtrx matrix def\n");
X fprintf(pfp,"/bitison {\n");
X fprintf(pfp," /ybit exch def\n");
X fprintf(pfp," /xbit exch def\n");
X fprintf(pfp," bstring ybit bwidth mul xbit 8 idiv add get\n");
X fprintf(pfp," 1 7 xbit 8 mod sub bitshift and 0 ne\n");
X fprintf(pfp,"} def\n");
X fprintf(pfp,"/setpattern {\n");
X fprintf(pfp," /freq exch def\n");
X fprintf(pfp," /bwidth exch def\n");
X fprintf(pfp," /bpside exch def\n");
X fprintf(pfp," /bstring exch def\n");
X fprintf(pfp," /onbits 0 def\n");
X fprintf(pfp," /offbits 0 def\n");
X fprintf(pfp," freq 0\n");
X fprintf(pfp," {\n");
X fprintf(pfp," /y exch def\n");
X fprintf(pfp," /x exch def\n");
X fprintf(pfp," /xindex x 1 add 2 div bpside mul cvi def\n");
X fprintf(pfp," /yindex y 1 add 2 div bpside mul cvi def\n");
X fprintf(pfp," xindex yindex bitison\n");
X fprintf(pfp," {/onbits onbits 1 add def 1}\n");
X fprintf(pfp," {/offbits offbits 1 add def 0}\n");
X fprintf(pfp," ifelse\n");
X fprintf(pfp," } setscreen\n");
X fprintf(pfp," {} settransfer\n");
X fprintf(pfp," offbits offbits onbits add div setgray\n");
X fprintf(pfp,"} def\n");
X fprintf(pfp,"/point {\n");
X fprintf(pfp," /x exch def\n");
X fprintf(pfp," /y exch def\n");
X fprintf(pfp," y x moveto\n");
X fprintf(pfp," y 0.01 add x lineto\n");
X fprintf(pfp,"} def\n");
X fprintf(pfp,"/ellipse {\n");
X fprintf(pfp," /a2 exch def\n");
X fprintf(pfp," /a1 exch def\n");
X fprintf(pfp," /rx exch def\n");
X fprintf(pfp," /ry exch def\n");
X fprintf(pfp," /xc exch def\n");
X fprintf(pfp," /yc exch def\n");
X fprintf(pfp," /savematrix mtrx currentmatrix def\n");
X fprintf(pfp," xc yc translate\n");
X fprintf(pfp," rx ry scale\n");
X fprintf(pfp," 0 0 1 a1 a2 arc\n");
X fprintf(pfp," savematrix setmatrix\n");
X fprintf(pfp,"} def\n");
X fprintf(pfp,"1 setlinewidth\n");
X fprintf(pfp,"1 setlinecap\n");
X fprintf(pfp,"1 setlinejoin\n");
X}
X
Xepilogue()
X{
X fprintf(pfp,"stroke\n");
X fprintf(pfp,"showpage\n");
X fprintf(pfp,"grestore\n");
X fprintf(pfp,"end\n");
X}
!FUNKY!STUFF!
echo
echo finished part 4 of 8majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 5 of 8
echo
echo extracting file pltx.c
sed 's/^X//' > pltx.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
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X FILE *pfp, *fopen();
X
X if (argc > 1) pfp = fopen(argv[1],"r");
X else pfp = stdin;
X
X if (pfp == NULL) {
X fprintf(stderr,"pltx: can't open input plot file\n");
X exit(1);
X }
X if (argc > 2) plotopen(argv[2]);
X else plotopen("");
X
X plotdriver();
X plotclose();
X fclose(pfp);
X exit(0);
X}
!FUNKY!STUFF!
echo extracting file pltx.man
sed 's/^X//' > pltx.man <<'!FUNKY!STUFF!'
XPLTX(1) UNIX Programmer's Manual PLTX(1)
X
X
XNAME
X pltx - converts plot files to text files
X
XSYNOPSIS
X pltx [plot-file [text-file]]
X
XDESCRIPTION
X pltx reads a plot file and writes a text file. It is the
X inverse of txpl(1-UBC). See the manual for fplot for a
X description of plot files.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo extracting file rplot.c
sed 's/^X//' > rplot.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
Xgetarg(desig,argc,argv)
Xint argc;
Xchar *desig, *argv[];
X{
X int argn;
X char minus[2], lookfor[12];
X
X strcpy(minus,"-");
X strcpy(lookfor,minus);
X strcat(lookfor,desig);
X
X for (argn = 1; argn < argc; argn++)
X if (!strcmp(argv[argn],lookfor)) return(argn);
X
X return (0);
X}
X
X#define GETARG(X) getarg(X,argc,argv)
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X FILE *plt, *fopen();
X int argn, nargs, nrows, ncols, sized;
X char nullname[2];
X
X if (GETARG("help")) {
X printf("useage: rpl [[plotfile] rasterfile] [-r n] [-c n]\n");
X printf(" plotfile is the input plot file\n");
X printf(" rasterfile is the output raster file\n");
X printf(" -r nrows [default = 256]\n");
X printf(" -c ncols [default = 256]\n");
X exit(0);
X }
X
X nargs = argc - 1;
X sized = 0;
X
X nrows = GETARG("r");
X if (nrows) {
X nrows = atoi(argv[++nrows]);
X sized = 1;
X nargs -= 2;
X }
X ncols = GETARG("c");
X if (ncols) {
X ncols = atoi(argv[++ncols]);
X sized = 1;
X nargs -= 2;
X }
X else ncols = nrows;
X
X if (nargs == 0) {
X plt = stdin;
X plotopen("");
X }
X else if (nargs == 1) {
X plt = stdin;
X plotopen(argv[1]);
X }
X else {
X plt = fopen(argv[1],"r");
X plotopen(argv[2]);
X }
X
X if (plt == NULL) {
X printf("rpl: can't open plot file\n");
X exit(1);
X }
X
X if (sized) frame(0,0,nrows-1,ncols-1,0);
X plotdriver(plt);
X plotclose();
X exit(0);
X}
!FUNKY!STUFF!
echo extracting file rplot.man
sed 's/^X//' > rplot.man <<'!FUNKY!STUFF!'
XRPLOT(1) UNIX Programmer's Manual RPLOT(1)
X
XNAME
X rplot - renders a plot file in a memory raster.
X
XSYNOPSIS
X rplot [[plotfile] rasterfile] [-r n] [-c n]
X
XDESCRIPTION
X rplot reads a plot file, and executes the plot commands,
X using a file for output, rather than a device. If two
X arguments are given, the first should be a plot file, and
X the second will be used as the output file. If only one
X argument is given, it is used as the output file, and
X plot commands are read from standard input. If none are
X given, output will be to standard output. See the manual
X page for fplot(3) for a description of the plot file
X format used by rplot.
X
X Any options to must be given after the input and output file
X names. The options recognized are:
X
X -r the next parameter given is to be used as the number of
X rows in the output raster. A frame command will override
X this setting.
X
X -c sets the number of output columns, as above. If the -r
X option is given without a -c option, the number of
X columns will be the same as the number of rows.
X
XLIMITATIONS
X Maximum image size is 512 x 512 x 32 bpp. Can be recompiled
X if you need more.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo extracting file txfns.c
sed 's/^X//' > txfns.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
Xstatic FILE *tfp;
X
Xplotopen(fname)
Xchar *fname;
X{
X FILE *fopen();
X
X if (fname[0] == '\0') tfp = stdout;
X else tfp = fopen(fname,"w");
X
X if (tfp == NULL) {
X fprintf(stderr,"plotopen: can't open output text file %s\n",fname);
X exit(1);
X }
X}
X
Xplotclose()
X{
X fclose(tfp);
X}
X
Xmove(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"move %hd %hd\n",x1,y1);
X}
X
Xcont(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"cont %hd %hd\n",x1,y1);
X}
X
Xbspline(k,n,v)
Xshort k, n, *v;
X{
X short vn, indx, x, y;
X
X fprintf(tfp,"bspline %hd %hd\n",k,n);
X indx = 0;
X for (vn = 0; vn < n; vn++) {
X x = v[indx++]; y = v[indx++];
X fprintf(tfp," %hd %hd\n",x,y);
X }
X}
X
Xpolygon(n,v)
Xshort n, *v;
X{
X short vn, indx, x, y;
X
X fprintf(tfp,"polygon %hd\n",n);
X indx = 0;
X for (vn = 0; vn < n; vn++) {
X x = v[indx++]; y = v[indx++];
X fprintf(tfp," %hd %hd\n",x,y);
X }
X}
X
Xchain(n,v)
Xshort n, *v;
X{
X short vn, indx, x, y;
X
X fprintf(tfp,"chain %hd\n",n);
X indx = 0;
X for (vn = 0; vn < n; vn++) {
X x = v[indx++]; y = v[indx++];
X fprintf(tfp," %hd %hd\n",x,y);
X }
X}
X
Xmoverel(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"moverel %hd %hd\n",x1,y1);
X}
X
Xcontrel(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"contrel %hd %hd\n",x1,y1);
X}
X
Xarea(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"area %hd %hd\n",x1,y1);
X}
X
Xpoint(x1,y1)
Xshort x1,y1;
X{
X fprintf(tfp,"point %hd %hd\n",x1,y1);
X}
X
Xline(x1,y1,x2,y2)
Xshort x1,y1,x2,y2;
X{
X fprintf(tfp,"line %hd %hd %hd %hd\n",x1,y1,x2,y2);
X}
X
Xlabel(str)
Xchar *str;
X{
X fprintf(tfp,"label %s\n",str);
X}
X
Xclabel(str)
Xchar *str;
X{
X fprintf(tfp,"clabel %s\n",str);
X}
X
Xblabel(w,h,str)
Xshort w,h;
Xchar *str;
X{
X fprintf(tfp,"blabel %hd %hd %s\n",w,h,str);
X}
X
Xllabel(w,h,str)
Xshort w,h;
Xchar *str;
X{
X fprintf(tfp,"llabel %hd %hd %s\n",w,h,str);
X}
X
Xcomment(str)
Xchar *str;
X{
X fprintf(tfp,"comment %s\n",str);
X}
X
Xfont(str)
Xchar *str;
X{
X fprintf(tfp,"font %s\n",str);
X}
X
Xfspec(ws,hs,theta)
Xdouble ws,hs,theta;
X{
X fprintf(tfp,"fspec %lf %lf %lf\n",ws,hs,theta);
X}
X
Xfillpat(pn,x1,y1,str)
Xshort pn,x1,y1;
Xchar *str;
X{
X int i,j;
X
X fprintf(tfp,"fillpat %hd %hd %hd\n",pn,x1,y1);
X pn = 0;
X for (i = 0; i < x1; i++) {
X fprintf(tfp,"\t");
X for (j = 0; j < y1; j++) fprintf(tfp,"%c",str[pn++]);
X fprintf(tfp,"\n");
X }
X}
X
Xsetpat(pn)
Xshort pn;
X{
X fprintf(tfp,"setpat %hd\n",pn);
X}
X
Xpensize(pn)
Xshort pn;
X{
X fprintf(tfp,"pensize %hd\n",pn);
X}
X
Xarc(x1,y1,x2,y2,x3,y3)
Xshort x1,y1,x2,y2,x3,y3;
X{
X fprintf(tfp,"arc %hd %hd %hd %hd %hd %hd\n",x1,y1,x2,y2,x3,y3);
X}
X
Xcircle(x1,y1,r)
Xshort x1,y1,r;
X{
X fprintf(tfp,"circle %hd %hd %hd\n",x1,y1,r);
X}
X
Xerase()
X{
X fprintf(tfp,"erase\n");
X}
X
Xstartp()
X{
X fprintf(tfp,"startp\n");
X}
X
Xendp()
X{
X fprintf(tfp,"endp\n");
X}
X
Xlinemod(str)
Xchar *str;
X{
X fprintf(tfp,"linemod %s\n",str);
X}
X
Xframe(x1,y1,x2,y2,hv)
Xshort x1,y1,x2,y2,hv;
X{
X fprintf(tfp,"frame %hd %hd %hd %hd %hd\n",x1,y1,x2,y2,hv);
X}
X
Xbppin(b)
Xshort b;
X{
X fprintf(tfp,"bppin %hd\n",b);
X}
X
Xbppout(b)
Xshort b;
X{
X fprintf(tfp,"bppout %hd\n",b);
X}
X
Xspace(x1,y1,x2,y2,hv)
Xshort x1,y1,x2,y2,hv;
X{
X fprintf(tfp,"space %hd %hd %hd %hd %hd\n",x1,y1,x2,y2,hv);
X}
X
Xgray(g)
Xshort g;
X{
X fprintf(tfp,"gray %hd\n",g);
X}
X
Xcolour(red,green,blue)
Xshort red,green,blue;
X{
X fprintf(tfp,"colour %hd %hd %hd\n",red,green,blue);
X}
!FUNKY!STUFF!
echo extracting file txpl.c
sed 's/^X//' > txpl.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
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{
X char str[1024], comm[16], nl, c;
X int i, patn;
X short x1, y1, x2, y2, x3, y3, r, gray, red, green, blue, hv, pn, n, k;
X FILE *tfp, *pfp, *fopen();
X double ws, hs, theta;
X
X if (argc > 1) tfp = fopen(argv[1],"r");
X else tfp = stdin;
X
X if (tfp == NULL) {
X fprintf(stderr,"txpl: can't open input text file\n");
X exit(1);
X }
X
X if (argc > 2) pfp = fopen(argv[2],"w");
X else pfp = stdout;
X
X if (pfp == NULL) {
X fprintf(stderr,"txpl: can't open output plot file\n");
X exit(1);
X }
X
X while (fscanf(tfp,"%s", comm) != EOF) {
X if (0 == strcmp(comm,"move")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"m");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"cont")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"n");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bspline")) {
X fscanf(tfp,"%hd",&k);
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"k");
X fwrite(&k,2,1,pfp);
X fwrite(&n,2,1,pfp);
X for (i = 0; i < n; i++) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X }
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bsphd")) {
X fscanf(tfp,"%hd",&k);
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"k");
X fwrite(&k,2,1,pfp);
X fwrite(&n,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bsppt")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"polygon")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"o");
X fwrite(&n,2,1,pfp);
X for (i = 0; i < n; i++) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X }
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"polyhd")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"o");
X fwrite(&n,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"polypt")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"chain")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"L");
X fwrite(&n,2,1,pfp);
X for (i = 0; i < n; i++) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X }
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"chainhd")) {
X fscanf(tfp,"%hd",&n);
X fprintf(pfp,"L");
X fwrite(&n,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"chainpt")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"moverel")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fprintf(pfp,"M");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"contrel")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"N");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"point")) {
X fscanf(tfp,"%hd%hd",
X &x1,&y1);
X fprintf(pfp,"p");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"area")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fprintf(pfp,"A");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"line")) {
X fscanf(tfp,"%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2);
X fprintf(pfp,"l");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"label")) {
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"t%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"clabel")) {
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"%%%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"blabel")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"U");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fprintf(pfp,"%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"llabel")) {
X fscanf(tfp,"%hd%hd",&x1,&y1);
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"V");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fprintf(pfp,"%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"comment")) {
X fscanf(tfp,"%1s",&c);
X i = 0;
X
X while (c != '\n') {
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,";%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"font")) {
X fscanf(tfp,"%s",str);
X fprintf(pfp,"X%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"fspec")) {
X fscanf(tfp,"%lf%lf%lf",&ws,&hs,&theta);
X fprintf(pfp,"S");
X fwrite(&ws,4,1,pfp);
X fwrite(&hs,4,1,pfp);
X fwrite(&theta,4,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"fillpat")) {
X fscanf(tfp,"%hd%hd%hd",&pn,&x1,&y1);
X fscanf(tfp,"%1s",&c);
X patn = x1 * y1;
X i = 0;
X
X while (i < patn) {
X if ((c != '\n') && (c != ' ') && (c != '\t'))
X str[i++] = c;
X fscanf(tfp,"%c",&c);
X }
X str[i] = '\0';
X fprintf(pfp,"P");
X fwrite(&pn,2,1,pfp);
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fprintf(pfp,"%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"setpat")) {
X fscanf(tfp,"%hd",&pn);
X fprintf(pfp,"T");
X fwrite(&pn,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"pensize")) {
X fscanf(tfp,"%hd",&pn);
X fprintf(pfp,"d");
X fwrite(&pn,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"arc")) {
X fscanf(tfp,
X "%hd%hd%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2,&x3,&y3);
X fprintf(pfp,"a");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&x3,2,1,pfp);
X fwrite(&y3,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"circle")) {
X fscanf(tfp,"%hd%hd%hd",
X &x1,&y1,&r);
X fprintf(pfp,"c");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&r,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"erase")) {
X fprintf(pfp,"e");
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"startp")) {
X fprintf(pfp,"[");
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"endp")) {
X fprintf(pfp,"]");
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"linemod")) {
X fscanf(tfp,"%s",
X str);
X fprintf(pfp,"f%s\n",str);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"frame")) {
X fscanf(tfp,"%hd%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2,&hv);
X fprintf(pfp,"F");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&hv,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bpp")) {
X fscanf(tfp,"%hd",&x1);
X fprintf(stderr,"warning: bpp command is out of date.\n");
X fprintf(stderr," please change to bppin(b) or bppout(b)\n");
X fprintf(stderr," see the manual entry for fplot(3-UBC)\n");
X fprintf(stderr," assuming bppin %hd for bpp %hd\n",x1,x1);
X fprintf(pfp,"B");
X fwrite(&x1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bppin")) {
X fscanf(tfp,"%hd",&x1);
X fprintf(pfp,"B");
X fwrite(&x1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"bppout")) {
X fscanf(tfp,"%hd",&x1);
X fprintf(pfp,"b");
X fwrite(&x1,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"space")) {
X fscanf(tfp,"%hd%hd%hd%hd%hd",
X &x1,&y1,&x2,&y2,&hv);
X fprintf(pfp,"s");
X fwrite(&x1,2,1,pfp);
X fwrite(&y1,2,1,pfp);
X fwrite(&x2,2,1,pfp);
X fwrite(&y2,2,1,pfp);
X fwrite(&hv,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"gray")) {
X fscanf(tfp,"%hd",&gray);
X fprintf(pfp,"g");
X fwrite(&gray,2,1,pfp);
X fflush(pfp);
X }
X else if (0 == strcmp(comm,"colour")) {
X fscanf(tfp,"%hd",&red);
X fscanf(tfp,"%hd",&green);
X fscanf(tfp,"%hd",&blue);
X fprintf(pfp,"C");
X fwrite(&red,2,1,pfp);
X fwrite(&green,2,1,pfp);
X fwrite(&blue,2,1,pfp);
X fflush(pfp);
X }
X else {
X fprintf(stderr,"txpl: unknown command %s\n", comm);
X while ('\n' != (c = getc(tfp)));
X }
X }
X fclose(pfp);
X exit(0);
X}
X
!FUNKY!STUFF!
echo extracting file txpl.man
sed 's/^X//' > txpl.man <<'!FUNKY!STUFF!'
XTXPL(1) UNIX Programmer's Manual TXPL(1)
X
XNAME
X txpl - converts text files to plot files
X
XSYNOPSIS
X txpl [text-file [plot-file]]
X
XDESCRIPTION
X txpl reads a text file and writes a plot file. It is the
X inverse of pltx(1). The input text file should have 1
X command per line, with commands and operands separated by at
X least one space. See the manual page for fplot(3) for a
X specification of plot files.
X
XAUTHOR
X Marc Majka
!FUNKY!STUFF!
echo
echo finished part 5 of 8majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 6 of 8
echo
echo extracting file rplfns.c
sed 's/^X//' > rplfns.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/*************************************************************/
X/* */
X/* NOTE: The code for the vector generator (DDA) and the */
X/* bspline generator is based on those published in: */
X/* */
X/* [1] Newman, W.M. and Sproull, R.F., "Principles of */
X/* Interactive Computer Graphics", McGraw-Hill, */
X/* New York, 1979. */
X/* */
X/*************************************************************/
X
X#include <stdio.h>
X#define GMAX 512 /* Max grid size */
X#define FPMAX 32
X#define MAXPATS 128
X#define BPPMAX 16
X#define STACKSIZE 65536
X
X/* Plot structure: contains the raster (grid), min and max defined co-ords,
X x and y ranges, current point and current gray level, a line-generator
X mask and a pointer for that mask, image file pointer and annotation
X record, and max row and col. */
X
Xstruct implstruct {
X int grid[GMAX][GMAX]; /* image raster */
X double x1, y1, x2, y2; /* min and max points */
X double xr, yr; /* x and y range */
X double xc, yc; /* current point */
X int uhv; /* user space hv */
X int ubpp; /* user bits per pixel */
X double ubppr; /* user bpp range */
X int bx1, by1, bx2, by2; /* polygon bounding box */
X int patc; /* current fill pattern */
X long gray; /* current gray level */
X long lgray, ogray; /* temp grays for fill */
X char linemask[100]; /* line generator mask */
X int lmp; /* mask pointer */
X FILE *ifp; /* image file pointer */
X int r1, c1, r2, c2; /* image max & min */
X int rc, cc; /* current row and col */
X int rr, cr; /* row and col range */
X int dhv; /* image is hv */
X int dbpp; /* image bits per pixel */
X double dbppr; /* image bpp range */
X int nrows, ncols, bpp /* image size & bpp */
X};
X
Xstruct implstruct impl;
X
Xstruct fpstruct {
X char grid[FPMAX][FPMAX];
X int nr, nc;
X};
X
Xstruct fpstruct fpat[MAXPATS];
X
Xstatic int stack[STACKSIZE][2], top, knotk, knotn;
X
X/************************************************************************/
X/* plotopen: open an image file for output, initialize plot structure */
X/************************************************************************/
X
Xplotopen(fname)
Xchar *fname;
X{
X FILE *fopen();
X int r,c;
X
X if (fname[0] == '\0') impl.ifp = stdout;
X else impl.ifp = fopen(fname,"w");
X
X if (impl.ifp == NULL) {
X fprintf(stderr,"plotopen: can't open output file %s\n",fname);
X exit(1);
X }
X
X /* defaults */
X frame(0,0,255,255,0);
X space(0,0,255,255,0);
X bppout(8);
X bppin(8);
X move(0,0);
X gray(255);
X linemod("1");
X fillpat(0,1,1,"1");
X font("sr");
X fspec(1.0,1.0,0.0);
X
X for (r = 0; r < GMAX; r++)
X for (c = 0; c < GMAX; c++) impl.grid[r][c] = 0;
X}
X
X/************************************************************************/
X/* frame: initialize number of x and y divisions in the output image */
X/************************************************************************/
X
Xframe(x1,y1,x2,y2,hv)
Xint x1,y1,x2,y2,hv;
X{
X impl.r1 = x1; impl.c1 = y1;
X impl.r2 = x2; impl.c2 = y2;
X impl.rr = x2 - x1; impl.cr = y2 - y1;
X impl.nrows = 1 + abs((int)(x2-x1));
X impl.ncols = 1 + abs((int)(y2-y1));
X
X if (impl.nrows > GMAX) {
X fprintf(stderr,"frame: nrows (%d) > max (%d)\n",
X impl.nrows,GMAX);
X exit(1);
X }
X if (impl.ncols > GMAX) {
X fprintf(stderr,"frame: ncols (%d) > max (%d)\n",
X impl.ncols,GMAX);
X exit(1);
X }
X}
X
X/************************************************************************/
X/* bppout: set number of bits per pixel for output */
X/************************************************************************/
X
Xbppout(b)
Xint b;
X{
X if ((b < 1) || (b > BPPMAX)) {
X fprintf(stderr,"bpp: %d BPP exceeds %d maximum\n",b,BPPMAX);
X exit(1);
X }
X
X impl.bpp = b;
X impl.dbpp = b;
X impl.lgray = 1 + (1 << b);
X impl.dbppr = (1 << b) - 1;
X}
X
X/************************************************************************/
X/* bppin: set number of bits per pixel for input */
X/************************************************************************/
X
Xbppin(b)
Xint b;
X{
X impl.ubpp = b;
X impl.ubppr = (1 << b) - 1;
X}
X
X/************************************************************************/
X/* plotclose: write the image */
X/************************************************************************/
X
Xplotclose()
X{
X int i, j, p, bytes;
X
X bytes = impl.dbpp / 8;
X if (bytes == 0) bytes = 1;
X
X impl.nrows = impl.nrows;
X impl.ncols = impl.ncols;
X
X for (i = 0; i < impl.nrows; i++)
X for (j = 0; j < impl.ncols; j++) {
X p = impl.grid[i][j];
X fwrite(&p,bytes,1,impl.ifp);
X }
X
X fclose(impl.ifp);
X}
X
X/************************************************************************/
X/* space: define x and y max and min. set x and y range */
X/************************************************************************/
X
Xspace(x1,y1,x2,y2,hv)
Xint x1, y1, x2, y2, hv;
X{
X impl.x1 = x1; impl.y1 = y1;
X impl.x2 = x2; impl.y2 = y2;
X impl.xr = x2 - x1;
X impl.yr = y2 - y1;
X impl.uhv = hv;
X move(x1,y1);
X impl.bx1 = impl.x1; impl.by1 = impl.y1;
X impl.bx2 = impl.x2; impl.by2 = impl.y2;
X if (impl.xr == 0) impl.xr = 1;
X if (impl.yr == 0) impl.yr = 1;
X}
X
Xhvmatch()
X{
X if (impl.uhv == impl.dhv) return(1);
X return(0);
X}
X
X/************************************************************************/
X/* erase: fill the grid with current gray level */
X/************************************************************************/
X
Xerase()
X{
X int x, y, pc;
X
X pc = impl.patc;
X
X for (x = 0; x < impl.nrows; x++)
X for (y = 0; y < impl.ncols; y++)
X if (fpat[pc].grid[x % fpat[pc].nr][y % fpat[pc].nc])
X impl.grid[x][y] = impl.gray;
X}
X
X/************************************************************************/
X/* move: change the current point to (x, y). */
X/************************************************************************/
X
Xmove(x,y)
Xint x, y;
X{
X dblmove((double)x,(double)y);
X}
X
Xdblmove(x,y)
Xdouble x,y;
X{
X impl.xc = x; impl.yc = y;
X
X if (impl.uhv != impl.dhv) {
X impl.cc = impl.c1 + (impl.xc - impl.x1) * (impl.cr / impl.xr);
X impl.rc = impl.r1 + (impl.yc - impl.y1) * (impl.rr / impl.yr);
X }
X else {
X impl.rc = impl.r1 + (impl.xc - impl.x1) * (impl.rr / impl.xr);
X impl.cc = impl.c1 + (impl.yc - impl.y1) * (impl.cr / impl.yr);
X }
X
X if (impl.xc < impl.bx1) impl.bx1 = impl.xc;
X if (impl.yc < impl.by1) impl.by1 = impl.yc;
X if (impl.xc > impl.bx2) impl.bx2 = impl.xc;
X if (impl.yc > impl.by2) impl.by2 = impl.yc;
X}
X
X/************************************************************************/
X/* point: plot a point */
X/************************************************************************/
X
Xpoint(x,y)
Xint x, y;
X{
X move(x,y);
X if ((impl.rc>=0)&&(impl.rc<=GMAX)&&(impl.cc>=0)&&(impl.cc<=GMAX))
X impl.grid[impl.rc][impl.cc] = impl.gray;
X}
X
X/************************************************************************/
X/* cont: line generator. Draws a line from current point to (x, y) */
X/* uses the line mask to decide when to set pixels. */
X/************************************************************************/
X
Xcont(x,y)
Xint x, y;
X{
X dblcont((double)x,(double)y);
X}
X
Xdblcont(x,y)
Xdouble x,y;
X{
X double r1, c1, r2, c2, rinc, cinc, length, tlen, r, c, fabs();
X int i;
X
X /* Based on the simple DDA from Newmann and Sproull[1] */
X
X r1 = impl.rc; c1 = impl.cc;
X dblmove(x,y);
X r2 = impl.rc; c2 = impl.cc;
X
X length = fabs(r2-r1);
X tlen = fabs(c2-c1);
X if (tlen > length) length = tlen;
X if (length != 0.0) {
X rinc = (r2 - r1)/length;
X cinc = (c2 - c1)/length;
X r = r1;
X c = c1;
X
X for (i = 0; i < length; i++) {
X if (impl.linemask[impl.lmp] == '\0') impl.lmp = 0;
X if (impl.linemask[impl.lmp++] == '1')
X if ((r>=0)&&(r<=GMAX)&&(c>=0)&&(c<=GMAX))
X impl.grid[(int)r][(int)c] = impl.gray;
X r += rinc;
X c += cinc;
X }
X if ((r != r2) || (c != c2)) {
X if (impl.linemask[impl.lmp] == '\0') impl.lmp = 0;
X if (impl.linemask[impl.lmp++] == '1')
X if ((r2>=0)&&(r2<=GMAX)&&(c2>=0)&&(c2<=GMAX))
X impl.grid[(int)r2][(int)c2] = impl.gray;
X }
X }
X}
X
X/************************************************************************/
X/* line: draw a line */
X/************************************************************************/
X
Xline(x1,y1,x2,y2)
Xint x1, y1, x2, y2;
X{
X move(x1,y1);
X cont(x2,y2);
X}
X
X/************************************************************************/
X/* chain: polyline */
X/************************************************************************/
X
Xchain(n,v)
Xshort n, *v;
X{
X int i, p;
X short x, y;
X
X p = 0;
X x = v[p++]; y = v[p++];
X move(x,y);
X
X for (i = 1; i < n; i++) {
X x = v[p++]; y = v[p++];
X cont(x,y);
X }
X}
X
X/************************************************************************/
X/* bspline: order k spline from Newmann & Sproull[1] */
X/************************************************************************/
X
Xbspline(k,n,v)
Xshort k,n,*v;
X{
X double u, du, ufin, x, y;
X short nn;
X
X nn = n - 1;
X ufin = (double)(nn - k + 2);
X du = ufin / (500.0 + (double)nn);
X
X u = 0.0;
X Bpoint(&x,&y,0.0,nn,k,v);
X move((int)x,(int)y);
X
X while (u <= ufin) {
X u = u + du;
X Bpoint(&x,&y,u,n,k,v);
X cont((int)x,(int)y);
X }
X x = v[nn*2];
X y = v[nn*2 + 1];
X cont((int)x,(int)y);
X}
X
XBpoint(x,y,u,n,k,v)
Xdouble *x,*y,u;
Xint n,k;
Xshort *v;
X{
X int i, m;
X double b, Bnblend();
X
X *x = 0.0; *y = 0.0;
X m = 0;
X knotk = k;
X knotn = n;
X
X for (i = 0; i <= n; i++) {
X b = Bnblend(i,k,u);
X *x = *x + (double)(v[m]) * b;
X *y = *y + (double)(v[m+1]) * b;
X m += 2;
X }
X}
X
XBknot(i)
Xint i;
X{
X if (i < knotk) return(0);
X else if (i > knotn) return(knotn - knotk + 2);
X else return(i - knotk + 1);
X}
X
Xdouble Bnblend(i,k,u)
Xint i,k;
Xdouble u;
X{
X double v, v1, v2, t1, t2;
X
X v1 = 0.0; v2 = 0.0; t1 = 0.0; t2 = 0.0;
X
X if (k == 1) {
X if ((Bknot(i) <= u) && (u < Bknot(i+1))) v = 1.0;
X else v = 0.0;
X }
X else {
X t1 = Bknot(i+k-1) - Bknot(i);
X if (t1 != 0) v1 = (u - Bknot(i)) * Bnblend(i,k-1,u) / t1;
X
X t2 = Bknot(i+k) - Bknot(i+1);
X if (t2 != 0) v2 = (Bknot(i+k) - u) * Bnblend(i+1,k-1,u) / t2;
X
X v = v1 + v2;
X }
X return(v);
X}
X
Xpolygon(n,v)
Xshort n, *v;
X{
X int i, p;
X short x, y;
X
X startp();
X p = 0;
X x = v[p++]; y = v[p++];
X move(x,y);
X
X for (i = 1; i < n; i++) {
X x = v[p++]; y = v[p++];
X cont(x,y);
X }
X endp();
X}
X
X/************************************************************************/
X/* moverel: relative move */
X/************************************************************************/
X
Xmoverel(x,y)
Xint x, y;
X{
X int newx, newy;
X
X newx = impl.xc + x;
X newy = impl.yc + y;
X move(newx,newy);
X
X}
X
Xdblmoverel(x,y)
Xdouble x, y;
X{
X double newx, newy;
X
X newx = impl.xc + x;
X newy = impl.yc + y;
X dblmove(newx,newy);
X
X}
X
X/************************************************************************/
X/* contrel: relative cont */
X/************************************************************************/
X
Xcontrel(x,y)
Xint x, y;
X{
X int newx, newy;
X
X newx = impl.xc + x;
X newy = impl.yc + y;
X cont(newx,newy);
X}
X
Xdblcontrel(x,y)
Xdouble x, y;
X{
X double newx, newy;
X
X newx = impl.xc + x;
X newy = impl.yc + y;
X dblcont(newx,newy);
X
X}
X
X/************************************************************************/
X/* gray: set the current gray level */
X/************************************************************************/
X
Xgray(g)
Xint g;
X{
X impl.gray = (double)g * impl.dbppr/impl.ubppr;
X}
X
X/************************************************************************/
X/* colour: set the current colour */
X/************************************************************************/
X
Xcolour(r,g,b)
Xint r,g,b;
X{
X gray((int)((double)(r + g + b) / 3.0));
X}
X
X/************************************************************************/
X/* linemod: change the line generator mask */
X/* this mask should be a string of 1s and 0s. The line */
X/* generator (cont) will set the pixels under a "1". */
X/************************************************************************/
X
Xlinemod(str)
Xchar *str;
X{
X strcpy(impl.linemask,str);
X impl.lmp = 0;
X}
X
X/************************************************************************/
X/* startp: start filled polygon */
X/************************************************************************/
X
Xstartp()
X{
X impl.ogray = impl.gray;
X impl.gray = impl.lgray;
X impl.bx1 = impl.xc; impl.by1 = impl.yc;
X impl.bx2 = impl.xc; impl.by2 = impl.yc;
X}
X
X/************************************************************************/
X/* endp: end filled polygon */
X/************************************************************************/
X
Xendp()
X{
X impl.gray = impl.ogray;
X pfill(impl.bx1,impl.by1,impl.bx2,impl.by2,impl.lgray);
X}
X
X/************************************************************************/
X/* arc: draw an arc from x1 y1 to x2 y2, with center at xc xy */
X/************************************************************************/
X
Xarc(xc,yc,x1,y1,x2,y2)
Xint xc,yc,x1,y1,x2,y2;
X{
X double fabs(), hypot(),acos(), cos(), sin();
X double dt, a1, a2, theta, rad, pi, pi2, up, dn, bup, bdn;
X double cx, cy;
X int catch;
X
X pi = acos(-1.0);
X pi2 = 2.0 * pi;
X
X /* Algorithm: move to x1 y1. The angle between x1 y1 and the x axis is a1.
X The angle to x2 y2 is a2. Set theta = a1, and move to x1 y1.
X Sweep anti-clockwise to a2, incrementing theta by dt. At each step,
X find the point on the arc at angle theta. Use cont to draw a line
X to that point.
X */
X
X rad = hypot((double)(x1-xc),(double)(y1-yc));
X
X /* find the angles a1 and a2 */
X
X if (y1 >= yc) a1 = acos((x1-xc)/rad);
X else a1 = pi + acos((xc-x1)/rad);
X
X if (y2 >= yc) a2 = acos((x2-xc)/rad);
X else a2 = pi + acos((xc-x2)/rad);
X
X dt = 0.1 / rad;
X theta = a1;
X up = a2+dt;
X dn = a2-dt;
X bup = up + pi2;
X bdn = dn + pi2;
X catch = 0; /* safety chain */
X
X /* step around the arc until within range of a2 */
X while (!((catch > 1) && (((theta < up) && (theta > dn)) ||
X ((theta < bup) && (theta > bdn))))) {
X
X impl.xc = xc + rad * cos(theta);
X impl.yc = yc + rad * sin(theta);
X
X if (impl.uhv != impl.dhv) {
X impl.cc = impl.c1 + (impl.xc - impl.x1) * (impl.cr / impl.xr);
X impl.rc = impl.r1 + (impl.yc - impl.y1) * (impl.rr / impl.yr);
X }
X else {
X impl.rc = impl.r1 + (impl.xc - impl.x1) * (impl.rr / impl.xr);
X impl.cc = impl.c1 + (impl.yc - impl.y1) * (impl.cr / impl.yr);
X }
X
X if (impl.xc < impl.bx1) impl.bx1 = impl.xc;
X if (impl.yc < impl.by1) impl.by1 = impl.yc;
X if (impl.xc > impl.bx2) impl.bx2 = impl.xc;
X if (impl.yc > impl.by2) impl.by2 = impl.yc;
X
X if (impl.linemask[impl.lmp] == '\0') impl.lmp = 0;
X if (impl.linemask[impl.lmp++] == '1')
X if ((impl.rc>=0)&&(impl.rc<=GMAX)&&(impl.cc>=0)&&(impl.cc<=GMAX))
X impl.grid[impl.rc][impl.cc] = impl.gray;
X theta+=dt;
X
X /* safety check to catch runaway loops */
X if (catch++ > 1000000) {
X fprintf(stderr,"arc: runaway loop caught: inform a wizard!\n");
X fprintf(stderr," xc=%lf yc=%lf x1=%lf y1=%lf x1=%lf y1=%lf\n",
X xc,yc,x1,y1,x2,y2);
X fprintf(stderr," angle1=%lf angle2=%lf dtheta=%lf\n",a1,a2,dt);
X exit(1);
X }
X }
X
X /* finish up */
X cont(x2,y2);
X point(x2,y2);
X}
X
X/************************************************************************/
X/* circle: simple incremental circle generator */
X/************************************************************************/
X
Xcircle(x1,y1,r)
Xint x1,y1,r;
X{
X arc (x1, y1, x1-r, y1, x1-r, y1);
X}
X
X/************************************************************************/
X/* fillpat: set fill pattern */
X/************************************************************************/
X
Xfillpat(n,r,c,str)
Xint n, r, c;
Xchar *str;
X{
X int i, j, p;
X
X if (n >= MAXPATS) {
X fprintf(stderr,"fillpat: pattern number %d > max %d\n",n,MAXPATS-1);
X exit(1);
X }
X
X impl.patc = n;
X fpat[n].nr = r;
X fpat[n].nc = c;
X p = 0;
X
X for (i = 0; i < r; i++)
X for (j = 0; j < c; j++) {
X if (str[p++] == '1') fpat[n].grid[i][j] = 1;
X else fpat[n].grid[i][j] = 0;
X if (str[p] == '\0') p = 0;
X }
X}
X
X/************************************************************************/
X/* setpat: set current fill pattern */
X/************************************************************************/
X
Xsetpat(n)
Xint n;
X{
X impl.patc = n;
X}
X
X/************************************************************************/
X/* pensize: set pensize */
X/************************************************************************/
X
Xpensize(p)
Xint p;
X{
X/* PENSIZE NOT IMPLEMENTED */
X}
X
X/************************************************************************/
X/* area: fill area from seed point - boundary is non-current value */
X/************************************************************************/
X
Xarea(x,y)
Xint x, y;
X{
X int nx, ny, nxm, nym, nxp, nyp, aminx, aminy, amaxx, amaxy, pc;
X long seedv, mark;
X
X pc = impl.patc;
X
X /* stack the seed point */
X move(x,y);
X seedv = impl.grid[impl.rc][impl.cc];
X mark = impl.lgray;
X aminx = impl.rc; aminy = impl.cc;
X amaxx = aminx; amaxy = aminy;
X
X top = 0;
X if (fpat[pc].grid[impl.rc%fpat[pc].nr][impl.cc%fpat[pc].nc])
X impl.grid[impl.rc][impl.cc] = impl.gray;
X else impl.grid[impl.rc][impl.cc] = mark;
X stack[top][0] = impl.rc; stack[top++][1] = impl.cc;
X
X
X /* stack any 4-connected neighbours of the top of the stack, which
X have the seed value at that pixel. */
X
X while (top > 0) {
X top--;
X nx = stack[top][0]; ny = stack[top][1];
X nxm = nx - 1; nym = ny - 1;
X nxp = nx + 1; nyp = ny + 1;
X
X if (nx > 0)
X if (impl.grid[nxm][ny] == seedv) {
X if (nxm < aminx) aminx = nxm;
X if (fpat[pc].grid[nxm%fpat[pc].nr][ny%fpat[pc].nc])
X impl.grid[nxm][ny] = impl.gray;
X else impl.grid[nxm][ny] = mark;
X stack[top][0] = nxm; stack[top++][1] = ny;
X }
X
X if (nx < impl.r2)
X if (impl.grid[nxp][ny] == seedv) {
X if (nxp > amaxx) amaxx = nxp;
X if (fpat[pc].grid[nxp%fpat[pc].nr][ny%fpat[pc].nc])
X impl.grid[nxp][ny] = impl.gray;
X else impl.grid[nxp][ny] = mark;
X stack[top][0] = nxp; stack[top++][1] = ny;
X }
X
X if (ny > 0)
X if (impl.grid[nx][nym] == seedv) {
X if (nym < aminy) aminy = nym;
X if (fpat[pc].grid[nx%fpat[pc].nr][nym%fpat[pc].nc])
X impl.grid[nx][nym] = impl.gray;
X else impl.grid[nx][nym] = mark;
X stack[top][0] = nx; stack[top++][1] = nym;
X }
X
X if (ny < impl.c2)
X if (impl.grid[nx][nyp] == seedv) {
X if (nyp > amaxy) amaxy = nyp;
X if (fpat[pc].grid[nx%fpat[pc].nr][nyp%fpat[pc].nc])
X impl.grid[nx][nyp] = impl.gray;
X else impl.grid[nx][nyp] = mark;
X stack[top][0] = nx; stack[top++][1] = nyp;
X }
X }
X for (nx = aminx; nx <= amaxx; nx++)
X for (ny = aminy; ny <= amaxy; ny++)
X if (impl.grid[nx][ny] == mark) impl.grid[nx][ny] = seedv;
X}
X
X
X/************************************************************************/
X/* pfill: fill a polygon in the bounding box x1, y1, x2, y2, */
X/* the polygon boundary must have been drawn with gray = fill */
X/* NOTE: fill cannot be 0. */
X/************************************************************************/
X
Xpfill(x1,y1,x2,y2,fill)
Xint x1, y1, x2, y2, fill;
X{
X
X int i, j, r, c, nr, nc, pc;
X int r1, c1, r2, c2, rt, ct;
X int negfill;
X
X pc = impl.patc;
X
X /*
X Algorithm:
X Visit the border of the box.
X Set 0 pixels to -fill and stack them.
X Set non-fill pixels negative and stack them.
X
X Run a filling algorithm inside the box and outside the polygon
X Set 0 pixels to -fill.
X Set non-fill pixels negative.
X
X Scan the box.
X Set 0 or positive to fill.
X Set -fill to 0.
X Set negatives to positive
X */
X
X if (fill == 0) {
X fprintf(stderr,"pfill: can't fill a polygon with 0 boundary.\n");
X return(0);
X }
X
X move(x1,y1); r1 = impl.rc; c1 = impl.cc;
X move(x2,y2); r2 = impl.rc; c2 = impl.cc;
X if (r1 > r2) { rt = r1; r1 = r2; r2 = rt; }
X if (c1 > c2) { ct = c1; c1 = c2; c2 = ct; }
X
X negfill = -1 * fill;
X top = 0;
X
X /* Visit the border */
X
X for (i = r1; i <= r2; i++) {
X if (impl.grid[i][c1] == 0) {
X impl.grid[i][c1] = negfill;
X stack[top][0] = i; stack[top++][1] = c1;
X };
X if ((impl.grid[i][c1] != fill) && (impl.grid[i][c1] > 0)) {
X impl.grid[i][c1] *= -1;
X stack[top][0] = i; stack[top++][1] = c1;
X };
X
X if (impl.grid[i][c2] == 0) {
X impl.grid[i][c2] = negfill;
X stack[top][0] = i; stack[top++][1] = c2;
X };
X if ((impl.grid[i][c2] != fill) && (impl.grid[i][c2] > 0)) {
X impl.grid[i][c2] *= -1;
X stack[top][0] = i; stack[top++][1] = c2;
X };
X
X if (top > STACKSIZE) {
X fprintf(stderr,"pfill: fill stack overflow\n");
X exit(1);
X };
X };
X
X for (i = c1; i <= c2; i++) {
X if (impl.grid[r1][i] == 0) {
X impl.grid[r1][i] = negfill;
X stack[top][0] = r1; stack[top++][1] = i;
X };
X if ((impl.grid[r1][i] != fill) && (impl.grid[r1][i] > 0)) {
X impl.grid[r1][i] *= -1;
X stack[top][0] = r1; stack[top++][1] = i;
X };
X
X if (impl.grid[r2][i] == 0) {
X impl.grid[r2][i] = negfill;
X stack[top][0] = r2; stack[top++][1] = i;
X };
X if ((impl.grid[r2][i] != fill) && (impl.grid[r2][i] > 0)) {
X impl.grid[r2][i] *= -1;
X stack[top][0] = r2; stack[top++][1] = i;
X };
X if (top > STACKSIZE) {
X fprintf(stderr,"pfill: fill stack overflow\n");
X exit(1);
X };
X }
X
X /* fill the rest of the outside zeros with negfill */
X
X while (top > 0) {
X top--;
X r = stack[top][0]; c = stack[top][1];
X
X nr = r-1;
X if ((nr >= r1) && (nr <= r2)) {
X if (impl.grid[nr][c] == 0) {
X impl.grid[nr][c] = negfill;
X stack[top][0] = nr; stack[top++][1] = c;
X };
X if ((impl.grid[nr][c] > 0) &&
X (impl.grid[nr][c] != fill)) {
X impl.grid[nr][c] *= -1;
X stack[top][0] = nr; stack[top++][1] = c;
X }
X }
X
X nr = r+1;
X if ((nr >= r1) && (nr <= r2)) {
X if (impl.grid[nr][c] == 0) {
X impl.grid[nr][c] = negfill;
X stack[top][0] = nr; stack[top++][1] = c;
X };
X if ((impl.grid[nr][c] > 0) &&
X (impl.grid[nr][c] != fill)) {
X impl.grid[nr][c] *= -1;
X stack[top][0] = nr; stack[top++][1] = c;
X }
X }
X
X nc = c-1;
X if ((nc >= c1) && (nc <= c2)) {
X if (impl.grid[r][nc] == 0) {
X impl.grid[r][nc] = negfill;
X stack[top][0] = r; stack[top++][1] = nc;
X };
X if ((impl.grid[r][nc] > 0) &&
X (impl.grid[r][nc] != fill)) {
X impl.grid[r][nc] *= -1;
X stack[top][0] = r; stack[top++][1] = nc;
X }
X }
X
X nc = c+1;
X if ((nc >= c1) && (nc <= c2)) {
X if (impl.grid[r][nc] == 0) {
X impl.grid[r][nc] = negfill;
X stack[top][0] = r; stack[top++][1] = nc;
X };
X if ((impl.grid[r][nc] > 0) &&
X (impl.grid[r][nc] != fill)) {
X impl.grid[r][nc] *= -1;
X stack[top][0] = r; stack[top++][1] = nc;
X }
X }
X if (top > STACKSIZE) {
X fprintf(stderr,"pfill: fill stack overflow\n");
X exit(1);
X }
X }
X
X
X /* scan the box */
X for (i = r1; i <= r2; i++)
X for (j = c1; j <= c2; j++)
X if (impl.grid[i][j] >= 0) {
X if (fpat[pc].grid[i%fpat[pc].nr][j%fpat[pc].nc])
X impl.grid[i][j] = impl.gray;
X else if (impl.grid[i][j] == fill)
X impl.grid[i][j] = impl.gray;
X }
X else if (impl.grid[i][j] == negfill) impl.grid[i][j] = 0;
X else if (impl.grid[i][j] < 0) impl.grid[i][j] *= -1;
X}
X
Xcomment(str)
Xchar *str;
X{
X}
X
Xdonelabel()
X{
X}
!FUNKY!STUFF!
echo
echo finished part 6 of 8majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 7 of 8
echo
echo installing directory test
echo
mkdir test
cd test
#
echo extracting file README
sed 's/^X//' > README <<'!FUNKY!STUFF!'
XThis directory contains a few sample plot files. They are all in text
Xformat. To convert them to real plot file format, run them through txpl.
XSince txpl is fast, I usually leave plot files in text format and pipe
Xthe text forms through when I want to plot them. For example:
X
X% txpl fubar | rplot -r 256 -c 256 > fu.r
X
XNot all the fonts called for by these plot files exist! You will have to
Xfool around with the Hershey fonts and drag them out. See the README file
Xin ../vfont.
X
XThe files are:
X
Xafrica Outline of african continent
Xfc.roman Roman fonts
Xfubar Wall plate
Xgraph1 A scatterplot
Xgraph2 An X-Y line plot
Xhappy Example fill pattern
Xspline b-spline Africa outline
Xtestp Test pattern: A bit of everything
Xyinyang Yin-Yang symbol in red and white
!FUNKY!STUFF!
echo extracting file africa
sed 's/^X//' > africa <<'!FUNKY!STUFF!'
Xspace 0 0 115 116 0
Xbppin 8
Xgray 255
Xchain 238
X 51 19
X 52 16
X 52 14
X 51 13
X 50 12
X 49 11
X 49 9
X 48 8
X 46 6
X 44 5
X 43 4
X 41 2
X 39 0
X 37 1
X 36 0
X 35 1
X 34 2
X 32 2
X 31 3
X 29 3
X 28 2
X 26 3
X 24 2
X 23 3
X 21 5
X 20 7
X 18 8
X 16 9
X 15 10
X 14 12
X 14 14
X 13 15
X 13 16
X 12 17
X 11 17
X 9 17
X 8 18
X 6 19
X 5 20
X 5 22
X 4 23
X 3 24
X 2 25
X 3 26
X 3 28
X 3 29
X 3 30
X 3 32
X 2 33
X 2 34
X 1 35
X 1 37
X 1 39
X 0 41
X 1 42
X 0 43
X 0 45
X 1 46
X 0 48
X 1 49
X 3 50
X 4 49
X 5 48
X 7 49
X 7 51
X 7 53
X 7 55
X 8 56
X 9 57
X 10 58
X 10 60
X 11 61
X 10 63
X 8 62
X 7 63
X 7 66
X 8 67
X 8 69
X 8 70
X 9 71
X 9 73
X 10 74
X 10 76
X 10 78
X 9 80
X 10 82
X 12 82
X 14 83
X 15 84
X 16 85
X 18 85
X 18 86
X 20 87
X 22 88
X 23 90
X 24 91
X 26 91
X 28 92
X 30 92
X 31 94
X 32 95
X 34 95
X 35 97
X 36 98
X 37 99
X 38 100
X 39 101
X 40 103
X 41 102
X 42 103
X 43 104
X 42 106
X 42 108
X 41 110
X 41 112
X 40 114
X 41 116
X 43 116
X 44 115
X 46 115
X 47 114
X 48 113
X 50 113
X 51 112
X 52 111
X 53 110
X 54 109
X 56 107
X 57 105
X 58 104
X 59 102
X 61 102
X 61 100
X 62 100
X 63 99
X 64 98
X 65 98
X 66 96
X 68 95
X 70 95
X 71 96
X 73 96
X 75 96
X 77 98
X 78 97
X 80 98
X 81 97
X 83 97
X 84 98
X 85 97
X 86 95
X 87 94
X 88 93
X 88 91
X 90 91
X 90 89
X 91 88
X 93 87
X 94 88
X 96 88
X 98 87
X 100 87
X 100 85
X 100 83
X 102 83
X 103 82
X 105 82
X 107 80
X 108 79
X 109 78
X 111 77
X 111 75
X 112 74
X 113 73
X 114 72
X 114 70
X 114 68
X 114 66
X 114 64
X 115 63
X 114 62
X 114 60
X 112 60
X 110 60
X 109 59
X 108 58
X 106 58
X 105 57
X 104 56
X 102 54
X 101 54
X 99 54
X 97 54
X 95 54
X 94 53
X 93 52
X 91 51
X 90 50
X 89 49
X 87 49
X 85 49
X 83 50
X 81 50
X 80 51
X 79 52
X 77 52
X 75 52
X 74 51
X 73 51
X 71 51
X 69 50
X 67 50
X 66 48
X 65 47
X 64 46
X 62 45
X 61 43
X 60 44
X 59 45
X 57 45
X 55 45
X 54 46
X 53 45
X 52 43
X 52 41
X 53 40
X 52 38
X 50 37
X 49 36
X 49 34
X 49 32
X 49 30
X 50 28
X 51 27
X 51 25
X 51 23
X 51 21
X 51 19
!FUNKY!STUFF!
echo extracting file fc.roman
sed 's/^X//' > fc.roman <<'!FUNKY!STUFF!'
Xspace 0 0 1859 1859 0
Xfspec 1.0 1.0 1.5707963267
Xmove 0 0
Xcont 1859 0
Xcont 1859 1859
Xcont 0 1859
Xcont 0 0
Xline 0 929 1859 929
Xline 929 0 929 1859
X
Xspace -9 -9 609 609 0
Xfont sr
Xmove 0 0
Xlabel Simplex Roman
Xmove 55 0
Xlabel !"#$%&^|()[]`'@
Xmove 90 0
Xlabel <>{}*+-=.,:;?/
Xmove 125 0
Xlabel 0123456789\~
Xmove 160 0
Xlabel ABCDEFGHIJKLM
Xmove 195 0
Xlabel NOPQRSTUVWXYZ
Xmove 230 0
Xlabel abcdefghijklm
Xmove 265 0
Xlabel nopqrstuvwxyz
X
Xspace -9 -319 609 299 0
Xfont dr
Xmove 0 0
Xlabel Duplex Roman
Xmove 55 0
Xlabel !"#$%&^|()[]`'@
Xmove 90 0
Xlabel <>{}*+-=.,:;?/
Xmove 125 0
Xlabel 0123456789\~
Xmove 160 0
Xlabel ABCDEFGHIJKLM
Xmove 195 0
Xlabel NOPQRSTUVWXYZ
Xmove 230 0
Xlabel abcdefghijklm
Xmove 265 0
Xlabel nopqrstuvwxyz
X
Xspace -319 -9 299 609 0
Xfont cr
Xmove 0 0
Xlabel Complex Roman
Xmove 55 0
Xlabel !"#$%&^|()[]`'@
Xmove 90 0
Xlabel <>{}*+-=.,:;?/
Xmove 125 0
Xlabel 0123456789\~
Xmove 160 0
Xlabel ABCDEFGHIJKLM
Xmove 195 0
Xlabel NOPQRSTUVWXYZ
Xmove 230 0
Xlabel abcdefghijklm
Xmove 265 0
Xlabel nopqrstuvwxyz
X
Xspace -319 -319 299 299 0
Xfont tr
Xmove 0 0
Xlabel Triplex Roman
Xmove 55 0
Xlabel !"#$%&^|()[]`'@
Xmove 90 0
Xlabel <>{}*+-=.,:;?/
Xmove 125 0
Xlabel 0123456789\~
Xmove 160 0
Xlabel ABCDEFGHIJKLM
Xmove 195 0
Xlabel NOPQRSTUVWXYZ
Xmove 230 0
Xlabel abcdefghijklm
Xmove 265 0
Xlabel nopqrstuvwxyz
!FUNKY!STUFF!
echo extracting file fubar
sed 's/^X//' > fubar <<'!FUNKY!STUFF!'
Xspace 0 0 199 199 0
Xcolour 0 255 0
Xmove 0 0
Xcont 0 199
Xcont 199 199
Xcont 199 0
Xcont 0 0
Xmove 2 2
Xcont 2 197
Xcont 197 197
Xcont 197 2
Xcont 2 2
Xmove 4 4
Xcont 4 195
Xcont 195 195
Xcont 195 4
Xcont 4 4
Xcolour 255 0 255
Xspace 0 0 105 215 0
Xmove 10 10
Xfont ge
Xfspec 2.2 1.5 1.5707963
Xlabel Es
Xmoverel 0 25
Xlabel ist
Xmove 50 10
Xfspec 2.1 2.0 1.5707963
Xlabel Fubar
!FUNKY!STUFF!
echo extracting file graph1
sed 's/^X//' > graph1 <<'!FUNKY!STUFF!'
Xspace -200 1100 1100 -200 1
Xbppin 8
Xgray 255
Xfont sr
Xline 0 0 1000 0
Xline 0 0 0 1000
Xfspec 3.000000 3.000000 0.000000
Xmove 250 -135
Xlabel Chroma X
Xfspec 3.000000 3.000000 1.570796
Xmove -195 250
Xlabel Chroma Y
Xfspec 1.000000 1.000000 1.570796
Xline -30 0 0 0
Xmove -80 -28
Xlabel 0.15
Xline -30 399 0 399
Xmove -80 371
Xlabel 0.25
Xline -30 799 0 799
Xmove -80 771
Xlabel 0.35
Xline -10 0 0 0
Xline -10 39 0 39
Xline -10 79 0 79
Xline -10 119 0 119
Xline -10 159 0 159
Xline -10 199 0 199
Xline -10 239 0 239
Xline -10 279 0 279
Xline -10 319 0 319
Xline -10 359 0 359
Xline -10 399 0 399
Xline -10 439 0 439
Xline -10 479 0 479
Xline -10 519 0 519
Xline -10 559 0 559
Xline -10 599 0 599
Xline -10 639 0 639
Xline -10 680 0 680
Xline -10 720 0 720
Xline -10 760 0 760
Xline -10 800 0 800
Xline -10 840 0 840
Xline -10 880 0 880
Xline -10 920 0 920
Xline -10 960 0 960
Xfspec 1.000000 1.000000 0.000000
Xline 0 -30 0 0
Xmove -28 -50
Xlabel 0.50
Xline 400 -30 400 0
Xmove 372 -50
Xlabel 0.60
Xline 800 -30 800 0
Xmove 772 -50
Xlabel 0.70
Xline 0 -10 0 0
Xline 39 -10 39 0
Xline 79 -10 79 0
Xline 119 -10 119 0
Xline 159 -10 159 0
Xline 199 -10 199 0
Xline 239 -10 239 0
Xline 279 -10 279 0
Xline 319 -10 319 0
Xline 359 -10 359 0
Xline 399 -10 399 0
Xline 439 -10 439 0
Xline 479 -10 479 0
Xline 519 -10 519 0
Xline 559 -10 559 0
Xline 599 -10 599 0
Xline 639 -10 639 0
Xline 679 -10 679 0
Xline 719 -10 719 0
Xline 759 -10 759 0
Xline 799 -10 799 0
Xline 839 -10 839 0
Xline 879 -10 879 0
Xline 919 -10 919 0
Xline 959 -10 959 0
Xline 999 -10 999 0
Xpoint 698 279
Xpoint 807 218
Xpoint 666 294
Xpoint 683 274
Xpoint 686 288
Xpoint 758 251
Xpoint 731 246
Xpoint 824 231
Xpoint 676 270
Xpoint 795 226
Xpoint 222 531
Xpoint 218 576
Xpoint 812 239
Xpoint 729 255
Xpoint 797 267
Xpoint 811 231
Xpoint 757 277
Xpoint 694 270
Xpoint 787 248
Xpoint 741 246
Xpoint 792 253
Xpoint 796 258
Xpoint 804 245
Xpoint 710 259
Xpoint 799 239
Xpoint 699 309
Xpoint 659 348
Xpoint 757 269
Xpoint 780 261
Xpoint 691 275
Xpoint 715 277
Xpoint 772 282
Xpoint 774 257
Xpoint 766 284
Xpoint 753 256
Xpoint 745 266
Xpoint 730 322
Xpoint 755 306
Xpoint 765 248
Xpoint 763 265
Xpoint 725 331
Xpoint 744 326
Xpoint 693 353
Xpoint 720 341
Xpoint 715 339
Xpoint 735 324
Xpoint 762 274
Xpoint 505 361
Xpoint 725 319
Xpoint 768 269
Xpoint 762 281
Xpoint 756 292
Xpoint 739 310
Xpoint 739 324
Xpoint 690 363
Xpoint 695 365
Xpoint 733 334
Xpoint 701 366
Xpoint 710 348
Xpoint 769 261
Xpoint 716 350
Xpoint 762 255
Xpoint 475 350
Xpoint 659 293
Xpoint 772 226
Xpoint 776 248
Xpoint 804 214
Xpoint 719 272
Xpoint 740 248
Xpoint 785 257
Xpoint 767 278
Xpoint 778 244
Xpoint 794 233
Xpoint 819 204
Xpoint 673 298
Xpoint 442 361
Xpoint 778 270
Xpoint 757 269
Xpoint 748 254
Xpoint 772 273
Xpoint 380 421
Xpoint 779 233
Xpoint 438 413
Xpoint 777 277
Xpoint 440 392
Xpoint 750 244
Xpoint 410 401
Xpoint 440 392
Xpoint 673 268
Xpoint 470 403
Xpoint 735 254
Xpoint 407 433
Xpoint 737 244
Xpoint 707 264
Xpoint 723 254
Xpoint 771 240
Xpoint 757 250
Xpoint 742 260
Xpoint 630 331
Xpoint 770 250
Xpoint 637 334
Xpoint 785 240
Xpoint 678 337
Xpoint 681 358
Xpoint 639 394
Xpoint 794 223
Xpoint 799 230
Xpoint 814 229
Xpoint 808 213
Xpoint 843 209
Xpoint 829 219
Xpoint 833 226
Xpoint 840 201
Xpoint 827 211
Xpoint 804 236
Xpoint 772 231
Xpoint 677 267
Xpoint 751 255
Xpoint 809 242
Xpoint 298 549
Xpoint 229 559
Xpoint 250 570
Xpoint 671 280
Xpoint 813 220
Xpoint 719 278
Xpoint 683 339
Xpoint 706 332
Xpoint 653 384
Xpoint 669 390
Xpoint 680 367
Xpoint 225 545
Xpoint 674 379
Xpoint 752 246
Xpoint 244 542
Xpoint 694 357
Xpoint 847 216
Xpoint 618 303
Xpoint 774 276
Xpoint 218 516
Xpoint 726 264
Xpoint 248 497
Xpoint 824 242
Xpoint 664 279
Xpoint 763 256
Xpoint 739 255
Xpoint 795 243
Xpoint 702 273
Xpoint 816 219
Xpoint 777 237
Xpoint 764 246
Xpoint 770 252
Xpoint 666 292
Xpoint 757 261
Xpoint 651 287
Xpoint 746 241
Xpoint 633 308
Xpoint 599 309
Xpoint 631 294
Xpoint 653 301
Xpoint 601 323
Xpoint 658 288
Xpoint 627 306
Xpoint 644 286
Xpoint 725 259
Xpoint 639 298
Xpoint 729 273
Xpoint 671 283
Xpoint 783 234
Xpoint 716 275
Xpoint 704 267
Xpoint 699 295
Xpoint 697 263
Xpoint 741 264
Xpoint 747 251
Xpoint 728 251
Xpoint 173 752
Xpoint 170 746
Xpoint 161 757
Xpoint 168 743
!FUNKY!STUFF!
echo extracting file graph2
sed 's/^X//' > graph2 <<'!FUNKY!STUFF!'
Xspace 0 32 256 0 1
Xfspec 1.000000 1.000000 0.000000
Xline 0 0 0 28
Xline 0 0 256 0
Xchain 128
X 0 7
X 2 0
X 4 0
X 6 0
X 8 0
X 10 0
X 12 0
X 14 0
X 16 0
X 18 0
X 20 0
X 22 0
X 24 0
X 26 1
X 28 2
X 30 3
X 32 4
X 34 4
X 36 4
X 38 4
X 40 4
X 42 4
X 44 3
X 46 4
X 48 4
X 50 4
X 52 4
X 54 4
X 56 4
X 58 4
X 60 4
X 62 4
X 64 5
X 66 4
X 68 5
X 70 6
X 72 6
X 74 6
X 76 7
X 78 9
X 80 13
X 82 13
X 84 15
X 86 19
X 88 24
X 90 26
X 92 28
X 94 25
X 96 20
X 98 16
X 100 13
X 102 13
X 104 16
X 106 18
X 108 16
X 110 13
X 112 13
X 114 11
X 116 9
X 118 9
X 120 9
X 122 12
X 124 13
X 126 16
X 128 12
X 130 12
X 132 11
X 134 11
X 136 12
X 138 15
X 140 20
X 142 21
X 144 18
X 146 17
X 148 18
X 150 17
X 152 15
X 154 13
X 156 14
X 158 15
X 160 15
X 162 15
X 164 14
X 166 14
X 168 12
X 170 11
X 172 9
X 174 8
X 176 7
X 178 5
X 180 5
X 182 5
X 184 5
X 186 4
X 188 4
X 190 4
X 192 4
X 194 4
X 196 4
X 198 4
X 200 3
X 202 3
X 204 3
X 206 3
X 208 3
X 210 3
X 212 3
X 214 2
X 216 3
X 218 2
X 220 2
X 222 2
X 224 2
X 226 1
X 228 2
X 230 1
X 232 1
X 234 1
X 236 1
X 238 1
X 240 1
X 242 1
X 244 1
X 246 1
X 248 0
X 250 0
X 252 0
X 254 0
!FUNKY!STUFF!
echo extracting file happy
sed 's/^X//' > happy <<'!FUNKY!STUFF!'
Xspace 0 0 115 116 0
Xgray 255
Xfillpat 1 32 32
X............1111111.............
X.........1111111111111..........
X.......11111.......11111........
X......111.............111.......
X.....111...............111......
X....11...................11.....
X...11.....................11....
X..111.....................111...
X..11.......................11...
X.11.........................11..
X.11......111.......111......11..
X.11......111.......111......11..
X11.......111.......111.......11.
X11...........................11.
X11...........................11.
X11...........................11.
X11...........................11.
X11...........................11.
X11...........................11.
X.11......11.........11......11..
X.11......11.........11......11..
X.11......111.......111......11..
X..11......111.....111......11...
X..111......111111111......111...
X...11.......1111111.......11....
X....11...................11.....
X.....111...............111......
X......111.............111.......
X.......11111.......11111........
X.........1111111111111..........
X............1111111.............
X................................
Xsetpat 1
Xpolygon 60
X 51 19
X 50 12
X 46 6
X 39 0
X 34 2
X 28 2
X 21 5
X 15 10
X 13 16
X 8 18
X 4 23
X 3 28
X 2 33
X 1 39
X 0 45
X 3 50
X 7 51
X 9 57
X 10 63
X 8 67
X 9 73
X 9 80
X 15 84
X 20 87
X 26 91
X 32 95
X 37 99
X 41 102
X 42 108
X 41 116
X 47 114
X 52 111
X 57 105
X 61 100
X 65 98
X 71 96
X 78 97
X 84 98
X 88 93
X 91 88
X 98 87
X 102 83
X 108 79
X 112 74
X 114 68
X 114 62
X 109 59
X 104 56
X 97 54
X 91 51
X 85 49
X 79 52
X 73 51
X 66 48
X 61 43
X 52 41
X 49 36
X 50 28
X 51 21
X 51 19
Xchain 60
X 51 19
X 50 12
X 46 6
X 39 0
X 34 2
X 28 2
X 21 5
X 15 10
X 13 16
X 8 18
X 4 23
X 3 28
X 2 33
X 1 39
X 0 45
X 3 50
X 7 51
X 9 57
X 10 63
X 8 67
X 9 73
X 9 80
X 15 84
X 20 87
X 26 91
X 32 95
X 37 99
X 41 102
X 42 108
X 41 116
X 47 114
X 52 111
X 57 105
X 61 100
X 65 98
X 71 96
X 78 97
X 84 98
X 88 93
X 91 88
X 98 87
X 102 83
X 108 79
X 112 74
X 114 68
X 114 62
X 109 59
X 104 56
X 97 54
X 91 51
X 85 49
X 79 52
X 73 51
X 66 48
X 61 43
X 52 41
X 49 36
X 50 28
X 51 21
X 51 19
!FUNKY!STUFF!
echo extracting file spline
sed 's/^X//' > spline <<'!FUNKY!STUFF!'
Xspace 0 0 115 116 0
Xbppin 8
Xgray 128
Xchain 34
X 94 52
X 85 49
X 79 52
X 66 48
X 61 43
X 52 41
X 49 36
X 51 19
X 46 6
X 39 0
X 28 2
X 15 10
X 13 16
X 4 23
X 0 45
X 3 50
X 7 51
X 10 63
X 8 67
X 9 80
X 37 99
X 41 116
X 52 111
X 61 100
X 71 96
X 84 98
X 91 88
X 98 87
X 108 79
X 112 74
X 114 68
X 114 62
X 103 55
X 94 52
Xgray 255
Xbspline 4 34
X 94 52
X 85 49
X 79 52
X 66 48
X 61 43
X 52 41
X 49 36
X 51 19
X 46 6
X 39 0
X 28 2
X 15 10
X 13 16
X 4 23
X 0 45
X 3 50
X 7 51
X 10 63
X 8 67
X 9 80
X 37 99
X 41 116
X 52 111
X 61 100
X 71 96
X 84 98
X 91 88
X 98 87
X 108 79
X 112 74
X 114 68
X 114 62
X 103 55
X 94 52
!FUNKY!STUFF!
echo extracting file testp
sed 's/^X//' > testp <<'!FUNKY!STUFF!'
Xcomment test pattern
X
Xspace 0 0 100 200 0
Xbppin 3
Xfont sr
Xfspec 1.000000 1.000000 1.570796
Xcolour 7 7 7
Xpensize 8
Xmove 10 10
Xlabel Hello World
Xgray 0
Xcomment erase
Xpensize 1
Xgray 7
X
Xspace 0 0 99 99 0
Xarc 49 49 9 49 49 89
Xcolour 7 0 0
Xcircle 49 49 9
Xcolour 0 7 0
Xcircle 49 49 19
Xcolour 0 0 7
Xcircle 49 49 29
Xgray 1
Xline 0 9 99 9
Xgray 2
Xline 0 19 99 19
Xgray 3
Xline 0 29 99 29
Xgray 4
Xline 0 39 99 39
Xgray 5
Xline 0 49 99 49
Xgray 6
Xline 0 59 99 59
Xgray 7
Xline 0 69 99 69
Xcolour 7 0 0
Xline 9 0 9 99
Xcolour 0 7 0
Xline 19 0 19 99
Xcolour 0 0 7
Xline 29 0 29 99
Xcolour 7 7 0
Xline 39 0 39 99
Xcolour 7 0 7
Xline 49 0 49 99
Xcolour 0 7 7
Xline 59 0 59 99
Xcolour 7 7 7
Xline 69 0 69 99
Xmove 0 0
Xcont 99 0
Xcont 99 99
Xcont 0 99
Xcont 0 0
Xline 0 0 99 99
Xmove 0 0
Xmoverel 85 4
Xcontrel 10 0
Xcontrel 0 10
Xcontrel -10 0
Xcontrel 0 -10
Xmove 85 14
Xcontrel 10 -10
Xpoint 79 5
Xpoint 79 10
Xpoint 79 15
Xpoint 79 20
Xpoint 79 25
Xpoint 79 30
Xpoint 79 35
Xpoint 79 40
Xpoint 79 45
Xpoint 79 50
Xpoint 79 55
Xpoint 79 60
Xpoint 79 65
Xpoint 79 70
Xpoint 79 75
Xpoint 79 80
Xpoint 79 85
Xpoint 79 90
Xpoint 79 95
!FUNKY!STUFF!
echo extracting file yinyang
sed 's/^X//' > yinyang <<'!FUNKY!STUFF!'
Xcomment the classic yin/yang symbol
Xspace -256 255 255 -256 1
Xcolour 255 255 255
Xarc 0 0 0 -256 0 255
Xarc 0 -127 0 -256 0 0
Xcircle 0 -127 10
Xarea 0 -127
Xcolour 255 0 0
Xarc 0 0 0 255 0 -256
Xarc 0 127 0 255 0 0
Xcircle 0 127 10
Xarea 0 127
Xarea 0 -240
Xcolour 255 255 255
Xarea 0 240
!FUNKY!STUFF!
cd ..
echo
echo finished installing directory test
echo
echo finished part 7 of 8majka@ubc-vision.UUCP (Marc Majka) (04/28/86)
- - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - - CUT - - -
#!/bin/sh
#
# shell archive - extract with /bin/sh
#
echo Plot archive part 8 of 8
echo
echo installing directory vfont
echo
mkdir vfont
cd vfont
echo extracting file README
sed 's/^X//' > README <<'!FUNKY!STUFF!'
XThis directory contains, in text form, a single vector font for drawing
Xlabels. This font must be run through mkfont to be of any use. i.e, from
Xthe parent directory:
X
X% mkfont vfont/sr.e vfont/sr
X
XThis font is derived from the Hershey fonts recently distributed in
Xmod.sources. Other "fonts" may be created with the programs hform and
Xhfont. hform reads, on standard input, the entire set of hersh.oc[1234]
Xfiles from that distribution, and creates two files in this directory. The
Xfile hf.table will contain a list of the Hershey "glyph numbers", and a
Xcharacter offset into the second file. The second file contains, for each
Xglyph, a list of relative moves and draws for rendering that glyph.
X
X% cat /wherever/you/put/the/hershey/fonts/hersh.oc[1234] | hform
X
XThe program hfont reads a list of char - glyph number pairs, and constructs
Xa font file in the format expected by the plot routines. Included in this
Xdirectory are a number of input files to hfont to create some useful fonts.
XFor example, To create a "Simplex Greek" font, run the command (from the
Xparent of this directory):
X
X% hfont < vfont/mk.sg > vfont/sg
X
XThe mk.* files in tis directory are:
X
Xmk.cg Complex Greek
Xmk.ci Complex Italic
Xmk.cr Complex Roman
Xmk.cs Complex Script
Xmk.dr Duplex Roman
Xmk.ge Gothic English
Xmk.gg Gothic German
Xmk.gi Gothic Italian
Xmk.sg Simplex Greek
Xmk.ss Simplex Script
Xmk.ti Triplex Italic
Xmk.tr Triplex Roman
X
XYou can make your own fonts, including any of the Hershey glyphs, by running
Xhfont with an input file with the format:
X%d %d
Xchar glyphno
Xchar glyphno
Xchar glyphno
Xchar glyphno
Xchar glyphno
X.
X.
X.
X
XThe first line must contain two integer values (may be 0) which are
Xcoordinate system offsets for the characters. Each successive line must be
Xa single character, followed by 1 space, followed by an integer. The
Xcharacter may be any ascii character. The integer is the glyph number. The
Xnew font created by hfont will cause the indicated glyph to be drawn in
Xplace of the given character in plotted labels. hfont is reasonably fast,
Xso don't hesitate to experiment.
X
XThe program hcat will produce a set of 25 plot files. Each file is a page
Xof a Hersey font catalogue.
!FUNKY!STUFF!
echo extracting file FORMAT
sed 's/^X//' > FORMAT <<'!FUNKY!STUFF!'
XFonts in this directory are stored in a two-part format. The first part of
Xthe file is a list of (character index) pairs. The second is a list of plot
Xcommands for each character in the font, separated by null (0) characters.
XThe x and y coordinates are signed 8 bit values.
X
XThe character is in one byte, in ASCII. The index is a 4 byte integer. The
Xindex is a pointer into the plot list. The two parts of the file are
Xseparated by a null (0) character.
X
XThe font can be read in C with:
X
Xreadfont(fontfp,clist,cindex,plist)
X
XFILE *fontfp;
Xchar *clist;
Xint *cindex;
Xchar *plist;
X
X{
X char c; /* input character */
X int cnum; /* character number */
X int i; /* counter */
X
X cnum = 0;
X i = 0;
X
X /* read the character index */
X
X fread (&c, 1, 1, fontfp);
X while (c != '\0') {
X clist[cnum] = c;
X fread (&cindex[cnum++], 4, 1, fontfp);
X fread (&c, 1, 1, fontfp);
X }
X
X /* read the list of plot commands */
X while (fread(&plist[i++], 1, 1, fontfp));
X
X}
X
XOnly moverel (M) and contrel(N) plot commands are used for the characters.
XFor example, the character F in the simplex roman font would comprise the
Xplot commands:
X
Xmoverel 4 0
Xcontrel 0 -21
Xmoverel 0 21
Xcontrel 13 0
Xmoverel -13 -10
Xcontrel 8 0
Xmoverel 6 10
X
XTo plot a character use the following algorithm:
X
X1: scan down clist for the desired character
X2: get the plotlist pointer from the corresponding cindex location
X3: scan plist from the pointer location until a null character, executing
X the plot commands.
X
XA C routine to accomplish this is given below.
X
Xplotchar(c,clist,cindex,plist)
Xchar c, *clist;
Xint *cindex;
Xchar *plist;
X{
X int i;
X short x, y;
X
X /* find the character */
X for (i = 0; ((clist[i] != '\0') && (clist[i] != c)) i++);
X
X if (clist[i] == '\0') return(0); /* character not in font */
X
X /* scan down the list to a null character */
X while (plist[i] != '\0') {
X
X /* get the x and y values from the 2nd and 3rd bytes */
X x = (short)plist[i+1];
X y = (short)plist[i+2];
X
X /* determine the type of plot command by the first byte */
X if (plist[i] == 'M') moverel(x,y);
X else contrel(x,y);
X
X /* increment i for the next 3 byte instruction */
X i += 3;
X }
X}
!FUNKY!STUFF!
echo extracting file mk.cg
sed 's/^X//' > mk.cg <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 2714
X" 2728
X# 2275
X$ 2274
X% 2271
X& 2272
X^ 2247
X| 2229
X( 1403
X) 1404
X[ 1405
X] 1406
X` 2253
X' 2251
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 2219
X+ 2232
X- 2231
X= 2238
X. 2210
X, 2211
X: 2212
X; 2213
X? 2215
X/ 2220
X0 2200
X1 2201
X2 2202
X3 2203
X4 2204
X5 2205
X6 2206
X7 2207
X8 2208
X9 2209
X\ 804
X~ 2246
XA 2027
XB 2028
XC 2029
XD 2030
XE 2031
XF 2032
XG 2033
XH 2034
XI 2035
XK 2036
XL 2037
XM 2038
XN 2039
XQ 2040
XO 2041
XP 2042
XR 2043
XS 2044
XT 2045
XV 2046
XW 2047
XX 2048
XY 2049
XZ 2050
Xa 2127
Xb 2128
Xc 2129
Xd 2130
Xe 2131
Xf 2132
Xg 2133
Xh 2134
Xi 2135
Xk 2136
Xl 2137
Xm 2138
Xn 2139
Xq 2140
Xo 2141
Xp 2142
Xr 2143
Xs 2144
Xt 2145
Xv 2146
Xw 2147
Xx 2148
Xy 2149
Xz 2150
!FUNKY!STUFF!
echo extracting file mk.ci
sed 's/^X//' > mk.ci <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 2764
X" 2778
X# 2275
X$ 2769
X% 2271
X& 2768
X^ 2247
X| 2229
X( 2771
X) 2772
X[ 1405
X] 1406
X` 2766
X' 2767
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 2773
X+ 2775
X- 2774
X= 2776
X. 2760
X, 2761
X: 2762
X; 2763
X? 2765
X/ 2770
X0 2750
X1 2751
X2 2752
X3 2753
X4 2754
X5 2755
X6 2756
X7 2757
X8 2758
X9 2759
X\ 804
X~ 2246
XA 2051
XB 2052
XC 2053
XD 2054
XE 2055
XF 2056
XG 2057
XH 2058
XI 2059
XJ 2060
XK 2061
XL 2062
XM 2063
XN 2064
XO 2065
XP 2066
XQ 2067
XR 2068
XS 2069
XT 2070
XU 2071
XV 2072
XW 2073
XX 2074
XY 2075
XZ 2076
Xa 2151
Xb 2152
Xc 2153
Xd 2154
Xe 2155
Xf 2156
Xg 2157
Xh 2158
Xi 2159
Xj 2160
Xk 2161
Xl 2162
Xm 2163
Xn 2164
Xo 2165
Xp 2166
Xq 2167
Xr 2168
Xs 2169
Xt 2170
Xu 2171
Xv 2172
Xw 2173
Xx 2174
Xy 2175
Xz 2176
!FUNKY!STUFF!
echo extracting file mk.cr
sed 's/^X//' > mk.cr <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 2714
X" 2728
X# 2275
X$ 2274
X% 2271
X& 2272
X^ 2247
X| 2229
X( 1403
X) 1404
X[ 1405
X] 1406
X` 2253
X' 2251
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 2219
X+ 2725
X- 2724
X= 2726
X. 2210
X, 2211
X: 2212
X; 2213
X? 2215
X/ 2720
X0 2200
X1 2201
X2 2202
X3 2203
X4 2204
X5 2205
X6 2206
X7 2207
X8 2208
X9 2209
X\ 804
X~ 2246
XA 2001
XB 2002
XC 2003
XD 2004
XE 2005
XF 2006
XG 2007
XH 2008
XI 2009
XJ 2010
XK 2011
XL 2012
XM 2013
XN 2014
XO 2015
XP 2016
XQ 2017
XR 2018
XS 2019
XT 2020
XU 2021
XV 2022
XW 2023
XX 2024
XY 2025
XZ 2026
Xa 2101
Xb 2102
Xc 2103
Xd 2104
Xe 2105
Xf 2106
Xg 2107
Xh 2108
Xi 2109
Xj 2110
Xk 2111
Xl 2112
Xm 2113
Xn 2114
Xo 2115
Xp 2116
Xq 2117
Xr 2118
Xs 2119
Xt 2120
Xu 2121
Xv 2122
Xw 2123
Xx 2124
Xy 2125
Xz 2126
!FUNKY!STUFF!
echo extracting file mk.cs
sed 's/^X//' > mk.cs <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 2764
X" 2778
X# 2275
X$ 2769
X% 2271
X& 2768
X^ 2247
X| 2229
X( 2771
X) 2772
X[ 1405
X] 1406
X` 2766
X' 2767
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 2773
X+ 2775
X- 2774
X= 2776
X. 2760
X, 2761
X: 2762
X; 2763
X? 2765
X/ 2770
X0 2750
X1 2751
X2 2752
X3 2753
X4 2754
X5 2755
X6 2756
X7 2757
X8 2758
X9 2759
X\ 804
X~ 2246
XA 2551
XB 2552
XC 2553
XD 2554
XE 2555
XF 2556
XG 2557
XH 2558
XI 2559
XJ 2560
XK 2561
XL 2562
XM 2563
XN 2564
XO 2565
XP 2566
XQ 2567
XR 2568
XS 2569
XT 2570
XU 2571
XV 2572
XW 2573
XX 2574
XY 2575
XZ 2576
Xa 2651
Xb 2652
Xc 2653
Xd 2654
Xe 2655
Xf 2656
Xg 2657
Xh 2658
Xi 2659
Xj 2660
Xk 2661
Xl 2662
Xm 2663
Xn 2664
Xo 2665
Xp 2666
Xq 2667
Xr 2668
Xs 2669
Xt 2670
Xu 2671
Xv 2672
Xw 2673
Xx 2674
Xy 2675
Xz 2676
!FUNKY!STUFF!
echo extracting file mk.dr
sed 's/^X//' > mk.dr <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 2714
X" 2728
X# 2275
X$ 2719
X% 2271
X& 2718
X^ 2247
X| 2229
X( 2721
X) 2722
X[ 1405
X] 1406
X` 2716
X' 2717
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 2723
X+ 2725
X- 2724
X= 2726
X. 2710
X, 2711
X: 2712
X; 2713
X? 2715
X/ 2720
X0 2700
X1 2701
X2 2702
X3 2703
X4 2704
X5 2705
X6 2706
X7 2707
X8 2708
X9 2709
X\ 804
X~ 2246
XA 2501
XB 2502
XC 2503
XD 2504
XE 2505
XF 2506
XG 2507
XH 2508
XI 2509
XJ 2510
XK 2511
XL 2512
XM 2513
XN 2514
XO 2515
XP 2516
XQ 2517
XR 2518
XS 2519
XT 2520
XU 2521
XV 2522
XW 2523
XX 2524
XY 2525
XZ 2526
Xa 2601
Xb 2602
Xc 2603
Xd 2604
Xe 2605
Xf 2606
Xg 2607
Xh 2608
Xi 2609
Xj 2610
Xk 2611
Xl 2612
Xm 2613
Xn 2614
Xo 2615
Xp 2616
Xq 2617
Xr 2618
Xs 2619
Xt 2620
Xu 2621
Xv 2622
Xw 2623
Xx 2624
Xy 2625
Xz 2626
!FUNKY!STUFF!
echo extracting file mk.ge
sed 's/^X//' > mk.ge <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 3714
X" 3728
X# 2275
X$ 3719
X% 2271
X& 3718
X^ 2247
X| 2229
X( 3721
X) 3722
X[ 1405
X] 1406
X` 3716
X' 3717
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 3723
X+ 3725
X- 3724
X= 3726
X. 3710
X, 3711
X: 3712
X; 3713
X? 3715
X/ 3720
X0 3700
X1 3701
X2 3702
X3 3703
X4 3704
X5 3705
X6 3706
X7 3707
X8 3708
X9 3709
X\ 804
X~ 2246
XA 3501
XB 3502
XC 3503
XD 3504
XE 3505
XF 3506
XG 3507
XH 3508
XI 3509
XJ 3510
XK 3511
XL 3512
XM 3513
XN 3514
XO 3515
XP 3516
XQ 3517
XR 3518
XS 3519
XT 3520
XU 3521
XV 3522
XW 3523
XX 3524
XY 3525
XZ 3526
Xa 3601
Xb 3602
Xc 3603
Xd 3604
Xe 3605
Xf 3606
Xg 3607
Xh 3608
Xi 3609
Xj 3610
Xk 3611
Xl 3612
Xm 3613
Xn 3614
Xo 3615
Xp 3616
Xq 3617
Xr 3618
Xs 3619
Xt 3620
Xu 3621
Xv 3622
Xw 3623
Xx 3624
Xy 3625
Xz 3626
!FUNKY!STUFF!
echo extracting file mk.gg
sed 's/^X//' > mk.gg <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 3714
X" 3428
X# 3429
X$ 3427
X% 2271
X& 3718
X^ 2247
X| 2229
X( 3721
X) 3722
X[ 1405
X] 1406
X` 3716
X' 3717
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 3723
X+ 3725
X- 3724
X= 3726
X. 3710
X, 3711
X: 3712
X; 3713
X? 3715
X/ 3720
X0 3700
X1 3701
X2 3702
X3 3703
X4 3704
X5 3705
X6 3706
X7 3707
X8 3708
X9 3709
X\ 804
X~ 2246
XA 3301
XB 3302
XC 3303
XD 3304
XE 3305
XF 3306
XG 3307
XH 3308
XI 3309
XJ 3310
XK 3311
XL 3312
XM 3313
XN 3314
XO 3315
XP 3316
XQ 3317
XR 3318
XS 3319
XT 3320
XU 3321
XV 3322
XW 3323
XX 3324
XY 3325
XZ 3326
Xa 3401
Xb 3402
Xc 3403
Xd 3404
Xe 3405
Xf 3406
Xg 3407
Xh 3408
Xi 3409
Xj 3410
Xk 3411
Xl 3412
Xm 3413
Xn 3414
Xo 3415
Xp 3416
Xq 3417
Xr 3418
Xs 3419
Xt 3420
Xu 3421
Xv 3422
Xw 3423
Xx 3424
Xy 3425
Xz 3426
!FUNKY!STUFF!
echo extracting file mk.gi
sed 's/^X//' > mk.gi <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 3714
X" 3728
X# 2275
X$ 3719
X% 2271
X& 3718
X^ 2247
X| 2229
X( 3721
X) 3722
X[ 1405
X] 1406
X` 3716
X' 3717
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 3723
X+ 3725
X- 3724
X= 3726
X. 3710
X, 3711
X: 3712
X; 3713
X? 3715
X/ 3720
X0 3700
X1 3701
X2 3702
X3 3703
X4 3704
X5 3705
X6 3706
X7 3707
X8 3708
X9 3709
X\ 804
X~ 2246
XA 3801
XB 3802
XC 3803
XD 3804
XE 3805
XF 3806
XG 3807
XH 3808
XI 3809
XJ 3810
XK 3811
XL 3812
XM 3813
XN 3814
XO 3815
XP 3816
XQ 3817
XR 3818
XS 3819
XT 3820
XU 3821
XV 3822
XW 3823
XX 3824
XY 3825
XZ 3826
Xa 3901
Xb 3902
Xc 3903
Xd 3904
Xe 3905
Xf 3906
Xg 3907
Xh 3908
Xi 3909
Xj 3910
Xk 3911
Xl 3912
Xm 3913
Xn 3914
Xo 3915
Xp 3916
Xq 3917
Xr 3918
Xs 3919
Xt 3920
Xu 3921
Xv 3922
Xw 3923
Xx 3924
Xy 3925
Xz 3926
!FUNKY!STUFF!
echo extracting file mk.sg
sed 's/^X//' > mk.sg <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 714
X" 717
X# 733
X$ 719
X% 2271
X& 734
X^ 2247
X| 723
X( 721
X) 722
X[ 1405
X] 1406
X` 730
X' 731
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 728
X+ 725
X- 725
X= 726
X. 710
X, 711
X: 712
X; 713
X? 715
X/ 802
X0 700
X1 701
X2 702
X3 703
X4 704
X5 705
X6 706
X7 707
X8 708
X9 709
X\ 804
X~ 2246
XA 527
XB 528
XC 529
XD 530
XE 531
XF 532
XG 533
XH 534
XI 535
XK 536
XL 537
XM 538
XN 539
XQ 540
XO 541
XP 542
XR 543
XS 544
XT 545
XV 546
XW 547
XX 548
XY 549
XZ 550
Xa 627
Xb 628
Xc 629
Xd 630
Xe 631
Xf 632
Xg 633
Xh 634
Xi 635
Xk 636
Xl 637
Xm 638
Xn 639
Xq 640
Xo 641
Xp 642
Xr 643
Xs 644
Xt 645
Xv 646
Xw 647
Xx 648
Xy 649
Xz 650
!FUNKY!STUFF!
echo extracting file mk.ss
sed 's/^X//' > mk.ss <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 714
X" 717
X# 733
X$ 719
X% 2271
X& 734
X^ 756
X| 723
X( 721
X) 722
X[ 1405
X] 1406
X` 730
X' 731
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 728
X+ 725
X- 725
X= 726
X. 710
X, 711
X: 712
X; 713
X? 715
X/ 802
X0 700
X1 701
X2 702
X3 703
X4 704
X5 705
X6 706
X7 707
X8 708
X9 709
X\ 804
X~ 2246
XA 551
XB 552
XC 553
XD 554
XE 555
XF 556
XG 557
XH 558
XI 559
XJ 560
XK 561
XL 562
XM 563
XN 564
XO 565
XP 566
XQ 567
XR 568
XS 569
XT 570
XU 571
XV 572
XW 573
XX 574
XY 575
XZ 576
Xa 651
Xb 652
Xc 653
Xd 654
Xe 655
Xf 656
Xg 657
Xh 658
Xi 659
Xj 660
Xk 661
Xl 662
Xm 663
Xn 664
Xo 665
Xp 666
Xq 667
Xr 668
Xs 669
Xt 670
Xu 671
Xv 672
Xw 673
Xx 674
Xy 675
Xz 676
!FUNKY!STUFF!
echo extracting file mk.ti
sed 's/^X//' > mk.ti <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 3264
X" 3278
X# 2275
X$ 3269
X% 2271
X& 3268
X^ 2247
X| 2229
X( 3271
X) 3272
X[ 1405
X] 1406
X` 3266
X' 3267
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 3273
X+ 3275
X- 3274
X= 3276
X. 3260
X, 3261
X: 3262
X; 3263
X? 3265
X/ 3270
X0 3250
X1 3251
X2 3252
X3 3253
X4 3254
X5 3255
X6 3256
X7 3257
X8 3258
X9 3259
X\ 804
X~ 2246
XA 3051
XB 3052
XC 3053
XD 3054
XE 3055
XF 3056
XG 3057
XH 3058
XI 3059
XJ 3060
XK 3061
XL 3062
XM 3063
XN 3064
XO 3065
XP 3066
XQ 3067
XR 3068
XS 3069
XT 3070
XU 3071
XV 3072
XW 3073
XX 3074
XY 3075
XZ 3076
Xa 3151
Xb 3152
Xc 3153
Xd 3154
Xe 3155
Xf 3156
Xg 3157
Xh 3158
Xi 3159
Xj 3160
Xk 3161
Xl 3162
Xm 3163
Xn 3164
Xo 3165
Xp 3166
Xq 3167
Xr 3168
Xs 3169
Xt 3170
Xu 3171
Xv 3172
Xw 3173
Xx 3174
Xy 3175
Xz 3176
!FUNKY!STUFF!
echo extracting file mk.tr
sed 's/^X//' > mk.tr <<'!FUNKY!STUFF!'
X0 -12
X 699
X! 3214
X" 3228
X# 2275
X$ 3219
X% 2271
X& 3218
X^ 2247
X| 2229
X( 3221
X) 3222
X[ 1405
X] 1406
X` 3216
X' 3217
X@ 2273
X< 2241
X> 2242
X{ 2225
X} 2226
X* 3223
X+ 3225
X- 3224
X= 3226
X. 3210
X, 3211
X: 3212
X; 3213
X? 3215
X/ 3220
X0 3200
X1 3201
X2 3202
X3 3203
X4 3204
X5 3205
X6 3206
X7 3207
X8 3208
X9 3209
X\ 804
X~ 2246
XA 3001
XB 3002
XC 3003
XD 3004
XE 3005
XF 3006
XG 3007
XH 3008
XI 3009
XJ 3010
XK 3011
XL 3012
XM 3013
XN 3014
XO 3015
XP 3016
XQ 3017
XR 3018
XS 3019
XT 3020
XU 3021
XV 3022
XW 3023
XX 3024
XY 3025
XZ 3026
Xa 3101
Xb 3102
Xc 3103
Xd 3104
Xe 3105
Xf 3106
Xg 3107
Xh 3108
Xi 3109
Xj 3110
Xk 3111
Xl 3112
Xm 3113
Xn 3114
Xo 3115
Xp 3116
Xq 3117
Xr 3118
Xs 3119
Xt 3120
Xu 3121
Xv 3122
Xw 3123
Xx 3124
Xy 3125
Xz 3126
!FUNKY!STUFF!
echo extracting file sr.e
sed 's/^X//' > sr.e <<'!FUNKY!STUFF!'
X!:
XM 5 0
XN 0 -14
XM 0 -5
XN -1 -1
XN 1 -1
XN 1 1
XN -1 1
XM 5 19
XE
X":
XM 4 0
XN 0 -7
XM 8 7
XN 0 -7
XM 4 7
XE
X#:
XM 11 4
XN -7 -32
XM 13 32
XN -7 -32
XM -6 19
XN 14 0
XM -15 -6
XN 14 0
XM 4 15
XE
X$:
XM 8 4
XN 0 -29
XM 4 29
XN 0 -29
XM 5 22
XN -2 2
XN -3 1
XN -4 0
XN -3 -1
XN -2 -2
XN 0 -2
XN 1 -2
XN 1 -1
XN 2 -1
XN 6 -2
XN 2 -1
XN 1 -1
XN 1 -2
XN 0 -3
XN -2 -2
XN -3 -1
XN -4 0
XN -3 1
XN -2 2
XM 17 18
XE
X%:
XM 21 0
XN -18 -21
XM 5 21
XN 2 -2
XN 0 -2
XN -1 -2
XN -2 -1
XN -2 0
XN -2 2
XN 0 2
XN 1 2
XN 2 1
XN 2 0
XN 2 -1
XN 3 -1
XN 3 0
XN 3 1
XN 2 1
XM -4 -14
XN -2 -1
XN -1 -2
XN 0 -2
XN 2 -2
XN 2 0
XN 2 1
XN 1 2
XN 0 2
XN -2 2
XN -2 0
XM 7 14
XE
X&:
XM 23 -9
XN 0 1
XN -1 1
XN -1 0
XN -1 -1
XN -1 -2
XN -2 -5
XN -2 -3
XN -2 -2
XN -2 -1
XN -4 0
XN -2 1
XN -1 1
XN -1 2
XN 0 2
XN 1 2
XN 1 1
XN 7 4
XN 1 1
XN 1 2
XN 0 2
XN -1 2
XN -2 1
XN -2 -1
XN -1 -2
XN 0 -2
XN 1 -3
XN 2 -3
XN 5 -7
XN 2 -2
XN 2 -1
XN 2 0
XN 1 1
XN 0 1
XM 3 19
XE
X':
XM 5 -2
XN -1 1
XN 1 1
XN 1 -1
XN 0 -2
XN -1 -2
XN -1 -1
XM 6 6
XE
X(:
XM 11 4
XN -2 -2
XN -2 -3
XN -2 -4
XN -1 -5
XN 0 -4
XN 1 -5
XN 2 -4
XN 2 -3
XN 2 -2
XM 3 28
XE
X):
XM 3 4
XN 2 -2
XN 2 -3
XN 2 -4
XN 1 -5
XN 0 -4
XN -1 -5
XN -2 -4
XN -2 -3
XN -2 -2
XM 11 28
XE
X*:
XM 8 -6
XN 0 -12
XM -5 9
XN 10 -6
XM 0 6
XN -10 -6
XM 13 15
XE
X+:
XM 13 -3
XN 0 -18
XM -9 9
XN 18 0
XM 4 12
XE
X,:
XM 6 -20
XN -1 -1
XN -1 1
XN 1 1
XN 1 -1
XN 0 -2
XN -1 -2
XN -1 -1
XM 6 25
XE
X-:
XM 4 -12
XN 18 0
XM 4 12
XE
X_:
XM 3 -21
XN 18 0
XM 3 21
XE
X.:
XM 5 -19
XN -1 -1
XN 1 -1
XN 1 1
XN -1 1
XM 5 19
XE
X/:
XM 20 4
XN -18 -32
XM 20 28
XE
X0:
XM 9 0
XN -3 -1
XN -2 -3
XN -1 -5
XN 0 -3
XN 1 -5
XN 2 -3
XN 3 -1
XN 2 0
XN 3 1
XN 2 3
XN 1 5
XN 0 3
XN -1 5
XN -2 3
XN -3 1
XN -2 0
XM 11 0
XE
X1:
XM 6 -4
XN 2 1
XN 3 3
XN 0 -21
XM 9 21
XE
X2:
XM 4 -5
XN 0 1
XN 1 2
XN 1 1
XN 2 1
XN 4 0
XN 2 -1
XN 1 -1
XN 1 -2
XN 0 -2
XN -1 -2
XN -2 -3
XN -10 -10
XN 14 0
XM 3 21
XE
X3:
XM 5 0
XN 11 0
XN -6 -8
XN 3 0
XN 2 -1
XN 1 -1
XN 1 -3
XN 0 -2
XN -1 -3
XN -2 -2
XN -3 -1
XN -3 0
XN -3 1
XN -1 1
XN -1 2
XM 17 17
XE
X4:
XM 13 0
XN -10 -14
XN 15 0
XM -5 14
XN 0 -21
XM 7 21
XE
X5:
XM 15 0
XN -10 0
XN -1 -9
XN 1 1
XN 3 1
XN 3 0
XN 3 -1
XN 2 -2
XN 1 -3
XN 0 -2
XN -1 -3
XN -2 -2
XN -3 -1
XN -3 0
XN -3 1
XN -1 1
XN -1 2
XM 17 17
XE
X6:
XM 16 -3
XN -1 2
XN -3 1
XN -2 0
XN -3 -1
XN -2 -3
XN -1 -5
XN 0 -5
XN 1 -4
XN 2 -2
XN 3 -1
XN 1 0
XN 3 1
XN 2 2
XN 1 3
XN 0 1
XN -1 3
XN -2 2
XN -3 1
XN -1 0
XN -3 -1
XN -2 -2
XN -1 -3
XM 16 14
XE
X7:
XM 17 0
XN -10 -21
XM -4 21
XN 14 0
XM 3 0
XE
X8:
XM 8 0
XN -3 -1
XN -1 -2
XN 0 -2
XN 1 -2
XN 2 -1
XN 4 -1
XN 3 -1
XN 2 -2
XN 1 -2
XN 0 -3
XN -1 -2
XN -1 -1
XN -3 -1
XN -4 0
XN -3 1
XN -1 1
XN -1 2
XN 0 3
XN 1 2
XN 2 2
XN 3 1
XN 4 1
XN 2 1
XN 1 2
XN 0 2
XN -1 2
XN -3 1
XN -4 0
XM 12 0
XE
X9:
XM 16 -7
XN -1 -3
XN -2 -2
XN -3 -1
XN -1 0
XN -3 1
XN -2 2
XN -1 3
XN 0 1
XN 1 3
XN 2 2
XN 3 1
XN 1 0
XN 3 -1
XN 2 -2
XN 1 -4
XN 0 -5
XN -1 -5
XN -2 -3
XN -3 -1
XN -2 0
XN -3 1
XN -1 2
XM 16 18
XE
X::
XM 5 -7
XN -1 -1
XN 1 -1
XN 1 1
XN -1 1
XM 0 -12
XN -1 -1
XN 1 -1
XN 1 1
XN -1 1
XM 5 19
XE
X;:
XM 5 -7
XN -1 -1
XN 1 -1
XN 1 1
XN -1 1
XM 1 -13
XN -1 -1
XN -1 1
XN 1 1
XN 1 -1
XN 0 -2
XN -1 -2
XN -1 -1
XM 6 25
XE
X<:
XM 20 -3
XN -16 -9
XN 16 -9
XM 4 21
XE
X=:
XM 4 -9
XN 18 0
XM -18 -6
XN 18 0
XM 4 15
XE
X>:
XM 4 -3
XN 16 -9
XN -16 -9
XM 20 21
XE
X?:
XM 3 -5
XN 0 1
XN 1 2
XN 1 1
XN 2 1
XN 4 0
XN 2 -1
XN 1 -1
XN 1 -2
XN 0 -2
XN -1 -2
XN -1 -1
XN -4 -2
XN 0 -3
XM 0 -5
XN -1 -1
XN 1 -1
XN 1 1
XN -1 1
XM 9 19
XE
X@:
XM 18 -8
XN -1 2
XN -2 1
XN -3 0
XN -2 -1
XN -1 -1
XN -1 -3
XN 0 -3
XN 1 -2
XN 2 -1
XN 3 0
XN 2 1
XN 1 2
XM -5 8
XN -2 -2
XN -1 -3
XN 0 -3
XN 1 -2
XN 1 -1
XM 7 11
XN -1 -8
XN 0 -2
XN 2 -1
XN 2 0
XN 2 2
XN 1 3
XN 0 2
XN -1 3
XN -1 2
XN -2 2
XN -2 1
XN -3 1
XN -3 0
XN -3 -1
XN -2 -1
XN -2 -2
XN -1 -2
XN -1 -3
XN 0 -3
XN 1 -3
XN 1 -2
XN 2 -2
XN 2 -1
XN 3 -1
XN 3 0
XN 3 1
XN 2 1
XN 1 1
XM -2 13
XN -1 -8
XN 0 -2
XN 1 -1
XM 8 16
XE
XA:
XM 9 0
XN -8 -21
XM 8 21
XN 8 -21
XM -13 7
XN 10 0
XM 4 14
XE
XB:
XM 4 0
XN 0 -21
XM 0 21
XN 9 0
XN 3 -1
XN 1 -1
XN 1 -2
XN 0 -2
XN -1 -2
XN -1 -1
XN -3 -1
XM -9 0
XN 9 0
XN 3 -1
XN 1 -1
XN 1 -2
XN 0 -3
XN -1 -2
XN -1 -1
XN -3 -1
XN -9 0
XM 17 21
XE
XC:
XM 18 -5
XN -1 2
XN -2 2
XN -2 1
XN -4 0
XN -2 -1
XN -2 -2
XN -1 -2
XN -1 -3
XN 0 -5
XN 1 -3
XN 1 -2
XN 2 -2
XN 2 -1
XN 4 0
XN 2 1
XN 2 2
XN 1 2
XM 3 16
XE
XD:
XM 4 0
XN 0 -21
XM 0 21
XN 7 0
XN 3 -1
XN 2 -2
XN 1 -2
XN 1 -3
XN 0 -5
XN -1 -3
XN -1 -2
XN -2 -2
XN -3 -1
XN -7 0
XM 17 21
XE
XE:
XM 4 0
XN 0 -21
XM 0 21
XN 13 0
XM -13 -10
XN 8 0
XM -8 -11
XN 13 0
XM 2 21
XE
XF:
XM 4 0
XN 0 -21
XM 0 21
XN 13 0
XM -13 -10
XN 8 0
XM 6 10
XE
XG:
XM 18 -5
XN -1 2
XN -2 2
XN -2 1
XN -4 0
XN -2 -1
XN -2 -2
XN -1 -2
XN -1 -3
XN 0 -5
XN 1 -3
XN 1 -2
XN 2 -2
XN 2 -1
XN 4 0
XN 2 1
XN 2 2
XN 1 2
XN 0 3
XM -5 0
XN 5 0
XM 3 13
XE
XH:
XM 4 0
XN 0 -21
XM 14 21
XN 0 -21
XM -14 11
XN 14 0
XM 4 10
XE
XI:
XM 4 0
XN 0 -21
XM 4 21
XE
XJ:
XM 12 0
XN 0 -16
XN -1 -3
XN -1 -1
XN -2 -1
XN -2 0
XN -2 1
XN -1 1
XN -1 3
XN 0 2
XM 14 14
XE
XK:
XM 4 0
XN 0 -21
XM 14 21
XN -14 -14
XM 5 5
XN 9 -12
XM 3 21
XE
XL:
XM 4 0
XN 0 -21
XM 0 0
XN 12 0
XM 1 21
XE
XM:
XM 4 0
XN 0 -21
XM 0 21
XN 8 -21
XM 8 21
XN -8 -21
XM 8 21
XN 0 -21
XM 4 21
XE
XN:
XM 4 0
XN 0 -21
XM 0 21
XN 14 -21
XM 0 21
XN 0 -21
XM 4 21
XE
XO:
XM 9 0
XN -2 -1
XN -2 -2
XN -1 -2
XN -1 -3
XN 0 -5
XN 1 -3
XN 1 -2
XN 2 -2
XN 2 -1
XN 4 0
XN 2 1
XN 2 2
XN 1 2
XN 1 3
XN 0 5
XN -1 3
XN -1 2
XN -2 2
XN -2 1
XN -4 0
XM 13 0
XE
XP:
XM 4 0
XN 0 -21
XM 0 21
XN 9 0
XN 3 -1
XN 1 -1
XN 1 -2
XN 0 -3
XN -1 -2
XN -1 -1
XN -3 -1
XN -9 0
XM 17 11
XE
XQ:
XM 9 0
XN -2 -1
XN -2 -2
XN -1 -2
XN -1 -3
XN 0 -5
XN 1 -3
XN 1 -2
XN 2 -2
XN 2 -1
XN 4 0
XN 2 1
XN 2 2
XN 1 2
XN 1 3
XN 0 5
XN -1 3
XN -1 2
XN -2 2
XN -2 1
XN -4 0
XM 3 -17
XN 6 -6
XM 4 23
XE
XR:
XM 4 0
XN 0 -21
XM 0 21
XN 9 0
XN 3 -1
XN 1 -1
XN 1 -2
XN 0 -2
XN -1 -2
XN -1 -1
XN -3 -1
XN -9 0
XM 7 0
XN 7 -11
XM 3 21
XE
XS:
XM 17 -3
XN -2 2
XN -3 1
XN -4 0
XN -3 -1
XN -2 -2
XN 0 -2
XN 1 -2
XN 1 -1
XN 2 -1
XN 6 -2
XN 2 -1
XN 1 -1
XN 1 -2
XN 0 -3
XN -2 -2
XN -3 -1
XN -4 0
XN -3 1
XN -2 2
XM 17 18
XE
XT:
XM 8 0
XN 0 -21
XM -7 21
XN 14 0
XM 1 0
XE
XU:
XM 4 0
XN 0 -15
XN 1 -3
XN 2 -2
XN 3 -1
XN 2 0
XN 3 1
XN 2 2
XN 1 3
XN 0 15
XM 4 0
XE
XV:
XM 1 0
XN 8 -21
XM 8 21
XN -8 -21
XM 9 21
XE
XW:
XM 2 0
XN 5 -21
XM 5 21
XN -5 -21
XM 5 21
XN 5 -21
XM 5 21
XN -5 -21
XM 7 21
XE
XX:
XM 3 0
XN 14 -21
XM 0 21
XN -14 -21
XM 17 21
XE
XY:
XM 1 0
XN 8 -10
XN 0 -11
XM 8 21
XN -8 -10
XM 9 10
XE
XZ:
XM 17 0
XN -14 -21
XM 0 21
XN 14 0
XM -14 -21
XN 14 0
XM 3 21
XE
X[:
XM 4 4
XN 0 -32
XM 1 32
XN 0 -32
XM -1 32
XN 7 0
XM -7 -32
XN 7 0
XM 3 28
XE
X\:
XM 0 0
XN 14 -24
XM 0 24
XE
X]:
XM 9 4
XN 0 -32
XM 1 32
XN 0 -32
XM -7 32
XN 7 0
XM -7 -32
XN 7 0
XM 4 28
XE
X^:
XM 5 -5
XN -1 -2
XN -2 -3
XN -2 -2
XM 5 7
XN 1 -2
XN 2 -3
XN 2 -2
XM 0 12
XE
X`:
XM 6 0
XN -1 -1
XN -1 -2
XN 0 -2
XN 1 -1
XN 1 1
XN -1 1
XM 5 4
XE
Xa:
XM 15 -7
XN 0 -14
XM 0 11
XN -2 2
XN -2 1
XN -3 0
XN -2 -1
XN -2 -2
XN -1 -3
XN 0 -2
XN 1 -3
XN 2 -2
XN 2 -1
XN 3 0
XN 2 1
XN 2 2
XM 4 18
XE
Xb:
XM 4 0
XN 0 -21
XM 0 11
XN 2 2
XN 2 1
XN 3 0
XN 2 -1
XN 2 -2
XN 1 -3
XN 0 -2
XN -1 -3
XN -2 -2
XN -2 -1
XN -3 0
XN -2 1
XN -2 2
XM 15 18
XE
Xc:
XM 15 -10
XN -2 2
XN -2 1
XN -3 0
XN -2 -1
XN -2 -2
XN -1 -3
XN 0 -2
XN 1 -3
XN 2 -2
XN 2 -1
XN 3 0
XN 2 1
XN 2 2
XM 3 18
XE
Xd:
XM 15 0
XN 0 -21
XM 0 11
XN -2 2
XN -2 1
XN -3 0
XN -2 -1
XN -2 -2
XN -1 -3
XN 0 -2
XN 1 -3
XN 2 -2
XN 2 -1
XN 3 0
XN 2 1
XN 2 2
XM 4 18
XE
Xe:
XM 3 -13
XN 12 0
XN 0 2
XN -1 2
XN -1 1
XN -2 1
XN -3 0
XN -2 -1
XN -2 -2
XN -1 -3
XN 0 -2
XN 1 -3
XN 2 -2
XN 2 -1
XN 3 0
XN 2 1
XN 2 2
XM 3 18
XE
Xf:
XM 10 0
XN -2 0
XN -2 -1
XN -1 -3
XN 0 -17
XM -3 14
XN 7 0
XM 3 7
XE
Xg:
XM 15 -7
XN 0 -16
XN -1 -3
XN -1 -1
XN -2 -1
XN -3 0
XN -2 1
XM 9 17
XN -2 2
XN -2 1
XN -3 0
XN -2 -1
XN -2 -2
XN -1 -3
XN 0 -2
XN 1 -3
XN 2 -2
XN 2 -1
XN 3 0
XN 2 1
XN 2 2
XM 4 18
XE
Xh:
XM 4 0
XN 0 -21
XM 0 10
XN 3 3
XN 2 1
XN 3 0
XN 2 -1
XN 1 -3
XN 0 -10
XM 4 21
XE
Xi:
XM 3 0
XN 1 -1
XN 1 1
XN -1 1
XN -1 -1
XM 1 -7
XN 0 -14
XM 4 21
XE
Xj:
XM 5 0
XN 1 -1
XN 1 1
XN -1 1
XN -1 -1
XM 1 -7
XN 0 -17
XN -1 -3
XN -2 -1
XN -2 0
XM 9 28
XE
Xk:
XM 4 0
XN 0 -21
XM 10 14
XN -10 -10
XM 4 4
XN 7 -8
XM 2 21
XE
Xl:
XM 4 0
XN 0 -21
XM 4 21
XE
Xm:
XM 4 -7
XN 0 -14
XM 0 10
XN 3 3
XN 2 1
XN 3 0
XN 2 -1
XN 1 -3
XN 0 -10
XM 0 10
XN 3 3
XN 2 1
XN 3 0
XN 2 -1
XN 1 -3
XN 0 -10
XM 4 21
XE
Xn:
XM 4 -7
XN 0 -14
XM 0 10
XN 3 3
XN 2 1
XN 3 0
XN 2 -1
XN 1 -3
XN 0 -10
XM 4 21
XE
Xo:
XM 8 -7
XN -2 -1
XN -2 -2
XN -1 -3
XN 0 -2
XN 1 -3
XN 2 -2
XN 2 -1
XN 3 0
XN 2 1
XN 2 2
XN 1 3
XN 0 2
XN -1 3
XN -2 2
XN -2 1
XN -3 0
XM 11 7
XE
Xp:
XM 4 -7
XN 0 -21
XM 0 18
XN 2 2
XN 2 1
XN 3 0
XN 2 -1
XN 2 -2
XN 1 -3
XN 0 -2
XN -1 -3
XN -2 -2
XN -2 -1
XN -3 0
XN -2 1
XN -2 2
XM 15 18
XE
Xq:
XM 15 -7
XN 0 -21
XM 0 18
XN -2 2
XN -2 1
XN -3 0
XN -2 -1
XN -2 -2
XN -1 -3
XN 0 -2
XN 1 -3
XN 2 -2
XN 2 -1
XN 3 0
XN 2 1
XN 2 2
XM 4 18
XE
Xr:
XM 4 -7
XN 0 -14
XM 0 8
XN 1 3
XN 2 2
XN 2 1
XN 3 0
XM 1 7
XE
Xs:
XM 14 -10
XN -1 2
XN -3 1
XN -3 0
XN -3 -1
XN -1 -2
XN 1 -2
XN 2 -1
XN 5 -1
XN 2 -1
XN 1 -2
XN 0 -1
XN -1 -2
XN -3 -1
XN -3 0
XN -3 1
XN -1 2
XM 14 18
XE
Xt:
XM 5 0
XN 0 -17
XN 1 -3
XN 2 -1
XN 2 0
XM -8 14
XN 7 0
XM 3 7
XE
Xu:
XM 4 -7
XN 0 -10
XN 1 -3
XN 2 -1
XN 3 0
XN 2 1
XN 3 3
XM 0 10
XN 0 -14
XM 4 21
XE
Xv:
XM 2 -7
XN 6 -14
XM 6 14
XN -6 -14
XM 8 21
XE
Xw:
XM 3 -7
XN 4 -14
XM 4 14
XN -4 -14
XM 4 14
XN 4 -14
XM 4 14
XN -4 -14
XM 7 21
XE
Xx:
XM 3 -7
XN 11 -14
XM 0 14
XN -11 -14
XM 14 21
XE
Xy:
XM 2 -7
XN 6 -14
XM 6 14
XN -6 -14
XN -2 -4
XN -2 -2
XN -2 -1
XN -1 0
XM 15 28
XE
Xz:
XM 14 -7
XN -11 -14
XM 0 14
XN 11 0
XM -11 -14
XN 11 0
XM 3 21
XE
X{:
XM 9 4
XN -3 -3
XN -1 -3
XN 0 -2
XN 1 -3
XN 3 -3
XM -2 12
XN -1 -3
XN 0 -4
XN 1 -3
XM 2 -2
XN -3 -2
XN 3 -2
XM 0 0
XN -3 -3
XN -1 -3
XN 0 -2
XN 1 -3
XN 3 -3
XM -2 12
XN -1 -3
XN 0 -4
XN 1 -3
XM 7 26
XE
X|:
XM 4 4
XN 0 -32
XM 4 28
XE
X}:
XM 5 4
XN 3 -3
XN 1 -3
XN 0 -2
XN -1 -3
XN -3 -3
XM 2 12
XN 1 -3
XN 0 -4
XN -1 -3
XM -2 -2
XN 3 -2
XN -3 -2
XM 0 0
XN 3 -3
XN 1 -3
XN 0 -2
XN -1 -3
XN -3 -3
XM 2 12
XN 1 -3
XN 0 -4
XN -1 -3
XM 7 26
XE
X~:
XM 3 -15
XN 0 2
XN 1 3
XN 2 1
XN 2 0
XN 2 -1
XN 4 -3
XN 2 -1
XN 2 0
XN 2 1
XN 1 2
XM -18 -2
XN 1 2
XN 2 1
XN 2 0
XN 2 -1
XN 4 -3
XN 2 -1
XN 2 0
XN 2 1
XN 1 3
XN 0 2
XM 3 9
XE
X :
XM 20 0
XE
!FUNKY!STUFF!
cd ..
echo
echo finished installing directory vfont
echo
echo finished part 8 of 8