[comp.sources.x] v05i038: cxpr -- color xpr program, Part01/01

argv@island.uu.net (Dan Heller) (12/06/89)

Submitted-by: uunet!relay.EU.net!sgzh!root (Bruno Pape)
Posting-number: Volume 5, Issue 38
Archive-name: cxpr/part01



[ From the README ]
These are the routines to cxpr.  This version of cxpr is based on the xpr
program provided in the MIT X core distribution.  It uses the output of
xwd to produce a postscript program and image data that when printed
on a color postscript printer generate an image of the window dumped with 
xwd.  This cxpr uses the XY format of xwd as opposed to the Z format used
by the orignal xpr, only outputs for color postscript printers, only
outputs compressed color images, and has only been tested on a Sun 3/60 C/G.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of shell archive."
# Contents:  cxpr cxpr/Makefile cxpr/README cxpr/cxpr.c cxpr/cxpr.h
#   cxpr/dump_prolog.c cxpr/epilog.h cxpr/escape.c cxpr/fullread.c
#   cxpr/hex.h cxpr/invbits.c cxpr/parse_args.c cxpr/points.c
#   cxpr/print_header.c cxpr/prolog.h cxpr/ps_finish.c
#   cxpr/ps_output.c cxpr/ps_putbuf.c cxpr/ps_setup.c
#   cxpr/read_colormaps.c cxpr/read_header.c cxpr/read_window_name.c
#   cxpr/reverse_byte.h cxpr/setup_layout.c cxpr/swapbits.c
#   cxpr/swaplong.c cxpr/swapshort.c
# Wrapped by argv@island on Tue Dec  5 11:40:44 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d 'cxpr' ; then
    echo shar: Creating directory \"'cxpr'\"
    mkdir 'cxpr'
fi
if test -f 'cxpr/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/Makefile'\"
else
echo shar: Extracting \"'cxpr/Makefile'\" \(1298 characters\)
sed "s/^X//" >'cxpr/Makefile' <<'END_OF_FILE'
X###########################################################################
X# start of Imakefile
X
X OBJS = dump_prolog.o		\
X	escape.o		\
X	fullread.o		\
X	invbits.o		\
X	parse_args.o		\
X	points.o		\
X	print_header.o		\
X	ps_finish.o		\
X	ps_output.o		\
X	ps_putbuf.o		\
X	ps_setup.o		\
X	read_colormaps.o	\
X	read_header.o		\
X	read_window_name.o	\
X	setup_layout.o		\
X	swapbits.o		\
X	swaplong.o		\
X	swapshort.o		\
X	cxpr.o
X
X SRCS = dump_prolog.c		\
X	escape.c		\
X	fullread.c		\
X	invbits.c		\
X	parse_args.c		\
X	points.c		\
X	print_header.c		\
X	ps_finish.c		\
X	ps_output.c		\
X	ps_putbuf.c		\
X	ps_setup.c		\
X	read_colormaps.c	\
X	read_header.c		\
X	read_window_name.c	\
X	setup_layout.c		\
X	swapbits.c		\
X	swaplong.c		\
X	swapshort.c		\
X	cxpr.c
X
X PROGRAM = cxpr
X
Xall:: cxpr
X
Xcxpr:   $(OBJS) $(LOCAL_LIBRARIES)
X	$(RM) $@
X	$(CC) -g -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES)
X
Xrelink::
X	$(RM) $(PROGRAM)
X	$(MAKE) $(MFLAGS) $(PROGRAM)
X
Xdepend:: $(DEPEND)
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
X
X$(DEPEND):
X	@echo "making $@"; \
X	cd $(DEPENDSRC); $(MAKE)
X
Xclean::
X	$(RM) $(PROGRAM)
X
X###########################################################################
X# Imake.tmpl common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
END_OF_FILE
if test 1298 -ne `wc -c <'cxpr/Makefile'`; then
    echo shar: \"'cxpr/Makefile'\" unpacked with wrong size!
