[comp.sources.misc] v03i089: HPGL to LaserJet translator, part 1 of 3

edf@ROCKEFELLER.ARPA (David MacKenzie) (07/16/88)

Posting-number: Volume 3, Issue 89
Submitted-by: "David MacKenzie" <edf@ROCKEFELLER.ARPA>
Archive-name: hpglplot/Part1

Brandon-

You were right, our active file has a 'y' instead of an 'm' for
comp.sources.misc.  I mailed a note to root asking someone to fix it.
Until then...

I read in a posting of yours somewhere that news for the group gets
mailed to ncoast!sources-misc, so I'm mailing this manually.

You'll note that the README contains a gentle request for money.  I
don't like the idea, but our head programmer insisted.  If that's
unacceptable, let me know, and I'll bring it up with him again.  Things
are so different in the PC world - half the stuff you find on BBS's
seems to be shareware, particularly substantial programs like this.
And we *are* a poor nonprofit organization working to save the world
(see the recent Newsweek :-)

David MacKenzie
Environmental Defense Fund

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 3)."
# Contents:  MANIFEST Makefile README const.h dbgvars.h do_ci.c do_cs.c
#   do_df.c do_ep.c do_ew.c do_ex.c do_ft.c do_ip.c do_iw.c do_lb.c
#   do_lt.c do_pg.c do_pt.c do_px.c do_rx.c do_si.c do_sl.c do_sm.c
#   do_sp.c do_wg.c fillcnst.h filltype.c fillvars.h hpgl.doc maps.c
#   mid_ref.c misc.c plot_cha.c set_dbgs.c vars.h
# Wrapped by dave@zedfdc  on Fri Jul  8 20:50:35 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(1509 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X MANIFEST                   1	This shipping list
X Makefile                   1	
X README                     1	
X charset.0                  3	
X const.h                    1	
X dbgvars.h                  1	
X do_ci.c                    1	
X do_cs.c                    1	
X do_df.c                    1	
X do_ep.c                    1	
X do_ew.c                    1	
X do_ex.c                    1	
X do_ft.c                    1	
X do_ip.c                    1	
X do_iw.c                    1	
X do_lb.c                    1	
X do_lt.c                    1	
X do_pg.c                    1	
X do_pt.c                    1	
X do_px.c                    1	
X do_rx.c                    1	
X do_si.c                    1	
X do_sl.c                    1	
X do_sm.c                    1	
X do_sp.c                    1	
X do_wg.c                    1	
X end_ref.c                  2	
X ep_map.c                   2	
X fillcnst.h                 1	
X filltype.c                 1	
X fillvars.h                 1	
X hatch.c                    3	
X hpgl.doc                   1	
X hpglfix.c                  2	
X hpglplot.doc               2	
X ib_map.c                   2	
X lj_map.c                   2	
X main.c                     3	
X maps.c                     1	
X mid_ref.c                  1	
X misc.c                     1	
X plot_cha.c                 1	
X set_dbgs.c                 1	
X step.c                     2	
X vars.h                     1	
END_OF_FILE
if test 1509 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(2707 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
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)
XCFLAGS=-O -DCHARSET=\"/usr/lib/charset.0\" -DTRUESOLID -DTTY=\"/dev/tty\"
XLIBS=-lm
X
XDOCS= README hpglplot.doc hpgl.doc Makefile charset.0
X
XSRCS= \
Xdo_ci.c do_cs.c do_df.c do_ep.c do_ew.c \
Xdo_ex.c do_ft.c do_ip.c do_iw.c do_lb.c \
Xdo_lt.c do_pg.c do_pt.c do_px.c do_rx.c \
Xdo_si.c do_sl.c do_sm.c do_sp.c do_wg.c \
Xend_ref.c ep_map.c filltype.c hatch.c \
Xib_map.c lj_map.c main.c maps.c \
Xmid_ref.c misc.c plot_cha.c set_dbgs.c \
Xstep.c
X
XOBJS= \
Xdo_ci.o do_cs.o do_df.o do_ep.o do_ew.o \
Xdo_ex.o do_ft.o do_ip.o do_iw.o do_lb.o \
Xdo_lt.o do_pg.o do_pt.o do_px.o do_rx.o \
Xdo_si.o do_sl.o do_sm.o do_sp.o do_wg.o \
Xend_ref.o ep_map.o filltype.o hatch.o \
Xib_map.o lj_map.o main.o maps.o \
Xmid_ref.o misc.o plot_cha.o set_dbgs.o \
Xstep.o
X
XHDRS= \
Xconst.h dbgvars.h fillcnst.h fillvars.h vars.h
X
Xhpglplot:	$(OBJS)
X	$(CC) $(OBJS) $(LIBS) -o hpglplot
X	strip hpglplot
X
Xlint:	$(SRCS)
X	lint $(SRCS) > lint.out
X
Xshar:	hpglplot.shar
X
Xhpglplot.shar:	$(DOCS) $(SRCS) $(HDRS) hpglfix.c
X	shar $(DOCS) $(SRCS) $(HDRS) hpglfix.c > hpglplot.shar
X
X# Break it down into several sharchives.
Xkit:	$(DOCS) $(SRCS) $(HDRS) hpglfix.c
X	makekit -nHPGLPLOT. -oMANIFEST $(DOCS) $(SRCS) $(HDRS) hpglfix.c
X	touch kit
X
Xclean:
X	rm -f $(OBJS) hpglplot
X
Xdo_ci.c: const.h vars.h dbgvars.h
Xdo_cs.c: const.h vars.h
Xdo_df.c: const.h
Xdo_ep.c: const.h vars.h dbgvars.h
Xdo_ew.c: const.h vars.h dbgvars.h
Xdo_ex.c: const.h vars.h dbgvars.h
Xdo_ft.c: const.h vars.h
Xdo_ip.c: const.h vars.h
Xdo_iw.c: const.h vars.h
Xdo_lb.c: const.h vars.h dbgvars.h
Xdo_lt.c: const.h vars.h
Xdo_pg.c: const.h vars.h dbgvars.h
Xdo_pt.c: const.h vars.h
Xdo_px.c: const.h vars.h dbgvars.h
Xdo_rx.c: const.h vars.h dbgvars.h
Xdo_si.c: const.h vars.h
Xdo_sl.c: const.h vars.h
Xdo_sm.c: const.h vars.h
Xdo_sp.c: fillvars.h
Xdo_wg.c: const.h vars.h dbgvars.h
Xend_ref.c: const.h vars.h fillcnst.h fillvars.h dbgvars.h
Xep_map.c: const.h fillcnst.h dbgvars.h
Xfilltype.c: const.h vars.h fillcnst.h fillvars.h dbgvars.h
Xhatch.c: const.h vars.h fillcnst.h dbgvars.h
Xib_map.c: const.h fillcnst.h dbgvars.h
Xlj_map.c: const.h fillcnst.h
Xmain.c: const.h vars.h dbgvars.h
Xmaps.c: const.h vars.h
Xmid_ref.c: const.h vars.h fillcnst.h fillvars.h dbgvars.h
Xmisc.c: const.h vars.h
Xplot_cha.c: const.h vars.h dbgvars.h
Xstep.c: const.h vars.h fillcnst.h fillvars.h dbgvars.h
X
X# Add missing default rule for UNOS.
X.SUFFIXES:	.o
X.c.o:
X	$(CC) $(CFLAGS) -c $<
END_OF_FILE
if test 2707 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1519 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
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
END_OF_FILE
if test 1519 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'const.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'const.h'\"
else
echo shar: Extracting \"'const.h'\" \(781 characters\)
sed "s/^X//" >'const.h' <<'END_OF_FILE'
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 LASER    2		/* HP LaserJet Plus */
X#define IBM_PRO  3		/* IBM Proprinter */
END_OF_FILE
if test 781 -ne `wc -c <'const.h'`; then
    echo shar: \"'const.h'\" unpacked with wrong size!
