home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
x
/
volume15
/
xhearts
/
part04
< prev
next >
Wrap
Text File
|
1992-02-03
|
56KB
|
2,016 lines
Newsgroups: comp.sources.x
Path: uunet!usc!elroy.jpl.nasa.gov!ames!pasteur!nntp
From: mikey@sgi.com (Mike Yang)
Subject: v15i171: xhearts (w/ patch #1), Part04/06
Message-ID: <1992Feb4.141941.9390@pasteur.Berkeley.EDU>
Sender: dcmartin@msi.com (David C. Martin - Moderator)
Nntp-Posting-Host: postgres.berkeley.edu
Organization: University of California, at Berkeley
References: <csx-15i168-xhearts@uunet.UU.NET>
Date: Tue, 4 Feb 1992 14:19:41 GMT
Approved: dcmartin@msi.com
Submitted-by: mikey@sgi.com (Mike Yang)
Posting-number: Volume 15, Issue 171
Archive-name: xhearts/part04
# 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 archive 4 (of 6)."
# Contents: gfx.c hearts.c hearts_dist.c rank.bm
# Wrapped by dcmartin@fascet on Wed Jan 15 06:30:34 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'gfx.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'gfx.c'\"
else
echo shar: Extracting \"'gfx.c'\" \(32347 characters\)
sed "s/^X//" >'gfx.c' <<'END_OF_FILE'
X/*
X * Spider card bitmap drawing routines, modified for external use
X * by Mike Yang, Silicon Graphics, mikey@sgi.com.
X *
X */
X
X/*
X * Copyright 1990 Heather Rose and Sun Microsystems, Inc.
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 copyright
X * notice and this permission notice appear in supporting documentation, and
X * that the names of Donald Woods and Sun Microsystems not be used in
X * advertising or publicity pertaining to distribution of the software without
X * specific, written prior permission. Heather Rose and Sun Microsystems not be used in
X * advertising or publicity pertaining to distribution of the software without
X * specific, written prior permission. Heather Rose and Sun Microsystems make
X * no representations about the suitability of this software for any purpose.
X * It is provided "as is" without express or implied warranty.
X *
X * THE ABOVE-NAMED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
X * SHALL HEATHER ROSE OR SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
X * OF THIS SOFTWARE.
X *
X * Author:
X * Heather Rose
X * hrose@sun.com
X *
X * Sun Microsystems, Inc.
X * 2550 Garcia Avenue
X * Mountain View, CA 94043
X */
X
X/*
X * Copyright 1990 David Lemke and Network Computing Devices
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 Network Computing Devices not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission. Network Computing
X * Devices makes no representations about the suitability of this software
X * for any purpose. It is provided "as is" without express or implied
X * warranty.
X *
X * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
X * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
X * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
X * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
X * LOSS 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 USE
X * OR PERFORMANCE OF THIS SOFTWARE.
X *
X * Author:
X * Dave Lemke
X * lemke@ncd.com
X *
X * Network Computing Devices, Inc
X * 350 North Bernardo Ave
X * Mountain View, CA 94043
X *
X * @(#)copyright.h 2.2 90/04/27
X *
X */
X
X/*
X% Copyright (c) 1989, Donald R. Woods and Sun Microsystems, Inc.
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 copyright
X% notice and this permission notice appear in supporting documentation, and
X% that the names of Donald Woods and Sun Microsystems not be used in
X% advertising or publicity pertaining to distribution of the software without
X% specific, written prior permission. Donald Woods and Sun Microsystems make
X% no representations about the suitability of this software for any purpose.
X% It is provided "as is" without express or implied warranty.
X%
X% THE ABOVE-NAMED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
X% INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
X% SHALL DONALD WOODS OR SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
X% CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
X% DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
X% TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
X% OF THIS SOFTWARE.
X%
X% History: Spider is a solitaire card game that can be found in various books
X% of same; the rules are presumed to be in the public domain. The author's
X% first computer implementation was on the Stanford Artificial Intelligence Lab
X% system (SAIL). It was later ported to the Xerox Development Environment.
X% The card images are loosely based on scanned-in images but were largely
X% redrawn by the author with help from Larry Rosenberg.
X%
X% This program is written entirely in NeWS and runs on OPEN WINDOWS 1.0.
X% It could be made to run much faster if parts of it were written in C, using
X% NeWS mainly for its display and input capabilities, but that is left as an
X% exercise for the reader. Spider may also run with little or no modification
X% on subsequent releases of OPEN WINDOWS, but no guarantee is made on this
X% point (nor any other; see above!). To run Spider, feed this file to 'psh'.
X%
X% Author: Don Woods
X% woods@sun.com
X%
X% Sun Microsystems, Inc.
X% 2550 Garcia Avenue
X% Mountain View, CA 94043
X*/
X
X/*
X * Spider card drawing routines
X */
X#include "gfx.h"
X#include <X11/Xutil.h>
X#include <stdio.h>
X#include <assert.h>
X
X/*
X * spider global variables
X */
XDisplay *dpy;
Xint screen;
XPixmap greenmap;
XPixmap redmap;
XPixmap logomap;
Xunsigned long blackpixel;
Xunsigned long whitepixel;
Xunsigned long borderpixel;
Xunsigned long greenpixel;
XBool is_color;
X
Xstatic GC cardgc; /* gc in use when drawing cards */
X
X/* substitue gray1 for Green on mono */
X#define gray1_width 16
X#define gray1_height 16
Xstatic char gray1_bits[] = {
X 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
X 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa};
X
X/* logo for card backs */
X/* any size logo can be handled. */
X
X#define logo_width 64
X#define logo_height 64
Xstatic char logo_bits[] = {
X 0x77,0xd5,0xd7,0xdd,0x77,0xd5,0xd7,0xdd,0xbb,0xea,0xae,0xbb,0xbb,0xea,0xae,
X 0xbb,0x5d,0x75,0x5d,0x77,0x5d,0x75,0x5d,0x77,0xee,0xba,0xba,0xee,0xae,0xba,
X 0xba,0xee,0x77,0x5d,0x75,0xdd,0x77,0x5d,0x75,0xdd,0xbb,0xae,0xea,0xba,0xbb,
X 0xae,0xea,0xba,0x5d,0x57,0xd5,0x75,0x5d,0x57,0xd5,0x75,0xae,0xab,0xaa,0xeb,
X 0xae,0xab,0xaa,0xeb,0xd7,0x55,0x55,0xd7,0xd7,0x51,0x55,0xd7,0xeb,0xae,0xaa,
X 0xae,0xeb,0xa2,0xaa,0xae,0x75,0x5d,0x55,0x5d,0x75,0x44,0x15,0x5d,0xba,0xbb,
X 0xea,0xba,0xba,0x88,0x8a,0xba,0x5d,0x77,0x75,0x75,0x1d,0x11,0x45,0x75,0xee,
X 0xee,0xba,0xea,0x2e,0x22,0xa2,0xea,0xd7,0xdd,0x5d,0xd5,0x57,0x44,0x10,0xd5,
X 0xab,0xbb,0xef,0xaa,0xab,0x88,0x88,0xaa,0x57,0x77,0x77,0xd5,0x57,0x11,0x45,
X 0xd5,0xae,0xee,0xba,0xea,0xae,0x22,0xa2,0xea,0x5d,0xdd,0x5d,0x75,0x5d,0x45,
X 0x10,0x75,0xba,0xba,0xef,0xba,0xba,0x8a,0x88,0xba,0x75,0x75,0x77,0x5d,0x75,
X 0x15,0x45,0x5d,0xea,0xea,0xba,0xae,0xea,0x2a,0xa2,0xae,0xdd,0xd5,0x5d,0x77,
X 0xdd,0x55,0x50,0x77,0xae,0xab,0xaf,0xeb,0xae,0xab,0xa8,0xeb,0xd7,0x55,0x57,
X 0xd7,0xd7,0x55,0x55,0xd7,0xeb,0xaa,0xaa,0xae,0xeb,0xaa,0xaa,0xae,0x75,0x57,
X 0x55,0x5d,0x75,0x57,0x55,0x5d,0xba,0xae,0xea,0xba,0xba,0xae,0xaa,0xba,0xdd,
X 0x5d,0x75,0x75,0xdd,0x5d,0x75,0x75,0xae,0xbb,0xba,0xea,0xae,0xbb,0xba,0xea,
X 0x77,0x77,0x5d,0xd5,0x77,0x77,0x5d,0xd5,0xeb,0xee,0xee,0xaa,0xeb,0xee,0xae,
X 0xaa,0xd7,0xdd,0x77,0xd5,0xd7,0xdd,0x77,0xd5,0xae,0xbb,0xbb,0xea,0xae,0xbb,
X 0xbb,0xea,0x5d,0x77,0x5d,0x75,0x5d,0x77,0x5d,0x75,0xba,0xee,0xee,0xba,0xba,
X 0xee,0xae,0xba,0x75,0xdd,0x77,0x5d,0x75,0xdd,0x77,0x5d,0xea,0xba,0xbb,0xae,
X 0xea,0xba,0xbb,0xae,0xd5,0x75,0x5d,0x57,0xd5,0x75,0x5d,0x57,0xaa,0xeb,0xae,
X 0xab,0xaa,0xeb,0xae,0xab,0x55,0xd7,0xd7,0x55,0x55,0xd7,0xd7,0x55,0xaa,0xae,
X 0xeb,0xae,0xaa,0xae,0xeb,0xae,0x55,0x5d,0x75,0x5d,0x55,0x5d,0x75,0x5d,0xea,
X 0xba,0xba,0xbb,0xea,0xba,0xba,0xbb,0x75,0x75,0x5d,0x77,0x75,0x75,0x5d,0x77,
X 0xba,0xea,0xee,0xee,0xba,0xea,0xee,0xee,0x5d,0xd5,0xd7,0xdd,0x5d,0xd5,0xd7,
X 0xdd,0xef,0xaa,0xab,0xbb,0xef,0xaa,0xab,0xbb,0x77,0xd5,0x57,0x77,0x77,0xd5,
X 0x57,0x77,0xba,0xea,0xae,0xee,0xba,0xea,0xae,0xee,0x5d,0x75,0x5d,0xdd,0x5d,
X 0x75,0x5d,0xdd,0xef,0xba,0xba,0xba,0xef,0xba,0xba,0xba,0x77,0x5d,0x75,0x75,
X 0x77,0x5d,0x75,0x75,0xba,0xae,0xea,0xea,0xba,0xae,0xea,0xea,0x5d,0x77,0xdd,
X 0xd5,0x5d,0x77,0xdd,0xd5,0xaf,0xeb,0xae,0xab,0xaf,0xeb,0xae,0xab,0x57,0xd7,
X 0xd7,0x55,0x57,0xd7,0xd7,0x55,0xaa,0xae,0xeb,0xaa,0xaa,0xae,0xeb,0xaa,0x55,
X 0x5d,0x75,0x57,0x55,0x5d,0x75,0x57,0xaa,0xba,0xba,0xae,0xaa,0xba,0xba,0xae,
X 0x75,0x75,0xdd,0x5d,0x55,0x75,0xdd,0x5d,0xba,0xea,0xae,0xbb,0xba,0xea,0xae,
X 0xbb,0x5d,0xd5,0x77,0x77,0x5d,0xd5,0x77,0x77,0xae,0xaa,0xeb,0xee,0xae,0xaa,
X 0xeb,0xee};
X
X#include "rank.bm"
X#include "face.bm"
X#include "suit.bm"
X
Xstatic Pixmap rank_map[NUM_RANKS], rank_r_map[NUM_RANKS];
Xstatic Pixmap rank_map_red[NUM_RANKS], rank_r_map_red[NUM_RANKS];
Xstatic Pixmap suit_map[NUM_SUITS], suit_r_map[NUM_SUITS];
Xstatic Pixmap suit_sm_map[NUM_SUITS], suit_sm_r_map[NUM_SUITS];
Xstatic Pixmap suit_lg_map[NUM_SUITS];
Xstatic Pixmap jack_map[NUM_SUITS], queen_map[NUM_SUITS], king_map[NUM_SUITS];
X
X/* clipping rectangles */
Xstatic XRectangle cliprects[1] = { 0, 0, CARD_WIDTH + 1, 0};
X
Xstatic GC redgc;
Xstatic GC blackgc;
Xstatic GC whitegc;
Xstatic GC backgc;
X
Xstatic int back_delta_x, back_delta_y; /* how much to modify the TS origin by */
X
Xstatic Bool card_is_clipped; /* optimizer for card drawing */
X
Xgfx_init(d, scr)
XDisplay *d;
Xint scr;
X{
XXGCValues gcv;
Xlong gcflags;
XXColor color;
XColormap cmap;
XPixmap tmpmap;
XGC logogc;
Xunsigned long redpixel;
X
X /* save these off */
X dpy = d;
X screen = scr;
X
X if (DisplayCells(dpy, screen) > 2) {
X is_color = True;
X } else {
X is_color = False;
X }
X
X blackpixel = BlackPixel(dpy, screen);
X whitepixel = WhitePixel(dpy, screen);
X
X /* make gc for white */
X gcv.foreground = WhitePixel(dpy, screen);
X gcv.background = BlackPixel(dpy, screen);
X gcv.graphics_exposures = False;
X gcflags = GCForeground | GCBackground | GCGraphicsExposures;
X
X whitegc = XCreateGC(dpy, RootWindow(dpy, screen), gcflags, &gcv);
X
X /* make gc for black */
X gcv.foreground = BlackPixel(dpy, screen);
X gcv.background = WhitePixel(dpy, screen);
X gcflags = GCForeground | GCBackground | GCGraphicsExposures;
X
X blackgc = XCreateGC(dpy, RootWindow(dpy, screen), gcflags, &gcv);
X
X tmpmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X logo_bits, logo_width, logo_height);
X
X logomap = XCreatePixmap(dpy, RootWindow(dpy, screen), logo_width,
X logo_height, DefaultDepth(dpy, screen));
X
X back_delta_x = (CARD_WIDTH - logo_width)/2;
X back_delta_y = (CARD_HEIGHT - logo_height)/2;
X
X if (is_color) {
X cmap = DefaultColormap(dpy, screen);
X XAllocNamedColor(dpy, cmap, "Sea Green", &color, &color);
X gcv.foreground = color.pixel;
X gcv.background = WhitePixel(dpy, screen);
X gcflags = GCForeground | GCBackground;
X logogc = XCreateGC(dpy, RootWindow(dpy, screen), gcflags, &gcv);
X XCopyPlane(dpy, tmpmap, logomap, logogc, 0, 0,
X logo_width, logo_height, 0, 0, 1);
X XFreeGC(dpy, logogc);
X } else {
X XCopyPlane(dpy, tmpmap, logomap, whitegc, 0, 0,
X logo_width, logo_height, 0, 0, 1);
X }
X XFreePixmap(dpy, tmpmap);
X
X gcv.tile = logomap;
X gcv.fill_style = FillTiled;
X gcflags |= GCTile | GCFillStyle | GCGraphicsExposures;
X
X backgc = XCreateGC(dpy, RootWindow(dpy, screen), gcflags, &gcv);
X
X borderpixel = blackpixel;
X
X if (is_color) {
X cmap = DefaultColormap(dpy, screen);
X
X color.flags = DoRed | DoGreen | DoBlue;
X
X /*
X * color levels are the NeWS RGB values
X */
X color.red = 13107; /* 0.2 */
X color.green = 52428; /* 0.8 */
X color.blue = 39321; /* 0.6 */
X XAllocColor(dpy, cmap, &color);
X greenpixel = color.pixel;
X
X color.red = 52428; /* 0.8 */
X color.green = color.blue = 0;
X XAllocColor(dpy, cmap, &color);
X redpixel = color.pixel;
X
X gcv.foreground = redpixel;
X gcv.background = WhitePixel(dpy, screen);
X gcflags = GCForeground | GCBackground | GCGraphicsExposures;
X
X redgc = XCreateGC(dpy, RootWindow(dpy, screen), gcflags, &gcv);
X
X } else {
X greenmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X gray1_bits, gray1_width, gray1_height);
X
X redmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X gray1_bits, gray1_width, gray1_height);
X
X gcv.tile = redmap;
X gcv.fill_style = FillTiled;
X
X gcv.foreground = BlackPixel(dpy, screen);
X gcv.background = WhitePixel(dpy, screen);
X
X gcflags = GCTile | GCForeground | GCBackground |
X GCFillStyle | GCGraphicsExposures;
X
X redgc = XCreateGC(dpy, RootWindow(dpy, screen), gcflags, &gcv);
X }
X make_card_maps();
X}
X
X/*
X * make a 'red' pixmap by setting the clipmask to the desired shape and
X * pushing 'red' through it
X */
X
Xstatic Pixmap
Xmake_red_map(bits, width, height)
Xchar *bits;
Xint width, height;
X{
XPixmap tmpmap, newmap;
Xstatic GC cleargc = (GC) 0;
XXGCValues xgcv;
X
X
X if (cleargc == (GC) 0) {
X xgcv.function = GXclear;
X cleargc = XCreateGC(dpy, RootWindow(dpy, screen), GCFunction,
X &xgcv);
X }
X
X tmpmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X bits, width, height);
X
X newmap = XCreatePixmap(dpy, RootWindow(dpy, screen), width, height, 1);
X
X /* clear pixmap */
X XFillRectangle(dpy, newmap, cleargc, 0, 0, width, height);
X
X XSetClipMask(dpy, redgc, tmpmap);
X XFillRectangle(dpy, newmap, redgc, 0, 0, width, height);
X XSetClipMask(dpy, redgc, None);
X XFreePixmap(dpy, tmpmap);
X
X return (newmap);
X}
X
Xmake_card_maps()
X{
Xunsigned char *new_bits;
XRank r;
Xint i;
X
X for (r = Ace; r <= King; r++) {
X rank_map[(int)r] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X rank_bits[(int)r], rank_width, rank_height);
X
X new_bits = (unsigned char *) calloc(sizeof(rank_bits[(int)r]),
X 1);
X rot_180((unsigned char *)rank_bits[(int)r], new_bits,
X rank_width, rank_height);
X rank_r_map[(int)r] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X new_bits, rank_width, rank_height);
X free((char *)new_bits);
X }
X
X for (r = Ace; r <= King; r++) {
X new_bits = (unsigned char *) calloc(sizeof(rank_bits[(int)r]),
X 1);
X rot_180((unsigned char *)rank_bits[(int)r], new_bits,
X rank_width, rank_height);
X if (is_color) {
X rank_map_red[(int)r] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X rank_bits[(int)r], rank_width, rank_height);
X
X rank_r_map_red[(int)r] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X new_bits, rank_width, rank_height);
X } else {
X rank_map_red[(int)r] = make_red_map(rank_bits[(int)r],
X rank_width, rank_height);
X
X rank_r_map_red[(int)r] = make_red_map((char *)new_bits,
X rank_width, rank_height);
X }
X free((char *)new_bits);
X }
X
X i = (int)Spade;
X /* make all the card bitmaps */
X suit_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X spade_bits, spade_width, spade_height);
X
X new_bits = (unsigned char *) calloc(sizeof(spade_bits), 1);
X flip_bits((unsigned char *)spade_bits, new_bits, spade_width,
X spade_height);
X suit_r_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X new_bits, spade_width, spade_height);
X free((char *)new_bits);
X
X suit_sm_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X spade_sm_bits, spade_sm_width, spade_sm_height);
X
X new_bits = (unsigned char *) calloc(sizeof(spade_sm_bits), 1);
X flip_bits((unsigned char *)spade_sm_bits, new_bits, spade_sm_width,
X spade_sm_height);
X suit_sm_r_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X new_bits, spade_sm_width, spade_sm_height);
X free((char *)new_bits);
X
X suit_lg_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X spade_lg_bits, spade_lg_width, spade_lg_height);
X
X jack_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X jack_s_bits, jack_s_width, jack_s_height);
X
X queen_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X queen_s_bits, queen_s_width, queen_s_height);
X
X king_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X king_s_bits, king_s_width, king_s_height);
X
X i = (int)Heart;
X /* make all the card bitmaps */
X new_bits = (unsigned char *) calloc(sizeof(heart_bits), 1);
X flip_bits((unsigned char *)heart_bits, new_bits, heart_width,
X heart_height);
X
X if (is_color) {
X suit_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X heart_bits, heart_width, heart_height);
X suit_r_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X new_bits, heart_width, heart_height);
X } else {
X suit_map[i] = make_red_map(heart_bits, heart_width,
X heart_height);
X suit_r_map[i] = make_red_map((char *)new_bits, heart_width,
X heart_height);
X }
X
X free((char *)new_bits);
X
X new_bits = (unsigned char *) calloc(sizeof(heart_sm_bits), 1);
X flip_bits((unsigned char *)heart_sm_bits, new_bits, heart_sm_width,
X heart_sm_height);
X suit_sm_r_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X new_bits, heart_sm_width, heart_sm_height);
X
X if (is_color) {
X suit_sm_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X heart_sm_bits, heart_sm_width, heart_sm_height);
X suit_sm_r_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X new_bits, heart_sm_width, heart_sm_height);
X } else {
X suit_sm_map[i] = make_red_map(heart_sm_bits, heart_sm_width,
X heart_height);
X suit_sm_r_map[i] = make_red_map((char *)new_bits,
X heart_sm_width, heart_sm_height);
X }
X free((char *)new_bits);
X
X suit_lg_map[i] = suit_map[i];
X
X if (is_color) {
X jack_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X jack_h_bits, jack_h_width, jack_h_height);
X
X queen_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X queen_h_bits, queen_h_width, queen_h_height);
X
X king_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X king_h_bits, king_h_width, king_h_height);
X } else {
X jack_map[i] = make_red_map(jack_h_bits, jack_h_width,
X jack_h_height);
X
X queen_map[i] = make_red_map(queen_h_bits, queen_h_width,
X queen_h_height);
X
X king_map[i] = make_red_map(king_h_bits, king_h_width,
X king_h_height);
X }
X
X
X i = (int)Diamond;
X /* make all the card bitmaps */
X new_bits = (unsigned char *) calloc(sizeof(diamond_bits), 1);
X flip_bits((unsigned char *)diamond_bits, new_bits, diamond_width,
X diamond_height);
X
X if (is_color) {
X suit_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X diamond_bits, diamond_width, diamond_height);
X suit_r_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X new_bits, diamond_width, diamond_height);
X } else {
X suit_map[i] = make_red_map(diamond_bits, diamond_width,
X diamond_height);
X suit_r_map[i] = make_red_map((char *)new_bits, diamond_width,
X diamond_height);
X }
X
X free((char *)new_bits);
X
X new_bits = (unsigned char *) calloc(sizeof(diamond_sm_bits), 1);
X flip_bits((unsigned char *)diamond_sm_bits, new_bits,
X diamond_sm_width, diamond_sm_height);
X suit_sm_r_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X new_bits, diamond_sm_width, diamond_sm_height);
X
X if (is_color) {
X suit_sm_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X diamond_sm_bits, diamond_sm_width, diamond_sm_height);
X suit_sm_r_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X new_bits, diamond_sm_width, diamond_sm_height);
X } else {
X suit_sm_map[i] = make_red_map(diamond_sm_bits, diamond_sm_width,
X diamond_height);
X suit_sm_r_map[i] = make_red_map((char *)new_bits,
X diamond_sm_width, diamond_sm_height);
X }
X free((char *)new_bits);
X
X suit_lg_map[i] = suit_map[i];
X
X if (is_color) {
X jack_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X jack_d_bits, jack_d_width, jack_d_height);
X
X queen_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X queen_d_bits, queen_d_width, queen_d_height);
X
X king_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X king_d_bits, king_d_width, king_d_height);
X } else {
X jack_map[i] = make_red_map(jack_d_bits, jack_d_width,
X jack_d_height);
X
X queen_map[i] = make_red_map(queen_d_bits, queen_d_width,
X queen_d_height);
X
X king_map[i] = make_red_map(king_d_bits, king_d_width,
X king_d_height);
X }
X
X i = (int)Club;
X /* make all the card bitmaps */
X suit_map[i] = XCreateBitmapFromData(dpy,
X RootWindow(dpy, screen),
X club_bits, club_width, club_height);
X
X new_bits = (unsigned char *) calloc(sizeof(club_bits), 1);
X flip_bits((unsigned char *)club_bits, new_bits, club_width,
X club_height);
X suit_r_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X new_bits, club_width, club_height);
X free((char *)new_bits);
X
X suit_sm_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X club_sm_bits, club_sm_width, club_sm_height);
X
X new_bits = (unsigned char *) calloc(sizeof(club_sm_bits), 1);
X flip_bits((unsigned char *)club_sm_bits, new_bits, club_sm_width,
X club_sm_height);
X suit_sm_r_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X new_bits, club_sm_width, club_sm_height);
X free((char *)new_bits);
X
X suit_lg_map[i] = suit_map[i];
X
X
X jack_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X jack_c_bits, jack_c_width, jack_c_height);
X
X queen_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X queen_c_bits, queen_c_width, queen_c_height);
X
X king_map[i] = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
X king_c_bits, king_c_width, king_c_height);
X}
X
Xstatic unsigned char _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};
X
X#define S(x,y) src[(H-1-(y))*W+(x)]
X#define D(x,y) dst[(H-1-(y))*W+(x)]
X
Xflip_bits(src, dst, W, H)
Xunsigned char *src, *dst;
Xint W, H;
X{
Xint x, y;
X
X W = (W + 7)/8;
X for (y = 0; y < H; y++) {
X for (x = 0; x < W; x++) {
X D (x, y) = S (x, H - 1 - y);
X }
X }
X}
X
Xrot_180(src, dst, W, H)
Xunsigned char *src, *dst;
Xint W, H;
X{
Xint x, y;
Xint width = W;
Xunsigned char *new;
Xint bit;
X
X W = (W + 7)/8;
X for (y = 0; y < H; y++) {
X for (x = 0; x < W; x++) {
X D (x, y) = _reverse_byte[S (W - 1 - x, H - 1 - y)];
X }
X }
X
X /* shift it over */
X new = (unsigned char *)calloc((unsigned)W*H, (unsigned)1);
X for (y = 0; y < H; y++) {
X for (x = 0; x < W*8; x++) {
X bit = (*(dst + (x + (W*8 - width))/8 + y * W)
X & (1 << ((x + (W*8 - width)) % 8))) ? 1 : 0;
X *(new + x/8 + y*W) = (bit << (x%8)) |
X (*(new + x/8 + y*W) & ~(1 << (x%8)));
X }
X }
X bcopy((char *)new, (char *)dst, W*H);
X free((char *)new);
X}
X
X/*
X * delta is 0 if the card is fully showing
X */
Xpaint_card(table, x, y, rank, suit, delta)
XWindow table;
Xint x,y;
XRank rank;
XSuit suit;
Xint delta;
X{
X if (suit == Spade || suit == Club) {
X cardgc = blackgc;
X } else {
X cardgc = redgc;
X }
X
X if (delta) {
X cliprects[0].height = delta;
X XSetClipRectangles(dpy, cardgc, x, y, cliprects, 1, Unsorted);
X {
X /* fill the background */
X XFillRectangle(dpy, table, whitegc, x, y,
X CARD_WIDTH, delta);
X /* draw border on card */
X XDrawRectangle(dpy, table, blackgc, x, y,
X CARD_WIDTH, delta);
X }
X card_is_clipped = True;
X } else { /* fill all the card */
X {
X /* fill the background */
X XFillRectangle(dpy, table, whitegc, x, y,
X CARD_WIDTH, CARD_HEIGHT);
X /* draw border on card */
X XDrawRectangle(dpy, table, blackgc, x, y,
X CARD_WIDTH, CARD_HEIGHT);
X }
X card_is_clipped = False;
X }
X
X switch (rank) {
X case King:
X draw_king(table, suit, x, y);
X break;
X case Queen:
X draw_queen(table, suit, x, y);
X break;
X case Jack:
X draw_jack(table, suit, x, y);
X break;
X
X case Ten:
X draw_pip(table, suit, MID_CARD_X + x, CARD_TEN_Y1 + y);
X draw_did(table, suit, MID_CARD_X + x, CARD_TEN_Y2 + y);
X draw_eight_pips(table, suit, x, y);
X break;
X
X case Nine:
X draw_pip(table, suit, x + MID_CARD_X, y + MID_CARD_Y);
X draw_eight_pips(table, suit, x, y);
X break;
X
X case Eight:
X draw_did(table, suit, x + MID_CARD_X, y + CARD_EIGHT_Y);
X /* fall thru */
X case Seven:
X draw_pip(table, suit, MID_CARD_X + x, CARD_SEVEN_Y + y);
X /* fall thru */
X case Six:
X draw_six_pips(table, suit, x, y);
X break;
X
X case Five:
X draw_pip(table, suit, x + MID_CARD_X, y + MID_CARD_Y);
X /* fall thru */
X case Four:
X draw_four_pips(table, suit, x, y);
X break;
X
X case Three:
X draw_pip(table, suit, x + MID_CARD_X, y + MID_CARD_Y);
X /* fall thru */
X case Deuce:
X draw_two_pips(table, suit, x, y);
X break;
X case Ace:
X draw_center_pip(table, suit, x + MID_CARD_X, y + MID_CARD_Y);
X break;
X default:
X assert(0);
X }
X
X draw_rank(table, x, y, rank, suit);
X
X /* clear the clip mask */
X XSetClipMask(dpy, cardgc, None);
X}
X
X/*
X * NOTE -- for all the pip drawers except the one that actually plots the
X * bits, the location is the card's location. the drawer's take the
X * pip's center as location.
X */
X
X/*
X * draws right-side-up pip
X *
X * location is for center of pip
X */
Xdraw_pip(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x, y;
X{
Xint w, h;
X
X switch(suit) {
X case Spade:
X w = spade_width;
X h = spade_height;
X break;
X case Diamond:
X x++;
X w = diamond_width;
X h = diamond_height;
X break;
X case Heart:
X y++;
X w = heart_width;
X h = heart_height;
X break;
X case Club:
X y++;
X w = club_width;
X h = club_height;
X break;
X default:
X assert(0);
X }
X XCopyPlane(dpy, suit_map[suit], table, cardgc,
X 0, 0, w, h,
X x - w/2, y - h/2, 1);
X}
X
X/*
X * draws upside-down pip
X *
X * location is for center of pip
X */
Xdraw_did(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
Xint w, h;
X
X if (card_is_clipped) /* a clipped card never shows any did's */
X return;
X
X switch(suit) {
X case Spade:
X w = spade_width;
X h = spade_height;
X break;
X case Diamond:
X x++;
X w = diamond_width;
X h = diamond_height;
X break;
X case Heart:
X y++;
X w = heart_width;
X h = heart_height;
X break;
X case Club:
X y++;
X w = club_width;
X h = club_height;
X break;
X default:
X assert(0);
X }
X XCopyPlane(dpy, suit_r_map[suit], table, cardgc,
X 0, 0, w, h,
X x - w/2, y - h/2, 1);
X}
X
X/*
X * draws big center pip
X */
Xdraw_center_pip(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
Xint w, h;
X
X if (card_is_clipped)
X return;
X
X switch(suit) {
X case Spade:
X w = spade_lg_width;
X h = spade_lg_height;
X break;
X case Diamond:
X w = diamond_width;
X h = diamond_height;
X break;
X case Heart:
X w = heart_width;
X h = heart_height;
X break;
X case Club:
X w = club_width;
X h = club_height;
X break;
X default:
X assert(0);
X }
X XCopyPlane(dpy, suit_lg_map[suit], table, cardgc,
X 0, 0, w, h,
X x - w/2, y - h/2, 1);
X}
X
X/*
X * draw_two_pips
X */
Xdraw_two_pips(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
X draw_pip(table, suit, x + MID_CARD_X, y + CARD_ROW1_Y);
X draw_did(table, suit, x + MID_CARD_X, y + CARD_ROW5_Y);
X}
X
X/*
X * draw_four_pips
X */
Xdraw_four_pips(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
X draw_pip(table, suit, x + CARD_COL1_X, y + CARD_ROW1_Y);
X draw_did(table, suit, x + CARD_COL1_X, y + CARD_ROW5_Y);
X
X draw_pip(table, suit, x + CARD_COL3_X, y + CARD_ROW1_Y);
X draw_did(table, suit, x + CARD_COL3_X, y + CARD_ROW5_Y);
X}
X
Xdraw_six_pips(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x, y;
X{
X draw_pip(table, suit, x + CARD_COL1_X, y + CARD_ROW1_Y);
X
X draw_pip(table, suit, x + CARD_COL3_X, y + CARD_ROW1_Y);
X
X if (card_is_clipped)
X return;
X
X /* these are only visible when its not clipped */
X draw_pip(table, suit, x + CARD_COL1_X, y + CARD_ROW3_Y);
X draw_did(table, suit, x + CARD_COL1_X, y + CARD_ROW5_Y);
X
X draw_pip(table, suit, x + CARD_COL3_X, y + CARD_ROW3_Y);
X draw_did(table, suit, x + CARD_COL3_X, y + CARD_ROW5_Y);
X}
X
Xdraw_eight_pips(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
X draw_pip(table, suit, x + CARD_COL1_X, y + CARD_ROW1_Y);
X
X draw_pip(table, suit, x + CARD_COL3_X, y + CARD_ROW1_Y);
X
X if (card_is_clipped)
X return;
X
X /* these are only visible when its not clipped */
X draw_pip(table, suit, x + CARD_COL1_X, y + CARD_ROW2_Y);
X draw_did(table, suit, x + CARD_COL1_X, y + CARD_ROW4_Y);
X draw_did(table, suit, x + CARD_COL1_X, y + CARD_ROW5_Y);
X
X draw_pip(table, suit, x + CARD_COL3_X, y + CARD_ROW2_Y);
X draw_did(table, suit, x + CARD_COL3_X, y + CARD_ROW4_Y);
X draw_did(table, suit, x + CARD_COL3_X, y + CARD_ROW5_Y);
X}
X
Xdraw_jack(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
X XCopyPlane(dpy, jack_map[suit], table, cardgc,
X 0, 0, FACECARD_WIDTH, FACECARD_HEIGHT,
X x + (CARD_WIDTH - FACECARD_WIDTH)/2,
X y + (CARD_HEIGHT - FACECARD_HEIGHT)/2, 1);
X
X XDrawRectangle(dpy, table, cardgc,
X x + (CARD_WIDTH - FACECARD_WIDTH)/2,
X y + (CARD_HEIGHT - FACECARD_HEIGHT)/2,
X FACECARD_WIDTH, FACECARD_HEIGHT);
X}
X
Xdraw_queen(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
X XCopyPlane(dpy, queen_map[suit], table, cardgc,
X 0, 0, FACECARD_WIDTH, FACECARD_HEIGHT,
X x + (CARD_WIDTH - FACECARD_WIDTH)/2,
X y + (CARD_HEIGHT - FACECARD_HEIGHT)/2, 1);
X
X XDrawRectangle(dpy, table, cardgc,
X x + (CARD_WIDTH - FACECARD_WIDTH)/2,
X y + (CARD_HEIGHT - FACECARD_HEIGHT)/2,
X FACECARD_WIDTH, FACECARD_HEIGHT);
X}
X
Xdraw_king(table, suit, x, y)
XWindow table;
XSuit suit;
Xint x,y;
X{
X XCopyPlane(dpy, king_map[suit], table, cardgc,
X 0, 0, FACECARD_WIDTH, FACECARD_HEIGHT,
X x + (CARD_WIDTH - FACECARD_WIDTH)/2,
X y + (CARD_HEIGHT - FACECARD_HEIGHT)/2, 1);
X
X XDrawRectangle(dpy, table, cardgc,
X x + (CARD_WIDTH - FACECARD_WIDTH)/2,
X y + (CARD_HEIGHT - FACECARD_HEIGHT)/2,
X FACECARD_WIDTH, FACECARD_HEIGHT);
X}
X
Xdraw_rank(table, x, y, rank, suit)
XWindow table;
Xint x, y;
XRank rank;
XSuit suit;
X{
Xint w, h;
X
X if (suit == Heart || suit == Diamond) {
X XCopyPlane(dpy, rank_map_red[rank], table, cardgc,
X 0, 0, RANK_WIDTH, RANK_HEIGHT,
X x + RANK_LOC_X, y + RANK_LOC_Y, 1);
X
X if (!card_is_clipped)
X XCopyPlane(dpy, rank_r_map_red[rank], table, cardgc,
X 0, 0, RANK_WIDTH, RANK_HEIGHT,
X x + (CARD_WIDTH - RANK_WIDTH - RANK_LOC_X),
X y + (CARD_HEIGHT - RANK_HEIGHT - RANK_LOC_Y), 1);
X } else {
X XCopyPlane(dpy, rank_map[rank], table, cardgc,
X 0, 0, RANK_WIDTH, RANK_HEIGHT,
X x + RANK_LOC_X, y + RANK_LOC_Y, 1);
X
X if (!card_is_clipped)
X XCopyPlane(dpy, rank_r_map[rank], table, cardgc,
X 0, 0, RANK_WIDTH, RANK_HEIGHT,
X x + (CARD_WIDTH - RANK_WIDTH - RANK_LOC_X),
X y + (CARD_HEIGHT - RANK_HEIGHT - RANK_LOC_Y), 1);
X }
X
X switch (suit) {
X case Spade:
X w = spade_sm_width;
X h = spade_sm_height;
X break;
X case Heart:
X w = heart_sm_width;
X h = heart_sm_height;
X break;
X case Diamond:
X x++; /* offset the smaller width */
X w = diamond_sm_width;
X h = diamond_sm_height;
X break;
X case Club:
X w = club_sm_width;
X h = club_sm_height;
X break;
X default:
X assert(0);
X }
X XCopyPlane(dpy, suit_sm_map[suit], table, cardgc,
X 0, 0, w, h,
X x + SMALL_LOC_X, y + SMALL_LOC_Y, 1);
X
X if (!card_is_clipped)
X XCopyPlane(dpy, suit_sm_r_map[suit], table, cardgc,
X 0, 0, w, h,
X x + (CARD_WIDTH - w - SMALL_LOC_X),
X y + (CARD_HEIGHT - h - SMALL_LOC_Y), 1);
X}
END_OF_FILE
if test 32347 -ne `wc -c <'gfx.c'`; then
echo shar: \"'gfx.c'\" unpacked with wrong size!
fi
# end of 'gfx.c'
fi
if test -f 'hearts.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hearts.c'\"
else
echo shar: Extracting \"'hearts.c'\" \(6065 characters\)
sed "s/^X//" >'hearts.c' <<'END_OF_FILE'
X/*
X * hearts - human interface to hearts program
X *
X * All smarts are in heartsd, which is invoked by initial caller of hearts.
X *
X * Private messages, last-play, auto-play added by:
X * Mike Yang of UC Berkeley (mikey@ernie.berkeley.edu)
X *
X * By Bob Ankeney or Generic Computer Products
X * Bug reports to:
X * ...!tektronix!reed!bob
X *
X *
X * Commands to hearts client (r = rank, s = suit):
X *
X * Ars Add card to hand.
X * Rrs Remove card from hand.
X * En Erase window n.
X * G Get a card.
X * Pnrs<name> Play card from player n, whose name is <name>.
X * Snpptt<name> Score points (pp) and total points (tt) for player n.
X * Mn<text> Message <text> is placed in window n.
X * X Go away.
X * Z Game over, socket closing.
X *
X * Messages from client:
X *
X * Prs Pass/Play card from hand.
X * M<text> Send message <text> to all players.
X *
X */
X
X#include <sys/errno.h>
X#include "misc.h"
X#include "defs.h"
X#include "local.h"
X#include "client.h"
X#ifdef SYSV
X#include <sys/termio.h>
X#endif
X
Xint dist_socket, dealer_socket;
Xchar game_over, first_game;
Xchar host[256];
X
Xchar *snames[] = {
X "",
X "clubs",
X "diamonds",
X "hearts",
X "spades"
X },
X rnames[] = " 23456789TJQKA";
X
Xget_going()
X{
X int dealer_port;
X char *name, *getenv();
X /*
X * Connect to distributor. If not available, start it.
X */
X if ((dist_socket = connect_to(host, PORT)) == 0) {
X start_distributor();
X if ((dist_socket = connect_to(host, PORT)) == 0)
X death("Can't invoke distributor!");
X }
X /*
X * Get dealer port and connect to it.
X * If port returned == 0, restart game with old dealer.
X */
X if (dealer_port = select_game()) {
X if (!first_game) {
X (void) close(dealer_socket);
X close_socket(dealer_socket);
X }
X if ((dealer_socket = connect_to(host, dealer_port)) == 0)
X death("Can't connect to dealer!\n");
X if ((name = getenv("HEARTS")) == NULL) /* get user name */
X if ((name = getenv("NAME")) == NULL)
X name = getenv("USER");
X init_socket();
X write_socket(dealer_socket, name); /* tell dealer */
X }
X start_game();
X}
X
Xdo_command(buf)
Xchar *buf;
X{
X char rch, sch;
X int player, suit, pts, total_pts, window_num;
X
X switch (buf[0]) {
X case 'A' : /* Add card to hand */
X enter_card(get_rank(buf[1]), get_suit(buf[2]));
X break;
X
X case 'R' : /* Remove card from hand */
X remove_card(get_rank(buf[1]), get_suit(buf[2]));
X break;
X
X case 'E' : /* Erase window */
X erase_window(buf[1] - '0');
X break;
X
X case 'G' : /* Get card */
X read_card();
X break;
X
X case 'P' : /* Play card from player */
X (void) sscanf(buf+1, "%1d %c %c", &player, &rch, &sch);
X play_card(player, rch, sch, buf+4);
X break;
X
X case 'S' : /* Score points for player */
X (void) sscanf(buf+1, "%1d %3d %3d", &player, &pts, &total_pts);
X score_points(player, pts, total_pts, buf+8);
X break;
X
X case 'M' : /* Print message in window */
X display_message(buf[1] - '0', buf+2);
X break;
X
X case 'X' : /* Game over */
X game_is_over();
X game_over = TRUE;
X first_game = FALSE;
X break;
X
X case 'Z' : /* Game over, socket closing */
X game_is_over();
X game_over = TRUE;
X first_game = TRUE;
X (void) close(dealer_socket);
X close_socket(dealer_socket);
X }
X}
X
X/*
X * Filter out nasties from message in buffer
X */
X
Xmikey_strcmp(s,t)
Xchar s[], t[];
X{
X int i;
X
X i = 0;
X while ((s[i] == t[i]) || (s[i] >= 'A' && s[i] <= 'Z' &&
X (s[i] - 'A' + 'a') == t[i]))
X if (t[i++] == '\0')
X return(TRUE);
X return((t[i] == '\0'));
X}
X
Xblock(buf, what)
Xchar *buf, *what;
X{
X int i;
X
X for (i=0;i<=strlen(what);i++)
X *buf++ = *what++;
X}
X
Xmikey_filter(buf)
Xchar *buf;
X{
X int i;
X
X for (i=1;i<strlen(buf);i++) {
X if (mikey_strcmp(buf+i,"asshole"))
X block(buf+i,"a--hole");
X if (mikey_strcmp(buf+i,"tit"))
X block(buf+i,"t-t");
X if (mikey_strcmp(buf+i,"shit"))
X block(buf+i,"s--t");
X if (mikey_strcmp(buf+i,"damn"))
X block(buf+i,"d--n");
X if (mikey_strcmp(buf+i,"fuck"))
X block(buf+i,"f--k");
X }
X}
X
X/**********************************************************************/
X
Xdo_socket()
X{
X char buf[64];
X
X if (!read_socket(dealer_socket, buf))
X death("Dealer died!!");
X do_command(buf);
X}
X
Xsend_message(msg)
Xchar *msg;
X{
X char buf[64];
X
X sprintf(buf, "M%s", msg);
X mikey_filter(buf);
X write_socket(dealer_socket, buf);
X}
X
Xsend_private_message(who, msg)
Xint who;
Xchar *msg;
X{
X char buf[64];
X
X sprintf(buf, ";%d%s", who, msg);
X mikey_filter(buf);
X write_socket(dealer_socket, buf);
X}
X
Xtoggle_private_messages()
X{
X char buf[2];
X
X buf[0] = '~';
X buf[1] = '\0';
X write_socket(dealer_socket, buf);
X}
X
Xsend_card(rank, suit)
Xint rank, suit;
X{
X char buf[64];
X
X sprintf(buf, "P%c%c", rank, suit);
X write_socket(dealer_socket, buf);
X}
X
Xsend_auto()
X{
X char buf[64];
X
X sprintf(buf, "P?%c", HEARTS);
X write_socket(dealer_socket, buf);
X}
X
Xclose_windows()
X{
X (void) signal(SIGINT, SIG_IGN);
X terminate();
X}
X
Xdeath(buf)
Xchar *buf;
X{
X close_windows();
X printf("%s\n", buf);
X exit(1);
X}
X
Xwimp_out()
X{
X close_windows();
X exit(0);
X}
X
Xget_rank(rch)
Xint rch;
X{
X int i;
X
X for (i = 1; i <= MAX_RANK; i++)
X if (rch == rnames[i])
X return(i);
X return(0);
X}
X
Xget_suit(sch)
Xint sch;
X{
X int i;
X
X for (i = 1; i <= MAX_SUIT; i++)
X if (sch == *snames[i])
X return(i);
X return(0);
X}
X
Xstart_new_game()
X{
X write_socket(dist_socket, "n");
X}
X
Xjoin_game(i)
Xint i;
X{
X char buf[64];
X
X (void) sprintf(buf, "j%d", i);
X write_socket(dist_socket, buf);
X}
X
Xdo_dist()
X{
X int i;
X char buf[64];
X
X if (read_socket(dist_socket, buf) == 0)
X dist_died(3);
X i = update_table(buf);
X show_tables(cur_screen_table);
X}
X
Xmain(argc, argv)
Xint argc;
Xchar **argv;
X{
X/* Call init first, in case the client wants to parse arguments */
X init(&argc, argv);
X
X if (argc > 2) {
X fprintf(stderr, "usage: %s [hostname]\n", *argv);
X exit(1);
X }
X if (argc == 2)
X (void) strcpy (host, *++argv);
X else
X (void) gethostname(host, sizeof(host)); /* host is this machine */
X
X first_game = TRUE;
X
X (void) signal(SIGINT, wimp_out);
X
X for (;;) {
X game_over = FALSE;
X get_going();
X do {
X scan();
X }
X while (!game_over);
X }
X}
X
END_OF_FILE
if test 6065 -ne `wc -c <'hearts.c'`; then
echo shar: \"'hearts.c'\" unpacked with wrong size!
fi
# end of 'hearts.c'
fi
if test -f 'hearts_dist.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'hearts_dist.c'\"
else
echo shar: Extracting \"'hearts_dist.c'\" \(10208 characters\)
sed "s/^X//" >'hearts_dist.c' <<'END_OF_FILE'
X/*
X * hearts_dist - distributor for hearts
X *
X * Keeps track of games in progress and allows new players to select which
X * game to join or start a new game.
X *
X *
X * Commands to hearts player:
X * tn Following info regards table n (n is unique identifier).
X * hn Now playing hand n.
X * rn Now playing round n.
X * pn<name> Player n is <name>.
X *
X * xn Table n has exited (game over).
X * g Get table number to join.
X * cn Connect to dealer on port n.
X *
X * Commands from hearts player:
X * jn Join table n.
X * n Start new game.
X *
X * Commands to dealer:
X * none yet?!?
X *
X * Commands from dealer:
X * hn Now playing hand n.
X * rn Now playing round n.
X * pn<name> Player n is <name>.
X *
X */
X
X#include "misc.h"
X#include "defs.h"
X#include "local.h"
X#include <string.h>
X#include <malloc.h>
X
Xtypedef struct table *table_ptr;
X
Xstruct table {
X table_ptr next_table; /* Points to next table entry */
X int table_id; /* Unique identifier */
X char player_name[4][9]; /* Name of players at table */
X int hand; /* Current dealer hand (1..4) */
X int round; /* Current round (1..13) */
X int port_num; /* Port # assigned */
X int socket; /* File descriptor for dealer */
X int pid; /* Process id for dealer */
X};
X
Xtypedef struct empty_table *empty_ptr;
X
Xstruct empty_table {
X empty_ptr next_empty;
X int port_num; /* Available port # */
X};
X
Xtypedef struct new_comer *new_ptr;
X
Xstruct new_comer {
X new_ptr next_new_comer;
X int socket; /* File descriptor */
X};
X
Xtable_ptr first_table;
Xempty_ptr first_empty;
Xnew_ptr first_new_comer;
X
Xint main_sock,
X next_port, /* Next port to assign */
X unique_id;
X
X/*
X * clear_table - dealer went away; drop that table.
X */
Xclear_table(tbl_ptr)
Xtable_ptr tbl_ptr;
X{
X table_ptr prev_ptr = NULL;
X table_ptr cur_ptr;
X empty_ptr temp_empty, cur_empty;
X new_ptr cur_new_comer;
X char buf[16];
X
X while (wait(0) != tbl_ptr->pid) /* Wait for process to die */
X ;
X (void) close(tbl_ptr->socket);
X /*
X * Inform new-comers
X */
X (void) sprintf(buf, "x%d", tbl_ptr->table_id);
X for (cur_new_comer = first_new_comer; cur_new_comer;
X cur_new_comer = cur_new_comer->next_new_comer)
X write_socket(cur_new_comer->socket, buf);
X for (cur_ptr = first_table; cur_ptr != tbl_ptr;
X cur_ptr = cur_ptr->next_table)
X prev_ptr = cur_ptr;
X if (prev_ptr)
X prev_ptr->next_table = tbl_ptr->next_table;
X else
X if ((first_table = tbl_ptr->next_table) == NULL &&
X first_new_comer == NULL)
X exit(0); /* No more dealers */
X ;
X if (first_table) {
X temp_empty = (empty_ptr) malloc(sizeof(struct empty_table));
X temp_empty->next_empty = NULL;
X temp_empty->port_num = tbl_ptr->port_num;
X free((char *) tbl_ptr);
X if (first_empty) {
X for (cur_empty = first_empty; cur_empty->next_empty;
X cur_empty = cur_empty->next_empty) ;
X cur_empty->next_empty = temp_empty;
X }
X else
X first_empty = temp_empty;
X }
X}
X
X/*
X * drop_new_comer - New comer exited
X */
Xdrop_new_comer(dead_new_comer)
Xnew_ptr dead_new_comer;
X{
X new_ptr cur_new_comer,
X prev_new_comer = NULL;
X
X (void) close(dead_new_comer->socket);
X for (cur_new_comer = first_new_comer; cur_new_comer != dead_new_comer;
X cur_new_comer = cur_new_comer->next_new_comer)
X prev_new_comer = cur_new_comer;
X if (prev_new_comer)
X prev_new_comer->next_new_comer = dead_new_comer->next_new_comer;
X else
X first_new_comer = dead_new_comer->next_new_comer;
X free((char *) dead_new_comer);
X if ((first_table == NULL) && (first_new_comer == NULL))
X exit(0); /* Nobody connected */
X}
X
X/*
X * new_player - New player has connected. Inform of games in progress and
X * request game to be joined.
X */
Xnew_player()
X{
X int new_socket; /* new file descriptor */
X char buf[64];
X struct sockaddr_in sockad;
X int ssize; /* makes accept happy */
X int i;
X new_ptr cur_new_comer, temp_new_comer;
X table_ptr cur_ptr;
X
X /*
X * add whoever's waiting
X */
X ssize = sizeof (sockad);
X if ((new_socket = accept(main_sock, &sockad, &ssize)) == -1) {
X perror("accept");
X exit(-1);
X }
X /*
X * add to list of new_comers
X */
X temp_new_comer = (new_ptr) malloc(sizeof(struct new_comer));
X temp_new_comer->next_new_comer = NULL;
X temp_new_comer->socket = new_socket;
X if (first_new_comer) {
X for (cur_new_comer = first_new_comer;
X cur_new_comer->next_new_comer;
X cur_new_comer = cur_new_comer->next_new_comer) ;
X cur_new_comer->next_new_comer = temp_new_comer;
X }
X else {
X first_new_comer = temp_new_comer;
X first_new_comer->next_new_comer = NULL;
X }
X /*
X * send info on games in progress
X */
X for (cur_ptr = first_table; cur_ptr; cur_ptr = cur_ptr->next_table) {
X (void) sprintf(buf, "t%d", cur_ptr->table_id);
X write_socket(new_socket, buf);
X (void) sprintf(buf, "h%d", cur_ptr->hand);
X write_socket(new_socket, buf);
X (void) sprintf(buf, "r%d", cur_ptr->round);
X write_socket(new_socket, buf);
X for (i = 0; i < 4; i++) {
X (void) sprintf(buf, "p%d%s", i, cur_ptr->player_name[i]);
X write_socket(new_socket, buf);
X }
X }
X write_socket(new_socket, "g");
X}
X
Xtell_new_comers(buf)
Xchar *buf;
X{
X new_ptr cur_new;
X
X for (cur_new = first_new_comer; cur_new;
X cur_new = cur_new->next_new_comer)
X write_socket(cur_new->socket, buf);
X}
X
X/*
X * join - join an existing table. table_num is unique identifier for table.
X */
Xjoin(table_num, socket)
Xint table_num, socket;
X{
X table_ptr cur_ptr;
X char buf[16];
X
X for (cur_ptr = first_table; cur_ptr && cur_ptr->table_id != table_num;
X cur_ptr = cur_ptr->next_table) ;
X if (cur_ptr) {
X (void) sprintf(buf, "c%d", cur_ptr->port_num);
X write_socket(socket, buf);
X }
X else
X write_socket(socket, "g"); /* Table doesn't exist?!? */
X}
X
X/*
X * new_table - start new hearts game.
X */
Xnew_table(cur_new_comer)
Xnew_ptr cur_new_comer;
X{
X table_ptr cur_table, new_tbl_ptr;
X empty_ptr tmp_empty;
X int i, socks[2];
X int dealer_port, dealer_socket, retry = 0;
X char buf[16], filename[1024];
X
X new_tbl_ptr = (table_ptr) malloc(sizeof(struct table));
X new_tbl_ptr->next_table = NULL;
X new_tbl_ptr->table_id = ++unique_id;
X for (i = 0; i < 4; i++)
X (void) strcpy(new_tbl_ptr->player_name[i], "<empty>");
X /*
X * Assign a port. Reassign a used port if available.
X */
X do {
X if (first_empty) {
X dealer_port = first_empty->port_num;
X tmp_empty = first_empty;
X first_empty = first_empty->next_empty;
X free((char *) tmp_empty);
X }
X else
X dealer_port = next_port++;
X /*
X * Make sure port is ok before assigning.
X */
X if ((dealer_socket = open_socket(dealer_port)) == 0)
X if (++ retry == 20) {
X fputs("Can't open a dealer port!\n", stderr);
X exit(1);
X }
X }
X while (dealer_socket == 0);
X new_tbl_ptr->port_num = dealer_port;
X /*
X * Open a socket pair to talk to dealer on.
X */
X if (socketpair(AF_UNIX, SOCK_STREAM, 0, socks) == -1) {
X perror("socketpair");
X exit(1);
X }
X switch (new_tbl_ptr->pid = fork()) {
X case 0:
X (void) setpgrp (0, getpid());
X (void) close(socks[0]);
X if (socks[1] != 3)
X (void) dup2(socks[1], 3); /* Remap to fd 3 */
X if (dealer_socket != 4)
X (void) dup2(dealer_socket, 4); /* Remap to fd 4 */
X sprintf(filename, "%s/%s", HEARTSLIB, HEARTSD);
X execl (filename, "heartsd", 0);
X exit(1);
X case -1:
X perror("fork");
X exit(1);
X }
X (void) close(socks[1]);
X (void) close(dealer_socket);
X
X new_tbl_ptr->socket = socks[0];
X if (first_table) {
X for (cur_table = first_table; cur_table->next_table;
X cur_table = cur_table->next_table)
X ;
X cur_table->next_table = new_tbl_ptr;
X }
X else
X first_table = new_tbl_ptr;
X /*
X * Inform hearts player of port # to connect on.
X */
X (void) sprintf(buf, "c%d", dealer_port);
X write_socket(cur_new_comer->socket, buf);
X}
X
Xmain(argc, argv)
Xchar **argv;
X{
X fd_type read_fd;
X table_ptr cur_table;
X new_ptr cur_new_comer;
X char buf[64], tmp_buf[64];
X int ret;
X int table_num;
X char debug;
X
X while (*++argv) {
X if (**argv == '-') {
X while (*++*argv) {
X switch (**argv) {
X case 'd':
X debug = TRUE;
X break;
X
X default:
X fprintf (stderr, "usage: hearts_dist [-d]\n");
X exit (1);
X break;
X }
X }
X }
X }
X
X first_table = NULL;
X first_empty = NULL;
X first_new_comer = NULL;
X next_port = DIST_PORT;
X unique_id = 0;
X
X if ((main_sock = open_socket(PORT)) == 0) {
X fputs("Distributor port in use!\n", stderr);
X exit(1);
X }
X if (!debug) {
X /*
X * Fork off and die. Thus hearts invoker wait() returns.
X * This signals ready to connect.
X */
X if (fork())
X exit (0);
X }
X
X for (;;) {
X fd_init(main_sock, &read_fd);
X /*
X * Build mask for dealers
X */
X for (cur_table = first_table; cur_table;
X cur_table = cur_table->next_table)
X fd_set(cur_table->socket, &read_fd);
X /*
X * Build mask for new_comers
X */
X for (cur_new_comer = first_new_comer; cur_new_comer;
X cur_new_comer = cur_new_comer->next_new_comer)
X fd_set(cur_new_comer->socket, &read_fd);
X
X /*
X * Wait for something to happen
X */
X if (select(WIDTH, &read_fd, (fd_type *) 0, (fd_type *) 0,
X (struct timeval *) 0)) {
X if (fd_isset(main_sock, read_fd))
X new_player();
X for (cur_table = first_table; cur_table;
X cur_table = cur_table->next_table)
X if (fd_isset(cur_table->socket, read_fd)) {
X /*
X * Message from dealer
X */
X ret = read_socket(cur_table->socket, buf);
X if (!ret) {
X clear_table(cur_table);
X break;
X } else {
X switch (buf[0]) {
X case 'h' :
X (void) sscanf(buf + 1, "%d", &cur_table->hand);
X break;
X case 'r' :
X (void) sscanf(buf + 1, "%d", &cur_table->round);
X break;
X case 'p' :
X (void) strcpy(cur_table->player_name[buf[1] - '0'], buf + 2);
X }
X (void) sprintf(tmp_buf, "t%d", cur_table->table_id);
X tell_new_comers(tmp_buf);
X tell_new_comers(buf);
X }
X }
X for (cur_new_comer = first_new_comer; cur_new_comer;
X cur_new_comer = cur_new_comer->next_new_comer)
X if (fd_isset(cur_new_comer->socket, read_fd)) {
X /*
X * Message from newcomer
X */
X ret = read_socket(cur_new_comer->socket, buf);
X if (ret)
X switch (buf[0]) {
X case 'j' :
X (void) sscanf(buf + 1, "%d", &table_num);
X join(table_num, cur_new_comer->socket);
X break;
X
X case 'n' :
X new_table(cur_new_comer);
X }
X else {
X drop_new_comer(cur_new_comer);
X break;
X }
X }
X }
X }
X}
X
END_OF_FILE
if test 10208 -ne `wc -c <'hearts_dist.c'`; then
echo shar: \"'hearts_dist.c'\" unpacked with wrong size!
fi
# end of 'hearts_dist.c'
fi
if test -f 'rank.bm' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'rank.bm'\"
else
echo shar: Extracting \"'rank.bm'\" \(2624 characters\)
sed "s/^X//" >'rank.bm' <<'END_OF_FILE'
X/*
X * Spider
X *
X * (c) Copyright 1989, Donald R. Woods and Sun Microsystems, Inc.
X * (c) Copyright 1990, David Lemke and Network Computing Devices Inc.
X *
X * See copyright.h for the terms of the copyright.
X *
X * @(#)rank.bm 2.1 90/04/25
X *
X */
X#define rank_width 9
X#define rank_height 14
Xstatic char rank_bits[13][28] = {
X 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6c, 0x00,
X 0x6c, 0x00, 0xc6, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0xc6, 0x00, 0x83, 0x01,
X 0x83, 0x01, 0x83, 0x01,
X 0x7c, 0x00, 0xfe, 0x00, 0xc7, 0x01, 0x83, 0x01, 0x80, 0x01, 0xc0, 0x01,
X 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00, 0x0e, 0x00, 0x87, 0x01,
X 0xff, 0x01, 0xff, 0x01,
X 0xff, 0x01, 0xff, 0x01, 0xc3, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x78, 0x00,
X 0xfc, 0x00, 0xc8, 0x01, 0x80, 0x01, 0x80, 0x01, 0x82, 0x01, 0xc7, 0x01,
X 0xfe, 0x00, 0x7c, 0x00,
X 0xe0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd8, 0x00, 0xd8, 0x00, 0xcc, 0x00,
X 0xcc, 0x00, 0xc6, 0x00, 0xc6, 0x00, 0xff, 0x01, 0xff, 0x01, 0xc0, 0x00,
X 0xe0, 0x01, 0xe0, 0x01,
X 0xff, 0x00, 0xff, 0x00, 0x03, 0x00, 0x03, 0x00, 0x7b, 0x00, 0xff, 0x00,
X 0xc7, 0x01, 0x82, 0x01, 0x80, 0x01, 0x80, 0x01, 0x82, 0x01, 0xc7, 0x01,
X 0xfe, 0x00, 0x7c, 0x00,
X 0x7c, 0x00, 0xfe, 0x00, 0xc7, 0x01, 0x83, 0x00, 0x03, 0x00, 0x7b, 0x00,
X 0xff, 0x00, 0xc7, 0x01, 0x83, 0x01, 0x83, 0x01, 0x83, 0x01, 0xc7, 0x01,
X 0xfe, 0x00, 0x7c, 0x00,
X 0xff, 0x01, 0xff, 0x01, 0x83, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0x60, 0x00,
X 0x60, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x18, 0x00, 0x18, 0x00,
X 0x18, 0x00, 0x18, 0x00,
X 0x7c, 0x00, 0xfe, 0x00, 0xc7, 0x01, 0x83, 0x01, 0xc7, 0x01, 0xfe, 0x00,
X 0x7c, 0x00, 0xfe, 0x00, 0xc7, 0x01, 0x83, 0x01, 0x83, 0x01, 0xc7, 0x01,
X 0xfe, 0x00, 0x7c, 0x00,
X 0x7c, 0x00, 0xfe, 0x00, 0xc7, 0x01, 0x83, 0x01, 0x83, 0x01, 0x83, 0x01,
X 0xc7, 0x01, 0xfe, 0x01, 0xbc, 0x01, 0x80, 0x01, 0x82, 0x01, 0xc7, 0x01,
X 0xfe, 0x00, 0x7c, 0x00,
X 0xf3, 0x00, 0xfb, 0x01, 0x9b, 0x01, 0x9b, 0x01, 0x9b, 0x01, 0x9b, 0x01,
X 0x9b, 0x01, 0x9b, 0x01, 0x9b, 0x01, 0x9b, 0x01, 0x9b, 0x01, 0x9b, 0x01,
X 0xfb, 0x01, 0xf3, 0x00,
X 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
X 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc3, 0x00, 0xc3, 0x00, 0xe7, 0x00,
X 0x7e, 0x00, 0x3c, 0x00,
X 0x38, 0x00, 0x7c, 0x00, 0xee, 0x00, 0xc6, 0x00, 0xc6, 0x00, 0xc6, 0x00,
X 0xc6, 0x00, 0xc6, 0x00, 0xdf, 0x00, 0xff, 0x00, 0xf6, 0x00, 0xee, 0x00,
X 0xfc, 0x01, 0xb8, 0x00,
X 0xef, 0x01, 0xef, 0x01, 0xe6, 0x00, 0x76, 0x00, 0x3e, 0x00, 0x1e, 0x00,
X 0x1e, 0x00, 0x3e, 0x00, 0x36, 0x00, 0x76, 0x00, 0x66, 0x00, 0xe6, 0x00,
X 0xef, 0x01, 0xef, 0x01};
END_OF_FILE
if test 2624 -ne `wc -c <'rank.bm'`; then
echo shar: \"'rank.bm'\" unpacked with wrong size!
fi
# end of 'rank.bm'
fi
echo shar: End of archive 4 \(of 6\).
cp /dev/null ark4isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 6 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
--
Molecular Simulations, Inc. mail: dcmartin@postgres.berkeley.edu
796 N. Pastoria Avenue uucp: uwvax!ucbvax!dcmartin
Sunnyvale, California 94086 at&t: 408/522-9236