fi
# end of 'cxpr/Makefile'
fi
if test -f 'cxpr/README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/README'\"
else
echo shar: Extracting \"'cxpr/README'\" \(3654 characters\)
sed "s/^X//" >'cxpr/README' <<'END_OF_FILE'
X/*
X *	Author:	  G. Bruno Pape, Computer Consultant, B.S. Computer Engineering
X *
X *	Address:  P.O. Box 368, Thomaston, Connecticut, 06787, USA.
X *	
X *	Copyright (c) G. Bruno Pape 1989.
X *	All rights reserved.
X *
X *	Permission is granted to anyone to use this software for any purpose on
X *	any computer system, and to alter it and redistribute it freely, subject
X *	to the following restrictions:
X *	
X *	1. The author is not responsible for the consequences of use or
X *	redistribution of this software, no matter how awful.
X *	
X *	2. The origin of this software must not be misrepresented, either by
X *	explicit claim or by omission.
X *	
X *	3. Altered versions must be plainly marked as such, and must not be
X *	misrepresented as being the original software. 
X *	
X *	4. This notice may not be removed or altered.
X *	
X *
X *	First distribution, November 30, 1989.
X *
X *	This software was developed while on holiday in Switzerland which
X *	is why some things are in centimeters, pages are A4.
X *
X *	I also do systems programming and administration in BSD and System V
X *	UNIX environments, network and network application development,
X *	X-Windows application development, 3D graphic and graphic animation
X *	program development, computational fluid dynamics, expert systems,
X *	and almost anything else you might want done with a computer.
X *	My favorite computer is a MAC, but I only do development work on Suns,
X *	Silicon Graphics, DECs, Crays, and of course IBM mainframes. 
X */
X
XCXPR:
X
XThese are the routines to cxpr.  This version of cxpr is based on the xpr
Xprogram provided in the MIT X core distribution.  It uses the output of
Xxwd to produce a postscript program and image data that when printed
Xon a color postscript printer generate an image of the window dumped with 
Xxwd.  This cxpr uses the XY format of xwd as opposed to the Z format used
Xby the orignal xpr, only outputs for color postscript printers, only
Xoutputs compressed color images, and has only been tested on a Sun 3/60 C/G.
X
Xcxpr:
Xtotal 38
X-rw-r--r--  1 bruno    users        1287 Jul  7 14:30 Makefile
X-rw-r--r--  1 bruno    users         106 Jul  7 13:50 dump_prolog.c
X-rw-r--r--  1 bruno    users          60 Jul  7 13:50 epilog.h
X-rw-r--r--  1 bruno    users         380 Jul  7 13:50 escape.c
X-rw-r--r--  1 bruno    users         508 Jul  7 13:50 fullread.c
X-rw-r--r--  1 bruno    users         649 Jul  7 13:50 hex.h
X-rw-r--r--  1 bruno    users         115 Jul  7 13:50 invbits.c
X-rw-r--r--  1 bruno    users        3611 Jul  7 14:05 parse_args.c
X-rw-r--r--  1 bruno    users         114 Jul  7 13:50 points.c
X-rw-r--r--  1 bruno    users        2142 Jul  7 14:09 print_header.c
X-rw-r--r--  1 bruno    users        1936 Jul  7 15:36 prolog.h
X-rw-r--r--  1 bruno    users          94 Jul  7 13:50 ps_finish.c
X-rw-r--r--  1 bruno    users        1303 Jul  7 15:21 ps_output.c
X-rw-r--r--  1 bruno    users        1253 Jul  7 13:50 ps_putbuf.c
X-rw-r--r--  1 bruno    users        3345 Jul  7 13:50 ps_setup.c
X-rw-r--r--  1 bruno    users         509 Jul  7 14:25 read_colormaps.c
X-rw-r--r--  1 bruno    users         604 Jul  7 13:50 read_header.c
X-rw-r--r--  1 bruno    users         251 Jul  7 13:51 read_window_name.c
X-rw-r--r--  1 bruno    users        1600 Jul  7 13:51 reverse_byte.h
X-rw-r--r--  1 bruno    users         918 Jul  7 13:51 setup_layout.c
X-rw-r--r--  1 bruno    users         196 Jul  7 13:51 swapbits.c
X-rw-r--r--  1 bruno    users         279 Jul  7 13:51 swaplong.c
X-rw-r--r--  1 bruno    users         200 Jul  7 13:51 swapshort.c
X-rw-r--r--  1 bruno    users         291 Jul  7 13:51 xpr.c
X-rw-r--r--  1 bruno    users        1003 Jul  7 14:04 xpr.h
X
END_OF_FILE
if test 3654 -ne `wc -c <'cxpr/README'`; then
    echo shar: \"'cxpr/README'\" unpacked with wrong size!
fi
# end of 'cxpr/README'
fi
if test -f 'cxpr/cxpr.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/cxpr.c'\"
else
echo shar: Extracting \"'cxpr/cxpr.c'\" \(292 characters\)
sed "s/^X//" >'cxpr/cxpr.c' <<'END_OF_FILE'
X#include "cxpr.h"
X#include "hex.h"
X
Xmain(argc, argv)
Xchar **argv;
X{
X	parse_args (argc, argv);
X
X	if ( read_header() ) exit(1);
X
X	read_window_name();
X
X	if ( win.ncolors ) read_colormaps();
X
X	setup_layout();
X
X	if ( flags & F_DEBUG ) print_header();
X
X	ps_setup();
X
X	ps_output();
X
X	ps_finish();
X}
END_OF_FILE
if test 292 -ne `wc -c <'cxpr/cxpr.c'`; then
    echo shar: \"'cxpr/cxpr.c'\" unpacked with wrong size!
fi
# end of 'cxpr/cxpr.c'
fi
if test -f 'cxpr/cxpr.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/cxpr.h'\"
else
echo shar: Extracting \"'cxpr/cxpr.h'\" \(1003 characters\)
sed "s/^X//" >'cxpr/cxpr.h' <<'END_OF_FILE'
X#include <X11/Xlib.h>
X#include <sys/uio.h>
X#include <stdio.h>
X#include <fcntl.h>
X#include <pwd.h>
X#include <X11/XWDFile.h>
X
X#define W_MAX 2400
X#define H_MAX 3150
X
X#define US_PAPER_WIDTH	2550		/* 8.5 inches * 300 DPI */
X#define US_PAPER_LENGTH	3300		/* 11 inches  * 300 DPI */
X
X#define PAPER_WIDTH	2430		/* 21.0 cm / 2.54 cm/inch * 300 DPI */
X#define PAPER_LENGTH	3480		/* 29.5 cm / 2.54 cm/inch * 300 DPI */
X
X#define COMMENTVERSION "PS-Adobe-1.0"
X
X#define min(x,y) (((x)<(y))?(x):(y))
X
X#define F_PORTRAIT	  1
X#define F_LANDSCAPE	  2
X#define F_DEBUG		  4
X#define F_APPEND	 16
X#define F_NOFF		 32
X#define F_COMPACT	128
X#define F_INVERT	256
X
X#define LINELEN 72      /* number of CHARS (bytes*2) per line of bitmap output*/
X
XXWDFileHeader	win;
XXColor		*colors;
X
Xchar		*infilename	= "stdin",
X		*header		= NULL,
X		*trailer	= NULL,
X		*window_name,
X		*escape();
X
Xint		top_margin,
X		left_margin,
X		scale	=  0,
X		split	=  1,
X		top	= -1,
X		left	= -1,
X		width	= -1,
X		height	= -1,
X		flags	= F_PORTRAIT,
X		points();
END_OF_FILE
if test 1003 -ne `wc -c <'cxpr/cxpr.h'`; then
    echo shar: \"'cxpr/cxpr.h'\" unpacked with wrong size!
fi
# end of 'cxpr/cxpr.h'
fi
if test -f 'cxpr/dump_prolog.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/dump_prolog.c'\"
else
echo shar: Extracting \"'cxpr/dump_prolog.c'\" \(106 characters\)
sed "s/^X//" >'cxpr/dump_prolog.c' <<'END_OF_FILE'
X#include "prolog.h"
X
Xdump_prolog(flags) {
X    char **p = ps_prolog;
X    while (*p) printf("%s\n",*p++);
X}
END_OF_FILE
if test 106 -ne `wc -c <'cxpr/dump_prolog.c'`; then
    echo shar: \"'cxpr/dump_prolog.c'\" unpacked with wrong size!