fi
# end of 'const.h'
fi
if test -f 'dbgvars.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dbgvars.h'\"
else
echo shar: Extracting \"'dbgvars.h'\" \(346 characters\)
sed "s/^X//" >'dbgvars.h' <<'END_OF_FILE'
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;
END_OF_FILE
if test 346 -ne `wc -c <'dbgvars.h'`; then
    echo shar: \"'dbgvars.h'\" unpacked with wrong size!
fi
# end of 'dbgvars.h'
fi
if test -f 'do_ci.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_ci.c'\"
else
echo shar: Extracting \"'do_ci.c'\" \(1527 characters\)
sed "s/^X//" >'do_ci.c' <<'END_OF_FILE'
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 "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_CI()
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    if (scanf("%f", &radius) != 1) {
X	fprintf(stderr, "Bad format for circle.\n");
X	exit(4);
X    }
X    if ((c = getchar()) != ';') {
X	scanf("%d", &chordangle);
X	getchar();		/* swallow terminating ';' */
X    } else {
X	chordangle = chord_angle;
X    }
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    t.x = t0.x = i_radius + current.x;
X    t.y = t0.y = current.y;
X
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}
END_OF_FILE
if test 1527 -ne `wc -c <'do_ci.c'`; then
    echo shar: \"'do_ci.c'\" unpacked with wrong size!
fi
# end of 'do_ci.c'
fi
if test -f 'do_cs.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_cs.c'\"
else
echo shar: Extracting \"'do_cs.c'\" \(831 characters\)
sed "s/^X//" >'do_cs.c' <<'END_OF_FILE'
X/*
X * do_cs.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
Xdo_CS()
X{
X    FILE   *charset;
X    int     i,
X            j;
X    char    num[8],
X            name[12];
X    short int old_set;
X
X    strcpy(name, "charset.");
X    old_set = stand_char_set;
X
X    if ((c = getchar()) == ';')
X	stand_char_set = 0;
X    else {
X	i = 0;
X	do
X	    num[i++] = c;
X	while ((c == getchar()) != ';');
X	num[i] = '\0';
X	sscanf(num, "%hd;", &stand_char_set);
X    }
X
X    if (old_set != stand_char_set) {
X	strcat(name, num);
X	if ((charset = fopen(name, "r")) == NULL) {
X	    perror(name);
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	    }
X	    fscanf(charset, " /* %c */\n", &c);
X	}
X    }
X}
END_OF_FILE
if test 831 -ne `wc -c <'do_cs.c'`; then
    echo shar: \"'do_cs.c'\" unpacked with wrong size!
fi
# end of 'do_cs.c'
fi
if test -f 'do_df.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_df.c'\"
else
echo shar: Extracting \"'do_df.c'\" \(1694 characters\)
sed "s/^X//" >'do_df.c' <<'END_OF_FILE'
X/*
X * do_df.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "const.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,
X        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
Xdo_DF()
X{
X    FILE   *charset;
X    int     i,
X            j;
X
X    plot_abs = FALSE;
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
X    c = getchar();		/* Get rid of the ";" */
X}
END_OF_FILE
if test 1694 -ne `wc -c <'do_df.c'`; then
    echo shar: \"'do_df.c'\" unpacked with wrong size!
