[comp.sources.games] v03i044: xchess - chess display program using X windows, Part03/06

games-request@tekred.TEK.COM (01/19/88)

Submitted by: faustus@ic.berkeley.edu (Wayne A. Christopher)
Comp.sources.games: Volume 3, Issue 44
Archive-name: xchess/Part03

#! /bin/sh

# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 6)."
# Contents:  COPYING button.c jail.c record.c scrollText/scrollText.3
#   std.c valid.c xchess.h
# Wrapped by billr@tekred on Mon Jan 18 08:48:09 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f COPYING -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"COPYING\"
else
echo shar: Extracting \"COPYING\" \(6476 characters\)
sed "s/^X//" >COPYING <<'END_OF_COPYING'
X		 GNU X-CHESS GENERAL PUBLIC LICENSE
X
X Copyright (C) 1986 Free Software Foundation, Inc.
X Everyone is permitted to copy and distribute verbatim copies
X of this license, but changing it is not allowed.
X
X  The license agreements of most software companies keep you at the
Xmercy of those companies.  By contrast, our general public license is
Xintended to give everyone the right to share GNU X-Chess.  To make
Xsure that you get the rights we want you to have, we need to make
Xrestrictions that forbid anyone to deny you these rights or to ask you
Xto surrender the rights.  Hence this license agreement.
X
X  Specifically, we want to make sure that you have the right to give
Xaway copies of GNU X-Chess, that you receive source code or else can get it
Xif you want it, that you can change GNU X-Chess or use pieces of it in new
Xfree programs, and that you know you can do these things.
X
X  To make sure that everyone has such rights, we have to forbid you to
Xdeprive anyone else of these rights.  For example, if you distribute
Xcopies of GNU X-Chess, you must give the recipients all the rights that you
Xhave.  You must make sure that they, too, receive or can get the
Xsource code.  And you must tell them their rights.
X
X  Also, for our own protection, we must make certain that everyone
Xfinds out that there is no warranty for GNU X-Chess.  If GNU X-Chess is
Xmodified by someone else and passed on, we want its recipients to know
Xthat what they have is not what we distributed, so that any problems
Xintroduced by others will not reflect on our reputation.
X
X  Therefore the Free Software Foundation, Inc. makes the following
Xterms which say what you must do to be allowed to distribute or change
XGNU X-Chess.
X
X			COPYING POLICIES
X
X  1. You may copy and distribute verbatim copies of GNU X-Chess source
Xcode as you receive it, in any medium, provided that you conspicuously
Xand appropriately publish on each file a valid copyright notice
X"Copyright (C) 1986 Free Software Foundation, Inc.", containing the
Xyear of last change for the file in question; keep intact the notices
Xon all files that refer to this License Agreement and to the absence
Xof any warranty; and give any other recipients of the GNU X-Chess
Xprogram a copy of this License Agreement along with the program.
X
X  2. You may modify your copy or copies of GNU X-Chess source code or
Xany portion of it, and copy and distribute such modifications under
Xthe terms of Paragraph 1 above, provided that you also do the following:
X
X    a) cause the modified files to carry prominent notices stating
X    who last changed such files and the date of any change; and
X
X    b) cause the whole of any work that you distribute or publish,
X    that in whole or in part contains or is a derivative of GNU X-Chess
X    or any part thereof, to be freely distributed
X    and licensed to all third parties on terms identical to those
X    contained in this License Agreement (except that you may choose
X    to grant more extensive warranty protection to third parties,
X    at your option).
X
X    c) if the modified program serves as a text editor, cause it
X    when started running in the simplest and usual way, to print
X    an announcement including a valid copyright notice ("Copyright
X    (C)", the year of authorship, and all copyright owners' names),
X    saying that there is no warranty (or else, saying that you provide
X    a warranty) and that users may redistribute the program under
X    these conditions, and telling the user how to view a copy of
X    this License Agreement.
X
X  3. You may copy and distribute GNU X-Chess or any portion of it in
Xcompiled, executable or object code form under the terms of Paragraphs
X1 and 2 above provided that you do the following:
X
X    a) cause each such copy of GNU X-Chess to be accompanied by the
X    corresponding machine-readable source code; or
X
X    b) cause each such copy of GNU X-Chess to be accompanied by a
X    written offer, with no time limit, to give any third party
X    free (except for a nominal shipping charge) machine readable
X    copy of the corresponding source code; or
X
X    c) in the case of a recipient of GNU X-Chess in compiled, executable
X    or object code form (without the corresponding source code) you
X    shall cause copies you distribute to be accompanied by a copy
X    of the written offer of source code which you received along
X    with the copy of GNU X-Chess.
X
X  4. You may not copy, sublicense, distribute or transfer GNU X-Chess
Xexcept as expressly provided under this License Agreement.  Any attempt
Xotherwise to copy, sublicense, distribute or transfer GNU X-Chess is void and
Xyour rights to use GNU X-Chess under this License agreement shall be
Xautomatically terminated.  However, parties who have received computer
Xsoftware programs from you with this License Agreement will not have
Xtheir licenses terminated so long as such parties remain in full compliance.
X
XYour comments and suggestions about our licensing policies and our
Xsoftware are welcome!  Please contact the Free Software Foundation, Inc.,
X1000 Mass Ave, Cambridge, MA 02138, or call (617) 876-3296.
X
X			   NO WARRANTY
X
X  BECAUSE GNU X-CHESS IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
XNO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
XWHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
XAND/OR OTHER PARTIES PROVIDE GNU X-CHESS "AS IS" WITHOUT WARRANTY OF ANY
XKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
XIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
XPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
XPROGRAM IS WITH YOU.  SHOULD THE GNU X-CHESS PROGRAM PROVE DEFECTIVE,
XYOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
X
X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL FREE SOFTWARE
XFOUNDATION, INC., AND/OR ANY OTHER PARTY WHO MAY MODIFY AND
XREDISTRIBUTE GNU X-CHESS AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
XDAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL,
XINCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
XINABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
XBEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
XFAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
XFREE SOFTWARE FOUNDATION, INC.) THE PROGRAM, EVEN IF YOU HAVE BEEN
XADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
XOTHER PARTY.
X======================================================================
END_OF_COPYING
if test 6476 -ne `wc -c <COPYING`; then
    echo shar: \"COPYING\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f button.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"button.c\"