fi
# end of 'cxpr/dump_prolog.c'
fi
if test -f 'cxpr/epilog.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/epilog.h'\"
else
echo shar: Extracting \"'cxpr/epilog.h'\" \(60 characters\)
sed "s/^X//" >'cxpr/epilog.h' <<'END_OF_FILE'
Xchar *ps_epilog[] = {
X	"",
X	"showpage",
X	"%%Trailer",
X	0
X};
END_OF_FILE
if test 60 -ne `wc -c <'cxpr/epilog.h'`; then
    echo shar: \"'cxpr/epilog.h'\" unpacked with wrong size!
fi
# end of 'cxpr/epilog.h'
fi
if test -f 'cxpr/escape.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/escape.c'\"
else
echo shar: Extracting \"'cxpr/escape.c'\" \(380 characters\)
sed "s/^X//" >'cxpr/escape.c' <<'END_OF_FILE'
X/*
X *	make a version of s in which control characters are deleted and
X *	special characters are escaped.
X */
X
Xchar *escape(s)
Xchar *s;
X{
X    static char buf[200];
X    char *p = buf;
X
X    for (;*s;s++) {
X	if (*s < ' ' || *s > 0176) continue;
X	if (*s==')' || *s=='(' || *s == '\\') {
X	    sprintf(p,"\\%03o",*s);
X	    p += 4;
X	}
X	else *p++ = *s;
X    }
X    *p = 0;
X    return buf;
X}
END_OF_FILE
if test 380 -ne `wc -c <'cxpr/escape.c'`; then
    echo shar: \"'cxpr/escape.c'\" unpacked with wrong size!
fi
# end of 'cxpr/escape.c'
fi
if test -f 'cxpr/fullread.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/fullread.c'\"
else
echo shar: Extracting \"'cxpr/fullread.c'\" \(508 characters\)
sed "s/^X//" >'cxpr/fullread.c' <<'END_OF_FILE'
X#include <stdio.h>
X
X/*
X *	fullread() is the same as read(), except that it guarantees to 
X *	read all the bytes requested.
X */
X
Xfullread (file, data, nbytes)
Xint file;
Xchar *data;
Xint nbytes;
X{
X	int bytes_read;
X	while ((bytes_read = read(file, data, nbytes)) != nbytes) {
X		if (bytes_read < 0) {
X			perror ("error while reading standard input");
X			return;
X		} else if (bytes_read == 0) {
X			fprintf (stderr, "xpr: premature end of file\n");
X			return;
X		}
X		nbytes -= bytes_read;
X		data += bytes_read;
X	}
X}
END_OF_FILE
if test 508 -ne `wc -c <'cxpr/fullread.c'`; then
    echo shar: \"'cxpr/fullread.c'\" unpacked with wrong size!
fi
# end of 'cxpr/fullread.c'
fi
if test -f 'cxpr/hex.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/hex.h'\"
else
echo shar: Extracting \"'cxpr/hex.h'\" \(649 characters\)
sed "s/^X//" >'cxpr/hex.h' <<'END_OF_FILE'
X/*
X * mapping tables to map a byte in to the hex representation of its
X * bit-reversal
X */
X
Xchar hex1[]="084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f\
X084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f\
X084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f\
X084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f084c2a6e195d3b7f";
X
Xchar hex2[]="000000000000000088888888888888884444444444444444cccccccccccccccc\
X2222222222222222aaaaaaaaaaaaaaaa6666666666666666eeeeeeeeeeeeeeee\
X111111111111111199999999999999995555555555555555dddddddddddddddd\
X3333333333333333bbbbbbbbbbbbbbbb7777777777777777ffffffffffffffff";
END_OF_FILE
if test 649 -ne `wc -c <'cxpr/hex.h'`; then
    echo shar: \"'cxpr/hex.h'\" unpacked with wrong size!
fi
# end of 'cxpr/hex.h'
fi
if test -f 'cxpr/invbits.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/invbits.c'\"
else
echo shar: Extracting \"'cxpr/invbits.c'\" \(115 characters\)
sed "s/^X//" >'cxpr/invbits.c' <<'END_OF_FILE'
X_invbits (b, n)
Xregister unsigned char *b;
Xregister long n;
X{
X	do {
X		*b = ~*b;
X		b++;
X	    } while (--n > 0);
X	
X}
END_OF_FILE
if test 115 -ne `wc -c <'cxpr/invbits.c'`; then
    echo shar: \"'cxpr/invbits.c'\" unpacked with wrong size!
