[alt.sources] PD plot

hot@integow.uucp (Roland van Hout) (10/28/90)

Here is a collection of PD plot libraries.
Also included is a hercules driver for Microport Unix V.3.2 and
Interactiver Unix V.3.2.0.2 (possibly other versions).
There is also a plot lib for the hercules driver.
Also included is a plot driver so you can add drivers to /usr/lib.
It should be easy to port these libraries to the various systems
especially those who have a plot(3) library.
Systems without any graphics should get a utility like gnuplot
to make graphs or to test the libraries.
I thank all then people  who made the sources their names and
copyrights or other licence information can be found in the
directories of the parts they made.
All the people are mentioned in the README file in the main
directory.
Most of this software has been tested on several System V
machines.(I've never tested the hpgl though)
Have Fun


-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is a shell archive (shar 3.21)
# made 10/26/1990 17:46 UTC by root@hot
# Source directory /u/pd/drivers/hercules
#
# existing files WILL be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#    172 -rw-r--r-- libplot/herc/README
#   1067 -rw-rw-rw- libplot/herc/herc.mk
#  19383 -rw-rw-rw- libplot/herc/libherc.c
#   1000 -rw-r--r-- libplot/ReGIS/ReGIS.mk
#   4002 -rw-r--r-- libplot/ReGIS/libReGIS.c
#    378 -rw-r--r-- libplot/hpgl/Makefile
#    572 -rw-r--r-- libplot/hpgl/README
#    737 -rw-r--r-- libplot/hpgl/arc.c
#    174 -rw-r--r-- libplot/hpgl/box.c
#    278 -rw-r--r-- libplot/hpgl/circle.c
#    168 -rw-r--r-- libplot/hpgl/close.c
#     92 -rw-r--r-- libplot/hpgl/cont.c
#     25 -rw-r--r-- libplot/hpgl/dot.c
#     27 -rw-r--r-- libplot/hpgl/erase.c
#   1323 -rw-r--r-- libplot/hpgl/hpglchord.c
#    163 -rw-r--r-- libplot/hpgl/label.c
#    111 -rw-r--r-- libplot/hpgl/line.c
#    413 -rw-r--r-- libplot/hpgl/linmod.c
#     91 -rw-r--r-- libplot/hpgl/move.c
#    110 -rw-r--r-- libplot/hpgl/onoff.c
#    429 -rw-r--r-- libplot/hpgl/open.c
#     44 -rw-r--r-- libplot/hpgl/point.c
#   1198 -rw-r--r-- libplot/hpgl/space.c
#   1799 -rw-r--r-- libplot/lp/Makefile
#  11475 -rw-r--r-- libplot/lp/charset.0
#   1407 -rw-r--r-- libplot/lp/circle.c
#    951 -rw-r--r-- libplot/lp/const.h
#    346 -rw-r--r-- libplot/lp/dbgvars.h
#   5595 -rw-r--r-- libplot/lp/ep_map.c
#    975 -rw-r--r-- libplot/lp/fillcnst.h
#    700 -rw-r--r-- libplot/lp/fillvars.h
#   4616 -rw-r--r-- libplot/lp/ib_map.c
#    879 -rw-r--r-- libplot/lp/itoa.h
#    939 -rw-r--r-- libplot/lp/label.c
#   4267 -rw-r--r-- libplot/lp/liblj.c
#    399 -rw-r--r-- libplot/lp/linemod.c
#   9092 -rw-r--r-- libplot/lp/lj_map.c
#   1200 -rw-r--r-- libplot/lp/maps.c
#   2718 -rw-r--r-- libplot/lp/move.c
#   2082 -rw-r--r-- libplot/lp/openpl.c
#   2788 -rw-r--r-- libplot/lp/plot_cha.c
#   2173 -rw-r--r-- libplot/lp/plotlp.h
#    885 -rw-r--r-- libplot/lp/plotlpus.h
#   1389 -rw-r--r-- libplot/lp/set_dbgs.c
#    830 -rw-r--r-- libplot/lp/vars.h
#   1519 -rw-r--r-- libplot/lp/README
#    652 -rw-r--r-- libplot/lp/README2
#    364 -rw-r--r-- libplot/sun/Makefile
#    756 -rw-r--r-- libplot/sun/README
#   4672 -rw-r--r-- libplot/sun/sunplot.1
#  19634 -rw-r--r-- libplot/sun/sunplot.c
#   1933 -rw-r--r-- libplot/sun/sunplot.icon
#    119 -rw-rw-rw- libplot/cgi/CGI.h
#   1343 -rw-rw-rw- libplot/cgi/CGI.mk
#   6196 -rw-rw-rw- libplot/cgi/libCGI.c
#    199 -rw-r--r-- libplot/cgi/README
#    627 -rw-rw-rw- libplot/cgi/h.c
#   2654 -rw-r--r-- lp.c
#    658 -rw-r--r-- herc/Makefile
#   1086 -rw-r--r-- herc/bitset.h
#    121 -rw-r--r-- herc/config
#  10419 -rw-r--r-- herc/herc.c
#   6396 -rw-r--r-- herc/herc.h
#   1690 -rw-r--r-- herc/test.c
#     14 -rw-r--r-- herc/ix386/n_herc
#     23 -rw-r--r-- herc/ix386/s_herc
#    156 -rw-r--r-- herc/ix386/mdevice
#    253 -rw-r--r-- herc/ix386/README
#   3061 -rw-r--r-- README
#   4963 -rw-r--r-- plot.c
#   5349 -rw-r--r-- lpdriver.c
#    584 -rw-r--r-- makefile
#   1115 -rw-r--r-- tplot.sh
#    885 -rw-r--r-- plotlpus.h
#   5283 -rw-r--r-- driver.c
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= libplot/herc/README ==============
if test ! -d 'libplot'; then
    echo "x - creating directory libplot"
    mkdir 'libplot'
fi
if test ! -d 'libplot/herc'; then
    echo "x - creating directory libplot/herc"
    mkdir 'libplot/herc'
fi
echo "x - extracting libplot/herc/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/herc/README &&
Xthe libherc.c is the plot(3) library
Xyou have to copy the herc.h file of the 286 or the 386 to /usr/include/sys
XDefine the correct define for or the 286 or the 386 driver.
SHAR_EOF
$TOUCH -am 1014202690 libplot/herc/README &&
chmod 0644 libplot/herc/README ||
echo "restore of libplot/herc/README failed"
set `wc -c libplot/herc/README`;Wc_c=$1
if test "$Wc_c" != "172"; then
	echo original size 172, current size $Wc_c
fi
# ============= libplot/herc/herc.mk ==============
echo "x - extracting libplot/herc/herc.mk (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/herc/herc.mk &&
X#	SCCS:	@(#)therc.mk	5.1 
X
XOWN=	bin		#file owner
XGRP=	bin		#file group
XPROT=	664		#protections
X#define UPORT286 if you will use the V.2 driver
X
XINSDIR = /usr/lib
XTESTDIR = .
XCFLAGS = -O -DIX386 
XSOURCE = libherc.c
XOFILES = libherc.o
XMAKE = make
X
Xall:	libherc.a
X	:
X
Xlibherc.a:	$(OFILES)
X	chmod $(PROT) $(OFILES)
X	chgrp $(GRP)  $(OFILES)
X	chown $(OWN)  $(OFILES)
X	ar r $(TESTDIR)/libherc.a $(OFILES)
X
Xinstall: all save move
X
Xclean:
X	-rm -f $(OFILES)
X
Xclobber: clean
X	-rm -f $(TESTDIR)/libherc.a
X
Xdelete:	clobber
X	rm -f $(SOURCE)
X
Xmove:
X	-rm -f $(INSDIR)/libherc.a
X	cp $(TESTDIR)/libherc.a $(INSDIR)/libherc.a
X	chmod $(PROT) $(INSDIR)/libherc.a
X	chmod -x $(INSDIR)/libherc.a	# not executable
X	chgrp $(GRP) $(INSDIR)/libherc.a
X	chown $(OWN) $(INSDIR)/libherc.a
X
Xsave:		
X	-if test -f $(INSDIR)/libherc.a ; \
X	then \
X		rm -f $(INSDIR)/OLDlibherc.a ; \
X		cp $(INSDIR)/libherc.a $(INSDIR)/OLDlibherc.a ; \
X		chmod $(PROT) $(INSDIR)/OLDlibherc.a ; \
X		chmod -x $(INSDIR)/OLDlibherc.a ; \
X		chgrp $(GRP) $(INSDIR)/OLDlibherc.a ; \
X		chown $(OWN) $(INSDIR)/OLDlibherc.a ; \
X	fi
SHAR_EOF
$TOUCH -am 1014202490 libplot/herc/herc.mk &&
chmod 0666 libplot/herc/herc.mk ||
echo "restore of libplot/herc/herc.mk failed"
set `wc -c libplot/herc/herc.mk`;Wc_c=$1
if test "$Wc_c" != "1067"; then
	echo original size 1067, current size $Wc_c
fi
# ============= libplot/herc/libherc.c ==============
echo "x - extracting libplot/herc/libherc.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/herc/libherc.c &&
X
X/* plot(4) graphics library for a hercules graphic card under unix
X	with the microport hercules driver in the system 
X	all the primitives are drawn with ioctl calls */
X
Xfloat gxscrunch,gyscrunch;
Xfloat pitograd;
Xint hercoffx,hercoffy;
X
X# include <stdio.h>
X/*# include <fcntl.h>*/
X# include <sys/herc.h>
X# include <math.h>
X
X/* Zeichensatz , IBM kompatibel */
X
Xchar font[256][8] = {	{   0,  0,  0,  0,  0,  0,  0,  0 },  /*   0    */
X			{ 126,129,165,129,189,153,129,126 },  /*   1    */
X			{ 126,255,219,255,195,231,255,126 },  /*   2    */
X			{ 108,254,254,254,124, 56, 16,  0 },  /*   3    */
X			{  16, 56,124,254,124, 56, 16,  0 },  /*   4    */
X			{  56,124, 56,254,254,124, 56,124 },  /*   5    */
X			{  16, 16, 56,124,254,124, 56,124 },  /*   6    */
X			{   0,  0, 24, 60, 60, 24,  0,  0 },  /*   7    */
X			{ 255,255,231,195,195,231,255,255 },  /*   8    */
X			{   0, 60,102, 66, 66,102, 60,  0 },  /*   9    */
X			{ 255,195,153,189,189,153,195,255 },  /*  10    */
X			{  15,  7, 15,125,204,204,204,120 },  /*  11    */
X			{  60,102,102,102, 60, 24,126, 24 },  /*  12    */
X			{  63, 51, 63, 48, 48,112,240,224 },  /*  13    */
X			{ 127, 99,127, 99, 99,103,230,192 },  /*  14    */
X			{ 153, 90, 60,231,231, 60, 90,153 },  /*  15    */
X			{ 128,224,248,254,248,224,128,  0 },  /*  16    */
X			{   2, 14, 62,254, 62, 14,  2,  0 },  /*  17    */
X			{  24, 60,126, 24, 24,126, 60, 24 },  /*  18    */
X			{ 102,102,102,102,102,  0,102,  0 },  /*  19    */
X			{ 127,219,219,123, 27, 27, 27,  0 },  /*  20    */
X			{  62, 99, 56,108,108, 56,204,120 },  /*  21    */
X			{   0,  0,  0,  0,126,126,126,  0 },  /*  22    */
X			{  24, 60,126, 24,126, 60, 24,255 },  /*  23    */
X			{  24, 60,126, 24, 24, 24, 24,  0 },  /*  24    */
X			{  24, 24, 24, 24,126, 60, 24,  0 },  /*  25    */
X			{   0, 24, 12,254, 12, 24,  0,  0 },  /*  26    */
X			{   0, 48, 96,254, 96, 48,  0,  0 },  /*  27    */
X			{   0,  0,192,192,192,254,  0,  0 },  /*  28    */
X			{   0, 36,102,255,102, 36,  0,  0 },  /*  29    */
X			{   0, 24, 60,126,255,255,  0,  0 },  /*  30    */
X			{   0,255,255,126, 60, 24,  0,  0 },  /*  31    */
X			{   0,  0,  0,  0,  0,  0,  0,  0 },  /*  32    */
X			{  48,120,120, 48, 48,  0, 48,  0 },  /*  33    */
X			{ 108,108,108,  0,  0,  0,  0,  0 },  /*  34    */
X			{ 108,108,254,108,254,108,108,  0 },  /*  35    */
X			{  48,124,192,120, 12,248, 48,  0 },  /*  36    */
X			{   0,198,204, 24, 48,102,198,  0 },  /*  37    */
X			{  56,108, 56,118,220,204,118,  0 },  /*  38    */
X			{  96, 96,192,  0,  0,  0,  0,  0 },  /*  39    */
X			{  24, 48, 96, 96, 96, 48, 24,  0 },  /*  40    */
X			{  96, 48, 24, 24, 24, 48, 96,  0 },  /*  41    */
X			{   0,102, 60,255, 60,102,  0,  0 },  /*  42    */
X			{   0, 48, 48,252, 48, 48,  0,  0 },  /*  43    */
X			{   0,  0,  0,  0,  0, 48, 48, 96 },  /*  44    */
X			{   0,  0,  0,252,  0,  0,  0,  0 },  /*  45    */
X			{   0,  0,  0,  0,  0, 48, 48,  0 },  /*  46    */
X			{   6, 12, 24, 48, 96,192,128,  0 },  /*  47    */
X			{ 124,198,206,222,246,230,124,  0 },  /*  48    */
X			{  48,112, 48, 48, 48, 48,252,  0 },  /*  49    */
X			{ 120,204, 12, 56, 96,204,252,  0 },  /*  50    */
X			{ 120,204, 12, 56, 12,204,120,  0 },  /*  51    */
X			{  28, 60,108,204,254, 12, 30,  0 },  /*  52    */
X			{ 252,192,248, 12, 12,204,120,  0 },  /*  53    */
X			{  56, 96,192,248,204,204,120,  0 },  /*  54    */
X			{ 252,204, 12, 24, 48, 48, 48,  0 },  /*  55    */
X			{ 120,204,204,120,204,204,120,  0 },  /*  56    */
X			{ 120,204,204,124, 12, 24,112,  0 },  /*  57    */
X			{   0, 48, 48,  0,  0, 48, 48,  0 },  /*  58    */
X			{   0, 48, 48,  0,  0, 48, 48, 96 },  /*  59    */
X			{  24, 48, 96,192, 96, 48, 24,  0 },  /*  60    */
X			{   0,  0,252,  0,  0,252,  0,  0 },  /*  61    */
X			{  96, 48, 24, 12, 24, 48, 96,  0 },  /*  62    */
X			{ 120,204, 12, 24, 48,  0, 48,  0 },  /*  63    */
X			{ 124,198,222,222,222,192,120,  0 },  /*  64    */
X			{  48,120,204,204,252,204,204,  0 },  /*  65    */
X			{ 252,102,102,124,102,102,252,  0 },  /*  66    */
X			{  60,102,192,192,192,102, 60,  0 },  /*  67    */
X			{ 248,108,102,102,102,108,248,  0 },  /*  68    */
X			{ 254, 98,104,120,104, 98,254,  0 },  /*  69    */
X			{ 254, 98,104,120,104, 96,240,  0 },  /*  70    */
X			{  60,102,192,192,206,102, 62,  0 },  /*  71    */
X			{ 204,204,204,252,204,204,204,  0 },  /*  72    */
X			{ 120, 48, 48, 48, 48, 48,120,  0 },  /*  73    */
X			{  30, 12, 12, 12,204,204,120,  0 },  /*  74    */
X			{ 230,102,108,120,108,102,230,  0 },  /*  75    */
X			{ 240, 96, 96, 96, 98,102,254,  0 },  /*  76    */
X			{ 198,238,254,254,214,198,198,  0 },  /*  77    */
X			{ 198,230,246,222,206,198,198,  0 },  /*  78    */
X			{  56,108,198,198,198,108, 56,  0 },  /*  79    */
X			{ 252,102,102,124, 96, 96,240,  0 },  /*  80    */
X			{ 120,204,204,204,220,120, 28,  0 },  /*  81    */
X			{ 252,102,102,124,108,102,230,  0 },  /*  82    */
X			{ 120,204,224,112, 28,204,120,  0 },  /*  83    */
X			{ 252,180, 48, 48, 48, 48,120,  0 },  /*  84    */
X			{ 204,204,204,204,204,204,252,  0 },  /*  85    */
X			{ 204,204,204,204,204,120, 48,  0 },  /*  86    */
X			{ 198,198,198,214,254,238,198,  0 },  /*  87    */
X			{ 198,198,108, 56, 56,108,198,  0 },  /*  88    */
X			{ 204,204,204,120, 48, 48,120,  0 },  /*  89    */
X			{ 254,198,140, 24, 50,102,254,  0 },  /*  90    */
X			{ 120, 96, 96, 96, 96, 96,120,  0 },  /*  91    */
X			{ 192, 96, 48, 24, 12,  6,  2,  0 },  /*  92    */
X			{ 120, 24, 24, 24, 24, 24,120,  0 },  /*  93    */
X			{  16, 56,108,198,  0,  0,  0,  0 },  /*  94    */
X			{   0,  0,  0,  0,  0,  0,  0,255 },  /*  95    */
X			{  48, 48, 24,  0,  0,  0,  0,  0 },  /*  96    */
X			{   0,  0,120, 12,124,204,118,  0 },  /*  97    */
X			{ 224, 96, 96,124,102,102,220,  0 },  /*  98    */
X			{   0,  0,120,204,192,204,120,  0 },  /*  99    */
X			{  28, 12, 12,124,204,204,118,  0 },  /* 100    */
X			{   0,  0,120,204,252,192,120,  0 },  /* 101    */
X			{  56,108, 96,240, 96, 96,240,  0 },  /* 102    */
X			{   0,  0,118,204,204,124, 12,248 },  /* 103    */
X			{ 224, 96,108,118,102,102,230,  0 },  /* 104    */
X			{  48,  0,112, 48, 48, 48,120,  0 },  /* 105    */
X			{  12,  0, 12, 12, 12,204,204,120 },  /* 106    */
X			{ 224, 96,102,108,120,108,230,  0 },  /* 107    */
X			{ 112, 48, 48, 48, 48, 48,120,  0 },  /* 108    */
X			{   0,  0,204,254,254,214,198,  0 },  /* 109    */
X			{   0,  0,248,204,204,204,204,  0 },  /* 110    */
X			{   0,  0,120,204,204,204,120,  0 },  /* 111    */
X			{   0,  0,220,102,102,124, 96,240 },  /* 112    */
X			{   0,  0,118,204,204,124, 12, 30 },  /* 113    */
X			{   0,  0,220,118,102, 96,240,  0 },  /* 114    */
X			{   0,  0,124,192,120, 12,248,  0 },  /* 115    */
X			{  16, 48,124, 48, 48, 52, 24,  0 },  /* 116    */
X			{   0,  0,204,204,204,204,118,  0 },  /* 117    */
X			{   0,  0,204,204,204,120, 48,  0 },  /* 118    */
X			{   0,  0,198,214,254,254,108,  0 },  /* 119    */
X			{   0,  0,198,108, 56,108,198,  0 },  /* 120    */
X			{   0,  0,204,204,204,124, 12,248 },  /* 121    */
X			{   0,  0,252,152, 48,100,252,  0 },  /* 122    */
X			{  28, 48, 48,224, 48, 48, 28,  0 },  /* 123    */
X			{  24, 24, 24,  0, 24, 24, 24,  0 },  /* 124    */
X			{ 224, 48, 48, 28, 48, 48,224,  0 },  /* 125    */
X			{ 118,220,  0,  0,  0,  0,  0,  0 },  /* 126    */
X			{   0, 16, 56,108,198,198,254,  0 },  /* 127    */
X			{  60,102, 96,102, 60, 12,  6, 60 },  /* 128    */
X			{   0,102,  0,102,102,102, 63,  0 },  /* 129    */
X			{  14,  0, 60,102,126, 96, 60,  0 },  /* 130    */
X			{ 126,195, 60,  6, 62,102, 63,  0 },  /* 131    */
X			{ 102,  0, 60,  6, 62,102, 63,  0 },  /* 132    */
X			{ 112,  0, 60,  6, 62,102, 63,  0 },  /* 133    */
X			{  24, 24, 60,  6, 62,102, 63,  0 },  /* 134    */
X			{   0,  0, 60, 96, 96, 60,  6, 28 },  /* 135    */
X			{ 126,195, 60,102,126, 96, 60,  0 },  /* 136    */
X			{ 102,  0, 60,102,126, 96, 60,  0 },  /* 137    */
X			{ 112,  0, 60,102,126, 96, 60,  0 },  /* 138    */
X			{ 102,  0, 56, 24, 24, 24, 60,  0 },  /* 139    */
X			{ 124,198, 56, 24, 24, 24, 60,  0 },  /* 140    */
X			{ 112,  0, 56, 24, 24, 24, 60,  0 },  /* 141    */
X			{  99, 28, 54, 99,127, 99, 99,  0 },  /* 142    */
X			{  24, 24,  0, 60,102,126,102,  0 },  /* 143    */
X			{  14,  0,126, 48, 60, 48,126,  0 },  /* 144    */
X			{   0,  0,127, 12,127,204,127,  0 },  /* 145    */
X			{  31, 54,102,127,102,102,103,  0 },  /* 146    */
X			{  60,102,  0, 60,102,102, 60,  0 },  /* 147    */
X			{   0,102,  0, 60,102,102, 60,  0 },  /* 148    */
X			{   0,112,  0, 60,102,102, 60,  0 },  /* 149    */
X			{  60,102,  0,102,102,102, 63,  0 },  /* 150    */
X			{   0,112,  0,102,102,102, 63,  0 },  /* 151    */
X			{   0,102,  0,102,102, 62,  6,124 },  /* 152    */
X			{ 195, 24, 60,102,102, 60, 24,  0 },  /* 153    */
X			{ 102,  0,102,102,102,102, 60,  0 },  /* 154    */
X			{  24, 24,126,192,192,126, 24, 24 },  /* 155    */
X			{  28, 54, 50,120, 48,115,126,  0 },  /* 156    */
X			{ 102,102, 60,126, 24,126, 24, 24 },  /* 157    */
X			{ 248,204,204,250,198,207,198,199 },  /* 158    */
X			{  14, 27, 24, 60, 24, 24,216,112 },  /* 159    */
X			{  14,  0, 60,  6, 62,102, 63,  0 },  /* 160    */
X			{  28,  0, 56, 24, 24, 24, 60,  0 },  /* 161    */
X			{   0, 14,  0, 60,102,102, 60,  0 },  /* 162    */
X			{   0, 14,  0,102,102,102, 63,  0 },  /* 163    */
X			{   0,124,  0,124,102,102,102,  0 },  /* 164    */
X			{ 126,  0,102,118,126,110,102,  0 },  /* 165    */
X			{  60,108,108, 62,  0,126,  0,  0 },  /* 166    */
X			{  56,108,108, 56,  0,124,  0,  0 },  /* 167    */
X			{  24,  0, 24, 48, 96,102, 60,  0 },  /* 168    */
X			{   0,  0,  0,126, 96, 96,  0,  0 },  /* 169    */
X			{   0,  0,  0,126,  6,  6,  0,  0 },  /* 170    */
X			{ 195,198,204,222, 51,102,204, 15 },  /* 171    */
X			{ 195,198,204,219, 55,111,207,  3 },  /* 172    */
X			{  24, 24,  0, 24, 24, 24, 24,  0 },  /* 173    */
X			{   0, 51,102,204,102, 51,  0,  0 },  /* 174    */
X			{   0,204,102, 51,102,204,  0,  0 },  /* 175    */
X			{  34,136, 34,136, 34,136, 34,136 },  /* 176    */
X			{  85,170, 85,170, 85,170, 85,170 },  /* 177    */
X			{ 219,119,219,238,219,119,219,238 },  /* 178    */
X			{  24, 24, 24, 24, 24, 24, 24, 24 },  /* 179    */
X			{  24, 24, 24, 24,248, 24, 24, 24 },  /* 180    */
X			{  24, 24,248, 24,248, 24, 24, 24 },  /* 181    */
X			{  54, 54, 54, 54,246, 54, 54, 54 },  /* 182    */
X			{   0,  0,  0,  0,254, 54, 54, 54 },  /* 183    */
X			{   0,  0,248, 24,248, 24, 24, 24 },  /* 184    */
X			{  54, 54,246,  6,246, 54, 54, 54 },  /* 185    */
X			{  54, 54, 54, 54, 54, 54, 54, 54 },  /* 186    */
X			{   0,  0,254,  6,246, 54, 54, 54 },  /* 187    */
X			{  54, 54,246,  6,254,  0,  0,  0 },  /* 188    */
X			{  54, 54, 54, 54,254,  0,  0,  0 },  /* 189    */
X			{  24, 24,248, 24,248,  0,  0,  0 },  /* 190    */
X			{   0,  0,  0,  0,248, 24, 24, 24 },  /* 191    */
X			{  24, 24, 24, 24, 31,  0,  0,  0 },  /* 192    */
X			{  24, 24, 24, 24,255,  0,  0,  0 },  /* 193    */
X			{   0,  0,  0,  0,255, 24, 24, 24 },  /* 194    */
X			{  24, 24, 24, 24, 31, 24, 24, 24 },  /* 195    */
X			{   0,  0,  0,  0,255,  0,  0,  0 },  /* 196    */
X			{  24, 24, 24, 24,255, 24, 24, 24 },  /* 197    */
X			{  24, 24, 31, 24, 31, 24, 24, 24 },  /* 198    */
X			{  54, 54, 54, 54, 55, 54, 54, 54 },  /* 199    */
X			{  54, 54, 55, 48, 63,  0,  0,  0 },  /* 200    */
X			{   0,  0, 63, 48, 55, 54, 54, 54 },  /* 201    */
X			{  54, 54,247,  0,255,  0,  0,  0 },  /* 202    */
X			{   0,  0,255,  0,247, 54, 54, 54 },  /* 203    */
X			{  54, 54, 55, 48, 55, 54, 54, 54 },  /* 204    */
X			{   0,  0,255,  0,255,  0,  0,  0 },  /* 205    */
X			{  54, 54,247,  0,247, 54, 54, 54 },  /* 206    */
X			{  24, 24,255,  0,255,  0,  0,  0 },  /* 207    */
X			{  54, 54, 54, 54,255,  0,  0,  0 },  /* 208    */
X			{   0,  0,255,  0,255, 24, 24, 24 },  /* 209    */
X			{   0,  0,  0,  0,255, 54, 54, 54 },  /* 210    */
X			{  54, 54, 54, 54, 63,  0,  0,  0 },  /* 211    */
X			{  24, 24, 31, 24, 31,  0,  0,  0 },  /* 212    */
X			{   0,  0, 31, 24, 31, 24, 24, 24 },  /* 213    */
X			{   0,  0,  0,  0, 63, 54, 54, 54 },  /* 214    */
X			{  54, 54, 54, 54,255, 54, 54, 54 },  /* 215    */
X			{  24, 24,255, 24,255, 24, 24, 24 },  /* 216    */
X			{  24, 24, 24, 24,248,  0,  0,  0 },  /* 217    */
X			{   0,  0,  0,  0, 31, 24, 24, 24 },  /* 218    */
X			{ 255,255,255,255,255,255,255,255 },  /* 219    */
X			{   0,  0,  0,  0,255,255,255,255 },  /* 220    */
X			{ 240,240,240,240,240,240,240,240 },  /* 221    */
X			{  15, 15, 15, 15, 15, 15, 15, 15 },  /* 222    */
X			{ 255,255,255,255,  0,  0,  0,  0 },  /* 223    */
X			{   0,  0, 59,110,100,110, 59,  0 },  /* 224    */
X			{   0, 60,102,124,102,124, 96, 96 },  /* 225    */
X			{   0,126,102, 96, 96, 96, 96,  0 },  /* 226    */
X			{   0,127, 54, 54, 54, 54, 54,  0 },  /* 227    */
X			{ 126,102, 48, 24, 48,102,126,  0 },  /* 228    */
X			{   0,  0, 63,108,108,108, 56,  0 },  /* 229    */
X			{   0, 51, 51, 51, 51, 62, 48, 96 },  /* 230    */
X			{   0, 59,110, 12, 12, 12, 12,  0 },  /* 231    */
X			{ 126, 24, 60,102,102, 60, 24,126 },  /* 232    */
X			{  28, 54, 99,127, 99, 54, 28,  0 },  /* 233    */
X			{  28, 54, 99, 99, 54, 54,119,  0 },  /* 234    */
X			{  14, 24, 12, 62,102,102, 60,  0 },  /* 235    */
X			{   0,  0,126,219,219,126,  0,  0 },  /* 236    */
X			{   6, 12,126,219,219,126, 96,192 },  /* 237    */
X			{  28, 96,192,252,192, 96, 28,  0 },  /* 238    */
X			{  60,102,102,102,102,102,102,  0 },  /* 239    */
X			{   0,126,  0,126,  0,126,  0,  0 },  /* 240    */
X			{  24, 24,126, 24, 24,  0,126,  0 },  /* 241    */
X			{  48, 24, 12, 24, 48,  0,126,  0 },  /* 242    */
X			{  12, 24, 48, 24, 12,  0,126,  0 },  /* 243    */
X			{  14, 27, 27, 24, 24, 24, 24, 24 },  /* 244    */
X			{  24, 24, 24, 24, 24,216,216,112 },  /* 245    */
X			{  24, 24,  0,126,  0, 24, 24,  0 },  /* 246    */
X			{   0,118,220,  0,118,220,  0,  0 },  /* 247    */
X			{  56,108,108, 56,  0,  0,  0,  0 },  /* 248    */
X			{   0,  0,  0, 24, 24,  0,  0,  0 },  /* 249    */
X			{   0,  0,  0,  0, 24,  0,  0,  0 },  /* 250    */
X			{  15, 12, 12, 12,236,108, 60, 28 },  /* 251    */
X			{ 120,108,108,108,108,  0,  0,  0 },  /* 252    */
X			{ 112, 24, 48, 96,120,  0,  0,  0 },  /* 253    */
X			{   0,  0, 60, 60, 60, 60,  0,  0 },  /* 254    */
X			{   0,  0,  0,  0,  0,  0,  0,  0 } };  /* 255    */
X
X
X	int	hercfd;
X#ifndef IX386
X	herc_args	herchv,herccurpos;
X#else
Xstruct h {
X	int c;
X	int x1;
X	int y1;
X	int x2;
X	int y2;
X	} ;
X
Xstruct h herccurpos;
X
XHERC Herc;
X#endif
X
X/* #define DEBUG   /* turn on if no driver calls should be made!*/
X
Xopenpl()
X{
X
X#ifndef DEBUG
X	hercfd = open("/dev/herc", O_WRONLY);
X#ifndef IX386
X        herccurpos=herchv;
X	herccurpos.c = 0x01;
X#endif
X#endif
X}
X
Xclosepl()
X{
X#ifndef DEBUG
X	close(hercfd);
X#endif
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=(630/(float) x);gyscrunch=(347/(float) y);
X	hercoffx = -(x0*gxscrunch);hercoffy=347+(y0*gyscrunch);
X}
X
X#ifdef DEBUG
Xprintf("offx=%d, offy=%d\n",hercoffx,hercoffy);
X#endif
X
X}
X
Xerase()
X{
X#ifndef DEBUG
X#ifndef IX386
X	ioctl(hercfd, HERC_CLEAR, &herchv);	/* Clear screen */
X#else
X	close(hercfd);
X	hercfd = open("/dev/herc", O_WRONLY);
X#endif
X#endif
X}
X
Xlabel(s)
Xchar *s;
X{
X	register int i;
X#ifndef IX386
X	herchv.str = s;
X	herchv.c = strlen(s);
X	herchv.x1 = herccurpos.x1/8; herchv.y1 = herccurpos.y1/8;
X	ioctl(hercfd, HERC_STR, &herchv);
X#else
X	Herc.cmd= SET_PIXEL;
X	for (i = 0 ; i < strlen(s);i++)
X	{
X		gchar((int) *(s + i), 8,(herccurpos.x1 + (i * 8)),herccurpos.y1);
X	}
X#endif
X}
X
Xmove(x,y)
Xint x,y;
X{
X	x = x*gxscrunch;
X	y = y*gyscrunch;
X	y = hercoffy - y ;x +=  hercoffx ;
X	herccurpos.x1 = x; herccurpos.y1 = y;
X#ifdef DEBUG
X	printf("move %d, %d\n",x,y);
X#endif
X
X}
X
Xcont(x,y)
Xint x,y;
X{
X	int xo,yo;
X	xo = x*gxscrunch;
X	yo = y*gyscrunch;
X	yo = hercoffy - yo ;xo +=  hercoffx ;
X#ifndef DEBUG
X#ifndef IX386
X		herchv.x1 = herccurpos.x1;
X		herchv.y1 = herccurpos.y1;
X		herchv.x2 = xo;
X		herchv.y2 = yo;
X		herchv.c = herccurpos.c;
X		ioctl(hercfd, HERC_LINE, &herchv);
X#else
X		hg_line(herccurpos.x1,herccurpos.y1,xo,yo);
X#endif
X#else
X		printf("cont = line from %d,%d to %d,%d\n",herccurpos.x1,herccurpos.y1,xo,yo);
X#endif
X		herccurpos.x1=xo;herccurpos.y1=yo;
X}
X
Xline (x1, y1, x2, y2)
Xint x1,y1,x2,y2;
X{
X	move(x1,y1);
X	cont(x2,y2);
X/*
X		herchv.x1 = abs(lrand48() % 719);
X		herchv.y1 = abs(lrand48() % 347);
X		herchv.x2 = abs(lrand48() % 719);
X		herchv.y2 = abs(lrand48() % 347);
X		herchv.c = 0x01;
X		ioctl(hercfd, HERC_LINE, &herchv);
X*/
X}
Xcircle(x,y,r)
Xint x,y,r;
X{
X/*
Xint xo,yo;
X	move((x-r),y);
X	xo=(x*gxscrunch);yo=(y*gyscrunch);
X	yo = hercoffy + yo;xo =  hercoffx + xo;
X	printf("\033PpC(C)[%d,%d]",xo,yo);
X*/
X	move(x,y);
X}
X
Xarc(x,y,x0,y0,x1,y1)
Xint x,y,x0,y0,x1,y1;
X{
X	move(x,y);
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 = hercoffy - yo;xo =  hercoffx + xo;
X	printf("\033PpC(A%dC) [%d,%d]\033\\",c,xo,yo);
X*/
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#ifndef DEBUG
X#ifdef IX386
XHERC Herc;
X	Herc.cmd= SET_PIXEL;
X#endif
X	x = x*gxscrunch;
X	y = y*gyscrunch;
X	y = hercoffy - y ;x +=  hercoffx ;
X	herccurpos.x1 = x; herccurpos.y1 = y;
X#ifndef IX386
X		herchv.x1 = x;
X		herchv.y1 = y;
X		herchv.c = herccurpos.c;
X		ioctl(hercfd, HERC_PLOT, &herchv);
X#else
X			Herc.phys_x = x;
X			Herc.phys_y = y;
X			if(write(hercfd, &Herc, sizeof(HERC)) < 0)
X			{
X				perror("main: write hercfd failed");
X				exit(2);
X			}
X#endif
X#else
X		printf("point %d,%d\n",x,y);
X#endif
X}
X
Xlinemod(s)
Xchar *s;
X{
X  if (strcmp(s,"dotted")==0) {
X	  herccurpos.c=0x42;
X	  }
X  else if (strcmp(s,"solid")==0) {
X	  herccurpos.c=0x01;
X	  }
X	  else if (strcmp(s,"longdashed")==0) {
X		  herccurpos.c=0x88;
X		  }
X		 else if (strcmp(s,"shortdashed")==0) {
X			  herccurpos.c=0x84;
X			 }
X			else if (strcmp(s,"dotdashed")==0) {
X				  herccurpos.c=0x01;
X				}
X}
X
X
X# define max(a,b)	(((a) > (b)) ? (a) : (b))
X# define abs(a)		(((a) < 0) ? (-a) : (a))
X# define sign(a)	((a) > 0 ? 1 : ((a) == 0 ? 0 : (-1)))
X# define TRUE		(-1)
X# define FALSE		(0)
Xhg_line(x1,y1,x2,y2,c)
Xint x1,y1,x2,y2,c;
X{
X	int ix, iy, i, inc, x,y, dx, dy, plot, plotx, ploty;
X	
X	Herc.cmd= SET_PIXEL;
X	dx=x2-x1; dy=y2-y1; 
X	ix = abs(dx);	iy = abs(dy);
X	inc = max(ix, iy);
X	plotx = x1;	ploty = y1;
X	x = y = 0;
X	for (i=0;i<=inc;++i)
X	{
X			x += ix;	y += iy;
X			plot = FALSE;
X			if (x > inc)
X			{ 
X				plot = TRUE;
X				x -= inc;
X				plotx += sign(dx);
X			};
X			if (y > inc)
X			{
X				plot = TRUE;
X				y -= inc;
X				ploty += sign(dy);
X			};
X
X			if (plot) 
X			{
X				Herc.phys_x = plotx;
X				Herc.phys_y = ploty;
X				if(write(hercfd, &Herc, sizeof(HERC)) < 0)
X				{
X					perror("main: write hercfd failed"); exit(2);
X				}
X			}
X	};
X}
X
Xbox(x0, y0, x1, y1)
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}
X /* PC spezifische Steuerroutinen */
X
X
X
Xgchar(byte,chrsize,x,y)
Xint byte,chrsize,x,y;
X{
Xregister int zeile,spalte;
Xchar h[2];
Xh[1]=0;
Xfor (zeile = 0 ; zeile <=7 ; zeile++)
X  {
X  for (spalte=0 ; spalte <= 7; spalte++)
X    {
X    if ((font[byte][zeile] & (128 >> spalte)) != 0)
X	{
X			Herc.phys_x = x+spalte; 
X			Herc.phys_y = y+zeile-7; 
X			if(write(hercfd, &Herc, sizeof(HERC)) < 0)
X			{
X				perror("main: write hercfd failed");
X				exit(2);
X			}
X	}
X    }
X  }
X}
X
X
SHAR_EOF
$TOUCH -am 1014173090 libplot/herc/libherc.c &&
chmod 0666 libplot/herc/libherc.c ||
echo "restore of libplot/herc/libherc.c failed"
set `wc -c libplot/herc/libherc.c`;Wc_c=$1
if test "$Wc_c" != "19383"; then
	echo original size 19383, current size $Wc_c
