[comp.sources.x] v09i049: xloadimage, Part02/09

jimf@saber.com (09/28/90)

Submitted-by: saber.com!jimf@saber.com
Posting-number: Volume 9, Issue 49
Archive-name: xloadimage/part02

#! /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 2 (of 9)."
# Contents:  xloadimage.man copyright.h fbm.h g3.h gif.h hash.h image.h
#   imagetypes.h kljcpyrght.h mac.h mit.cpyrght
# Wrapped by jimf@armory on Tue Sep 25 19:37:39 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'xloadimage.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xloadimage.man'\"
else
echo shar: Extracting \"'xloadimage.man'\" \(18198 characters\)
sed "s/^X//" >'xloadimage.man' <<'END_OF_FILE'
X.TH XLOADIMAGE 1 "13 December 1989"
X.SH NAME
Xxloadimage, xsetbg, xview \- load images into an X11 window or onto
Xthe root window
X.SH SYNOPSIS
X\fIxloadimage\fR [global_options] {[image_options] image ...}
X.SH DESCRIPTION
X\fIXloadimage\fR displays images in an X11 window or loads them onto
Xthe root window.  See the \fIIMAGE TYPES\fR section below for
Xsupported image types.
X.PP
XIf the destination display cannot support the number of colors in the
Ximage, the image will be dithered (monochrome destination) or have its
Xcolormap reduced (color destination) as appropriate.  This can also be
Xdone forcibly with the \fI-halftone\fR, \fI-dither\fR, and
X\fI-colors\fR options.
X.PP
XIf more than one image is to be loaded, they will be merged into a
Xsingle image.  The \fI-at\fR and \fI-center\fR options control where
Xsubsequent images will be loaded onto the initial image.  Any
Xcombination of color image depths and/or monochrome images may be
Xloaded at one time.  If merging two color images would overload the
Xnumber of available colormap entries, the number of colors shared
Xbetween the images will be automatically reduced to fit.
X.PP
XA variety of image manipulations can be specified, including gamma
Xcorrection, brightening, clipping, dithering, depth-reduction,
Xrotation, and zooming.  Most of these manipulations have simple
Ximplementations; speed was opted for above accuracy.
X.PP
XIf you are viewing a large image in a window, the initial window will
Xbe at most 90% of the size of the display unless the window manager
Xdoes not correctly handle window size requests or if you've used the
X\fI-fullscreen\fR option.  You may move the image around in the window
Xby dragging with the first mouse button.  The cursor will indicate
Xwhich directions you may drag, if any.  You may exit the window by
Xtyping 'q' or '^C' when the keyboard focus is on the window.
X.PP
XIt's possible to have a "slideshow" of many images by specifying the
X\fI-slideshow\fR option.
X.PP
XA wide variety of common image manipulations can be done by mixing and
Xmatching the available options.  See the section entitled \fIHINTS FOR
XGOOD IMAGE DISPLAYS\fR for some ideas.
X.PP
X\fIXsetbg\fR is equivalent to \fIxloadimage -onroot -quiet\fR and
X\fIxview\fR is equivalent to \fIxloadimage -view -verbose\fR.
X.SH RESOURCE CLASS
X\fIXloadimage\fR uses the resource class name \fIxloadimage\fR for
Xwindow managers which need this resource set.  This name changed
Xin version 2.00; some previous versions used the name \fIXLoadImage\fR
Xwhich was difficult to predict.
X.SH GLOBAL OPTIONS
XThe following options affect the global operation of \fIxloadimage\fR.
XThey may be specified anywhere on the command line.
X.TP 8
X-border \fIcolor\fR
XThis sets the background portion of the window which is not covered by
Xany images to be \fIcolor\fR.
X.TP
X-display \fIdisplay_name\fR
XX11 display name to send the image(s) to.
X.TP
X-fullscreen
XUse the entire screen to display images.  If combined with -onroot,
Xthe image will be zoomed to fill the entire rootwindow.
X.TP
X-geometry \fIWxH[{+-X}{+-}Y]\fR
XThis sets the size of the window onto which the images are loaded to a
Xdifferent value than the size of the image.  When viewing an image in
Xa window, this can be used to reduce the size of the destination
Xwindow.  When loading an image onto the root window, this option
Xcontrols the size of the pixmap which will be loaded onto the root.
XIf the size is smaller than that of the display, the image will be
Xreplicated.
X.TP
X-install
XForcibly install the image's colormap when the window is focused.
XThis violates ICCCM standards and only exists to allow operation with
Xnaive window managers.  Use this option only if your window manager
Xdoes not install colormaps properly.
X.TP
X-list
XList the images which are along the image path.
X.TP
X-help
XDisplays a short summary of xloadimage command line syntax.
X.TP
X-onroot
XLoad image(s) onto the root window instead of viewing in a window.
XThis is the opposite of \fI-view\fR.  \fIXSetbg\fR has this option set
Xby default.  Loading with the -onroot option will fail if enough
Xsharable colors cannot be allocated from the default colormap.
X.TP
X-path
XDisplays the image path and image suffixes which will be used when
Xlooking for images.  These are loaded from ~/.xloadimagerc and
Xoptionally from a systemwide file (normally /usr/lib/xloadimagerc).
X.TP
X-quiet
XForces \fIxloadimage\fR and \fIxview\fR to be quiet.  This is the
Xdefault for \fIxsetbg\fR, but the others like to whistle. 
X.TP
X-slideshow
XShow each image argument one at a time instead of merging them.
XTyping 'p' will back up to the previous image displayed, 'n' will go
Xto the next image, and 'q' or '^C' will quit.  This option is often
Xused in conjunction with -fullscreen.  When this option is specified,
Xthe \fI-bright\fR, \fI-colors\fR, \fI-dither\fR, \fI-gamma\fR,
X\fI-smooth\fR, \fI-xzoom\fR, \fI-yzoom\fR, and \fI-zoom\fR options
Xwill propagate to all images following them.
X.TP
X-supported
XList the supported image types. 
X.TP
X-verbose
XCauses \fIxloadimage\fR to be talkative, telling you what kind of
Ximage it's playing with and any special processing that it has to do. 
XThis is the default for \fIxview\fR and \fIxloadimage\fR. 
X.TP
X-version
XPrint the version number and patchlevel of this version of
X\fIxloadimage\fR.  Versions prior to version 1, patchlevel 03 do not
Xhave this option and should be updated.
X.TP
X-view
XView image(s) in a window.  This is the opposite of \fI-onroot\fR and
Xthe default for \fIxsetbg\fR. 
X.SH IMAGE OPTIONS
XThe following options may preceed each image.  These options are
Xlocal to the image they preceed. 
X.TP
X-at \fIX\fR,\fIY\fR
XIndicates coordinates to load the image at on the first image.  If
Xthis is an option to the first image, and the \fI-onroot\fR option is
Xspecified, the image will be loaded at the given location on the
Xdisplay background. 
X.TP
X-background \fIcolor\fR
XUse \fIcolor\fR as the background color instead of the default
X(usually white but this depends on the image type) if you are
Xtransferring a monochrome image to a color display. 
X.TP
X-brighten \fIpercentage\fR
XSpecify a percentage multiplier for a color image's colormap.  A value
Xof more than 100 will brighten an image, one of less than 100 will
Xdarken it. 
X.TP
X-center
XCenter the image on the first image loaded.  If this is an option to
Xthe first image, and the \fI-onroot\fR option is specified, the image
Xwill be centered on the display background. 
X.TP
X-colors \fIn\fR
XSpecify the maximum number of colors to use in the image.  This is a
Xway to forcibly reduce the depth of an image.
X.TP
X-clip \fIX\fR,\fIY\fR,\fIW\fR,\fIH\fR
XClip the image before loading it.  \fIX\fR and \fIY\fR define the
Xupper-left corner of the clip area, and \fIW\fR and \fIH\fR define the
Xextents of the area.  A zero value for \fIW\fR or \fIH\fR will be
Xinterpreted as the remainder of the image. 
X.TP
X-dither
XDither a color image to monochrome using a Floyd-Steinberg dithering
Xalgorithm.  This happens by default when viewing color images on a
Xmonochrome display.  This is slower than \fI-halftone\fR and affects
Xthe image accuracy but usually looks much better.
X.TP
X-foreground \fIcolor\fR
XUse \fIcolor\fR as the foreground color instead of black if you are
Xtransferring a monochrome image to a color display.  This can also be
Xused to invert the foreground and background colors of a monochrome
Ximage. 
X.TP
X-gamma \fIdisplay_gamma\fR
XSpecify the gamma correction for the display.
XThe default value is 1.0, a typical display needs 2.0 to 2.5.
X.TP
X-halftone
XForce halftone dithering of a color image when displaying on a
Xmonochrome display.  This option is ignored on monochrome images.
XThis dithering algorithm blows an image up by sixteen times; if you
Xdon't like this, the \fI-dither\fR option will not blow the image up
Xbut will take longer to process and will be less accurate.
X.TP
X-name \fIimage_name\fR
XForce the next argument to be treated as an image name.  This is
Xuseful if the name of the image is \fI-dither\fR, for instance. 
X.TP
X-rotate \fIdegrees\fR
XRotate the image by \fIdegrees\fR clockwise.  The number must be a
Xmultiple of 90.
X.TP
X-smooth
XSmooth a color image.  This reduces blockiness after zooming an image
Xup.  If used on a monochrome image, nothing happens.  This option can
Xtake awhile to perform, especially on large images.  You may specify
Xmore than one \fI-smooth\fR option per image, causing multiple
Xiterations of the smoothing algorithm.
X.TP
X-xzoom \fIpercentage\fR
XZoom the X axis of an image by \fIpercentage\fR.  A number greater
Xthan 100 will expand the image, one smaller will compress it.  A zero
Xvalue will be ignored. 
X.TP
X-yzoom \fIpercentage\fR
XZoom the Y axis of an image by \fIpercentage\fR.  See \fI-xzoom\fR for
Xmore information. 
X.TP
X-zoom \fIpercentage\fR
XZoom both the X and Y axes by \fIpercentage\fR.  See \fI-xzoom\fR for
Xmore information.  Technically the percentage actually zoomed is the
Xsquare of the number supplied since the zoom is to both axes, but I
Xopted for consistency instead of accuracy.
X.SH EXAMPLES
XTo load the rasterfile "my.image" onto the background and replicate
Xit to fill the entire background:
X.sp
X.ti +5
Xxloadimage -onroot my.image
X.PP
XTo load a monochrome image "my.image" onto the background, using red
Xas the foreground color, replicate the image, and overlay
X"another.image" onto it at coordinate (10,10):
X.sp
X.ti +5
Xxloadimage -foreground red my.image -at 10,10 another.image
X.PP
XTo center the rectangular region from 10 to 110 along the X axis and
Xfrom 10 to the height of the image along the Y axis:
X.sp
X.ti +5
Xxloadimage -center -clip 10,10,100,0 my.image
X.PP
XTo double the size of an image:
X.sp
X.ti +5
Xxloadimage -zoom 200 my.image
X.PP
XTo halve the size of an image:
X.sp
X.ti +5
Xxloadimage -zoom 50 my.image
X.PP
XTo brighten a dark image:
X.sp
X.ti +5
Xxloadimage -brighten 150 my.image
X.PP
XTo darken a bright image:
X.sp
X.ti +5
Xxloadimage -brighten 50 my.image
X.SH HINTS FOR GOOD IMAGE DISPLAYS
XSince images are likely to come from a variety of sources, they may be
Xin a variety of aspect ratios which may not be supported by your
Xdisplay.  The \fI-xzoom\fR and \fI-yzoom\fR options can be used to
Xchange the aspect ratio of an image before display.  If you use these
Xoptions, it is recommended that you increase the size of one of the
Xdimensions instead of shrinking the other, since shrinking looses
Xdetail.  For instance, many GIF images have an X:Y ratio of about 2:1.
XYou can correct this for viewing on a 1:1 display with either
X\fI-xzoom 50\fR or \fI-yzoom 200\fR (reduce X axis to 50% of its size
Xand expand Y axis to 200% of its size, respectively) but the latter
Xshould be used so no detail is lost in the conversion.
X.PP
XWhen zooming color images up you can reduce blockiness with
X\fI-smooth\fR.  For zooms of 300% or more, I recommend two smoothing
Xpasses (although this can take awhile to do on slow machines).  There
Xwill be a noticable improvement in the image.
X.PP
XWhen merging images, the first image loaded is used to determine the
Xdepth of the merged image.  This becomes a problem if the first image
Xis monochrome and other images are color, since the other images will
Xbe dithered to monochrome before merging.  You can get around this
Xbehavior by using the \fI-geometry\fR option to specify the size of
Xthe destination image -- this will force \fIxloadimage\fR to use the
Xdefault depth of the display instead of 1.  The standard behavior
Xmight be modified in the future if it becomes a problem.
X.PP
XYou can perform image processing on a small portion of an image by
Xloading the image more than once and using the \fI-at\fR and
X\fI-clip\fR options.  Load the image, then load it again and clip,
Xposition, and process the second.  To brighten a 100x100 rectangular
Xportion of an image located at (50,50), for instance, you could type:
X.sp
X.ti +5
Xxloadimage my.image -at 50,50 -clip 50,50,100,100 -brighten 150 my.image
X.PP
XOne common use of \fIxloadimage\fR is to load images onto the root
Xwindow.  Unfortunately there is no agreed-upon method of freeing some
Xroot window resources, such as colormap entries, nor is there a way to
Xmodify the root window colormap without confusing most window
Xmanagers.  For this reason, \fIxloadimage\fR will not allow the
Xloading of images onto the root window if it cannot allocate shared
Xcolors from the root window's colormap.  I suggest the avoidance of
Xmultiple color image loads onto the root window, as these eat up root
Xwindow shareable colormap entries.  If you wish to have a slideshow,
Xuse the \fI-slideshow\fR option.
X.PP
XOne common complaint is that \fIxloadimage\fR does not have a
X\fI-reverse\fR function for inverting monochrome images.  In fact,
Xthis function is a special-case of the foreground and background
Xcoloring options.  To invert an image with a black foreground and
Xwhite background (which is standard), use \fI-foreground white
X-background black\fR.  This will work on both color and monochrome
Xdisplays.
X.SH PATHS AND EXTENSIONS
XThe file ~/.xloadimagerc (and optionally a system-wide file) defines
Xthe path and default extensions that \fIxloadimage\fR will use when
Xlooking for images.  This file can have two statements: "path=" and
X"extension=" (the equals signs must follow the word with no spaces
Xbetween).  Everything following the "path=" keyword will be prepended
Xto the supplied image name if the supplied name does not specify an
Xexisting file.  The paths will be searched in the order they are
Xspecified.  Everything following the "extension=" keyword will be
Xappended to the supplied image name if the supplied name does not
Xspecify an existing file.  As with paths, these extensions will be
Xsearched in the order they are given.  Comments are any portion of a
Xline following a hash-mark (#).
X.PP
XThe following is a sample ~/.xloadimagerc file:
X.PP
X.nf
X  # paths to look for images in
X  path= /usr/local/images
X        /home/usr1/guest/madd/images
X        /usr/include/X11/bitmaps
X
X  # default extensions for images; .Z is automatic; scanned in order
X  extension= .csun .msun .sun .face .xbm .bm
X.fi
X.PP
XVersions of \fIxloadimage\fR prior to version 01, patchlevel 03 would
Xload the system-wide file (if any), followed by the user's file.  This
Xbehavior made it difficult for the user to configure her environment
Xif she didn't want the default.  Newer versions will ignore the
Xsystem-wide file if a personal configuration file exists.
X.SH IMAGE TYPES
X.PP
X\fIXloadimage\fR currently supports the following image types:
X.sp
X.nf
X  CMU Window Manager raster files
X  Faces Project images
X  Fuzzy Bitmap (FBM) images
X  GIF images
X  G3 FAX images
X  MacPaint images
X  Portable Bitmap (PBM) images
X  Sun monochrome rasterfiles
X  Sun color RGB rasterfiles
X  X pixmap files
X  X10 bitmap files
X  X11 bitmap files
X  Utah Raster Toolkit (RLE) files
X.fi
X.PP
XNormal, compact, and raw PBM images are supported.  Both standard and
Xrun-length encoded Sun rasterfiles are supported.  Any image whose
Xname ends in .Z is assumed to be a compressed image and will be
Xfiltered through "uncompress".
X.SH AUTHOR
X.nf
XJim Frost
XSaber Software
Xjimf@saber.com
X.fi
X.PP
XFor a more-or-less complete list of other contributors (there are a
X\fIlot\fR of them), please see the README file enclosed with the
Xdistribution.
X.SH FILES
X.nf
X.in +5
Xxloadimage              - the image loader and viewer
Xxsetbg                  - pseudonym which quietly sets the background
Xxview                   - pseudonym which views in a window
X/usr/lib/X11/Xloadimage - default system-wide configuration file
X~/.xloadimagerc         - user's personal configuration file
X.in -5
X.fi
X.SH COPYRIGHT
XCopyright (c) 1989, 1990 Jim Frost and others.
X.PP
X\fIXloadimage\fR is copywritten material with a very loose copyright
Xallowing unlimited modification and distribution if the copyright
Xnotices are left intact.  Various portions are copywritten by various
Xpeople, but all use a modification of the MIT copyright notice.
XPlease check the source for complete copyright information.  The
Xintent is to keep the source free, not to stifle its distribution, so
Xplease write to me if you have any questions.
X.SH BUGS
XZooming dithered images, especially downwards, is UGLY.
X.PP
XImages can come in a variety of aspect ratios.  \fIXloadimage\fR cannot
Xdetect what aspect ratio the particular image being loaded has, nor
Xthe aspect ratio of the destination display, so images with differing
Xaspect ratios from the destination display will appear distorted.  See
X\fIHINTS FOR GOOD IMAGE DISPLAYS\fR for more information.
X.PP
XThe GIF format allows more than one image to be stored in a single GIF
Xfile, but \fIxloadimage\fR will only display the first.
X.PP
XOnly PseudoColor, GrayScale, StaticColor, and StaticGray visuals are
Xsupported.  These are the most common visuals so this isn't usually a
Xproblem.
X.PP
XYou cannot load an image onto the root window if the default visual is
Xnot supported by \fIxloadimage\fR.
X.PP
XOne of the pseudonyms for \fIxloadimage\fR, \fIxview\fR, is the same
Xname as Sun uses for their SunView-under-X package.  This will be
Xconfusing if you're one of those poor souls who has to use Sun's
XXView.
X.PP
XSome window managers do not correctly handle window size requests.  In
Xparticular, many versions of the twm window manager use
Xthe MaxSize hint instead of the PSize hint, causing images which
Xare larger than the screen to display in a window larger than the
Xscreen, something which is normally avoided.  Some versions of twm
Xalso ignore the MaxSize argument's real function, to limit the maximum
Xsize of the window, and allow the window to be resized larger than the
Ximage.  If this happens, \fIxloadimage\fR merely places the image in
Xthe upper-left corner of the window and uses the zero-value'ed pixel
Xfor any space which is not covered by the image.  This behavior is
Xless-than-graceful but so are window managers which are cruel enough
Xto ignore such details.
X.PP
XThe order in which operations are performed on an image is independent
Xof the order in which they were specified on the command line.
XWherever possible I tried to order operations in such a way as to look
Xthe best possible (zooming before dithering, for instance) or to
Xincrease speed (zooming downward before compressing, for instance).
END_OF_FILE
if test 18198 -ne `wc -c <'xloadimage.man'`; then
    echo shar: \"'xloadimage.man'\" unpacked with wrong size!
fi
# end of 'xloadimage.man'
fi
if test -f 'copyright.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'copyright.h'\"
else
echo shar: Extracting \"'copyright.h'\" \(1090 characters\)
sed "s/^X//" >'copyright.h' <<'END_OF_FILE'
X#ifndef _JIM_COPYRIGHT_
X/*
X * Copyright 1989, 1990 Jim Frost
X *
X * Permission to use, copy, modify, distribute, and sell this software
X * and its documentation for any purpose is hereby granted without fee,
X * provided that the above copyright notice appear in all copies and
X * that both that copyright notice and this permission notice appear
X * in supporting documentation.  The author makes no representations
X * about the suitability of this software for any purpose.  It is
X * provided "as is" without express or implied warranty.
X *
X * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
X * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
X * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
X * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
X * USE OR PERFORMANCE OF THIS SOFTWARE.
X */
X
Xstatic char *Copyright= "Copyright 1989 Jim Frost";
X#define _JIM_COPYRIGHT_
X#endif
END_OF_FILE
if test 1090 -ne `wc -c <'copyright.h'`; then
    echo shar: \"'copyright.h'\" unpacked with wrong size!
fi
# end of 'copyright.h'
fi
if test -f 'fbm.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbm.h'\"
else
echo shar: Extracting \"'fbm.h'\" \(1917 characters\)
sed "s/^X//" >'fbm.h' <<'END_OF_FILE'
X/*****************************************************************
X * fbm.h: FBM Library 0.9 (Beta Test)  07-Mar-89  Michael Mauldin
X *
X * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
X * use this file in whole or in part provided that you do not sell it
X * for profit and that this copyright notice is retained unchanged.
X *
X * fbm.h: Fuzzy Bitmap Definition
X *
X *****************************************************************/
X
Xtypedef unsigned char BYTE;	/* 8 bits unsigned		*/
X
X# define FBM_MAX_TITLE		80		/* For title and credits */
X
X# define BIG			1		/* msb first byte order */
X# define LITTLE			0		/* lsb first byte order */
X
X#define FBMIN_SUCCESS       0   /* success */
X
X#define FBMIN_ERR_BAD_SD   -1   /* bad screen descriptor */
X#define FBMIN_ERR_BAD_SIG  -2   /* bad signature */
X#define FBMIN_ERR_EOD      -3   /* unexpected end of raster data */
X#define FBMIN_ERR_EOF      -4   /* unexpected end of input stream */
X#define FBMIN_ERR_FAO      -5   /* file already open */
X#define FBMIN_ERR_IAO      -6   /* image already open */
X#define FBMIN_ERR_NFO      -7   /* no file open */
X#define FBMIN_ERR_NIO      -8   /* no image open */
X
X# define FBM_MAGIC	"%bitmap"
X
X/* FBM bitmap headers in files (null terminated 12 character ascii strings) */
Xtypedef struct fbm_filehdr_struct {
X	char	magic[8];		/* 2 bytes FBM_MAGIC number */
X	char	cols[8];		/* Width in pixels */
X	char	rows[8];		/* Height in pixels */
X	char	planes[8];		/* Depth (1 for B+W, 3 for RGB) */
X	char	bits[8];		/* Bits per pixel */
X	char	physbits[8];		/* Bits to store each pixel */
X	char	rowlen[12];		/* Length of a row in bytes */
X	char	plnlen[12];		/* Length of a plane in bytes */
X	char	clrlen[12];		/* Length of colormap in bytes */
X	char	aspect[12];		/* ratio of Y to X of one pixel */
X	char	title[FBM_MAX_TITLE];	/* Null terminated title */
X	char	credits[FBM_MAX_TITLE];	/* Null terminated credits */
X} FBMFILEHDR;
END_OF_FILE
if test 1917 -ne `wc -c <'fbm.h'`; then
    echo shar: \"'fbm.h'\" unpacked with wrong size!
fi
# end of 'fbm.h'
fi
if test -f 'g3.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'g3.h'\"
else
echo shar: Extracting \"'g3.h'\" \(6806 characters\)
sed "s/^X//" >'g3.h' <<'END_OF_FILE'
X/* g3.h - header file for group 3 FAX compression filters
X*/
X
X#define MAXCOLS 2550	/* Maximum image size is 8.5"x11" @ 300dpi */
X#define MAXROWS 3300
X
X#define TWTABLE		23
X#define MWTABLE		24
X#define TBTABLE		25
X#define MBTABLE		26
X#define EXTABLE		27
X#define VRTABLE		28
X
X#define WHASHA 3510
X#define WHASHB 1178
X#define BHASHA 293
X#define BHASHB 2695
X#define HASHSIZE 1021
X
X#ifndef _G3_H_
X#define _G3_H_
X
Xtypedef unsigned char bit;
X
Xint	bmask[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
X
Xtypedef struct tableentry {
X    int tabid;
X    int code;
X    int length;
X    int count;
X    } tableentry;
X
Xstruct tableentry twtable[] = {
X    { TWTABLE, 0x35, 8, 0 },
X    { TWTABLE, 0x7, 6, 1 },
X    { TWTABLE, 0x7, 4, 2 },
X    { TWTABLE, 0x8, 4, 3 },
X    { TWTABLE, 0xb, 4, 4 },
X    { TWTABLE, 0xc, 4, 5 },
X    { TWTABLE, 0xe, 4, 6 },
X    { TWTABLE, 0xf, 4, 7 },
X    { TWTABLE, 0x13, 5, 8 },
X    { TWTABLE, 0x14, 5, 9 },
X    { TWTABLE, 0x7, 5, 10 },
X    { TWTABLE, 0x8, 5, 11 },
X    { TWTABLE, 0x8, 6, 12 },
X    { TWTABLE, 0x3, 6, 13 },
X    { TWTABLE, 0x34, 6, 14 },
X    { TWTABLE, 0x35, 6, 15 },
X    { TWTABLE, 0x2a, 6, 16 },
X    { TWTABLE, 0x2b, 6, 17 },
X    { TWTABLE, 0x27, 7, 18 },
X    { TWTABLE, 0xc, 7, 19 },
X    { TWTABLE, 0x8, 7, 20 },
X    { TWTABLE, 0x17, 7, 21 },
X    { TWTABLE, 0x3, 7, 22 },
X    { TWTABLE, 0x4, 7, 23 },
X    { TWTABLE, 0x28, 7, 24 },
X    { TWTABLE, 0x2b, 7, 25 },
X    { TWTABLE, 0x13, 7, 26 },
X    { TWTABLE, 0x24, 7, 27 },
X    { TWTABLE, 0x18, 7, 28 },
X    { TWTABLE, 0x2, 8, 29 },
X    { TWTABLE, 0x3, 8, 30 },
X    { TWTABLE, 0x1a, 8, 31 },
X    { TWTABLE, 0x1b, 8, 32 },
X    { TWTABLE, 0x12, 8, 33 },
X    { TWTABLE, 0x13, 8, 34 },
X    { TWTABLE, 0x14, 8, 35 },
X    { TWTABLE, 0x15, 8, 36 },
X    { TWTABLE, 0x16, 8, 37 },
X    { TWTABLE, 0x17, 8, 38 },
X    { TWTABLE, 0x28, 8, 39 },
X    { TWTABLE, 0x29, 8, 40 },
X    { TWTABLE, 0x2a, 8, 41 },
X    { TWTABLE, 0x2b, 8, 42 },
X    { TWTABLE, 0x2c, 8, 43 },
X    { TWTABLE, 0x2d, 8, 44 },
X    { TWTABLE, 0x4, 8, 45 },
X    { TWTABLE, 0x5, 8, 46 },
X    { TWTABLE, 0xa, 8, 47 },
X    { TWTABLE, 0xb, 8, 48 },
X    { TWTABLE, 0x52, 8, 49 },
X    { TWTABLE, 0x53, 8, 50 },
X    { TWTABLE, 0x54, 8, 51 },
X    { TWTABLE, 0x55, 8, 52 },
X    { TWTABLE, 0x24, 8, 53 },
X    { TWTABLE, 0x25, 8, 54 },
X    { TWTABLE, 0x58, 8, 55 },
X    { TWTABLE, 0x59, 8, 56 },
X    { TWTABLE, 0x5a, 8, 57 },
X    { TWTABLE, 0x5b, 8, 58 },
X    { TWTABLE, 0x4a, 8, 59 },
X    { TWTABLE, 0x4b, 8, 60 },
X    { TWTABLE, 0x32, 8, 61 },
X    { TWTABLE, 0x33, 8, 62 },
X    { TWTABLE, 0x34, 8, 63 },
X    };
X
Xstruct tableentry mwtable[] = {
X    { MWTABLE, 0x1b, 5, 64 },
X    { MWTABLE, 0x12, 5, 128 },
X    { MWTABLE, 0x17, 6, 192 },
X    { MWTABLE, 0x37, 7, 256 },
X    { MWTABLE, 0x36, 8, 320 },
X    { MWTABLE, 0x37, 8, 384 },
X    { MWTABLE, 0x64, 8, 448 },
X    { MWTABLE, 0x65, 8, 512 },
X    { MWTABLE, 0x68, 8, 576 },
X    { MWTABLE, 0x67, 8, 640 },
X    { MWTABLE, 0xcc, 9, 704 },
X    { MWTABLE, 0xcd, 9, 768 },
X    { MWTABLE, 0xd2, 9, 832 },
X    { MWTABLE, 0xd3, 9, 896 },
X    { MWTABLE, 0xd4, 9, 960 },
X    { MWTABLE, 0xd5, 9, 1024 },
X    { MWTABLE, 0xd6, 9, 1088 },
X    { MWTABLE, 0xd7, 9, 1152 },
X    { MWTABLE, 0xd8, 9, 1216 },
X    { MWTABLE, 0xd9, 9, 1280 },
X    { MWTABLE, 0xda, 9, 1344 },
X    { MWTABLE, 0xdb, 9, 1408 },
X    { MWTABLE, 0x98, 9, 1472 },
X    { MWTABLE, 0x99, 9, 1536 },
X    { MWTABLE, 0x9a, 9, 1600 },
X    { MWTABLE, 0x18, 6, 1664 },
X    { MWTABLE, 0x9b, 9, 1728 },
X    };
X
Xstruct tableentry tbtable[] = {
X    { TBTABLE, 0x37, 10, 0 },
X    { TBTABLE, 0x2, 3, 1 },
X    { TBTABLE, 0x3, 2, 2 },
X    { TBTABLE, 0x2, 2, 3 },
X    { TBTABLE, 0x3, 3, 4 },
X    { TBTABLE, 0x3, 4, 5 },
X    { TBTABLE, 0x2, 4, 6 },
X    { TBTABLE, 0x3, 5, 7 },
X    { TBTABLE, 0x5, 6, 8 },
X    { TBTABLE, 0x4, 6, 9 },
X    { TBTABLE, 0x4, 7, 10 },
X    { TBTABLE, 0x5, 7, 11 },
X    { TBTABLE, 0x7, 7, 12 },
X    { TBTABLE, 0x4, 8, 13 },
X    { TBTABLE, 0x7, 8, 14 },
X    { TBTABLE, 0x18, 9, 15 },
X    { TBTABLE, 0x17, 10, 16 },
X    { TBTABLE, 0x18, 10, 17 },
X    { TBTABLE, 0x8, 10, 18 },
X    { TBTABLE, 0x67, 11, 19 },
X    { TBTABLE, 0x68, 11, 20 },
X    { TBTABLE, 0x6c, 11, 21 },
X    { TBTABLE, 0x37, 11, 22 },
X    { TBTABLE, 0x28, 11, 23 },
X    { TBTABLE, 0x17, 11, 24 },
X    { TBTABLE, 0x18, 11, 25 },
X    { TBTABLE, 0xca, 12, 26 },
X    { TBTABLE, 0xcb, 12, 27 },
X    { TBTABLE, 0xcc, 12, 28 },
X    { TBTABLE, 0xcd, 12, 29 },
X    { TBTABLE, 0x68, 12, 30 },
X    { TBTABLE, 0x69, 12, 31 },
X    { TBTABLE, 0x6a, 12, 32 },
X    { TBTABLE, 0x6b, 12, 33 },
X    { TBTABLE, 0xd2, 12, 34 },
X    { TBTABLE, 0xd3, 12, 35 },
X    { TBTABLE, 0xd4, 12, 36 },
X    { TBTABLE, 0xd5, 12, 37 },
X    { TBTABLE, 0xd6, 12, 38 },
X    { TBTABLE, 0xd7, 12, 39 },
X    { TBTABLE, 0x6c, 12, 40 },
X    { TBTABLE, 0x6d, 12, 41 },
X    { TBTABLE, 0xda, 12, 42 },
X    { TBTABLE, 0xdb, 12, 43 },
X    { TBTABLE, 0x54, 12, 44 },
X    { TBTABLE, 0x55, 12, 45 },
X    { TBTABLE, 0x56, 12, 46 },
X    { TBTABLE, 0x57, 12, 47 },
X    { TBTABLE, 0x64, 12, 48 },
X    { TBTABLE, 0x65, 12, 49 },
X    { TBTABLE, 0x52, 12, 50 },
X    { TBTABLE, 0x53, 12, 51 },
X    { TBTABLE, 0x24, 12, 52 },
X    { TBTABLE, 0x37, 12, 53 },
X    { TBTABLE, 0x38, 12, 54 },
X    { TBTABLE, 0x27, 12, 55 },
X    { TBTABLE, 0x28, 12, 56 },
X    { TBTABLE, 0x58, 12, 57 },
X    { TBTABLE, 0x59, 12, 58 },
X    { TBTABLE, 0x2b, 12, 59 },
X    { TBTABLE, 0x2c, 12, 60 },
X    { TBTABLE, 0x5a, 12, 61 },
X    { TBTABLE, 0x66, 12, 62 },
X    { TBTABLE, 0x67, 12, 63 },
X    };
X
Xstruct tableentry mbtable[] = {
X    { MBTABLE, 0xf, 10, 64 },
X    { MBTABLE, 0xc8, 12, 128 },
X    { MBTABLE, 0xc9, 12, 192 },
X    { MBTABLE, 0x5b, 12, 256 },
X    { MBTABLE, 0x33, 12, 320 },
X    { MBTABLE, 0x34, 12, 384 },
X    { MBTABLE, 0x35, 12, 448 },
X    { MBTABLE, 0x6c, 13, 512 },
X    { MBTABLE, 0x6d, 13, 576 },
X    { MBTABLE, 0x4a, 13, 640 },
X    { MBTABLE, 0x4b, 13, 704 },
X    { MBTABLE, 0x4c, 13, 768 },
X    { MBTABLE, 0x4d, 13, 832 },
X    { MBTABLE, 0x72, 13, 896 },
X    { MBTABLE, 0x73, 13, 960 },
X    { MBTABLE, 0x74, 13, 1024 },
X    { MBTABLE, 0x75, 13, 1088 },
X    { MBTABLE, 0x76, 13, 1152 },
X    { MBTABLE, 0x77, 13, 1216 },
X    { MBTABLE, 0x52, 13, 1280 },
X    { MBTABLE, 0x53, 13, 1344 },
X    { MBTABLE, 0x54, 13, 1408 },
X    { MBTABLE, 0x55, 13, 1472 },
X    { MBTABLE, 0x5a, 13, 1536 },
X    { MBTABLE, 0x5b, 13, 1600 },
X    { MBTABLE, 0x64, 13, 1664 },
X    { MBTABLE, 0x65, 13, 1728 },
X    };
X
Xstruct tableentry extable[] = {
X    { EXTABLE, 0x8, 11, 1792 },
X    { EXTABLE, 0xc, 11, 1856 },
X    { EXTABLE, 0xd, 11, 1920 },
X    { EXTABLE, 0x12, 12, 1984 },
X    { EXTABLE, 0x13, 12, 2048 },
X    { EXTABLE, 0x14, 12, 2112 },
X    { EXTABLE, 0x15, 12, 2176 },
X    { EXTABLE, 0x16, 12, 2240 },
X    { EXTABLE, 0x17, 12, 2304 },
X    { EXTABLE, 0x1c, 12, 2368 },
X    { EXTABLE, 0x1d, 12, 2432 },
X    { EXTABLE, 0x1e, 12, 2496 },
X    { EXTABLE, 0x1f, 12, 2560 },
X    };
X
X#endif /*_G3_H_*/
END_OF_FILE
if test 6806 -ne `wc -c <'g3.h'`; then
    echo shar: \"'g3.h'\" unpacked with wrong size!
fi
# end of 'g3.h'
fi
if test -f 'gif.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'gif.h'\"
else
echo shar: Extracting \"'gif.h'\" \(1969 characters\)
sed "s/^X//" >'gif.h' <<'END_OF_FILE'
X/* gif.h:
X *
X * gifin.h
X * kirk johnson
X * november 1989
X * external interface to gifin.c
X *
X * Copyright 1989 Kirk L. Johnson (see the included file
X * "kljcpyrght.h" for complete copyright information)
X */
X
X/*
X * gifin return codes
X */
X#define GIFIN_SUCCESS       0   /* success */
X#define GIFIN_DONE          1   /* no more images */
X
X#define GIFIN_ERR_BAD_SD   -1   /* bad screen descriptor */
X#define GIFIN_ERR_BAD_SEP  -2   /* bad image separator */
X#define GIFIN_ERR_BAD_SIG  -3   /* bad signature */
X#define GIFIN_ERR_EOD      -4   /* unexpected end of raster data */
X#define GIFIN_ERR_EOF      -5   /* unexpected end of input stream */
X#define GIFIN_ERR_FAO      -6   /* file already open */
X#define GIFIN_ERR_IAO      -7   /* image already open */
X#define GIFIN_ERR_NFO      -8   /* no file open */
X#define GIFIN_ERR_NIO      -9   /* no image open */
X
X/*
X * colormap indices 
X */
X
X#define GIF_RED  0
X#define GIF_GRN  1
X#define GIF_BLU  2
X
X/*
X * typedef BYTE for convenience
X */
X
Xtypedef unsigned char BYTE;
X
Xstatic int gifin_open_file();
Xstatic int gifin_open_image();
Xstatic int gifin_get_pixel();
Xstatic int gifin_close_image();
Xstatic int gifin_close_file();
Xstatic int gifin_load_cmap();
Xstatic int gifin_skip_extension();
Xstatic int gifin_read_data_block();
Xstatic int gifin_push_string();
Xstatic int gifin_add_string();
Xstatic int gifin_fatal();
X
X/* #defines, typedefs, and such
X */
X
X#define GIF_SIG      "GIF87a"
X#define GIF_SIG_LEN  6          /* GIF signature length */
X#define GIF_SD_SIZE  7          /* GIF screen descriptor size */
X#define GIF_ID_SIZE  9          /* GIF image descriptor size */
X
X#define GIF_SEPARATOR   ','     /* GIF image separator */
X#define GIF_EXTENSION   '!'     /* GIF extension block marker */
X#define GIF_TERMINATOR  ';'     /* GIF terminator */
X
X#define STAB_SIZE  4096         /* string table size */
X#define PSTK_SIZE  1024         /* pixel stack size */
X
X#define NULL_CODE  -1           /* string table null code */
END_OF_FILE
if test 1969 -ne `wc -c <'gif.h'`; then
    echo shar: \"'gif.h'\" unpacked with wrong size!
fi
# end of 'gif.h'
fi
if test -f 'hash.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'hash.h'\"
else
echo shar: Extracting \"'hash.h'\" \(1518 characters\)
sed "s/^X//" >'hash.h' <<'END_OF_FILE'
X/*
X * Determine colormap of rgb tuple and remap for xloadimage
X *
X * Portions of this were borrowed from the PBMPLUS software package
X * written by Jef Poskanzer (see Copyright below)
X */
X/*
X** Copyright (C) 1989 by Jef Poskanzer.
X**
X** Permission to use, copy, modify, and distribute this software and its
X** documentation for any purpose and without fee is hereby granted, provided
X** that the above copyright notice appear in all copies and that both that
X** copyright notice and this permission notice appear in supporting
X** documentation.  This software is provided "as is" without express or
X** implied warranty.
X*/
X
X#define PM_SCALE(a, b, c) (long)((a) * (c))/(b)
X#define HASHLEN 6553
X#define HashRGB(r, g, b)  ((r)*33023 + (g)*30013 + (b)*27011) % HASHLEN
X
Xtypedef struct hash_elem *hash_ent;
X
Xstruct hash_elem
X{
X	struct pix
X	{ unsigned int r,g,b;} pix;
X	unsigned long mapnum;
X	struct hash_elem *next;
X};
X
Xtypedef hash_ent *hash_list;
X
X/* Get memory set up for hashing */
Xhash_list init_hash();
X
X/* Add a colour to the hashing list */
Xvoid add_hash( /* hash_list hl; unsigned int r,g,b */ );
X
X/* Count the colours in the map */
Xint count_hash( /* hash_list hl */);
X
X/* Fill a colour map from hash_list */
Xint fill_map( /* hash_list hl; RGBMap *rgbm; unsigned int maxval */ );
X
X/* Find map value from rgb triplet */
Xunsigned int find_hash( /* hash_list hl; unsigned int r,g,b */ );
X
X/* Free hash list */
Xvoid free_hash( /* hash_list hl */ );
X
X/* Free hash list element */
Xvoid free_helem( /* hash_ent he */ );
END_OF_FILE
if test 1518 -ne `wc -c <'hash.h'`; then
    echo shar: \"'hash.h'\" unpacked with wrong size!
fi
# end of 'hash.h'
fi
if test -f 'image.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'image.h'\"
else
echo shar: Extracting \"'image.h'\" \(2846 characters\)
sed "s/^X//" >'image.h' <<'END_OF_FILE'
X/* image.h:
X *
X * portable image type declarations
X *
X * jim frost 10.02.89
X *
X * Copyright 1989 Jim Frost.  See included file "copyright.h" for complete
X * copyright information.
X */
X
X#include "copyright.h"
X#include <stdio.h>
X
Xtypedef unsigned long  Pixel;     /* what X thinks a pixel is */
Xtypedef unsigned short Intensity; /* what X thinks an RGB intensity is */
Xtypedef unsigned char  byte;      /* byte type */
X
Xstruct cache {
X  unsigned int  len;
X  char          buf[BUFSIZ];
X  struct cache *next;
X};
X
Xtypedef struct {
X  unsigned int  type;     /* ZIO file type */
X  FILE         *stream;   /* file input stream */
X  char         *filename; /* filename */
X  struct cache *data;     /* data cache */
X  struct cache *dataptr;  /* ptr to current cache block */
X  int           bufptr;   /* ptr within current cache block */
X} ZFILE;
X
X#define ZSTANDARD 0 /* standard file */
X#define ZPIPE     1 /* file is a pipe (ie uncompress) */
X#define ZSTDIN    2 /* file is stdin */
X
Xtypedef struct rgbmap {
X  unsigned int  size;  /* size of RGB map */
X  unsigned int  used;  /* number of colors used in RGB map */
X  Intensity    *red;   /* color values in X style */
X  Intensity    *green;
X  Intensity    *blue;
X} RGBMap;
X
X/* image structure
X */
X
Xtypedef struct {
X  char         *title;  /* name of image */
X  unsigned int  type;   /* type of image */
X  RGBMap        rgb;    /* RGB map of image if IRGB type */
X  unsigned int  width;  /* width of image in pixels */
X  unsigned int  height; /* height of image in pixels */
X  unsigned int  depth;  /* depth of image in bits if IRGB type */
X  unsigned int  pixlen; /* length of pixel if IRGB type */
X  byte         *data;   /* data rounded to full byte for each row */
X} Image;
X
X#define IBITMAP 0 /* image is a bitmap */
X#define IRGB    1 /* image is RGB */
X
X#define BITMAPP(IMAGE) ((IMAGE)->type == IBITMAP)
X#define RGBP(IMAGE)    ((IMAGE)->type == IRGB)
X
X/* function declarations
X */
X
XImage *clip(); /* clip.c */
X
Xvoid brighten(); /* bright.c */
X
Xvoid compress(); /* compress.c */
X
XImage *dither(); /* dither.c */
X
Xvoid fill(); /* fill.c */
X
Xvoid fold(); /* fold.c */
X
XImage *halftone(); /* halftone.c */
X
XImage *loadImage(); /* imagetypes.c */
Xvoid   identifyImage();
Xvoid   goodImage();
X
XZFILE *zopen(); /* io.c */
Xint    zread();
Xint    zgetc();
Xchar  *zgets();
Xvoid   zclose();
X
Xvoid merge(); /* merge.c */
X
Xchar  *dupString(); /* new.c */
XImage *newBitImage();
XImage *newRGBImage();
Xvoid   freeImage();
Xvoid   freeImageData();
Xvoid   newRGBMapData();
Xvoid   freeRGBMapData();
Xbyte  *lcalloc();
Xbyte  *lmalloc();
Xvoid   lfree();
X
Xvoid reduceRGBMap(); /* reduce.c */
Xvoid reduce();
X
Xunsigned long memToVal(); /* value.c */
Xvoid          valToMem();
Xunsigned long memToValLSB();
Xvoid          valToMemLSB();
X
XImage *zoom(); /* zoom.c */
XImage *rotate(); /* rotate.c */
XImage *smooth(); /* smooth.c */
END_OF_FILE
if test 2846 -ne `wc -c <'image.h'`; then
    echo shar: \"'image.h'\" unpacked with wrong size!
fi
# end of 'image.h'
fi
if test -f 'imagetypes.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'imagetypes.h'\"
else
echo shar: Extracting \"'imagetypes.h'\" \(1551 characters\)
sed "s/^X//" >'imagetypes.h' <<'END_OF_FILE'
X/* imagetypes.h:
X *
X * supported image types and the imagetypes array declaration.  when you
X * add a new image type, only the makefile and this header need to be
X * changed.
X *
X * jim frost 10.15.89
X */
X
XImage *facesLoad();
XImage *pbmLoad();
XImage *sunRasterLoad();
XImage *gifLoad();
XImage *rleLoad();
XImage *xwdLoad();
XImage *xbitmapLoad();
XImage *xpixmapLoad();
XImage *g3Load();
XImage *fbmLoad();
XImage *macLoad();
XImage *cmuwmLoad();
X
Xint facesIdent();
Xint pbmIdent();
Xint sunRasterIdent();
Xint gifIdent();
Xint rleIdent();
Xint xwdIdent();
Xint xbitmapIdent();
Xint xpixmapIdent();
Xint g3Ident();
Xint fbmIdent();
Xint macIdent();
Xint cmuwmIdent();
X
X/* some of these are order-dependent
X */
X
Xstruct {
X  int    (*identifier)(); /* print out image info if this kind of image */
X  Image *(*loader)();     /* load image if this kind of image */
X  char  *name;            /* name of this image format */
X} ImageTypes[] = {
X  fbmIdent,       fbmLoad,       "FBM Image",
X  sunRasterIdent, sunRasterLoad, "Sun Rasterfile",
X  cmuwmIdent,     cmuwmLoad,     "CMU WM Raster",
X  pbmIdent,       pbmLoad,       "Portable Bit Map (PBM)",
X  facesIdent,     facesLoad,     "Faces Project",
X  gifIdent,       gifLoad,       "GIF Image",
X  rleIdent,       rleLoad,       "Utah RLE Image",
X  xwdIdent,       xwdLoad,       "X Window Dump",
X  macIdent,       macLoad,       "MacPaint Image",
X  xpixmapIdent,   xpixmapLoad,   "X Pixmap",
X  xbitmapIdent,   xbitmapLoad,   "X Bitmap",
X  g3Ident,        g3Load,        "G3 FAX Image",
X  NULL,           NULL,          NULL
X};
END_OF_FILE
if test 1551 -ne `wc -c <'imagetypes.h'`; then
    echo shar: \"'imagetypes.h'\" unpacked with wrong size!
fi
# end of 'imagetypes.h'
fi
if test -f 'kljcpyrght.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kljcpyrght.h'\"
else
echo shar: Extracting \"'kljcpyrght.h'\" \(1099 characters\)
sed "s/^X//" >'kljcpyrght.h' <<'END_OF_FILE'
X#ifndef _KLJ_COPYRIGHT_
X
X/****
X  Copyright 1989, 1990 Kirk L. Johnson
X
X  Permission to use, copy, modify, distribute, and sell this
X  software and its documentation for any purpose is hereby granted
X  without fee, provided that the above copyright notice appear in
X  all copies and that both that copyright notice and this
X  permission notice appear in supporting documentation. The
X  author makes no representations about the suitability of this
X  software for any purpose. It is provided "as is" without express
X  or implied warranty.
X
X  THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
X  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
X  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT
X  OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
X  NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
X  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X****/
X
Xstatic char *KLJCopyright = "Copyright 1989, 1990 Kirk L. Johnson";
X#define _KLJ_COPYRIGHT_
X#endif
END_OF_FILE
if test 1099 -ne `wc -c <'kljcpyrght.h'`; then
    echo shar: \"'kljcpyrght.h'\" unpacked with wrong size!
fi
# end of 'kljcpyrght.h'
fi
if test -f 'mac.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mac.h'\"
else
echo shar: Extracting \"'mac.h'\" \(1213 characters\)
sed "s/^X//" >'mac.h' <<'END_OF_FILE'
X/****************************************************************
X * mac.h:
X *
X * adapted from code by Patrick Naughton (naughton@sun.soe.clarkson.edu)
X *
X * macin.h
X * Mark Majhor
X * August 1990
X *
X * routines for reading MAC files
X *
X * Copyright 1990 Mark Majhor (see the included file
X * "mrmcpyrght.h" for complete copyright information)
X *
X ****************************************************************/
X
X# define MAC_MAGIC	0x0
X
Xtypedef unsigned char BYTE;	/* 8 bits unsigned		*/
X
X/*
X * macin return codes
X */
X#define MACIN_SUCCESS       0   /* success */
X
X#define MACIN_ERR_BAD_SD   -1   /* bad screen descriptor */
X#define MACIN_ERR_BAD_SIG  -2   /* bad signature */
X#define MACIN_ERR_EOD      -3   /* unexpected end of raster data */
X#define MACIN_ERR_EOF      -4   /* unexpected end of input stream */
X#define MACIN_ERR_FAO      -5   /* file already open */
X#define MACIN_ERR_IAO      -6   /* image already open */
X#define MACIN_ERR_NFO      -7   /* no file open */
X#define MACIN_ERR_NIO      -8   /* no image open */
X
Xstatic int macin_open_image();
Xstatic int macin_close_file();
Xstatic int macin_fatal();
X
X#define	MAC_HDR_LEN	512
X#define ADD_HDR_LEN	128
X#define	MAX_LINES	720
X#define	BYTES_LINE	72
END_OF_FILE
if test 1213 -ne `wc -c <'mac.h'`; then
    echo shar: \"'mac.h'\" unpacked with wrong size!
fi
# end of 'mac.h'
fi
if test -f 'mit.cpyrght' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mit.cpyrght'\"
else
echo shar: Extracting \"'mit.cpyrght'\" \(1292 characters\)
sed "s/^X//" >'mit.cpyrght' <<'END_OF_FILE'
X#ifndef _MIT_COPYRIGHT_
X/*
X * Copyright 1989 Massachusetts Institute of Technology
X *
X * Permission to use, copy, modify, distribute, and sell this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of M.I.T. not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  M.I.T. makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
X * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
X * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
X * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
X */
X
Xstatic char *MitCopyright=
X  "Copyright 1989 Massachusetts Institute of Technology";
X#define _MIT_COPYRIGHT_
X#endif
END_OF_FILE
if test 1292 -ne `wc -c <'mit.cpyrght'`; then
    echo shar: \"'mit.cpyrght'\" unpacked with wrong size!
fi
# end of 'mit.cpyrght'
fi
echo shar: End of archive 2 \(of 9\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 9 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

dan
----------------------------------------------------
O'Reilly && Associates   argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.