fi
# end of 'cxpr/invbits.c'
fi
if test -f 'cxpr/parse_args.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/parse_args.c'\"
else
echo shar: Extracting \"'cxpr/parse_args.c'\" \(3611 characters\)
sed "s/^X//" >'cxpr/parse_args.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <fcntl.h>
X#include <X11/XWDFile.h>
X
X#define F_PORTRAIT	  1
X#define F_DEBUG		  4
X#define F_APPEND	 16
X#define F_NOFF		 32
X#define F_COMPACT	128
X#define F_INVERT	256
X
Xextern	XWDFileHeader	win;
Xextern	char		*infilename, *header, *trailer, *window_name;
Xextern	int		top_margin, left_margin, scale, split,
X			top, left, width, height, flags;
X
Xparse_args(argc, argv)
X
Xregister	int	argc;
Xregister	char	**argv;
X
X{
X
X    char	*output_filename	= NULL;
X    register	int	f, len, pos;
X    double	atof();
X    int		atoi();
X
X    argc--;
X    argv++;
X
X    while ( argc > 0 && argv[0][0] == '-' ) {
X	len = strlen(*argv);
X	switch (argv[0][1]) {
X	case 'a':		/* -append <filename> */
X	    if (!bcmp(*argv, "-append", len)) {
X		argc--; argv++;
X		output_filename = *argv;
X		flags |= F_APPEND;
X	    }
X	    break;
X
X	case 'd':
X	    if (!bcmp(*argv, "-debug", len)) flags |= F_DEBUG;
X	    break;
X
X	case 'h':		/* -height <inches> */
X	    if (len <= 3) {
X		fprintf(stderr, "xpr: ambiguous option: \"%s\"\n", *argv);
X		exit(1);
X	    }
X	    if (!bcmp(*argv, "-height", len)) {
X		argc--; argv++;
X		height = (int)(300.0 * atof(*argv));
X	    } else if (!bcmp(*argv, "-header", len)) {
X		argc--; argv++;
X		header = *argv;
X	    }
X	    break;
X
X	case 'l':		/* -landscape | -left <inches> */
X	    if (!bcmp(*argv, "-landscape", len)) {
X		flags &= ~F_PORTRAIT;
X	    } else if (!bcmp(*argv, "-left", len)) {
X		argc--; argv++;
X		left = (int)(300.0 * atof(*argv));
X	    }
X	    break;
X
X	case 'n':		/*  -noff */
X	    if (!bcmp(*argv, "-noff", len)) {
X		flags |= F_NOFF;
X	    }
X	    break;
X
X	case 'o':		/* -output <filename> */
X	    if (!bcmp(*argv, "-output", len)) {
X		argc--; argv++;
X		output_filename = *argv;
X	    }
X	    break;
X
X	case 'p':		/* -portrait */
X	    if (!bcmp(*argv, "-portrait", len)) {
X		flags |= F_PORTRAIT;
X	    }
X	    break;
X
X	case 'c':		/* -compact */
X	    if (!bcmp(*argv, "-compact", len)) {
X		flags |= F_COMPACT;
X	    }
X	    break;
X
X	case 'r':		/* -rv */
X	    if (!bcmp(*argv, "-rv", len)) {
X		flags |= F_INVERT;
X	    }
X	    break;
X
X	case 's':		/* -scale <scale> | -split <n-pages> */
X	    if (!bcmp(*argv, "-scale", len)) {
X		argc--; argv++;
X		scale = atoi(*argv);
X	    } else if (!bcmp(*argv, "-split", len)) {
X		argc--; argv++;
X		split = atoi(*argv);
X	    }
X	    break;
X
X	case 't':		/* -top <inches> */
X	    if (len <= 2) {
X		fprintf(stderr, "xpr: ambigous option: \"%s\"\n", *argv);
X		exit(1);
X	    }
X	    if (!bcmp(*argv, "-top", len)) {
X		argc--; argv++;
X		top = (int)(300.0 * atof(*argv));
X	    } else if (!bcmp(*argv, "-trailer", len)) {
X		argc--; argv++;
X		trailer = *argv;
X	    }
X	    break;
X
X	case 'w':		/* -width <inches> */
X	    if (!bcmp(*argv, "-width", len)) {
X		argc--; argv++;
X		width = (int)(300.0 * atof(*argv));
X	    }
X	    break;
X
X	}
X	argc--; argv++;
X    }
X
X    if (argc > 0) {
X	f = open(*argv, O_RDONLY, 0);
X	if (f < 0) {
X	    fprintf(stderr, "xpr: error opening \"%s\" for input\n", *argv);
X	    perror("");
X	    exit(1);
X	}
X	dup2(f, 0);
X	close(f);
X	infilename = *argv;
X    }
X
X    if (output_filename != NULL) {
X	if (!(flags & F_APPEND)) {
X	    f = open(output_filename, O_CREAT|O_WRONLY|O_TRUNC, 0664);
X	} else {
X	    f = open(output_filename, O_WRONLY, 0);
X	}
X	if (f < 0) {
X	    fprintf(stderr, "xpr: error opening \"%s\" for output\n", 
X		    output_filename);
X	    perror("xpr");
X	    exit(1);
X	}
X	if (flags & F_APPEND) {
X	    pos = lseek(f, 0, 2);          /* get eof position */
X	    if (flags & F_NOFF) pos -= 3; /* set position before trailing */
X					   /*     formfeed and reset */
X	    lseek(f, pos, 0);              /* set pointer */
X	}
X	dup2(f, 1);
X	close(f);
X    }
X}
END_OF_FILE
if test 3611 -ne `wc -c <'cxpr/parse_args.c'`; then
    echo shar: \"'cxpr/parse_args.c'\" unpacked with wrong size!
fi
# end of 'cxpr/parse_args.c'
fi
if test -f 'cxpr/points.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/points.c'\"
else
echo shar: Extracting \"'cxpr/points.c'\" \(114 characters\)
sed "s/^X//" >'cxpr/points.c' <<'END_OF_FILE'
Xint points(n)
X{
X    /* scale n from pixels (1/300 inch) to points (1/72 inch) */
X    n *= 72;
X    return n/300;
X}
END_OF_FILE
if test 114 -ne `wc -c <'cxpr/points.c'`; then
    echo shar: \"'cxpr/points.c'\" unpacked with wrong size!