else
echo shar: Extracting \"button.c\" \(7647 characters\)
sed "s/^X//" >button.c <<'END_OF_button.c'
X/* This file contains code for X-CHESS.
X   Copyright (C) 1986 Free Software Foundation, Inc.
X
XThis file is part of X-CHESS.
X
XX-CHESS is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY.  No author or distributor
Xaccepts responsibility to anyone for the consequences of using it
Xor for whether it serves any particular purpose or works at all,
Xunless he says so in writing.  Refer to the X-CHESS General Public
XLicense for full details.
X
XEveryone is granted permission to copy, modify and redistribute
XX-CHESS, but only under the conditions described in the
XX-CHESS General Public License.   A copy of this license is
Xsupposed to have been given to you along with X-CHESS so you
Xcan know your rights and responsibilities.  It should be in a
Xfile named COPYING.  Among other things, the copyright notice
Xand this notice must be preserved on all copies.  */
X
X
X/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/26 12:09:41 $
X *           $Source: /users/faustus/xchess/RCS/button.c,v $
X * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
X *	Permission is granted to do anything with this code except sell it
X *	or remove this message.
X *
X * Do stuff with the buttons.
X * The configuration we're using is:	Draw	Back	Pause
X *					Resign	Fwd	Flip
X *					Reset	Save	Switch
X */
X
X#include "xchess.h"
X
Xtypedef enum choice { NOCHOICE, DRAW, RESIGN, REPLAY, SWITCH, FORE, SAVE,
X		STOP, FLIP, RESTART } choice;
X
Xstatic struct but {
X	char *label;
X	int x, y;
X	int width, height;
X	choice which;
X} buts[] = {
X	{ "Draw", 0, 5, 108, 29, DRAW } ,
X	{ "Back", 109, 5, 108, 29, REPLAY } ,
X	{ "Pause", 219, 5, 108, 29, STOP } ,
X	{ "Resign", 0, 35, 108, 29, RESIGN } ,
X	{ "Fwd", 109, 35, 108, 29, FORE } ,
X	{ "Flip", 219, 35, 108, 29, FLIP } ,
X	{ "Reset", 0, 66, 108, 29, RESTART } ,
X	{ "Save", 109, 66, 108, 29, SAVE } ,
X	{ "Switch", 219, 66, 108, 29, SWITCH }
X} ;
X
Xvoid
Xbutton_draw(win)
X	windata *win;
X{
X	int i, x, numbuts = sizeof (buts) / sizeof (struct but);
X
X	XSetDisplay(win->display);
X	XLine(win->buttonwin, 0, 29, BUTTON_WIDTH, 29, BORDER_WIDTH, 
X			BORDER_WIDTH, win->border.pixel, GXcopy, AllPlanes);
X	XLine(win->buttonwin, 0, 60, BUTTON_WIDTH, 60, BORDER_WIDTH,
X			BORDER_WIDTH, win->border.pixel, GXcopy, AllPlanes);
X	XLine(win->buttonwin, 108, 0, 108, BUTTON_HEIGHT, BORDER_WIDTH,
X			BORDER_WIDTH, win->border.pixel, GXcopy, AllPlanes);
X	XLine(win->buttonwin, 219, 0, 219, BUTTON_HEIGHT, BORDER_WIDTH,
X			BORDER_WIDTH, win->border.pixel, GXcopy, AllPlanes);
X
X	for (i = 0; i < numbuts; i++) {
X		x = (buts[i].width - XStringWidth(buts[i].label, win->large, 0,
X				0)) / 2;
X		XText(win->buttonwin, buts[i].x + x, buts[i].y, buts[i].label,
X				strlen(buts[i].label), win->large->id,
X				win->textcolor.pixel, win->textback.pixel);
X	}
X	return;
X}
X
Xvoid
Xbutton_service(win, event)
X	windata *win;
X	XEvent *event;
X{
X	XKeyOrButtonEvent *ev = (XKeyOrButtonEvent *) event;
X	choice c;
X	int i, numbuts = sizeof (buts) / sizeof (struct but);
X	char *s;
X
X	for (i = 0; i < numbuts; i++)
X		if ((ev->x >= buts[i].x) && (ev->x <= buts[i].x +
X				buts[i].width) && (ev->y >= buts[i].y) &&
X				(ev->y <= buts[i].y + buts[i].height)) {
X			c = buts[i].which;
X			break;
X		}
X	if ((i == numbuts) || (c == NOCHOICE)) {
X		message_add(win, "Bad choice.\n", true);
X		return;
X	}
X
X	if (loading_flag && (c != STOP)) {
X		message_add(win, "You can only use PAUSE now\n", true);
X		return;
X	}
X
X	switch (c) {
X	    case DRAW:
X		if (!oneboard) {
X			message_add(win, "Just a sec...\n", false);
X			if (!pop_question(((win == win1) ? win2 : win1),
X"The other player wants\nto call the game a draw.\nDo you agree?\n")) {
X				message_add(win,
X				"The other player declines the draw\n", false);
X				return;
X			}
X		}
X		message_add(win1, "Draw agreed.\n", false);
X		if (!oneboard)
X			message_add(win2, "Draw agreed.\n", false);
X		cleanup("Draw agreed.");
X		break;
X
X	    case RESIGN:
X		if (!pop_question(win, "Are you sure\nyou want to resign?"))
X			return;
X		if ((oneboard && !progflag) || (nexttomove == win->color)) {
X			if (nexttomove == WHITE)
X				s = "White resigns.";
X			else
X				s = "Black resigns.";
X			if (oneboard) {
X				message_add(win, s, false);
X				message_add(win, "\n", false);
X			} else {
X				message_add(win1, s, false);
X				message_add(win, "\n", false);
X				message_add(win2, s, false);
X				message_add(win, "\n", false);
X			}
X			cleanup(s);
X		} else {
X			message_add(win, "It's not your turn.\n", true);
X		}
X		break;
X
X	    case REPLAY:
X		if (!oneboard) {
X			message_add(win, "Just a sec...\n", false);
X			if (!pop_question(((win == win1) ? win2 : win1),
X"The other player wants\nto take back his last move.\nDo you let him?\n")) {
X				message_add(win,
X				"The other player refuses...\n", false);
X				return;
X			}
X		}
X		if (!moves) {
X			message_add(win, "Can't back up...\n", true);
X			break;
X		}
X		message_add(win1, "Replaying...\n", false);
X		if (!oneboard)
X			message_add(win2, "Replaying...\n", false);
X		replay();
X		break;
X
X	    case FORE:
X		if (!oneboard) {
X			message_add(win, "Just a sec...\n", false);
X			if (!pop_question(((win == win1) ? win2 : win1),
X"The other player wants\nto do a 'fore'.\nIs that ok with you?\n")) {
X				message_add(win,
X				"The other player refuses...\n", false);
X				return;
X			}
X		}
X		if (!foremoves) {
X			message_add(win, "Can't go forward...\n", true);
X			break;
X		}
X		message_add(win1, "Moving forward...\n", false);
X		if (!oneboard)
X			message_add(win2, "Moving forward...\n", false);
X		forward();
X		break;
X
X	    case SWITCH:
X		message_add(win, "You can't switch yet.\n", false);
X		break;
X
X	    case SAVE:
X		if (saveflag) {
X			message_add(win, 
X				"Game is already being logged in file '", true);
X			message_add(win, record_file, true);
X			message_add(win, "'.\n", true);
X		} else {
X			message_add(win, "Saving game to file '", false);
X			message_add(win, record_file, false);
X			message_add(win, "'.\n", false);
X			record_save();
X		}
X		break;
X
X	    case STOP:
X		if (loading_flag) {
X			loading_paused = (loading_paused ? false : true);
X			message_add(win, loading_paused ?
X				"Stopped.\nHit 'Pause' again to restart.\n" :
X				"Restarted.\n", false);
X		} else if (clock_started) {
X			if (!oneboard) {
X				message_add(win, "Just a sec...\n", false);
X				if (!pop_question(((win == win1) ? win2 : win1),
X"The other player wants\nto stop the clock.\nDo you let him?\n")) {
X					message_add(win,
X					"The other player refuses to pause.\n",
X					false);
X					return;
X				}
X			}
X			message_add(win1, 
X			"Clock stopped.\nHit 'Pause' again to restart.\n",
X					false);
X			if (!oneboard)
X				message_add(win2, 
X			"Clock stopped.\nHit 'Pause' again to restart.\n", 
X					false);
X			clock_started = false;
X		} else {
X			if (!oneboard) {
X				message_add(win, "Just a sec...\n", false);
X				if (!pop_question(((win == win1) ? win2 : win1),
X"The other player wants\nto start the clock again.\nIs that ok?\n")) {
X					message_add(win,
X				"The other player refuses to resume.\n",
X					false);
X					return;
X				}
X			}
X			message_add(win1, "Clock restarted.\n", false);
X			if (!oneboard)
X				message_add(win2, "Clock restarted.\n", false);
X			clock_started = true;
X		}
X		break;
X
X	    case FLIP:
X		message_add(win, "Flipping window...\n", false);
X		win->flipped = win->flipped ? false : true;
X		win_redraw(win, (XEvent *) NULL);
X		break;
X
X	    case RESTART:
X		if (!oneboard) {
X			message_add(win, "Just a sec...\n", false);
X			if (!pop_question(((win == win1) ? win2 : win1),
X"The other player wants\nto restart the game.\nDo you agree?\n")) {
X				message_add(win,
X				"The other player refuses to reset\n", false);
X				return;
X			}
X		}
X		message_add(win, "Restarting game.\n", false);
X		restart();
X		break;
X	}
X	return;
X}
X
END_OF_button.c
if test 7647 -ne `wc -c <button.c`; then
    echo shar: \"button.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f jail.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"jail.c\"
