billr@saab.CNA.TEK.COM (Bill Randle) (11/02/90)
Submitted-by: Rich Burridge <rburridge@sun.COM>
Posting-number: Volume 11, Issue 55
Archive-name: reve/Part04
Environment: SunView, XView, X11, termcap
#! /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 4 (of 7)."
# Contents: images/reve.color.icon makemove.c patchlevel.h tty.c x11.c
# Wrapped by billr@saab on Thu Nov 1 14:02:51 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'images/reve.color.icon' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'images/reve.color.icon'\"
else
echo shar: Extracting \"'images/reve.color.icon'\" \(14926 characters\)
sed "s/^X//" >'images/reve.color.icon' <<'END_OF_FILE'
X/* Format_version=1, Width=64, Height=64, Depth=8, Valid_bits_per_item=16
X */
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0501,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0105,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0500,0x0000,0x0002,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0505,0x0505,0x0505,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0205,
X 0x0502,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0205,0x0505,0x0505,0x0505,0x0505,0x0202,0x0201,
X 0x0202,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0205,
X 0x0502,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0205,0x0505,0x0505,0x0505,0x0505,0x0202,0x0201,
X 0x0202,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0205,
X 0x0502,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0505,0x0505,0x0505,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0205,
X 0x0502,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0501,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0105,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0505,0x0505,0x0505,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0205,0x0505,0x0505,0x0505,0x0505,0x0202,0x0201,
X 0x0202,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0505,0x0505,0x0505,0x0505,0x0505,0x0502,0x0201,
X 0x0202,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0205,0x0505,0x0505,0x0505,0x0505,0x0202,0x0201,
X 0x0202,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0505,0x0505,0x0505,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0501,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,
X 0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0105,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0500,0x0000,0x0000,0x0000,0x0000,0x0502,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0205,0x0000,0x0000,0x0000,0x0005,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0500,0x0000,0x0000,0x0502,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0205,0x0505,0x0505,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0502,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0201,
X 0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0202,0x0205,
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
X 0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,0x0505,
END_OF_FILE
if test 14926 -ne `wc -c <'images/reve.color.icon'`; then
echo shar: \"'images/reve.color.icon'\" unpacked with wrong size!
fi
# end of 'images/reve.color.icon'
fi
if test -f 'makemove.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makemove.c'\"
else
echo shar: Extracting \"'makemove.c'\" \(3566 characters\)
sed "s/^X//" >'makemove.c' <<'END_OF_FILE'
X/*LINTLIBRARY*/
X
X/* @(#)makemove.c 1.4 90/10/08
X *
X * Interface to best computer strategy routines used by Reve.
X *
X * Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X * All rights reserved.
X *
X * Permission is given to distribute these sources, as long as the
X * introductory messages are not removed, and no monies are exchanged.
X *
X * You are forbidden from using Reve as is, or in a modified state, in
X * any tournaments, without the permission of the authors.
X *
X * No responsibility is taken for any errors on inaccuracies inherent
X * either to the comments or the code of this program, but if reported
X * (see README file), then an attempt will be made to fix them.
X */
X
X#include <stdio.h>
X#include "reve.h"
X#include "extern.h"
X
X
Xvalid_move(board, player) /* Check if valid move for this player. */
XBOARD *board ;
Xint player ;
X{
X int mv ;
X int valid ; /* Set if there is a valid move. */
X
X for (mv = 0; mv < 64; mv++)
X if (board->square[mv] == FREE)
X {
X valid = legal(mv, player, board) ;
X if (valid == TRUE) return(TRUE) ;
X }
X return(FALSE) ;
X}
X
X
Xvoid
Xdomove(pos, mv, nextpos, player)
XBOARD *pos, *nextpos ;
Xint mv, player ;
X{
X register int i ;
X if (pos != nextpos) FOR_BOARD(i) nextpos->square[i] = pos->square[i] ;
X
X s_move = mv ;
X s_row = mv >> 3 ;
X s_col = mv & 7 ;
X s_player = player ;
X s_opponent = -player ;
X s_flip = TRUE ;
X s_pos = nextpos ;
X
X nextpos->square[s_move] = player ;
X
X (void) sandwich(-9) ;
X (void) sandwich(-8) ;
X (void) sandwich(-7) ;
X (void) sandwich(-1) ;
X (void) sandwich(1) ;
X (void) sandwich(7) ;
X (void) sandwich(8) ;
X (void) sandwich(9) ;
X
X nextpos->moves_left = (pos->moves_left) - 1 ;
X}
X
X
Xlegal(mv, player, pos)
XBOARD *pos ;
Xint mv, player ;
X{
X if (pos->square[mv]) return(FALSE) ; /* Already occupied */
X
X s_move = mv ;
X s_row = mv >> 3 ;
X s_col = mv & 7 ;
X s_player = player ;
X s_opponent = -player ;
X s_flip = FALSE ;
X s_pos = pos ;
X
X return(sandwich(-9) || sandwich(-8) || sandwich(-7) || sandwich(-1) ||
X sandwich(1) || sandwich(7) || sandwich(8) || sandwich(9)) ;
X}
X
X
X/* Test whether the square move sandwiches a line
X * of enemy pieces in the direction [row_inc, col_inc];
X * If (s_flip) then update position by capturing such pieces
X */
X
Xsandwich(increment)
Xregister int increment ;
X{
X register int square,offset ;
X int row_offset,col_offset,piece,piece_count ;
X
X if (s_pos->square[s_move+increment] != s_opponent) return(FALSE) ;
X
X/* Quick test to catch most failures -
X * note that the tested square may not even
X * be on the board, but the condition is a
X * sufficient one for failure.
X */
X
X row_offset = (increment < -1 ? s_row : /* inc -1: -9, -8, -7 */
X increment > 1 ? 7-s_row : 8) ; /* inc 1: 7, 8, 9 */
X col_offset = (increment & 4 ? s_col : /* inc -1: -9, -1, 7 */
X increment & 1 ? 7-s_col : 8) ; /* inc 1: -7, 1, 9 */
X
X offset = (row_offset > col_offset ? col_offset : row_offset) ;
X
X/* offset = shortest distance to an edge in the direction of search */
X
X if (2 > offset) return(FALSE) ;
X
X piece_count = 1 ;
X square = s_move+increment ;
X
X while (--offset)
X {
X if (!(piece = s_pos->square[square += increment]))
X return(FALSE) ; /* If empty square, give up */
X
X if (piece == s_player) break ;
X else piece_count++ ; /* Count opponent's pieces encountered */
X }
X
X if (!offset) return(FALSE) ;
X
X if (s_flip)
X while (piece_count--)
X s_pos->square[square -= increment] = s_player ;
X
X return (TRUE) ;
X}
END_OF_FILE
if test 3566 -ne `wc -c <'makemove.c'`; then
echo shar: \"'makemove.c'\" unpacked with wrong size!
fi
# end of 'makemove.c'
fi
if test -f 'patchlevel.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patchlevel.h'\"
else
echo shar: Extracting \"'patchlevel.h'\" \(698 characters\)
sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
X
X/* @(#)patchlevel.h 1.9 90/10/20
X *
X * This is the current patchlevel for this version of reve.
X *
X * Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X * All rights reserved.
X *
X * Permission is given to distribute these sources, as long as the
X * introductory messages are not removed, and no monies are exchanged.
X *
X * You are forbidden from using Reve as is, or in a modified state, in
X * any tournaments, without the permission of the authors.
X *
X * No responsibility is taken for any errors on inaccuracies inherent
X * either to the comments or the code of this program, but if reported
X * (see README file), then an attempt will be made to fix them.
X */
X
X#define PATCHLEVEL 0
END_OF_FILE
if test 698 -ne `wc -c <'patchlevel.h'`; then
echo shar: \"'patchlevel.h'\" unpacked with wrong size!
fi
# end of 'patchlevel.h'
fi
if test -f 'tty.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tty.c'\"
else
echo shar: Extracting \"'tty.c'\" \(13742 characters\)
sed "s/^X//" >'tty.c' <<'END_OF_FILE'
X/*LINTLIBRARY*/
X
X/* @(#)tty.c 1.6 90/10/20
X *
X * These are the dumb tty dependent graphics routines used by reve.
X *
X * Copyright (C) 1990 - Rich Burridge & Yves Gallot.
X * All rights reserved.
X *
X * Permission is given to distribute these sources, as long as the
X * introductory messages are not removed, and no monies are exchanged.
X *
X * You are forbidden from using Reve as is, or in a modified state, in
X * any tournaments, without the permission of the authors.
X *
X * No responsibility is taken for any errors or inaccuracies inherent
X * either to the comments or the code of this program, but if reported
X * (see README file), then an attempt will be made to fix them.
X */
X
X#include <stdio.h>
X#include <strings.h>
X#include <sys/ioctl.h>
X#include <signal.h>
X
X#ifdef SYSV
X#include <sgtty.h>
X#endif /*SYSV*/
X
X#include "reve.h"
X#include "color.h"
X#include "extern.h"
X
X#define DRAW_STRING(col, row, str, v) draw_string(col, row, str, v), return
X
Xenum gr_type gtype = GTTY ; /* Graphics type. */
X
X/* NOTE: This is a classic example of reverse engineering. These routines
X * have been modified (read hacked), to use the same interface as
X * the pixel graphics ones. Therefore they have to do some strange
X * checking to make sure everything comes out correctly.
X */
X
Xchar *CE, *CL, *CM, *SE, *SO ;
X
Xchar *getenv(), *tgetstr(), *tgoto() ;
X
Xstruct sgttyb in_new, in_old ;
X
Xstatic void do_clr_eol(), do_standend(), do_standout(), draw_string() ;
Xstatic void get_event(), outc(), outstr(), tc_move() ;
X
X/* Information for all the panel items. */
X
Xstruct tty_info { /* Information for all the panel items. */
X int column ; /* Column number. */
X int row ; /* Row number. */
X int x ; /* Pseudo x mouse position. */
X int y ; /* Pseudo y mouse position. */
X} ;
X
Xstruct tty_info ttyvals[MAXITEMS] = {
X { 1, 1, 33, 33, }, /* Last */
X { 11, 1, 107, 33, }, /* Load */
X { 22, 1, 167, 33, }, /* New game */
X { 33, 1, 255, 33, }, /* Save */
X { 44, 1, 318, 33, }, /* Suggest */
X { 55, 1, 403, 33, }, /* Undo */
X { -1, -1, 33, 75, }, /* Done (not displayed). */
X { -1, -1, 318, 75, }, /* Cancel (not displayed). */
X { -1, -1, 403, 75, }, /* Quit (not displayed). */
X { 38, 5, 15, 114, }, /* Black: */
X { 38, 7, 237, 114, }, /* White: */
X { 38, 9, 15, 156, }, /* Difficuly: */
X { 38, 11, 237, 156, }, /* Notes: */
X { -1, -1, -1, -1, }, /* Panel message. */
X { -1, -1, -1, -1, }, /* Notes message. */
X { -1, -1, -1, -1, }, /* Score message. */
X { -1, -1, -1, -1, }, /* Turn message. */
X} ;
X
Xstruct other_info { /* Information needed to place other text values. */
X int column ; /* Column number. */
X int row ; /* Row number. */
X} ;
X
Xstruct other_info othervals[MAXITEMS] = {
X { -1, -1, }, /* Last (ignored). */
X { -1, -1, }, /* Load (ignored). */
X { -1, -1, }, /* New game (ignored). */
X { -1, -1, }, /* Save (ignored). */
X { -1, -1, }, /* Suggest (ignored). */
X { -1, -1, }, /* Undo (ignored). */
X { -1, -1, }, /* Done (ignored). */
X { -1, -1, }, /* Cancel (ignored). */
X { -1, -1, }, /* Quit (ignored). */
X { 60, 5, }, /* Black: */
X { 60, 7, }, /* White: */
X { 60, 9, }, /* Difficuly: */
X { 60, 11, }, /* Notes: */
X { 38, 13, }, /* Panel message. */
X { 38, 15, }, /* Notes message. */
X { 38, 17, }, /* Score message. */
X { 38, 19, }, /* Turn message. */
X} ;
X
X
XSIGRET
Xcleanup()
X{
X destroy_frame() ;
X}
X
X
X/*ARGSUSED*/
Xvoid
Xbatch(state) /* Graphics batching - null routine. */
Xenum bltype state ;
X{}
X
X
Xvoid
Xclose_frame() /* This option does nothing with termcap. */
X{}
X
X
X/*ARGSUSED*/
Xvoid
Xcolor_area(x, y, width, height, color)
Xint x, y, width, height, color ;
X{
X char nextline[MAXLINE] ;
X
X/* There are two cases we care about here:
X *
X * (1) If the width is TOTAL_WIDTH and the height is TOTAL_HEIGHT, then
X * we clear the whole of the screen. We also draw the board at this
X * time. With the pixel based graphics versions, this is normally
X * done by low-level graphics routines, but to fully emulate that is
X * just too hard.
X *
X * (2) When we are "undo"ing a piece. A check is made to if the width and
X * the height of the area we are coloring is PSIZE. If so, then we
X * display a space at the appropriately adjusted row/column.
X */
X
X if (width == TOTAL_WIDTH && height == TOTAL_HEIGHT)
X {
X tputs(CL, 1, outc) ;
X tc_move(4, 3) ;
X outstr("a b c d e f g h") ;
X for (y = 4; y < 21; y++)
X {
X tc_move(1, y) ;
X if (y % 2)
X SPRINTF(nextline, "%c| | | | | | | | |%c",
X '1' + (y - 4) / 2, '1' + (y - 4) / 2) ;
X else SPRINTF(nextline, " +---+---+---+---+---+---+---+---+") ;
X outstr(nextline) ;
X }
X tc_move(4, 21) ;
X outstr("a b c d e f g h") ;
X }
X else if (width == PSIZE && height == PSIZE)
X {
X tc_move(4 + 4 * (((x - BBORDER - PIECE_MARGIN) / CELL_SIZE) & 7),
X 5 + 2 * ((y - CY - BBORDER - PIECE_MARGIN) / CELL_SIZE)) ;
X outc(' ') ;
X }
X}
X
X
X/*ARGSUSED*/
Xvoid
Xcreate_menu(mtype, values) /* Create popup menus - null routine. */
Xenum panel_type mtype ;
Xchar *values[] ;
X{}
X
X
Xvoid
Xdestroy_frame() /* Destroy reve window. */
X{
X tputs(CL, 1, outc) ;
X SIGNAL(SIGINT, SIG_IGN) ;
X IOCTL(0, TIOCSETP, &in_old) ;
X exit(0) ;
X}
X
X
Xstatic void
Xdo_clr_eol() /* Clear to the end of the line. */
X{
X tputs(CE, 1, outc) ;
X}
X
X
X/*ARGSUSED*/
Xdo_menu(mtype) /* Popup appropriate menu - not used. */
Xenum panel_type mtype ;
X{
X return 0 ;
X}
X
X
Xstatic void
Xdo_standend() /* Finish inverted area. */
X{
X tputs(SE, 1, outc) ;
X}
X
X
Xstatic void
Xdo_standout() /* Start inverted area. */
X{
X tputs(SO, 1, outc) ;
X}
X
X
X/*ARGSUSED*/
Xvoid
Xdraw_image(x, y, width, height, image) /* Null routine. */
Xint x, y, width, height ;
Xenum image_type image ;
X{}
X
X
X/*ARGSUSED*/
Xvoid
Xdraw_line(x1, y1, x2, y2, op, color)
Xint x1, y1, x2, y2, color ;
Xenum optype op ;
X{
X char ch ;
X
X/* There is just one case we care about here; the "suggest" cross. To
X * determine if this is such a case, we check if the two x values differ
X * by 10, and the two y values differ by 10. If so, then a plus sign is
X * output at the appropriate row/column, if the color is black, otherwise
X * a space is output.
X */
X
X if (abs(x1 - x2) == 10 && abs(y1 - y2) == 10)
X {
X ch = '+' ;
X tc_move(4 + 4 * (((x1 - BBORDER - PIECE_MARGIN) / CELL_SIZE) & 7),
X 5 + 2 * ((y1 - CY - BBORDER - PIECE_MARGIN) / CELL_SIZE)) ;
X if (color != C_BLACK) ch = ' ' ;
X outc(ch) ;
X }
X}
X
X
X/*ARGSUSED*/
Xvoid
Xdraw_stencil(x, y, width, height, op, color, stencil, image)
Xint x, y, width, height, color ;
Xenum optype op ;
Xenum image_type stencil, image ;
X{
X int ch ;
X
X if (image == P_BLACK) ch = 'X' ;
X else if (image == P_WHITE) ch = 'O' ;
X else return ;
X if (op == RCLR) ch = ' ' ;
X else if (op == RINV) return ;
X
X tc_move(4 + 4 * (((x - BBORDER - PIECE_MARGIN) / CELL_SIZE) & 7),
X 5 + 2 * ((y - CY - BBORDER - PIECE_MARGIN) / CELL_SIZE)) ;
X outc(ch) ;
X}
X
X
Xstatic void
Xdraw_string(x, y, str, flag) /* Display str at x,y. */
Xint x,y, flag ;
Xchar *str ;
X{
X
X/* If flag is set, then we clear to the end of line, otherwise we
X * display the text str in reverse video.
X */
X
X if (flag)
X {
X tc_move(x, y) ;
X do_clr_eol() ;
X }
X else do_standout() ;
X
X tc_move(x, y) ;
X outstr(str) ;
X if (!flag) do_standend() ;
X}
X
X
X/* Text can be one of three things:
X *
X * (1) Text for "panel" items.
X * (2) Text for "cyclic" items.
X * (3) Other text.
X *
X * First we check to see if this is one of the panel message strings.
X *
X * Next we check if this is a panel button or cycle types.
X *
X * For all other text, we check where it is being displayed against
X * a list of possible values. This is then remapped to the correct
X * row/column number, and displayed.
X */
X
X/*ARGSUSED*/
Xvoid
Xdraw_text(x, y, ftype, color, str)
Xenum font_type ftype ;
Xint x, y, color ;
Xchar *str ;
X{
X enum panel_type pt ;
X int black, white ;
X int i ;
X
X/* Check if we are inputting a load/save filename. */
X
X if (x == 89 && y == 74)
X {
X draw_string(38, 3, str, TRUE) ; /* File: */
X return ;
X }
X else if (x == 136 && y == 74)
X {
X draw_string(45, 3, str, TRUE) ; /* filename */
X return ;
X }
X
X/* Check for the four panel message types. */
X
X else if (x == 15 && y == 195) /* Panel message. */
X {
X if (EQUAL(str, "Use left"))
X STRCPY(str, "Select a letter/number pair for a move") ;
X draw_string(othervals[(int) PANEL_MES].column,
X othervals[(int) PANEL_MES].row, str, TRUE) ;
X return ;
X }
X else if (x == 237 && y == 195) /* Note message. */
X {
X draw_string(othervals[(int) NOTES_MES].column,
X othervals[(int) NOTES_MES].row, str, TRUE) ;
X return ;
X }
X else if (x == 15 && y == 237) /* Score message. */
X {
X if (sscanf(str, "Black: %d, White: %d", &black, &white) == 2)
X SPRINTF(str, "Black (O): %d, White (X): %d", black, white) ;
X draw_string(othervals[(int) SCORE_MES].column,
X othervals[(int) SCORE_MES].row, str, TRUE) ;
X return ;
X }
X else if (x == 237 && y == 237) /* Turn message. */
X {
X draw_string(othervals[(int) TURN_MES].column,
X othervals[(int) TURN_MES].row, str, TRUE) ;
X return ;
X }
X
X/* Check for panel and cyclic items. */
X
X for (i = 0; i < MAXITEMS-4; i++)
X if (EQUAL(str, items[i].text))
X if (ttyvals[i].column != -1)
X {
X if (EQUAL(str, "load")) STRCPY(str, "Load") ;
X else if (EQUAL(str, "save")) STRCPY(str, "Save") ;
X draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
X return ;
X }
X else return ;
X
X/* Other text. */
X
X switch (y)
X {
X case 111 : if (x == 182) pt = BLACK_PLAYS ; /* Black plays. */
X else pt = WHITE_PLAYS ; /* White plays. */
X break ;
X case 153 : if (x == 182) pt = DIFFICULTY ; /* Difficulty. */
X else pt = NOTES ; /* Notes. */
X break ;
X default : return ; /* We're not interested in this piece of text. */
X }
X draw_string(othervals[(int) pt].column, othervals[(int) pt].row,
X str, TRUE) ;
X}
X
X
Xstatic void
Xget_event() /* Only events possible are keyboard ones. */
X{
X char c ;
X
X tc_move(0, 0) ; /* Get that bloody cursor out of the way. */
X READ(0, &c, 1) ;
X cur_ch = c & 0177 ;
X}
X
X
X/*ARGSUSED*/
Xget_strwidth(ftype, str) /* Get width in pixels of string value. */
Xenum font_type ftype ;
Xchar *str ;
X{
X return(8) ;
X}
X
X
Xvoid
Xinit_fonts() /* Open normal and bold fonts. */
X{
X nfont_height = 12 ; /* Fake the dimensions. */
X bfont_height = 12 ;
X}
X
X
Xinit_ws_type()
X{
X char bp[1024], termtype[MAXLINE] ;
X static char buf[100] ;
X char *area = buf ;
X
X if (getenv("TERM") != NULL) STRCPY(termtype, getenv("TERM")) ;
X if (tgetent(bp, termtype) != 1) return 1 ;
X if ((CL = tgetstr("cl", &area)) == (char *) 0) return 1 ;
X if ((CM = tgetstr("cm", &area)) == (char *) 0) return 1 ;
X if ((CE = tgetstr("ce", &area)) == (char *) 0) return 1 ;
X if ((SO = tgetstr("so", &area)) == (char *) 0) return 1 ;
X if ((SE = tgetstr("se", &area)) == (char *) 0) return 1 ;
X move_delta = 5 ;
X cur_dpyno = DPY1 ;
X return 0 ;
X}
X
X
Xstatic void
Xload_colors() /* No colors in the termcap implementation. */
X{
X iscolor[(int) cur_dpyno] = 0 ;
X}
X
X
X/*ARGSUSED*/
Xvoid
Xlock_screen(state) /* Graphics locking - null routine. */
Xenum bltype state ;
X{}
X
X
Xvoid
Xmake_canvas() /* Null routine, see the make_frame routine. */
X{}
X
X
X/*ARGSUSED*/
Xvoid
Xmake_frame(argc, argv) /* Create reve window/icon. */
Xint argc ;
Xchar *argv[] ;
X{
X SIGNAL(SIGINT, cleanup) ;
X IOCTL(0, TIOCGETP, &in_old) ; /* Setup standard input. */
X in_new = in_old ;
X in_new.sg_flags |= RAW ;
X in_new.sg_flags &= ~(ECHO | CRMOD) ;
X IOCTL(0, TIOCSETP, &in_new) ;
X setbuf(stdout, (char *) NULL) ;
X}
X
X
Xvoid
Xmake_icon() /* Null routine - no icon in termcap version. */
X{}
X
X
Xstatic void
Xoutc(c) /* Output the next character to the screen. */
Xregister int c ;
X{
X PUTC(c, stdout) ;
X}
X
X
Xstatic void
Xoutstr(str)
Xchar *str ;
X{
X register int i ;
X
X for (i = 0; i < strlen(str); i++) PUTC(str[i], stdout) ;
X}
X
X
Xvoid
Xprocess_event() /* Process the next user input. */
X{
X if (cur_ch == 12) nextc = FRAME_REPAINT ;
X else nextc = KEYBOARD ;
X}
X
X
X/*ARGSUSED*/
Xvoid
Xset_cursor(cursor) /* No cursors in termcap version. */
Xenum curtype cursor ;
X{}
X
X
X/*ARGSUSED*/
Xvoid
Xstart_tool(dtype) /* Display screen and start event dispatcher. */
Xenum disp_type dtype ;
X{
X init_canvas() ; /* Equivalent of a FRAME_REPAINT. */
X
X for (;;)
X {
X get_event() ; /* Get next canvas event. */
X process_event() ; /* Find out what kind it is. */
X handle_event() ; /* And do the apropriate action. */
X }
X}
X
X
Xstatic void
Xtc_move(x, y) /* Move to character position (x, y). */
Xint x, y ;
X{
X tputs(tgoto(CM, x, y), 1, outc) ;
X}
END_OF_FILE
if test 13742 -ne `wc -c <'tty.c'`; then
echo shar: \"'tty.c'\" unpacked with wrong size!
fi
# end of 'tty.c'
fi
if test -f 'x11.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'x11.c'\"
else
echo shar: Extracting \"'x11.c'\" \(22002 characters\)
sed "s/^X//" >'x11.c' <<'END_OF_FILE'
X/*LINTLIBRARY*/
X
X/* @(#)x11.c 1.7 90/10/18
X *
X * X11 dependent graphics routines used by reve.
X *
X * Copyright (c) 1990 - Rich Burridge & Yves Gallot.
X * All rights reserved.
X *
X * Permission is given to distribute these sources, as long as the
X * introductory messages are not removed, and no monies are exchanged.
X *
X * You are forbidden from using Reve as is, or in a modified state, in
X * any tournaments, without the permission of the authors.
X *
X * No responsibility is taken for any errors or inaccuracies inherent
X * either to the comments or the code of this program, but if reported
X * (see README file), then an attempt will be made to fix them.
X */
X
X#include <stdio.h>
X#include <strings.h>
X#include <sys/time.h>
X#include "reve.h"
X#include "color.h"
X#include "extern.h"
X#include "images.h"
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X#include <X11/Xatom.h>
X#include <X11/cursorfont.h>
X
X#define BOLDFONT "lucidasanstypewriter-bold-12"
X#define DEFFONT "fixed"
X#define NORMALFONT "lucidasanstypewriter-12"
X
X#define FRAME_MASK (ButtonPressMask | ButtonReleaseMask | ExposureMask | \
X EnterWindowMask | KeyPressMask | LeaveWindowMask | \
X PointerMotionMask)
X
X#define OTHELLO_BORDER_WIDTH 2
X
Xenum gr_type gtype = GX11 ; /* Graphics type. */
X
Xstatic void get_event(), init_X() ;
Xstatic int process_expose() ;
X
XAtom protocol_atom[MAXDPY], kill_atom[MAXDPY] ;
XCursor cursor[MAXCURSORS] ;
XDisplay *dpy[MAXDPY], *open_display() ;
XGC gc[MAXDPY] ; /* Graphics context for text and lines. */
XGC ropgc[MAXDPY] ; /* Graphics context for rops. */
XGC stencilgc[MAXDPY] ; /* Graphics context for stencils. */
XPixmap images[MAXIMAGES] ;
XPixmap no_pixmap ;
XPixmap load_color_icon(), load_image(), reve_icon ;
XWindow frame[MAXDPY], root[MAXDPY] ;
XXClassHint class_hint = { "reve", "Reve" } ;
XXColor BGcolor, FGcolor ;
XXEvent event ;
XXFontStruct *font[MAXFONTS] ;
XXSizeHints size ;
XXWMHints wm_hints ;
XXGCValues gc_val ; /* Used to setup graphics context values. */
Xint cmap_loaded ; /* Set if we've already loaded the colormap. */
Xint gc_flags ; /* Used to set up graphics context flags. */
Xint screen[MAXDPY] ; /* Default graphics display screen. */
Xint xfd[MAXDPY] ; /* Server connection file descriptors. */
Xunsigned long backgnd[MAXDPY] ; /* Default background color. */
Xunsigned long foregnd[MAXDPY] ; /* Default foreground color. */
Xunsigned long gc_mask ; /* Mask for setting graphic context values. */
Xunsigned long palette[OTH_COLORSIZE] ; /* Xlib color palette. */
X
X#ifndef NOSELECT
X#ifdef NO_43SELECT
Xint fullmask ; /* Full mask of file descriptors to check on. */
Xint readmask ; /* Readmask used in select call. */
X#else
Xfd_set fullmask ; /* Full mask of file descriptors to check on. */
Xfd_set readmask ; /* Readmask used in select call. */
X#endif /*NO_43SELECT*/
X#endif /*NOSELECT*/
X
X/* 256-byte table for quickly reversing the bits in an unsigned 8-bit char,
X * used to convert between MSBFirst and LSBFirst image formats.
X */
X
Xchar revtable[256] = {
X 0, -128, 64, -64, 32, -96, 96, -32,
X 16, -112, 80, -48, 48, -80, 112, -16,
X 8, -120, 72, -56, 40, -88, 104, -24,
X 24, -104, 88, -40, 56, -72, 120, -8,
X 4, -124, 68, -60, 36, -92, 100, -28,
X 20, -108, 84, -44, 52, -76, 116, -12,
X 12, -116, 76, -52, 44, -84, 108, -20,
X 28, -100, 92, -36, 60, -68, 124, -4,
X 2, -126, 66, -62, 34, -94, 98, -30,
X 18, -110, 82, -46, 50, -78, 114, -14,
X 10, -118, 74, -54, 42, -86, 106, -22,
X 26, -102, 90, -38, 58, -70, 122, -6,
X 6, -122, 70, -58, 38, -90, 102, -26,
X 22, -106, 86, -42, 54, -74, 118, -10,
X 14, -114, 78, -50, 46, -82, 110, -18,
X 30, -98, 94, -34, 62, -66, 126, -2,
X 1, -127, 65, -63, 33, -95, 97, -31,
X 17, -111, 81, -47, 49, -79, 113, -15,
X 9, -119, 73, -55, 41, -87, 105, -23,
X 25, -103, 89, -39, 57, -71, 121, -7,
X 5, -123, 69, -59, 37, -91, 101, -27,
X 21, -107, 85, -43, 53, -75, 117, -11,
X 13, -115, 77, -51, 45, -83, 109, -19,
X 29, -99, 93, -35, 61, -67, 125, -3,
X 3, -125, 67, -61, 35, -93, 99, -29,
X 19, -109, 83, -45, 51, -77, 115, -13,
X 11, -117, 75, -53, 43, -85, 107, -21,
X 27, -101, 91, -37, 59, -69, 123, -5,
X 7, -121, 71, -57, 39, -89, 103, -25,
X 23, -105, 87, -41, 55, -73, 119, -9,
X 15, -113, 79, -49, 47, -81, 111, -17,
X 31, -97, 95, -33, 63, -65, 127, -1,
X} ;
X
Xint opvals[3] ; /* Pixrect rasterop values. */
Xunsigned int scr_depth[MAXDPY] ;
X
X
X/*ARGSUSED*/
Xvoid
Xbatch(state) /* Turn graphics batching on or off. */
Xenum bltype state ;
X{
X XFlush(dpy[(int) cur_dpyno]) ;
X}
X
X
Xvoid
Xclose_frame() /* Iconise reve window. */
X{
X int d ;
X XEvent event ;
X
X d = (int) cur_dpyno ;
X iconic = 1 ;
X event.xclient.type = ClientMessage ;
X event.xclient.display = dpy[d] ;
X event.xclient.window = frame[d] ;
X event.xclient.message_type = XInternAtom(dpy[d], "WM_CHANGE_STATE", False) ;
X event.xclient.format = 32 ;
X event.xclient.data.l[0] = IconicState ;
X XSendEvent(dpy[d], DefaultRootWindow(dpy[d]), False,
X SubstructureRedirectMask | SubstructureNotifyMask, &event) ;
X}
X
X
Xvoid
Xcolor_area(x, y, width, height, color)
Xint x, y, width, height, color ;
X{
X int d ;
X
X d = (int) cur_dpyno ;
X if (iscolor[d]) gc_val.foreground = palette[color] ;
X else
X {
X if (color == C_WHITE) gc_val.foreground = backgnd[d] ;
X else gc_val.foreground = foregnd[d] ;
X }
X gc_val.function = GXcopy ;
X XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
X XFillRectangle(dpy[d], frame[d], gc[d], x, y,
X (unsigned int) width, (unsigned int) height) ;
X}
X
X
X/*ARGSUSED*/
Xvoid
Xcreate_menu(mtype, values) /* Create the various popup menus. */
Xenum panel_type mtype ;
Xchar *values[] ;
X{}
X
X
Xvoid
Xdestroy_frame() /* Destroy reve window. */
X{
X XDestroyWindow(dpy[(int) cur_dpyno], frame[(int) cur_dpyno]) ;
X}
X
X
X/*ARGSUSED*/
Xdo_menu(mtype) /* Display popup menu for cyclic item. */
Xenum item_type mtype ;
X{
X return(0) ;
X}
X
X
Xvoid
Xdraw_image(x, y, width, height, image)
Xint x, y, width, height ;
Xenum image_type image ;
X{
X int d ;
X
X d = (int) cur_dpyno ;
X gc_mask = GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
X gc_val.stipple = images[(int) image] ;
X gc_val.ts_x_origin = x ;
X gc_val.ts_y_origin = y ;
X XChangeGC(dpy[d], ropgc[d], gc_mask, &gc_val) ;
X XFillRectangle(dpy[d], frame[d], ropgc[d], x, y, width, height) ;
X}
X
X
Xvoid
Xdraw_line(x1, y1, x2, y2, op, color)
Xint x1, y1, x2, y2, color ;
Xenum optype op ;
X{
X int d ;
X
X d = (int) cur_dpyno ;
X if (iscolor[d]) gc_val.foreground = palette[color] ;
X else gc_val.foreground = foregnd[d] ;
X gc_val.function = opvals[(int) op] ;
X XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
X XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
X}
X
X
Xvoid
Xdraw_stencil(x, y, width, height, op, color, stencil, image)
Xint x, y, width, height, color ;
Xenum optype op ;
Xenum image_type stencil, image ;
X{
X int d ;
X
X d = (int) cur_dpyno ;
X if (iscolor[d]) gc_val.foreground = palette[color] ;
X else gc_val.foreground = foregnd[d] ;
X gc_val.function = opvals[(int) op] ;
X gc_val.clip_x_origin = x ;
X gc_val.clip_y_origin = y ;
X gc_val.clip_mask = images[(int) stencil] ;
X gc_val.stipple = images[(int) image] ;
X gc_val.ts_x_origin = x ;
X gc_val.ts_y_origin = y ;
X gc_mask = GCForeground | GCFunction | GCClipMask |
X GCClipXOrigin | GCClipYOrigin |
X GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
X XChangeGC(dpy[d], stencilgc[d], gc_mask, &gc_val) ;
X XFillRectangle(dpy[d], frame[d], stencilgc[d], x, y, width, height) ;
X}
X
X
Xvoid
Xdraw_text(x, y, ftype, color, str)
Xenum font_type ftype ;
Xint x, y, color ;
Xchar *str ;
X{
X int d ;
X
X d = (int) cur_dpyno ;
X if (iscolor[d]) gc_val.foreground = palette[color] ;
X else
X {
X if (color == C_WHITE) gc_val.foreground = backgnd[d] ;
X else gc_val.foreground = foregnd[d] ;
X }
X gc_val.font = font[(int) ftype]->fid ;
X gc_val.function = GXcopy ;
X XChangeGC(dpy[d], gc[d], GCFont | GCForeground | GCFunction, &gc_val) ;
X XDrawString(dpy[d], frame[d], gc[d], x, y, str, strlen(str)) ;
X}
X
X
Xstatic void
Xget_event() /* Get the next canvas event. */
X{
X int d ;
X
X d = (int) cur_dpyno ;
X XFlush(dpy[d]) ;
X if (!XCheckMaskEvent(dpy[d], ExposureMask, &event))
X XNextEvent(dpy[d], &event) ;
X}
X
X
XXFontStruct *
Xget_font(name)
Xchar *name ;
X{
X XFontStruct *f ;
X
X if (!(f = XLoadQueryFont(dpy[0], name)))
X if (!(f = XLoadQueryFont(dpy[0], DEFFONT)))
X {
X FPRINTF(stderr, "%s: couldn't get the default font.", progname) ;
X exit(1) ;
X }
X return(f) ;
X}
X
X
Xget_strwidth(ftype, str) /* Get width in pixels of string value. */
Xenum font_type ftype ;
Xchar *str ;
X{
X return(XTextWidth(font[(int) ftype], str, strlen(str))) ;
X}
X
X
Xstatic void
Xinit_X(dpyno, dtype)
Xenum dpy_type dpyno ;
Xenum disp_type dtype ;
X{
X int d ;
X
X d = (int) dpyno ;
X if (dtype == XBLACK || dtype == XBOTH)
X dpy[d] = open_display(dpyno, black_dpy) ;
X else dpy[d] = open_display(dpyno, white_dpy) ;
X
X screen[d] = DefaultScreen(dpy[d]) ;
X root[d] = RootWindow(dpy[d], screen[d]) ;
X
X if (!geometry[d])
X STRCPY(geometry[d], XGetDefault(dpy[d], progname, "Geometry")) ;
X
X foregnd[d] = BlackPixel(dpy[d], screen[d]) ;
X backgnd[d] = WhitePixel(dpy[d], screen[d]) ;
X scr_depth[d] = DefaultDepth(dpy[d], screen[d]) ;
X}
X
X
Xvoid
Xinit_fonts() /* Open the normal and bold fonts. */
X{
X font[(int) BFONT] = get_font(BOLDFONT) ;
X font[(int) NFONT] = get_font(NORMALFONT) ;
X bfont_height = font[(int) BFONT]->max_bounds.ascent +
X font[(int) BFONT]->max_bounds.descent ;
X nfont_height = font[(int) NFONT]->max_bounds.ascent +
X font[(int) NFONT]->max_bounds.descent ;
X}
X
X
Xinit_ws_type()
X{
X#ifndef NOSELECT
X#ifdef NO_43SELECT
X fullmask = 0 ;
X#else
X FD_ZERO(&fullmask) ;
X#endif /*NO_43SELECT*/
X#endif /*NOSELECT*/
X
X if (dtype == XTWO)
X {
X init_X(DPY1, XBLACK) ;
X init_X(DPY2, XWHITE) ;
X }
X else init_X(DPY1, dtype) ;
X cmap_loaded = 0 ;
X move_delta = 10 ;
X
X images[(int) BUT_STENCIL] = load_image(button_stencil_image) ;
X images[(int) BUT_INVERT] = load_image(button_invert_image) ;
X images[(int) BUT_NORMAL] = load_image(button_normal_image) ;
X images[(int) CY_NORMAL] = load_image(cycle_glyph_image) ;
X images[(int) CY_STENCIL] = load_image(cycle_stencil_image) ;
X images[(int) CY_LINVERT] = load_image(cycle_linvert_image) ;
X images[(int) CY_RINVERT] = load_image(cycle_rinvert_image) ;
X images[(int) P_WHITE] = load_image(white_image) ;
X images[(int) P_BLACK] = load_image(black_image) ;
X
X cursor[(int) CANVASCUR] = XCreateFontCursor(dpy[0], XC_top_left_arrow) ;
X cursor[(int) HOURGLASS] = XCreateFontCursor(dpy[0], XC_watch) ;
X no_pixmap = XCreateBitmapFromData(dpy[0], root[0],
X (char *) nocur_image, 16, 16) ;
X cursor[(int) NOCURSOR] = XCreatePixmapCursor(dpy[0], no_pixmap, no_pixmap,
X &FGcolor, &BGcolor, 0, 0) ;
X return 0 ;
X}
X
X
Xstatic void
Xload_colors() /* Create and load reve color map. */
X{
X XColor ccol ;
X u_char red[OTH_COLORSIZE], green[OTH_COLORSIZE], blue[OTH_COLORSIZE] ;
X int d, i, numcolors ;
X
X if (cmap_loaded) return ;
X d = (int) cur_dpyno ;
X iscolor[d] = 0 ;
X if (DisplayCells(dpy[d], screen[d]) > 2)
X {
X oth_colorsetup(red, green, blue) ;
X iscolor[d] = 1 ;
X numcolors = 0 ;
X for (i = 0; i < OTH_COLORSIZE; i++)
X {
X ccol.flags = DoRed | DoGreen | DoBlue ;
X ccol.red = (unsigned short) (red[i] << 8) ;
X ccol.green = (unsigned short) (green[i] << 8) ;
X ccol.blue = (unsigned short) (blue[i] << 8) ;
X if (XAllocColor(dpy[d],
X DefaultColormap(dpy[d], screen[d]), &ccol) == True)
X palette[numcolors++] = ccol.pixel ;
X }
X if (numcolors < 2)
X {
X FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
X exit(1) ;
X }
X cmap_loaded = 1 ;
X }
X}
X
X
XPixmap
Xload_color_icon(sbuf)
Xunsigned short sbuf[] ;
X{
X GC pix_gc ;
X Pixmap pixmap ;
X XImage *image ;
X char cbuf[512*8] ;
X int d, i ;
X
X d = (int) cur_dpyno ;
X for (i = 0; i < (256*8); i++)
X {
X cbuf[i*2+0] = palette[(sbuf[i] >> 8) & 0xFF] ;
X cbuf[i*2+1] = palette[sbuf[i] & 0xFF] ;
X }
X pix_gc = DefaultGC(dpy[d], screen[d]) ;
X image = XCreateImage(dpy[d], DefaultVisual(dpy[d], screen[d]),
X scr_depth[d], ZPixmap, 0, cbuf, 64, 64, 8, 64) ;
X pixmap = XCreatePixmap(dpy[d], root[d],
X ICONWIDTH, (unsigned) image->height, scr_depth[d]) ;
X XPutImage(dpy[d], pixmap, pix_gc, image, 0, 0, 0, 0,
X ICONWIDTH, (unsigned) image->height) ;
X return(pixmap) ;
X}
X
X
XPixmap
Xload_image(sbuf)
Xunsigned short sbuf[256] ;
X{
X char cbuf[512] ;
X int i ;
X
X for (i = 0; i < 256; i++)
X {
X cbuf[i*2+0] = revtable[(sbuf[i] >> 8) & 0xFF] ;
X cbuf[i*2+1] = revtable[sbuf[i] & 0xFF] ;
X }
X return(XCreateBitmapFromData(dpy[(int) cur_dpyno], root[(int) cur_dpyno],
X cbuf, 64, 64)) ;
X}
X
X
X/*ARGSUSED*/
Xvoid
Xlock_screen(state) /* Turn graphics locking on or off - null routine. */
Xenum bltype state ;
X{}
X
X
Xvoid
Xmake_canvas() {} /* Null routine, see the make_frame routine. */
X
X
Xvoid
Xmake_frame(argc, argv) /* Create reve window/icon. */
Xint argc ;
Xchar *argv[] ;
X{
X unsigned int h, w ; /* Window dimensions. */
X int d, flags ;
X int x, y ; /* Window position. */
X
X d = (int) cur_dpyno ;
X opvals[(int) RCLR] = GXclear ;
X opvals[(int) RSRC] = GXcopy ;
X opvals[(int) RINV] = GXxor ;
X
X load_colors() ;
X if (iscolor[d]) reve_icon = load_color_icon(cicon_image) ;
X else reve_icon = load_image(icon_image) ;
X
X size.flags = PMinSize | PMaxSize | PPosition | PSize ;
X size.x = 0 ;
X size.y = 0 ;
X size.max_width = size.min_width = size.width = TOTAL_WIDTH ;
X size.max_height = size.min_height = size.height = TOTAL_HEIGHT ;
X
X if (strlen(geometry[d]))
X {
X flags = XParseGeometry(geometry[d], &x, &y, &w, &h) ;
X if (XValue & flags)
X {
X if (XNegative & flags)
X x = DisplayWidth(dpy[d], screen[d]) + x - size.width ;
X size.flags |= USPosition ;
X size.x = x ;
X }
X if (YValue & flags)
X {
X if (YNegative & flags)
X y = DisplayHeight(dpy[d], screen[d]) + y - size.height ;
X size.flags |= USPosition ;
X size.y = y ;
X }
X }
X
X frame[d] = XCreateSimpleWindow(dpy[d], root[d],
X size.x, size.y, size.width, size.height,
X OTHELLO_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
X
X protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
X kill_atom[d] = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
X
X XSetStandardProperties(dpy[d], frame[d], "reve", NULL, reve_icon,
X argv, argc, &size) ;
X
X wm_hints.icon_x = ix ;
X wm_hints.icon_y = iy ;
X wm_hints.input = True ;
X wm_hints.icon_pixmap = reve_icon ;
X wm_hints.flags = InputHint | IconPixmapHint ;
X if (iconic)
X {
X wm_hints.initial_state = IconicState ;
X wm_hints.flags |= StateHint ;
X }
X XSetWMHints(dpy[d], frame[d], &wm_hints) ;
X
X/* Set XA_WM_CLASS so things that depend on NAME work. */
X
X XSetClassHint(dpy[d], frame[d], &class_hint) ;
X
X gc_mask = GCForeground | GCBackground | GCGraphicsExposures ;
X gc_val.foreground = foregnd[d] ;
X gc_val.background = backgnd[d] ;
X gc_val.graphics_exposures = False ;
X gc[d] = XCreateGC(dpy[d], root[d], gc_mask, &gc_val) ;
X
X ropgc[d] = XCreateGC(dpy[d], root[d], gc_mask, &gc_val) ;
X XSetFillStyle(dpy[d], ropgc[d], FillStippled) ;
X
X stencilgc[d] = XCreateGC(dpy[d], root[d], gc_mask, &gc_val) ;
X XSetFillStyle(dpy[d], stencilgc[d], FillOpaqueStippled) ;
X}
X
X
Xvoid
Xmake_icon() {} /* Null routine - icon created in make_frame. */
X
X
XDisplay *
Xopen_display(dpyno, display) /* Establish a connection to a display server. */
Xenum dpy_type dpyno ;
Xchar *display ;
X{
X int d ;
X Display *dpy ;
X
X d = (int) dpyno ;
X if ((dpy = XOpenDisplay(display)) == NULL)
X {
X FPRINTF(stderr,"%s: Couldn't open display %s\n", progname, display) ;
X exit(1) ;
X }
X
X xfd[d] = ConnectionNumber(dpy) ;
X
X#ifndef NOSELECT
X#ifdef NO_43SELECT
X fullmask |= (1 << xfd[d]) ;
X#else
X FD_SET(xfd[d], &fullmask) ;
X#endif /*NO_43SELECT*/
X#endif /*NOSELECT*/
X
X return(dpy) ;
X}
X
X
Xvoid
Xprocess_event() /* Determine event type. */
X{
X XClientMessageEvent *ev ;
X XKeyPressedEvent *key_event ;
X char chs[2] ;
X int d ;
X
X d = (int) cur_dpyno ;
X switch (event.type)
X {
X case ClientMessage : /* Catch ICCCM kill from WM. */
X
X ev = (XClientMessageEvent *) &event ;
X if (ev->message_type == protocol_atom[d] &&
X ev->data.l[0] == kill_atom[d])
X exit(0) ;
X nextc = IGNORE_EVENT ;
X break ;
X case Expose : nextc = process_expose((XExposeEvent *) &event) ;
X break ;
X case KeyPress : key_event = (XKeyPressedEvent *) &event ;
X curx = key_event->x ;
X cury = key_event->y ;
X (void) XLookupString(key_event, chs, 1,
X (KeySym *) NULL,
X (XComposeStatus *) NULL) ;
X cur_ch = chs[0] ;
X nextc = KEYBOARD ;
X break ;
X case EnterNotify : nextc = ENTER_WINDOW ;
X break ;
X case LeaveNotify : nextc = EXIT_WINDOW ;
X break ;
X case MotionNotify : nextc = MOUSE_MOVING ;
X curx = event.xbutton.x ;
X cury = event.xbutton.y ;
X break ;
X case ButtonPress : curx = event.xbutton.x ;
X cury = event.xbutton.y ;
X if (event.xbutton.button == Button1)
X nextc = LEFT_DOWN ;
X else if (event.xbutton.button == Button2)
X nextc = MIDDLE_DOWN ;
X else if (event.xbutton.button == Button3)
X nextc = RIGHT_DOWN ;
X break ;
X case ButtonRelease : curx = event.xbutton.x ;
X cury = event.xbutton.y ;
X if (event.xbutton.button == Button1)
X nextc = LEFT_UP ;
X else if (event.xbutton.button == Button2)
X nextc = MIDDLE_UP ;
X else if (event.xbutton.button == Button3)
X nextc = RIGHT_UP ;
X }
X}
X
X
Xstatic
Xprocess_expose(event)
XXExposeEvent *event ;
X{
X int d ;
X int doframe = 0 ;
X
X d = (int) cur_dpyno ;
X do
X if (event->count == 0 && event->window == frame[(int) cur_dpyno])
X doframe++ ;
X while (XCheckMaskEvent(dpy[d], ExposureMask, (XEvent *) event)) ;
X
X return(doframe ? FRAME_REPAINT : IGNORE_EVENT) ;
X}
X
X
Xvoid
Xset_cursor(ctype)
Xenum curtype ctype ;
X{
X int d ;
X
X d = (int) cur_dpyno ;
X XDefineCursor(dpy[d], frame[d], cursor[(int) ctype]) ;
X XFlush(dpy[d]) ;
X}
X
X
Xvoid
Xstart_tool(dtype) /* Start event dispatcher and display. */
Xenum disp_type dtype ;
X{
X XSelectInput(dpy[0], frame[0], FRAME_MASK) ;
X XMapWindow(dpy[0], frame[0]) ;
X
X if (dtype == XTWO)
X {
X XSelectInput(dpy[1], frame[1], FRAME_MASK) ;
X XMapWindow(dpy[1], frame[1]) ;
X }
X
X if (dtype == XTWO) Xselect_input() ;
X else Xnext_input() ;
X}
X
X
XXnext_input()
X{
X for (;;)
X {
X get_event() ; /* Get next canvas event. */
X process_event() ; /* Find out what kind it is. */
X handle_event() ; /* And do the apropriate action. */
X }
X}
X
X
XXselect_input()
X{
X int fd = -1 ; /* File descriptor with this event. */
X struct timeval tval ; /* To set checking period. */
X
X tval.tv_usec = 0 ;
X tval.tv_sec = 0 ;
X
X for (;;)
X {
X XSync(dpy[0], 0) ;
X if (dtype == XTWO) XSync(dpy[1], 0) ;
X
X#ifdef NOSELECT
X fd = 0 ;
X#else
X fd = -1 ;
X readmask = fullmask ;
X#ifdef NO_43SELECT
X SELECT(32, &readmask, 0, 0, &tval) ;
X if (readmask && (1 << xfd)[0]) fd = 0 ;
X else if (readmask && (1 << xfd)[1]) fd = 1 ;
X#else
X SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
X if (FD_ISSET(xfd[0], &readmask)) fd = 0 ;
X else if (FD_ISSET(xfd[1], &readmask)) fd = 1 ;
X#endif /*NO_43SELECT*/
X#endif /*NOSELECT*/
X
X if (fd >= 0)
X {
X cur_dpyno = (enum dpy_type) fd ;
X do
X {
X get_event() ; /* Get next canvas event. */
X process_event() ; /* Find out what kind it is. */
X handle_event() ; /* And do appropriate action. */
X }
X while (XPending(dpy[fd])) ;
X }
X }
X}
END_OF_FILE
if test 22002 -ne `wc -c <'x11.c'`; then
echo shar: \"'x11.c'\" unpacked with wrong size!
fi
# end of 'x11.c'
fi
echo shar: End of archive 4 \(of 7\).
cp /dev/null ark4isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 7 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