fi
# end of 'cxpr/points.c'
fi
if test -f 'cxpr/print_header.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/print_header.c'\"
else
echo shar: Extracting \"'cxpr/print_header.c'\" \(2142 characters\)
sed "s/^X//" >'cxpr/print_header.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/XWDFile.h>
X
X#define F_PORTRAIT	  1
X
Xextern	XWDFileHeader	win;
Xextern	XColor		*colors;
Xextern	int		flags, scale;
X
Xprint_header()
X{
X	register	i;
X	fprintf(stderr, "header size	= %d\n", win.header_size);	 
X	fprintf(stderr, "file version	= %d\n", win.file_version);	
X	fprintf(stderr, "pixmap format	= %s\n",
X		(win.pixmap_format==XYPixmap) ? "XYPixmap" : "ZPixmap" );
X	fprintf(stderr, "pixmap depth	= %d\n", win.pixmap_depth);
X	fprintf(stderr, "pixmap width	= %d\n", win.pixmap_width);
X	fprintf(stderr, "pixmap height	= %d\n", win.pixmap_height);
X	fprintf(stderr, "xoffset     	= %d\n", win.xoffset);     
X	fprintf(stderr, "byte order  	= %d\n", win.byte_order); 
X	fprintf(stderr, "bitmap unit	= %d\n", win.bitmap_unit);
X	fprintf(stderr, "bitmap order	= %d\n", win.bitmap_bit_order);  
X	fprintf(stderr, "bitmap pad  	= %d\n", win.bitmap_pad);	
X	fprintf(stderr, "bits per pixel	= %d\n", win.bits_per_pixel);
X	fprintf(stderr, "bytes per line	= %d\n", win.bytes_per_line);	
X	fprintf(stderr, "visual class	= %d\n", win.visual_class);
X	fprintf(stderr, "red mask   	= %d\n", win.red_mask);	  
X	fprintf(stderr, "green mask  	= %d\n", win.green_mask);
X	fprintf(stderr, "blue mask  	= %d\n", win.blue_mask);	
X	fprintf(stderr, "bits per rgb	= %d\n", win.bits_per_rgb);
X	fprintf(stderr, "colormap entrs	= %d\n", win.colormap_entries); 
X	fprintf(stderr, "ncolors     	= %d\n", win.ncolors);	
X	fprintf(stderr, "window width	= %d\n", win.window_width);	
X	fprintf(stderr, "window height	= %d\n", win.window_height);
X	fprintf(stderr, "window x    	= %d\n", win.window_x);	
X	fprintf(stderr, "window y   	= %d\n", win.window_y);
X	fprintf(stderr, "window brd wid	= %d\n", win.window_bdrwidth);
X	fprintf(stderr, "Orientation: %s, Scale: %d\n", 
X		( flags & F_PORTRAIT ) ? "Portrait" : "Landscape", scale);
X        for ( i = 0; i < 6; i++ ) {
X		fprintf(stderr, "colors[%d].pixel = %d\n", i, colors[i].pixel );
X		fprintf(stderr, "colors[%d].red   = %d\n", i, colors[i].red );
X		fprintf(stderr, "colors[%d].green = %d\n", i, colors[i].green );
X		fprintf(stderr, "colors[%d].blue  = %d\n", i, colors[i].blue );
X	}
X}
END_OF_FILE
if test 2142 -ne `wc -c <'cxpr/print_header.c'`; then
    echo shar: \"'cxpr/print_header.c'\" unpacked with wrong size!
fi
# end of 'cxpr/print_header.c'
fi
if test -f 'cxpr/prolog.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/prolog.h'\"
else
echo shar: Extracting \"'cxpr/prolog.h'\" \(1936 characters\)
sed "s/^X//" >'cxpr/prolog.h' <<'END_OF_FILE'
X/*
X *	postscript "program" to unpack and print the bitmaps being sent
X */
X
Xchar *ps_prolog[] = {
X
X"%%Pages: 1",
X"%%EndProlog",
X"%%Page: 1 1",
X"",
X"/bitgen",
X"	{",
X"		/out_buff exch def",
X"		{",
X"			in_buff_index	in_buff_len	eq {",
X"				currentfile in_buff readhexstring pop pop",
X"				/in_buff_index 0 def",
X"			} if",
X"",
X"			/leng	in_buff	in_buff_index	get def",
X"			/in_buff_index	in_buff_index 1	add def",
X"			/byte	in_buff	in_buff_index	get def",
X"			/in_buff_index	in_buff_index 1	add def",
X"			/bytes	leng	out_buff_index	add def",
X"",
X"			bytes width lt {",
X"				out_buff_index 1 bytes 1 sub",
X"				{ out_buff exch byte put } for",
X"				/out_buff_index out_buff_index leng add def",
X"			} if",
X"			bytes width eq {",
X"				out_buff_index 1 width 1 sub",
X"				{ out_buff exch byte put } for",
X"				/out_buff_index 0 def",
X"				out_buff",
X"				exit",
X"			} if",
X"			bytes width gt {",
X"				out_buff_index 1 width 1 sub",
X"				{ out_buff exch byte put } for",
X"				/in_buff_index in_buff_index 1 sub def",
X"				/in_buff_index in_buff_index 1 sub def",
X"				in_buff in_buff_index",
X"				out_buff_index leng add width sub put",
X"				/out_buff_index 0 def",
X"				out_buff",
X"				exit",
X"			} if",
X"		} loop",
X"	} def",
X"",
X"",
X"/bitdump	% stack: width, height, scale",
X"		% dump a bit image with lower left corner at origin",
X"	{",
X"		% read arguments",
X"		/iscale exch def",
X"		/height exch def",
X"		/width exch def",
X"",
X"		/in_buff_len	40			def",
X"		/in_buff	in_buff_len	string	def",
X"		/in_buff_index	in_buff_len		def",
X"		/red_buff	width		string	def",
X"		/grn_buff	width		string	def",
X"		/blu_buff	width		string	def",
X"		/out_buff_index	0			def",
X"",
X"		% scale appropriately",
X"		width iscale mul height iscale mul scale",
X"",
X"		% read and dump the image",
X"		width height 8 [width 0 0 height neg 0 height]",
X"			{ red_buff bitgen }",
X"			{ grn_buff bitgen }",
X"			{ blu_buff bitgen } true 3 colorimage",
X"	} def",
X"gsave",
X0
X};
END_OF_FILE
if test 1936 -ne `wc -c <'cxpr/prolog.h'`; then
    echo shar: \"'cxpr/prolog.h'\" unpacked with wrong size!
fi
# end of 'cxpr/prolog.h'
fi
if test -f 'cxpr/ps_finish.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/ps_finish.c'\"
else
echo shar: Extracting \"'cxpr/ps_finish.c'\" \(94 characters\)
sed "s/^X//" >'cxpr/ps_finish.c' <<'END_OF_FILE'
X#include "epilog.h"
X
Xps_finish()
X{
X	char **p = ps_epilog;
X
X	while (*p) printf("%s\n",*p++);
X}
END_OF_FILE
if test 94 -ne `wc -c <'cxpr/ps_finish.c'`; then
    echo shar: \"'cxpr/ps_finish.c'\" unpacked with wrong size!