fi
# end of 'do_df.c'
fi
if test -f 'do_ep.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_ep.c'\"
else
echo shar: Extracting \"'do_ep.c'\" \(1851 characters\)
sed "s/^X//" >'do_ep.c' <<'END_OF_FILE'
X/*
X * do_ep.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * edge a polygon
X * read points[] from hpgl file
X * call put_seg() from vertex to vertex, and back to the start
X *
X * The EP instruction -- non-standard, edge polygon  (plot polygon perimeter)
X *    EPX1,Y1, X2,Y2, ... Xn,Yn;
X * 
X * X1,Y1 ... Xn,Yn are the n vertices of an n-sided polygon.  Spaces between 
X * pairs of coordinates are optional, for readability. 
X *         
X * The coordinates listed are relative to the current point.  The current point 
X * is the last point listed in the most recent PA or PR instruction.  Absolute 
X * coordinates may be used in the EP instruction, if it is preceded by the 
X * instruction PA0,0;, which establishes 0,0 as the current point.  See the 
X * instruction manual for details on the current point, and absolute / relative 
X * coordinates. 
X */
X
X#include <stdio.h>
X#include "const.h"
X#include "vars.h"
X#ifdef TESTVER
X#  include "dbgvars.h"
X#endif
X
Xdo_EP()
X{
X    POINT   P[100];
X    int     num_pts = 0;
X    int     n;
X
X#ifdef TESTVER
X    int     xwas_on;		/* for debugging */
X
X    /* turn debug2x off, if necessary, for the duration of do_EP() */
X    if (debug2x) {
X	xwas_on = TRUE;
X	debug2x = FALSE;
X    } else {
X	xwas_on = FALSE;
X    }
X#endif
X
X    do {
X	if (scanf("%d,%d", &(P[num_pts].x), &(P[num_pts].y)) != 2) {
X	     /* <<<<<<< */ ;
X	}
X	P[num_pts].x += current.x;
X	P[num_pts].y += current.y;
X	num_pts++;
X    } while ((c = getchar()) != ';');
X
X    P[num_pts] = P[0];
X    num_pts++;
X
X#ifdef TESTVER
X    if (debug8) {
X	for (n = 0; n < num_pts; n++) {
X	    fprintf(errfp, "p[%d] ( %d, %d );  ", n, P[n].x, P[n].y);
X	}
X	putc('\n', errfp);
X    }
X#endif
X
X    for (n = 0; n < num_pts - 1; n++) {
X	put_seg(P[n], P[n + 1]);
X    }
X
X#ifdef TESTVER			/* reset debug2x if necessary */
X    if (xwas_on) {
X	debug2x = TRUE;
X    }
X#endif
X}
END_OF_FILE
if test 1851 -ne `wc -c <'do_ep.c'`; then
    echo shar: \"'do_ep.c'\" unpacked with wrong size!
fi
# end of 'do_ep.c'
fi
if test -f 'do_ew.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_ew.c'\"
else
echo shar: Extracting \"'do_ew.c'\" \(2394 characters\)
sed "s/^X//" >'do_ew.c' <<'END_OF_FILE'
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}
END_OF_FILE
if test 2394 -ne `wc -c <'do_ew.c'`; then
    echo shar: \"'do_ew.c'\" unpacked with wrong size!
fi
# end of 'do_ew.c'
fi
if test -f 'do_ex.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_ex.c'\"
else
echo shar: Extracting \"'do_ex.c'\" \(1207 characters\)
sed "s/^X//" >'do_ex.c' <<'END_OF_FILE'
X/*
X * do_ex.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#ifdef TESTVER
X#  include "dbgvars.h"
X#endif
X
Xdo_Ex(absolute)
X    int     absolute;
X{
X    POINT   icoor,
X            t;
X    float   x_coor,
X            y_coor;
X
X#ifdef TESTVER
X    int     xwas_on;		/* for debugging */
X
X    /* turn debug2x off, if necessary, for the duration of do_Ex() */
X    if (debug2x) {
X	xwas_on = TRUE;
X	debug2x = FALSE;
X    } else {
X	xwas_on = FALSE;
X    }
X#endif
X
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    if (!absolute) {
X	icoor.x += current.x;
X	icoor.y += current.y;
X    }
X    t.x = icoor.x;
X    t.y = current.y;
X    put_seg(current, t);
X    put_seg(t, icoor);
X    t.x = current.x;
X    t.y = icoor.y;
X    put_seg(icoor, t);
X    put_seg(t, current);
X    c = getchar();
X
X#ifdef TESTVER
X    if (xwas_on) {
X	debug2x = TRUE;
X    }
X#endif
X}
END_OF_FILE
if test 1207 -ne `wc -c <'do_ex.c'`; then
    echo shar: \"'do_ex.c'\" unpacked with wrong size!
fi
# end of 'do_ex.c'
fi
if test -f 'do_ft.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_ft.c'\"
else
echo shar: Extracting \"'do_ft.c'\" \(829 characters\)
sed "s/^X//" >'do_ft.c' <<'END_OF_FILE'
X/*
X * do_ft.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
Xdo_FT()
X{
X    float   spcng;		/* local var, not global var 'spacing' in
X				 * fillvars.h */
X
X    if (first_fill) {
X	fill_spacing = 0.01 *
X	    sqrt((double) (P2.x - P1.x) * (P2.x - P1.x) +
X	    (double) (P2.y - P1.y) * (P2.y - P1.y)) + 0.5;
X	fill_angle = 0;
X	first_fill = FALSE;
X    }
X    if ((c = getchar()) == ';') {
X	fill_type = BI_SOLID;
X    } else {
X	ungetc(c, stdin);
X	scanf("%hd", &fill_type);
X
X	if (getchar() == ',') {
X	    scanf("%f", &spcng);
X	    fill_spacing = (scaling ? x_scaler * spcng + 0.5 : (int) spcng);
X
X	    if (getchar() == ',') {
X		scanf("%hd", &fill_angle);
X		getchar();	/* swallow terminating ';' */
X	    }
X	}
X    }
X
X    set_fill();
X    fix_fill();
X}
END_OF_FILE
if test 829 -ne `wc -c <'do_ft.c'`; then
    echo shar: \"'do_ft.c'\" unpacked with wrong size!