else
echo shar: Extracting \"jail.c\" \(5459 characters\)
sed "s/^X//" >jail.c <<'END_OF_jail.c'
X/* This file contains code for X-CHESS.
X   Copyright (C) 1986 Free Software Foundation, Inc.
X
XThis file is part of X-CHESS.
X
XX-CHESS is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY.  No author or distributor
Xaccepts responsibility to anyone for the consequences of using it
Xor for whether it serves any particular purpose or works at all,
Xunless he says so in writing.  Refer to the X-CHESS General Public
XLicense for full details.
X
XEveryone is granted permission to copy, modify and redistribute
XX-CHESS, but only under the conditions described in the
XX-CHESS General Public License.   A copy of this license is
Xsupposed to have been given to you along with X-CHESS so you
Xcan know your rights and responsibilities.  It should be in a
Xfile named COPYING.  Among other things, the copyright notice
Xand this notice must be preserved on all copies.  */
X
X
X/* RCS Info: $Revision: 1.3 $ on $Date: 86/11/26 12:09:54 $
X *           $Source: /users/faustus/xchess/RCS/jail.c,v $
X * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
X *	Permission is granted to do anything with this code except sell it
X *	or remove this message.
X *
X */
X
X#include "xchess.h"
X
X#include "pawn_small.bitmap"
X#include "rook_small.bitmap"
X#include "knight_small.bitmap"
X#include "bishop_small.bitmap"
X#include "queen_small.bitmap"
X#include "king_small.bitmap"
X
X#include "pawn_small_outline.bitmap"
X#include "rook_small_outline.bitmap"
X#include "knight_small_outline.bitmap"
X#include "bishop_small_outline.bitmap"
X#include "queen_small_outline.bitmap"
X#include "king_small_outline.bitmap"
X
Xstatic bool pos[32];
X
Xstatic piecetype pcs[] = { KING, QUEEN, ROOK, ROOK, BISHOP, BISHOP, KNIGHT,
X		KNIGHT, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN } ;
X
Xextern int piecepos();
Xextern short *bitsget();
X
Xvoid
Xjail_init(win)
X	windata *win;
X{
X	int i;
X
X	for (i = 0; i < 32; i++)
X		pos[i] = false;
X	jail_draw(win);
X	return;
X}
X
X#define JAIL_HEADER	"Captured Pieces"
X
Xvoid
Xjail_draw(win)
X	windata *win;
X{
X	int i;
X	short *bits;
X	piece p;
X
X	XSetDisplay(win->display);
X
X	i = XStringWidth(JAIL_HEADER, win->large, 0, 0);
X	XText(win->jailwin, (JAIL_WIDTH - i) / 2, 1, JAIL_HEADER,
X			strlen(JAIL_HEADER), win->large->id, 
X			win->textcolor.pixel, win->textback.pixel);
X	for (i = 0; i < 16; i++)
X		if (pos[i]) {
X			p.color = WHITE;
X			p.type = pcs[i];
X			bits = bitsget(&p);
X			XBitmapBitsPut(win->jailwin, 5 + (i % 8) * 32, 25 +
X					(i / 8) * 32, 32, 32, bits,
X					win->blackpiece.pixel,
X					win->textback.pixel,
X					(Bitmap) 0, GXcopy, AllPlanes);
X		} else {
X			XPixSet(win->jailwin, 5 + (i % 8) * 32, 25 + (i / 8) *
X					32, 32, 32, win->textback.pixel);
X		}
X	for (i = 0; i < 16; i++)
X		if (pos[i + 16]) {
X			p.color = BLACK;
X			p.type = pcs[i];
X			bits = bitsget(&p);
X			XBitmapBitsPut(win->jailwin, 5 + (i % 8) * 32, 94 +
X					(i / 8) * 32, 32, 32, bits,
X					win->blackpiece.pixel,
X					win->textback.pixel,
X					(Bitmap) 0, GXcopy,
X					AllPlanes);
X		} else {
X			XPixSet(win->jailwin, 5 + (i % 8) * 32, 94 + (i / 8) *
X					32, 32, 32, win->textback.pixel);
X		}
X
X	return;
X}
X
Xvoid
Xjail_add(p)
X	piece *p;
X{
X	int i = piecepos(p, false);
X	short *bits;
X
X	pos[i] = true;
X
X	bits = bitsget(p);
X
X	XSetDisplay(win1->display);
X	XBitmapBitsPut(win1->jailwin, 5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) +
X			(i / 8) * 32, 32, 32, bits, win1->blackpiece.pixel,
X			win1->textback.pixel, (Bitmap) 0, GXcopy, AllPlanes);
X	if (!oneboard) {
X		XSetDisplay(win2->display);
X		XBitmapBitsPut(win2->jailwin, 5 + (i % 8) * 32, ((i >= 16) ? 30
X				: 25) + (i / 8) * 32, 32, 32, bits,
X				win2->blackpiece.pixel, win2->textback.pixel,
X				(Bitmap) 0, GXcopy, AllPlanes);
X	}
X
X	return;
X}
X
Xvoid
Xjail_remove(p)
X	piece *p;
X{
X	int i = piecepos(p, true);
X
X	pos[i] = false;
X
X	XSetDisplay(win1->display);
X	XPixSet(win1->jailwin, 5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) +
X			(i / 8) * 32, 32, 32, win1->textback.pixel);
X	if (!oneboard) {
X		XSetDisplay(win2->display);
X		XPixSet(win2->jailwin, 5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) +
X				(i / 8) * 32, 32, 32, win2->textback.pixel);
X	}
X
X	return;
X}
X
Xstatic short *
Xbitsget(p)
X	piece *p;
X{
X	short *bits;
X
X	switch (p->type) {
X	    case PAWN:
X		bits = (p->color == WHITE) ? pawn_small_outline_bits :
X				pawn_small_bits;
X		break;
X
X	    case ROOK:
X		bits = (p->color == WHITE) ? rook_small_outline_bits :
X				rook_small_bits;
X		break;
X
X	    case KNIGHT:
X		bits = (p->color == WHITE) ? knight_small_outline_bits :
X				knight_small_bits;
X		break;
X
X	    case BISHOP:
X		bits = (p->color == WHITE) ? bishop_small_outline_bits :
X				bishop_small_bits;
X		break;
X
X	    case QUEEN:
X		bits = (p->color == WHITE) ? queen_small_outline_bits :
X				queen_small_bits;
X		break;
X
X	    case KING:
X		bits = (p->color == WHITE) ? king_small_outline_bits :
X				king_small_bits;
X		break;
X	}
X	return (bits);
X}
X
Xstatic int
Xpiecepos(p, there)
X	piece *p;
X	bool there;
X{
X	int i, base = (p->color == WHITE) ? 0 : 16;
X
X	switch (p->type) {
X	    case PAWN:
X		for (i = base + 8; (i < base + 15) && pos[i]; i++)
X			;
X		if (there && !pos[i])
X			i--;
X		break;
X
X	    case KING:
X		/* Hmm... */
X		i = base;
X		break;
X
X	    case QUEEN:
X		i = base + 1;
X		break;
X
X	    case ROOK:
X		i = base + 2;
X		if ((there && pos[i + 1]) || (!there && pos[i]))
X			i++;
X		break;
X
X	    case BISHOP:
X		i = base + 4;
X		if ((there && pos[i + 1]) || (!there && pos[i]))
X			i++;
X		break;
X
X	    case KNIGHT:
X		i = base + 6;
X		if ((there && pos[i + 1]) || (!there && pos[i]))
X			i++;
X		break;
X	}
X	return (i);
X}
X
END_OF_jail.c
if test 5459 -ne `wc -c <jail.c`; then
    echo shar: \"jail.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f record.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"record.c\"