fi
# end of 'cxpr/ps_finish.c'
fi
if test -f 'cxpr/ps_output.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/ps_output.c'\"
else
echo shar: Extracting \"'cxpr/ps_output.c'\" \(1303 characters\)
sed "s/^X//" >'cxpr/ps_output.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/XWDFile.h>
X
X#define F_PORTRAIT	  1
X#define F_DEBUG		  4
X#define F_COMPACT	128
X#define F_INVERT	256
X
Xextern	XWDFileHeader	win;
X
Xextern	XColor		*colors;
X
Xps_output()
X{
X	int			iw = win.pixmap_width, ih = win.pixmap_height; 
X	int			iwb = win.bytes_per_line;
X	char			*buffer, *color_buffer;
X	unsigned	long	swaptest = 1;
X	register	int	i, j, k, l;
X	static		char	hex[]	= "0123456789abcdef";
X	extern		char	hex1[], hex2[];
X
X	if ( (buffer=(char *)malloc((unsigned)( ih*iw+iwb-iw ))) == NULL ) {
X		fprintf(stderr,"xpr: cannot allocate %d bytes\n",ih*iw+iwb-iw);
X		exit(1);
X	}
X	if ( (color_buffer=(char *)malloc((unsigned)( ih*iw*3 ))) == NULL ) {
X		fprintf(stderr,"xpr: cannot allocate %d bytes\n",ih*iw*3);
X		exit(1);
X	}
X
X	for ( i = 0; i < ih; i++ ) fullread( 0, (char *) &buffer[i*iw], iwb );
X
X	for ( i = 0, k = 0; i < ih; i++ ) {
X		for ( j = i * iw; j < i * iw + iw; j++ ) 
X			color_buffer[k++] = colors[buffer[j]].red / 257;
X		for ( j = i * iw; j < i * iw + iw; j++ ) 
X			color_buffer[k++] = colors[buffer[j]].green / 257;
X		for ( j = i * iw; j < i * iw + iw; j++ ) 
X			color_buffer[k++] = colors[buffer[j]].blue / 257;
X	}
X
X	if (win.bitmap_bit_order == MSBFirst)
X		_swapbits( color_buffer, (long) ih * iw * 3 );
X
X	ps_putbuf( color_buffer, ih * iw * 3 );
X}
END_OF_FILE
if test 1303 -ne `wc -c <'cxpr/ps_output.c'`; then
    echo shar: \"'cxpr/ps_output.c'\" unpacked with wrong size!
fi
# end of 'cxpr/ps_output.c'
fi
if test -f 'cxpr/ps_putbuf.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/ps_putbuf.c'\"
else
echo shar: Extracting \"'cxpr/ps_putbuf.c'\" \(1253 characters\)
sed "s/^X//" >'cxpr/ps_putbuf.c' <<'END_OF_FILE'
X/*
X *	Dump some bytes in hex, with bits in each byte reversed.
X */
X
Xint ps_putbuf( buffer, bytes )
Xregister unsigned	char	*buffer;
Xregister		int	bytes;
X{
X	register		int	run_length = 0, count = 0;
X	register unsigned	char	current_byte = *buffer;
X	static			char	hex[] = "0123456789abcdef";
X	extern			char	hex1[], hex2[];
X
X	while ( bytes-- ) {
X		if ( *buffer != current_byte || ++run_length == 255 ) {
X			if ( ++count > 20 ) {
X				printf("\n");
X				count = 1;
X			}
X			putchar ( hex[ run_length >>  4 ] );
X			putchar ( hex[ run_length & 0xf ] );
X/*			printf  ( " < run_length = %d\t", run_length );	*/
X			putchar ( hex1[ current_byte ] );
X			putchar ( hex2[ current_byte ] );
X/*			printf  ( " < current_byte %d\n", current_byte );	*/
X			if ( run_length == 255 ) {
X				run_length = 0;
X				current_byte = *( buffer + 1 );
X			} else {
X				run_length = 1;
X				current_byte = *buffer;
X			}
X		}
X		buffer++;
X	}
X	if ( run_length > 0 ) {
X		if ( ++count > 20 ) {
X			printf("\n");
X			count = 1;
X		}
X		putchar ( hex[ run_length >>  4 ] );
X		putchar ( hex[ run_length & 0xf ] );
X		putchar ( hex1[ current_byte ] );
X		putchar ( hex2[ current_byte ] );
X	}
X	while ( count != 20 ) {
X		count++;
X		putchar ( '0' );
X		putchar ( '0' );
X		putchar ( '0' );
X		putchar ( '0' );
X	}
X}
END_OF_FILE
if test 1253 -ne `wc -c <'cxpr/ps_putbuf.c'`; then
    echo shar: \"'cxpr/ps_putbuf.c'\" unpacked with wrong size!