fi
# end of 'do_ft.c'
fi
if test -f 'do_ip.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_ip.c'\"
else
echo shar: Extracting \"'do_ip.c'\" \(544 characters\)
sed "s/^X//" >'do_ip.c' <<'END_OF_FILE'
X/*
X * do_ip.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
Xdo_IP()
X{
X    register int diffx,
X            diffy;
X
X    diffx = P2.x - P1.x;
X    diffy = P2.y - P1.y;
X    if (scanf("%d,%d", &P1.x, &P1.y) != 2) {
X	fprintf(stderr, "Bad format for IP\n");
X	exit(5);
X    }
X    if ((c = getchar()) == ',') {
X	if (scanf("%d,%d;", &P2.x, &P2.y) != 2) {
X	    fprintf(stderr, "Bad format for IP\n");
X	    exit(5);
X	}
X    } else {
X	P2.x = P1.x + diffx;
X	P2.y = P1.y + diffy;
X    }
X}
END_OF_FILE
if test 544 -ne `wc -c <'do_ip.c'`; then
    echo shar: \"'do_ip.c'\" unpacked with wrong size!
fi
# end of 'do_ip.c'
fi
if test -f 'do_iw.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_iw.c'\"
else
echo shar: Extracting \"'do_iw.c'\" \(401 characters\)
sed "s/^X//" >'do_iw.c' <<'END_OF_FILE'
X/*
X * do_iw.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
Xdo_IW()
X{
X    if ((c = getchar()) == ';') {
X	LL.y = LL.x = 0;
X	UR.x = 10365;
X	UR.y = 7962;
X    } else {
X	ungetc(c, stdin);
X	if (scanf("%d,%d,%d,%d;", &LL.x, &LL.y, &UR.x, &UR.y) != 4) {
X	    fprintf(stderr, "bad format in IW instruction\n");
X	    exit(4);
X	}
X    }
X}
END_OF_FILE
if test 401 -ne `wc -c <'do_iw.c'`; then
    echo shar: \"'do_iw.c'\" unpacked with wrong size!
fi
# end of 'do_iw.c'
fi
if test -f 'do_lb.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_lb.c'\"
else
echo shar: Extracting \"'do_lb.c'\" \(937 characters\)
sed "s/^X//" >'do_lb.c' <<'END_OF_FILE'
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
Xdo_LB()
X{
X    POINT   l_point;
X
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 = getchar()) != label_terminator) {
X	    l_point = plot_char(l_point, c, set_standard);
X	}
X    else
X	while ((c = getchar()) != label_terminator) {
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}
END_OF_FILE
if test 937 -ne `wc -c <'do_lb.c'`; then
    echo shar: \"'do_lb.c'\" unpacked with wrong size!
fi
# end of 'do_lb.c'
fi
if test -f 'do_lt.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_lt.c'\"
else
echo shar: Extracting \"'do_lt.c'\" \(425 characters\)
sed "s/^X//" >'do_lt.c' <<'END_OF_FILE'
X/*
X * do_lt.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
Xdo_LT()
X{
X    float   lt;
X
X    if ((c = getchar()) == ';') {
X	line_type = SOLID;
X	return;
X    } else {
X	ungetc(c, stdin);
X	scanf("%f", &lt);
X	line_type = lt;
X	if ((c = getchar()) == ',') {
X	    scanf("%f", &line_pattern_length);
X	    getchar();		/* swallow the terminating ';' */
X	}
X    }
X}
END_OF_FILE
if test 425 -ne `wc -c <'do_lt.c'`; then
    echo shar: \"'do_lt.c'\" unpacked with wrong size!
fi
# end of 'do_lt.c'
fi
if test -f 'do_pg.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_pg.c'\"
else
echo shar: Extracting \"'do_pg.c'\" \(2638 characters\)
sed "s/^X//" >'do_pg.c' <<'END_OF_FILE'
X/*
X * do_pg.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X *
X * polygon area fill
X * read points[] from hpgl file
X * call hatch( points, num_pts );
X * 
X * The PG instruction -- non-standard, polygon area fill
X * Two alternate forms:
X *    PGX1,Y1, X2,Y2, ... Xn,Yn;  OR        
X *    PGX0,Y0, X1,Y1, X2,Y2, ... Xn,Yn, X1,X2;
X * 
X * X0,Y0 are coordinates of a point in the interior of the polygon and X1,Y1 
X * ... Xn,Yn are the n vertices of an n-sided polygon.  The first point listed 
X * must be such that a line segment drawn from that point to any point on the 
X * perimeter of the polygon is nowhere outside the perimeter.  If there is no 
X * such point in the polygon, this fill routine will not work for the polygon.  
X * If a vertex satisfies those conditions, the first form of the instruction 
X * may be used.  If not, the second form must be used.  Note that in the second 
X * form, the second point listed (ei, the first vertex listed) must be repeated 
X * as the last point listed.  Spaces between pairs of coordinates are optional, 
X * for readibility. 
X *
X * The coordinates listed are relative to the current point.  The current point
X * is the last point listed in the most recent PA or PR instruction.  Absolute
X * coordinates may be used in the PG instruction, if it is preceded by the
X * instruction PA0,0;, which establishes 0,0 as the current point.  See the
X * instruction manual for details on the current point, and absolute / relative
X * coordinates.
X */
X
X#include <stdio.h>
X#include "const.h"
X#include "vars.h"
X#ifdef TESTVER
X#include "dbgvars.h"
X#endif
X
Xdo_PG()
X{
X    POINT   points[100];
X    int     num_pts = 0;
X
X#ifdef TESTVER
X    int     n;
X    int     was_on;		/* for debugging */
X
X    /* turn debug2 off, if necessary, for the duration of do_PG() */
X    if (debug2) {
X	was_on = TRUE;
X	debug2 = FALSE;
X    } else {
X	was_on = FALSE;
X    }
X#endif
X
X    do {
X	if (scanf("%d,%d", &(points[num_pts].x), &(points[num_pts].y)) != 2) {
X	    fprintf(stderr, "Bad format in PG instruction.\n");
X	    exit(2);
X	}
X	points[num_pts].x += current.x;
X	points[num_pts].y += current.y;
X	num_pts++;
X    } while ((c = getchar()) != ';');
X
X    points[num_pts] = points[0];
X    num_pts++;
X
X#ifdef TESTVER
X    if (debug8) {
X	for (n = 0; n < num_pts; n++) {
X	    fprintf(errfp, "points[%d] ( %d, %d );  ",
X		n, points[n].x, points[n].y);
X	}
X	putc('\n', errfp);
X    }
X    if (debug1c) {
X	printf("To: hatch();\n");
X    }
X    if (debug1f) {
X	fprintf(errfp, "\nTo: hatch();\n");
X    }
X#endif
X
X    hatch(points, num_pts);
X
X#ifdef TESTVER			/* reset debug2 if necessary */
X    if (was_on) {
X	debug2 = TRUE;
X    }
X#endif
X}
END_OF_FILE
if test 2638 -ne `wc -c <'do_pg.c'`; then
    echo shar: \"'do_pg.c'\" unpacked with wrong size!