else
echo shar: Extracting \"record.c\" \(7027 characters\)
sed "s/^X//" >record.c <<'END_OF_record.c'
X/* This file contains code for X-CHESS.
X   Copyright (C) 1986 Free Software Foundation, Inc.
X
XThis file is part of X-CHESS.
X
XX-CHESS is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY.  No author or distributor
Xaccepts responsibility to anyone for the consequences of using it
Xor for whether it serves any particular purpose or works at all,
Xunless he says so in writing.  Refer to the X-CHESS General Public
XLicense for full details.
X
XEveryone is granted permission to copy, modify and redistribute
XX-CHESS, but only under the conditions described in the
XX-CHESS General Public License.   A copy of this license is
Xsupposed to have been given to you along with X-CHESS so you
Xcan know your rights and responsibilities.  It should be in a
Xfile named COPYING.  Among other things, the copyright notice
Xand this notice must be preserved on all copies.  */
X
X
X/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/23 17:18:20 $
X *           $Source: /users/faustus/xchess/RCS/record.c,v $
X * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
X *	Permission is granted to do anything with this code except sell it
X *	or remove this message.
X *
X * Deal with recording moves.
X */
X/*
X * Converted imbedded ^F and ^H characters to \006 and \010,
X * respectively.   billr@tekred.tek.com  1/18/88
X */
X
X#include "xchess.h"
X
X#define smartass
X
Xbool record_english = true;
Xchar *record_file = DEF_RECORD_FILE;
Xint movenum = 0;
Xbool saveflag = true; /* Until it's debugged ... false;*/
X
Xstatic char *colnames[] = { "qr", "qn", "qb", "q", "k", "kb", "kn", "kr" } ;
Xstatic char *pcnames[] = { "P", "R", "N", "B", "Q", "K" } ;
X
Xstatic char *movestring();
Xstatic char *tstring();
Xstatic FILE *backup;
X
X#define RECORD_HEADER	"\0061    XChess Game Record\0060\n\n"
X
Xvoid
Xrecord_init(win)
X	windata *win;
X{
X	int i;
X
X	i = XStringWidth(RECORD_HEADER, win->medium, 0, 0);
X	i = (40 * win->small->width - i * win->medium->width) /
X			win->medium->width / 2;
X	TxtGrab(win->recwin, "xchess", win->small, win->textback.pixel,
X			win->textcolor.pixel, win->cursorcolor.pixel);
X	TxtAddFont(win->recwin, 1, win->medium, win->textcolor.pixel);
X	for (; i > 0; i++)
X		TxtWriteStr(win->recwin, " ");
X	TxtWriteStr(win->recwin, RECORD_HEADER);
X	
X	if (saveflag) {
X		if (!(backup = fopen(record_file, "w"))) {
X			perror(record_file);
X			saveflag = false;
X		} else {
X			fprintf(backup, "X Chess -- %s\n", datestring());
X			if (dispname2)
X				fprintf(backup, "\tWhite on %s, black on %s\n", 
X						dispname1, dispname2);
X			else
X				fprintf(backup, "\tGame played on %s\n",
X						dispname1);
X			fprintf(backup, "\t%s\n", record_english ? "english" :
X					"algebraic");
X			fflush(backup);
X		}
X	}
X
X	movenum = 0;
X	return;
X}
X
Xvoid
Xrecord_reset()
X{
X	XSetDisplay(win1->display);
X	TxtWriteStr(win1->recwin, "\n\n\0061    New Game\0060\n\n");
X	if (!oneboard) {
X		XSetDisplay(win2->display);
X		TxtWriteStr(win2->recwin, "\n\n\0061    New Game\0060\n\n");
X	}
X	movenum = 0;
X	if (saveflag) {
X		fprintf(backup, "\n\nNew Game\n\n");
X		fflush(backup);
X	}
X	return;
X}
X
Xvoid
Xrecord_end(s)
X	char *s;
X{
X	char buf[BSIZE];
X
X	sprintf(buf, "\n%s\n", s);
X	XSetDisplay(win1->display);
X	TxtWriteStr(win1->recwin, s);
X	if (!oneboard) {
X		XSetDisplay(win2->display);
X		TxtWriteStr(win2->recwin, s);
X	}
X	if (saveflag) {
X		fprintf(backup, "\n%s\n", s);
X		fprintf(backup, "Time: white: %s, ", tstring(whiteseconds));
X		fprintf(backup, "black: %s\n", tstring(blackseconds));
X		fclose(backup);
X	}
X	return;
X}
X
Xvoid
Xrecord_save()
X{
X	move *m;
X	FILE *fp;
X	int i;
X	char *s;
X
X	if (!(fp = fopen(record_file, "w"))) {
X		perror(record_file);
X		return;
X	}
X	fprintf(fp, "X Chess -- %s\n", datestring());
X	if (dispname2)
X		fprintf(fp, "\tWhite on %s, black on %s\n", 
X				dispname1, dispname2);
X	else
X		fprintf(fp, "\tGame played on %s\n", dispname1);
X	fprintf(fp, "\t%s\n", record_english ? "english" : "algebraic");
X
X	for (m = moves, i = 1; m; i++) {
X		s = movestring(m);
X		fprintf(fp, "%2d. %-16s ", i, s);
X		m = m->next;
X		if (m)
X			s = movestring(m);
X		else
X			s = "";
X		fprintf(fp, "%s\n", s);
X		if (m)
X			m = m->next;
X	}
X	fclose(fp);
X	return;
X}
X
Xvoid
Xrecord_move(m)
X	move *m;
X{
X	char *s, buf[BSIZE];
X
X	s = movestring(m);
X
X	if (m->piece.color == WHITE) {
X		movenum++;
X		sprintf(buf, "%2d. %-16s ", movenum, s);
X	} else {
X		sprintf(buf, "%-16s\n", s);
X	}
X	XSetDisplay(win1->display);
X	TxtWriteStr(win1->recwin, buf);
X	if (!oneboard) {
X		XSetDisplay(win2->display);
X		TxtWriteStr(win2->recwin, buf);
X	}
X	if (saveflag) {
X		fprintf(backup, "%s", buf);
X		fflush(backup);
X	}
X
X	return;
X}
X
Xvoid
Xrecord_back()
X{
X	char *s = (nexttomove == WHITE) ? "\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010"
X			: "\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010";
X
X	XSetDisplay(win1->display);
X	TxtWriteStr(win1->recwin, s);
X	if (!oneboard) {
X		XSetDisplay(win2->display);
X		TxtWriteStr(win2->recwin, s);
X	}
X
X	if (nexttomove == BLACK)
X		movenum--;
X	if (saveflag) {
X		fseek(backup, (nexttomove == WHITE) ? -17 : -21, 1);
X		fflush(backup);
X	}
X
X	return;
X}
X
Xstatic char *
Xmovestring(m)
X	move *m;
X{
X	int fy, ty;
X	static char buf[BSIZE];
X
X	if (!record_english || (m->piece.color == WHITE)) {
X		fy = SIZE - m->fromy;
X		ty = SIZE - m->toy;
X	} else {
X		fy = m->fromy + 1;
X		ty = m->toy + 1;
X	}
X
X	switch (m->type) {
X	    case MOVE:
X		if (record_english)
X			sprintf(buf, "%s/%s%d-%s%d%s", pcnames[(int) m->piece.
X					type], colnames[m->fromx], fy,
X					colnames[m->tox], ty, m->check ? "+" :
X					"");
X		else
X			sprintf(buf, "%c%d%c%d", 'a' + m->fromx, fy, 'a' +
X					m->tox, ty);
X		break;
X	    case CAPTURE:
X		if (record_english)
X			sprintf(buf, "%s/%s%dx%s/%s%d%s%s",
X					pcnames[(int) m->piece.type],
X					colnames[m->fromx], fy,
X					pcnames[(int) m->taken.type],
X					colnames[m->tox], ty,
X					m->enpassant ? "e.p." : "",
X					m->check ? "+" : "");
X		else
X			sprintf(buf, "%c%d%c%d", 'a' + m->fromx, fy, 'a' +
X					m->tox, ty);
X		break;
X
X	    case KCASTLE:
X		if (record_english)
X			sprintf(buf, "O-O%s", m->check ? "ch" : "");
X		else if (m->piece.color == WHITE)
X			strcpy(buf, "e1g1");
X		else
X			strcpy(buf, "e8g8");
X		break;
X
X	    case QCASTLE:
X		if (record_english)
X			sprintf(buf, "O-O-O%s", m->check ? "ch" : "");
X		else if (m->piece.color == WHITE)
X			strcpy(buf, "e1c1");
X		else
X			strcpy(buf, "e8c8");
X		break;
X
X	    default:
X		sprintf(buf, "something strange");
X		break;
X	}
X	if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) && 
X			(m->toy == 7)) || ((m->piece.color == WHITE) &&
X			(m->toy == 0)))) 
X		strcat(buf, "(Q)");
X
X#ifdef smartass
X	if (!(random() % 50))
X		strcat(buf, "?");
X	else if (!(random() % 50))
X		strcat(buf, "!");
X	else if (!(random() % 500))
X		strcat(buf, "???");
X	else if (!(random() % 500))
X		strcat(buf, "!!!");
X#endif smartass
X
X	return (buf);
X}
X
Xstatic char *
Xtstring(s)
X	int s;
X{
X	static char buf[64];
X
X	if (s > 3600)
X		sprintf(buf, "%dh %dm %ds", s / 3600, (s % 3600) / 60, s % 60);
X	else if (s > 60)
X		sprintf(buf, "%dm %ds", (s % 3600) / 60, s % 60);
X	else
X		sprintf(buf, "%ds", s);
X	return (buf);
X}
X
END_OF_record.c
if test 7027 -ne `wc -c <record.c`; then
    echo shar: \"record.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f scrollText/scrollText.3 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"scrollText/scrollText.3\"