fi
# end of 'cxpr/ps_putbuf.c'
fi
if test -f 'cxpr/ps_setup.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/ps_setup.c'\"
else
echo shar: Extracting \"'cxpr/ps_setup.c'\" \(3345 characters\)
sed "s/^X//" >'cxpr/ps_setup.c' <<'END_OF_FILE'
X#include <pwd.h>
X#include <X11/XWDFile.h>
X
X#define PAPER_WIDTH	2430		/* 21.0 cm / 2.54 cm/inch * 300 DPI */
X#define PAPER_LENGTH	3480		/* 29.5 cm / 2.54 cm/inch * 300 DPI */
X
X#define COMMENTVERSION "PS-Adobe-1.0"
X
X#define F_PORTRAIT	  1
X#define F_DEBUG		  4
X#define F_APPEND	 16
X#define F_NOFF		 32
X#define F_COMPACT	128
X#define F_INVERT	256
X
Xextern	XWDFileHeader	win;
Xextern	char		*infilename, *header, *trailer, *window_name;
Xextern	int		scale, top, left, width, height, flags;
Xextern	char		*escape();
X
Xps_setup()
X{
X    char	hostname[256];
X    struct	passwd	*pswd;
X    long	clock;
X    int		lm, bm; /* left and bottom margins in portrait orientation */
X    int		iw = win.pixmap_width, ih = win.pixmap_height; 
X
X    pswd = getpwuid (getuid ());
X    (void) gethostname (hostname, sizeof(hostname) );
X
X    printf ("%%!%s\n", COMMENTVERSION);
X    printf ("%%%%Creator: %s:%s (%s)\n",hostname,pswd->pw_name,pswd->pw_gecos);
X    printf ("%%%%Title: %s (%s)\n", infilename, window_name );
X    printf ("%%%%CreationDate: %s", (time (&clock), ctime (&clock)));
X    printf ("%%%%EndComments\n");
X
X    dump_prolog(flags);
X
X    if ( flags & F_PORTRAIT ) {
X	lm = (left > 0)? left : ((PAPER_WIDTH - scale * iw) / 2);
X	bm = (top > 0)? (PAPER_LENGTH - top - scale * ih)
X		: ((PAPER_LENGTH - scale * ih) / 2);
X	if (header || trailer) {
X	    printf("gsave\n");
X	    printf("/Times-Roman findfont 15 scalefont setfont\n");
X	    /* origin at bottom left corner of image */
X	    printf("%d %d translate\n",points(lm),points(bm));
X	    if (header) {
X		char *label = escape(header);
X		printf("%d (%s) stringwidth pop sub 2 div %d moveto\n",
X		    points(iw*scale), label, points(ih*scale) + 10);
X		printf("(%s) show\n",label);
X	    }
X	    if (trailer) {
X		char *label = escape(trailer);
X		printf("%d (%s) stringwidth pop sub 2 div -20 moveto\n",
X		    points(iw*scale), label);
X		printf("(%s) show\n",label);
X	    }
X	    printf("grestore\n");
X	}
X	/* set resolution to device units (300/inch) */
X	printf("72 300 div dup scale\n");
X	/* move to lower left corner of image */
X	printf("%d %d translate\n",lm,bm);
X	/* dump the bitmap */
X	printf("%d %d %d bitdump\n",iw,ih,scale);
X    } else { /* orientation == LANDSCAPE */
X	/* calculate margins */
X	lm = (top > 0)? (PAPER_WIDTH - top - scale * ih)
X		: ((PAPER_WIDTH - scale * ih) / 2);
X	bm = (left > 0)? (PAPER_LENGTH - left - scale * iw)
X		: ((PAPER_LENGTH - scale * iw) / 2);
X
X	if (header || trailer) {
X	    printf("gsave\n");
X	    printf("/Times-Roman findfont 15 scalefont setfont\n");
X	    /* origin at top left corner of image */
X	    printf("%d %d translate\n",points(lm),points(bm + scale * iw));
X	    /* rotate to print the titles */
X	    printf("-90 rotate\n");
X	    if (header) {
X		char *label = escape(header);
X		printf("%d (%s) stringwidth pop sub 2 div %d moveto\n",
X		    points(iw*scale), label, points(ih*scale) + 10);
X		printf("(%s) show\n",label);
X	    }
X	    if (trailer) {
X		char *label = escape(trailer);
X		printf("%d (%s) stringwidth pop sub 2 div -20 moveto\n",
X		    points(iw*scale), label);
X		printf("(%s) show\n",label);
X	    }
X	    printf("grestore\n");
X	}
X	/* set resolution to device units (300/inch) */
X	printf("72 300 div dup scale\n");
X	/* move to lower left corner of image */
X	printf("%d %d translate\n",lm,bm);
X	/* dump the bitmap */
X	printf("%d %d %d bitdump\n",ih,iw,scale);
X    }
X}
END_OF_FILE
if test 3345 -ne `wc -c <'cxpr/ps_setup.c'`; then
    echo shar: \"'cxpr/ps_setup.c'\" unpacked with wrong size!
fi
# end of 'cxpr/ps_setup.c'
fi
if test -f 'cxpr/read_colormaps.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/read_colormaps.c'\"
else
echo shar: Extracting \"'cxpr/read_colormaps.c'\" \(509 characters\)
sed "s/^X//" >'cxpr/read_colormaps.c' <<'END_OF_FILE'
X#include <X11/Xlib.h>
X#include <X11/XWDFile.h>
X
Xextern		XWDFileHeader	win;
Xextern		XColor		*colors;
X
Xread_colormaps()
X{
X	register	i;
X	unsigned long	swaptest = 1;
X
X	colors = (XColor*)malloc((unsigned)(win.ncolors*sizeof(XColor)));
X
X	fullread(0, (char *)colors, (int) (win.ncolors * sizeof(XColor)));
X
X	if (*(char *) &swaptest) {
X	    for (i = 0; i < win.ncolors; i++) {
X		_swaplong((char *) &colors[i].pixel, (long) sizeof(long));
X		_swapshort((char *) &colors[i].red, (long) (3 * sizeof(short)));
X	    }
X	}
X}
END_OF_FILE
if test 509 -ne `wc -c <'cxpr/read_colormaps.c'`; then
    echo shar: \"'cxpr/read_colormaps.c'\" unpacked with wrong size!
fi
# end of 'cxpr/read_colormaps.c'
fi
if test -f 'cxpr/read_header.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/read_header.c'\"
else
echo shar: Extracting \"'cxpr/read_header.c'\" \(604 characters\)
sed "s/^X//" >'cxpr/read_header.c' <<'END_OF_FILE'
X#include <X11/XWDFile.h>
X#include <stdio.h>
X
XXWDFileHeader	win;
X
Xread_header()
X{
X    unsigned long	swaptest = 1;
X
X    fullread(0, (char *) &win, sizeof(win) );
X
X    if (*(char *) &swaptest) _swaplong((char *) &win, (long)sizeof(win));
X
X    if (win.file_version != XWD_FILE_VERSION) {
X	fprintf(stderr,"xpr: file format version missmatch.\n");
X	return(1);
X    }
X
X    if (win.header_size < sizeof(win)) {
X	fprintf(stderr,"xpr: header size is too small.\n");
X	return(1);
X    }
X
X    if (win.byte_order != win.bitmap_bit_order)
X        fprintf(stderr,"xpr: image will be incorrect, byte swapping error.\n");
X}
END_OF_FILE
if test 604 -ne `wc -c <'cxpr/read_header.c'`; then
    echo shar: \"'cxpr/read_header.c'\" unpacked with wrong size!