fi
# ============= libplot/ReGIS/ReGIS.mk ==============
if test ! -d 'libplot/ReGIS'; then
    echo "x - creating directory libplot/ReGIS"
    mkdir 'libplot/ReGIS'
fi
echo "x - extracting libplot/ReGIS/ReGIS.mk (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/ReGIS/ReGIS.mk &&
XOWN=	bin		#file owner
XGRP=	bin		#file group
XPROT=	664		#protections
X
XINSDIR = /usr/lib
XINS = :
XTESTDIR = .
XCFLAGS = -O
XSOURCE = libReGIS.c
XOFILES = libReGIS.o
X
Xall:	libReGIS.a
X	:
X
XlibReGIS.a:	$(OFILES)
X	chmod $(PROT) $(OFILES)
X	chgrp $(GRP)  $(OFILES)
X	chown $(OWN)  $(OFILES)
X	ar r $(TESTDIR)/libReGIS.a $(OFILES)
X
Xinstall: all save move
X
Xclean:
X	-rm -f $(OFILES)
X
Xclobber: clean
X	-rm -f $(TESTDIR)/libReGIS.a
X
Xdelete:	clobber
X	rm -f $(SOURCE)
X
Xmove:
X	-rm -f $(INSDIR)/libReGIS.a
X	cp $(TESTDIR)/libReGIS.a $(INSDIR)/libReGIS.a
X	chmod $(PROT) $(INSDIR)/libReGIS.a
X	chmod -x $(INSDIR)/libReGIS.a	# not executable
X	chgrp $(GRP) $(INSDIR)/libReGIS.a
X	chown $(OWN) $(INSDIR)/libReGIS.a
X
Xsave:		
X	-if test -f $(INSDIR)/libReGIS.a ; \
X	then \
X		rm -f $(INSDIR)/OLDlibReGIS.a ; \
X		cp $(INSDIR)/libReGIS.a $(INSDIR)/OLDlibReGIS.a ; \
X		chmod $(PROT) $(INSDIR)/OLDlibReGIS.a ; \
X		chmod -x $(INSDIR)/OLDlibReGIS.a ; \
X		chgrp $(GRP) $(INSDIR)/OLDlibReGIS.a ; \
X		chown $(OWN) $(INSDIR)/OLDlibReGIS.a ; \
X	fi
SHAR_EOF
$TOUCH -am 1014195290 libplot/ReGIS/ReGIS.mk &&
chmod 0644 libplot/ReGIS/ReGIS.mk ||
echo "restore of libplot/ReGIS/ReGIS.mk failed"
set `wc -c libplot/ReGIS/ReGIS.mk`;Wc_c=$1
if test "$Wc_c" != "1000"; then
	echo original size 1000, current size $Wc_c
fi
echo "End of part 1, continue with part 2"
exit 0