fi
# end of 'do_pg.c'
fi
if test -f 'do_pt.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_pt.c'\"
else
echo shar: Extracting \"'do_pt.c'\" \(271 characters\)
sed "s/^X//" >'do_pt.c' <<'END_OF_FILE'
X/*
X * do_pt.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
Xdo_PT()
X{
X    if ((c = getchar()) == ';') {
X	pen_thickness = 0.3;
X    } else {
X	ungetc(c, stdin);
X	scanf("%f;", &pen_thickness);
X    }
X}
END_OF_FILE
if test 271 -ne `wc -c <'do_pt.c'`; then
    echo shar: \"'do_pt.c'\" unpacked with wrong size!
fi
# end of 'do_pt.c'
fi
if test -f 'do_px.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_px.c'\"
else
echo shar: Extracting \"'do_px.c'\" \(1810 characters\)
sed "s/^X//" >'do_px.c' <<'END_OF_FILE'
X/*
X * do_px.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#ifdef TESTVER
X#include "dbgvars.h"
X#endif
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    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
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	    }
X	}
X	if (plot_abs)
X	    current = icoor;
X	else {
X	    current.x += icoor.x;
X	    current.y += icoor.y;
X	}
X
X	if (symbol_mode) {
X	    put_symbol(current);
X	}
X	if ((c = getchar()) == ';')
X	    break;
X    }
X
X#ifdef TESTVER			/* reset debug2x if necessary */
X    if (xwas_on) {
X	debug2x = TRUE;
X    }
X#endif
X}
END_OF_FILE
if test 1810 -ne `wc -c <'do_px.c'`; then
    echo shar: \"'do_px.c'\" unpacked with wrong size!
fi
# end of 'do_px.c'
fi
if test -f 'do_rx.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_rx.c'\"
else
echo shar: Extracting \"'do_rx.c'\" \(1162 characters\)
sed "s/^X//" >'do_rx.c' <<'END_OF_FILE'
X/*
X * do_rx.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#endif
X
Xdo_Rx(absolute)
X    int     absolute;
X{
X    POINT   icoor;
X    POINT   points[5];
X    float   x_coor,
X            y_coor;
X
X#ifdef TESTVER
X    int     i;
X
X#endif
X
X    if (scanf("%f,%f", &x_coor, &y_coor) != 2) {
X	fprintf(stderr, "Odd number of coordinates in RA or RR instruction\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 (!absolute) {
X	icoor.x += current.x;
X	icoor.y += current.y;
X    }
X    points[0] = points[4] = current;
X    points[1].x = icoor.x;
X    points[1].y = current.y;
X    points[2] = icoor;
X    points[3].x = current.x;
X    points[3].y = icoor.y;
X    c = getchar();
X
X#ifdef TESTVER
X    if (debug3) {
X	for (i = 0; i < 5; i++) {
X	    fprintf(errfp, "points[%d] ( %d, %d )\n",
X		i, points[i].x, points[i].y);
X	}
X    }
X#endif
X
X    hatch(points, 5);
X}
END_OF_FILE
if test 1162 -ne `wc -c <'do_rx.c'`; then
    echo shar: \"'do_rx.c'\" unpacked with wrong size!
fi
# end of 'do_rx.c'
fi
if test -f 'do_si.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_si.c'\"
else
echo shar: Extracting \"'do_si.c'\" \(375 characters\)
sed "s/^X//" >'do_si.c' <<'END_OF_FILE'
X/*
X * do_si.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
Xdo_SI()
X{
X    if ((c = getchar()) == ';') {
X	char_width = 0.187;
X	char_height = 0.269;
X    } else {
X	ungetc(c, stdin);
X	if (scanf("%f,%f;", &char_width, &char_height) != 2) {
X	    fprintf(stderr, "Bad SI format\n");
X	    exit(5);
X	}
X    }
X}
END_OF_FILE
if test 375 -ne `wc -c <'do_si.c'`; then
    echo shar: \"'do_si.c'\" unpacked with wrong size!
fi
# end of 'do_si.c'
fi
if test -f 'do_sl.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_sl.c'\"
else
echo shar: Extracting \"'do_sl.c'\" \(332 characters\)
sed "s/^X//" >'do_sl.c' <<'END_OF_FILE'
X/*
X * do_sl.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
Xdo_SL()
X{
X    if ((c = getchar()) == ';')
X	char_slant = 0.187;
X    else {
X	ungetc(c, stdin);
X	if (scanf("%f;", &char_slant) != 1) {
X	    fprintf(stderr, "Bad SL format\n");
X	    exit(5);
X	}
X    }
X}
END_OF_FILE
if test 332 -ne `wc -c <'do_sl.c'`; then
    echo shar: \"'do_sl.c'\" unpacked with wrong size!
fi
# end of 'do_sl.c'
fi
if test -f 'do_sm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_sm.c'\"
else
echo shar: Extracting \"'do_sm.c'\" \(272 characters\)
sed "s/^X//" >'do_sm.c' <<'END_OF_FILE'
X/*
X * do_sm.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include "const.h"
X#include "vars.h"
X#include <stdio.h>
X
Xdo_SM()
X{
X    if ((c = getchar()) == ';')
X	symbol_mode = FALSE;
X    else {
X	symbol_mode = TRUE;
X	symbol_char = c;
X	c = getchar();
X    }
X}
END_OF_FILE
if test 272 -ne `wc -c <'do_sm.c'`; then
    echo shar: \"'do_sm.c'\" unpacked with wrong size!
fi
# end of 'do_sm.c'
fi
if test -f 'do_sp.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_sp.c'\"
else
echo shar: Extracting \"'do_sp.c'\" \(288 characters\)
sed "s/^X//" >'do_sp.c' <<'END_OF_FILE'
X/*
X * do_sp.c
X *
X * Copyright (c) 1988 Environmental Defense Fund, Inc.
X */
X
X#include <stdio.h>
X#include "fillvars.h"
X
Xdo_SP()
X{
X    char    c;
X
X    if ((c = getchar()) == ';') {
X	pen_number = 0;
X    } else {
X	ungetc(c, stdin);
X	scanf("%d", &pen_number);
X	getchar();
X	fix_fill();
X    }
X}
END_OF_FILE
if test 288 -ne `wc -c <'do_sp.c'`; then
    echo shar: \"'do_sp.c'\" unpacked with wrong size!