fi
# end of 'cxpr/read_header.c'
fi
if test -f 'cxpr/read_window_name.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/read_window_name.c'\"
else
echo shar: Extracting \"'cxpr/read_window_name.c'\" \(251 characters\)
sed "s/^X//" >'cxpr/read_window_name.c' <<'END_OF_FILE'
X#include <X11/XWDFile.h>
X
Xextern	XWDFileHeader	win;
Xextern	char		*window_name;
X
Xread_window_name()
X{
X    window_name = (char *)malloc((unsigned)(win.header_size - sizeof(win)));
X    fullread(0, window_name, (int) (win.header_size - sizeof(win) ) );
X}
END_OF_FILE
if test 251 -ne `wc -c <'cxpr/read_window_name.c'`; then
    echo shar: \"'cxpr/read_window_name.c'\" unpacked with wrong size!
fi
# end of 'cxpr/read_window_name.c'
fi
if test -f 'cxpr/reverse_byte.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/reverse_byte.h'\"
else
echo shar: Extracting \"'cxpr/reverse_byte.h'\" \(1600 characters\)
sed "s/^X//" >'cxpr/reverse_byte.h' <<'END_OF_FILE'
Xchar _reverse_byte[0x100] = {
X	0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
X	0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
X	0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
X	0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
X	0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
X	0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
X	0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
X	0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
X	0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
X	0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
X	0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
X	0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
X	0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
X	0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
X	0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
X	0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
X	0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
X	0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
X	0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
X	0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
X	0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
X	0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
X	0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
X	0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
X	0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
X	0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
X	0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
X	0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
X	0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
X	0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
X	0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
X	0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
X};
END_OF_FILE
if test 1600 -ne `wc -c <'cxpr/reverse_byte.h'`; then
    echo shar: \"'cxpr/reverse_byte.h'\" unpacked with wrong size!
fi
# end of 'cxpr/reverse_byte.h'
fi
if test -f 'cxpr/setup_layout.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/setup_layout.c'\"
else
echo shar: Extracting \"'cxpr/setup_layout.c'\" \(918 characters\)
sed "s/^X//" >'cxpr/setup_layout.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <X11/XWDFile.h>
X
X#define min(x,y) (((x)<(y))?(x):(y))
X#define F_PORTRAIT	  1
X#define W_MAX 2400
X#define H_MAX 3150
X
Xextern	char		*header, *trailer;
Xextern	XWDFileHeader	win;
Xextern	int		scale, width, height, flags;
X
Xsetup_layout()
X{
X	register	w_scale, w_max, h_scale, h_max;
X
X	if (header != NULL)	win.pixmap_height += 75;
X	if (trailer != NULL)	win.pixmap_height += 75;
X
X	/* check maximum width and height; set orientation and scale */
X
X	if ( flags & F_PORTRAIT ) {
X	    w_max	= (width  > 0)? width  : W_MAX;
X	    h_max	= (height > 0)? height : H_MAX;
X	    w_scale	= w_max / win.pixmap_width;
X	    h_scale	= h_max / win.pixmap_height;
X	    scale	= min(w_scale, h_scale);
X	} else {
X	    w_max	= (width  > 0)? width  : H_MAX;
X	    h_max	= (height > 0)? height : W_MAX;
X	    w_scale	= w_max / win.pixmap_width;
X	    h_scale	= h_max / win.pixmap_height;
X	    scale	= min(w_scale, h_scale);
X	}
X}
END_OF_FILE
if test 918 -ne `wc -c <'cxpr/setup_layout.c'`; then
    echo shar: \"'cxpr/setup_layout.c'\" unpacked with wrong size!
fi
# end of 'cxpr/setup_layout.c'
fi
if test -f 'cxpr/swapbits.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/swapbits.c'\"
else
echo shar: Extracting \"'cxpr/swapbits.c'\" \(196 characters\)
sed "s/^X//" >'cxpr/swapbits.c' <<'END_OF_FILE'
X#include "reverse_byte.h"
X
X/* copied from lib/X/XPutImage.c */
X
X_swapbits (b, n)
X	register unsigned char *b;
X	register long n;
X{
X	do {
X		*b = _reverse_byte[*b];
X		b++;
X	    } while (--n > 0);
X	
X}
END_OF_FILE
if test 196 -ne `wc -c <'cxpr/swapbits.c'`; then
    echo shar: \"'cxpr/swapbits.c'\" unpacked with wrong size!
fi
# end of 'cxpr/swapbits.c'
fi
if test -f 'cxpr/swaplong.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/swaplong.c'\"
else
echo shar: Extracting \"'cxpr/swaplong.c'\" \(279 characters\)
sed "s/^X//" >'cxpr/swaplong.c' <<'END_OF_FILE'
X_swaplong (bp, n)
X     register char *bp;
X     register long n;
X{
X	register char c;
X	register char *ep = bp + n;
X	register char *sp;
X	do {
X	  	sp = bp + 3;
X		c = *sp;
X		*sp = *bp;
X		*bp++ = c;
X		sp = bp + 1;
X		c = *sp;
X		*sp = *bp;
X		*bp++ = c;
X		bp += 2;
X	}
X	while (bp < ep);
X}
END_OF_FILE
if test 279 -ne `wc -c <'cxpr/swaplong.c'`; then
    echo shar: \"'cxpr/swaplong.c'\" unpacked with wrong size!
fi
# end of 'cxpr/swaplong.c'
fi
if test -f 'cxpr/swapshort.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cxpr/swapshort.c'\"
else
echo shar: Extracting \"'cxpr/swapshort.c'\" \(200 characters\)
sed "s/^X//" >'cxpr/swapshort.c' <<'END_OF_FILE'
X_swapshort (bp, n)
X     register char *bp;
X     register long n;
X{
X	register char c;
X	register char *ep = bp + n;
X	do {
X		c = *bp;
X		*bp = *(bp + 1);
X		bp++;
X		*bp = c;
X		bp++;
X	}
X	while (bp < ep);
X}
END_OF_FILE
if test 200 -ne `wc -c <'cxpr/swapshort.c'`; then
    echo shar: \"'cxpr/swapshort.c'\" unpacked with wrong size!
fi
# end of 'cxpr/swapshort.c'
fi
echo shar: End of shell archive.
exit 0