else
echo shar: Extracting \"scrollText/scrollText.3\" \(8425 characters\)
sed "s/^X//" >scrollText/scrollText.3 <<'END_OF_scrollText/scrollText.3'
X.TH SCROLLTEXT 3 "14 September 1986"
X.UC
X.SH NAME
XscrollText - Multi-font scrollable text windows for X
X.SH SYNOPSIS
X.nf
X.B #include <X/Xlib.h>
X.B #include "scrollText.h"
X.PP
X.B "int TxtGrab(textWin, program, mainFont, bg, fg, cur)"
XWindow textWin;
Xchar *program;
XFontInfo *mainFont;
Xint bg, fg, cur;
X.PP
X.B int TxtRelease(w)
XWindow w;
X.PP
X.B int TxtAddFont(textWin, fontNumber, newFont, newColor)
XWindow textWin;
Xint fontNumber;
XFontInfo *newFont;
Xint newColor;
X.PP
X.B int TxtWinP(w)
XWindow w;
X.PP
X.B int TxtClear(w)
XWindow w;
X.PP
X.B int TxtWriteStr(w, str)
XWindow w;
Xchar *str;
X.PP
X.B int TxtJamStr(w, str)
XWindow w;
Xchar *str;
X.PP
X.B int TxtRepaint(w)
XWindow w;
X.PP
X.B int TxtFilter(evt)
XXEvent *evt;
X.SH DESCRIPTION
XThe
X.I scrollText
Xpackage implements a multi-font, multi-color, scrollable text window abstraction
Xwhich runs over the X Window System.
XThe package supports any number of windows each with its own scroll bar
Xand character buffer.
XEach window can have up to eight fonts loaded.  A color may be
Xspecified for each loaded font.
XThe fonts can be mixed freely using a change font character
Xcontrol sequence.
XThe scrolling operations supported are scroll relative
Xto scroll bar,  line to top,
Xand top line to here.
XThe size of the character buffer for each window is limited only by
Xthe process space of the controlling program.
X.PP
X.B TxtGrab
Xtakes control of a previously created window, \fItextWin\fP,
Xand makes it into a
Xscrollable output window.
XThe string
X.I program
Xis used to look up X defaults for the package (see section
X\fIX Defaults\fP).
XThe parameter
X.I mainFont
Xis the initial font used for drawing text in the window.  This
Xfont is loaded into slot zero.
X.I TxtGrab
Xassumes this record is fully filled (including the width table).
XThe X library routine
X.I XOpenFont
Xcan be used to obtain fully filled font record structures.
XAdditional fonts can be loaded using
X.I TxtAddFont
X(described below).
XThe pixel value \fIfg\fP will be used to draw the scroll bar and
Xis also used as the initial color for
X.I mainFont.
XThe pixel value \fIbg\fP will be used as the background for drawing all text.
X\fIbg\fP is also used as the background for the scroll bar subwindow.
XThe color of the text cursor is set to
X.I cur.
XIn order for the text window to work properly,  the programmer
Xmust select \fIExposeRegion\fP and \fIExposeCopy\fP events
Xon the window in addition to any other events the programmer
Xmight wish to register.
XThe routine returns a non-zero value if the window was sucessfully
Xgrabbed.
X.PP
X.B TxtRelease
Xreleases control of a previously grabbed window.
XAll resources consumed by the text window package are reclaimed.
XThe window itself is
X.I not
Xdestroyed.
X.PP
X.B TxtAddFont
Xloads a new font so that it can be used in a previously grabbed
Xtext window.
XThe parameter
X.I fontNumber
Xis used to specify the slot for the new font.
XThere are eight font slots numbered 0 through 7.
XIf there is already a font in the specified slot,
Xit will be replaced with the new one and an automatic redraw
Xof the screen contents will take place.
XSee
X.I TxtWriteStr
Xand
X.I TxtJamStr
Xfor details on using multiple fonts.
XThe pixel value
X.I newColor
Xspecifies the foreground color for the font.  If TXT_NO_COLOR
Xis specified,  the color will default to the foreground color
Xsupplied when the window was grabbed.
XThe programmer can change just the color of a font by specifing
Xa null font for a given slot.
XThe routine returns a non-zero value if the font
Xwas sucessfully loaded.
X.PP
X.B TxtWinP
Xreturns a non-zero value if the specified window has been previously
Xgrabbed using
X.I TxtGrab.
XIf it is not a text window,  the routine returns zero.
X.PP
X.B TxtClear
Xclears the specified window of its contents and resets the
Xcurrent writing position to the upper left hand corner
Xof the screen.
XThe routine also \fIclears the contents of the text window
Xbuffer and resets the scroll bar\fP.
XThe routine returns zero if the window is not a text window.
XThis procedure should be used \fIinstead\fP of the
XX library call
X.I XClear.
X.PP
X.B TxtWriteStr
Xwrites a null-terminated string into the specified text window.
XThe text is always appended to the end of the text buffer.
XIf the scroll bar is positioned such that the end of the
Xtext is not visible,  an automatic scroll to the bottom will
Xbe done before the text is appended.
XNon-printable ASCII characters are ignored.
XThe newline character (\\n) causes the current text position
Xto advance one line and start at the left.
XTabs are not supported.
XLines too wide to fit on the screen will be wrapped to the
Xnext line and a line wrap indicator will be drawn in the
Xright margin.
XBackspace deletes the previous character.
XIt will do the right thing if asked to backspace past a normal
Xor wrapped line marker.
XA new text font can be specified using the sequence control-F followed
Xby a digit.  
XThe digit must be 0, 1, 2, or 3.
XThe directive will be ignored if there is no font loaded in the
Xspecified slot.
XIf there is no more space at the bottom of the screen,  the
Xwindow will scroll to make room.
XThe routine will return zero if it could not append the text.
X.PP
X.B TxtJamStr
Xis identical to
X.I TxtWriteStr
Xexcept the current screen position is \fInot\fP updated.
XThis routine should be used if the programmer wants to
Xappend text to the buffer without causing the window to
Xscroll.
XAfter the text has been added,  the programmer should
Xcall
X.I TxtRepaint
Xto update the screen contents.
X.PP
X.B TxtRepaint
Xredraws the specified scrollable text window.
XThe routine repaints the entire window including the scroll bar.
XNOTE:  for handling exposure events,
X.I TxtFilter
Xshould be used.
X.PP
X.B TxtFilter
Xhandles events associated with scrollable text windows.  It
Xwill handle \fIExposeRegion\fP and \fIExposeCopy\fP events on
Xthe main window,  and \fIExposeWindow\fP and \fIButtonReleased\fP
Xevents in the scroll bar.
XIt does \fInot\fP handle any other events.
XIf it does not want to handle the event,  the routine will return zero.
XA call to this routine should be included in the main event
Xloop of the programmers controlling program.
X.SH USER INTERFACE
X.PP
XThe \fIscrollText\fP package supports user controlled browsing
Xthrough a buffer built using
X.I TxtWriteStr
Xor
X.I TxtJamStr.
XAlong the right side of the window is a \fIscroll bar\fP window.
XThe scroll bar window displays a filled square representing the
Xrelative position through the buffer and the relative amount of
Xthe buffer currently on the screen.
XScrolling is controlled by clicking mouse buttons
Xin the scroll bar.
X.PP
XThis package supports three scrolling operations:  scroll to
Xspot,  line to top,  and top to here.
XThe
X.B middle button
Xis used to select scroll to spot.
XThis operation causes the screen to scroll such that the center
Xof the scroll bar indicator moves to the current position of
Xthe mouse.
XThis is used to scroll to a relative spot in the buffer.
XLine to top and top to here operations are for scrolling
Xdown or up some proportion of the screen.
XThe
X.B left button
Xselects line to top.
XThis operation causes the screen to scroll such that the
Xline adjacent to the mouse position becomes the top line
Xof the screen.
XThus,  clicking near the top of the scroll bar scrolls only
Xa couple of lines while a click near the bottom will scroll
Xalmost an entire screen.
XThe
X.B right button
Xis used for the top to here command.
XThis function causes the top line of the screen to scroll down
Xto the current position of the mouse.
XThis allows the user to scroll up and down by the same amounts
Xif the mouse position is kept constant.
X.SH "X DEFAULTS"
XThe current version of the library reads one default:
X.TP 8
X.B JumpScroll
XIf on,  the line to top and top to here operations will not
Xscroll to the target position smoothly.  Instead,  the window
Xwill be repainted once at the correct spot.
X.SH FILES
XlibScroll.a - Scrollable text library
X.SH "SEE ALSO"
XXlib - C Language X Interface, X(8C)
X.SH AUTHOR
XDavid Harrison,  University of California,  Berkeley
X.SH BUGS
XSometimes when the window is resized,  the scroll bar is repainted
Xwithout a border.
XThe origin of this bug is unknown but a work-around is to iconify
Xand deiconify the window forcing a complete redraw.
X.PP
XLoading large files with many font changes is slow.
XUnfortunately,  there is simply a lot of work which must
Xbe done.
XResizing windows with extrodinarily large buffers may also
Xtake some time (the line breaks must be recomputed).
END_OF_scrollText/scrollText.3
if test 8425 -ne `wc -c <scrollText/scrollText.3`; then
    echo shar: \"scrollText/scrollText.3\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f std.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"std.c\"
