PD plot(4) librarys (and hercules driver for interactive 386) part 2 of 9
Roland van Hout
hot at integow.uucp
Sun Oct 28 14:52:28 AEST 1990
#!/bin/sh
# This is part 02 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
# ============= libplot/ReGIS/libReGIS.c ==============
echo "x - extracting libplot/ReGIS/libReGIS.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/ReGIS/libReGIS.c &&
X
X/* plot(4) graphics library for a regis terminal for VT240/VT300/GIGI */
X/* This is public domain written by Roland van Hout hot at hot.mug */
Xextern float deltx,delty;
Xfloat gxscrunch,gyscrunch;
Xfloat pitograd;
Xint offx,offy;
X
X#include <math.h>
X
Xopenpl()
X{
Xprintf( "\033PpS(E)\033\\");
X
X}
X
Xclosepl()
X{
X printf("\033\\\033[24;1H");
X
X}
X
Xspace(x0,y0,x1,y1)
Xint x0,y0,x1,y1;
X{
Xint x,y;
Xpitograd=(180.0/M_PI);
X
Xif (x1>0 && y1>0 && y0<y1 && x0<x1) {
X x=x1-x0;y=y1-y0;
X gxscrunch=(700/(float) x);gyscrunch=(490/(float) y);
X offx = -(x0*gxscrunch);offy= 485+(y0*gyscrunch);
X}
Xelse {
X gxscrunch=700/deltx;gyscrunch=490/delty;
X offx = 0; offy= 485;
X
X}
X
X}
X
Xerase()
X{
X printf("\033PpS(E)\033\\");
X}
X
Xlabel(s)
Xchar *s;
X{
X printf("\033PpP[,-12]T'%s';\033\\",s);
X
X}
X
Xmove(x,y)
Xint x,y;
X{
X char s[5];
X int xo,yo;
X xo = x*gxscrunch;
X yo = y*gyscrunch;
X yo = offy - yo;xo = offx + xo;
X printf("\033PpP[%d,%d]\033\\",xo,yo);
X}
X
Xcont(x,y)
Xint x,y;
X{
X char s[5];
X int xo,yo;
X xo = x*gxscrunch;
X yo = y*gyscrunch;
X yo = offy - yo;xo = offx + xo;
X
X printf("\033PpV[%d,%d]\033\\",xo,yo);
X}
X
Xline (x1, y1, x2, y2)
Xint x1,y1,x2,y2;
X{
X move(x1,y1);
X cont(x2,y2);
X}
Xcircle(x,y,r)
Xint x,y,r;
X{
Xint xo,yo;
X move((x-r),y);
X xo=(x*gxscrunch);yo=(y*gyscrunch);
X yo = offy - yo;xo = offx + xo;
X printf("\033PpC(C)[%d,%d]",xo,yo);
X}
X
Xarc(x,y,x0,y0,x1,y1)
Xint x,y,x0,y0,x1,y1;
X{
Xfloat a1,a2,r1,r2;
Xint xo,yo,c1,c2,c;
X move(x0,y0);
X if ((x-x0) > 0) {
X r1=(y-y0)/(x-x0);
X a1=atan(r1);
X c1=(a1*pitograd);
X }
X else {
X c1=180;
X }
X if ((x-x1) > 0) {
X r2=(y-y1)/(x-x1);
X a2=atan(r2);
X c2=(a2*pitograd);
X }
X else {
X c2=180;
X }
X c=c1-c2;
X xo=(x*gxscrunch);yo=(y*gyscrunch);
X yo = offy - yo;xo = offx + xo;
X printf("\033PpC(A%dC) [%d,%d]\033\\",c,xo,yo);
X}
X
Xdot(xi,yi,dx,n,pat)
Xint xi,yi,dx,n,pat[256];
X{
X}
X
Xpoint(x,y)
Xint x,y;
X{
X move(x,y);
X printf("\033PpV[]\033\\");
X}
X
Xlinemod(s)
Xchar *s;
X{
X if (strcmp(s,"dotted")==0) {
X printf("\033PpW(P4)\033\\");
X }
X else if (strcmp(s,"solid")==0) {
X printf("\033PpW(P1)\033\\");
X }
X else if (strcmp(s,"longdashed")==0) {
X printf("\033PpW(P11100111)\033\\");
X }
X else if (strcmp(s,"shortdashed")==0) {
X printf("\033PpW(P2)\033\\");
X }
X else if (strcmp(s,"dotdashed")==0) {
X printf("\033PpW(P3)\033\\");
X }
X}
X
X
X/*
Xint vt300turt(),vt300from(),vt300to(),gtcheck(),gpenc(),gstate();
Xstruct display vt300 ={0.0,0.0,0.0,-400.0,399.0,-240.0,239.0,0.9,0,
X "\033PpS(E)P[384,240]\033\\\033PrSM0\033\\\033[20;1H",
X "\033PrSM2\033\\\033PpS(E)\033\\",
X "\033PrSM2\033\\\033PpS(E)\033\\",
X "\033PpS(E)\033\\",
X vt300turt,vt300from,vt300to,gtcheck,nullfn,nullfn,nullfn,
X gpenc,nullfn,gstate};
X
Xchar *vt300pens[] = {"W(R)","W(E)","W(C)"};
X*/
X
X/*vt300to(newx,newy)
Xdouble newx,newy;
X{
X printf(vt300pens[penerase]);
X cont((int)newx,(int)newy);
X printf("\033\\");
X}
X
Xvt300turt()
X{
X double newx,newy,angle;
X
X printf("\033PpW(C)");
X angle = (mydpy->turth-90.0)*3.141592654/180.0;
X newx = mydpy->turtx + 15.0*sin(angle);
X newy = mydpy->turty + 15.0*cos(angle);
X gmovepos((int)newx,(int)(y= mydpy->turth*3.141592654/180.0;
X newx = mydpy->turtx + 15.0*sin(angle);
X newy = mydpy->turty + 15.0*cos(angle);
X gplotpos((int)newx,(int)(gyscrunch*newy));
X angle = (mydpy->turth+90.0)*3.141592654/180.0;
X newx = mydpy->turtx + 15.0*sin(angle);
X newy = mydpy->turty + 15.0*cos(angle);
X gplotpos((int)newx,(int)(gyscrunch*newy));
X angle = (mydpy->turth-90.0)*3.141592654/180.0;
X newx = mydpy->turtx + 15.0*sin(angle);
X newy = mydpy->turty + 15.0*cos(angle);
X gplotpos((int)newx,(int)(gyscrunch*newy));
X printf(vt300pens[penerase]);
X printf("\033\\");
X}
X
Xgpenc(ipen)
Xregister int ipen;
X{
X if ((ipen<0) || (ipen>7)) {
X puts("Bad pen color, must be 0 to 7.");
X errhand();
X }
X printf("\033PpW(I%d)\033\\",ipen);
X}
X
Xgstate(which) {
X switch(which) {
X case 't':
X printf("\033PrSM2\033\\\033PpS(E)\033\\");
X break;
X case 's':
X case 'f':
X printf("\033PrSM0\033\\\033PpS(E)\033\\");
X if (textmode && shown) vt300turt();
X break;
X case '*':
X printf("\033[K");
X }
X}
X*/
X
X
X
X
SHAR_EOF
$TOUCH -am 1014194990 libplot/ReGIS/libReGIS.c &&
chmod 0644 libplot/ReGIS/libReGIS.c ||
echo "restore of libplot/ReGIS/libReGIS.c failed"
set `wc -c libplot/ReGIS/libReGIS.c`;Wc_c=$1
if test "$Wc_c" != "4002"; then
echo original size 4002, current size $Wc_c
fi
# ============= libplot/hpgl/Makefile ==============
if test ! -d 'libplot/hpgl'; then
echo "x - creating directory libplot/hpgl"
mkdir 'libplot/hpgl'
fi
echo "x - extracting libplot/hpgl/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/Makefile &&
X# Define CIRELBUG if the plotter has the firmware bug that puts it into
X# relative-coordinate mode after a circle or an arc.
XCFLAGS=-O -DCIRELBUG
X
Xall: libhpgl.a
X
Xlibhpgl.a: arc.o box.o circle.o close.o cont.o dot.o erase.o label.o line.o \
X linmod.o move.o open.o point.o space.o onoff.o hpglchord.o
X ar rc libhpgl.a *.o
X
Xclean:
X rm -f *.o libhpgl.a
X
Xmv: all
X mv libhpgl.a ..
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/Makefile &&
chmod 0644 libplot/hpgl/Makefile ||
echo "restore of libplot/hpgl/Makefile failed"
set `wc -c libplot/hpgl/Makefile`;Wc_c=$1
if test "$Wc_c" != "378"; then
echo original size 378, current size $Wc_c
fi
# ============= libplot/hpgl/README ==============
echo "x - extracting libplot/hpgl/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/README &&
XFollowing is a shell archive of the source for a V7 plot(3) library for
XHewlett-Packard plotters which speak HPGL (HP Graphics Language). We have
Xnow had fairly extensive experience using this software with our HP7470
X2-pen plotter.
X
XWe have had enough requests for this software that we felt it was worth
Xposting to the net. The package was written jointly by myself and
XHenry Spencer. While the package has been fairly well-exercised, should
Xany bugs show up, please let us know.
X
X David Trueman @ U of Toronto Zoology
X {allegra,ihnp4,linus,decvax}!utzoo!david
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/README &&
chmod 0644 libplot/hpgl/README ||
echo "restore of libplot/hpgl/README failed"
set `wc -c libplot/hpgl/README`;Wc_c=$1
if test "$Wc_c" != "572"; then
echo original size 572, current size $Wc_c
fi
# ============= libplot/hpgl/arc.c ==============
echo "x - extracting libplot/hpgl/arc.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/arc.c &&
X/* @(#)arc.c 1.5 of 4 Aug 84 */
X
X#include <math.h>
X#define sq(x) ((double)(x) * (double)(x))
X
Xextern int hpglchord();
X
Xarc(xc, yc, xs, ys, xe, ye)
Xint xc, yc; /* center of arc */
Xint xs, ys; /* starting point */
Xint xe, ye; /* end point */
X{
X double as, ae;
X double angle;
X double rs;
X double pi = 3.14159265358979323846;
X
X as = atan2((double)(ys - yc), (double)(xs - xc)) * (180/pi);
X ae = atan2((double)(ye - yc), (double)(xe - xc)) * (180/pi);
X angle = ae - as;
X if (angle < 0)
X angle += 360;
X
X rs = sqrt(sq(xs - xc) + sq(ys - yc));
X
X move(xs, ys);
X on();
X printf("PD;");
X printf("AA %d,%d,%.2f,%d;", xc, yc, angle, hpglchord((int)rs));
X#ifdef CIRELBUG
X printf("PA;"); /* back into absolute mode -- firmware bug */
X#endif
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/arc.c &&
chmod 0644 libplot/hpgl/arc.c ||
echo "restore of libplot/hpgl/arc.c failed"
set `wc -c libplot/hpgl/arc.c`;Wc_c=$1
if test "$Wc_c" != "737"; then
echo original size 737, current size $Wc_c
fi
# ============= libplot/hpgl/box.c ==============
echo "x - extracting libplot/hpgl/box.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/box.c &&
Xbox(x0, y0, x1, y1)
Xint x0, y0; /* one corner */
Xint x1, y1; /* other corner */
X{
X move(x0, y0);
X cont(x0, y1);
X cont(x1, y1);
X cont(x1, y0);
X cont(x0, y0);
X move(x1, y1);
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/box.c &&
chmod 0644 libplot/hpgl/box.c ||
echo "restore of libplot/hpgl/box.c failed"
set `wc -c libplot/hpgl/box.c`;Wc_c=$1
if test "$Wc_c" != "174"; then
echo original size 174, current size $Wc_c
fi
# ============= libplot/hpgl/circle.c ==============
echo "x - extracting libplot/hpgl/circle.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/circle.c &&
X/* @(#)circle.c 1.4 of 31 July 84 */
Xextern int hpglchord();
X
Xcircle(x, y, r)
Xint x, y; /* center */
Xint r; /* radius */
X{
X move(x, y);
X on();
X printf("CI %d,%d;", r, hpglchord(r));
X#ifdef CIRELBUG
X printf("PA;"); /* back into absolute mode -- firmware bug */
X#endif
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/circle.c &&
chmod 0644 libplot/hpgl/circle.c ||
echo "restore of libplot/hpgl/circle.c failed"
set `wc -c libplot/hpgl/circle.c`;Wc_c=$1
if test "$Wc_c" != "278"; then
echo original size 278, current size $Wc_c
fi
# ============= libplot/hpgl/close.c ==============
echo "x - extracting libplot/hpgl/close.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/close.c &&
X/* @(#)close.c 1.2 of 26 July 84 */
X#include <stdio.h>
X
Xclosepl()
X{
X on();
X printf("PU;"); /* pen up */
X printf("SP;"); /* put pen away */
X off();
X fflush(stdout);
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/close.c &&
chmod 0644 libplot/hpgl/close.c ||
echo "restore of libplot/hpgl/close.c failed"
set `wc -c libplot/hpgl/close.c`;Wc_c=$1
if test "$Wc_c" != "168"; then
echo original size 168, current size $Wc_c
fi
# ============= libplot/hpgl/cont.c ==============
echo "x - extracting libplot/hpgl/cont.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/cont.c &&
Xcont(x, y)
Xint x, y; /* point to move to */
X{
X on();
X printf("PD %d,%d;", x, y);
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/cont.c &&
chmod 0644 libplot/hpgl/cont.c ||
echo "restore of libplot/hpgl/cont.c failed"
set `wc -c libplot/hpgl/cont.c`;Wc_c=$1
if test "$Wc_c" != "92"; then
echo original size 92, current size $Wc_c
fi
# ============= libplot/hpgl/dot.c ==============
echo "x - extracting libplot/hpgl/dot.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/dot.c &&
Xdot()
X{
X on();
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/dot.c &&
chmod 0644 libplot/hpgl/dot.c ||
echo "restore of libplot/hpgl/dot.c failed"
set `wc -c libplot/hpgl/dot.c`;Wc_c=$1
if test "$Wc_c" != "25"; then
echo original size 25, current size $Wc_c
fi
# ============= libplot/hpgl/erase.c ==============
echo "x - extracting libplot/hpgl/erase.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/erase.c &&
Xerase()
X{
X on();
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/erase.c &&
chmod 0644 libplot/hpgl/erase.c ||
echo "restore of libplot/hpgl/erase.c failed"
set `wc -c libplot/hpgl/erase.c`;Wc_c=$1
if test "$Wc_c" != "27"; then
echo original size 27, current size $Wc_c
fi
# ============= libplot/hpgl/hpglchord.c ==============
echo "x - extracting libplot/hpgl/hpglchord.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/hpglchord.c &&
X/* @(#)hpglchord.c 1.2 of 2 Oct 84 */
X
Xextern int hpglsize; /* Size of coordinate space. */
X
X#define MINCHA 5 /* Minimum chord angle. */
X
X/*
X * hpglchord - compute a suitable chord angle for circle/arc
X */
Xint
Xhpglchord(r)
Xint r; /* radius */
X{
X int changle;
X
X /*
X * The following calculation is essentially just chord/radius,
X * where chord is the desired chord size (10 machine units).
X * This yields an (approximate) result in radians, which is then
X * multiplied by (360/2pi), about 57, to yield degrees. The
X * messy part is that the desired chord needs to be expressed in
X * user units, and care is needed to avoid overflow and underflow
X * in integer arithmetic. A 10-unit chord is 1/720 of the machine
X * coordinate space, so hpglsize/720 would be the chord. Shuffling,
X * we have (57/720)*(hpglsize/r). (1/13) is close to (57/720)
X * and involves much less chance of over/underflow problems.
X *
X * Actually, the machine coordinate space isn't always (in fact,
X * ever!) 7200x7200 any more, but the numbers still come out close
X * enough that it's not worth worrying about.
X *
X * After all that, we enforce a minimum chord for speed. This
X * pretty much eliminates residual underflow worries.
X */
X changle = (hpglsize/r)/13;
X if (changle < MINCHA)
X changle = MINCHA;
X
X return(changle);
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/hpglchord.c &&
chmod 0644 libplot/hpgl/hpglchord.c ||
echo "restore of libplot/hpgl/hpglchord.c failed"
set `wc -c libplot/hpgl/hpglchord.c`;Wc_c=$1
if test "$Wc_c" != "1323"; then
echo original size 1323, current size $Wc_c
fi
# ============= libplot/hpgl/label.c ==============
echo "x - extracting libplot/hpgl/label.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/label.c &&
X/* @(#)label.c 1.3 of 26 July 84 */
Xlabel(s)
Xchar *s;
X{
X on();
X printf("CP -0.3333,-0.25;"); /* offset to center first char */
X printf("LB%s%c", s, 03);
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/label.c &&
chmod 0644 libplot/hpgl/label.c ||
echo "restore of libplot/hpgl/label.c failed"
set `wc -c libplot/hpgl/label.c`;Wc_c=$1
if test "$Wc_c" != "163"; then
echo original size 163, current size $Wc_c
fi
# ============= libplot/hpgl/line.c ==============
echo "x - extracting libplot/hpgl/line.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/line.c &&
Xline(x0,y0,x1,y1)
Xint x0, y0; /* starting point */
Xint x1, y1; /* end point */
X{
X move(x0,y0);
X cont(x1,y1);
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/line.c &&
chmod 0644 libplot/hpgl/line.c ||
echo "restore of libplot/hpgl/line.c failed"
set `wc -c libplot/hpgl/line.c`;Wc_c=$1
if test "$Wc_c" != "111"; then
echo original size 111, current size $Wc_c
fi
# ============= libplot/hpgl/linmod.c ==============
echo "x - extracting libplot/hpgl/linmod.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/linmod.c &&
X/* @(#)linmod.c 1.2 of 9 Aug 84 */
X
X#define STREQ(x, y) (strcmp((x), (y)) == 0)
X
Xlinemod(s)
Xchar *s;
X{
X char *pattern;
X
X if (STREQ(s, "dotted"))
X pattern = "1,1";
X else if (STREQ(s, "solid"))
X pattern = "";
X else if (STREQ(s, "longdashed"))
X pattern = "3,1";
X else if (STREQ(s, "shortdashed"))
X pattern = "2,1";
X else if (STREQ(s, "dotdashed"))
X pattern = "4,2";
X on();
X printf("LT %s;", pattern);
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/linmod.c &&
chmod 0644 libplot/hpgl/linmod.c ||
echo "restore of libplot/hpgl/linmod.c failed"
set `wc -c libplot/hpgl/linmod.c`;Wc_c=$1
if test "$Wc_c" != "413"; then
echo original size 413, current size $Wc_c
fi
# ============= libplot/hpgl/move.c ==============
echo "x - extracting libplot/hpgl/move.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/move.c &&
Xmove(x,y)
Xint x, y; /* point to move to */
X{
X on();
X printf("PU %d,%d;", x, y);
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/move.c &&
chmod 0644 libplot/hpgl/move.c ||
echo "restore of libplot/hpgl/move.c failed"
set `wc -c libplot/hpgl/move.c`;Wc_c=$1
if test "$Wc_c" != "91"; then
echo original size 91, current size $Wc_c
fi
# ============= libplot/hpgl/onoff.c ==============
echo "x - extracting libplot/hpgl/onoff.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/onoff.c &&
Xon()
X{
X printf("\033.Y"); /* wakeup plotter */
X}
X
Xoff()
X{
X printf("\033.Z"); /* turn plotter off again */
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/onoff.c &&
chmod 0644 libplot/hpgl/onoff.c ||
echo "restore of libplot/hpgl/onoff.c failed"
set `wc -c libplot/hpgl/onoff.c`;Wc_c=$1
if test "$Wc_c" != "110"; then
echo original size 110, current size $Wc_c
fi
# ============= libplot/hpgl/open.c ==============
echo "x - extracting libplot/hpgl/open.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/open.c &&
X/* @(#)open.c 1.5 of 2 Oct 84 */
Xopenpl()
X{
X on();
X printf("\033.I81;;17:"); /* set threshold for sending XOFF to 81
X * and set XON character to DC1
X */
X printf("\033.N;19:"); /* set XOFF character to DC3 */
X printf("IN;"); /* initialize everything */
X printf("SP 1;"); /* select left pen */
X printf("VS 20;"); /* reduce pen velocity */
X printf("SI 0.1368,0.27;"); /* char size absolute, shrunk a bit */
X off();
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/open.c &&
chmod 0644 libplot/hpgl/open.c ||
echo "restore of libplot/hpgl/open.c failed"
set `wc -c libplot/hpgl/open.c`;Wc_c=$1
if test "$Wc_c" != "429"; then
echo original size 429, current size $Wc_c
fi
# ============= libplot/hpgl/point.c ==============
echo "x - extracting libplot/hpgl/point.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/point.c &&
Xpoint(xi,yi){
X move(xi,yi);
X cont(xi,yi);
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/point.c &&
chmod 0644 libplot/hpgl/point.c ||
echo "restore of libplot/hpgl/point.c failed"
set `wc -c libplot/hpgl/point.c`;Wc_c=$1
if test "$Wc_c" != "44"; then
echo original size 44, current size $Wc_c
fi
# ============= libplot/hpgl/space.c ==============
echo "x - extracting libplot/hpgl/space.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/hpgl/space.c &&
X/* @(#)space.c 1.3 of 2 Oct 84 */
X
X#define PLOTX 10300 /* How wide is plotter in physical units. */
X#define PLOTY 7650 /* How high is plotter in physical units. */
X
Xint hpglsize = 7200; /* Size of coordinate space, for chord calculations. */
X
Xspace(x0,y0,x1,y1)
Xint x0, y0; /* lower left corner */
Xint x1, y1; /* upper right corner */
X{
X int absy;
X long aspect; /* In thousandths. */
X int llx, lly, urx, ury;
X
X /*
X * compute physical plot area: use as much of the paper as
X * possible while preserving the aspect ratio of the user space.
X */
X aspect = (1000L * abs(x1 - x0)) / abs(y1 - y0);
X if (aspect > (1000L * PLOTX) / PLOTY) { /* Wide and squat. */
X llx = 0;
X urx = PLOTX;
X lly = (PLOTY - (int)((1000L * PLOTX) / aspect)) / 2;
X ury = lly + (int)((1000L * PLOTX) / aspect);
X } else { /* Limited by height, not width. */
X lly = 0;
X ury = PLOTY;
X llx = (PLOTX - (int)((PLOTY * aspect)/1000)) / 2;
X urx = llx + (int)((PLOTY * aspect)/1000);
X }
X
X on();
X printf("IP %d,%d,%d,%d;", llx, lly, urx, ury); /* set plot area */
X printf("SC %d,%d,%d,%d;", x0, x1, y0, y1); /* set scaling */
X off();
X
X hpglsize = abs(x1 - x0);
X absy = abs(y1 - y0);
X if (absy > hpglsize)
X hpglsize = absy;
X}
SHAR_EOF
$TOUCH -am 0708142187 libplot/hpgl/space.c &&
chmod 0644 libplot/hpgl/space.c ||
echo "restore of libplot/hpgl/space.c failed"
set `wc -c libplot/hpgl/space.c`;Wc_c=$1
if test "$Wc_c" != "1198"; then
echo original size 1198, current size $Wc_c
fi
# ============= libplot/lp/Makefile ==============
if test ! -d 'libplot/lp'; then
echo "x - creating directory libplot/lp"
mkdir 'libplot/lp'
fi
echo "x - extracting libplot/lp/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/Makefile &&
X# Unix Makefile for hpglplot
X#
X# Copyright (c) 1988 Environmental Defense Fund, Inc.
X#
X# Latest revision: 07/08/88
X
X# Defines that can go in CFLAGS:
X# -DCHARSET= path of character set data file
X# -DTRUESOLID use true solid fill instead of tri-hatch
X#
X# -DTESTVER produce debugging output
X# -DTTY= terminal device name (only used if TESTVER defined)
X# -DGENIX use _exit in stead of exit in main.c
X#CFLAGS=-O -DCHARSET=\"/u/local/lib/charset.0\" -DTRUESOLID -DTESTVER -DTTY=\"/dev/tty\"
XCFLAGS=-O -DCHARSET=\"/usr2/local/lib/charset.0\" -DTTY=\"/dev/tty\" -DGENIX
XLIBS=
X
XDOCS= README hpglplot.doc hpgl.doc Makefile charset.0
X
XSRCS= \
Xlabel.c move.c circle.c liblj.c openpl.c linemod.c \
Xep_map.c ib_map.c lj_map.c maps.c \
Xplot_cha.c set_dbgs.c
X
XOBJS= \
Xlabel.o move.o circle.o liblj.o openpl.o linemod.o \
Xep_map.o ib_map.o lj_map.o maps.o \
Xplot_cha.o set_dbgs.o
X
XHDRS= \
Xconst.h dbgvars.h vars.h plotlp.h
X
XEXTRAS=
X
Xlibplotlp.a: $(OBJS)
X ar r libplotlp.a $(OBJS)
X
Xinstall: libplotlp.a charset.0
X cp libplotlp.a /usr/lib
X cp charset.0 /u/local/lib
X
Xlint: $(SRCS)
X lint $(SRCS) > lint.out
X
Xshar: plotlp.shar
X
Xplotlp.shar: $(DOCS) $(SRCS) $(HDRS)
X shar $(DOCS) $(SRCS) $(HDRS) > plotlp.shar
X
X# Break it down into several sharchives.
Xkit: $(DOCS) $(SRCS) $(HDRS)
X makekit -nPLOTLP. -oMANIFEST $(DOCS) $(SRCS) $(HDRS)
X touch kit
X
Xclean:
X rm -f $(OBJS) libplotlp.a
X
Xep_map.c: const.h fillcnst.h dbgvars.h
Xib_map.c: const.h fillcnst.h dbgvars.h
Xlj_map.c: const.h fillcnst.h
X#main.c: const.h vars.h dbgvars.h
Xmaps.c: const.h vars.h
Xmisc.c: const.h vars.h
Xplot_cha.c: const.h vars.h dbgvars.h
Xlabel.c : plotlp.h
Xmove.c : plotlp.h
Xcircle.c : plotlp.h
Xliblj.c : plotlp.h
Xopenpl.c : plotlp.h
Xlinemod.c : plotlp.h
X
X# Add missing default rule for UNOS.
X.SUFFIXES: .o
X.c.o:
X $(CC) $(CFLAGS) -c $<
X
SHAR_EOF
$TOUCH -am 0117134289 libplot/lp/Makefile &&
chmod 0644 libplot/lp/Makefile ||
echo "restore of libplot/lp/Makefile failed"
set `wc -c libplot/lp/Makefile`;Wc_c=$1
if test "$Wc_c" != "1799"; then
echo original size 1799, current size $Wc_c
fi
echo "End of part 2, continue with part 3"
exit 0
--
UUCP: ..!uunet!mcsun!hp4nl!integow!hot or hot at integow.UUCP or hot at hot.mug
Roland van Hout, Sr. software engineer, Integrity software consultants,
Pelmolenlaan 16, 3447 GW Woerden, Netherlands,
tel +31 3480-30131, fax +31 3480-30182
More information about the Alt.sources
mailing list