fi
# end of 'do_sp.c'
fi
if test -f 'do_wg.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'do_wg.c'\"
else
echo shar: Extracting \"'do_wg.c'\" \(3096 characters\)
sed "s/^X//" >'do_wg.c' <<'END_OF_FILE'
X/*
X * do_wg.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#define MIN(x, y) ((x) < (y) ? (x) : (y))
X#define MAX(x, y) ((x) > (y) ? (x) : (y))
X
Xdo_WG()
X{
X    POINT   t;
X    POINT   points[362];
X    float   radius;
X    int     i_radius,
X            start_angle,
X            sweep_angle,
X            chordangle;
X    int     i;
X    int     num_points;
X
X#ifdef TESTVER
X    int     p,
X            was_on;		/* for debugging */
X
X#endif
X
X
X    if (scanf("%f,%d,%d", &radius, &start_angle, &sweep_angle) != 3) {
X	fprintf(stderr, "Wrong number of parameters.\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
X    /* set endpoints for starting radius */
X    num_points = 0;
X    points[num_points++] = current;
X
X    t.x = (int) ((double) radius * cos((double) start_angle *
X	    DEGREES_TO_RADIANS)) + current.x;
X    t.y = (int) ((double) radius * sin((double) start_angle *
X	    DEGREES_TO_RADIANS)) + current.y;
X    points[num_points++] = t;
X
X    /*
X     * set succeeding points along circumference, ...                  ... up
X     * to but not incl the last point (at full sweep angle) 
X     */
X    for (i = chordangle; abs(i) < abs(sweep_angle); i += chordangle) {
X	t.x = (int) ((double) radius * cos((double) ((start_angle + i) % 360)
X		* DEGREES_TO_RADIANS)) + current.x;
X	t.y = (int) ((double) radius * sin((double) ((start_angle + i) % 360)
X		* DEGREES_TO_RADIANS)) + current.y;
X
X	points[num_points++] = t;
X    }
X
X    /* set last point on circumference, at full sweep angle */
X    t.x = (int) ((double) radius * cos((double) (start_angle + sweep_angle) *
X	    DEGREES_TO_RADIANS)) + current.x;
X    t.y = (int) ((double) radius * sin((double) (start_angle + sweep_angle) *
X	    DEGREES_TO_RADIANS)) + current.y;
X    points[num_points++] = t;
X
X    /* set final point, at center again */
X    points[num_points++] = current;
X
X#ifdef TESTVER
X    /* send points to error file */
X    if (debug3) {
X	fprintf(errfp, "num_points: %d\n", num_points);
X	for (p = 0; p < num_points; p++) {
X	    fprintf(errfp, "points[%2d] ( %4d, %4d )\n",
X		p, points[p].x, points[p].y);
X	}
X	fflush(errfp);
X    }
X#endif
X
X#ifdef TESTVER
X    /* turn debug2 off, if necessary, for the duration of fill routines */
X    if (debug2) {
X	was_on = TRUE;
X	debug2 = FALSE;
X    } else {
X	was_on = FALSE;
X    }
X
X    if (debug1c) {
X	printf("To: hatch();\n");
X    }
X    if (debug1f) {
X	fprintf(errfp, "To: hatch();\n");
X    }
X#endif
X
X    hatch(points, num_points);
X
X#ifdef TESTVER
X    if (was_on) {
X	debug2 = TRUE;
X    }
X#endif
X
X}
END_OF_FILE
if test 3096 -ne `wc -c <'do_wg.c'`; then
    echo shar: \"'do_wg.c'\" unpacked with wrong size!
fi
# end of 'do_wg.c'
fi
if test -f 'fillcnst.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fillcnst.h'\"
else
echo shar: Extracting \"'fillcnst.h'\" \(975 characters\)
sed "s/^X//" >'fillcnst.h' <<'END_OF_FILE'
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
END_OF_FILE
if test 975 -ne `wc -c <'fillcnst.h'`; then
    echo shar: \"'fillcnst.h'\" unpacked with wrong size!
fi
# end of 'fillcnst.h'
fi
if test -f 'filltype.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'filltype.c'\"
else
echo shar: Extracting \"'filltype.c'\" \(2909 characters\)
sed "s/^X//" >'filltype.c' <<'END_OF_FILE'
X/*
X * filltype.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 "fillvars.h"
X#ifdef TESTVER
X#include "dbgvars.h"
X#endif
X
X#ifdef TRUESOLID
Xdouble  PUs_per_dot;		/* extern-referenced by init_map() */
X
X#endif
X
X/*
X * fill_type specifies a general category of fill: 
X *            solid, parallel, cross-hatch
X * fill_angle specifies the angle of inclination of the hatch lines
X * this routine combines fill_type and fill_angle, and assigns the
X *    result to var fill, which specifies the combination of 
X *    fill_type and fill_angle.
X * fix_fill() assigns an altered value of fill to var fixed_fill,
X *    and an altered value of fill_spacing to var spacing.
X * fill_type, fill_angle, and fill_spacing reside in vars.h and do_df.c
X * fill, fixed_fill, and spacing reside in fillvars.h and hatch.c
X */
Xset_fill()
X{
X    fill_angle = reduce_degs(fill_angle);
X    switch (fill_type) {
X    case UNI_SOLID:
X    case BI_SOLID:
X	fill = SOLIDFILL;
X	break;
X    case CROSS_HATCH:
X	switch (fill_angle) {
X	case 0:
X	case 90:
X	    fill = CROSS_0;
X	    break;
X	case 45:
X	case 135:
X	    fill = CROSS_45;
X	    break;
X	}
X	break;
X    case PARALLEL:
X	switch (fill_angle) {
X	case 0:
X	    fill = PARLL_0;
X	    break;
X	case 45:
X	    fill = PARLL_45;
X	    break;
X	case 90:
X	    fill = PARLL_90;
X	    break;
X	case 135:
X	    fill = PARLL_135;
X	    break;
X	default:
X	    fill = OTHER;
X	    break;
X	}
X	break;
X    }
X}
X
X
X#define SPACING_MULTIPLIER 1.5
X
X/*
X * Since different "pens" have not been implemented for the printers,
X * FT4,50,45;SP1; and FT4,50,45;SP2; would plot as indistinguishable
X * fill patterns: only the pen number has changed.  To work around that,
X * this routine assigns a new fill type (in var fixed_fill) 
X * and a new fill spacing (in var spacing)
X * based on a combination of fill, fill_spacing, and pen_number,
X * to provide contrast between different "pens". 
X */
Xfix_fill()
X{
X    if (fill == SOLIDFILL) {
X	fixed_fill = SOLIDFILL;
X#ifdef TRUESOLID
X	spacing = (int) (PUs_per_dot * 0.95);
X#else
X	spacing = 75;
X#endif
X    } else if (fill == OTHER) {
X	fixed_fill = OTHER;
X	spacing = (fill_spacing * 4 / SPACING_MULTIPLIER) + 0.5;
X    } else {
X	fixed_fill = ((fill + pen_number - 2) % 6) + 1;
X	spacing = (fill_spacing * (fill_type - 1) / SPACING_MULTIPLIER) + 0.5;
X    }
X
X#ifdef TESTVER
X    if (debug9) {
X	fprintf(errfp, "fill_type: %d;  fill_angle: %d;  pen_number: %d\n",
X	    fill_type, fill_angle, pen_number);
X	fprintf(errfp, "fill: %d;  fixed_fill: %d;  spacing: %d\n\n",
X	    fill, fixed_fill, spacing);
X    }
X#endif
X
X}
X
X
X
X/* =========================== reduce_degs() =============================== */
X/* modify angle so that  0 <= angle < 180 */
X
Xint
Xreduce_degs(angle)
X    int     angle;
X{
X    while (angle >= 180) {
X	angle -= 180;
X    }
X    while (angle < 0) {
X	angle += 180;
X    }
X    return (angle);
X}
END_OF_FILE
if test 2909 -ne `wc -c <'filltype.c'`; then
    echo shar: \"'filltype.c'\" unpacked with wrong size!
fi
# end of 'filltype.c'
fi
if test -f 'fillvars.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fillvars.h'\"
else
echo shar: Extracting \"'fillvars.h'\" \(700 characters\)
sed "s/^X//" >'fillvars.h' <<'END_OF_FILE'
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;
END_OF_FILE
if test 700 -ne `wc -c <'fillvars.h'`; then
    echo shar: \"'fillvars.h'\" unpacked with wrong size!
fi
# end of 'fillvars.h'
fi
if test -f 'hpgl.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'hpgl.doc'\"
else
echo shar: Extracting \"'hpgl.doc'\" \(2074 characters\)
sed "s/^X//" >'hpgl.doc' <<'END_OF_FILE'
XHPGL COMMANDS
X
XAl Chase
X
XCopyright (c) 1988 Environmental Defense Fund, Inc.
X
X
XThe useful instructions for a user-generated HPGL (Hewlett-Packard
XGraphics Language) file for use with the hpglplot program are (ESC is
Xthe escape character, ASCII 27):
X
XESC.R   initialize the bit map; should be the 1st instruction.
XDF;     set defaults, read in charset.0; should be the 2nd instruction.
XESC.Z   dump the bit map to the output file; should be the last instruction.
X
XAA,AR   not yet implemented         (not used by 20/20)
XCI      circle (has a bug)          (not used by 20/20)
X
XPU,PD   pen up, pen down
XPA,PR   plot line segment -- absolute / relative
X
XEA,ER   edge a rectangle -- absolute / relative
XRA,RR   fill a rectangle -- absolute / relative
XEW,WG   edge, fill a wedge (pie sector)
XEP,PG   edge, fill a polygon (non-standard; see hpglplot.doc)
X
XFT      fill type -- type 1,2 = solid; 3 = parallel hatch; 4 = cross hatch;
X                     5 is ignored.
XLB      label; Ctrl-C (ASCII 3) is label terminator
XSI      size of characters for labels
XSP      select pen
XSM      symbol mode for line charts
X
X{,}     enclose comments (non-standard; see hpglplot.doc)
X
X
XNOTES
X
XA crucial concept is the current point: the last point listed in the
Xmost recent PA, PR, PU, or PD instruction which had parameters.
X
XEW,EG  use the current point as the center of the pie sector.
X
XEA,ER,RA,RR  specify a rectangle with the current point at one corner
Xand the point listed as the parameter for the EA,ER,RA,RR instruction
Xat the diagonally opposite corner.
X
XEg, PU;PA100,100;RA300,200;  establishes the current point as (100,100)
Xwithout plotting a line to the current point, since the pen is up; and
Xthen creates a rectangle with a corner at (100,100) and opposite corner
Xat (300,200).  The rectangle is plotted regardless of the PU/PD status.
X"PU100,100;" is equivalent to "PU;PA100,100;".  20/20 apparently always
Xuses the latter form.
X
XEP,PG parameters are relative to the current point.  Set the current
Xpoint to (0,0) to use absolute coordinates with the EP and PG
Xinstructions.
END_OF_FILE
if test 2074 -ne `wc -c <'hpgl.doc'`; then
    echo shar: \"'hpgl.doc'\" unpacked with wrong size!
fi
# end of 'hpgl.doc'
fi
if test -f 'maps.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'maps.c'\"
else
echo shar: Extracting \"'maps.c'\" \(1070 characters\)
sed "s/^X//" >'maps.c' <<'END_OF_FILE'
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[350000];
X
Xinit_map()
X{
X    switch (printer) {
X    case EPSON:
X	ep_init_map();
X	break;
X    case LASER:
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 LASER:
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 LASER:
X	lj_put_seg(p1, p2);
X	break;
X    case IBM_PRO:
X	ib_put_seg(p1, p2);
X	break;
X    }
X}
END_OF_FILE
if test 1070 -ne `wc -c <'maps.c'`; then
    echo shar: \"'maps.c'\" unpacked with wrong size!
fi
# end of 'maps.c'
fi
if test -f 'mid_ref.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mid_ref.c'\"
else
echo shar: Extracting \"'mid_ref.c'\" \(3034 characters\)
sed "s/^X//" >'mid_ref.c' <<'END_OF_FILE'
X/*
X * mid_ref.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#include "fillcnst.h"
X#include "fillvars.h"
X#ifdef TESTVER
X#include "dbgvars.h"
X#endif
X
X#ifdef __STDC__
Xint
Xmid_ref(POINT A, POINT B, POINT C);
Xint
Xchoose_step(FPOINT *f_pt_s1p, double chg_x_s1, double chg_y_s1,
X    FPOINT *f_pt_s2p, double chg_x_s2, double chg_y_s2,
X    int status, int limit);
X
X#endif
X
X/* =========================== mid_ref() =================================== */
Xmid_ref(A, C, B)
X    POINT   A,
X            C,
X            B;
X{
X    FPOINT  f_pt_CB,
X            f_pt_CA,
X            f_pt_AB;
X    POINT   endpt_CB,
X            endpt_CA,
X            endpt_AB;
X    FPOINT  T;			/* intercept on A-B of hatch line thru C */
X    double  ydiff;
X    int     limit;
X    double  m1,
X            m2;
X
X#ifdef TESTVER
X    if (debug4) {
X	fprintf(errfp, "A: ( %d, %d );  ", A.x, A.y);
X	fprintf(errfp, "B: ( %d, %d );  ", B.x, B.y);
X	fprintf(errfp, "C: ( %d, %d )\n", C.x, C.y);
X    }
X#endif
X
X    /* find 1st set of hatch segment endpoints (thru C) */
X    endpt_CB = C;
X    f_pt_CB.xx = (double) endpt_CB.x;
X    f_pt_CB.yy = (double) endpt_CB.y;
X    if (hatch_degs == 90) {	/* hatch lines are vertical */
X	T.xx = (double) C.x;
X	ydiff = (T.xx - A.x) * (B.y - A.y) / (double) (B.x - A.x);
X	T.yy = (double) A.y + ydiff;
X    } else if (A_B == VERT) {	/* side A-B is vertical */
X	T.xx = (double) A.x;
X	ydiff = (double) (A.x - C.x) * tan(hatch_rads);
X	T.yy = (double) C.y + ydiff;
X    } else {			/* non-special cases - solve 2 eqns, 2
X				 * unknowns */
X	m1 = tan(hatch_rads);	/* slope of hatch lines */
X	m2 = ((double) A.y - B.y) / (A.x - B.x);	/* slope of A_B */
X	T.xx = ((C.x * m1) - (A.x * m2) + A.y - C.y) / (m1 - m2);
X	T.yy = (T.xx - A.x) * m2 + A.y;
X    }
X#ifdef TESTVER
X    if (debug4) {
X	fprintf(errfp, "T: ( %5.0f, %5.0f );  ", T.xx, T.yy);
X    }
X#endif
X    f_pt_AB.xx = T.xx;
X    f_pt_AB.yy = T.yy;
X
X    /* plot hatch lines up to limiting point (B) to 'right' of C */
X    limit = ((C_B == VERT) ? B.y : B.x);
X#ifdef TESTVER
X    if (debug4)
X	fprintf(errfp, "limit: %d\n", limit);
X    if (debug1c) {
X	fprintf(stderr, "To: choose_step() - side 1;\n");
X    }
X    if (debug1f) {
X	fprintf(errfp, "\nTo: choose_step() - side 1;\n");
X    }
X#endif
X    choose_step(&f_pt_CB, chg_x_CB, chg_y_CB,
X	&f_pt_AB, chg_x_AB, chg_y_AB,
X	C_B, limit);
X
X
X    /* assign next set of hatch segment endpoints (along 2nd side) */
X    f_pt_CA.xx = C.x - chg_x_CA;
X    f_pt_CA.yy = C.y - chg_y_CA;
X    f_pt_AB.xx = T.xx - chg_x_AB;
X    f_pt_AB.yy = T.yy - chg_y_AB;
X
X    /* plot hatch lines up to limiting point (A) to 'left' of C */
X    limit = ((C_A == VERT) ? A.y : A.x);
X#ifdef TESTVER
X    if (debug4)
X	fprintf(errfp, "limit: %d\n", limit);
X    if (debug1c) {
X	fprintf(stderr, "To: choose_step() - side 2;\n");
X    }
X    if (debug1f) {
X	fprintf(errfp, "\nTo: choose_step() - side 2;\n");
X    }
X#endif
X    choose_step(&f_pt_CA, -chg_x_CA, -chg_y_CA,
X	&f_pt_AB, -chg_x_AB, -chg_y_AB,
X	C_A, limit);
X}
END_OF_FILE
if test 3034 -ne `wc -c <'mid_ref.c'`; then
    echo shar: \"'mid_ref.c'\" unpacked with wrong size!
fi
# end of 'mid_ref.c'
fi
if test -f 'misc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'misc.c'\"
else
echo shar: Extracting \"'misc.c'\" \(295 characters\)
sed "s/^X//" >'misc.c' <<'END_OF_FILE'
X/*
X * misc.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
Xunimpl(c1, c2)
X    char    c1,
X            c2;
X{
X#ifdef TESTVER
X    fprintf(stderr, "%c%c UNIMPLEMENTED\n", c1, c2);
X#endif
X    while ((c = getchar()) != ';');
X}
END_OF_FILE
if test 295 -ne `wc -c <'misc.c'`; then
    echo shar: \"'misc.c'\" unpacked with wrong size!
fi
# end of 'misc.c'
fi
if test -f 'plot_cha.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'plot_cha.c'\"
else
echo shar: Extracting \"'plot_cha.c'\" \(2788 characters\)
sed "s/^X//" >'plot_cha.c' <<'END_OF_FILE'
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}
END_OF_FILE
if test 2788 -ne `wc -c <'plot_cha.c'`; then
    echo shar: \"'plot_cha.c'\" unpacked with wrong size!
fi
# end of 'plot_cha.c'
fi
if test -f 'set_dbgs.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'set_dbgs.c'\"
else
echo shar: Extracting \"'set_dbgs.c'\" \(1389 characters\)
sed "s/^X//" >'set_dbgs.c' <<'END_OF_FILE'
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 = 0;
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 = 1;
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 = 1;
X
X    /* to plot.err: NOT USED */
X    debug8 = 0;
X
X    /* to plot.err: info from fix_fill */
X    debug9 = 1;
X}
END_OF_FILE
if test 1389 -ne `wc -c <'set_dbgs.c'`; then
    echo shar: \"'set_dbgs.c'\" unpacked with wrong size!
fi
# end of 'set_dbgs.c'
fi
if test -f 'vars.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'vars.h'\"
else
echo shar: Extracting \"'vars.h'\" \(827 characters\)
sed "s/^X//" >'vars.h' <<'END_OF_FILE'
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,
X        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;
END_OF_FILE
if test 827 -ne `wc -c <'vars.h'`; then
    echo shar: \"'vars.h'\" unpacked with wrong size!
fi
# end of 'vars.h'
fi
echo shar: End of archive 1 \(of 3\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0