else
echo shar: Extracting \"std.c\" \(6617 characters\)
sed "s/^X//" >std.c <<'END_OF_std.c'
X/* This file contains code for X-CHESS.
X   Copyright (C) 1986 Free Software Foundation, Inc.
X
XThis file is part of X-CHESS.
X
XX-CHESS is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY.  No author or distributor
Xaccepts responsibility to anyone for the consequences of using it
Xor for whether it serves any particular purpose or works at all,
Xunless he says so in writing.  Refer to the X-CHESS General Public
XLicense for full details.
X
XEveryone is granted permission to copy, modify and redistribute
XX-CHESS, but only under the conditions described in the
XX-CHESS General Public License.   A copy of this license is
Xsupposed to have been given to you along with X-CHESS so you
Xcan know your rights and responsibilities.  It should be in a
Xfile named COPYING.  Among other things, the copyright notice
Xand this notice must be preserved on all copies.  */
X
X
X/* RCS Info: $Revision: 1.1 $ on $Date: 86/11/01 17:08:40 $
X *           $Source: /users/faustus/xchess/RCS/std.c,v $
X * Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
X *
X * Utility routines.
X */
X
X#include "std.h"
X
X#ifndef IBMPC
X#include <sys/types.h>
X#endif not IBMPC
X#ifdef UNIX
X#include <signal.h>
X#include <pwd.h>
X#endif UNIX
X#ifdef BSD
X#include <sys/time.h>
X#include <sys/resource.h>
X#endif BSD
X
Xextern char **environ;
X
Xbool
Xprefix(p, s)
X	register char *p, *s;
X{
X	while (*p && (*p == *s))
X		p++, s++;
X	if (!*p)
X		return (true);
X	else
X		return (false);
X}
X
X/* Create a copy of a string. */
X
Xchar *
Xcopy(str)
X	char *str;
X{
X	char *p, *tmalloc();
X	
X	p = tmalloc(strlen(str) + 1);
X	strcpy(p, str);
X	return(p);
X}
X
X/* Determine whether sub is a substring of str. */
X
Xbool
Xsubstring(sub, str)
X	register char *str, *sub;
X{
X	register char *s;
X
X	while(*str) {
X		if(*str == *sub) {
X			for(s = sub; *s; s++)
X				if(*s != *str++)
X					break;
X			if(*s == '\0')
X				return (true);
X		}
X		str++;
X	}
X	return (false);
X}
X
X/* Malloc num bytes and initialize to zero. Fatal error if the space can't
X * be malloc'd. 
X */
X
Xchar *
Xtmalloc(num)
X	register int num;
X{
X	register char *s;
X	char *malloc();
X
X	s = malloc((unsigned) num);
X	if (!s) {
X		fatal("malloc: can't allocate %d bytes", num);
X	}
X	bzero(s, num);
X	return(s);
X}
X
Xchar *
Xtrealloc(ptr, num)
X	char *ptr;
X	int num;
X{
X	register char *s;
X	char *realloc();
X
X	s = realloc(ptr, (unsigned) num);
X	if (!s) {
X		fatal("realloc: can't allocate %d bytes", num);
X	}
X	/* Well, this won't be zeroed... Too bad... */
X	return(s);
X}
X
X/* Append one character to a string. Don't check for overflow. */
X
Xvoid
Xappendc(s, c)
X	char *s, c;
X{
X	while (*s)
X		s++;
X	*s++ = c;
X	*s = '\0';
X	return;
X}
X
Xint
Xscannum(str)
X	char *str;
X{
X	int i = 0;
X
X	while(isdigit(*str))
X		i = i * 10 + *(str++) - '0';
X	return(i);
X}
X
X/* Case insensitive prefix. */
X
Xbool
Xciprefix(p, s)
X	register char *p, *s;
X{
X	while (*p) {
X		if ((isupper(*p) ? tolower(*p) : *p) !=
X		    (isupper(*s) ? tolower(*s) : *s))
X			return(false);
X		p++;
X		s++;
X	}
X	return (true);
X}
X
X/* Case insensitive strcmp... */
X
Xbool
Xcieq(p, s)
X	register char *p, *s;
X{
X	while (*p) {
X		if ((isupper(*p) ? tolower(*p) : *p) !=
X		    (isupper(*s) ? tolower(*s) : *s))
X			return(false);
X		p++;
X		s++;
X	}
X	return (!*s);
X}
X
X#ifdef BSD
X
X/* Return the date. Return value is static data. */
X
Xchar *
Xdatestring()
X{
X	register char *tzn;
X	struct tm *tp;
X	static char tbuf[40];
X	char *ap;
X	struct timeval tv;
X	struct timezone tz;
X	char *timezone(), *asctime();
X	int i;
X	struct tm *localtime();
X
X	(void) gettimeofday(&tv, &tz);
X	tp = localtime((time_t *) &tv.tv_sec);
X	ap = asctime(tp);
X	tzn = timezone(tz.tz_minuteswest, tp->tm_isdst);
X	sprintf(tbuf, "%.20s", ap);
X	if (tzn)
X		strcat(tbuf, tzn);
X	strcat(tbuf, ap + 19);
X	i = strlen(tbuf);
X	tbuf[i - 1] = '\0';
X	return (tbuf);
X}
X
X#else BSD
X
X/* Give it a try... */
X
Xchar *
Xdatestring()
X{
X	long i;
X	static char buf[64];
X
X	i = time(0);
X	strcpy(buf, ctime(&i));
X	buf[strlen(buf) - 1] = '\0';	/* Kill the nl. */
X	return (buf);
X}
X
X#endif
X
X/* How many seconds have elapsed in running time. */
X
Xint
Xseconds()
X{
X#ifdef BSD
X	struct rusage ruse;
X
X	getrusage(RUSAGE_SELF, &ruse);
X	return (ruse.ru_utime.tv_sec);
X#else BSD
X#endif BSD
X}
X
X/* A few things that may not exist on non-unix systems. */
X
X#ifndef BSD
X
X#ifndef index
X
Xchar *
Xindex(s, c)
X	register char *s;
X	register char c;
X{
X	while ((*s != c) && (*s != '\0'))
X		s++;
X	if (*s == '\0')
X		return ((char *) 0);
X	else
X		return (s);
X}
X
X#endif not index
X
X#ifndef rindex
X
Xchar *
Xrindex(s, c)
X	register char *s;
X	register char c;
X{
X	register char *t;
X
X	for (t = s; *t != '\0'; t++);
X	while ((*t != c) && (t != s))
X		t--;
X	if (t == s)
X		return ((char *) 0);
X	else
X		return (t);
X}
X
X#endif not rindex
X
X#ifndef bcopy
X
Xvoid
Xbcopy(from, to, num)
X	register char *from, *to;
X	register int num;
X{
X	while (num-- > 0)
X		*to++ = *from++;
X	return;
X}
X
X#endif not bcopy
X
X#ifndef bzero
X
Xvoid
Xbzero(ptr, num)
X	register char *ptr;
X	register int num;
X{
X	while (num-- > 0)
X		*ptr++ = '\0';
X	return;
X}
X
X#endif not bzero
X
X/* This might not be around... If not then forget about sorting... */
X
Xvoid qsort() {}
X
X#endif BSD
X
Xchar *
Xgettok(s)
X	char **s;
X{
X	char buf[BSIZE];
X	int i = 0;
X
X	while (isspace(**s))
X		(*s)++;
X	if (!**s)
X		return (NULL);
X	while (**s && !isspace(**s))
X		buf[i++] = *(*s)++;
X	buf[i] = '\0';
X	while (isspace(**s))
X		(*s)++;
X	return (copy(buf));
X}
X
X/* Die horribly. */
X
X/* VARARGS1 */
Xvoid
Xfatal(s, args)
X        char *s;
X{
X	fputs("Internal Error: ", stderr);
X	_doprnt(s, &args, stderr);
X	putc('\n', stderr);
X
X	kill(getpid(), SIGIOT);
X	/* NOTREACHED */
X}
X
Xvoid
Xsetenv(name, value)
X	char *name, *value;
X{
X	int i;
X	char **xx, *s;
X
X	s = tmalloc(strlen(name) + 2);
X	sprintf(s, "%s=", name);
X
X	/* Copy the old environment... */
X	for (i = 0; environ[i]; i++)
X		if (prefix(s, environ[i]))
X			break;
X	if (!environ[i]) {
X		xx = (char **) tmalloc((i + 2) * sizeof (char *));
X		for (i = 0; environ[i]; i++)
X			xx[i] = environ[i];
X		xx[i + 1] = NULL;
X		environ = xx;
X	} else
X		xx = environ;
X	
X	xx[i] = tmalloc(strlen(name) + strlen(value) + 2);
X	sprintf(xx[i], "%s=%s", name, value);
X	return;
X}
X
Xchar *
Xgetusername()
X{
X	int i = getuid();
X	struct passwd *pw = getpwuid(i);
X
X	return (pw ? pw->pw_name : NULL);
X}
X
Xchar *
Xgethome()
X{
X	int i = getuid();
X	struct passwd *pw = getpwuid(i);
X
X	return (pw ? pw->pw_dir : "/strange");
X}
X
Xchar *
Xtildexpand(s)
X	char *s;
X{
X	struct passwd *pw;
X	char *n, buf[64];
X	int i;
X
X	if (*s != '~')
X		return (copy(s));
X
X	for (s++, i = 0; *s != '/'; s++, i++)
X		buf[i] = *s;
X	buf[i] = '\0';
X	if (!i)
X		pw = getpwuid(getuid());
X	else
X		pw = getpwnam(buf);
X	if (!pw)
X		return (s);
X	n = tmalloc(strlen(s) + strlen(pw->pw_dir) + 1);
X	strcpy(n, pw->pw_dir);
X	strcat(n, s);
X	return (n);
X}
X
END_OF_std.c
if test 6617 -ne `wc -c <std.c`; then
    echo shar: \"std.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f valid.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"valid.c\"