-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/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@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@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is part 03 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= libplot/lp/charset.0 ==============
echo "x - extracting libplot/lp/charset.0 (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/charset.0 &&
X   2,0, 100, 0,0, -100, 0,2, 100, 0,6, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ! */
X   1,6, 100, 1,2, -100, 1,-2, 100, 1,2, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* " */
X   1,1, 100, 0,6, -100, 2,0, 100, 0,-6, -100, 1,2, 100, -4,0, -100, 0,2, 100, 4,0, -200,-200,-200,-200,-200 /* # */
X   0,2, 100, 1,-1, 2,0, 1,1, 0,1, -4,2, 0,1, 1,1, 2,0, 1,-1, -100, -2,2, 100, 0,-8, -200 /* $ */
X   0,2, 100, 3,4, -100, -2,0, 100, -1,-1, 0,1, 1,0, -100, 2,-3, 100, 0,-1, -1,0, 1,1, -200,-200,-200 /* % */
X   4,0, 100, -3,5, 0,2, 1,1, 1,-1, 0,-2, -3,-2, 0,-2, 1,-1, 2,0, 1,2, -200,-200,-200,-200,-200 /* & */
X   1,6, 100, 1,2, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ' */
X   3,0, 100, -1,2, 0,4, 1,2, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ( */
X   1,0, 100, 1,2, 0,4, -1,2, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ) */
X   0,2, 100, 4,4, -100, -4,0, 100, 4,-4, -100, -2,0, 100, 0,4, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* * */
X   2,2, 100, 0,4, -100, -2,-2, 100, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* + */
X   2,0, 100, -1,0, 0,1, 1,0, 0,-1, -1,-1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* , */
X   0,4, 100, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* - */
X   1,0, 100, 0,1, 1,0, 0,-1, -1,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* . */
X   0,1, 100, 3,6, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* / */
X   1,0, 100, -1,3, 0,2, 1,3, 2,0, 1,-3, 0,-2, -1,-3, -2,0, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* 0 */
X   1,0, 100, 2,0, -1,0, 0,8, -1,-1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* 1 */
X   4,0, 100, -4,0, 0,1, 1,2, 2,1, 1,1, 0,2, -1,1, -2,0, -1,-1, 0,-1, -200,-200,-200,-200,-200 /* 2 */
X   0,1, 100, 1,-1, 2,0, 1,1, 0,2, -1,1, -2,0, 2,0, 1,1, 0,2, -1,1, -2,0, -1,-1, -200 /* 3 */
X   4,0, 100, 0,8, 0,-4, -4,0, 1,4, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* 4 */
X   0,1, 100, 1,-1, 2,0, 1,1, 0,2, -1,1, -3,0, 0,4, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* 5 */
X   0,4, 100, 3,0, 1,-1, 0,-2, -1,-1, -2,0, -1,1, 0,6, 1,1, 2,0, 1,-1, -200,-200,-200,-200,-200 /* 6 */
X   1,0, 100, 3,8, -4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* 7 */
X   0,1, 100, 0,2, 4,2, 0,2, -1,1, -2,0, -1,-1, 0,-2, 4,-2, 0,-2, -1,-1, -2,0, -1,1, -200 /* 8 */
X   4,0, 100, 0,8, -3,0, -1,-1, 0,-2, 1,-1, 2,0, 1,1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* 9 */
X   1,0, 100, 0,1, 1,0, 0,-1, -1,0, -100, 0,4, 100, 0,1, 1,0, 0,-1, -1,0, -200,-200,-200,-200,-200 /* : */
X   2,0, 100, -1,0, 0,1, 1,0, 0,-1, -1,-1, -100, 0,5, 100, 0,1, 1,0, 0,-1, -1,0, -200,-200,-200 /* ; */
X   4,1, 100, -3,3, 3,3, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* < */
X   0,3, 100, 4,0, -100, 0,2, 100, -4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* = */
X   0,1, 100, 3,3, -3,3, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* > */
X   2,0, 100, 0,0, -100, 0,2, 100, 0,1, 2,2, 0,2, -1,1, -2,0, -1-1, -200,-200,-200,-200,-200,-200,-200 /* ? */
X   4,1, 100, -3,0, -1,1, 0,4, 1,1, 2,0, 1,-1, 0,-2, -1,-1, -1,0, 0,2, 2,1, -200, -200, -200 /* @ */
X   100, 0,5, 2,3, 2,-3, 0,-5, -100, 0,4, 100, -4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* A */
X   0,4, 100, 3,0, 1,-1, 0,-2, -1,-1, -3,0, 0,8, 3,0, 1,-1, 0,-2, -1,-1, -200,-200,-200,-200,-200 /* B */
X   4,1, 100, -1,-1, -2,0, -1,1, 0,6, 1,1, 2,0, 1,-1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* C */
X   100, 0,8, 3,0, 1,-1, 0,-6, -1,-1, -3,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* D */
X   4,0, 100, -4,0, 0,4, 3,0, -3,0, 0,4, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* E */
X   100, 0,4, 3,0, -3,0, 0,4, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* F */
X   2,3, 100, 2,0, 0,-2, -1,-1, -2,0, -1,1, 0,6, 1,1, 2,0, 1,-1, -200,-200,-200,-200,-200,-200,-200 /* G */
X   100, 0,8, 0,-4, 4,0, 0,4, 0,-8, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* H */
X   1,0, 100, 2,0, -1,0, 0,8, 1,0, -2,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* I */
X   0,2, 100, 0,-1, 1,-1, 2,0, 1,1, 0,7, -1,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* J */
X   100, 0,8, 0,-4, 4,4, -4,-4, 4,-4, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* K */
X   4,0, 100, -4,0, 0,8, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* L */
X   100, 0,8, 2,-3, 2,3, 0,-8, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* M */
X   100, 0,8, 4,-8, 0,8, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* N */
X   0,1, 100, 0,6, 1,1, 2,0, 1,-1, 0,-6, -1,-1, -2,0, -1,1, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* O */
X   100, 0,8, 3,0, 1,-1, 0,-2, -1,-1, -3,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* P */
X   0,1, 100, 0,6, 1,1, 2,0, 1,-1, 0,-6, -1,-1, -2,0, -1,1, -100, 2,1, 100, 2,-2, -200,-200,-200 /* Q */
X   100, 0,8, 3,0, 1,-1, 0,-2, -1,-1, -3,0, 2,0, 2,-4, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* R */
X   0,1, 100, 1,-1, 2,0, 1,1, 0,2, -1,1, -2,0, -1,1, 0,2, 1,1, 2,0, 1,-1, -200,-200,-200 /* S */
X   2,0, 100, 0,8, -2,0, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* T */
X   0,8, 100, 0,-7, 1,-1, 2,0, 1,1, 0,-1, 0,8, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* U */
X   0,8, 100, 1,-5, 1,-3, 1,3, 1,5, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* V */
X   0,8, 100, 0,-6, 1,-2, 1,3, 0,1, 0,-1, 1,-3, 1,2, 0,6, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* W */
X   100, 4,8, -100, -4,0, 100, 4,-8, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* X */
X   2,0, 100, 0,5, -2,3, 2,-3, 2,3, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* Y */
X   0,8, 100, 4,0, -4,-8, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* Z */
X   3,0, 100, -1,0, 0,8, 1,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* [ */
X   0,7, 100, 3,-6, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* \ */
X   1,0, 100, 1,0, 0,8, -1,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ] */
X   0,6, 100, 2,2, 2,-2, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ^ */
X   100, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* _ */
X   2,8, 100, 1,-2, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ` */
X   4,1, 100, -1,-1, -2,0, -1,1, 0,2, 1,2, 3,0, 0,-5, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* a */
X   0,8, 100, 0,-8, 0,1, 1,-1, 2,0, 1,1, 0,3, -1,1, -3,0, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* b */
X   4,1, 100, -1,-1, -2,0, -1,1, 0,3, 1,1, 2,0, 1,-1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* c */
X   4,8, 100, 0,-8, 0,1, -1,-1, -2,0, -1,1, 0,3, 1,1, 3,0, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* d */
X   4,1, 100, -1,-1, -2,0, -1,1, 0,3, 1,1, 2,0, 1,-1, 0,-1, -4,0, -200,-200,-200,-200,-200,-200,-200 /* e */
X   1,0, 100, 0,7, 1,1, 1,0, 1,-1, -100, -2,-3, 100, -2,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* f */
X   4,1, 100, -1,-1, -2,0, -1,1, 0,3, 1,1, 3,0, 0,-7, -1,-1, -2,0, -1,1, -200,-200,-200,-200,-200 /* g */
X   100, 0,8, 0,-4, 1,1, 2,0, 1,-1, 0,-4, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* h */
X   1,0, 100, 2,0, -1,0, 0,5, -100, 0,2, 100, 0,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* i */
X   0,-2, 100, 1,-1, 1,0, 1,1, 0,7, -100, 0,2, 100, 0,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* j */
X   100, 0,8, 0,-5, 4,2, -2,-1, 2,-4, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* k */
X   1,0, 100, 2,0, -1,0, 0,8, -1,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* l */
X   100, 0,5, 0,-1, 1,1, 1,0, 0,-5, 0,4, 1,1, 1,0, 0,-5, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* m */
X   100, 0,5, 0,-1, 1,1, 2,0, 1,-1, 0,-4, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* n */
X   1,0, 100, -1,1, 0,3, 1,1, 2,0, 1,-1, 0,-3, -1,-1, -2,0, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* o */
X   0,-3, 100, 0,8, 3,0, 1,-1, 0,-3, -1,-1, -2,0, -1,1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* p */
X   4,1, 100, -1,-1, -2,0, -1,1, 0,3, 1,1, 3,0, 0,-8, -1,0, 2,0, -200,-200,-200,-200,-200,-200,-200 /* q */
X   100, 0,5, 0,-2, 2,2, 2,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* r */
X   0,1, 100, 1,-1, 2,0, 1,1, 0,1, -4,1, 0,1, 1,1, 2,0, 1,-1, -200,-200,-200,-200,-200,-200,-200 /* s */
X   2,0, 100, 0,8, -100, -2,-3, 100, 4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* t */
X   0,5, 100, 0,-4, 1,-1, 2,0, 1,1, 0,-1, 0,5, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* u */
X   0,5, 100, 2,-5, 2,5, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* v */
X   0,5, 100, 0,-3, 1,-2, 1,3, 0,2, 0,-2, 1,-3, 1,2, 0,3, -200,-200,-200,-200,-200,-200,-200,-200,-200 /* w */
X   100, 4,5, -100, -4,0, 100, 4,-5, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* x */
X   0,5, 100, 2,-5, -2,-3, 2,3, 2,5, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* y */
X   4,0, 100, -4,0, 4,5, -4,0, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* z */
X   3,0, 100, -1,1, 0,2, -1,1, 1,1, 0,2, 1,1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* { */
X   2,0, 100, 0,8, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* | */
X   1,0, 100, 1,1, 0,2, 1,1, -1,1, 0,2, -1,1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* } */
X   1,6, 100, 1,1, 1,-1, 1,1, -200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200,-200 /* ~ */
SHAR_EOF
$TOUCH -am 0706211890 libplot/lp/charset.0 &&
chmod 0644 libplot/lp/charset.0 ||
echo "restore of libplot/lp/charset.0 failed"
set `wc -c libplot/lp/charset.0`;Wc_c=$1
if test "$Wc_c" != "11475"; then
	echo original size 11475, current size $Wc_c
fi
# ============= libplot/lp/circle.c ==============
echo "x - extracting libplot/lp/circle.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/circle.c &&
X/*
X * do_ci.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include <math.h>
X#include "plotlp.h"
X#ifdef TESTVER
X#include "dbgvars.h"
X#endif
X
X#define DEGREES_TO_RADIANS 3.1415926535898 / 180.0
X
Xcircle(x,y,r)
Xint x,y,r;
X{
X    POINT   t,
X            t0,
X            t1;
X    float   radius;
X    int     i_radius,
X            chordangle;
X    int     i;
X
X#ifdef TESTVER
X    int     xwas_on;		/* for debugging */
X
X    /* turn debug2 off, if necessary, for the duration of do_CI() */
X    if (debug2x) {
X	xwas_on = TRUE;
X	debug2x = FALSE;
X    } else {
X	xwas_on = FALSE;
X    }
X#endif
X
X
X	radius=r*gxscrunch;
X
X    if (scaling) {
X	i_radius = (int) (radius * x_scaler);
X	if (i_radius < 0)
X	    i_radius -= 1;
X    } else
X	i_radius = (int) radius;
X	current.x=x*gxscrunch;current.y=y*gyscrunch;
X        current.x += offx; current.y += offy;
X    t.x = t0.x = i_radius + current.x;
X    t.y = t0.y = current.y;
X    chordangle=1;
X    for (i = chordangle; i < 360; i += chordangle) {
X	t1.x = (double) radius *cos((double) i
X	    *       DEGREES_TO_RADIANS) + current.x;
X	t1.y = (double) radius *sin((double) i
X	    *       DEGREES_TO_RADIANS) + current.y;
X
X	put_seg(t, t1);
X	t = t1;
X    }
X    /* plot last full or partial chord; chordangle may not be a factor of 360 */
X    put_seg(t, t0);
X
X#ifdef TESTVER			/* reset debug2x if necessary */
X    if (xwas_on) {
X	debug2x = TRUE;
X    }
X#endif
X}
SHAR_EOF
$TOUCH -am 1010212988 libplot/lp/circle.c &&
chmod 0644 libplot/lp/circle.c ||
echo "restore of libplot/lp/circle.c failed"
set `wc -c libplot/lp/circle.c`;Wc_c=$1
if test "$Wc_c" != "1407"; then
	echo original size 1407, current size $Wc_c
fi
# ============= libplot/lp/const.h ==============
echo "x - extracting libplot/lp/const.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/const.h &&
X/*
X * const.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
Xtypedef struct {
X    int     x,
X            y;
X} POINT;
X
X#define PA 0
X#define PR 1
X#define PD 2
X#define PU 3
X
X#define ESC 27
X
X#define TRUE 1
X#define FALSE 0
X
X/* LINE TYPES */
X#define DOTS 0
X#define SHORT_DASH 1
X#define BROKN_1 2
X#define BROKN_2 3
X#define BROKN_DOT 4
X#define BROKN_DASH 5
X#define BROKN_2DASH 6
X#define SOLID 7
X
X/* FILL TYPES: values assigned to var fill_type */
X#define BI_SOLID 1
X#define UNI_SOLID 2
X#define PARALLEL 3
X#define CROSS_HATCH 4
X
X/* Charater set defines */
X#define CHAR_ELEM 28
X#define NUM_CHAR 94
X
X/* Printer model: values of global var 'printer' */
X#define EPSON    1		/* Epson LQ 1500 */
X#define LASERLOW 2		/* HP LaserJet Plus low sized 5" x 6" */
X#define IBM_PRO  3		/* IBM Proprinter */
X#define LASERMED 4		/* HP LaserJet Plus med sized 8" x 6" */
X#define LASERHIGH 5		/* HP LaserJet Plus extra large 8" x 11"*/
X
X#define BITMAPSIZE 935000
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/const.h &&
chmod 0644 libplot/lp/const.h ||
echo "restore of libplot/lp/const.h failed"
set `wc -c libplot/lp/const.h`;Wc_c=$1
if test "$Wc_c" != "951"; then
	echo original size 951, current size $Wc_c
fi
# ============= libplot/lp/dbgvars.h ==============
echo "x - extracting libplot/lp/dbgvars.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/dbgvars.h &&
X/*
X * dbgvars.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * the home for these vars is set_dbgs.c
X */
X
X#include <stdio.h>
X
Xextern FILE *errfp;
X
Xextern int debug1c,
X        debug1f,
X        debug2,
X        debug2x,
X        debug3,
X        debug4,
X        debug5,
X        debug6,
X        debug7,
X        debug8,
X        debug9;
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/dbgvars.h &&
chmod 0644 libplot/lp/dbgvars.h ||
echo "restore of libplot/lp/dbgvars.h failed"
set `wc -c libplot/lp/dbgvars.h`;Wc_c=$1
if test "$Wc_c" != "346"; then
	echo original size 346, current size $Wc_c
fi
# ============= libplot/lp/ep_map.c ==============
echo "x - extracting libplot/lp/ep_map.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/ep_map.c &&
X/*
X * ep_map.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "const.h"
X#include "fillcnst.h"
X
X#ifdef TESTVER
X#include <signal.h>
X#include "dbgvars.h"
X#endif
X
X/* Constants */
X/* SCALEX = 10.15 (inches) / 10366 (plotter units) * 180 (dots/inch) */
X#define SCALEX 0.1762492
X/* SCALEY = 7.8 (inches) / 7963 (plotter units) * 180 (dots/inch) */
X#define SCALEY 0.1763154
X
X#define YLIM 1404
X#define XLIM 231
X
X#define ROUNDER 0.0
X
X#ifdef TESTVER
X#define PUT_BIT(x, y) map[(tempindex = (tempy = y) + YLIM * ((tempx = x) >> 3))] |= BITS[x & 7];
X#else
X#define PUT_BIT(x, y) map[y + YLIM * (x >> 3)] |= BITS[x & 7]
X#endif
X
X#define ABS(x) ( (x) > 0.0 ? (x) : -(x) )
X
Xstatic char BITS[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
X
X/* move bit map to maps.c for combined printer version --- */
X/* char   map[XLIM * YLIM]; */
Xextern char map[];
X
X#ifdef TESTVER
Xstatic int tempindex,
X        tempx,
X        tempy;
Xstatic POINT tempp1,
X        tempp2;
X
Xep_catch()
X{
X    fprintf(stderr, "Segmentation violation\n");
X    fprintf(stderr, "tempindex = %d x = %d y = %d p1 = %d,%d p2 = %d,%d\n", tempindex, tempx, tempy, tempp1.x, tempp1.y, tempp2.x, tempp2.y);
X    ep_dump_map(FALSE);
X    exit(1);
X}
X
Xepcatchi()
X{
X    ep_dump_map(FALSE);
X    exit(1);
X}
X
X#endif
X
X
Xep_put_seg(p1, p2)
X    POINT   p1,
X            p2;
X{
X    double  diffx,
X            diffy,
X            change_ratio;
X    register int x,
X            y;
X    register int inc;
X
X#ifdef TESTVER
X    if (debug2 || debug2x) {
X	fprintf(errfp, "p1 ( %d, %d );   p2 ( %d, %d )\n",
X	    p1.x, p1.y, p2.x, p2.y);
X    }
X#if 0
X    signal(SIGSEGV, ep_catch);
X    signal(SIGINT, epcatchi);
X#endif
X    tempp1 = p1;
X    tempp2 = p2;
X#endif
X
X    p1.x = SCALEX * (double) p1.x + ROUNDER;
X    p2.x = SCALEX * (double) p2.x + ROUNDER;
X    p1.y = SCALEY * (double) p1.y + ROUNDER;
X    p2.y = SCALEY * (double) p2.y + ROUNDER;
X
X    diffx = p2.x - p1.x;
X    diffy = p2.y - p1.y;
X
X    if (diffx != 0.0 && diffy != 0.0) {
X	if (ABS(diffx) > ABS(diffy)) {
X	    inc = (diffx < 0) ? -1 : 1;
X	    change_ratio = diffy / diffx;
X	    for (x = p1.x; x != p2.x; x += inc) {
X		y = (x - p1.x) * change_ratio + p1.y + ROUNDER;
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, p2.y);
X	} else {
X	    inc = (diffy < 0) ? -1 : 1;
X	    change_ratio = diffx / diffy;
X	    for (y = p1.y; y != p2.y; y += inc) {
X		x = (y - p1.y) * change_ratio + p1.x + ROUNDER;
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, p2.y);
X	}
X    } else {
X	if (diffx) {		/* horizontal line */
X	    y = p1.y;
X	    inc = (diffx < 0) ? -1 : 1;
X	    for (x = p1.x; x != p2.x; x += inc) {
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, y);
X	} else {
X	    x = p1.x;
X	    inc = (diffy < 0) ? -1 : 1;
X	    for (y = p1.y; y != p2.y; y += inc) {
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(x, p2.y);
X	}
X    }
X}
X
X
X/* LEFT_CUTOFF is the number of dot rows along left edge of page to skip over.
X *    shifts image to the left by that many dot rows on the hardcopy page */
X#define LEFT_CUTOFF  72
X
Xep_dump_map(to_printer)
X    int     to_printer;
X{
X    register int k;
X    int     map_max = XLIM * YLIM;
X    int     i,
X            j;
X    char    hdr[5];
X    register char *pm0,
X           *pm1,
X           *pm2,
X           *pb;
X    char    buf[180];
X    int     non_blank;
X    short int lim;
X
X#ifndef TESTVER
X    to_printer = TRUE;
X#endif
X
X    if (to_printer) {
X	hdr[0] = ESC;
X	hdr[1] = '3';
X	hdr[2] = 24;		/* Spacing at 24/180 inch per line */
X	write(1, hdr, 3);
X	hdr[1] = '*';
X	hdr[2] = 39;		/* Triple density, 24 pins */
X	hdr[3] = (YLIM - LEFT_CUTOFF) & 0x0ff;
X	hdr[4] = ((YLIM - LEFT_CUTOFF) >> 8) & 0x0ff;
X	for (k = 0; k < map_max; k += 3 * YLIM) {
X	    write(1, hdr, 5);
X	    pm0 = &map[k + LEFT_CUTOFF];
X	    pm1 = &map[k + YLIM + LEFT_CUTOFF];
X	    pm2 = &map[k + (2 * YLIM) + LEFT_CUTOFF];
X	    lim = YLIM - LEFT_CUTOFF;
X	    while ((lim -= 60) >= 0) {
X		pb = buf;
X		for (i = 0; i < 60; i++) {
X		    *pb++ = *pm0++;
X		    *pb++ = *pm1++;
X		    *pb++ = *pm2++;
X		}
X		write(1, buf, 180);
X		fflush(stdout);
X	    }
X
X	    if (lim < 0)
X		for (lim += 60; lim > 0; lim--) {
X		    pb = buf;
X		    *pb++ = *pm0++;
X		    *pb++ = *pm1++;
X		    *pb++ = *pm2++;
X		    write(1, buf, 3);
X		    fflush(stdout);
X		}
X	    write(1, "\n\r", 2);/* LF and CR to end line */
X	}
X	hdr[0] = '\f';		/* Initialize the printer */
X	write(1, hdr, 1);
X	fflush(stdout);
X	hdr[0] = ESC;		/* Initialize the printer */
X	hdr[1] = '@';
X	write(1, hdr, 2);
X	fflush(stdout);
X#ifdef TESTVER
X	fclose(errfp);
X#endif
X
X    }
X#ifdef TESTVER
X    else {
X	FILE   *tty,
X	       *ttyout;
X	int     dump_start,
X	        dump_stop;
X
X	if ((tty = fopen(TTY, "r")) == NULL) {
X	    perror(TTY);
X	    exit(10);
X	}
X	if ((ttyout = fopen(TTY, "w")) == NULL) {
X	    perror(TTY);
X	    exit(10);
X	}
X	fprintf(ttyout, "Enter start bit:");
X	fflush(ttyout);
X	fscanf(tty, "%d", &dump_start);
X	dump_stop = dump_start + 79;
X	non_blank = 0;
X	pb = buf;
X	for (k = 0; k < XLIM * YLIM; k += YLIM) {
X	    for (i = 0; i < 8; i++) {
X		for (j = k + dump_start; j < k + dump_stop; j++) {
X		    if (map[j] & BITS[i]) {
X			sprintf(pb, ".");
X			non_blank = 1;
X		    } else {
X			sprintf(pb, " ");
X		    }
X		    pb++;
X		}
X		if (non_blank) {
X		    sprintf(pb, "\n\000");
X		    printf("%s", buf);
X		}
X		non_blank = 0;
X		pb = buf;
X	    }
X	}
X    }
X#endif
X
X}
X
X
Xep_init_map()
X{
X    register int k;
X    int     map_max = XLIM * YLIM;
X    register char *mp;
X
X#ifdef TRUESOLID
X    extern double PUs_per_dot;	/* declared in file filltype.c */
X
X    PUs_per_dot = 1.0 / SCALEX;	/* used by fix_fill() in file filltype.c */
X#endif
X
X    mp = map;
X    for (k = 0; k < map_max; k++) {
X	*mp++ = 0;
X    }
X}
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/ep_map.c &&
chmod 0644 libplot/lp/ep_map.c ||
echo "restore of libplot/lp/ep_map.c failed"
set `wc -c libplot/lp/ep_map.c`;Wc_c=$1
if test "$Wc_c" != "5595"; then
	echo original size 5595, current size $Wc_c
fi
# ============= libplot/lp/fillcnst.h ==============
echo "x - extracting libplot/lp/fillcnst.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/fillcnst.h &&
X/*
X * fillcnst.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#define DEG_TO_RAD  0.017453292	/* pi/180  */
X#define PI          3.1415926535898
X#define PI_2        1.5707962	/* pi/2; approx 180 deg  */
X#define PI_4        0.7853981	/* pi/4; approx  90 deg  */
X#define PI_9        0.3490658	/* pi/9; approx  20 deg  */
X
X/* values stored in global vars C_A, C_B, A_B  */
X#define GENR        0		/* non-special angle relationship */
X#define PARL        1		/* segment & hatch line parallel */
X#define VERT        2		/* segment is vertical */
X#define HORZ        3		/* segment is horizontal */
X
Xtypedef struct {
X    double  xx,
X            yy;
X} FPOINT;
X
X/*
X * fill_type / fill_angle combos: values for hatching and filler
X *    these are values assigned to vars fill and fixed_fill
X */
X#define SOLIDFILL   0
X#define CROSS_0     4
X#define CROSS_45    1
X#define PARLL_0     2
X#define PARLL_45    5
X#define PARLL_90    6
X#define PARLL_135   3
X#define OTHER      -1
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/fillcnst.h &&
chmod 0644 libplot/lp/fillcnst.h ||
echo "restore of libplot/lp/fillcnst.h failed"
set `wc -c libplot/lp/fillcnst.h`;Wc_c=$1
if test "$Wc_c" != "975"; then
	echo original size 975, current size $Wc_c
fi
# ============= libplot/lp/fillvars.h ==============
echo "x - extracting libplot/lp/fillvars.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/fillvars.h &&
X/*
X * fillvars.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * the home for these vars is hatch.c
X */
X
Xextern int hatch_degs;		/* hatch angle in degrees */
Xextern double hatch_rads;	/* hatch angle in radians */
Xextern double x_shift;
Xextern double chg_x_CA,
X        chg_y_CA,
X        chg_x_CB,
X        chg_y_CB,
X        chg_x_AB,
X        chg_y_AB;
X
X/*
X * status of line segment: vertical (VERT), horizontal (HORZ), 
X * parallel to the hatch lines (PARL), or generic (GENR) -- non-special
X */
Xextern int C_A,
X        C_B,
X        A_B;
X
X/* variables used by fix_fill(), which is called from do_FT and do_SP */
Xextern int fill,
X        fixed_fill,
X        pen_number,
X        spacing;
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/fillvars.h &&
chmod 0644 libplot/lp/fillvars.h ||
echo "restore of libplot/lp/fillvars.h failed"
set `wc -c libplot/lp/fillvars.h`;Wc_c=$1
if test "$Wc_c" != "700"; then
	echo original size 700, current size $Wc_c
fi
echo "End of part 3, continue with part 4"
exit 0





-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is part 04 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= libplot/lp/ib_map.c ==============
echo "x - extracting libplot/lp/ib_map.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/ib_map.c &&
X/*
X * ib_map.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "const.h"
X#include "fillcnst.h"
X
X#ifdef TESTVER
X#include <signal.h>
X#include "dbgvars.h"
X#endif
X
X#define XLIM 94			/* 47 for 1/2 pg output, 94 for full page
X				 * output */
X#define YLIM 480		/* 240/480 for half/full pg output, mode K... */
X /* ...480/960 for half/full pg output, mode L */
X#define MODE 'Z'		/* 'K' / 'L': 60 dots per in / 120 dots per
X				 * in 'Z' quad density 240 dots per in */
X
X#define LEFT_CUTOFF  0
X
X/*
X * Constants
X * SCALEX and SCALEY have been changed to vars, set in init_map,
X * to simplify quick changes of scale, depending on XLIM, YLIM
X */
X
X#define ROUNDER 0.0
X
X#ifndef TESTVER
X#define PUT_BIT(x,y)    map[(x >> 3) + (XLIM * y)] |= BITS[x & 7]
X#endif
X
X#define ABS(x) ((x) > 0.0 ? (x) : -(x))
X
Xlong    MAP_MAX;
Xdouble  SCALEX,
X        SCALEY;			/* <<<<<<<<<<<< */
Xchar    BITS[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
Xextern char map[];		/* in maps.c */
X
X
X/*******************************
X * catch(), catchi() were here *
X *******************************/
X
X#ifdef TESTVER
XPUT_BIT(x, y)
X    int     x,
X            y;
X{
X    int     offset;
X
X    offset = ((x >> 3) + (XLIM * y));
X    if ((offset >= (MAP_MAX)) || (offset < 0)) {
X	fprintf(stderr,
X	    "PUTBIT offset overflow: %d;  x: %d;  y: %d\n", offset, x, y);
X	fprintf(errfp,
X	    "PUTBIT offset overflow: %d;  x: %d;  y: %d\n", offset, x, y);
X	fclose(errfp);
X	dump_map(TRUE);
X	exit(1);
X    }
X    map[offset] |= BITS[x & 7];
X}
X
X#endif
X
X
Xib_put_seg(p1, p2)
X    POINT   p1,
X            p2;
X{
X    double  diffx,
X            diffy,
X            change_ratio;
X    register int x,
X            y;
X    register int inc;
X
X#if 0
X    signal(SIGSEGV, catch);
X    signal(SIGINT, catchi);
X#endif
X
X#ifdef TESTVER
X    if (debug2 || debug2x) {
X	fprintf(errfp, "p1 ( %d, %d );   p2 ( %d, %d )\n",
X	    p1.x, p1.y, p2.x, p2.y);
X    }
X#endif
X
X    p1.x = SCALEX * (double) p1.x + ROUNDER;
X    p2.x = SCALEX * (double) p2.x + ROUNDER;
X    p1.y = SCALEY * (double) p1.y + ROUNDER;
X    p2.y = SCALEY * (double) p2.y + ROUNDER;
X
X    diffx = p2.x - p1.x;
X    diffy = p2.y - p1.y;
X
X    if (diffx != 0.0 && diffy != 0.0) {	/* neither horiz nor vert */
X	if (ABS(diffx) > ABS(diffy)) {	/* closer to horizontal */
X	    inc = (diffx < 0) ? -1 : 1;
X	    change_ratio = diffy / diffx;
X	    for (x = p1.x; x != p2.x; x += inc) {
X		y = (x - p1.x) * change_ratio + p1.y + ROUNDER;
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, p2.y);
X	} else {		/* closer to vertical */
X	    inc = (diffy < 0) ? -1 : 1;
X	    change_ratio = diffx / diffy;
X	    for (y = p1.y; y != p2.y; y += inc) {
X		x = (y - p1.y) * change_ratio + p1.x + ROUNDER;
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, p2.y);
X	}
X    } else {
X	if (diffx) {		/* horizontal line */
X	    y = p1.y;
X	    inc = (diffx < 0) ? -1 : 1;
X	    for (x = p1.x; x != p2.x; x += inc) {
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, y);
X	} else {		/* vert. line */
X	    x = p1.x;
X	    inc = (diffy < 0) ? -1 : 1;
X	    for (y = p1.y; y != p2.y; y += inc) {
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(x, p2.y);
X	}
X    }
X}
X
X
Xib_dump_map(to_printer)
X    int     to_printer;
X{
X    int     i;
X    register int j;
X    char    ch;
X    char    hdr[5];
X
X    if (to_printer) {
X	hdr[0] = ESC;
X	hdr[1] = '3';
X	hdr[2] = 24;		/* Line spacing for graphics: 24/216 inch */
X	write(1, hdr, 3);
X	hdr[1] = MODE;		/* 'K'/'L': 480/960 bit image graphics */
X	hdr[2] = (YLIM - LEFT_CUTOFF) & 0xff;	/* n1 = YLIM mod 256 */
X	hdr[3] = ((YLIM - LEFT_CUTOFF) >> 8) & 0xff;	/* n2 = YLIM / 256 */
X
X	for (i = 0; i < XLIM; i++) {
X	    write(1, hdr, 4);
X	    for (j = LEFT_CUTOFF * XLIM; j < MAP_MAX; j += XLIM) {
X		ch = map[i + j];
X		if (ch == 26)
X		    ch = 18;	/* bug in proprinter graphics */
X		if (ch == '\n')
X		    ch = 8;	/* prevent add'n of \r to \n */
X		write(1, &ch, 1);
X#ifdef TESTVER
X		if (debug5)
X		    fprintf(errfp, "%4d", ch);
X#endif
X	    }
X#ifdef TESTVER
X	    if (debug5)
X		fprintf(errfp, "%3d*\n", i);
X#endif
X	    putchar('\n');	/* LF and CR to end line */
X	    putchar('\r');
X	    fflush(stdout);
X	}
X
X	/* putchar( '\f' ); *//* form feed */
X#ifdef TESTVER
X	fclose(errfp);
X#endif
X
X    }				/* end if ( to_printer )... */
X}
X
X
Xib_init_map()
X{
X#ifdef TRUESOLID
X    extern double PUs_per_dot;	/* declared in file filltype.c */
X
X#endif
X    register int k;
X    register char *mp;
X
X    MAP_MAX = XLIM * YLIM;
X    SCALEX = (double) (XLIM * 8) / 10366;
X    SCALEY = (double) (YLIM) / 7963;
X
X#ifdef TRUESOLID
X    PUs_per_dot = 1.0 / SCALEX;	/* used by fix_fill() in file filltype.c */
X#endif
X
X    mp = map;
X    for (k = 0; k < MAP_MAX; k++)
X	*mp++ = 0;
X}
SHAR_EOF
$TOUCH -am 0214090289 libplot/lp/ib_map.c &&
chmod 0644 libplot/lp/ib_map.c ||
echo "restore of libplot/lp/ib_map.c failed"
set `wc -c libplot/lp/ib_map.c`;Wc_c=$1
if test "$Wc_c" != "4616"; then
	echo original size 4616, current size $Wc_c
fi
# ============= libplot/lp/itoa.h ==============
echo "x - extracting libplot/lp/itoa.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/itoa.h &&
X/********************************************************************
X ***** itoa -- Konvertieren Zahlen in ASCII String              *****
X ********************************************************************/
X/* Setzt Zahlen in ASCII String um. Die Umwandlung erfolgt
X   in umgekehrter Reihenfolge. Danach wird der String vertauscht.
X
X   Beispiele:
X	int n;
X	char scrtext[100];
X
X	itoa(n,scrtext);
X        printf("String: %s",&scrtext[0]);
X*/
X
Xitoa(n,scrtext)
Xint n;
Xchar scrtext[];
X{
Xint i,sign,c,j;
X/* 
X	Vorzeichen merken 
X*/
Xif ((sign = n) <0)
X  n= -n;
X/* 
X	Umwandeln 
X*/
Xi=0;
Xdo
X  {
X  scrtext[i++]= n % 10 +'0';
X  }
Xwhile (( n/= 10)>0);
X/* 
X	Vorzeichen setzen 
X*/
Xif (sign <0)
X  scrtext[i++]='-';
Xscrtext[i]='\0';
X/* 
X	Nun Umdrehen 
X*/
Xj= i-1;
Xif (j>0);
X  {
X  for (i=0 ; i<j ; i++ , j--)
X    {
X    c=scrtext[i];
X    scrtext[i]=scrtext[j];
X    scrtext[j]=c;
X    }
X  }
X}
X
X    
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/itoa.h &&
chmod 0644 libplot/lp/itoa.h ||
echo "restore of libplot/lp/itoa.h failed"
set `wc -c libplot/lp/itoa.h`;Wc_c=$1
if test "$Wc_c" != "879"; then
	echo original size 879, current size $Wc_c
fi
# ============= libplot/lp/label.c ==============
echo "x - extracting libplot/lp/label.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/label.c &&
X/*
X * do_lb.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "const.h"
X#include "vars.h"
X#include "dbgvars.h"
X
Xextern POINT plot_char();
X
Xlabel(s)
Xchar *s;
X{
X    char *sp;
X    POINT   l_point;
X    sp=s;
X#ifdef TESTVER
X    int     was_on,
X            xwas_on;		/* for debugging */
X
X    /* turn debug2/2x off, if necessary, for the duration of labeling */
X    if (debug2) {
X	was_on = TRUE;
X	debug2 = FALSE;
X    } else {
X	was_on = FALSE;
X    }
X    if (debug2x) {
X	xwas_on = TRUE;
X	debug2x = FALSE;
X    } else {
X	xwas_on = FALSE;
X    }
X#endif
X
X    l_point = current;
X    if (stand_set_sel)
X	while ((c = *sp++) != NULL) {
X	    l_point = plot_char(l_point, c, set_standard);
X	}
X    else
X	while ((c = *sp++) != NULL) {
X	    l_point = plot_char(l_point, c, set_alternate);
X	}
X    pen_up = TRUE;
X
X#ifdef TESTVER
X    if (was_on) {
X	debug2 = TRUE;
X    }
X    if (xwas_on) {
X	debug2x = TRUE;
X    }
X#endif
X}
X
SHAR_EOF
$TOUCH -am 1010115088 libplot/lp/label.c &&
chmod 0644 libplot/lp/label.c ||
echo "restore of libplot/lp/label.c failed"
set `wc -c libplot/lp/label.c`;Wc_c=$1
if test "$Wc_c" != "939"; then
	echo original size 939, current size $Wc_c
fi
# ============= libplot/lp/liblj.c ==============
echo "x - extracting libplot/lp/liblj.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/liblj.c &&
X/*
X * main.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * hpglplot v2.1
X *
X * Filter to read HPGL commands (Hewlett-Packard Graphics Language,
X * used by HP7475A 6-pen plotter, among others) and produce bit map
X * graphics commands for various printers.
X *
X * Usage: tplotlp -eismh
X * Options: for the lpdriver.c program  
X * -e	produce output for Epson LQ-1500
X * -i	produce output for IBM Proprinter
X * -s	produce output for HP LaserJet+ small
X * -m   produce output for HP LaserJet+ enlarged
X * -h   produce output for HP LaserJet+ extra large
X *
X *
X * Authors:
X *  Mel Brooks
X *    Initial program design, command interpreter, Epson bit-map.
X *  Al Chase
X *    Fill routines, LaserJet and Proprinter bit-maps.
X *  David MacKenzie
X *    Rewrote option parser and makefile, cleaned up.
X */
X/* plot(4) graphics library for a regis terminal for VT240/VT300/GIGI */
Xextern float deltx,delty;
Xfloat pitograd;
X
X#include <math.h>
X#include "plotlp.h"
X
Xclosepl()
X{
Xdump_map(printer);
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=(7850/(float) x);gyscrunch=(7850/(float) y);
X	offx = -(x0*gxscrunch);offy= -(y0*gyscrunch);
X}
X
X}
X
Xerase()
X{
X/*	printf("\014");*/
X}
X
X
Xarc(x,y,x0,y0,x1,y1)
Xint x,y,x0,y0,x1,y1;
X{
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 ;xo +=  offx ;
X	printf("\033PpC(A%dC) [%d,%d]\033\\",c,xo,yo);
X
X*/
X}
X/*
X * do_ew.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X 
X
X#include <stdio.h>
X#include <math.h>
X#include "const.h"
X#include "vars.h"
X#ifdef TESTVER
X#  include "dbgvars.h"
X#endif
X
X#define DEGREES_TO_RADIANS 3.1415926535898 / 180.0
X
Xdo_EW()
X{
X    POINT   t,
X            t1;
X    float   radius;
X    int     i_radius,
X            start_angle,
X            sweep_angle,
X            chordangle;
X    int     i;
X
X#ifdef TESTVER
X    int     xwas_on;		/* for debugging 
X
X    /* turn debug2x off, if necessary, for the duration of do_EW() 
X    if (debug2x) {
X	xwas_on = TRUE;
X	debug2x = FALSE;
X    } else {
X	xwas_on = FALSE;
X    }
X#endif
X
X    if (scanf("%f,%d,%d", &radius, &start_angle, &sweep_angle) != 3) {
X	fprintf(stderr, "Odd number of coordinate\n");
X	exit(4);
X    }
X    if ((c = getchar()) != ';') {
X	scanf("%d", &chordangle);
X	getchar();
X    } else {
X	chordangle = chord_angle;
X    }
X
X    if (sweep_angle < 0)
X	chordangle = -1 * (abs(chordangle));
X
X    start_angle %= 360;
X    if (sweep_angle > 360)
X	sweep_angle = 360;
X    else if (sweep_angle < -360)
X	sweep_angle = -360;
X
X    if (scaling) {
X	i_radius = (int) (radius * x_scaler);
X	if (i_radius < 0)
X	    i_radius -= 1;
X    } else
X	i_radius = (int) radius;
X
X    /* plot starting radius 
X    t.x = (int) ((double) radius * cos((double) start_angle *
X	    DEGREES_TO_RADIANS) + 0.5) + current.x;
X    t.y = (int) ((double) radius * sin((double) start_angle *
X	    DEGREES_TO_RADIANS) + 0.5) + current.y;
X    put_seg(current, t);
X
X    /* plot chords up to (but not incl) sweep_angle 
X    for (i = chordangle; abs(i) < abs(sweep_angle); i += chordangle) {
X	t1.x = (int) ((double) radius * cos((double) (start_angle + i)
X		* DEGREES_TO_RADIANS) + 0.5) + current.x;
X	t1.y = (int) ((double) radius * sin((double) (start_angle + i)
X		* DEGREES_TO_RADIANS) + 0.5) + current.y;
X	put_seg(t, t1);
X	t = t1;
X    }
X
X    /* plot remaining (partial?) chord needed to make up the full sweep angle 
X    t1.x = (int) ((double) radius * cos((double) (start_angle + sweep_angle)
X	    * DEGREES_TO_RADIANS) + 0.5) + current.x;
X    t1.y = (int) ((double) radius * sin((double) (start_angle + sweep_angle)
X	    * DEGREES_TO_RADIANS) + 0.5) + current.y;
X    put_seg(t, t1);
X    t = t1;
X
X    /* plot ending radius 
X    put_seg(t1, current);
X
X#ifdef TESTVER			/* reset debug2x if necessary 
X    if (xwas_on) {
X	debug2x = TRUE;
X    }
X#endif
X}
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      cont(x,y);
X}
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
X
SHAR_EOF
$TOUCH -am 1011095088 libplot/lp/liblj.c &&
chmod 0644 libplot/lp/liblj.c ||
echo "restore of libplot/lp/liblj.c failed"
set `wc -c libplot/lp/liblj.c`;Wc_c=$1
if test "$Wc_c" != "4267"; then
	echo original size 4267, current size $Wc_c
fi
# ============= libplot/lp/linemod.c ==============
echo "x - extracting libplot/lp/linemod.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/linemod.c &&
X#include "plotlp.h"
X
Xlinemod(s)
Xchar *s;
X{
X	line_type = SOLID;
X  if (strcmp(s,"dotted")==0) {
X	line_type=DOTS;
X	  }
X  else if (strcmp(s,"solid")==0) {
X	line_type = SOLID;
X	  }
X	  else if (strcmp(s,"longdashed")==0) {
X		  line_type=BROKN_2DASH;
X		  }
X		 else if (strcmp(s,"shortdashed")==0) {
X			 line_type=SHORT_DASH;
X			 }
X			else if (strcmp(s,"dotdashed")==0) {
X				line_type=BROKN_DASH;
X				}
X}
X
SHAR_EOF
$TOUCH -am 1010110488 libplot/lp/linemod.c &&
chmod 0644 libplot/lp/linemod.c ||
echo "restore of libplot/lp/linemod.c failed"
set `wc -c libplot/lp/linemod.c`;Wc_c=$1
if test "$Wc_c" != "399"; then
	echo original size 399, current size $Wc_c
fi
# ============= libplot/lp/lj_map.c ==============
echo "x - extracting libplot/lp/lj_map.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/lj_map.c &&
X/*
X * lj_map.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "const.h"
X#include "vars.h"
X#include "fillcnst.h"
X#include "itoa.h"
X
X#ifdef TESTVER
X#include <signal.h>
X#endif
X
X/*
X * Origin is at lower left corner.
X * Bytes of raster data are oriented along the x-axis, hi bit at left:
X *       (0,0) is bit 7 of byte 0;
X *       (7,0) is bit 0 of byte 0;
X *       (16,0) is bit 7 of byte 2;
X *       (16,3) is bit 7 of byte (2 + Xlim*3)
X */
X
X/*
X * Constants
X * Ylim = 1440 dot rows, plus a couple extra for rounding error
X#define Ylim 1442
X#define Xlim  235
X#define scaleX  0.180859
X#define scaleY  0.180859
X
X#define Ylim 1841
X#define Xlim  300
X
X/* scaleX = scaleY = number of dots per plotter unit
X                   = 1440 dot rows in y-direction / 7962 PU's in y-dir 
X#define scaleX  0.231205
X#define scaleY  0.231205
X#define rounder 0.0
X [hot@mh.nl] */
X
Xstatic int Ylim,Xlim,Ylim8;
Xstatic double scaleX,scaleY,rounder;
X
X#define ABS(x) ((x) > 0.0 ? (x) : -(x))
X
X/* move bit map to maps.c for combined printer version --- */
X#if 0
Xchar    map[Xlim * Ylim];
X
X#endif
Xextern char map[];
X
Xstatic char BITS[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
X#ifdef TESTVER
X#define PUT_BIT(x, y)  map[(tempindex = (tempx = (x >> 3)) + ((tempy = y) * Xlim))] |= BITS[x & 7];
X#else
X#define P_BIT(x, y)  map[(x >> 3) + (y * Xlim)] |= BITS[x & 7]; 
XPUT_BIT(x, y)
Xint x,y;
X{
Xint saveit;
Xif (printer == LASERHIGH || printer == LASERMED) { 
X	saveit=x;x=y;y=Ylim-saveit;
X}
XP_BIT(x,y);
X}
X
X#endif
X
X
X#ifdef TESTVER
Xstatic int tempindex,
X        tempx,
X        tempy;
Xstatic POINT tempp1,
X        tempp2;
X
Xlj_catch()
X{
X    fprintf(stderr, "Segmentation violation\n");
X    fprintf(stderr, "tempindex = %d x = %d y = %d p1 = %d,%d p2 = %d,%d\n",
X	tempindex, tempx, tempy, tempp1.x, tempp1.y, tempp2.x, tempp2.y);
X    lj_dump_map(FALSE);
X    exit(1);
X}
X
Xljcatchi()
X{
X    lj_dump_map(FALSE);
X    exit(1);
X}
X
X#endif
X
Xlj_put_seg(p1, p2)
X    POINT   p1,
X            p2;
X{
X    double  diffx,
X            diffy,
X            change_ratio;
X    register int x,
X            y;
X    register int inc;
X
X#ifdef TESTVER
X#if 0
X    signal(SIGSEGV, lj_catch);
X    signal(SIGINT, ljcatchi);
X#endif
X    tempp1 = p1;
X    tempp2 = p2;
X#endif
X
X    p1.x = scaleX * (double) p1.x + rounder;
X    p2.x = scaleX * (double) p2.x + rounder;
X    p1.y = scaleY * (double) p1.y + rounder;
X    p2.y = scaleY * (double) p2.y + rounder;
X
X    diffx = p2.x - p1.x;
X    diffy = p2.y - p1.y;
X
X    if (diffx != 0.0 && diffy != 0.0) {
X	if (ABS(diffx) > ABS(diffy)) {
X	    inc = (diffx < 0) ? -1 : 1;
X	    change_ratio = diffy / diffx;
X	    for (x = p1.x; x != p2.x; x += inc) {
X		y = (x - p1.x) * change_ratio + p1.y + rounder;
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, p2.y);
X	} else {
X	    inc = (diffy < 0) ? -1 : 1;
X	    change_ratio = diffx / diffy;
X	    for (y = p1.y; y != p2.y; y += inc) {
X		x = (y - p1.y) * change_ratio + p1.x + rounder;
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, p2.y);
X	}
X    } else {
X	if (diffx) {		/* horizontal line */
X	    y = p1.y;
X	    inc = (diffx < 0) ? -1 : 1;
X	    for (x = p1.x; x != p2.x; x += inc) {
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(p2.x, y);
X	} else {
X	    x = p1.x;
X	    inc = (diffy < 0) ? -1 : 1;
X	    for (y = p1.y; y != p2.y; y += inc) {
X		PUT_BIT(x, y);
X	    }
X	    PUT_BIT(x, p2.y);
X	}
X    }
X}
X
X
Xlj_dump_map(to_printer)
X    int     to_printer;
X{
X    register int r;
X    char    ccount[8];/* [hot@mh.nl] */
X    char    hdr[80];/* [hot@mh.nl] */
X    char   *mp = map;
X    char   *p,leeg,
X           *maxp;		/* for LF-char test */
X    short int schrijfspaar,hdr_length;
X    short int county,countx,countsx,countdif;/* [hot@mh.nl] */
X
X    if (to_printer) {
X	hdr[0] = ESC;
X
X	/* reset printer */
X	hdr_length = 1 + n_strcpy(&hdr[1], "E");
X	write(1, hdr, hdr_length);
X
X	/* set printer to interpret a '\n' char to a '\r\n' pair */
X	hdr_length = 1 + n_strcpy(&hdr[1], "&k2G");
X	write(1, hdr, hdr_length);
X
X	/* raster graphics resolution: 300 dots/in */
X	hdr_length = 1 + n_strcpy(&hdr[1], "*t300R");
X	write(1, hdr, hdr_length);
X
X	if (printer == LASERLOW) {
X		/* set cursor to col 11  */
X		hdr_length = 1 + n_strcpy(&hdr[1], "&a11C");
X		write(1, hdr, hdr_length);
X
X	        /* set cursor to row 10 */
X		hdr_length = 1 + n_strcpy(&hdr[1], "&a10R");
X		write(1, hdr, hdr_length);
X		/* [hot@mh.nl] */
X	}
X
X	/* start graphics at current cursor posn */
X	hdr_length = 1 + n_strcpy(&hdr[1], "*r1A");
X	write(1, hdr, hdr_length);
X
X	if (printer==LASERLOW) {
X		/* transfer-line-of-graphics escape sequence -- 235 is Xlim */
X		hdr_length = 1 + n_strcpy(&hdr[1], "*b");
X		itoa(Xlim,ccount);
X		hdr_length += n_strcpy(&hdr[hdr_length], ccount);
X		hdr_length += n_strcpy(&hdr[hdr_length], "W");
X	}
X
X	/*
X	 * write Ylim rows, each row is Xlim bytes starting at offset r from
X	 * map[0] 
X	 */
X	for (r = (Ylim - 1) * Xlim,county=1; r >= 0; r -= Xlim,county++) {
X	    /* check this row for LF-chars; replace with byte value of 8 */
X	    p = mp + r;
X	    maxp = p + Xlim;
X	    leeg=0;	/* [hot@mh.nl] */
X	    countx=0;
X	    schrijfspaar=FALSE;
X	    while (p < maxp) {
X		if (*p == '\n') *p = '\010';
X		if (printer != LASERLOW){
X		if (*p == '\000') {
X			if (schrijfspaar==TRUE) {
X			/* transfer-line-of-graphics escape sequence -- 235 is Xlim */
X				hdr_length += n_strcpy(&hdr[hdr_length], "\033*b");
X				itoa(countdif,ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], "W");
X				write(1, hdr, hdr_length);
X				write(1, mp + r + countsx, countdif);
X			/* end raster graphics */
X				hdr_length = 1 + n_strcpy(&hdr[1], "*rB");
X				write(1, hdr, hdr_length);
X				schrijfspaar=FALSE;
X				fflush(stdout);
X				}
X			}
X	     else { /* *p != 0 */
X		     if (schrijfspaar==FALSE) {
X		        /* make cursorposition header */
X			/* set cursor to current col  */
X				hdr_length = 1 + n_strcpy(&hdr[1], "*p");
X				itoa((countx*8),ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], "X");
X			/* set cursor to current row */
X				hdr_length += n_strcpy(&hdr[hdr_length], "\033*p");
X				itoa(county,ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], "Y");
X			/* start graphics at current cursor posn */
X				hdr_length += n_strcpy(&hdr[hdr_length], "\033*r1A");
X				countdif=1;countsx=countx;
X				schrijfspaar=TRUE;
X				     }
X	                  else /* schrijfspaar==TRUE */
X			  {
X				  countdif++;
X			  }
X
X		     }		/* end of if (*p == 0) */
X			        /* [hot@mh.nl] */
X		  } 		/* end of if (printer != LASERLOW) */
X		p++;countx++;
X	    } 			/* end of while (p < maxp) */
X	    if (printer == LASERLOW) { 
X		    write(1, hdr, hdr_length);
X		    write(1, mp + r, Xlim);
X	    }
X	    else {
X			if (schrijfspaar==TRUE) {
X			/* transfer-line-of-graphics escape sequence -- 235 is Xlim */
X				hdr_length += n_strcpy(&hdr[hdr_length], "\033*b");
X				itoa(countdif,ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], ccount);
X				hdr_length += n_strcpy(&hdr[hdr_length], "W");
X				write(1, hdr, hdr_length);
X				write(1, mp + r + countsx, countdif);
X			/* end raster graphics */
X				hdr_length = 1 + n_strcpy(&hdr[1], "*rB");
X				write(1, hdr, hdr_length);
X				schrijfspaar=FALSE;
X				}
X	    } 		/* end else van if (printer==LASERLOW) */
X	    fflush(stdout);
X	}		/* end van de grote for loop voor iedere regel */
X	if (printer==LASERLOW) {
X		/* end raster graphics */
X		hdr_length = 1 + n_strcpy(&hdr[1], "*rB");
X		write(1, hdr, hdr_length);
X	}
X
X	/* reset printer and eject the page 
X	hdr_length = 1 + n_strcpy(&hdr[1], "E");
X	write(1, hdr, hdr_length);
X*/
X	/*
X	 * set printer to interpret a '\n' char to a '\r\n' pair. this works
X	 * in combo with the plot script, which also controls interpretation
X	 * of \n's at the port 
X	 */
X	hdr_length = 1 + n_strcpy(&hdr[1], "&k2G");
X	write(1, hdr, hdr_length);
X
X	fflush(stdout);
X    }
X}
X
X
X/*
X * copy string from src to dst, including terminating \0.
X * return number of chars copied, excluding terminating \0
X */
Xint
Xn_strcpy(dst, src)
X    char   *dst,
X           *src;
X{
X    char   *p;
X
X    p = src;
X    while (*dst++ = *src++);
X    return ((--src) - p);
X}
X
X
Xlj_init_map()
X{
X    register int k;
X    register char *mp;
X    int     map_max ;
X#ifdef TRUESOLID
X    extern double PUs_per_dot;	/* declared in file filltype.c */
X#endif
X
X    switch(printer) {
X	    case LASERLOW:
X		    Ylim=1442;
X		    Xlim=235;
X		    scaleX=0.180859;
X		    scaleY=0.180859;
X		    rounder=0.0;
X		    break;
X	    case LASERMED:
X		    Ylim=1841;
X		    Xlim=300;
X		    scaleX=0.231205;
X		    scaleY=0.231205;
X		    rounder=0.0;
X		    break;
X
X/* scaleX = scaleY = number of dots per plotter unit
X                   = 1440 dot rows in y-direction / 7962 PU's in y-dir */
X	    case LASERHIGH:
X		    Ylim=3000;
X		    Ylim8=375;
X		    Xlim=298;
X		    scaleX=0.2995369;
X		    scaleY=0.2995369;
X		    rounder=0.0;
X		    break;
X    }
X    map_max = Ylim * Xlim;
X
X#ifdef TRUESOLID
X    PUs_per_dot = 1.0 / scaleX;	/* used by fix_fill() in file filltype.c */
X#endif
X
X    mp = map;
X    for (k = 0; k < map_max; k++) {
X	*mp++ = 0;
X    }
X}
SHAR_EOF
$TOUCH -am 0216085089 libplot/lp/lj_map.c &&
chmod 0644 libplot/lp/lj_map.c ||
echo "restore of libplot/lp/lj_map.c failed"
set `wc -c libplot/lp/lj_map.c`;Wc_c=$1
if test "$Wc_c" != "9092"; then
	echo original size 9092, current size $Wc_c
fi
# ============= libplot/lp/maps.c ==============
echo "x - extracting libplot/lp/maps.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/maps.c &&
X/*
X * maps.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * Uses the value of printer to dispatch map-related function
X * calls to either ep_map.c or lj_map.c
X */
X
X#include "const.h"
X#include "vars.h"
X
X/*
X * This is a single bit map, accessed by either the epson or laserjet
X * map-related function calls, depending on which printer is being used.
X * It has been declared to be somewhat larger than necessary.
X */
X
Xchar    map[BITMAPSIZE];
X
Xinit_map()
X{
X    switch (printer) {
X    case EPSON:
X	ep_init_map();
X	break;
X    case LASERLOW:
X    case LASERMED:
X    case LASERHIGH:
X	lj_init_map();
X	break;
X    case IBM_PRO:
X	ib_init_map();
X	break;
X    }
X}
X
Xdump_map(to_printer)
X    int     to_printer;
X{
X    switch (printer) {
X    case EPSON:
X	ep_dump_map(to_printer);
X	break;
X    case LASERLOW:
X    case LASERMED:
X    case LASERHIGH:
X	lj_dump_map(to_printer);
X	break;
X    case IBM_PRO:
X	ib_dump_map(to_printer);
X	break;
X    }
X}
X
Xput_seg(p1, p2)
X    POINT   p1,
X            p2;
X{
X    switch (printer) {
X    case EPSON:
X	ep_put_seg(p1, p2);
X	break;
X    case LASERLOW:
X    case LASERMED:
X    case LASERHIGH:
X	lj_put_seg(p1, p2);
X	break;
X    case IBM_PRO:
X	ib_put_seg(p1, p2);
X	break;
X    }
X}
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/maps.c &&
chmod 0644 libplot/lp/maps.c ||
echo "restore of libplot/lp/maps.c failed"
set `wc -c libplot/lp/maps.c`;Wc_c=$1
if test "$Wc_c" != "1200"; then
	echo original size 1200, current size $Wc_c
fi
echo "End of part 4, continue with part 5"
exit 0



-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is part 06 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= libplot/sun/sunplot.c ==============
echo "x - extracting libplot/sun/sunplot.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/sun/sunplot.c &&
X/*
X * Sunplot - plotter backend for Sun workstation
X *
X * Copyright (c) 1987 by Sjoerd Mullender, Vrije Universiteit, Amsterdam.
X *
X * This program may be redistributed without fee as long as this copyright
X * notice is in tact.
X * Any commercial use is strictly prohibited.
X */
X
X#include <stdio.h>
X#include <suntool/sunview.h>
X#include <suntool/scrollbar.h>
X#include <suntool/panel.h>
X#include <suntool/canvas.h>
X
X/*
X * Configurable definitions
X */
X#define INIT_CANVAS_SIZE	512
X#define DEFAULT_SPACE		4096
X#define MAX_NAME_LENGTH		128
X
X/*
X * Unconfigurable definitions
X */
X#define BIG			0x7FFFFFFF
X
X#define FORMAT_RASTER		0
X#define FORMAT_ICON		1
X
X#define LABEL			0
X#define SQUARE			1
X#define REVERSE			2
X
Xint client_object;		/* used for notifier */
Xint *me = &client_object;	/* idem */
X
Xint curx, cury;			/* current position on plot */
Xint lox, loy, hix = DEFAULT_SPACE, hiy = DEFAULT_SPACE;	/* current space */
Xint slox, shix, sloy, shiy;	/* saved space settings for zooming */
Xint minx, maxx, miny, maxy;	/* minimum and maximum values encountered */
Xint hor_size, ver_size;		/* canvas size */
Xint turned, xmirror, ymirror;	/* orientation of plot */
Xint zooming;
Xint make_label = TRUE;		/* print labels */
Xint square = TRUE;		/* canvas is square */
Xint reverse = FALSE;		/* reverse video */
XFrame frame, dump_frame, options_frame;
XPanel panel, dump_panel, options_panel;
XPanel_item next_page_item;
XPanel_item hor_size_item, ver_size_item, toggle_item, font_item;
XPanel_item dump_format, dump_file_item;
XCanvas canvas;
XPixwin *pw;
XPixfont *font;
Xchar font_name[MAX_NAME_LENGTH];
Xchar font_dir[] = "/usr/lib/fonts/fixedwidthfonts/";
X
Xshort sunplot_icon_image[] = {
X#include "sunplot.icon"
X};
Xmpr_static(sunplot_icon, 64, 64, 1, sunplot_icon_image);
X
Xchar *malloc(), *realloc();
X
X/*
X *  input module
X */
X
Xstatic char *plotcommands, *plptr;
Xstatic int plotlength;
Xstatic int maxplotlength;
Xstatic int eof_seen;
X
Xgetchr()
X{
X	register c;
X
X	if (plptr < plotcommands + plotlength)
X		return *plptr++ & 0xFF;
X	if (eof_seen || (c = getchar()) == EOF) {
X		eof_seen = 1;
X		return EOF;
X	}
X	if (plotlength >= maxplotlength) {
X		plotcommands = realloc(plotcommands, maxplotlength *= 2);
X		plptr = plotcommands + plotlength;
X	}
X	*plptr++ = c;
X	plotlength++;
X	return c;
X}
X
Xgetint()
X{
X	register n;
X
X	n = getchr();
X	n = n | getchr() << 8;
X	if (n & 0x8000)			/* sign extend */
X		n |= ~0x7FFF;
X	return n;
X}
X
Xchar *getstr()
X{
X	register i = plptr - plotcommands;
X	register c;
X
X	while ((c = getchr()) != EOF && c != '\0' && c != '\n')
X		;
X	plptr[-1] = 0;
X	return plotcommands + i;
X}
X
X/*
X * plot module
X */
X
X#define point(x,y)	pw_put(pw, plotx(x, y), ploty(x, y), !reverse)
X
X#define line(x0,y0,x1,y1)	pw_vector(pw,plotx(x0,y0),ploty(x0,y0),plotx(x1,y1),ploty(x1,y1),PIX_SRC,!reverse)
X
X#define convx(x,s)	(((x) - lox) * (s) / (hix - lox))
X#define convy(y,s)	(((y) - loy) * (s) / (hiy - loy))
X
Xinitplot()
X{
X	plptr = plotcommands = malloc(maxplotlength = 1024);
X	plotlength = 0;
X}
X
Xplotx(x, y)
X{
X	register a;
X
X	switch (turned) {
X	case 0: a = convx(x, hor_size); break;
X	case 1: a = hor_size - 1 - convy(y, hor_size); break;
X	case 2: a = hor_size - 1 - convx(x, hor_size); break;
X	case 3: a = convy(y, hor_size); break;
X	}
X	return xmirror ? hor_size - 1 - a : a;
X}
X
Xploty(x, y)
X{
X	register a;
X
X	switch (turned) {
X	case 0: a = ver_size - 1 - convy(y, ver_size); break;
X	case 1: a = ver_size - 1 - convx(x, ver_size); break;
X	case 2: a = convy(y, ver_size); break;
X	case 3: a = convx(x, ver_size); break;
X	}
X	a = ymirror ? ver_size - 1 - a : a;
X	return zooming ? a+1 : a;
X}
X
Xlabel(s)
Xchar *s;
X{
X	struct pr_size pr_size;
X
X	if (!make_label)
X		return 0;
X	pw_text(pw, plotx(curx, cury), ploty(curx, cury), reverse ? PIX_NOT(PIX_SRC)&PIX_DST : PIX_SRC|PIX_DST, font, s);
X	pr_size = pf_textwidth(strlen(s), font, s);
X	return pr_size.x * (hix - lox) / hor_size;
X}
X
Xisqrt(n)
X{
X	int a, b, c;
X
X	a = n;
X	b = n;
X	if (n > 1) {
X		while (a > 0) {
X			a = a >> 2;
X			b = b >> 1;
X		}
X		do {
X			a = b;
X			c = n / b;
X			b = (c + a) >> 1;
X		} while ((a - c) < -1 || (a - c) > 1);
X	}
X	return b;
X}
X
Xstatic setcir(x, y, a1, b1, c1, a2, b2, c2)
X{
X	if (a1 * y - b1 * x >= c1 && a2 * y - b2 * x <= c2)
X		point(x, y);
X}
X
Xarc(x, y, x1, y1, x2, y2)
X{
X	register a1 = x1 - x, b1 = y1 - y, a2 = x2 - x, b2 = y2 - y;
X	register c1 = a1 * y - b1 * x, c2 = a2 * y - b2 * x;
X	register r2 = a1 * a1 + b1 * b1;
X	register i, di, sqrt, dx, dy;
X
X	dx = (hix - lox) / hor_size;
X	dy = (hiy - loy) / ver_size;
X	di = dx < dy ? dx : dy;
X	if (di <= 0)
X		di = 1;
X	for (i = isqrt(r2 >> 1); i >= 0; i -= di) {
X		sqrt = isqrt(r2 - i * i);
X		setcir(x + i, y + sqrt, a1, b1, c1, a2, b2, c2);
X		setcir(x + i, y - sqrt, a1, b1, c1, a2, b2, c2);
X		setcir(x - i, y + sqrt, a1, b1, c1, a2, b2, c2);
X		setcir(x - i, y - sqrt, a1, b1, c1, a2, b2, c2);
X		setcir(x + sqrt, y + i, a1, b1, c1, a2, b2, c2);
X		setcir(x + sqrt, y - i, a1, b1, c1, a2, b2, c2);
X		setcir(x - sqrt, y + i, a1, b1, c1, a2, b2, c2);
X		setcir(x - sqrt, y - i, a1, b1, c1, a2, b2, c2);
X	}
X}
X
Xcircle(x, y, r)
X{
X	arc(x, y, x + r, y, x - r, y);
X	arc(x, y, x - r, y, x + r, y);
X}
X
XNotify_value input_reader(me, fd)
Xint *me;
Xint fd;
X{
X	int newx, newy, x, y, r;
X	register char *p;
X
X	do {
X		switch (getchr()) {
X		case 'm':				/* move */
X			curx = getint();
X			cury = getint();
X			if (curx < minx) minx = curx;
X			if (curx > maxx) maxx = curx;
X			if (cury < miny) miny = cury;
X			if (cury > maxy) maxy = cury;
X			break;
X		case 'n':				/* cont */
X			newx = getint();
X			newy = getint();
X			line(curx, cury, newx, newy);
X			curx = newx;
X			cury = newy;
X			if (curx < minx) minx = curx;
X			if (curx > maxx) maxx = curx;
X			if (cury < miny) miny = cury;
X			if (cury > maxy) maxy = cury;
X			break;
X		case 'p':				/* point */
X			curx = getint();
X			cury = getint();
X			point(curx, cury);
X			if (curx < minx) minx = curx;
X			if (curx > maxx) maxx = curx;
X			if (cury < miny) miny = cury;
X			if (cury > maxy) maxy = cury;
X			break;
X		case 'l':				/* line */
X			newx = getint();
X			newy = getint();
X			curx = getint();
X			cury = getint();
X			line(newx, newy, curx, cury);
X			if (newx < minx) minx = newx;
X			if (newx > maxx) maxx = newx;
X			if (newy < miny) miny = newy;
X			if (newy > maxy) maxy = newy;
X			if (curx < minx) minx = curx;
X			if (curx > maxx) maxx = curx;
X			if (cury < miny) miny = cury;
X			if (cury > maxy) maxy = cury;
X			break;
X		case 't':				/* label */
X			p = getstr();
X			curx += label(p);
X			if (curx < minx) minx = curx;
X			if (curx > maxx) maxx = curx;
X			break;
X		case 'a':				/* arc */
X			x = getint();
X			y = getint();
X			newx = getint();
X			newy = getint();
X			curx = getint();
X			cury = getint();
X			arc(x, y, newx, newy, curx, cury);
X			if (x < minx) minx = x;
X			if (x > maxx) maxx = x;
X			if (y < miny) miny = y;
X			if (y > maxy) maxy = y;
X			if (newx < minx) minx = newx;
X			if (newx > maxx) maxx = newx;
X			if (newy < miny) miny = newy;
X			if (newy > maxy) maxy = newy;
X			if (curx < minx) minx = curx;
X			if (curx > maxx) maxx = curx;
X			if (cury < miny) miny = cury;
X			if (cury > maxy) maxy = cury;
X			break;
X		case 'c':				/* circle */
X			curx = getint();
X			cury = getint();
X			r = getint();
X			circle(curx, cury, r);
X			if (curx - r < minx) minx = curx - r;
X			if (curx + r > maxx) maxx = curx + r;
X			if (cury - r < miny) miny = cury - r;
X			if (cury + r > maxy) maxy = cury + r;
X			break;
X		case 'e':				/* erase */
X			panel_set(next_page_item, PANEL_SHOW_ITEM, TRUE, 0);
X			/* fall through */
X		case EOF:
X			notify_set_input_func(me, NOTIFY_FUNC_NULL, fd);
X			if (zooming) {
X				lox = slox;
X				hix = shix;
X				loy = sloy;
X				hiy = shiy;
X				zooming = 0;
X			}
X			return NOTIFY_DONE;
X		case 'f':				/* linemod */
X			getstr();
X			break;
X		case 's':				/* space */
X			if (zooming) {
X				slox = getint();
X				sloy = getint();
X				shix = getint();
X				shiy = getint();
X			} else {
X				lox = getint();
X				loy = getint();
X				hix = getint();
X				hiy = getint();
X			}
X			break;
X		}
X	} while (plptr < plotcommands + plotlength || stdin->_cnt > 0);
X	return NOTIFY_DONE;
X}
X
X/*
X * button routines
X */
X
Xrestartplot()
X{
X	minx = BIG;
X	maxx = -BIG;
X	miny = BIG;
X	maxy = -BIG;
X	plptr = plotcommands;
X
X	/* clear the canvas */
X	pw_writebackground(pw, 0, 0, (int) window_get(canvas, CANVAS_WIDTH),
X				(int) window_get(canvas, CANVAS_HEIGHT),
X				reverse ? PIX_SET : PIX_CLR);
X}
X
Xresetplot()
X{
X	restartplot();
X	plotlength = 0;
X}
X
Xvoid redraw()
X{
X	if (zooming) {
X		lox = slox;
X		hix = shix;
X		loy = sloy;
X		hiy = shiy;
X		zooming = 0;
X	}
X	restartplot();
X	input_reader(me, fileno(stdin));
X}
X
Xvoid nextpage()
X{
X	resetplot();
X	panel_set(next_page_item, PANEL_SHOW_ITEM, FALSE, 0);
X	notify_set_input_func(me, input_reader, fileno(stdin));
X	if (stdin->_cnt > 0)
X		input_reader(me, fileno(stdin));
X}
X
Xvoid zoom()
X{
X	int a;
X
X	if (!zooming) {
X		slox = lox;
X		shix = hix;
X		sloy = loy;
X		shiy = hiy;
X		zooming = 1;
X	}
X	if (maxx == minx) {
X		maxx++;
X		minx--;
X	}
X	if (maxy == miny) {
X		maxy++;
X		miny--;
X	}
X	if ((a = (maxx-minx) * (shiy-sloy) / (shix-slox)) >= maxy-miny) {
X		loy = miny - (a - maxy + miny) / 2;
X		hiy = loy + a;
X		lox = minx;
X		hix = maxx;
X	} else {
X		a = (maxy - miny) * (shix - slox) / (shiy - sloy);
X		lox = minx - (a - maxx + minx) / 2;
X		hix = lox + a;
X		loy = miny;
X		hiy = maxy;
X	}
X	hix++;
X	hiy++;
X	restartplot();
X	input_reader(me, fileno(stdin));
X}
X
Xvoid quit()
X{
X	/* don't ask for confirmation */
X	if (font)
X		pf_close(font);
X	window_set(frame, FRAME_NO_CONFIRM, TRUE, 0);
X	window_destroy(frame);
X}
X
Xvoid turn()
X{
X	int tmp;
X
X	turned = (turned + 1) & 3;
X	tmp = xmirror;
X	xmirror = ymirror;
X	ymirror = tmp;
X}
X
Xvoid mirrorx()
X{
X	xmirror ^= 1;
X}
X
Xvoid mirrory()
X{
X	ymirror ^= 1;
X}
X
Xvoid toggle_proc()
X{
X	if ((int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, SQUARE)) {
X		panel_set(ver_size_item,
X			PANEL_SHOW_ITEM,	FALSE,
X			0);
X		panel_set(hor_size_item,
X			PANEL_LABEL_STRING,	"Canvas size:     ",
X			0);
X	} else {
X		panel_set(ver_size_item,
X			PANEL_SHOW_ITEM,	TRUE,
X			0);
X		panel_set(hor_size_item,
X			PANEL_LABEL_STRING,	"Horizontal size: ",
X			0);
X	}
X}
X
Xvoid options()
X{
X	window_set(options_frame, WIN_SHOW, TRUE, 0);
X}
X
Xvoid options_done()
X{
X	register int r;
X	char *f;
X	Cursor cursor;
X
X	window_set(options_frame, WIN_SHOW, FALSE, 0);
X	r = (int) panel_get(hor_size_item, PANEL_VALUE);
X	if (r != hor_size) {
X		window_set(canvas, CANVAS_WIDTH, r, 0);
X		hor_size = r;
X	}
X	if (square)
X		r = hor_size;
X	else
X		r = (int) panel_get(ver_size_item, PANEL_VALUE);
X	if (r != ver_size) {
X		window_set(canvas, CANVAS_HEIGHT, r, 0);
X		ver_size = r;
X	}
X	f = (char *) panel_get_value(font_item);
X	if (f == 0 || *f == 0) {
X		if (font_name[0] != 0) {
X			font_name[0] = 0;
X			if (font)
X				pf_close(font);
X			font = pf_default();
X		}
X	} else {
X		if (font_name[0] == 0 || strcmp(f, font_name) != 0) {
X			strcpy(font_name, f);
X			f = font_name;
X			if (*f != '/') {
X				f = malloc(strlen(font_dir)+strlen(font_name)+1);
X				strcpy(f, font_dir);
X				strcat(f, font_name);
X			}
X			if (font)
X				pf_close(font);
X			font = pf_open(f);
X			if (f != font_name)
X				free(f);
X		}
X	}
X	if (font == 0) {
X		font_name[0] = 0;
X		font = pf_default();
X	}
X	make_label = (int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, LABEL);
X	square = (int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, SQUARE);
X	reverse = (int) panel_get(toggle_item, PANEL_TOGGLE_VALUE, REVERSE);
X	cursor = (Cursor) window_get(canvas, WIN_CURSOR);
X	cursor_set(cursor,
X			CURSOR_OP, reverse ? PIX_SRC^PIX_DST : PIX_SRC|PIX_DST,
X			0);
X	window_set(canvas, WIN_CURSOR, cursor, 0);
X	redraw();
X}
X
Xvoid dump()
X{
X	window_set(dump_frame, WIN_SHOW, TRUE, 0);
X}
X
Xvoid dump_done()
X{
X	char *file;
X	int width, height;
X	register int x, y;
X	register char *s;
X	register short *p;
X	FILE *f;
X
X	/* we use the fact that the canvas is retained */
X	file = (char *) panel_get_value(dump_file_item);
X	if (file != 0 && *file != 0 && (f = fopen(file, "w")) != 0) {
X		width = (int) window_get(canvas, CANVAS_WIDTH);
X		height = (int) window_get(canvas, CANVAS_HEIGHT);
X		switch ((int) panel_get_value(dump_format)) {
X		case FORMAT_RASTER:
X			pr_dump(pw->pw_prretained, f, (colormap_t *) 0,
X							RT_STANDARD, 0);
X			break;
X		case FORMAT_ICON:
X			p = mpr_d(pw->pw_prretained)->md_image;
X			fprintf(f, "\
X/* Format_version=1, Width=%d, Height=%d, Depth=1, Valid_bits_per_item=16\n\
X */\n", (width+15) & ~15, height);
X			for (y = 0; y < height; y++) {
X				s = "\t";
X				for (x = 0; x < width; x += 16) {
X					fprintf(f, "%s0x%04x,", s, *p & 0xFFFF);
X					p++;
X					s = "";
X				}
X				fprintf(f, "\n");
X			}
X			break;
X		}
X		fclose(f);
X	}
X	window_set(dump_frame, WIN_SHOW, FALSE, 0);
X}
X
Xvoid fit_screen()
X{
X	register int w, h;
X	
X	w = hor_size + (int) scrollbar_get((Scrollbar) window_get(canvas, WIN_VERTICAL_SCROLLBAR), SCROLL_THICKNESS);
X	h = ver_size + (int) scrollbar_get((Scrollbar) window_get(canvas, WIN_HORIZONTAL_SCROLLBAR), SCROLL_THICKNESS);
X	window_set(canvas, WIN_WIDTH, w, WIN_HEIGHT, h, 0);
X	window_set(canvas, CANVAS_WIDTH, hor_size, CANVAS_HEIGHT, ver_size, 0);
X	window_set(panel, WIN_WIDTH, w, 0);
X	window_fit(frame);
X}
X
X/*
X * initialization
X */
X
Xvoid dump_init()
X{
X	register Pixrect *pr;
X
X	dump_frame = window_create(frame, FRAME,
X			FRAME_DONE_PROC,	dump_done,
X			0);
X	dump_panel = window_create(dump_frame, PANEL, 0);
X	pr = panel_button_image(dump_panel, "Done", 0, (Pixfont *) 0);
X	(void) panel_create_item(dump_panel, PANEL_BUTTON,
X			PANEL_LABEL_IMAGE,	pr,
X			PANEL_NOTIFY_PROC,	dump_done,
X			0);
X	/* order of strings is important (see definitions of FORMAT_*) */
X	dump_format = panel_create_item(dump_panel, PANEL_CYCLE,
X			PANEL_LABEL_STRING,	"Dump format:",
X			PANEL_CHOICE_STRINGS,	"Rasterfile format",
X						"Icon format",
X						(char *) 0,
X			0);
X	dump_file_item = panel_create_item(dump_panel, PANEL_TEXT,
X			PANEL_LABEL_X,		ATTR_COL(0),
X			PANEL_LABEL_Y,		ATTR_ROW(1),
X			PANEL_VALUE_DISPLAY_LENGTH, 25,
X			PANEL_LABEL_STRING,	"Dump to file:",
X			0);
X	window_fit(dump_panel);
X	window_fit(dump_frame);
X}
X
Xvoid options_init()
X{
X	register Pixrect *pr;
X
X	options_frame = window_create(frame, FRAME,
X			FRAME_DONE_PROC,	options_done,
X			0);
X	options_panel = window_create(options_frame, PANEL, 0);
X
X	pr = panel_button_image(options_panel, "Done", 0, (Pixfont *) 0);
X	(void) panel_create_item(options_panel, PANEL_BUTTON,
X			PANEL_LABEL_IMAGE,	pr,
X			PANEL_NOTIFY_PROC,	options_done,
X			0);
X	pr = panel_button_image(options_panel, "Rotate", 0, (Pixfont*) 0);
X	(void) panel_create_item(options_panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	turn,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(options_panel, "X Mirror", 0, (Pixfont*) 0);
X	(void) panel_create_item(options_panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	mirrorx,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(options_panel, "Y Mirror", 0, (Pixfont*) 0);
X	(void) panel_create_item(options_panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	mirrory,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	toggle_item = panel_create_item(options_panel, PANEL_TOGGLE,
X			PANEL_LAYOUT,		PANEL_HORIZONTAL,
X			PANEL_CHOICE_STRINGS,	"Label",
X						"Square",
X						"Reverse",
X						(char *) 0,
X			PANEL_TOGGLE_VALUE,	LABEL, make_label,
X			PANEL_TOGGLE_VALUE,	SQUARE, square,
X			PANEL_TOGGLE_VALUE,	REVERSE, reverse,
X			PANEL_NOTIFY_PROC,	toggle_proc,
X			0);
X	font_item = panel_create_item(options_panel, PANEL_TEXT,
X			PANEL_VALUE_DISPLAY_LENGTH, 51,
X			PANEL_VALUE_STORED_LENGTH, MAX_NAME_LENGTH,
X			PANEL_LABEL_STRING,	"Font name:",
X			PANEL_VALUE,		font_name,
X			0);
X	hor_size_item = panel_create_item(options_panel, PANEL_SLIDER,
X			PANEL_LABEL_STRING,	"Horizontal size: ",
X			PANEL_VALUE,		hor_size,
X			PANEL_MIN_VALUE,	64,
X			PANEL_MAX_VALUE,	2048,
X			PANEL_SLIDER_WIDTH,	200,
X			0);
X	ver_size_item = panel_create_item(options_panel, PANEL_SLIDER,
X			PANEL_LABEL_STRING,	"Vertical size:   ",
X			PANEL_VALUE,		ver_size,
X			PANEL_MIN_VALUE,	64,
X			PANEL_MAX_VALUE,	2048,
X			PANEL_SLIDER_WIDTH,	200,
X			0);
X	window_fit(options_panel);
X	window_fit(options_frame);
X	if (square) {
X		panel_set(ver_size_item,
X			PANEL_SHOW_ITEM,	FALSE,
X			0);
X		panel_set(hor_size_item,
X			PANEL_LABEL_STRING,	"Canvas size:     ",
X			0);
X	}
X}
X
Xvoid panel_init()
X{
X	register Pixrect *pr;
X
X	panel = window_create(frame, PANEL, 0);
X	pr = panel_button_image(panel, "Next Page", 0, (Pixfont *) 0);
X	next_page_item = panel_create_item(panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	nextpage,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(panel, "Redraw", 0, (Pixfont *) 0);
X	(void) panel_create_item(panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	redraw,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(panel, "Zoom", 0, (Pixfont *) 0);
X	(void) panel_create_item(panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	zoom,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(panel, "Options", 0, (Pixfont *) 0);
X	(void) panel_create_item(panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	options,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(panel, "Dump", 0, (Pixfont *) 0);
X	(void) panel_create_item(panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	dump,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(panel, "Fit Screen", 0, (Pixfont *) 0);
X	(void) panel_create_item(panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	fit_screen,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	pr = panel_button_image(panel, "Quit", 0, (Pixfont *) 0);
X	(void) panel_create_item(panel, PANEL_BUTTON,
X			PANEL_NOTIFY_PROC,	quit,
X			PANEL_LABEL_IMAGE,	pr,
X			0);
X	window_fit_height(panel);
X}
X
Xcanvas_init()
X{
X	canvas = window_create(frame, CANVAS,
X			CANVAS_AUTO_SHRINK,	FALSE,
X			CANVAS_WIDTH,		hor_size,
X			CANVAS_HEIGHT,		ver_size,
X			CANVAS_RETAINED,	TRUE,
X			WIN_VERTICAL_SCROLLBAR,	scrollbar_create(0),
X			WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0),
X			0);
X	pw = canvas_pixwin(canvas);
X}
X
Xmain(argc, argv)
Xchar **argv;
X{
X	initplot();
X
X	hor_size = ver_size = INIT_CANVAS_SIZE;
X	frame = window_create(NULL, FRAME,
X			FRAME_LABEL,		"Sunplot",
X			FRAME_SUBWINDOWS_ADJUSTABLE, FALSE,
X			FRAME_ICON, icon_create(ICON_IMAGE, &sunplot_icon, 0),
X			FRAME_ARGC_PTR_ARGV,	&argc, argv,
X			0);
X	while (argc > 1 && argv[1][0] == '-') {
X		switch (argv[1][1]) {
X		case 'c':
X			if (argv[1][2])
X				hor_size = atoi(&argv[1][2]);
X			else if (argc > 2) {
X				hor_size = atoi(argv[2]);
X				argv[1] = argv[0];
X				argv++;
X				argc--;
X			}
X			if (hor_size < 64)
X				hor_size = 64;
X			ver_size = hor_size;
X			square = TRUE;
X			break;
X		case 'h':
X			if (argv[1][2])
X				hor_size = atoi(&argv[1][2]);
X			else if (argc > 2) {
X				hor_size = atoi(argv[2]);
X				argv[1] = argv[0];
X				argv++;
X				argc--;
X			}
X			if (hor_size < 64)
X				hor_size = 64;
X			square = FALSE;
X			break;
X		case 'v':
X			if (argv[1][2])
X				ver_size = atoi(&argv[1][2]);
X			else if (argc > 2) {
X				ver_size = atoi(argv[2]);
X				argv[1] = argv[0];
X				argv++;
X				argc--;
X			}
X			if (ver_size < 64)
X				ver_size = 64;
X			square = FALSE;
X			break;
X		case 'l':
X			make_label = !make_label;
X			break;
X		case 's':
X			square = !square;
X			break;
X		case 'r':
X			turn();
X			break;
X		case 'x':
X			mirrorx();
X			break;
X		case 'y':
X			mirrory();
X			break;
X		case 'f':
X			if (argv[1][2])
X				strcpy(font_name, &argv[1][2]);
X			else if (argc > 2) {
X				strcpy(font_name, argv[2]);
X				argv[1] = argv[0];
X				argv++;
X				argc--;
X			}
X			break;
X		}
X		argc--;
X		argv[1] = argv[0];
X		argv++;
X	}
X	dump_init();
X	options_init();
X	panel_init();
X	canvas_init();
X	if (font_name[0]) {
X		register char *f = font_name;
X
X		if (*f != '/') {
X			f = malloc(strlen(font_dir)+strlen(font_name)+1);
X			strcpy(f, font_dir);
X			strcat(f, font_name);
X		}
X		font = pf_open(f);
X		if (f != font_name)
X			free(f);
X	}
X	if (font == 0) {
X		font = pf_default();
X		font_name[0] = 0;
X	}
X
X	fit_screen();
X
X	notify_set_input_func(me, input_reader, fileno(stdin));
X
X	window_main_loop(frame);
X
X	exit(0);
X}
SHAR_EOF
$TOUCH -am 1225041788 libplot/sun/sunplot.c &&
chmod 0644 libplot/sun/sunplot.c ||
echo "restore of libplot/sun/sunplot.c failed"
set `wc -c libplot/sun/sunplot.c`;Wc_c=$1
if test "$Wc_c" != "19634"; then
	echo original size 19634, current size $Wc_c
fi
# ============= libplot/sun/sunplot.icon ==============
echo "x - extracting libplot/sun/sunplot.icon (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/sun/sunplot.icon &&
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0x0000,0x0000,0x0000,0x0400,0x0000,0x0000,0x0000,0x0400,
X	0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0000,0x0800,
X	0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x7FF0,0x1000,
X	0x0000,0x0007,0x800F,0x1000,0x0000,0x0038,0x0000,0xE000,
X	0x0000,0x00C0,0x0000,0x3800,0x2000,0x0300,0x0000,0x4600,
X	0x1800,0x0400,0x0000,0x4100,0x07FF,0x0800,0x0000,0x8080,
X	0x03FF,0xFFFC,0x0000,0x8060,0x01C1,0xFFFF,0xFFF0,0x8010,
X	0x00E0,0x8037,0xFFFF,0xF008,0x0071,0x0030,0x001F,0xFE04,
X	0x003A,0x0030,0x0002,0x0002,0x001E,0x0060,0x0002,0x0002,
X	0x000F,0x0060,0x0002,0x0001,0x000F,0x8060,0x0004,0x0000,
X	0x0011,0xC0C0,0x0004,0x0000,0x0010,0xE0C0,0x0008,0x0000,
X	0x0020,0x7180,0x0008,0x0000,0x0020,0x3B80,0x0008,0x0000,
X	0x0040,0x1F00,0x0010,0x0000,0x0040,0x0E00,0x0010,0x0000,
X	0x0040,0x1F80,0x0020,0x0000,0x0080,0x3BC0,0x0020,0x0000,
X	0x0080,0x70E0,0x0040,0x0000,0x0081,0xE070,0x0040,0x0000,
X	0x0081,0xC038,0x0040,0x0000,0x0100,0x001C,0x0080,0x0000,
X	0x0100,0x000E,0x0080,0x0000,0x0100,0x0007,0x0100,0x0000,
X	0x0100,0x0003,0x8100,0x0000,0x0100,0x0001,0xE100,0x0000,
X	0x0100,0x0000,0xF200,0x0000,0x0100,0x0000,0x3A00,0x0000,
X	0x0100,0x0000,0x1C00,0x0000,0x0100,0x0000,0x0E00,0x0000,
X	0x0100,0x0000,0x0F00,0x0000,0x0100,0x0000,0x0B80,0x0000,
X	0x0080,0x0000,0x0980,0x0000,0x0080,0x0000,0x1040,0x0000,
X	0x0080,0x0000,0x1020,0x0000,0x0080,0x0000,0x2000,0x0000,
X	0x0040,0x0000,0x2000,0x0000,0x0040,0x0000,0x2000,0x0000,
X	0x0FFF,0xFFFF,0xFFFF,0xFFE0,0x0924,0x9249,0x2492,0x4920,
X	0x0924,0x9249,0x2492,0x4920,0x0924,0x9249,0x2492,0x4920,
X	0x0800,0x0000,0x0000,0x0020,0x0800,0x0000,0x0000,0x0020,
X	0x0800,0x0000,0x0000,0x0021,0x0800,0x0000,0x0000,0x0022,
X	0x0800,0x0000,0x0000,0x0022,0x0800,0x0000,0x0000,0x0024,
X	0x0FFF,0xFFFF,0xFFFF,0xFFE8,0x0000,0x4004,0x0000,0x0010,
X	0x0000,0x3008,0x0000,0x0060,0x0000,0x0808,0x0000,0x0080,
X	0x0000,0x0410,0x0000,0x0100,0x0000,0x0310,0x0000,0x0600
SHAR_EOF
$TOUCH -am 1225041788 libplot/sun/sunplot.icon &&
chmod 0644 libplot/sun/sunplot.icon ||
echo "restore of libplot/sun/sunplot.icon failed"
set `wc -c libplot/sun/sunplot.icon`;Wc_c=$1
if test "$Wc_c" != "1933"; then
	echo original size 1933, current size $Wc_c
fi
# ============= libplot/cgi/CGI.h ==============
if test ! -d 'libplot/cgi'; then
    echo "x - creating directory libplot/cgi"
    mkdir 'libplot/cgi'
fi
echo "x - extracting libplot/cgi/CGI.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/cgi/CGI.h &&
X
Xtypedef	struct
X{
X	int	x1, y1, x2, y2;
X	int	c;		/* || ascii code || strlen	*/
X	char	*str;		/* String			*/
X} herc_args;
SHAR_EOF
$TOUCH -am 0511125390 libplot/cgi/CGI.h &&
chmod 0666 libplot/cgi/CGI.h ||
echo "restore of libplot/cgi/CGI.h failed"
set `wc -c libplot/cgi/CGI.h`;Wc_c=$1
if test "$Wc_c" != "119"; then
	echo original size 119, current size $Wc_c
fi
# ============= libplot/cgi/CGI.mk ==============
echo "x - extracting libplot/cgi/CGI.mk (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/cgi/CGI.mk &&
X#	SCCS:	@(#)tCGI.mk	5.1 
X
XOWN=	bin		#file owner
XGRP=	bin		#file group
XPROT=	664		#protections
X
XINSDIR = /usr/lib/386
XTESTDIR = .
X#	c compile flags and system libraries to link with
X#	DEBUG can be defined on the make command line e.g.:
X#	$ make -DDEBUG=-Zi
X
XCFLAGS = -O $(DEBUG)
XLINK_LIBS	=	-lx -lm -lccgi
XSOURCE = libCGI.c cgistart.c cgistuff.c gtexttests.c
XOFILES = libCGI.o cgistart.o cgistuff.o gtexttests.o
XMAKE = make
X
Xall:	$(SOURCE)
X	cc $(CFLAGS) $(MODEL) -c $(SOURCE)
X	:
X
XlibCGI.a:	$(OFILES)
X	chmod $(PROT) $(OFILES)
X	chgrp $(GRP)  $(OFILES)
X	chown $(OWN)  $(OFILES)
X	-rm libCGI.a
X	ar r $(TESTDIR)/libCGI.a $(OFILES)
X	ranlib libCGI.a
X	@echo "Done building $(libCGI.a)"
X
X
Xinstall: all save move
X
Xclean:
X	-rm -f $(OFILES)
X
Xclobber: clean
X	-rm -f $(TESTDIR)/libCGI.a
X
Xdelete:	clobber
X	rm -f $(SOURCE)
X
Xmove:
X	-rm -f $(INSDIR)/SlibCGI.a
X	cp $(TESTDIR)/libCGI.a $(INSDIR)/SlibCGI.a
X	chmod $(PROT) $(INSDIR)/SlibCGI.a
X	chmod -x $(INSDIR)/SlibCGI.a	# not executable
X	chgrp $(GRP) $(INSDIR)/SlibCGI.a
X	chown $(OWN) $(INSDIR)/SlibCGI.a
X
Xsave:		
X	-if test -f $(INSDIR)/SlibCGI.a ; \
X	then \
X		rm -f $(INSDIR)/OLDlibCGI.a ; \
X		cp $(INSDIR)/SlibCGI.a $(INSDIR)/OLDlibCGI.a ; \
X		chmod $(PROT) $(INSDIR)/OLDlibCGI.a ; \
X		chmod -x $(INSDIR)/OLDlibCGI.a ; \
X		chgrp $(GRP) $(INSDIR)/OLDlibCGI.a ; \
X		chown $(OWN) $(INSDIR)/OLDlibCGI.a ; \
X	fi
X
X
X	
SHAR_EOF
$TOUCH -am 1014212290 libplot/cgi/CGI.mk &&
chmod 0666 libplot/cgi/CGI.mk ||
echo "restore of libplot/cgi/CGI.mk failed"
set `wc -c libplot/cgi/CGI.mk`;Wc_c=$1
if test "$Wc_c" != "1343"; then
	echo original size 1343, current size $Wc_c
fi
echo "End of part 6, continue with part 7"
exit 0




-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is part 05 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= libplot/lp/move.c ==============
echo "x - extracting libplot/lp/move.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/move.c &&
X/*
X * do_px.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "plotlp.h"
X#ifdef TESTVER
X#include "dbgvars.h"
X#endif
X
Xmove(x,y)
Xint x,y;
X{
X	int xo,yo;
X    float   x_coor,
X            y_coor;
X    POINT   icoor,
X            t;
X	pen_up = TRUE;
X	plot_abs = TRUE;
X	x_coor=x*gxscrunch;y_coor=y*gyscrunch;
X	x_coor += offx; y_coor += offy;
X	if (scaling) {
X	    icoor.x = (int) (x_coor * x_scaler);
X	    icoor.y = (int) (y_coor * y_scaler);
X	    if (icoor.x < 0)
X		icoor.x -= 1;
X	    if (icoor.y < 0)
X		icoor.y -= 1;
X	} else {
X	    icoor.x = (int) x_coor;
X	    icoor.y = (int) y_coor;
X	}
X
X	current = icoor;
X
X	if (symbol_mode) put_symbol(current);
X
X}
X
Xcont(x,y)
Xint x,y;
X{
X	int xo,yo;
X    float   x_coor,
X            y_coor;
X    POINT   icoor,
X            t;
X	x_coor=x*gxscrunch;y_coor=y*gyscrunch;
X	plot_abs = TRUE;
X	pen_up = FALSE;
X	x_coor += offx; y_coor += offy;
X
X	if (scaling) {
X	    icoor.x = (int) (x_coor * x_scaler);
X	    icoor.y = (int) (y_coor * y_scaler);
X	    if (icoor.x < 0)
X		icoor.x -= 1;
X	    if (icoor.y < 0)
X		icoor.y -= 1;
X	} else {
X	    icoor.x = (int) x_coor;
X	    icoor.y = (int) y_coor;
X	}
X
X	put_seg(current, icoor);
X
X	if (plot_abs)    current = icoor;
X
X	if (symbol_mode) put_symbol(current);
X
X}
X
X/*
Xdo_Px(selector)
X    int     selector;
X{
X    float   x_coor,
X            y_coor;
X    POINT   icoor,
X            t;
X
X#ifdef TESTVER
X    int     xwas_on;		/* for debugging 
X
X    /* turn debug2x off, if necessary, for the duration of do_Px() 
X    if (debug2x) {
X	xwas_on = TRUE;
X	debug2x = FALSE;
X    } else {
X	xwas_on = FALSE;
X    }
X#endif
X
X/*    plot_abs = TRUE; /* [hot@mh.nl] 
X
X    switch (selector) {
X    case PA:
X	plot_abs = TRUE;
X	break;
X    case PR:
X	plot_abs = FALSE;
X	break;
X    case PU:
X	pen_up = TRUE;
X	break;
X    case PD:
X	pen_up = FALSE;
X	break;
X    default:
X	fprintf(stderr, "Bad selector for Px %d\n", selector);
X	exit(4);
X    }
X
X    if ((c = getchar()) == ';') {
X#ifdef TESTVER			/* reset debug2x if necessary 
X	if (xwas_on) {
X	    debug2x = TRUE;
X	}
X#endif
X	return;
X    } else {
X	ungetc(c, stdin);
X    }
X#ifdef TESTVER
X  fprintf(errfp,"do_Px(coordinates):%f,%f\n", x_coor, y_coor);
X  fflush(errfp);
X#endif
X
X    for (;;) {
X	if (scanf("%f,%f", &x_coor, &y_coor) != 2) {
X	    fprintf(stderr, "Odd number of coordinate\n");
X	    exit(4);
X	}
X	if (scaling) {
X	    icoor.x = (int) (x_coor * x_scaler);
X	    icoor.y = (int) (y_coor * y_scaler);
X	    if (icoor.x < 0)
X		icoor.x -= 1;
X	    if (icoor.y < 0)
X		icoor.y -= 1;
X	} else {
X	    icoor.x = (int) x_coor;
X	    icoor.y = (int) y_coor;
X	}
X
X	if (!pen_up) {
X	    if (plot_abs) {
X		put_seg(current, icoor);
X	    } else {
X		t.x = current.x + icoor.x;
X		t.y = current.y + icoor.y;
X		put_seg(current, t);
X*/
SHAR_EOF
$TOUCH -am 1011090488 libplot/lp/move.c &&
chmod 0644 libplot/lp/move.c ||
echo "restore of libplot/lp/move.c failed"
set `wc -c libplot/lp/move.c`;Wc_c=$1
if test "$Wc_c" != "2718"; then
	echo original size 2718, current size $Wc_c
fi
# ============= libplot/lp/openpl.c ==============
echo "x - extracting libplot/lp/openpl.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/openpl.c &&
X/*
X * do_df.c
X *
X * copyright (c) 1988 environmental defense fund, inc.
X */
X
X#include <stdio.h>
X#include "plotlp.h"
X
X/* global variables */
Xshort int
X        plot_abs,
X        line_type,
X        symbol_mode,
X        stand_char_set,
X        alt_char_set,
X        stand_set_sel,
X        set_standard[NUM_CHAR][CHAR_ELEM],
X        set_alternate[NUM_CHAR][CHAR_ELEM],
X        char_slant,
X        scaling,
X        label_terminator,
X        chord_angle,
X        fill_type,
X        fill_spacing,
X        fill_angle,
X        pen_up;
Xint        printer;		/* printer model */
Xchar    symbol_char;
Xshort int first_fill;
XPOINT   current;
XPOINT   P1,
X        P2;
XPOINT   LL,
X        UR;
Xfloat   x_scaler,
X        y_scaler;
Xfloat   line_pattern_length;
Xfloat   char_width,
X        char_height;
Xfloat   pen_thickness;
Xchar    c;
X
Xopenpl()
X{
X    FILE   *charset;
X    int     i,
X            j;
X
X    to_printer = TRUE;
X	    if (printer == 0 || printer == EPSON) printer = EPSON;
X	    else if (printer == 0 || printer == IBM_PRO) printer = IBM_PRO;
X	    else if (printer == 0 || printer == LASERLOW) printer = LASERLOW;
X	    else if (printer == 0 || printer == LASERMED) printer = LASERMED;
X	    else if (printer == 0 || printer == LASERHIGH) printer = LASERHIGH;
X
X
X    plot_abs = TRUE;
X    line_type = SOLID;
X    scaling = FALSE;
X    label_terminator = 3;
X    chord_angle = 5;
X    symbol_mode = FALSE;
X    stand_char_set = 0;
X    alt_char_set = 0;
X    stand_set_sel = TRUE;
X    if ((charset = fopen(CHARSET, "r")) == NULL) {
X	perror(CHARSET);
X	exit(2);
X    }
X    for (i = 0; i < NUM_CHAR; i++) {
X	for (j = 0; j < CHAR_ELEM; j++) {
X	    fscanf(charset, "%hd,", &set_standard[i][j]);
X	    set_alternate[i][j] = set_standard[i][j];
X	}
X	fscanf(charset, " /* %c */\n", &c);
X    }
X
X    if (fclose(charset) < 0) {
X	perror(CHARSET);
X	exit(1);
X    }
X    char_width = 0.187;
X    char_height = 0.269;
X    char_slant = 0;
X    fill_type = 1;
X    fill_spacing = 10;
X    fill_angle = 0;
X    pen_thickness = 0.3;	/* In millimeters */
X    pen_up = TRUE;
X	LL.y = LL.x = 0;
X	UR.x = 10365;
X	UR.y = 7962;
X	init_map();
X}
X
SHAR_EOF
$TOUCH -am 0213135389 libplot/lp/openpl.c &&
chmod 0644 libplot/lp/openpl.c ||
echo "restore of libplot/lp/openpl.c failed"
set `wc -c libplot/lp/openpl.c`;Wc_c=$1
if test "$Wc_c" != "2082"; then
	echo original size 2082, current size $Wc_c
fi
# ============= libplot/lp/plot_cha.c ==============
echo "x - extracting libplot/lp/plot_cha.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/plot_cha.c &&
X/*
X * plot_cha.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "const.h"
X#include "vars.h"
X
X#ifdef TESTVER
X#include "dbgvars.h"
X#include <ctype.h>		/* for isprint() -- test version */
X#endif
X
X/* 1020.4081 plotter units/in * .25 char/grid * .3937 in/cm */
X#define SCALE_W 100.43366
X
X/* 1020.4081 plotter units/in * .0625 char/grid * .3937 in/cm */
X#define SCALE_H 50.2116832
X
Xfloat   scale_w,
X        scale_h;
X
XPOINT
Xplot_char(left_corner, charac, set)
X    POINT   left_corner;
X    char    charac;
X    short int set[NUM_CHAR][CHAR_ELEM];
X{
X    int     i;
X    short int it;
X    int     index;
X    POINT   here,
X            there;
X    float   offset;
X
X#ifdef TESTVER
X    int     was_on;
X
X    /* turn debug2 off, if necessary, for the duration of plot_char() */
X    if (debug2) {
X	was_on = TRUE;
X	debug2 = FALSE;
X    } else {
X	was_on = FALSE;
X    }
X
X    if (debug6) {
X	if (isprint(charac)) {
X	    fprintf(errfp, "plot_char: %c\n", charac);
X	} else {
X	    fprintf(errfp, "plot_char unprintable: %d\n", charac);
X	}
X    }
X#endif
X
X    i = 0;
X    here = left_corner;
X    pen_up = TRUE;
X    scale_w = char_width * SCALE_W;
X    scale_h = char_height * SCALE_H;
X    if (charac < '!') {
X	if (charac != ' ') {
X	    fprintf(stderr, "Non printing char %x\n", charac);
X	}
X	here.x = left_corner.x + (int) (6 * scale_w + 0.5);
X#ifdef TESTVER
X	/* turn debug2 back on if necessary */
X	if (was_on) {
X	    debug2 = TRUE;
X	}
X#endif
X	return (here);
X    } else
X	index = charac - '!';
X    while ((it = set[index][i++]) != -200) {
X	if (it > 99 || it < -99) {
X	    if (it > 0)
X		pen_up = FALSE;
X	    else
X		pen_up = TRUE;
X	} else {
X	    offset = it * scale_w;
X	    if (offset < 0.0)
X		offset -= 0.5;
X	    else
X		offset += 0.5;
X	    there.x = here.x + (int) offset;
X	    offset = set[index][i++] * scale_h;
X	    if (offset < 0.0)
X		offset -= 0.5;
X	    else
X		offset += 0.5;
X	    there.y = here.y + (int) offset;
X	    if (!pen_up) {
X		put_seg(here, there);
X	    }
X	    here = there;
X	}
X    }
X
X#ifdef TESTVER
X    /* turn debug2 back on if necessary */
X    if (was_on) {
X	debug2 = TRUE;
X    }
X#endif
X    there.x = left_corner.x + (int) (6 * scale_w + 0.5);
X    there.y = left_corner.y;
X    return (there);
X}
X
X
Xput_symbol(center)
X    POINT   center;
X{
X    POINT   ll;
X    float   horz_offset = 2.0;
X    float   vert_offset;
X
X    switch (symbol_char) {
X    case 'o':
X    case 'x':
X	vert_offset = 2.5;
X	break;
X    case '.':
X	vert_offset = 0.5;
X	horz_offset = 1.5;
X	break;
X    default:
X	vert_offset = 4.0;
X	break;
X    }
X    ll.x = center.x - char_width * horz_offset * SCALE_W;
X    ll.y = center.y - char_height * vert_offset * SCALE_H;
X    if (stand_set_sel) {
X	ll = plot_char(ll, symbol_char, set_standard);
X    } else {
X	ll = plot_char(ll, symbol_char, set_alternate);
X    }
X}
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/plot_cha.c &&
chmod 0644 libplot/lp/plot_cha.c ||
echo "restore of libplot/lp/plot_cha.c failed"
set `wc -c libplot/lp/plot_cha.c`;Wc_c=$1
if test "$Wc_c" != "2788"; then
	echo original size 2788, current size $Wc_c
fi
# ============= libplot/lp/plotlp.h ==============
echo "x - extracting libplot/lp/plotlp.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/plotlp.h &&
X/* 
X	include  file to use the epson,ibm-proprinter and the laserjet
X	with the plot(4) graphic library
X	the switch is done via a variable printer this one must be defined
X	in your main program
X	these variables must be defined in the main-part of your programm
X    extern int no_fill;
X    int     to_printer; EPSON || IBM_PRO || LASERLOW || LASERMED || LASERHIGH
X
X*/
X	extern int to_printer;
X/*
X * const.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
Xtypedef struct {
X    int     x,
X            y;
X} POINT;
X
X#define ESC 27
X
X#define TRUE 1
X#define FALSE 0
X
X/* LINE TYPES */
X#define DOTS 0
X#define SHORT_DASH 1
X#define BROKN_1 2
X#define BROKN_2 3
X#define BROKN_DOT 4
X#define BROKN_DASH 5
X#define BROKN_2DASH 6
X#define SOLID 7
X
X/* FILL TYPES: values assigned to var fill_type */
X#define BI_SOLID 1
X#define UNI_SOLID 2
X#define PARALLEL 3
X#define CROSS_HATCH 4
X
X/* Charater set defines */
X#define CHAR_ELEM 28
X#define NUM_CHAR 94
X
X/* Printer model: values of global var 'printer' */
X#define EPSON    1		/* Epson LQ 1500 */
X#define LASERLOW 2		/* HP LaserJet Plus low sized 5" x 6" */
X#define IBM_PRO  3		/* IBM Proprinter */
X#define LASERMED 4		/* HP LaserJet Plus med sized 8" x 6" */
X#define LASERHIGH 5		/* HP LaserJet Plus extra large 8" x 11"*/
X
X#define BITMAPSIZE 935000
X/*
X * vars.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * global variables
X */
X
Xextern short int
X        plot_abs,
X        line_type,
X        symbol_mode,
X        stand_char_set,
X        alt_char_set,
X        stand_set_sel,
X        set_standard[][CHAR_ELEM],
X        set_alternate[][CHAR_ELEM],
X        char_slant,
X        scaling,
X        label_terminator,
X        chord_angle,
X        fill_type,
X        fill_spacing,
X        fill_angle,
X        pen_up;
Xextern int printer;		/* printer model: EPSON or LASER */
Xextern char symbol_char;
Xextern short int first_fill;
Xextern POINT current;
Xextern POINT P1,
X        P2;
Xextern POINT LL,
X        UR;
Xextern float x_scaler,
X        y_scaler;
Xextern float gxscrunch,gyscrunch;
Xextern float char_width,
X        char_height;
Xextern float line_pattern_length;
Xextern float pen_thickness;
Xextern char c;
Xextern int offx,offy;
SHAR_EOF
$TOUCH -am 0213125889 libplot/lp/plotlp.h &&
chmod 0644 libplot/lp/plotlp.h ||
echo "restore of libplot/lp/plotlp.h failed"
set `wc -c libplot/lp/plotlp.h`;Wc_c=$1
if test "$Wc_c" != "2173"; then
	echo original size 2173, current size $Wc_c
fi
# ============= libplot/lp/plotlpus.h ==============
echo "x - extracting libplot/lp/plotlpus.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/plotlpus.h &&
X/* 
X	include  file to use the epson,ibm-proprinter and the laserjet
X	with the plot(4) graphic library
X	the switch is done via a variable printer this one must be defined
X	in your main program
X	these variables must be defined in the main-part of your programm
X    extern int no_fill;
X    int     to_printer; EPSON || IBM_PRO || LASERLOW || LASERMED || LASERHIGH
X
X*/
X/*
X * const.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#define TRUE 1
X#define FALSE 0
X
X/* Printer model: values of global var 'printer' */
X#define EPSON    1		/* Epson LQ 1500 */
X#define LASERLOW 2		/* HP LaserJet Plus low sized 5" x 6" */
X#define IBM_PRO  3		/* IBM Proprinter */
X#define LASERMED 4		/* HP LaserJet Plus med sized 8" x 6" */
X#define LASERHIGH 5		/* HP LaserJet Plus extra large 8" x 11"*/
X
X	int offx,offy;
X	int to_printer=TRUE;
X	int printer=LASERLOW;
X	float gxscrunch,gyscrunch;
X
X
SHAR_EOF
$TOUCH -am 1010213588 libplot/lp/plotlpus.h &&
chmod 0644 libplot/lp/plotlpus.h ||
echo "restore of libplot/lp/plotlpus.h failed"
set `wc -c libplot/lp/plotlpus.h`;Wc_c=$1
if test "$Wc_c" != "885"; then
	echo original size 885, current size $Wc_c
fi
# ============= libplot/lp/set_dbgs.c ==============
echo "x - extracting libplot/lp/set_dbgs.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/set_dbgs.c &&
X/*
X * set_dbgs.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X
XFILE   *errfp;
Xint     debug1c,
X        debug1f,
X        debug2,
X        debug2x,
X        debug3,
X        debug4,
X        debug5,
X        debug6,
X        debug7,
X        debug8,
X        debug9;
X
Xset_debugs()
X{
X#if 0
X    errfp = fopen(TTY, "w");
X#else
X    errfp = fopen("plot.err", "w");
X#endif
X
X    fprintf(errfp, "- - - plot.err: plot program error file - - -\n\n");
X
X    /* to console: transfer control to fns */
X    debug1c = 1;
X
X    /* to plot.err: transfer control to fns */
X    debug1f = 1;
X
X    /*
X     * to plot.err: scaled endpts of segment in put_seg() does NOT include
X     * endpoints plotted during fill routines 
X     */
X    debug2 = 1;
X
X    /*
X     * to plot.err: scaled endpts of segment in put_seg(), EXTENSION --
X     * endpoints plotted during fill routines 
X     */
X    debug2x = 1;
X
X    /* to plot.err: the points sent to hatch() by do_WG, do_Rx */
X    debug3 = 0;
X
X    /* to plot.err: info from fill routines */
X    debug4 = 0;
X
X    /* to plot.err: bytes sent to printer from dump_map() */
X    debug5 = 0;
X
X    /* to plot.err: character being processed by plot_char() */
X    debug6 = 0;
X
X    /* to plot.err: detailed info from get_chgs() */
X    debug7 = 0;
X
X    /* to plot.err: NOT USED */
X    debug8 = 0;
X
X    /* to plot.err: info from fix_fill */
X    debug9 = 0;
X}
SHAR_EOF
$TOUCH -am 1007125888 libplot/lp/set_dbgs.c &&
chmod 0644 libplot/lp/set_dbgs.c ||
echo "restore of libplot/lp/set_dbgs.c failed"
set `wc -c libplot/lp/set_dbgs.c`;Wc_c=$1
if test "$Wc_c" != "1389"; then
	echo original size 1389, current size $Wc_c
fi
# ============= libplot/lp/vars.h ==============
echo "x - extracting libplot/lp/vars.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/vars.h &&
X/*
X * vars.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * global variables
X */
X
Xextern short int
X        plot_abs,
X        line_type,
X        symbol_mode,
X        stand_char_set,
X        alt_char_set,
X        stand_set_sel,
X        set_standard[][CHAR_ELEM],
X        set_alternate[][CHAR_ELEM],
X        char_slant,
X        scaling,
X        label_terminator,
X        chord_angle,
X        fill_type,
X        fill_spacing,
X        fill_angle,
X        pen_up;
Xextern int printer;		/* printer model: EPSON or LASER */
Xextern char symbol_char;
Xextern short int first_fill;
Xextern POINT current;
Xextern POINT P1,
X        P2;
Xextern POINT LL,
X        UR;
Xextern float x_scaler,
X        y_scaler;
Xextern float char_width,
X        char_height;
Xextern float line_pattern_length;
Xextern float pen_thickness;
Xextern char c;
SHAR_EOF
$TOUCH -am 0213140589 libplot/lp/vars.h &&
chmod 0644 libplot/lp/vars.h ||
echo "restore of libplot/lp/vars.h failed"
set `wc -c libplot/lp/vars.h`;Wc_c=$1
if test "$Wc_c" != "830"; then
	echo original size 830, current size $Wc_c
fi
# ============= libplot/lp/README ==============
echo "x - extracting libplot/lp/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/README &&
XHPGLPLOT and HPGLFIX
X
XVersion 3.0
X
XHpglplot is a filter that translates from Hewlett-Packard Graphics
XLanguage (used in HP plotters) to one of three popular printers.
XHpglfix is a filter that corrects some problems in the HPGL codes
Xoutput by the 20/20 spreadsheet program.
X
XCopyright (c) 1988 Environmental Defense Fund, Inc.
X
XPermission is granted to copy and distribute these programs freely,
Xprovided that you do not deprive others of the right to do the same,
Xand that the copyright notices and this notice are not removed.  We
Xrequest a donation to help cover the costs of development.  Suggested
Xdonations are $35 for a single user, and $100 for multi-user
Xenvironments; however, donations of any size are welcome.
X
XSend donations to:
X
X Dan Kirshner
X Environmental Defense Fund
X 5655 College Ave, Suite 304
X Oakland, CA  94618
X (415) 658-8008
X
XEmail about the programs should be addressed to David MacKenzie at
Xedf@rocky2.rockefeller.edu (...rutgers!cmcl2!rocky2!edf).
X
XThe Environmental Defense Fund (EDF) is a private, non-profit
Xenvironmental education and advocacy organization, incorporated in
X1967, with over 60,000 members and six offices nationwide.  EDF's staff
Xincludes attorneys, scientists, and economists who seek solutions to a
Xbroad range of environmental and public health problems.
X
XIf you would like more information about EDF, or information on
Xbecoming a member, write or call our national headquarters at:
X
XEnvironmental Defense Fund
X257 Park Avenue South
XNew York, NY  01110
X(212) 505-2100
SHAR_EOF
$TOUCH -am 1014205990 libplot/lp/README &&
chmod 0644 libplot/lp/README ||
echo "restore of libplot/lp/README failed"
set `wc -c libplot/lp/README`;Wc_c=$1
if test "$Wc_c" != "1519"; then
	echo original size 1519, current size $Wc_c
fi
# ============= libplot/lp/README2 ==============
echo "x - extracting libplot/lp/README2 (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/lp/README2 &&
XThanx to EDF for letting me post this since it's derived from
Xa package they posted in 1988, Copyright Environmental Defense
XFund.
XYour HP Laser must have enough memory for the graphic image if
Xyou want every plot to come out right.
XThe output is optimized so your output files are as small as
Xpossible. But if there is a graph with very many vectors in it
Xthe standard memory in the HP is not sufficient!
X
Xregards
XRoland van Hout,
XI changed and added some pieces here but I claim no rights on
Xthem.
XIf you have comments or notes or ideas you can mail me at:
Xhot@integow.uucp (uunet!mcsun!hp4nl!integow!hot)  or
Xhout@hot.mug ..!plains!minixug!hot!hout
SHAR_EOF
$TOUCH -am 1026183190 libplot/lp/README2 &&
chmod 0644 libplot/lp/README2 ||
echo "restore of libplot/lp/README2 failed"
set `wc -c libplot/lp/README2`;Wc_c=$1
if test "$Wc_c" != "652"; then
	echo original size 652, current size $Wc_c
fi
# ============= libplot/sun/Makefile ==============
if test ! -d 'libplot/sun'; then
    echo "x - creating directory libplot/sun"
    mkdir 'libplot/sun'
fi
echo "x - extracting libplot/sun/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/sun/Makefile &&
X# The names of the installed binary and manual page.
X# Feel free to change.
XBINARY	= /usr/local/sunplot
XMANUAL	= /usr/man/manl/sunplot.l
X
XCFLAGS	= -O
X
Xsunplot:	sunplot.o
X		$(CC) -o sunplot sunplot.o -lsuntool -lsunwindow -lpixrect
X
Xinstall:	sunplot
X		cp sunplot $(BINARY)
X		cp sunplot.1 $(MANUAL)
X
Xclean:
X		rm -f sunplot *.o core make.out
X
Xsunplot.o:	sunplot.icon
SHAR_EOF
$TOUCH -am 1225041788 libplot/sun/Makefile &&
chmod 0644 libplot/sun/Makefile ||
echo "restore of libplot/sun/Makefile failed"
set `wc -c libplot/sun/Makefile`;Wc_c=$1
if test "$Wc_c" != "364"; then
	echo original size 364, current size $Wc_c
fi
# ============= libplot/sun/README ==============
echo "x - extracting libplot/sun/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/sun/README &&
XThis program was written on a Sun 3/50 running SunOS 3.2.
XIt also compiles and runs on a Sun 3/50 running SunOS 3.4.
X
XTo make simply type ``make''.
XTo install, check the Makefile to see if all the names are correct.  Then
Xtype ``make install''.
X
XIf you find any bugs or if you have any suggestions or improvements, please
Xdrop me a note at the address below.
X
XYou might try the command
X	echo 0 0 1 1 2 4 3 9 4 16 | spline | graph | sunplot
Xafter which a window pops up.  Then click the ``Next Page'' button.
X
XSjoerd Mullender
XDept. of Mathematics and Computer Science
XFree University
XAmsterdam
XNetherlands
X
XEmail: sjoerd@cs.vu.nl
XIf this doesn't work, try ...!seismo!mcvax!cs.vu.nl!sjoerd or
X...!seismo!mcvax!vu44!sjoerd or sjoerd%cs.vu.nl@seismo.css.gov.
SHAR_EOF
$TOUCH -am 1225041788 libplot/sun/README &&
chmod 0644 libplot/sun/README ||
echo "restore of libplot/sun/README failed"
set `wc -c libplot/sun/README`;Wc_c=$1
if test "$Wc_c" != "756"; then
	echo original size 756, current size $Wc_c
fi
# ============= libplot/sun/sunplot.1 ==============
echo "x - extracting libplot/sun/sunplot.1 (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/sun/sunplot.1 &&
X.TH SUNPLOT 1
X.SH NAME
Xsunplot \- plotter backend for Sun workstation
X.SH SYNOPSIS
X.B sunplot
X[
X.B \-c
X.I canvas_size
X] [
X.B \-h
X.I horizontal_size
X] [
X.B \-v
X.I vertical_size
X] [
X.B \-f
X.I font_name
X] [
X.B \-r
X] [
X.B \-x
X] [
X.B \-y
X] [
X.B \-l
X] [
X.B \-s
X]
X.SH DESCRIPTION
X.I Sunplot
Xreads UNIX plotter code (see
X.IR plot (5))
Xfrom standard input and displays it in a Sun window.
XThe window consists of two subwindows.
XAt the top is a control panel with a number of buttons and below it is
Xa window with a canvas on which
X.I sunplot
Xdraws and a horizontal and a vertical scrollbar with which you can select
Xwhich part of the canvas you want to see in the window.
XThe buttons in the control panel have the following functions:
X.TP
X.B "Next Page"
XDraw the next page.
XPages are separated by an
X.B e
X(the
X.I erase
Xfunction in the
X.IR plot (3X)
Xlibrary).
XWhile
X.I sunplot
Xis still reading a page this button is not displayed.
X.TP
X.B Redraw
XRedraw the current page.
X.TP
X.B Zoom
XZoom the current page.
X.I Sunplot
Xfinds the most extreme x- and y-coordinates in the current page and uses
Xthose values in stead of the values given by the
X.B s
Xcommand (the
X.I space
Xfunction) for scaling.
X.TP
X.B Options
X.I Sunplot
Xdisplays a window where you can set certain options.
XSee the description below.
X.TP
X.B Dump
X.I Sunplot
Xdisplays a window with three items.
XYou should type a file name after the string
X.B Dump to file:
Xand then press the
X.B Done
Xbutton.
X.I Sunplot
Xwill then dump the plot into the named file in the format chosen with the
X.B Dump format
Xitem.
XThe dump can be in either
X.IR rasterfile (5)
Xor
X.I icon
Xformat.
XIf the file name is empty,
X.I sunplot
Xwill do nothing.
X.TP
X.B "Fit Screen"
XResize the window so that the canvas fits.
X.TP
X.B Quit
XExit
X.IR sunplot .
X.SH OPTIONS
XWhen the
X.B Options
Xbutton is pressed
X.I sunplot
Xwill display a window with the following items.
X.TP
X.B Done
XDone setting options.
X.I Sunplot
Xwill automatically do a redraw of the page with the new settings.
X.TP
X.B Rotate
XRotate the plot by 90 degrees counter-clockwise.
X.TP
X.B "X Mirror"
XMirror the plot in the x-axis.
X.TP
X.B "Y Mirror"
XMirror the plot in the y-axis.
X.TP
X.B Label
XIf on, display labels.
X.TP
X.B Square
XIf on, the canvas is square, otherwise you can set the horizontal and vertical
Xsizes of the canvas separately.
X.TP
X.B Reverse
XDisplay the canvas in reverse video.
X.TP
X.B "Font name"
XThe name of the font to be used for the labels.
XIf the name is not absolute it is taken to be relative to the system's fonts
Xdirectory /usr/lib/fonts/fixedwidthfonts.
XIf no name is given or the named file does not contain a font, the default
Xfont is used.
X.TP
X.B "Canvas size"
XThe size of the canvas.
XThe size of the canvas is measured in pixels.
XThis is only displayed when the
X.B Square
Xtoggle is on.
X.TP
X.B "Horizontal size"
XThe horizontal size of the canvas.
XThis is only displayed when the
X.B Square
Xtoggle is off.
X.TP
X.B "Vertical size"
XThe vertical size of the canvas.
XThis is only displayed when the
X.B Square
Xtoggle is off.
X.PP
XThe following command line options are recognized.
X.IP "\f3\-c\fP \f2canvas_size\fP"
XSet the canvas size.
X.I Canvas_size
Xmust be between 64 and 2048.
XThis also switches on the
X.B Square
Xtoggle.
X.IP "\f3\-h\fP \f2horizontal_size\fP"
XSet the horizontal size.
X.I Horizontal_size
Xmust be between 64 and 2048.
XThis also switches off the
X.B Square
Xtoggle.
X.IP "\f3\-v\fP \f2vertical_size\fP"
XSet the vertical size.
X.I Vertical_size
Xmust be between 64 and 2048.
XThis also switches off the
X.B Square
Xtoggle.
X.IP "\f3\-f\fP \f2font_name\fP"
XSet the font to be used for labels.
XThis is independent from the font that is used for the text in the control
Xpanel and the options and dump windows.
XA name not starting with ``/'' is taken to be relative to the system's font
Xdirectory /usr/lib/fonts/fixedwidthfonts.
X.IP \f3\-r\fP
XRotate the plot by 90 degrees counter-clockwise.
X.IP \f3\-x\fP
XMirror the plot in the x-axis.
X.IP \f3\-y\fP
XMirror the plot in the y-axis.
X.IP \f3\-l\fP
XToggle labeling.
X.IP \f3\-s\fP
XToggle square mode.
X.PP
XThe
X.BR \-r ,
X.B \-x
Xand
X.B \-y
Xoptions are evaluated left to right and can be repeated to get cumulative
Xeffect.
X.I Sunplot
Xalso recognizes the generic tool arguments; see
X.IR suntools (1)
Xfor a list of these arguments.
X.PP
XThe defaults are: batching on, labels printed, square canvas, canvas is 512
Xby 512 pixels, the point
X.I "(0,\ 0)"
Xis in the lower left-hand corner.
X.SH BUGS
XThe
X.I linemod
Xfunction is not implemented.
X.PP
XThe
X.B zoom
Xcommand doesn't take the height of labels into account.
X.SH "SEE ALSO"
X.IR plot (3X),
X.IR plot (5),
Xand
X.IR rasterfile (5).
X.SH AUTHOR
XSjoerd Mullender, Free University, Amsterdam <sjoerd@cs.vu.nl>
SHAR_EOF
$TOUCH -am 1225041788 libplot/sun/sunplot.1 &&
chmod 0644 libplot/sun/sunplot.1 ||
echo "restore of libplot/sun/sunplot.1 failed"
set `wc -c libplot/sun/sunplot.1`;Wc_c=$1
if test "$Wc_c" != "4672"; then
	echo original size 4672, current size $Wc_c
fi
echo "End of part 5, continue with part 6"
exit 0


-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is part 07 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= libplot/cgi/libCGI.c ==============
echo "x - extracting libplot/cgi/libCGI.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/cgi/libCGI.c &&
X
X/* plot(4) graphics library for the SCO  CGI library under xenix*/
X
X
X#include <stdio.h>	/* for fprintf on stderr	*/
X#include <ctype.h>	/*	we are using tolower()	*/
X#define MAIN	1	/* causes declarations in the .h files to occur here */
X#include "cgistuff.h"	/*	includes cgitypes.h and cgifctns.h	*/
X#include "ctest.h"
X#include <signal.h>
X
X/*VOID close_gin_device( VOID );	/*	in gintests.c	*/
X
Xstatic char cgidisplay[]="CGIDISP ";
Xstatic char cgiprinter[]="CGIPRNT ";
Xchar * cgidevice = cgidisplay;
Xstatic void usage_message();
Xint vsl_type_returns;
X
X
X
X
Xfloat gxscrunch,gyscrunch;
Xfloat pitograd;
Xint CGIoffx,CGIoffy;
X
X# include <stdio.h>
X# include <fcntl.h>
X# include "CGI.h"
X# include <math.h>
X
X	herc_args	CGIhv,CGIcurpos;
X
X/* #define DEBUG   /* turn on if no driver calls should be made!*/
X
Xopenpl()
X{
X
X	int strlen( char * );
X#ifndef NO_DEBUGGING
X#ifndef MSDOS
X#ifdef CGIVER
X	extern int scodebug;	/* declared in the bindings in v_opnwk.c */
X#else
X	extern int cgidebug;	/* declared in the bindings in v_opnwk.c */
X#endif
X#endif
X#endif
X				/* setting to TRUE will cause the bindings */
X				/* to print out the execl command rather */
X				/* than executing it when they are forking */
X				/* the agents.	*/
X	/* local variables */
X	SINT16	coord_xform_mode;
X	char	*char_pointer;
X	register SINT16	i;
X	char * char_ptr;
X	int defer_mode;
X	int use_defaults;
X
X
X
X	use_defaults = TRUE;
X
X	manual_operation = FALSE;	/* m flag */
X	do_timings = FALSE;		/* t flag */
X	defer_mode = ASAP;	/* b flag sets to (BNI), or a sets to (ASTI) */
X	coord_xform_mode = 0;	/* selected with 0, 1, 2, or 3	*/
X
X
X#ifndef NO_DEBUGGING
X#ifndef MSDOS
X#ifdef CGIVER
X	if ( scodebug )
X	{
X		printf( "\nExecute the desired agent with these 4 arguments on a console screen:\n" );
X	}
X	else
X#else
X	if ( cgidebug )
X	{
X		printf( "\nExecute the desired agent with these 4 arguments on a console screen:\n" );
X	}
X	else
X#endif
X#endif
X#endif
X
X	ok_to_use_graphtext = FALSE;
X
X	if ( cgistart( coord_xform_mode, defer_mode )	)
X	{
X		fprintf( stderr, "plotcgi: message: open failed, ctest will exit.\n" );
X		fprintf( stderr, "plotcgi: requires environment variables:\n" );
X		fprintf( stderr, "CGIPATH=   <- specify pathname for location of CGI agents.\n" );
X		fprintf( stderr, "CGIDISP=   <- specify agent name for display\n" );
X/*		fprintf( stderr, "or CGIPRNT=  <- alternate agent name when running plotcgi with -p option.\n" );*/
X		fprintf( stderr, "(instead of CGIPATH, you may need VDIPATH for CGI ver. 1.0 bindings.)\n" );
X		exit (-1);
X	}
X
X	/*	set up the color palettes	*/
X	original_palette();
X	normal_graphtext();	/* adjusts graphtext size	*/
X
X
X	/*	CGI starts up in graphics mode	*/
X	ok_to_use_graphtext = TRUE;
X
X	/*	The workstation should already be clear at this time.	*/
X
X        CGIcurpos=CGIhv;
X	linemod("solid");
X}
X
Xclosepl()
X{
X#ifndef DEBUG
X	if (isatty(0)) getchar(); /* stdin is a tty then leave the 
X		screen until a character is pressed */
X	/* close the workstation*/
X	if ( v_clswk(dev_handle) < 0 )
X		report_cgi_error( "v_clswk" );
X#endif
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=(VDC_X/(float) x);gyscrunch=(VDC_Y/(float) y);
X	CGIoffx = (-1 *(x0*gxscrunch) + 1);
X	CGIoffy=(y0*gyscrunch)-1;
X}
X
X#ifdef DEBUG
Xprintf("offx=%d, offy=%d\n",CGIoffx,CGIoffy);
X#endif
X
X}
X
Xerase()
X{
X#ifndef DEBUG
X	if (isatty(0)) getchar(); /* stdin is a tty then leave the 
X		screen until a character is pressed */
X	v_clrwk(dev_handle);
X#endif
X}
X
Xlabel(s)
Xchar *s;
X{
X#ifndef DEBUG
X	v_gtext(dev_handle, CGIcurpos.x1,CGIcurpos.y1,s);
X#else
X	printf("str=%s, x=%d, y=%d\n",s,CGIhv.x1,CGIhv.y1);
X#endif
X}
X
Xmove(x,y)
Xint x,y;
X{
XSINT16 row,column;
X	x = x*gxscrunch;
X	y = y*gyscrunch;
X	y += CGIoffy ;
X	x +=  CGIoffx ;
X	CGIcurpos.x1 = x;  CGIcurpos.y1 = y;
X	column = x; row = y;
X	vs_curaddress(dev_handle,row,column);
X#ifdef DEBUG
X	printf("move %d, %d\n",x,y);
X#endif
X
X}
X
Xcont(x,y)
Xint x,y;
X{
X	int xo,yo;
X
X	int line_spacing;
X	int start_line;
X	SINT16 polyline_array[256];
X
X	xo = x*gxscrunch;
X	yo = y*gyscrunch;
X	yo += CGIoffy ;
X	xo +=  CGIoffx ;
X	/*	leave room for 5 lines of text at the top	*/
X	start_line = VDC_Y - (5 * cell_height);
X	line_spacing = start_line / (LINE_TYPES+1);
X
X
X	/* draw each line type across the screen in default color */
X	polyline_array[0] = CGIcurpos.x1;	/* x1 */
X	polyline_array[2] = xo;	/* x2 */
X	polyline_array[1] = CGIcurpos.y1;/*y1*/
X	polyline_array[3] = yo;	/* y2 */
X	CGIhv.c = CGIcurpos.c;
X#ifndef DEBUG
X	if ( v_pline( dev_handle, 2, polyline_array ) < 0 )
X		report_cgi_error( "v_pline" );
X#else
X		printf("cont = line from %d,%d to %d,%d\n",CGIhv.x1,CGIhv.y1,CGIhv.x2,CGIhv.y2);
X#endif
X		CGIcurpos.x1=xo;CGIcurpos.x2=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{
XSINT16 xo,yo,ro;
X	xo=(x*gxscrunch);yo=(y*gyscrunch);
X	yo = CGIoffy + yo;
X	xo =  CGIoffx + xo;
X	ro = (r * gxscrunch);
X	v_circle(dev_handle,xo,yo,ro);
X}
X
Xarc(x,y,x0,y0,x1,y1)
Xint x,y,x0,y0,x1,y1;
X{
X#ifdef ARC
Xfloat a1,a2,r1,r2;
XSINT16 xo,yo,c1,c2,r;
X	if ((x-x0) > 0) {
X		r1=(y-y0)/(x-x0);
X		a1=atan(r1);
X		c1=(a1*pitograd*10);
X	}
X	else {
X		c1=1800;
X	}
X	if ((x-x1) > 0) {
X		r2=(y-y1)/(x-x1);
X		a2=atan(r2);
X		c2=(a2*pitograd*10);
X	}
X	else {
X		c2=1800;
X	}
X	
X	xo=(x0*gxscrunch);yo=(y0*gyscrunch);
X	yo = CGIoffy + yo;
X	xo =  CGIoffx + xo;
X	v_arc(dev_handle, xo,yo, ,c1,c2);
X#endif
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{
Xint xo,yo;
X	xo = x*gxscrunch;
X	yo = y*gyscrunch;
X	yo += CGIoffy ;
X	xo +=  CGIoffx ;
X	CGIcurpos.x1 = xo; CGIcurpos.y1 = yo;
X#ifndef DEBUG
X	move(x,y);
X	cont(x,y);
X#else
X		printf("point %d,%d\n",x,y);
X#endif
X}
X
Xlinemod(s)
Xchar *s;
X{
XSINT16 line_type;
X  if (strcmp(s,"dotted")==0) {
X	line_type = 3;
X	  }
X  else if (strcmp(s,"solid")==0) {
X	line_type = 1;
X	  }
X	  else if (strcmp(s,"longdashed")==0) {
X		line_type = 2;
X		  }
X		 else if (strcmp(s,"shortdashed")==0) {
X			line_type = 7;
X			 }
X			else if (strcmp(s,"dotdashed")==0) {
X				line_type = 4;
X				}
Xif ( (vsl_type_returns = vsl_type( dev_handle, line_type )) < 0)
X	report_cgi_error( "vsl_type" );
X}
X
X
Xbox(x0, y0, x1, y1)
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 1014213390 libplot/cgi/libCGI.c &&
chmod 0666 libplot/cgi/libCGI.c ||
echo "restore of libplot/cgi/libCGI.c failed"
set `wc -c libplot/cgi/libCGI.c`;Wc_c=$1
if test "$Wc_c" != "6196"; then
	echo original size 6196, current size $Wc_c
fi
# ============= libplot/cgi/README ==============
echo "x - extracting libplot/cgi/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/cgi/README &&
XThe following files are not included because of SCO copyrights:
Xcgifctns.h cgistart.c cgistuff.c cgistuff.h cgitypes.h ctest.h gtexttests.c
XIf you get Xenix with CGI you will get these files anyway.
SHAR_EOF
$TOUCH -am 1014213590 libplot/cgi/README &&
chmod 0644 libplot/cgi/README ||
echo "restore of libplot/cgi/README failed"
set `wc -c libplot/cgi/README`;Wc_c=$1
if test "$Wc_c" != "199"; then
	echo original size 199, current size $Wc_c
fi
# ============= libplot/cgi/h.c ==============
echo "x - extracting libplot/cgi/h.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > libplot/cgi/h.c &&
X# include <stdio.h>
X# include <fcntl.h>
X# include <math.h>
X
Xmain(argc, argv)
Xint	argc;
Xchar	*argv[];
X{
X	int	i,j;
X	char	strbuff[90];
X
X	openpl();space(0,0,720,350);
X	for (j=1;j<=100;j++) {
X	erase();
X	move(280,280);
X	/* Do some random dots */
X	label("Some random dots.");
X	for (i = 0; i < 100; i ++)
X	{
X		point( abs(lrand48() % 719),abs(lrand48() % 347));
X	};
X/*	sleep(10);
X	/* Do some random lines */
X	erase();
X	move(280,280);
X	/* Do some random dots */
X	label("Some random lines.");
X	for (i = 0; i < 50; i ++)
X	{
X	line( abs(lrand48() % 719),abs(lrand48() % 347),abs(lrand48() % 719),abs(lrand48() % 347));
X	};
X	}
X	closepl();
X}	
SHAR_EOF
$TOUCH -am 0511152090 libplot/cgi/h.c &&
chmod 0666 libplot/cgi/h.c ||
echo "restore of libplot/cgi/h.c failed"
set `wc -c libplot/cgi/h.c`;Wc_c=$1
if test "$Wc_c" != "627"; then
	echo original size 627, current size $Wc_c
fi
# ============= lp.c ==============
echo "x - extracting lp.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > lp.c &&
X/*	@(#)driver.c	5.1		*/
X#include <stdio.h>
X#include <math.h>
X#include <errno.h>
X#include "plotlpus.h"
X
Xfloat deltx = 4095.0;
Xfloat delty = 4095.0;
X
Xmain(argc,argv)  char **argv; {
X	int std=1;
X	FILE *fin;
X
X	while(argc-- > 1) {
X		if(*argv[1] == '-')
X			switch(argv[1][1]) {
X				case 'l':
X					deltx = atoi(&argv[1][2]) - 1;
X					break;
X				case 'w':
X					delty = atoi(&argv[1][2]) - 1;
X					break;
X				case 's':
X					printer=LASERLOW;
X					break;
X				case 'm':
X					printer=LASERMED;
X					break;
X				case 'h':
X					printer=LASERHIGH;
X					break;
X				case 'i':
X					printer=IBM_PRO;
X					break;
X				case 'e':
X					printer=EPSON;
X					break;
X				}
X
X		else {
X			std = 0;
X			if ((fin = fopen(argv[1], "r")) == NULL) {
X				fprintf(stderr, "can't open %s\n", argv[1]);
X				exit(1);
X				}
X			fplt(fin);
X			}
X		argv++;
X		}
X	if (std)
X		fplt( stdin );
X	exit(0);
X	}
X
X
Xfplt(fin)  FILE *fin; {
X	int c;
X	char s[256];
X	int xi,yi,x0,y0,x1,y1,r,dx,n,i;
X	int pat[256];
X
X	openpl();
X	while((c=getc(fin)) != EOF){
X		switch(c){
X		case 'm':
X			xi = getsi(fin);
X			yi = getsi(fin);
X			move(xi,yi);
X			break;
X		case 'l':
X			x0 = getsi(fin);
X			y0 = getsi(fin);
X			x1 = getsi(fin);
X			y1 = getsi(fin);
X			line(x0,y0,x1,y1);
X			break;
X		case 't':
X			getsd(s,fin);
X			label(s);
X			break;
X		case 'e':
X			erase();
X			break;
X		case 'p':
X			xi = getsi(fin);
X			yi = getsi(fin);
X			point(xi,yi);
X			break;
X		case 'n':
X			xi = getsi(fin);
X			yi = getsi(fin);
X			cont(xi,yi);
X			break;
X		case 's':
X			x0 = getsi(fin);
X			y0 = getsi(fin);
X			x1 = getsi(fin);
X			y1 = getsi(fin);
X			space(x0,y0,x1,y1);
X			break;
X		case 'a':
X			xi = getsi(fin);
X			yi = getsi(fin);
X			x0 = getsi(fin);
X			y0 = getsi(fin);
X			x1 = getsi(fin);
X			y1 = getsi(fin);
X			arc(xi,yi,x0,y0,x1,y1);
X			break;
X		case 'c':
X			xi = getsi(fin);
X			yi = getsi(fin);
X			r = getsi(fin);
X			circle(xi,yi,r);
X			break;
X		case 'f':
X			getsd(s,fin);
X			linemod(s);
X			break;
X		case 'd':
X			xi = getsi(fin);
X			yi = getsi(fin);
X			dx = getsi(fin);
X			n = getsi(fin);
X			for(i=0; i<n; i++)pat[i] = getsi(fin);
X			dot(xi,yi,dx,n,pat);
X			break;
X			}
X		}
X	closepl();
X	}
Xgetsi(fin)  FILE *fin; {	/* get an integer stored in 2 ascii bytes. */
X	short a, b;
X	if((b = getc(fin)) == EOF)
X		return(EOF);
X	if((a = getc(fin)) == EOF)
X		return(EOF);
X	a = a<<8;
X	return(a|b);
X}
Xgetsd(s,fin)  char *s;  FILE *fin; {
X	for( ; *s = getc(fin); s++)
X		if(*s == '\n')
X			break;
X	*s = '\0';
X	return;
X}
X
X
Xmatherr(x)
Xstruct exception *x;
X{
Xif(x->type==DOMAIN)
X	{errno=EDOM;
X	if(!strcmp("log",x->name))x->retval = (-HUGE);
X	else x->retval = 0;
X	return(1);
X	}
Xelse  if ((x->type)==SING)
X	{errno=EDOM;
X	x->retval = (-HUGE);
X	return(1);
X	}
Xelse return(0);
X}
X
X
SHAR_EOF
$TOUCH -am 1014215790 lp.c &&
chmod 0644 lp.c ||
echo "restore of lp.c failed"
set `wc -c lp.c`;Wc_c=$1
if test "$Wc_c" != "2654"; then
	echo original size 2654, current size $Wc_c
fi
# ============= herc/Makefile ==============
if test ! -d 'herc'; then
    echo "x - creating directory herc"
    mkdir 'herc'
fi
echo "x - extracting herc/Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/Makefile &&
X# define IX386 for Interactive 386
XDEFINES=-DIX386
XCFLAGS=$(DEFINES)
X
Xherc.o: herc.c herc.h
X	cc -c $(DEFINES) -DINKERNEL herc.c
X
X# must be root to make install
Xinstall: herc.o 
X	cp herc.o herc.c herc.h config Makefile /etc/atconf/modules/herc
X	mkunix
X	mv /etc/atconf/kernels/unix.std.* /unix.test
X
X# must be root to make filesys
X# also edit /etc/atconf/systems/system.std to enter herc as device with 
X# major device number 15
Xfilesys:
X	mknod /dev/herc c 15 0
X	chmod ugo+rwx /dev/herc
X	mkdir /etc/atconf/modules/herc
X
Xtest: test.o  herc.h
X	cc -o test $(DEFINES) test.o 
X
Xprint:
X	srcpub herc.h test.c herc.c config Makefile >PRINT
X	trj PRINT
X	offjet tr.PRINT
SHAR_EOF
$TOUCH -am 1014125090 herc/Makefile &&
chmod 0644 herc/Makefile ||
echo "restore of herc/Makefile failed"
set `wc -c herc/Makefile`;Wc_c=$1
if test "$Wc_c" != "658"; then
	echo original size 658, current size $Wc_c
fi
# ============= herc/bitset.h ==============
echo "x - extracting herc/bitset.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/bitset.h &&
Xstatic char SCCS_x[] = "%W% %G% %U%";
X/*+++
X	bitset.h
X 
X	PURPOSE : bit manipulation macros
X
X	DATE	: 2/15/90
X
X	AUTHOR  : W. Hatch
X
X	PROJECT : WEH Software
X			
X	COMPANY : Computational Engineering
X		  14504 Greenview Drive Suite 500
X		  Laurel, Maryland 20708
X		  Phone (301)470-3839
X		  FAX (301)776-5461
X
X	CREDITS : Harbison And Steele, A C Reference Manual
X		  Prentice Hall, 1984, Pages 172-180
X
X---*/ 
X/*
X------------------------------------------------------------------------
X  MODIFICATIONS
XDATE-PROGRAMMER	DESCRIPTION
X------------------------------------------------------------------------
X*/
X
X#define	SET		unsigned long
X#define SET_BITS	(sizeof(SET) * 8)	/* number of bits in SET */
X
X#define VALIDBIT(i)	((i) < SET_BITS && (i) >= 0)
X
X#define	EMPTYSET		((SET) 0)
X#define SINGLESET(i)		(((SET) 1) << (i))
X#define DOSET(set,i)		((set | (SINGLESET(i))))
X#define AND(set1,set2)		((set1) & (set2))
X#define OR(set1, set2)		((set1) | (set2))
X#define XOR(set1, set2)		((set1) ^ (set2))
X#define ISSET(i,set)		(SINGLESET((i)) & (set))
X#define MASKSET(set,mask)	((set) & (mask) == (mask))
SHAR_EOF
$TOUCH -am 1013182190 herc/bitset.h &&
chmod 0644 herc/bitset.h ||
echo "restore of herc/bitset.h failed"
set `wc -c herc/bitset.h`;Wc_c=$1
if test "$Wc_c" != "1086"; then
	echo original size 1086, current size $Wc_c
fi
# ============= herc/config ==============
echo "x - extracting herc/config (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/config &&
X* 1 "herc/config.c
X
X*ident	"@(#)config	
X
Xcharacter(9)
X
Xprefix = herc
X
Xfunctions = init, open, close, read, write, ioctl
X
SHAR_EOF
$TOUCH -am 1013182190 herc/config &&
chmod 0644 herc/config ||
echo "restore of herc/config failed"
set `wc -c herc/config`;Wc_c=$1
if test "$Wc_c" != "121"; then
	echo original size 121, current size $Wc_c
fi
# ============= herc/herc.c ==============
echo "x - extracting herc/herc.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/herc.c &&
Xstatic char SCCS_hercdent[] = "%W% %G% %U%";
X/*======================================================================*/
X/*  herc.c - hercules graphics card driver for Microport V386/3.0e	*/
X/*									*/
X/*	2/5/90								*/
X/*	Bill Hatch							*/
X/*	uunet!bts!bill							*/
X/*	Computational Engineering					*/
X/*	14504 Greenview Drive Suite 500					*/
X/*	Laurel, Maryland 20708						*/
X/*	Phone (301)470-3839						*/
X/*									*/
X/*	see herc.h for credits to other programmers and authors		*/
X/*======================================================================*/
X#include "herc.h"
Xextern char *sptalloc();
Xextern int  sptfree();
Xextern unsigned char inb();
X
X/*----------------------------------------------------------------------*/
X/* settings for 6845 chips data registers for graphics and text modes	*/
X/*----------------------------------------------------------------------*/
Xstatic int gdata[12] = {0x35, 0x2d, 0x2e, 0x7, 0x5b, 0x2, 0x57, 0x57, 0x2,
X	0x3, 0x0, 0x0};
Xstatic int tdata[12] = {0x61, 0x50, 0x52, 0xf, 0x19, 0x6, 0x19, 0x19, 0x2,
X	0xd, 0xb, 0xc};
X
Xstatic char *myvaddr;
Xstatic char *vaddr0;
Xstatic char *vaddr1;
Xstatic int g_mode();
Xstatic int t_mode();
X
Xstatic int clearscreen();
Xstatic int wait_for_retrace();
X
X/*======================================================================*/
X/* hercinit - nothing done						*/
X/*======================================================================*/
Xhercinit(dev)
Xint dev;
X{
X	u.u_error = 0;
X	return;
X}
X/*======================================================================*/
X/* hercopen - enable graphics and clear screen				*/
X/*======================================================================*/
Xhercopen(dev,flag)
Xint dev;
Xint flag;
X{
X	int i;
X
X	/*--------------------------------------------------------------*/
X	/* map herc graphics pages to virtual memory and set myvaddr	*/
X	/* to page 0							*/
X	/*--------------------------------------------------------------*/
X	if((vaddr0=sptalloc(HERC_SIZE,PG_P, HERC_PAGE_0,0)) == (char *)0 ||
X		(vaddr1=sptalloc(HERC_SIZE,PG_P, HERC_PAGE_1,0)) == (char *)0)
X	{
X		KERROR("hercopen: sptalloc() failed");
X		u.u_error = 1;
X		return;
X	}
X	myvaddr = vaddr0;
X	/*--------------------------------------------------------------*/
X	/* clear both pages of graphics memory				*/
X	/*--------------------------------------------------------------*/
X#ifdef DBUG
X	printf("hercopen: vaddr0: %d, vaddr1: %d, \n", vaddr0, vaddr1);
X#endif
X	/*--------------------------------------------------------------*/
X	/* switch to graphics mode					*/
X	/*--------------------------------------------------------------*/
X	if(g_mode() < 0)
X	{
X		KERROR("hercopen: g_mode() failed");
X		u.u_error = 1;
X		return;
X	}
X	clearscreen(vaddr0);
X	clearscreen(vaddr1);
X	u.u_error = 0;
X	return;
X}
X/*======================================================================*/
X/* hercclose - close the herc device					*/
X/*======================================================================*/
Xhercclose(dev)
Xint dev;
X{
X	clearscreen(vaddr0);
X	clearscreen(vaddr1);
X	/*--------------------------------------------------------------*/
X	/* switch to text mode						*/
X	/*--------------------------------------------------------------*/
X	t_mode();
X	/*--------------------------------------------------------------*/
X	/* free mapped virtual memory					*/
X	/*--------------------------------------------------------------*/
X	sptfree(vaddr0, HERC_SIZE,0);
X	sptfree(vaddr1, HERC_SIZE,0);
X
X#ifdef DBUG
X	printf("hercclose:\n");
X#endif
X	u.u_error = 0;
X	return;
X}
X/*======================================================================*/
X/* hercioctl - does nothing						*/
X/*======================================================================*/
Xhercioctl(dev, cmd, arg)
Xint dev;
Xint cmd;
XHERC *arg;
X{
X
X	u.u_error = 0;
X	return;
X}
Xhercread(dev)
Xint dev;
X{
X}
X/*======================================================================*/
X/* hercwrite - perform all herc graphics operations			*/
X/*======================================================================*/
Xhercwrite(dev)
Xint dev;
X{
X	HERC	*arg;
X	HERC herc;
X	unsigned char *pc;
X	int x;
X	int y;
X	int cmd;
X	int i;
X
X	unsigned char byte;
X	int byteloc;
X	int myint;
X
X	pc = (unsigned char *)(&herc);
X	arg = (&herc);
X	for(i=0; i < sizeof(HERC); i++)
X	{
X		if( (myint = cpass()) < 0)
X		{
X			printf("i= %d\n", i);
X			KERROR("hercwrite: cpass failed");
X			u.u_error = 1;
X			return;
X		}
X		pc[i] = myint;
X	}
X	/************ an alternate, untested way of accomplishing the above
X	if(copyin(&u.u_base, arg, sizeof(HERC)) != SUCCESS)
X	{
X		printf("u.u_count: %d, u.u_base: %d, u.u_offset: %d\n",
X			u.u_count, u.u_base, u.u_offset);
X		printf("sizeof(HERC): %d\n", sizeof(HERC));
X		KERROR("hercwrite: copyin() failed");
X		u.u_error = 1;
X		return;
X	}
X	**********/
X#ifdef DBUG
X	printf("hercwrite: x: %d, y: %d, cmd: %d\n",
X		arg->phys_x, arg->phys_y, arg->cmd);
X#endif
X	/*--------------------------------------------------------------*/
X	/* extract and validate HERC contents				*/
X	/*--------------------------------------------------------------*/
X	if((x=arg->phys_x) > PHYS_X_MAX || x < PHYS_X_MIN
X		|| (y=arg->phys_y) > PHYS_Y_MAX || y < PHYS_Y_MIN)
X	{
X		KERROR("hercwrite: illegal arg");
X			printf("arg: %d, cmd: %d, x: %d, y: %d\n", 
X				arg, arg->cmd, x, y);
X		u.u_error = 1;
X		return;
X	}
X	cmd = arg->cmd;
X	/*--------------------------------------------------------------*/
X	/* compute offset of byte to be acted on			*/
X	/*--------------------------------------------------------------*/
X	if(cmd == SET_PIXEL || cmd == CLEAR_PIXEL || cmd == REVERSE_PIXEL)
X	{
X		byteloc = BYTE_OFFSET(x,y);
X	}	
X	
X	/*--------------------------------------------------------------*/
X	/* perform action						*/
X	/*--------------------------------------------------------------*/
X	switch(cmd)
X	{
X		case SET_PIXEL:	
X				SET_BIT(myvaddr[byteloc], x);
X				break;
X
X		case CLEAR_PIXEL: 
X				CLEAR_BIT(myvaddr[byteloc], x);
X				break;
X
X		case REVERSE_PIXEL: 
X				REVERSE_BIT(myvaddr[byteloc], x);
X				break;
X
X		case CLEAR_SCREEN_0:
X				clearscreen(vaddr0);
X				break;
X
X		case CLEAR_SCREEN_1:
X				clearscreen(vaddr1);
X				break;
X				
X		/* this switch screen does not work, any comments or 	*/
X		/* suggestions are welcome  WEH 2/17/90			*/
X		case SWITCH_SCREEN_0:
X				myvaddr = vaddr0;
X				wait_for_retrace();
X				if(outb(DMC_PORT, DMC_PAGE_0) == FAILURE)
X				{
X					KERROR("hercwrite: outb() failed ");
X					return(FAILURE);
X				}
X				break;
X
X		case SWITCH_SCREEN_1:
X				myvaddr = vaddr1;
X				wait_for_retrace();
X				if(outb(DMC_PORT, DMC_PAGE_1) == FAILURE)
X				{
X					KERROR("hercwrite: outb() failed ");
X					return(FAILURE);
X				}
X				break;
X	}
X	u.u_error = 0;
X	return;
X}
X/*======================================================================*/
X/* clearscreen - turn all pixels off					*/
X/*======================================================================*/
Xstatic int clearscreen(vaddr)
Xchar *vaddr;
X{
X	unsigned int i;
X	for(i = 0; i < HERC_PAGE_BYTES; i++)
X	{
X		vaddr[i] = 0;
X	}
X	return(SUCCESS);
X}
X/*======================================================================*/
X/* g_mode - switch to graphics mode					*/
X/*======================================================================*/
Xstatic int g_mode()
X{
X	int i; 	
X	unsigned char dmcbyte = (DMC_GRAPHICS|DMC_ON_SCREEN|DMC_PAGE_0);
X	/*--------------------------------------------------------------*/
X	/* enable both graphics pages and turn display off		*/
X	/*--------------------------------------------------------------*/
X	wait_for_retrace();
X	if(outb(CONFIG_SWITCH, CF_PAGE_0) == FAILURE ||
X		outb(DMC_PORT, DMC_OFF_SCREEN) == FAILURE)
X	{
X		KERROR("g_mode: outb() to DMC_PORT or CONFIG_SWITCH failed");
X		return(FAILURE);
X	}
X	/*--------------------------------------------------------------*/
X	/* set hardware parameters for graphics mode, failure to do this*/
X	/* may damage the video tube					*/
X	/*--------------------------------------------------------------*/
X	for(i = 0; i < 12; i++)
X	{
X		if(outb(INDEX_REG_6845, i) == FAILURE ||
X			outb(DATA_REG_6845, gdata[i]) == FAILURE)
X		{
X			KERROR("g_mode: outb() to DATA or INDEX REG failed");
X			return(FAILURE);
X		}
X	}
X	/*--------------------------------------------------------------*/
X	/* on retrace, enable graphics and turn display on		*/
X	/*--------------------------------------------------------------*/
X	wait_for_retrace();
X	if(outb(DMC_PORT, dmcbyte) == FAILURE)
X	{
X		KERROR("g_mode: outb(DMC_PORT, DMC_GRAPHICS) failed ");
X		return(FAILURE);
X	}
X	return(SUCCESS);
X}
X/*======================================================================*/
X/* t_mode - switch to text mode						*/
X/*======================================================================*/
Xstatic int t_mode()
X{
X	int i;
X	unsigned char dmcbyte = (DMC_ON_SCREEN|DMC_TEXT);
X	/*--------------------------------------------------------------*/
X	/* turn display off						*/
X	/*--------------------------------------------------------------*/
X	if(outb(DMC_PORT, DMC_OFF_SCREEN) == FAILURE)
X	{
X		KERROR("t_mode: outb to DMC_PORTT) failed ");
X		return(FAILURE);
X		
X	}
X	/*--------------------------------------------------------------*/
X	/* set hardware parameters for text mode			*/
X	/*--------------------------------------------------------------*/
X	for(i = 0; i < 12; i++)		/* set hw sweep rate etc.	*/
X	{
X		if(outb(INDEX_REG_6845, i) == FAILURE ||
X			outb(DATA_REG_6845, tdata[i]) == FAILURE)
X		{
X			KERROR("t_mode: outb() to 6845 failed");
X			return(FAILURE);
X		}
X	}
X	delay(0);
X	/*--------------------------------------------------------------*/
X	/* set text mode, turn display on				*/
X	/*--------------------------------------------------------------*/
X	if(outb(DMC_PORT, dmcbyte) == FAILURE)
X	{
X		KERROR("t_mode: outb(DMC_PORT, dmcbyte) failed");
X		return(FAILURE);
X	}
X	/*--------------------------------------------------------------*/
X	/* enable text mode						*/
X	/*--------------------------------------------------------------*/
X	if(outb(CONFIG_SWITCH, CF_TEXT_ONLY) == FAILURE)
X	{
X		KERROR("t_mode: outb(CONFIG_SWITCH, CF_TEXT_ONLY) failed");
X		return(FAILURE);
X	}
X	return(SUCCESS);
X}
X/*======================================================================*/
X/* wait_for_retrace - loop until vertical retrace			*/
X/*======================================================================*/
Xstatic int wait_for_retrace()
X{
X	unsigned char byte;
X	byte = inb(DS_PORT);
X	while(byte & DS_RETRACE)
X	{
X		delay(0);
X		byte = inb(DS_PORT);
X	}
X}
SHAR_EOF
$TOUCH -am 1013182190 herc/herc.c &&
chmod 0644 herc/herc.c ||
echo "restore of herc/herc.c failed"
set `wc -c herc/herc.c`;Wc_c=$1
if test "$Wc_c" != "10419"; then
	echo original size 10419, current size $Wc_c
fi
echo "End of part 7, continue with part 8"
exit 0




-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is part 08 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= herc/herc.h ==============
echo "x - extracting herc/herc.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/herc.h &&
Xstatic char SCCS_HERCH[] = "%W% %G% %U%";
X/* 
X++++ 
X	herc.h 
X 
X	PURPOSE : Hercules Graphics constants and macros
X
X	AUTHOR  : W. Hatch   
X
X	COMPANY	: Computational Engineering
X		  14504 Greenview Drive Suite 500
X		  Laurel, Maryland 20708
X		  301-470-3839
X		  usrnet: uunet!bts!bill
X
X	DATE	: 2/4/90
X
X	CREDITS : I got useful information from all of the following
X		  sources which I wish to acknowledge and thank.  
X
X		1.) David B. Dotty, "Programmers Guide To The Hercules
X		    Graphics Card", Addison-Wesley, 1988,
X
X		2.) Dan Schechter, "How To Access The Hercules Graphics
X		    Plane", The C Users Journal, August, 1988,
X
X		3.) geb, port (sample Hercules graphics driver)
X		    1988, Reynolds Metals Co., PO Box 1200,
X		    Sheffield, Al. 35660,  (205)-386-9657,
X
X		4.) David T. Lewis, mode.c from gnuplot, 7/13/87,
X
X		5.) Jeffery A. Turner, setmode.c, (Hercules mode set for
X		    Everix), 5/20/87,
X
X		6.) Janet I. Egan and Thomas J. Teixeira, "Writing a Unix
X		    Device Driver", Wiley, 1988,
X
X		7.) "Software Development System Volume I", Microport
X		    V386/3.0e,
X
X		8.) Microport Tech Support System V386 Dos Merge 386
X		    Version 1.1.1U, 12/15/88,
X
X		9.) Microport documentation on Display(7) forwarded
X		    by Bob Courtney, uunet!agc!courtney, August, 1989,
X
X		10.) Cliff Flint, sample Hercules driver code,
X		     uunet!ames!mailrus!umix!clif!clif, April, 1989,
X
X		11.) Machael Gordon and Colon Kelly, hercgraph.asm,
X		     Hercules graphics code for MS-DOS gnuplot,
X		     December, 1986.
X
X---*/ 
X/*
X------------------------------------------------------------------------
X  MODIFICATIONS
XDATE-PROGRAMMER	DESCRIPTION
X------------------------------------------------------------------------
X*/
X#include <sys/types.h>
X#include <sys/dir.h>
X#include <sys/signal.h>
X#include <sys/param.h>
X#include <stdio.h>
X#include <sys/user.h>
X#include <fcntl.h>
X#include <sys/file.h>
X#include <sys/ioctl.h>
X#ifndef IX386
X#include <sys/io_op.h>
X#endif
X/*----------------------------------------------------------------------*/
X/* values returned by driver functions					*/
X/*----------------------------------------------------------------------*/
X#define SUCCESS 0
X#define FAILURE (-1)
X
X/*----------------------------------------------------------------------*/
X/* system constants used by kernel functions				*/
X/*----------------------------------------------------------------------*/
X#define IPC_FLAG	(IPC_CREAT|00666)
X#define PG_P		0x00000001	/* page present bit	*/
X
X/*----------------------------------------------------------------------*/
X/* herc page physical base addresses and sizes in units of 4096 bytes	*/
X/*----------------------------------------------------------------------*/
X#define HERC_TEXT_PAGE	176
X#define	HERC_PAGE_0	176
X#define HERC_PAGE_1	184
X#define	HERC_SIZE	8
X
X/*----------------------------------------------------------------------*/
X/* herc base addresses and sizes in bytes				*/
X/*----------------------------------------------------------------------*/
X#define	HERC_TEXT_BUF	0xB000
X#define HERC_P0_BUF	0xB000
X#define HERC_P1_BUF	0xB800
X
X#define HERC_PAGE_BYTES	32768
X
X/*----------------------------------------------------------------------*/
X/* error message macro							*/
X/*----------------------------------------------------------------------*/
X#define KERROR(a)	printf("ERROR herc: %s\n",a);
X
X/*----------------------------------------------------------------------*/
X/* herc ioctl commands and data structure for ioctl(dev, cmd, arg)	*/
X/*----------------------------------------------------------------------*/
X	/* cmd values */
X#	define	SET_PIXEL	2
X#	define	CLEAR_PIXEL	3
X#	define	REVERSE_PIXEL	4
X#	define	CLEAR_SCREEN_0	5
X#	define	CLEAR_SCREEN_1	6
X#	define	SWITCH_SCREEN_0	7
X#	define	SWITCH_SCREEN_1	8
X
X	/* HERC arg (a data structure) */
X	typedef struct s_hercio {
X		int	cmd;
X		int	phys_x;
X		int	phys_y;
X		} HERC;
X#	define NO_HERC	(HERC *)0
X#	define VALIDHERC(a)	((a) != NO_HERC)
X
X/*----------------------------------------------------------------------*/
X/* ports and byte values to put to ports				*/
X/*----------------------------------------------------------------------*/
X#define CONFIG_SWITCH		0x3bf
X#	define CF_TEXT_ONLY	0	/* default, prevents graphics	*/
X#	define CF_PAGE_0	01	/* enable page 0 only		*/
X#	define CF_PAGE_1	03	/* enable both pages		*/
X
X#define	INDEX_REG_6845		0x3b4	/* 6845 index register		*/
X#define	DATA_REG_6845		0x3b5	/* 6845 data register		*/
X
X#define	DMC_PORT		0x3b8	/* display mode control port	*/
X#	define	DMC_TEXT	00	/* default, text display mode	*/
X#	define	DMC_GRAPHICS	02	/* graphics display mode	*/
X#	define	DMC_OFF_SCREEN	000
X#	define	DMC_ON_SCREEN	010
X#	define	DMC_ON_BLINK	040
X#	define	DMC_OFF_BLINK	000
X#	define	DMC_PAGE_0	000	/* dmc show page 0		*/
X#	define	DMC_PAGE_1	0200	/* dmc show page 1		*/
X
X/* text mode */
X#	define	NORMAL		007
X#	define INTENSITY	010
X#	define	BLANK		000
X#	define UNDERLINE	001
X#	define REVERSE_VIDEO	0160
X#	define BLINK		0200
X
X#define DS_PORT 		0x3ba	/* display status port		*/
X#	define DS_RETRACE	0x80	/* retrace is when bit 7 is 0	*/
X/*----------------------------------------------------------------------*/
X/* graphics memory byte location and bit manipulation			*/
X/*----------------------------------------------------------------------*/
X	/* physical screen dimensions					*/
X	/*--------------------------------------------------------------*/
X#	define	PHYS_X_MIN	0
X#	define	PHYS_X_MAX	719
X#	define  PHYS_Y_MIN	0
X#	define	PHYS_Y_MAX	347
X	/*--------------------------------------------------------------*/
X	/* given x, y coordinates, determine byte offset within screen	*/
X	/* memory							*/
X	/*--------------------------------------------------------------*/
X#	define	BYTE_OFFSET(x,y) (unsigned)(0x2000 * ((y)%4) + \
X			90 * ((y)/4) + (x)/8)
X
X	/*--------------------------------------------------------------*/
X	/* for given x coordinate, generate a byte with the correct 	*/
X	/* bit set							*/
X	/*--------------------------------------------------------------*/
X#	define	X_BIT(x)	(1 << (7-((x)%8)))
X
X	/*--------------------------------------------------------------*/
X	/* set, clear, reverse bit for given x within a given byte	*/
X	/*--------------------------------------------------------------*/
X#	define	SET_BIT(byte,x)	((byte) |= (X_BIT((x))))
X#	define	CLEAR_BIT(byte,x) ((byte) &= (unsigned char)0xff ^ (X_BIT(x)))
X#	define	REVERSE_BIT(byte,x) ((byte) ^= (X_BIT(x) ))
SHAR_EOF
$TOUCH -am 1014123490 herc/herc.h &&
chmod 0644 herc/herc.h ||
echo "restore of herc/herc.h failed"
set `wc -c herc/herc.h`;Wc_c=$1
if test "$Wc_c" != "6396"; then
	echo original size 6396, current size $Wc_c
fi
# ============= herc/test.c ==============
echo "x - extracting herc/test.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/test.c &&
X/*======================================================================*/
X/* test - test features of herc driver					*/
X/* W Hatch 2/17/90							*/
X/*======================================================================*/
X#include <stdio.h>
X#include "herc.h"
X#define delay sleep
X
Xint	hercfd;
Xmain()
X{
X	int i;
X	int j;
X	HERC Herc;
X	char buffer[4];
X	if((hercfd = open("/dev/herc", O_WRONLY)) < 0)
X	{
X		perror("main: open /dev/herc failed");
X		exit(2);
X	}
X	/*--------------------------------------------------------------*/
X	/* test SET_PIXEL with a pattern				*/
X	/*--------------------------------------------------------------*/
X	Herc.cmd = SET_PIXEL;
X	pattern(&Herc);
X	sleep(5);
X	/*--------------------------------------------------------------*/
X	/* test CLEAR_PIXEL by removing test pattern			*/
X	/*--------------------------------------------------------------*/
X	Herc.cmd = CLEAR_PIXEL;
X	pattern(&Herc);
X	sleep(5);
X	/*--------------------------------------------------------------*/
X	/* test REVERSE_PIXEL with same pattern				*/
X	/*--------------------------------------------------------------*/
X	Herc.cmd = REVERSE_PIXEL;
X	pattern(&Herc);
X	sleep(5);
X	pattern(&Herc);
X	sleep(5);
X	close(hercfd);
X	printf("hercfd: %d\n",hercfd);
X	exit(0);
X
X}
Xpattern(Herc)
XHERC *Herc;
X{
X	int i,j;
X	for(j=100; j< 200 ; j++)
X	{
X		for(i=100; i< 110; i++)
X		{
X			Herc->phys_x = j;
X			Herc->phys_y = i;
X			if(write(hercfd, Herc, sizeof(HERC)) < 0)
X			{
X				perror("main: write hercfd failed");
X				exit(2);
X			}
X		}
X		for(i=100; i< 110; i++)
X		{
X			Herc->phys_y = j;
X			Herc->phys_x = i;
X			if(write(hercfd, Herc, sizeof(HERC)) < 0)
X			{
X				perror("main: write hercfd failed");
X				exit(2);
X			}
X		}
X	}
X}
SHAR_EOF
$TOUCH -am 1013182190 herc/test.c &&
chmod 0644 herc/test.c ||
echo "restore of herc/test.c failed"
set `wc -c herc/test.c`;Wc_c=$1
if test "$Wc_c" != "1690"; then
	echo original size 1690, current size $Wc_c
fi
# ============= herc/ix386/n_herc ==============
if test ! -d 'herc/ix386'; then
    echo "x - creating directory herc/ix386"
    mkdir 'herc/ix386'
fi
echo "x - extracting herc/ix386/n_herc (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/ix386/n_herc &&
Xherc	herc	c	0
SHAR_EOF
$TOUCH -am 1014120790 herc/ix386/n_herc &&
chmod 0644 herc/ix386/n_herc ||
echo "restore of herc/ix386/n_herc failed"
set `wc -c herc/ix386/n_herc`;Wc_c=$1
if test "$Wc_c" != "14"; then
	echo original size 14, current size $Wc_c
fi
# ============= herc/ix386/s_herc ==============
echo "x - extracting herc/ix386/s_herc (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/ix386/s_herc &&
Xherc	Y	1	0	0	0	0	0	0	0
SHAR_EOF
$TOUCH -am 1014123690 herc/ix386/s_herc &&
chmod 0644 herc/ix386/s_herc ||
echo "restore of herc/ix386/s_herc failed"
set `wc -c herc/ix386/s_herc`;Wc_c=$1
if test "$Wc_c" != "23"; then
	echo original size 23, current size $Wc_c
fi
# ============= herc/ix386/mdevice ==============
echo "x - extracting herc/ix386/mdevice (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/ix386/mdevice &&
X
Xherc	ocrwi	iHcr	herc	0	15	1	1	-1
X       you have to add the following line to the file /etc/conf/cf.d/mdevice:
X
X       herc	Iocrwi	iHct	herc	0	15	1	16	-1
X
SHAR_EOF
$TOUCH -am 1014121390 herc/ix386/mdevice &&
chmod 0644 herc/ix386/mdevice ||
echo "restore of herc/ix386/mdevice failed"
set `wc -c herc/ix386/mdevice`;Wc_c=$1
if test "$Wc_c" != "156"; then
	echo original size 156, current size $Wc_c
fi
# ============= herc/ix386/README ==============
echo "x - extracting herc/ix386/README (Text)"
sed 's/^X//' << 'SHAR_EOF' > herc/ix386/README &&
Xcopy s_herc to /etc/conf/sdevice.d/herc
Xcopy n_herc to /etc/conf/node.d/herc
Xadd the first line in mdevice to /etc/conf/cf.d/mdevice
Xcompile the source and copy it to /etc/conf/pack.d/herc/Driver.o
Xof course you will have to create the directory first!
SHAR_EOF
$TOUCH -am 1014194190 herc/ix386/README &&
chmod 0644 herc/ix386/README ||
echo "restore of herc/ix386/README failed"
set `wc -c herc/ix386/README`;Wc_c=$1
if test "$Wc_c" != "253"; then
	echo original size 253, current size $Wc_c
fi
# ============= README ==============
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XThis directory tree contains a collection of PD graphic drivers.
XAll of them support the plot(4) definition of ATT, well they support
Xthem more or less. Most of the drivers don't have bit patterns,
Xcircles and arcs built in. So if you have a lot of time here is 
Xsomething to do!!!
XAlso included is a driver programm for plot. So you can now install
Xa runnable driver in /usr/lib add a line to your /usr/bin/tplot script
Xand with sag -Therc  or any suitable name for the new driver you
Xcan plot an activity graph on you screen or printer.
XThe driver program was written by Wietse Venema and changed for
X386 Unix 3.xxx by Bill Hatch, I made minor changes for the
Xprinterdriver.
XSomething like sag -Thplj could also immediately spool the output
Xto lp if the line in /usr/bin/tplot is appropriate.
XRemember most of this is a collection so other people wrote it,
Xtheir names and e-mail/mail adresses can be found in the corresponding
Xdirectories.
XThe REGIS stuff and the adaption of the hpgl converter to a plot
Xlibrary for (hplj,epson,ibm) is my work, also I optimized the
Xhplj output with cursor adressing.
XThe hpgl converter was posted by the Environmental Defense Fund in
X1988, they have the copyright on this source but allowed me 
Xto repost this!
XOk I know it's a terrible hack, but it works.
XAny changes or ideas or other PD plot librarys to hout@hot.mug.
XAny PD applications that use plot (gnuplot/fchart I already 
Xhave) are welcome too.
XAlso I've build a plot interface for the CGI library of SCO.
XIn the tplot entry you should not forget to set the
Xenvironment variables for your outputdevices for the CGI library.
XXenix doesnot have a tplot or sag programm it has no graphics but
Xthe CGI and no system activity reports, as far as I know.
XSCO Unix should have sag, tplot and system activity data 
Xand the CGI library, but I don't have a SCO Unix yet.
XAlso Included is the hercules driver posted to comp.unix.ix386 some
Xweeks ago, originally it was a driver for uPort 386 unix, I added
Xthe files for Interactive 386 V.3.2.0.2 but it should also work
Xon 2.2.
XThe guy who posted it was Bill Hatch, I didnot find any copyrights
Xso I guess its alright if I repost this with my interactive 
Xchanges.
XAlso included is a plot library for sun 3 workstations from 
XSjoerd Mullenders, Sjoerd has the copyright but it's allowed
Xto redistribute this if you leave the copyright message in.
XThen I have 2 other plotlibs for HPGL 7440 and for a DEC LN03 
Xlaserprinter.
XThe HPGL stuff was written by Dave Trueman and Henry Spencer
Xfrom Toronto. 
XThere was no copyright in the sources so I guess it's ok if I
Xrepost this.
XThe ln03 stuff was copyrighted by Nicolas Christopher from
XColumbia University but it didnot say it was allowed to 
Xredistribute this so it's not included.
XAlso I have a hercules driver for uPort V.2.3 which was posted
Xand copyrighted by Microport so this one is not included as well.
XIf the people who have the rights on the uport and ln03 stuff
Xcould mail me I that they would allow me to repost these 
X2 parts. I would post them in a few weeks.
X
X
SHAR_EOF
$TOUCH -am 1026190890 README &&
chmod 0644 README ||
echo "restore of README failed"
set `wc -c README`;Wc_c=$1
if test "$Wc_c" != "3061"; then
	echo original size 3061, current size $Wc_c
fi
# ============= plot.c ==============
echo "x - extracting plot.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > plot.c &&
X/*
X * plot(1) clone. This filter implements the commands described in the 
X * V7 UNIX manual pages, using the gl graphics library routines.
X *
X * Author: Wietse Venema (wietse@wzv.UUCP)
X *
X * Options: -Tdevice, where device is one of:
X *
X *	cga (CGA)	cga adapter, low (high) resolution
X *	herc (HERC)	hercules adapter, page 0 (page 1)
X *	ega		ega adapter
X *	lp		matrix printer 
X *	lj		laserjet printer
X *
X * The output device can also be specified with the GLMODE environment
X * variable. See the gl graphics library documentation for details.
X */
X/* changes to provide compatibility with Microport V386 3.0e
X * W Hatch  uunet!bts!bill
X * 2/18/90
X */
X
X#include <stdio.h>
X/*#include <modes.h>*/
X
Xstatic void     confirm();
X
X/*
X * If the output device is specified on the command line we pass it on to
X * the gl library routines by setting the GLMODE environment variable...
X */
X
Xstruct Modetab {
X    char           *modename;
X    int             modeval;
X};
X
Xstruct Modetab  modetab[] = {
X    "cga",	CGA_COLOR_MODE,		/* cga lo-res */
X    "CGA",	CGA_HI_RES_MODE,	/* cga hi-res */
X    "herc",	HERC_P0_MODE,		/* hercules page 0 */
X    "HERC",	HERC_P1_MODE,		/* hercules page 1 */
X    "ega",	EGA_COLOR_MODE,		/* ega */
X    "lp",	IBM_PRINTER,		/* matrix printer */
X    "lj",	LJ_PRINTER,		/* laserjet printer */
X    0, 0,
X};
X
X/* various shorthands */
X#ifdef V386		/* 16 bit integers output by uport V386 graph(1) */
X#define	READ(x)			fread((char *) &s_x, sizeof(s_x), 1, stdin);\
X					x=s_x
X#else
X#define	READ(x)			fread((char *) &x, sizeof(x), 1, stdin)
X#endif
X#define	READ2(a,b)		READ(a); READ(b)
X#define	READ3(a,b,c)		READ2(a,b); READ(c)
X#define	READ4(a,b,c,d)		READ2(a,b); READ2(c,d);
X#define	READ6(a,b,c,d,e,f)	READ4(a,b,c,d); READ2(e,f);
X
X/* 
X * Process the plotfile. The program terminates with a diagnostic
X * in case of unrecognized data.
X */
X
Xmain(argc, argv)
Xint             argc;
Xchar          **argv;
X{
X    register struct Modetab *mp;
X    register int    c;
X    char            buf[BUFSIZ];
X    int             x, y, x0, y0, x1, y1, x2, y2, r, glmode;
X#ifdef V386
X    short int       s_x, s_y, s_x0, s_y0, s_x1, s_y1, s_x2, s_y2, s_r, s_glmode;
X#endif
X    static char     envstring[] = "GLMODE=xxxxxx";
X
X    /* process command-line arguments */
X
X    while (--argc && *++argv) {
X	if (strncmp(*argv, "-T", 2) == 0) {
X	    for (mp = modetab; mp->modename; mp++) {
X		if (strcmp(*argv + 2, mp->modename) == 0) {
X		    sprintf(envstring, "GLMODE=%d", glmode = mp->modeval);
X		    putenv(envstring);
X		}
X	    }
X	} else {
X	    fprintf(stderr, "bad argument: %s\n", *argv);
X	    exit(1);
X	}
X    }
X
X#ifndef	unix
X    you may have to select binary mode for stdin
X#endif
X
X    /* process the plotfile */
X
X    openpl();
X
X    while ((c = getchar()) != EOF) {
X#ifdef DBUG
X	fprintf(stderr, "c= %c, c(int)= %d\n",c,c);
X	fflush(stderr);
X#endif
X	switch (c) {
X	case 'm':				/* move */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    move(x, y);
X	    break;
X	case 'n':				/* cont */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    cont(x, y);
X	    break;
X	case 'p':				/* point */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    point(x, y);
X	    break;
X	case 'l':				/* line */
X	    READ4(x1, y1, x2, y2);
X#ifdef DBUG
X	    fprintf(stderr, "x1: %d, y1: %d, x2: %d, y2: %d\n", x1, y1,x2,y2);
X	    fflush(stderr);
X#endif
X	    line(x1, y1, x2, y2);
X	    break;
X	case 't':				/* label */
X	    {
X		register char  *p = buf;
X
X		/********
X		while ((c = getchar()) != EOF && c)
X		    *p++ = c;
X		*p = '\0';
X		weh  2/18/90  --- incoming string is newline terminated
X		********/
X		gets(buf);
X		label(buf);
X	    }
X#ifdef DBUG
X	    fprintf(stderr, "label: %s\n", buf);
X	    fflush(stderr);
X#endif
X	    break;
X	case 'a':				/* arc */
X	    READ6(x, y, x0, y0, x1, y1);
X	    arc(x, y, x0, y0, x1, y1);
X	    break;
X	case 'c':				/* circle */
X	    READ3(x, y, r);
X	    circle(x, y, r);
X	    break;
X	case 'e':				/* erase */
X	    if (glmode <= MAXVIDEO)
X		confirm();
X	    erase();
X	    break;
X	case 'f':				/* linemod */
X	    gets(buf);
X	    linemod(buf);
X	    break;
X	case 's':				/* space */
X	    READ4(x0, y0, x1, y1);
X#ifdef DBUG
X	    fprintf(stderr, "x0: %d, y0: %d, x1: %d, y1: %d\n", x0, y0,x1,y1);
X	    fflush(stderr);
X#endif
X	    space(x0, y0, x1, y1);
X	    break;
X				/* corrupt */
X	default:
X	    closepl();
X	    fprintf(stderr,"c= %c, %d corrupted plotfile -- giving up\n",c,c);
X	    fflush(stderr);
X	    exit(1);
X	}; /* end switch */
X    } /* end while */
X
X    if (glmode <= MAXVIDEO)
X	confirm();
X    closepl();
X    exit(0);
X    /* NOTREACHED */
X}
X
X/* give them a chance before erase() or closepl() clobber the screen */
X
Xstatic void     confirm()
X{
X    FILE           *fp;
X    int             c;
X
X    if (fp = fopen("/dev/tty", "r")) {
X	while ((c = getc(fp)) != EOF && c != '\n');
X	fclose(fp);
X    }
X}
SHAR_EOF
$TOUCH -am 1014123990 plot.c &&
chmod 0644 plot.c ||
echo "restore of plot.c failed"
set `wc -c plot.c`;Wc_c=$1
if test "$Wc_c" != "4963"; then
	echo original size 4963, current size $Wc_c
fi
# ============= lpdriver.c ==============
echo "x - extracting lpdriver.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > lpdriver.c &&
X/*
X * plot(1) clone. This filter implements the commands described in the 
X * V7 UNIX manual pages, using the gl graphics library routines.
X *
X * Author: Wietse Venema (wietse@wzv.UUCP)
X *
X * Options: -Tdevice, where device is one of:
X *
X *	cga (CGA)	cga adapter, low (high) resolution
X *	herc (HERC)	hercules adapter, page 0 (page 1)
X *	ega		ega adapter
X *	lp		matrix printer 
X *	lj		laserjet printer
X *
X * The output device can also be specified with the GLMODE environment
X * variable. See the gl graphics library documentation for details.
X */
X/* changes to provide compatibility with Microport V386 3.0e
X * W Hatch  uunet!bts!bill
X * 2/18/90
X */
X/*
Xchanges to get it running on interactive 386
XR.P. van Hout uunet!mcsun!hp4nl!integow!hot!hot
X*/
X
X
X#include "plotlpus.h"
X#include <stdio.h>
X/*#include <modes.h>*/
X
Xstatic void     confirm();
X
X/*
X * If the output device is specified on the command line we pass it on to
X * the gl library routines by setting the GLMODE environment variable...
X */
Xfloat deltx = 4095.0;
Xfloat delty = 4095.0;
X
Xstruct Modetab {
X    char           *modename;
X    int             modeval;
X};
X
Xstruct Modetab  modetab[] = {
X#ifdef bla
X    "cga",	CGA_COLOR_MODE,		/* cga lo-res */
X    "CGA",	CGA_HI_RES_MODE,	/* cga hi-res */
X    "herc",	HERC_P0_MODE,		/* hercules page 0 */
X    "HERC",	HERC_P1_MODE,		/* hercules page 1 */
X    "ega",	EGA_COLOR_MODE,		/* ega */
X    "lp",	IBM_PRINTER,		/* matrix printer */
X    "lj",	LJ_PRINTER,		/* laserjet printer */
X#endif
X    0, 0,
X};
X
X/* various shorthands */
X#ifdef V386		/* 16 bit integers output by uport V386 graph(1) */
X#define	READ(x)			fread((char *) &s_x, sizeof(s_x), 1, stdin);\
X					x=s_x
X#else
X#define	READ(x)			fread((char *) &x, sizeof(x), 1, stdin)
X#endif
X#define	READ2(a,b)		READ(a); READ(b)
X#define	READ3(a,b,c)		READ2(a,b); READ(c)
X#define	READ4(a,b,c,d)		READ2(a,b); READ2(c,d);
X#define	READ6(a,b,c,d,e,f)	READ4(a,b,c,d); READ2(e,f);
X
X/* 
X * Process the plotfile. The program terminates with a diagnostic
X * in case of unrecognized data.
X */
X
Xmain(argc, argv)
Xint             argc;
Xchar          **argv;
X{
X    register struct Modetab *mp;
X    register int    c;
X    char            buf[BUFSIZ];
X    int             x, y, x0, y0, x1, y1, x2, y2, r, glmode;
X#ifdef V386
X    short int       s_x, s_y, s_x0, s_y0, s_x1, s_y1, s_x2, s_y2, s_r, s_glmode;
X#endif
X    static char     envstring[] = "GLMODE=xxxxxx";
X    int noconfirm;
X	noconfirm = 0;
X    /* process command-line arguments */
X
X	while(argc-- > 1) {
X		if(*argv[1] == '-')
X			switch(argv[1][1]) {
X				case 'l':
X					deltx = atoi(&argv[1][2]) - 1;
X					break;
X				case 'w':
X					delty = atoi(&argv[1][2]) - 1;
X					break;
X				case 's':
X					printer=LASERLOW;
X					break;
X				case 'm':
X					printer=LASERMED;
X					break;
X				case 'h':
X					printer=LASERHIGH;
X					break;
X				case 'i':
X					printer=IBM_PRO;
X					break;
X				case 'e':
X					printer=EPSON;
X					break;
X				}
X
X		argv++;
X		}
X
X#ifndef	unix
X    you may have to select binary mode for stdin
X#endif
X
X    /* process the plotfile */
X
X    openpl();
X
X    while ((c = getchar()) != EOF) {
X#ifdef DBUG
X	fprintf(stderr, "c= %c, c(int)= %d\n",c,c);
X	fflush(stderr);
X#endif
X	switch (c) {
X	case 'm':				/* move */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    move(x, y);
X	    break;
X	case 'n':				/* cont */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    cont(x, y);
X	    break;
X	case 'p':				/* point */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    point(x, y);
X	    break;
X	case 'l':				/* line */
X	    READ4(x1, y1, x2, y2);
X#ifdef DBUG
X	    fprintf(stderr, "x1: %d, y1: %d, x2: %d, y2: %d\n", x1, y1,x2,y2);
X	    fflush(stderr);
X#endif
X	    line(x1, y1, x2, y2);
X	    break;
X	case 't':				/* label */
X	    {
X		register char  *p = buf;
X
X		/********
X		while ((c = getchar()) != EOF && c)
X		    *p++ = c;
X		*p = '\0';
X		weh  2/18/90  --- incoming string is newline terminated
X		********/
X		gets(buf);
X		label(buf);
X	    }
X#ifdef DBUG
X	    fprintf(stderr, "label: %s\n", buf);
X	    fflush(stderr);
X#endif
X	    break;
X	case 'a':				/* arc */
X	    READ6(x, y, x0, y0, x1, y1);
X	    arc(x, y, x0, y0, x1, y1);
X	    break;
X	case 'c':				/* circle */
X	    READ3(x, y, r);
X	    circle(x, y, r);
X	    break;
X	case 'e':				/* erase */
X/*	    if (glmode <= MAXVIDEO)*/
X		if (!noconfirm) confirm();
X	    erase();
X	    break;
X	case 'f':				/* linemod */
X	    gets(buf);
X	    linemod(buf);
X	    break;
X	case 's':				/* space */
X	    READ4(x0, y0, x1, y1);
X#ifdef DBUG
X	    fprintf(stderr, "x0: %d, y0: %d, x1: %d, y1: %d\n", x0, y0,x1,y1);
X	    fflush(stderr);
X#endif
X	    space(x0, y0, x1, y1);
X	    break;
X				/* corrupt */
X	default:
X	    closepl();
X	    fprintf(stderr,"c= %c, %d corrupted plotfile -- giving up\n",c,c);
X	    fflush(stderr);
X	    exit(1);
X	}; /* end switch */
X    } /* end while */
X
X/*    if (glmode <= MAXVIDEO)*/
X	if (!noconfirm) confirm();
X	else sleep(5);
X    closepl();
X    exit(0);
X    /* NOTREACHED */
X}
X
X/* give them a chance before erase() or closepl() clobber the screen */
X
Xstatic void     confirm()
X{
X    FILE           *fp;
X    int             c;
X
X    if (fp = fopen("/dev/tty", "r")) {
X	while ((c = getc(fp)) != EOF && c != '\n');
X	fclose(fp);
X    }
X}
SHAR_EOF
$TOUCH -am 1014221490 lpdriver.c &&
chmod 0644 lpdriver.c ||
echo "restore of lpdriver.c failed"
set `wc -c lpdriver.c`;Wc_c=$1
if test "$Wc_c" != "5349"; then
	echo original size 5349, current size $Wc_c
fi
# ============= makefile ==============
echo "x - extracting makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > makefile &&
XCFLAGS=-O -DV386
XCC=gcc
X
Xall: therc tplotlp tReGIS thpgl tsun tCGI
X
Xtherc:
X	$(CC) $(CFLAGS) driver.c -o therc -lherc -lm
X
Xtplotlp:
X	$(CC) $(CFLAGS) lpdriver.c -o tplotlp -lplotlp -lm
X
XtReGIS:
X	$(CC) $(CFLAGS) driver.c -o tReGIS -lReGIS -lm
X
XtCGI:
X	$(CC) $(CFLAGS) driver.c -o tCGI -lcgi -lm
X
Xthpgl:
X	$(CC) $(CFLAGS) driver.c -o thpgl -lhpgl -lm
X
Xtsun:
X	$(CC) $(CFLAGS) driver.c -o tsun -lsun -lm
X
Xinstall: therc tplotlp tReGIS tln03 tCGI thpgl tsun
X	cp therc /usr/lib
X	cp tplotlp /usr/lib
X	cp tReGIS /usr/lib
X	cp tln03 /usr/lib
X	cp tCGI /usr/lib
X	cp thpgl /usr/lib
X	cp tsun /usr/lib
X
SHAR_EOF
$TOUCH -am 1026194490 makefile &&
chmod 0644 makefile ||
echo "restore of makefile failed"
set `wc -c makefile`;Wc_c=$1
if test "$Wc_c" != "584"; then
	echo original size 584, current size $Wc_c
fi
echo "End of part 8, continue with part 9"
exit 0



-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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

hot@integow.uucp (Roland van Hout) (10/28/90)

#!/bin/sh
# This is part 09 of a multipart archive
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= tplot.sh ==============
echo "x - extracting tplot.sh (Text)"
sed 's/^X//' << 'SHAR_EOF' > tplot.sh &&
X#Add these lines to your tplot script in /usr/bin if you've
X#installed /usr/lib/therc and the other drivers
X
Xcase $1 in
X-T*)	t=$1
X	shift ;;
X*)	t=-T$TERM
Xesac
Xcase $t in
X-T450)	exec /usr/lib/t450 $*;;			#standard AT&T no PD
X-T300)	exec /usr/lib/t300 $*;;			#standard AT&T no PD
X-T300S|-T300s)	exec /usr/lib/t300s $*;;	#standard AT&T no PD
X-Tver)	exec /usr/lib/vplot $*;;		#standard AT&T no PD
X-Ttek|-T4014)	exec /usr/lib/t4014 $* ;;	#standard AT&T no PD
X-TReGIS|-Tvt330|-Tvt240|-Tvt340)	exec /usr/lib/tReGIS $* ;;
X-Thpgl | -Thp74* | -Thp75*) exec /usr/lib/tplothpgl $*  ;; # | lp to plot
X-Tlp | -Tplotlp | -Tlaser ) exec /usr/lib/tplotlp -h $* | lp -dlaser ;; # laser big picture
X		# -m and -l give a medium and small size output
X-Tepson) exec /usr/lib/tplotlp -e $* | lp -depson ;; # epson picture
X-Tibm) exec /usr/lib/tplotlp -i $* | lp -dibm ;; # ibm picture
X-Therc)	exec /usr/lib/therc $* ;;
X-TCGI|-Tconsole|-Tansi)	CGIPATH=/usr/lib/cgi;export CGIPATH
X			CGIDISP=vgabw;export CGIDISP;
X			/usr/lib/tCGI $* 
X			read a </dev/tty
X			;;
X-Ttplot)	exec /bin/cat $* ;;
X*)  echo terminal type not known 1>&2; exit 1
Xesac
SHAR_EOF
$TOUCH -am 1026185890 tplot.sh &&
chmod 0644 tplot.sh ||
echo "restore of tplot.sh failed"
set `wc -c tplot.sh`;Wc_c=$1
if test "$Wc_c" != "1115"; then
	echo original size 1115, current size $Wc_c
fi
# ============= plotlpus.h ==============
echo "x - extracting plotlpus.h (Text)"
sed 's/^X//' << 'SHAR_EOF' > plotlpus.h &&
X/* 
X	include  file to use the epson,ibm-proprinter and the laserjet
X	with the plot(4) graphic library
X	the switch is done via a variable printer this one must be defined
X	in your main program
X	these variables must be defined in the main-part of your programm
X    extern int no_fill;
X    int     to_printer; EPSON || IBM_PRO || LASERLOW || LASERMED || LASERHIGH
X
X*/
X/*
X * const.h
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#define TRUE 1
X#define FALSE 0
X
X/* Printer model: values of global var 'printer' */
X#define EPSON    1		/* Epson LQ 1500 */
X#define LASERLOW 2		/* HP LaserJet Plus low sized 5" x 6" */
X#define IBM_PRO  3		/* IBM Proprinter */
X#define LASERMED 4		/* HP LaserJet Plus med sized 8" x 6" */
X#define LASERHIGH 5		/* HP LaserJet Plus extra large 8" x 11"*/
X
X	int offx,offy;
X	int to_printer=TRUE;
X	int printer=LASERLOW;
X	float gxscrunch,gyscrunch;
X
X
SHAR_EOF
$TOUCH -am 1014215790 plotlpus.h &&
chmod 0644 plotlpus.h ||
echo "restore of plotlpus.h failed"
set `wc -c plotlpus.h`;Wc_c=$1
if test "$Wc_c" != "885"; then
	echo original size 885, current size $Wc_c
fi
# ============= driver.c ==============
echo "x - extracting driver.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > driver.c &&
X/*
X * plot(1) clone. This filter implements the commands described in the 
X * V7 UNIX manual pages, using the gl graphics library routines.
X *
X * Author: Wietse Venema (wietse@wzv.UUCP)
X *
X * Options: -Tdevice, where device is one of:
X *
X *	cga (CGA)	cga adapter, low (high) resolution
X *	herc (HERC)	hercules adapter, page 0 (page 1)
X *	ega		ega adapter
X *	lp		matrix printer 
X *	lj		laserjet printer
X *
X * The output device can also be specified with the GLMODE environment
X * variable. See the gl graphics library documentation for details.
X */
X/* changes to provide compatibility with Microport V386 3.0e
X * W Hatch  uunet!bts!bill
X * 2/18/90
X */
X/*
Xchanges to get it running on interactive 386
XR.P. van Hout uunet!mcsun!hp4nl!integow!hot!hot
X*/
X
X#include <stdio.h>
X/*#include <modes.h>*/
X
Xstatic void     confirm();
X
X/*
X * If the output device is specified on the command line we pass it on to
X * the gl library routines by setting the GLMODE environment variable...
X */
X
Xfloat deltx = 4095.0;
Xfloat delty = 4095.0;
X
Xstruct Modetab {
X    char           *modename;
X    int             modeval;
X};
X
Xstruct Modetab  modetab[] = {
X#ifdef bla
X    "cga",	CGA_COLOR_MODE,		/* cga lo-res */
X    "CGA",	CGA_HI_RES_MODE,	/* cga hi-res */
X    "herc",	HERC_P0_MODE,		/* hercules page 0 */
X    "HERC",	HERC_P1_MODE,		/* hercules page 1 */
X    "ega",	EGA_COLOR_MODE,		/* ega */
X    "lp",	IBM_PRINTER,		/* matrix printer */
X    "lj",	LJ_PRINTER,		/* laserjet printer */
X#endif
X    0, 0,
X};
X
X/* various shorthands */
X#ifdef V386		/* 16 bit integers output by uport V386 graph(1) */
X#define	READ(x)			fread((char *) &s_x, sizeof(s_x), 1, stdin);\
X					x=s_x
X#else
X#define	READ(x)			fread((char *) &x, sizeof(x), 1, stdin)
X#endif
X#define	READ2(a,b)		READ(a); READ(b)
X#define	READ3(a,b,c)		READ2(a,b); READ(c)
X#define	READ4(a,b,c,d)		READ2(a,b); READ2(c,d);
X#define	READ6(a,b,c,d,e,f)	READ4(a,b,c,d); READ2(e,f);
X
X/* 
X * Process the plotfile. The program terminates with a diagnostic
X * in case of unrecognized data.
X */
X
Xmain(argc, argv)
Xint             argc;
Xchar          **argv;
X{
X    register struct Modetab *mp;
X    register int    c;
X    char            buf[BUFSIZ];
X    int             x, y, x0, y0, x1, y1, x2, y2, r, glmode;
X#ifdef V386
X    short int       s_x, s_y, s_x0, s_y0, s_x1, s_y1, s_x2, s_y2, s_r, s_glmode;
X#endif
X    static char     envstring[] = "GLMODE=xxxxxx";
X    int noconfirm;
X	noconfirm = 0;
X    /* process command-line arguments */
X
X    while (--argc && *++argv) {
X#ifdef bla
X	if (strncmp(*argv, "-T", 2) == 0) {
X	    for (mp = modetab; mp->modename; mp++) {
X		if (strcmp(*argv + 2, mp->modename) == 0) {
X		    sprintf(envstring, "GLMODE=%d", glmode = mp->modeval);
X		    putenv(envstring);
X		}
X	    }
X	} else {
X	    fprintf(stderr, "bad argument: %s\n", *argv);
X	    exit(1);
X	}
X#endif
X	if (strncmp(*argv, "-K", 2) == 0) noconfirm = 1;
X    }
X
X#ifndef	unix
X    you may have to select binary mode for stdin
X#endif
X
X    /* process the plotfile */
X
X    openpl();
X
X    while ((c = getchar()) != EOF) {
X#ifdef DBUG
X	fprintf(stderr, "c= %c, c(int)= %d\n",c,c);
X	fflush(stderr);
X#endif
X	switch (c) {
X	case 'm':				/* move */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    move(x, y);
X	    break;
X	case 'n':				/* cont */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    cont(x, y);
X	    break;
X	case 'p':				/* point */
X	    READ2(x, y);
X#ifdef DBUG
X	    fprintf(stderr, "x: %d, y: %d\n", x, y);
X	    fflush(stderr);
X#endif
X	    point(x, y);
X	    break;
X	case 'l':				/* line */
X	    READ4(x1, y1, x2, y2);
X#ifdef DBUG
X	    fprintf(stderr, "x1: %d, y1: %d, x2: %d, y2: %d\n", x1, y1,x2,y2);
X	    fflush(stderr);
X#endif
X	    line(x1, y1, x2, y2);
X	    break;
X	case 't':				/* label */
X	    {
X		register char  *p = buf;
X
X		/********
X		while ((c = getchar()) != EOF && c)
X		    *p++ = c;
X		*p = '\0';
X		weh  2/18/90  --- incoming string is newline terminated
X		********/
X		gets(buf);
X		label(buf);
X	    }
X#ifdef DBUG
X	    fprintf(stderr, "label: %s\n", buf);
X	    fflush(stderr);
X#endif
X	    break;
X	case 'a':				/* arc */
X	    READ6(x, y, x0, y0, x1, y1);
X	    arc(x, y, x0, y0, x1, y1);
X	    break;
X	case 'c':				/* circle */
X	    READ3(x, y, r);
X	    circle(x, y, r);
X	    break;
X	case 'e':				/* erase */
X/*	    if (glmode <= MAXVIDEO)*/
X		if (!noconfirm) confirm();
X	    erase();
X	    break;
X	case 'f':				/* linemod */
X	    gets(buf);
X	    linemod(buf);
X	    break;
X	case 's':				/* space */
X	    READ4(x0, y0, x1, y1);
X#ifdef DBUG
X	    fprintf(stderr, "x0: %d, y0: %d, x1: %d, y1: %d\n", x0, y0,x1,y1);
X	    fflush(stderr);
X#endif
X	    space(x0, y0, x1, y1);
X	    break;
X				/* corrupt */
X	default:
X	    closepl();
X	    fprintf(stderr,"c= %c, %d corrupted plotfile -- giving up\n",c,c);
X	    fflush(stderr);
X	    exit(1);
X	}; /* end switch */
X    } /* end while */
X
X/*    if (glmode <= MAXVIDEO)*/
X	if (!noconfirm) confirm();
X	else sleep(5);
X    closepl();
X    exit(0);
X    /* NOTREACHED */
X}
X
X/* give them a chance before erase() or closepl() clobber the screen */
X
Xstatic void     confirm()
X{
X    FILE           *fp;
X    int             c;
X
X    if (fp = fopen("/dev/tty", "r")) {
X	while ((c = getc(fp)) != EOF && c != '\n');
X	fclose(fp);
X    }
X}
SHAR_EOF
$TOUCH -am 1026194490 driver.c &&
chmod 0644 driver.c ||
echo "restore of driver.c failed"
set `wc -c driver.c`;Wc_c=$1
if test "$Wc_c" != "5283"; then
	echo original size 5283, current size $Wc_c
fi
exit 0


-- 
UUCP: ..!uunet!mcsun!hp4nl!integow!hot	or  hot@integow.UUCP or hot@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