else
echo shar: Extracting \"valid.c\" \(6907 characters\)
sed "s/^X//" >valid.c <<'END_OF_valid.c'
X/* This file contains code for X-CHESS.
X   Copyright (C) 1986 Free Software Foundation, Inc.
X
XThis file is part of X-CHESS.
X
XX-CHESS is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY.  No author or distributor
Xaccepts responsibility to anyone for the consequences of using it
Xor for whether it serves any particular purpose or works at all,
Xunless he says so in writing.  Refer to the X-CHESS General Public
XLicense for full details.
X
XEveryone is granted permission to copy, modify and redistribute
XX-CHESS, but only under the conditions described in the
XX-CHESS General Public License.   A copy of this license is
Xsupposed to have been given to you along with X-CHESS so you
Xcan know your rights and responsibilities.  It should be in a
Xfile named COPYING.  Among other things, the copyright notice
Xand this notice must be preserved on all copies.  */
X
X
X/* RCS Info: $Revision: 1.3 $ on $Date: 86/11/23 17:18:35 $
X *           $Source: /users/faustus/xchess/RCS/valid.c,v $
X * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
X *	Permission is granted to do anything with this code except sell it
X *	or remove this message.
X *
X * Validate a move.
X */
X
X#include "xchess.h"
X
Xextern bool ischeck(), couldmove();
X
Xbool
Xvalid_move(m, b)
X	move *m;
X	board *b;
X{
X	board tb;
X
X	/* First check that the piece can make the move at all... */
X	if (!couldmove(m, b))
X		return (false);
X
X	/* Now see if the king is in check now. */
X	bcopy((char *) b, (char *) &tb, sizeof (board));
X	board_move(&tb, m);
X	if (ischeck(&tb, m->piece.color))
X		return (false);
X	
X	if (ischeck(&tb, ((m->piece.color == WHITE) ? BLACK : WHITE)))
X		m->check = true;
X	
X	return (true);
X}
X
Xstatic bool
Xcouldmove(m, b)
X	move *m;
X	board *b;
X{
X	int x, y;
X
X	switch (m->type) {
X	    case KCASTLE:
X		if ((m->piece.color == WHITE) && (b->white_cant_castle_k) ||
X				(m->piece.color == BLACK) && 
X				(b->black_cant_castle_k))
X			return (false);
X		if ((b->square[m->fromy][5].color != NONE) ||
X				(b->square[m->fromy][6].color != NONE))
X			return (false);
X		if (ischeck(b, m->piece.color))
X			return (false);
X		break;
X
X	    case QCASTLE:
X		if ((m->piece.color == WHITE) && (b->white_cant_castle_q) ||
X				(m->piece.color == BLACK) && 
X				(b->black_cant_castle_q))
X			return (false);
X		if ((b->square[m->fromy][1].color != NONE) ||
X				(b->square[m->fromy][2].color != NONE) ||
X				(b->square[m->fromy][3].color != NONE))
X			return (false);
X		if (ischeck(b, m->piece.color))
X			return (false);
X		break;
X
X	    case MOVE:
X	    case CAPTURE:
X		/* There is one special case here, that of taking a pawn
X		 * en passant.  In this case we change the move field to
X		 * CAPTURE if it's ok.
X		 */
X		switch (m->piece.type) {
X		    case PAWN:
X			if ((m->type == MOVE) && (m->fromx == m->tox)) {
X				/* A normal move. */
X				if ((m->piece.color == WHITE) && (m->fromy ==
X						m->toy + 1))
X					break;
X				if ((m->piece.color == WHITE) && (m->fromy ==
X						6) && (m->toy == 4) &&
X						(b->square[5][m->fromx].color
X						== NONE))
X					break;
X				if ((m->piece.color == BLACK) && (m->fromy ==
X						m->toy - 1))
X					break;
X				if ((m->piece.color == BLACK) && (m->fromy ==
X						1) && (m->toy == 3) &&
X						(b->square[2][m->fromx].color
X						== NONE))
X					break;
X				return (false);
X			} else if (m->type == CAPTURE) {
X				if ((((m->piece.color == WHITE) && (m->fromy ==
X					    m->toy + 1)) || ((m->piece.color ==
X					    BLACK) && (m->fromy == m->toy -
X					    1))) && ((m->fromx == m->tox + 1) ||
X					    (m->fromx == m->tox - 1)))
X					break;
X				/* Now maybe it's enpassant...  We've already
X				 * checked for some of these things in the
X				 * calling routine.
X				 */
X				if (m->enpassant) {
X					if (b->square[(m->piece.color == WHITE)
X						    ? 3 : 4][m->tox].color == 
X						    ((m->piece.color == WHITE) ?
X						    BLACK : WHITE))
X						break;
X				}
X				return (false);
X			}
X			return (false);
X
X		    case ROOK:
X			if (m->fromx == m->tox) {
X				for (y = m->fromy + ((m->fromy > m->toy) ? -1 :
X						1); y != m->toy; y += ((m->fromy
X						> m->toy) ? -1 : 1))
X					if (b->square[y][m->tox].color != NONE)
X						return (false);
X				break;
X			}
X			if (m->fromy == m->toy) {
X				for (x = m->fromx + ((m->fromx > m->tox) ? -1 :
X						1); x != m->tox; x += ((m->fromx
X						> m->tox) ? -1 : 1))
X					if (b->square[m->toy][x].color != NONE)
X						return (false);
X				break;
X			}
X			return (false);
X
X		    case KNIGHT:
X			x = m->fromx - m->tox;
X			y = m->fromy - m->toy;
X			if ((((x == 2) || (x == -2)) &&
X					((y == 1) || (y == -1))) ||
X					(((x == 1) || (x == -1)) &&
X					((y == 2) || (y == -2))))
X				break;
X			return (false);
X
X		    case BISHOP:
X			x = m->fromx - m->tox;
X			y = m->fromy - m->toy;
X			if ((x != y) && (x != - y))
X				return (false);
X			for (x = m->fromx + ((m->fromx > m->tox) ? -1 : 1), y =
X					m->fromy + ((m->fromy > m->toy) ? -1 :
X					1); x != m->tox;
X					x += ((m->fromx > m->tox) ? -1 : 1),
X					y += ((m->fromy > m->toy) ? -1 : 1))
X				if (b->square[y][x].color != NONE)
X					return (false);
X			break;
X
X		    case QUEEN:
X			if (m->fromx == m->tox) {
X				for (y = m->fromy + ((m->fromy > m->toy) ? -1 :
X						1); y != m->toy; y += ((m->fromy
X						> m->toy) ? -1 : 1))
X					if (b->square[y][m->tox].color != NONE)
X						return (false);
X				break;
X			}
X			if (m->fromy == m->toy) {
X				for (x = m->fromx + ((m->fromx > m->tox) ? -1 :
X						1); x != m->tox; x += ((m->fromx
X						> m->tox) ? -1 : 1))
X					if (b->square[m->toy][x].color != NONE)
X						return (false);
X				break;
X			}
X			x = m->fromx - m->tox;
X			y = m->fromy - m->toy;
X			if ((x != y) && (x != - y))
X				return (false);
X			for (x = m->fromx + ((m->fromx > m->tox) ? -1 : 1), y =
X					m->fromy + ((m->fromy > m->toy) ? -1 :
X					1); x != m->tox;
X					x += ((m->fromx > m->tox) ? -1 : 1),
X					y += ((m->fromy > m->toy) ? -1 : 1))
X				if (b->square[y][x].color != NONE)
X					return (false);
X			break;
X
X		    case KING:
X			x = m->fromx - m->tox;
X			y = m->fromy - m->toy;
X			if ((x >= -1) && (x <= 1) && (y >= -1) && (y <= 1))
X				break;
X			return (false);
X		}
X		break;
X	}
X	return (true);
X}
X
X/* Say whether either king is in check...  If move is non-NULL, say whether he
X * in in check after the move takes place.  We do this in a rather stupid way.
X */
X
Xstatic bool
Xischeck(b, col)
X	board *b;
X	color col;
X{
X	int x, y, kx, ky;
X	move ch;
X
X	for (x = 0; x < SIZE; x++)
X		for (y = 0; y < SIZE; y++)
X			if ((b->square[y][x].color == col) &&
X				    (b->square[y][x].type == KING)) {
X				kx = x;
X				ky = y;
X			}
X
X	for (x = 0; x < SIZE; x++)
X		for (y = 0; y < SIZE; y++)
X			if (b->square[y][x].color == ((col == WHITE) ?
X					BLACK : WHITE)) {
X				ch.type = CAPTURE;
X				ch.piece.color = b->square[y][x].color;
X				ch.piece.type = b->square[y][x].type;
X				ch.fromx = x;
X				ch.fromy = y;
X				ch.tox = kx;
X				ch.toy = ky;
X				ch.enpassant = false;
X				if (couldmove(&ch, b))
X					return (true);
X			}
X
X	return (false);
X}
X
END_OF_valid.c
if test 6907 -ne `wc -c <valid.c`; then
    echo shar: \"valid.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f xchess.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"xchess.h\"
else
echo shar: Extracting \"xchess.h\" \(7123 characters\)
sed "s/^X//" >xchess.h <<'END_OF_xchess.h'
X/* This file contains code for X-CHESS.
X   Copyright (C) 1986 Free Software Foundation, Inc.
X
XThis file is part of X-CHESS.
X
XX-CHESS is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY.  No author or distributor
Xaccepts responsibility to anyone for the consequences of using it
Xor for whether it serves any particular purpose or works at all,
Xunless he says so in writing.  Refer to the X-CHESS General Public
XLicense for full details.
X
XEveryone is granted permission to copy, modify and redistribute
XX-CHESS, but only under the conditions described in the
XX-CHESS General Public License.   A copy of this license is
Xsupposed to have been given to you along with X-CHESS so you
Xcan know your rights and responsibilities.  It should be in a
Xfile named COPYING.  Among other things, the copyright notice
Xand this notice must be preserved on all copies.  */
X
X
X/* RCS Info: $Revision: 1.5 $ on $Date: 86/11/26 12:11:39 $
X *           $Source: /users/faustus/xchess/RCS/xchess.h,v $
X * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group
X *	Permission is granted to do anything with this code except sell it
X *	or remove this message.
X *
X * Definitions for the X chess program.
X */
X
X#include "std.h"
X#include <X/Xlib.h>
X#include "scrollText/scrollText.h"
X
X#define SIZE	8
X
Xtypedef enum piecetype { PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING } piecetype;
Xtypedef enum movetype { MOVE, QCASTLE, KCASTLE, CAPTURE } movetype;
Xtypedef enum color { WHITE, BLACK, NONE } color;
X
Xtypedef struct piece {
X	enum piecetype type;
X	enum color color;
X} piece;
X
X/* The board has y=0 and black at the top...  This probably isn't the best
X * place to keep track of who can castle, but it's part of the game state...
X */
X
Xtypedef struct board {
X	piece square[SIZE][SIZE];
X	bool white_cant_castle_k;
X	bool white_cant_castle_q;
X	bool black_cant_castle_k;
X	bool black_cant_castle_q;
X} board;
X
Xtypedef struct move {
X	movetype type;
X	piece piece;
X	piece taken;
X	int fromx, fromy;
X	int tox, toy;
X	struct move *next;
X	bool enpassant;
X	bool check;
X} move;
X
X#define iswhite(win, i, j)	(!(((i) + (j)) % 2))
X
X/* Stuff for the display. */
X
Xtypedef struct windata {
X	Display *display;
X	Window basewin;
X	Window boardwin;
X	Window recwin;
X	Window wclockwin;
X	Window bclockwin;
X	Window messagewin;
X	Window buttonwin;
X	Window jailwin;
X	Window icon;
X	Pixmap iconpixmap;
X	Color blackpiece;
X	Color whitepiece;
X	Color blacksquare;
X	Color whitesquare;
X	Color border;
X	Color textcolor;
X	Color textback;
X	Color errortext;
X	Color playertext;
X	Color cursorcolor;
X	FontInfo *small;
X	FontInfo *medium;
X	FontInfo *large;
X	bool bnw;
X	color color;
X	bool flipped;
X	double whitehands[3];
X	double blackhands[3];
X	char *txtassoc;
X} windata;
X
X#define SMALL_FONT	"6x10"
X#define MEDIUM_FONT	"vtsingle"
X#define LARGE_FONT	"corfx"
X#define JAIL_FONT	"ctl25fx"
X
X#define SQUARE_WIDTH	80
X#define SQUARE_HEIGHT	80
X
X#define BORDER_WIDTH	3
X
X#define BOARD_WIDTH	8 * SQUARE_WIDTH + 7 * BORDER_WIDTH
X#define BOARD_HEIGHT	8 * SQUARE_HEIGHT + 7 * BORDER_WIDTH
X#define BOARD_XPOS	0
X#define BOARD_YPOS	0
X
X#define RECORD_WIDTH	265	/* 40 chars * 6 pixels / character. */
X#define RECORD_HEIGHT	433
X#define RECORD_XPOS	BOARD_WIDTH + BORDER_WIDTH
X#define RECORD_YPOS	0
X
X#define JAIL_WIDTH	RECORD_WIDTH
X#define JAIL_HEIGHT	163
X#define JAIL_XPOS	RECORD_XPOS
X#define JAIL_YPOS	RECORD_YPOS + RECORD_HEIGHT + BORDER_WIDTH
X
X#define CLOCK_WIDTH	131
X#define CLOCK_HEIGHT	131 + BORDER_WIDTH + 20
X#define WCLOCK_XPOS	RECORD_XPOS
X#define WCLOCK_YPOS	RECORD_HEIGHT + JAIL_HEIGHT + BORDER_WIDTH * 2
X#define BCLOCK_XPOS	WCLOCK_XPOS + CLOCK_WIDTH + BORDER_WIDTH
X#define BCLOCK_YPOS	WCLOCK_YPOS
X
X#define MESS_WIDTH	329
X#define MESS_HEIGHT	92
X#define MESS_XPOS	0
X#define MESS_YPOS	BOARD_HEIGHT + BORDER_WIDTH
X
X#define BUTTON_WIDTH	MESS_WIDTH
X#define BUTTON_HEIGHT	MESS_HEIGHT
X#define BUTTON_XPOS	MESS_WIDTH + BORDER_WIDTH
X#define BUTTON_YPOS	MESS_YPOS
X
X#define BASE_WIDTH	BOARD_WIDTH + RECORD_WIDTH + BORDER_WIDTH * 3
X#define BASE_HEIGHT	BOARD_HEIGHT + MESS_HEIGHT + BORDER_WIDTH * 3
X
X#define BASE_XPOS	50
X#define BASE_YPOS	50
X
X#define BLACK_PIECE_COLOR	"#202020"
X#define WHITE_PIECE_COLOR	"#FFFFCC"
X#define BLACK_SQUARE_COLOR	"#67925D"
X#define WHITE_SQUARE_COLOR	"#C8C365"
X#define BORDER_COLOR		"#902E39"
X#define TEXT_COLOR		"#006D6D"
X#define TEXT_BACK		"#FFFFDD"
X#define ERROR_TEXT		"Red"
X#define PLAYER_TEXT		"Blue"
X#define CURSOR_COLOR		"#FF606F"
X
X#define DEF_RECORD_FILE		"xchess.game"
X
X#define NUM_FLASHES		5
X#define FLASH_SIZE		10
X
X/* xchess.c */
X
Xextern void main();
Xextern bool debug;
Xextern char *progname;
Xextern char *proghost;
Xextern char *piecenames[];
Xextern char *colornames[];
Xextern char *movetypenames[];
Xextern char *dispname1, *dispname2;
Xextern bool oneboard;
Xextern bool bnwflag;
Xextern bool progflag;
Xextern bool blackflag;
Xextern bool quickflag;
Xextern int num_flashes;
Xextern int flash_size;
Xextern char *black_piece_color;
Xextern char *white_piece_color;
Xextern char *black_square_color;
Xextern char *white_square_color;
Xextern char *border_color;
Xextern char *text_color;
Xextern char *text_back;
Xextern char *error_text;
Xextern char *player_text;
Xextern char *cursor_color;
X
X/* board.c */
X
Xextern void board_setup();
Xextern void board_drawall();
Xextern void board_move();
Xextern board *chessboard;
Xextern void board_init();
X
X/* window.c */
X
Xextern bool win_setup();
Xextern void win_redraw();
Xextern void win_restart();
Xextern void win_drawboard();
Xextern void win_drawpiece();
Xextern void win_erasepiece();
Xextern void win_process();
Xextern void win_flash();
Xextern windata *win1, *win2;
Xextern bool win_flashmove;
X
X/* control.c */
X
Xextern void button_pressed();
Xextern void button_released();
Xextern void move_piece();
Xextern void prog_move();
Xextern move *moves;
Xextern move *foremoves;
Xextern color nexttomove;
Xextern void replay();
Xextern void forward();
Xextern void cleanup();
Xextern void restart();
Xextern bool noisyflag;
X
X/* valid.c */
X
Xextern bool valid_move();
X
X/* record.c */
X
Xextern void record_move();
Xextern void record_reset();
Xextern void record_save();
Xextern void record_back();
Xextern void record_init();
Xextern void record_end();
Xextern bool record_english;
Xextern char *record_file;
Xextern int movenum;
Xextern bool saveflag;
X
X/* message.c */
X
Xextern void message_init();
Xextern void message_add();
Xextern void message_send();
X
X/* clock.c */
X
Xextern void clock_init();
Xextern void clock_draw();
Xextern void clock_update();
Xextern void clock_switch();
Xextern bool clock_started;
Xextern int movesperunit;
Xextern int timeunit;
Xextern int whiteseconds;
Xextern int blackseconds;
X
X/* button.c */
X
Xextern void button_draw();
Xextern void button_service();
X
X/* jail.c */
X
Xextern void jail_init();
Xextern void jail_draw();
Xextern void jail_add();
Xextern void jail_remove();
X
X/* program.c */
X
Xextern bool program_init();
Xextern void program_end();
Xextern void program_send();
Xextern void program_undo();
Xextern move *program_get();
X
X/* parse.c */
X
Xextern void load_game();
Xextern move *parse_file();
Xextern move *parse_move();
Xextern move *parse_imove();
Xextern bool loading_flag;
Xextern bool loading_paused;
X
X/* popup.c */
X
Xextern bool pop_question();
X
END_OF_xchess.h
if test 7123 -ne `wc -c <xchess.h`; then
    echo shar: \"xchess.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 3 \(of 6\).
cp /dev/null ark3isdone
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