[comp.sources.games.bugs] Official patch #4 for reve v1.1

richb@sunaus.oz (Rich Burridge) (12/18/90)

[Unless I've made any silly boo-boo's, that's it with reve for two or three
 months - Rich].


/*  Official patch #4 for Reve v1.1.
 *
 *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
 *  All rights reserved.
 *
 *  Permission is granted to copy this patch, for redistribution
 *  in patch form only, provided the news headers in "substantially
 *  unaltered format" are retained, the introductory messages are not
 *  removed, and no monies are exchanged.
 *
 *  Permission is also granted to copy this patch, without the news
 *  headers, for the purposes of patching the Reve source and making
 *  an executable copy by means of compilation, provided that such
 *  copy will not be used for the purposes of competition in any othello
 *  tournaments, without prior permission from the authors.
 */

CONTENTS:

1. What is reve?
2/ Changes made in this patch.
3/ How to install this patch.
4/ How to get previous patches.

----------------

1/ What is reve?

Reve is an othello game. It works under SunView, XView, X11 (Xlib) and on
dumb tty terminals.

Reve has nine levels of difficulty. Levels 1-3 should be useful to beginners,
levels 4-6 would satisfy amateurs, and the higher levels will give experts a
good game. Level 8 (30 minutes) is the tournament level.

----------------
 
2/ Changes made in this patch.

       * From Jonathan I. Kamens <jik@pit-manager.MIT.EDU>
         From Rod Whitby <rwhitby@adl.austek.oz.au>
         From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
         You forgot to add common.c and common.o to the file lists in the
         Imakefile.

       * The props button for the SunView and X11 version now toggles the
         display of the property window, rather than closing it down to an
         icon.         
                       
       * Added in a redraw request (^L for example) for the other versions
         (not just the tty one).
                       
       * It was possible to number the 0th stone by toggling the "number
         move" option. 
                       
       * Added in keyboard options for all the toggles on the property sheet.
                       
       * From Soren Hein <shein@ferdowsi.berkeley.edu>
         I'm not sure what the connection is between the level and the #moves
         lookahead. Does one override the other? For instance, what if I set
         level to 1 and #moves to 8?
                       
         [Valerie Haecky has rewritten this section of the README file, and
          I've modified the manual pages appropriately. The Difficulty and
          Set Search Depth items on the property sheet have been modified
          to better reflect the situation - Rich.]
                       
       * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
         It would be nice to have the ability to "make tty" in the Imakefile
         as well as being able to generate the X11 version.

         [Rod Whitby has kindly added this to the Imakefile for me - Rich.]

       * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
         Add the ability to change the default background colour of the board
         to a (not too bright !) green colour. After all, that's the colour of
         the othello sets you buy in the shops!

         [I'll do these with settable resources. I'll allow you to set some of
          them on the command line, and I'll add a .reverc file, which will be
          read from the users home directory. For the X11/XView versions, I'll
          allow the resources to be set in all the standard X places, and the
          .reverc file can superceed them - Rich.]

       * From: robert@anucsd.anu.oz.au (Robert Cohen)
         It might be useful to have a way of setting the difficulty absolutely
         ie in a way not dependant on the machine being used as otherwise level
         3 say is harder on a faster machine than a slower machine. Then you
         could say to someone else as a measure of your Othello playing ability
         "I can beat reve on level a3" (a3 stands for absolute level 3).

         [This functionality is now available with the "set search depth"
          option.]

       * Added the -props command line option, to automatically display the
         reve property sheet on startup.

       * Added the reve.properties X resource, to achieve the same result.

       * Fixed the problem of the property sheet coming up with the incorrect
         size under X11R3.

       * Added in support for online help window via a "help" button on the
         main panel. The help file is just a copy of the nroff'ed version of
         the manual pages placed in the $(LIBDIR) directory. The Makefile.dist
         file has been updated to move this file to $(LIBDIR) with the "make
         install". You can also specify the location of the reve help file
         with the new HELPNAMEFILE and HELPNAME definitions.

       * The -h <helpfile> command line options have been added to allow you
         to specify an alternate location for the helpfile. The manual pages
         have been updated.

       * Modifying the "Computer plays:" selection, failed to update the
         "Black:" and "White:" messages.

       * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
       * From Valerie Haecky <vmh@Eng.Sun.COM>
         Allow the player to go forwards through a game as well as backwards
         (Undo only performs the latter and not the former). In other words,
         "undo the Undo" !

----------------

3/ How to install this patch.

This patch consists of four parts. Save each one first. You should use
Larry Wall's patch program to apply these changes. Assuming the four files
are called patch4-1, patch4-2, patch4-3 and patch4-4 do the following:

cd reve_src        # directory where your reve source files are.
patch <patch4-1
patch <patch4-2
patch <patch4-3       
patch <patch4-4

Copy Makefile.dist to Makefile, and adjust for your site. See the README
file for things you might have to tweak in order to get Reve to work on
your machine.
 
You will then have to do the appropriate make, to generate the graphics
version you require. Do a "make help" to obtain more information on this.
 
Finally, you should do a "make install". You will probably have to be
super-user to do this.

If you have any problems with Reve after applying this patch, and your
problem is not listed in the TODO file, please let us know.

----------------

4/ How to get previous patches.

If you need to get patches 1, 2 or 3, then they can be obtained from the
automatic mail archive server, by sending a message to
rb-archive-server@Aus.Sun.COM containing the line:

send reve patchn

where n is the patch number you require.

You can also include a path line in these requests to indicate the mail
path that the archive server should use to send the files to you. Such a
path line could be:

path uunet.uu.net!hostname!user

Note that this is uunet.uu.net and not just uunet. Sun.COM doesn't recognise
just uunet.

[NOTE: When unpacking the shars generated by the automatic mail service,
       it is possible you will get error messages for incorrect length.
       Please ignore; hopefully the files should still unpack correctly].

Rich Burridge           richb@Aus.Sun.COM
Yves Gallot             galloty@cernvax.cern.ch

------CUT HERE------patch 4 - part 1------CUT HERE------


------- patchlevel.h -------
Prereq: 3
*** /tmp/da06643	Tue Dec 18 10:00:46 1990
--- patchlevel.h	Mon Dec 10 17:39:00 1990
***************
*** 22,25 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  3
--- 22,25 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  4

------- Makefile.dist -------
*** /tmp/da06646	Tue Dec 18 10:00:46 1990
--- Makefile.dist	Sun Dec 16 11:07:04 1990
***************
*** 34,39 ****
--- 34,45 ----
  EDGENAMEFILE    = $(LIBDIR)/reve.edgetable
  EDGENAME        = -DEDGENAME=\"$(EDGENAMEFILE)\"
  #-----------------------------------------------------------------------
+ #  Full pathname of the reve online help file. This can also be overridden
+ #  with a command line option.
+ #
+ HELPNAMEFILE    = $(LIBDIR)/reve.help
+ HELPNAME        = -DHELPNAME=\"$(HELPNAMEFILE)\"
+ #-----------------------------------------------------------------------
  #  Not all machines have the index() string library function. If you
  #  don't have this function then you should uncomment the NOINDEX
  #  definition below.
***************
*** 106,112 ****
  #  Compilation flags and standard macro definitions.
  #
  CDEFS		= $(NOINDEX) $(NOSELECT) $(NO_USLEEP) $(NO_TIMEVAL) \
! 		  $(EDGENAME) $(SELTYPE) $(SIGRET) $(SYSV) \
  		  $(X11R3) $(X11INCDIR) $(XVIEWINCDIR)
  CFLAGS          = -O $(CDEFS)
  #
--- 112,118 ----
  #  Compilation flags and standard macro definitions.
  #
  CDEFS		= $(NOINDEX) $(NOSELECT) $(NO_USLEEP) $(NO_TIMEVAL) \
! 		  $(EDGENAME) $(HELPNAME) $(SELTYPE) $(SIGRET) $(SYSV) \
  		  $(X11R3) $(X11INCDIR) $(XVIEWINCDIR)
  CFLAGS          = -O $(CDEFS)
  #
***************
*** 116,121 ****
--- 122,128 ----
  
  BINARIES        = sv_reve tty_reve xreve xv_reve
  ETABLE		= reve.edgetable
+ HFILE		= reve.help
  
  CC              = cc
  
***************
*** 194,200 ****
  
  xview:          $(STDOBJS) $(REVEOBJS) common.o reve_proc.o xview.o
  		$(CC) -o xv_reve $(XVIEWLIBDIR) $(CFLAGS) $(STDOBJS) \
! 				xview.o $(XVIEWLIBS)
  		-cp xv_reve reve
  		$(CC) -o reve_proc $(CFLAGS) common.o reve_proc.o $(REVEOBJS)
  
--- 201,207 ----
  
  xview:          $(STDOBJS) $(REVEOBJS) common.o reve_proc.o xview.o
  		$(CC) -o xv_reve $(XVIEWLIBDIR) $(CFLAGS) $(STDOBJS) \
! 				common.o xview.o $(XVIEWLIBS)
  		-cp xv_reve reve
  		$(CC) -o reve_proc $(CFLAGS) common.o reve_proc.o $(REVEOBJS)
  
***************
*** 205,210 ****
--- 212,219 ----
  		-cat reve.edge1 reve.edge2 > $(ETABLE)
  		-cp $(ETABLE) $(LIBDIR)
  		-chmod 644 $(LIBDIR)/$(ETABLE)
+ 		-cp reve.man.text $(LIBDIR)/$(HFILE)
+ 		-chmod 644 $(LIBDIR)/$(HFILE)
  		-cp reve.man $(MANDIR)/reve.$(MANSECT)
  		-chmod 644 $(MANDIR)/reve.$(MANSECT)
  

------- CHANGES -------
*** /tmp/da06649	Tue Dec 18 10:00:47 1990
--- CHANGES	Tue Dec 18 09:51:40 1990
***************
*** 23,28 ****
--- 23,113 ----
  Reve change history.
  ====================
  
+ v1.1 - patchlevel 4. 18th December 1990.
+ 
+        * From Jonathan I. Kamens <jik@pit-manager.MIT.EDU>
+          From Rod Whitby <rwhitby@adl.austek.oz.au>
+          From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
+          You forgot to add common.c and common.o to the file lists in the
+          Imakefile.
+ 
+        * The props button for the SunView and X11 version now toggles the
+          display of the property window, rather than closing it down to an
+          icon.
+ 
+        * Added in a redraw request (^L for example) for the other versions
+          (not just the tty one).
+ 
+        * It was possible to number the 0th stone by toggling the "number
+          move" option.
+ 
+        * Added in keyboard options for all the toggles on the property sheet.
+ 
+        * From Soren Hein <shein@ferdowsi.berkeley.edu>
+          I'm not sure what the connection is between the level and the #moves
+          lookahead. Does one override the other? For instance, what if I set
+          level to 1 and #moves to 8?
+ 
+          [Valerie Haecky has rewritten this section of the README file, and
+           I've modified the manual pages appropriately. The Difficulty and
+           Set Search Depth items on the property sheet have been modified
+           to better reflect the situation - Rich.]
+ 
+        * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
+          It would be nice to have the ability to "make tty" in the Imakefile
+          as well as being able to generate the X11 version.
+ 
+          [Rod Whitby has kindly added this to the Imakefile for me - Rich.]
+ 
+        * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
+          Add the ability to change the default background colour of the board
+          to a (not too bright !) green colour. After all, that's the colour of
+          the othello sets you buy in the shops!
+ 
+          [I'll do these with settable resources. I'll allow you to set some of
+           them on the command line, and I'll add a .reverc file, which will be
+           read from the users home directory. For the X11/XView versions, I'll
+           allow the resources to be set in all the standard X places, and the
+           .reverc file can superceed them - Rich.]
+ 
+        * From: robert@anucsd.anu.oz.au (Robert Cohen)
+          It might be useful to have a way of setting the difficulty absolutely
+          ie in a way not dependant on the machine being used as otherwise level
+          3 say is harder on a faster machine than a slower machine. Then you
+          could say to someone else as a measure of your Othello playing ability
+          "I can beat reve on level a3" (a3 stands for absolute level 3).
+ 
+          [This functionality is now available with the "set search depth"
+           option.]
+ 
+        * Added the -props command line option, to automatically display the
+          reve property sheet on startup.
+ 
+        * Added the reve.properties X resource, to achieve the same result.
+ 
+        * Fixed the problem of the property sheet coming up with the incorrect
+          size under X11R3.
+ 
+        * Added in support for online help window via a "help" button on the
+          main panel. The help file is just a copy of the nroff'ed version of
+          the manual pages placed in the $(LIBDIR) directory. The Makefile.dist
+          file has been updated to move this file to $(LIBDIR) with the "make
+          install". You can also specify the location of the reve help file
+          with the new HELPNAMEFILE and HELPNAME definitions.
+ 
+        * The -h <helpfile> command line options have been added to allow you
+          to specify an alternate location for the helpfile. The manual pages
+          have been updated.
+ 
+        * Modifying the "Computer plays:" selection, failed to update the
+          "Black:" and "White:" messages.
+ 
+        * From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
+        * From Valerie Haecky <vmh@Eng.Sun.COM>
+          Allow the player to go forwards through a game as well as backwards
+          (Undo only performs the latter and not the former). In other words,
+          "undo the Undo" !
+ 
  v1.1 - patchlevel 3. 9th December 1990.
  
         * Added a description of the -bestmove command line option to the

------- README -------
*** /tmp/da06652	Tue Dec 18 10:00:48 1990
--- README	Sat Dec 15 11:47:45 1990
***************
*** 39,48 ****
  
  See the manual pages for a detailed description of the rules of Othello.
  
! Reve has nine levels of difficulty. Levels 1-3 should be useful to beginners,
! levels 4-6 would satisfy amateurs, and the higher levels will give experts a
! good game. Level 8 (30 minutes) is the tournament level.
  
  The address where people can get information about tournaments, Othello
  Quarterly, and "Othello Brief and Basic' is:
   
--- 39,94 ----
  
  See the manual pages for a detailed description of the rules of Othello.
  
! Reve has various levels of difficulty.
  
+ You can decide, whether you would like to set a time limit, or a search depth 
+ limit on the computer move. 
+  
+ The levels of play can be rated approximately as follows:
+  
+ Instant: 
+   Beginner level. The search depth is one ply. Even at this level,
+   beating reve is not trivial! 
+ 
+ 1 Minute/3 Minutes/5 Minutes:
+   Intermediate levels. If you often beat reve at the 5 minute level, you
+   have probably mastered the basics, and played a lot of games. Interested
+   in playing real people in tournaments ? 
+ 
+ 10 Minutes:
+   Advanced. Beating reve at this level is no piece of cake. 
+ 
+ 30 Minutes:  (tournament level)
+   More advanced. None of us has beaten reve at this level yet. If you do,
+   you should seriously consider participating in your countries national 
+   championship. 
+ 
+ 60 Minutes: 
+   At this level reve looks further ahead than most humans can. If you
+   win a game here, send us a transcript, because you have either found
+   a serious bug in the algorithm, or your game deserves to be published. 
+  
+ Set Search Depth:  
+   Setting the depth is an alternative to using a clock. With a clock, the time
+   left decides, how many plys you search for each move. This usually varies
+   by one or two plys, depending on where in the game you are, and towards
+   the end, it is often worth calculating all the way and then storing some
+   moves.
+ 
+   By setting the depth you force the computer to search n plys, no matter where
+   in the game you are. There is no clock. This means, that if the depth is set
+   to something other than say '0', or whatever you want to use, the computer
+   uses the depth, otherwise it will use the time. Or something like that.
+   The point of this feature is game analysis. Especially towards the endgame
+   you want to be able to let the computer run (for example, over night). Or if
+   you know that you usually look 4 plys ahead, you want to play an opponent
+   that consistently examines 6 plys. Or you are simply curious what the
+   computer would have played had it searched a little further (like situations
+   which can only be recognized properly in 6 plys etc. Note, that for each
+   additional ply, the compute time increases by about a factor of 4.
+ 
+ ----------
+ 
  The address where people can get information about tournaments, Othello
  Quarterly, and "Othello Brief and Basic' is:
   
***************
*** 81,86 ****
--- 127,134 ----
   
  EDGENAMEFILE - alternate location for the Reve edge table.
  EDGENAME     - alternate location for the Reve edge table.
+ HELPNAMEFILE - alternate location for the Reve online help file.
+ HELPNAME     - alternate location for the Reve online help file.
  NOINDEX      - uncomment if you don't have the index() function.
  NOSELECT     - uncomment if your machine doesn't have the select() call.
  NO_USLEEP    - uncomment if you don't have the usleep(3) call.

------- TODO -------
*** /tmp/da06655	Tue Dec 18 10:00:49 1990
--- TODO	Sun Dec 16 12:21:40 1990
***************
*** 49,59 ****
     because of the inability with some of the graphics versions to interrupt
     it, once it's started.
  
- *  From Valerie Haecky <vmh@Eng.Sun.COM>
-    It might be nice to have an additional button for <help>.
-    It pops up an alert, giving a short summary of the rules and explaining
-    non-obvious things, like how Difficulty is measured.
- 
  *  There are several problems outstanding with the XView version:
     ~ **IMPORTANT** It's still possible to hang the server, if the left
                     mouse button is clicked at the wrong time.
--- 49,54 ----
***************
*** 77,93 ****
     Display the time left for the user[s] and computer.
  
  *  From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
-    Add the ability to change the default background colour of the board to
-    a (not too bright !) green colour. After all, that's the colour of the
-    othello sets you buy in the shops!
-  
-    [I'll do these with settable resources. I'll allow you to set some of
-     them on the command line, and I'll add a .reverc file, which will be read
-     from the users home directory. For the X11/XView versions, I'll allow the
-     resources to be set in all the standard X places, and the .reverc file can
-     superceed them - Rich.]
- 
- *  From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
     Supply a way of forcing the computer to move before its search is complete.
     This would be very handy at the higher levels.
  
--- 72,77 ----
***************
*** 104,113 ****
     on-screen renumbering would have to be done on-the-fly).
   
  *  From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
-    Allow the player to go forwards through a game as well as backwards (Undo
-    only performs the latter and not the former). In other words, "undo the
-    Undo" !
- 
     "New Game" should just undo the game right back to the start. That way
     a player can use the move forwards facility to replay the game easily
     right from the start. Of course, as soon as the player makes a new move,
--- 88,93 ----
***************
*** 236,245 ****
     times faster overall.
  
  *  From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
-    It would be nice to have the ability to "make tty" in the Imakefile as
-    well as being able to generate the X11 version.
- 
- *  From Richard K. Lloyd <RKL@anduin.compsci.liverpool.ac.uk>
     Add in a move list window, which would contain a scrollable list of all
     the moves so far (plus evaluation for the computers moves).
  
--- 216,221 ----
***************
*** 255,267 ****
     you would have a simple regression test for checking for compiler bugs
     on new architectures.
  
- *  From: robert@anucsd.anu.oz.au (Robert Cohen)
-    It might be useful to have a way of setting the difficulty absolutely ie
-    in a way not dependant on the machine being used as otherwise level 3 say
-    is harder on a faster machine than a slower machine. Then you could say to 
-    someone else as a measure of your Othello playing ability "I can beat reve
-    on level a3" (a3 stands for absolute level 3).
- 
  *  From: robert@anucsd.anu.oz.au (Robert Cohen) 
     A cute feature I noticed in the standard X11r4 othello is that it thinks
     during the humans move time. If the person is a slow player this could make
--- 231,236 ----
***************
*** 277,289 ****
     change some numerical constants eg the weighting put on mobility by slider.
     Of course there would be a "tournament" setting to make reve play as well as
     possible.
- 
- *  Add in a redraw request (^L for example) for the other versions (not just
-    the tty one).
- 
- *  Now that reve has a property sheet, and some of the previous panel items
-    no longer exist, the keyboard interface needed to be changed to include
-    the new options, and alter some of the existing ones.
  
  
  Items we're unlikely to implement.
--- 246,251 ----

------- reve.man -------
*** /tmp/da06658	Tue Dec 18 10:00:49 1990
--- reve.man	Sun Dec 16 02:51:12 1990
***************
*** 1,5 ****
  .\" %Z%%M% %I% %E%
! .TH REVE 6 "29 November 1990"
  .SH NAME
  reve \- an othello game.
  .SH SYNOPSIS
--- 1,5 ----
  .\" %Z%%M% %I% %E%
! .TH REVE 6 "15 December 1990"
  .SH NAME
  reve \- an othello game.
  .SH SYNOPSIS
***************
*** 23,28 ****
--- 23,33 ----
  .B \-g
  .I geometry
  ] [
+ .B \-h
+ .I helpfile
+ ] [
+ .B \-help
+ ] [
  .B \-i
  ] [
  .B \-last
***************
*** 38,43 ****
--- 43,50 ----
  ] [
  .B \-number
  ] [
+ .B \-props
+ ] [
  .B \-quick
  ] [
  .B \-v
***************
*** 88,94 ****
  Their meanings are given below, plus an indication of their keyboard
  equivalents. With the cyclic selections, clicking over the left half of the
  cycle item increments the selection, and clicking over the right half of the
! cycle item decrements the selection.
  .LP
  By default, a human will play black, and the computer will play white. If
  you want a human vs human startup or some other combination, then you should
--- 95,104 ----
  Their meanings are given below, plus an indication of their keyboard
  equivalents. With the cyclic selections, clicking over the left half of the
  cycle item increments the selection, and clicking over the right half of the
! cycle item decrements the selection. Control-l is a keyboard accelerator
! for redrawing the
! .I reve
! windows.
  .LP
  By default, a human will play black, and the computer will play white. If
  you want a human vs human startup or some other combination, then you should
***************
*** 95,103 ****
  use the appropriate command line options (see below).
  .SH REVE BUTTONS
  .LP
! With the graphics versions, there are eight buttons that are normally
! displayed at the top of the Reve window. Each of these buttons, has a
! keyboard equivalent which is given in brackets below.
  .LP
  .IP "\fBload [ L ]\fP" 18
  Load a game file. The format of this game file is given below. With the
--- 105,115 ----
  use the appropriate command line options (see below).
  .SH REVE BUTTONS
  .LP
! With the graphics versions, there are ten buttons that are normally
! displayed at the top of the 
! .I reve
! window. Each of these buttons, has a keyboard equivalent which is given in
! brackets below.
  .LP
  .IP "\fBload [ L ]\fP" 18
  Load a game file. The format of this game file is given below. With the
***************
*** 115,120 ****
--- 127,144 ----
  .IP "\fBnew game [ n ]\fP" 18
  Start a new game of
  .I reve
+ .IP "\fBhelp [ H ]\fP" 18
+ Display a window containing the online
+ .I reve
+ help information. A cycle at the top of this window allows you to page
+ through this file.
+ .IP "\fBredo [ r ]\fP" 18
+ Redo the last "move". If the opponent is the computer, then two "moves" are
+ redone. A "move" is considered to be all consecutive moves by the opponent.
+ To redo a move, you must have undone a move.
+ .IP "\fBprops [ p ]\fP" 18
+ Display a property sheet containing choices and toggles which will
+ alter various \fIreve\fP properties.
  .IP "\fBsave [ S ]\fP" 18
  Save the current game to file. See the entry for the \fBload\fP button
  above for details of how to enter the filename.
***************
*** 122,133 ****
  Let the computer suggest a good move for you. This move will be dependent
  upon the current level of difficulty set.
  .IP "\fBundo [ u ]\fP" 18
! Undo the last "move". If the opponent is the computer, the two "moves" are
  undone. A "move" is considered to be all previous consecutive moves by
  the opponent.
- .IP "\fBprops [ p ]\fP" 18
- Display a property sheet containing choices and toggles which will
- alter various \fIreve\fP properties.
  .IP "\fBquit [ q ]\fP" 18
  Exit the
  .I reve
--- 146,154 ----
  Let the computer suggest a good move for you. This move will be dependent
  upon the current level of difficulty set.
  .IP "\fBundo [ u ]\fP" 18
! Undo the last "move". If the opponent is the computer, then two "moves" are
  undone. A "move" is considered to be all previous consecutive moves by
  the opponent.
  .IP "\fBquit [ q ]\fP" 18
  Exit the
  .I reve
***************
*** 140,149 ****
  the appropriate half, to either increment or decrement the current value.
  Clicking left over the toggle item boxes, will toggle the value of that item
  on or off.
! The choice items also have keyboard equivalents which are given in brackets
! below. They must be followed by the value of the new selection you wish to
! make. The dumb tty version has the equivalent of these items displayed to the
! right of the reve board display.
  .LP
  .IP "\fBComputer plays: [ C ]\fP" 18
  A choice item which selects what color[s] the computer should play. The
--- 161,170 ----
  the appropriate half, to either increment or decrement the current value.
  Clicking left over the toggle item boxes, will toggle the value of that item
  on or off.
! The choice and toggle items also have keyboard equivalents which are given in
! brackets below. The choice items must be followed by the value of the new
! selection you wish to make. The dumb tty version has the equivalent of these
! items displayed to the right of the reve board display.
  .LP
  .IP "\fBComputer plays: [ C ]\fP" 18
  A choice item which selects what color[s] the computer should play. The
***************
*** 178,197 ****
  .LP
  Level eight is tournament level.
  .IP "\fBSet search depth: [ No keyboard equivalent ]\fP" 18
! A cyclic item which sets the maximum search depth for a computer move.
! .IP "\fBAnimate move option. [ No keyboard equivalent ]\fP" 18
  A toggle item for animating the computer move and the dragging of human pieces.
! .IP "\fBShow current best move option. [ No keyboard equivalent ]\fP" 18
  A toggle item for showing the current best move as the computer makes it's
  move.
! .IP "\fBShow last move option. [ No keyboard equivalent ]\fP" 18
  A toggle item for outlining the square containing the last move.
! .IP "\fBShow evaluation information option. [ No keyboard equivalent ]\fP" 18
  A toggle information for displaying evaluation information for each computer
  move.
! .IP "\fBNumber last move option. [ No keyboard equivalent ]\fP" 18
  A toggle item for number the last move stone.
! .IP "\fBDon't show flip option. [ No keyboard equivalent ]\fP" 18
  A toggle item to prevent the flip of the stones as a turn is completed.
  .SH OPTIONS
  .TP
--- 199,221 ----
  .LP
  Level eight is tournament level.
  .IP "\fBSet search depth: [ No keyboard equivalent ]\fP" 18
! A cyclic item which sets the maximum search depth for each and every computer
! move. By default this option is turned off, and the computer uses a clock to
! time it's moves. Depending on where in the game you are, the search depth
! usually varies by one or two plys. Turning on this option disables the clock.
! .IP "\fBAnimate move option. [ O followed by a or A ]\fP" 18
  A toggle item for animating the computer move and the dragging of human pieces.
! .IP "\fBShow current best move option. [ O followed by b or B ]\fP" 18
  A toggle item for showing the current best move as the computer makes it's
  move.
! .IP "\fBShow last move option. [ O followed by l or L ]\fP" 18
  A toggle item for outlining the square containing the last move.
! .IP "\fBShow evaluation information option. [ O followed by e or E ]\fP" 18
  A toggle information for displaying evaluation information for each computer
  move.
! .IP "\fBNumber last move option. [ O followed by n or N ]\fP" 18
  A toggle item for number the last move stone.
! .IP "\fBDon't show flip option. [ O followed by f or F ]\fP" 18
  A toggle item to prevent the flip of the stones as a turn is completed.
  .SH OPTIONS
  .TP
***************
*** 231,236 ****
--- 255,274 ----
  .I reve
  to give geometry information.
  .TP
+ .BI \-h " helpfile"
+ Specify an alternate location for the
+ .I reve
+ online help file. Normally the location of this file is compiled
+ in when the program is created, but
+ .I reve
+ will search every directory on your search path looking file a file called
+ .I reve.help.
+ .TP
+ .B \-help
+ Initially show the
+ .I reve
+ help window.
+ .TP
  .B \-i
  Invert the reve window before displaying it. For use by people who
  started their graphics environment in inverse mode. This option is
***************
*** 258,263 ****
--- 296,306 ----
  .B \-number
  Show the move number on the last stone placed.
  .TP
+ .B \-props
+ Initially show the
+ .I reve
+ property window.
+ .TP
  .B \-quick
  Play a quick game. Don't flash the stones as they are being turned.
  .TP
***************
*** 293,299 ****
  .SH RESOURCES
  On startup, the X11 and XView version of
  .I reve
! will use the following X resources:
  .TP 15
  .PD 0
  .B Resource:
--- 336,348 ----
  .SH RESOURCES
  On startup, the X11 and XView version of
  .I reve
! will use the following X resources. These resources can be placed in all the
! normal X places. You can also set a
! .I REVEDEFAULTS
! environment variable to
! point to a file containing them, or place them in a
! .I .reverc
! file in your home directory.
  .TP 15
  .PD 0
  .B Resource:
***************
*** 378,383 ****
--- 427,512 ----
  Indicates whether a quick game should be played. Stones are not flashed as
  they are placed, if this resource is set true.
  .sp
+ .TP
+ .B Resource:
+ reve.properties
+ .TP
+ .B Values:
+ True, False (False)
+ .TP
+ .B Description
+ Indicates whether the properties window is initially displayed.
+ .sp
+ .TP
+ .B Resource:
+ reve.showHelp
+ .TP
+ .B Values:
+ True, False (False)
+ .TP
+ .B Description
+ Indicates whether the online help window is initially displayed.
+ .sp
+ .TP
+ .B Resource:
+ reve.panelColor
+ .TP
+ .B Values:
+ Color name string or hexadecimal color specification string
+ .TP
+ .B Description
+ The background color of the main and property panels.
+ .sp
+ .TP
+ .B Resource:
+ reve.boardColor
+ .TP
+ .B Values:
+ Color name string or hexadecimal color specification string
+ .TP
+ .B Description
+ The color of the reve playing board.
+ .sp
+ .TP
+ .B Resource:
+ reve.boardBorderColor
+ .TP
+ .B Values:
+ Color name string or hexadecimal color specification string
+ .TP
+ .B Description
+ The border color of the reve playing board.
+ .sp
+ .TP
+ .B Resource:
+ reve.gridColor
+ .TP
+ .B Values:
+ Color name string or hexadecimal color specification string
+ .TP
+ .B Description
+ The color of the grid lines on the reve playing board.
+ .sp
+ .TP
+ .B Resource:
+ reve.textColor
+ .TP
+ .B Values:
+ Color name string or hexadecimal color specification string
+ .TP
+ .B Description
+ The color of all text panel text items.
+ .sp
+ .TP
+ .B Resource:
+ reve.itemColor
+ .TP
+ .B Values:
+ Color name string or hexadecimal color specification string
+ .TP
+ .B Description
+ The background color of the button and cycle items.
+ .sp
  .SH REVE GAMES FILE FORMAT
  .I Reve
  has the ability to load or save games. The format of the games files are:
***************
*** 405,410 ****
--- 534,541 ----
  .SH FILES
  .TP
  .B /usr/local/lib/reve.edgetable
+ .TP
+ .B ~/.reverc
  edge stability table for all possible edge combinations.
  .SH BUGS
  See the TODO file for the list of known problems.

------- reve.man.text -------
*** /tmp/da06661	Tue Dec 18 10:00:50 1990
--- reve.man.text	Sun Dec 16 02:51:25 1990
***************
*** 10,19 ****
  
  SYNOPSIS
       reve [ -animate ] [ -bestmove ] [ -black [ display ] ] [  -c
!      ] [ -d difficulty ] [ -e edgefile ] [ -g geometry ] [ -i ] [
!      -last ] [ -load gamefile ] [ -log ] [ -m  ]  [  -notes  ]  [
!      -number  ] [ -quick ] [ -v ] [ -white [ display ] ] [ -? ] [
!      -Wi ] [ -Wp x y ] [ -WP x y ]
  
  DESCRIPTION
       Reve is a version of the popular Othello game.  It  contains
--- 10,20 ----
  
  SYNOPSIS
       reve [ -animate ] [ -bestmove ] [ -black [ display ] ] [  -c
!      ]  [  -d  difficulty  ] [ -e edgefile ] [ -g geometry ] [ -h
!      helpfile ] [ -help ] [ -i ] [ -last ] [ -load gamefile  ]  [
!      -log ] [ -m ] [ -notes ] [ -number ] [ -props ] [ -quick ] [
!      -v ] [ -white [ display ] ] [ -? ] [ -Wi ] [ -Wp x y ] [ -WP
!      x y ]
  
  DESCRIPTION
       Reve is a version of the popular Othello game.  It  contains
***************
*** 51,66 ****
       indication of their keyboard equivalents.  With  the  cyclic
       selections,  clicking  over  the left half of the cycle item
       increments the selection, and clicking over the  right  half
!      of the cycle item decrements the selection.
  
       By default, a human will play black, and the  computer  will
       play  white.  If  you  want a human vs human startup or some
-      other combination, then you should use the appropriate  com-
-      mand line options (see below).
  
  
  
! Sun Release 4.1   Last change: 29 November 1990                 1
  
  
  
--- 52,66 ----
       indication of their keyboard equivalents.  With  the  cyclic
       selections,  clicking  over  the left half of the cycle item
       increments the selection, and clicking over the  right  half
!      of  the  cycle item decrements the selection. Control-l is a
!      keyboard accelerator for redrawing the reve windows.
  
       By default, a human will play black, and the  computer  will
       play  white.  If  you  want a human vs human startup or some
  
  
  
! Sun Release 4.1   Last change: 15 December 1990                 1
  
  
  
***************
*** 71,79 ****
  
  
  
  REVE BUTTONS
!      With the graphics versions, there are eight buttons that are
!      normally  displayed  at  the top of the Reve window. Each of
       these buttons, has a keyboard equivalent which is  given  in
       brackets below.
  
--- 71,82 ----
  
  
  
+      other combination, then you should use the appropriate  com-
+      mand line options (see below).
+ 
  REVE BUTTONS
!      With the graphics versions, there are ten buttons  that  are
!      normally  displayed  at  the top of the reve window. Each of
       these buttons, has a keyboard equivalent which is  given  in
       brackets below.
  
***************
*** 99,104 ****
--- 102,122 ----
  
       new game [ n ]    Start a new game of reve
  
+      help [ H ]        Display a  window  containing  the  online
+                        reve  help information. A cycle at the top
+                        of this window allows you to page  through
+                        this file.
+ 
+      redo [ r ]        Redo the last "move". If the  opponent  is
+                        the computer, then two "moves" are redone.
+                        A "move" is considered to be all  consecu-
+                        tive  moves  by  the  opponent.  To redo a
+                        move, you must have undone a move.
+ 
+      props [ p ]       Display  a   property   sheet   containing
+                        choices and toggles which will alter vari-
+                        ous reve properties.
+ 
       save [ S ]        Save the current game  to  file.  See  the
                         entry   for  the  load  button  above  for
                         details of how to enter the filename.
***************
*** 105,151 ****
  
       suggest [ s ]     Let the computer suggest a good  move  for
                         you.  This move will be dependent upon the
-                        current level of difficulty set.
  
-      undo [ u ]        Undo the last "move". If the  opponent  is
-                        the  computer, the two "moves" are undone.
-                        A "move" is considered to be all  previous
-                        consecutive moves by the opponent.
  
-      props [ p ]       Display  a   property   sheet   containing
-                        choices and toggles which will alter vari-
-                        ous reve properties.
  
!      quit [ q ]        Exit the reve program.
  
- REVE PROPERTY SHEET SELECTIONS
-      With the graphical versions, there is a property sheet  win-
-      dow  which  can  be  displayed.  The  property sheet has two
-      choice items, one cyclic item, and six toggle  items.  Click
-      with the left mouse button over the option you want from the
  
  
  
- Sun Release 4.1   Last change: 29 November 1990                 2
  
  
  
  
  
  
! REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
! 
       choice items. With the cyclic items,  click  with  the  left
       mouse  button over the appropriate half, to either increment
       or decrement the current value.  Clicking left over the tog-
       gle  item  boxes,  will  toggle the value of that item on or
!      off.  The choice items also have keyboard equivalents  which
!      are  given  in  brackets below. They must be followed by the
!      value of the new selection you wish to make.  The  dumb  tty
!      version  has  the equivalent of these items displayed to the
!      right of the reve board display.
  
       Computer plays: [ C ]
                         A choice item which selects what  color[s]
--- 123,166 ----
  
       suggest [ s ]     Let the computer suggest a good  move  for
                         you.  This move will be dependent upon the
  
  
  
! Sun Release 4.1   Last change: 15 December 1990                 2
  
  
  
  
  
  
+ REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
+                        current level of difficulty set.
  
!      undo [ u ]        Undo the last "move". If the  opponent  is
!                        the computer, then two "moves" are undone.
!                        A "move" is considered to be all  previous
!                        consecutive moves by the opponent.
  
+      quit [ q ]        Exit the reve program.
  
! REVE PROPERTY SHEET SELECTIONS
!      With the graphical versions, there is a property sheet  win-
!      dow  which  can  be  displayed.  The  property sheet has two
!      choice items, one cyclic item, and six toggle  items.  Click
!      with the left mouse button over the option you want from the
       choice items. With the cyclic items,  click  with  the  left
       mouse  button over the appropriate half, to either increment
       or decrement the current value.  Clicking left over the tog-
       gle  item  boxes,  will  toggle the value of that item on or
!      off.   The  choice  and  toggle  items  also  have  keyboard
!      equivalents  which  are  given in brackets below. The choice
!      items must be followed by the value of the new selection you
!      wish  to  make.  The  dumb tty version has the equivalent of
!      these items  displayed  to  the  right  of  the  reve  board
!      display.
  
       Computer plays: [ C ]
                         A choice item which selects what  color[s]
***************
*** 174,222 ****
            6         15 minutes.
            7         20 minutes.
            8         30 minutes.
-           9         60 minutes.
  
-      Level eight is tournament level.
  
-      Set search depth: [ No keyboard equivalent ]
-                        A  cyclic  item  which  sets  the  maximum
-                        search depth for a computer move.
  
!      Animate move option. [ No keyboard equivalent ]
!                        A toggle item for animating  the  computer
!                        move and the dragging of human pieces.
  
-      Show current best move option. [ No keyboard equivalent ]
-                        A toggle item for showing the current best
-                        move as the computer makes it's move.
  
  
  
- Sun Release 4.1   Last change: 29 November 1990                 3
  
  
  
  
  
  
! REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
!      Show last move option. [ No keyboard equivalent ]
                         A toggle item  for  outlining  the  square
                         containing the last move.
  
!      Show evaluation information option. [ No keyboard equivalent ]
!                        A   toggle   information   for  displaying
!                        evaluation information for  each  computer
                         move.
  
!      Number last move option. [ No keyboard equivalent ]
                         A toggle item for  number  the  last  move
                         stone.
  
!      Don't show flip option. [ No keyboard equivalent ]
                         A toggle item to prevent the flip  of  the
                         stones as a turn is completed.
  
--- 189,244 ----
            6         15 minutes.
            7         20 minutes.
            8         30 minutes.
  
  
  
! Sun Release 4.1   Last change: 15 December 1990                 3
  
  
  
  
  
  
+ REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
+           9         60 minutes.
  
!      Level eight is tournament level.
  
+      Set search depth: [ No keyboard equivalent ]
+                        A  cyclic  item  which  sets  the  maximum
+                        search  depth  for each and every computer
+                        move. By default  this  option  is  turned
+                        off, and the computer uses a clock to time
+                        it's moves. Depending on where in the game
+                        you  are,  the search depth usually varies
+                        by one or two plys. Turning on this option
+                        disables the clock.
  
+      Animate move option. [ O followed by a or A ]
+                        A toggle item for animating  the  computer
+                        move and the dragging of human pieces.
  
!      Show current best move option. [ O followed by b or B ]
!                        A toggle item for showing the current best
!                        move as the computer makes it's move.
! 
!      Show last move option. [ O followed by l or L ]
                         A toggle item  for  outlining  the  square
                         containing the last move.
  
!      Show evaluation information option. [ O followed by e or E ]
!                        A  toggle   information   for   displaying
!                        evaluation  information  for each computer
                         move.
  
!      Number last move option. [ O followed by n or N ]
                         A toggle item for  number  the  last  move
                         stone.
  
!      Don't show flip option. [ O followed by f or F ]
                         A toggle item to prevent the flip  of  the
                         stones as a turn is completed.
  
***************
*** 233,238 ****
--- 255,274 ----
       -black [ display ]
            Black will be played by a human. With the  X11  variant
            of  reve  it  is  possible  to give an optional display
+ 
+ 
+ 
+ Sun Release 4.1   Last change: 15 December 1990                 4
+ 
+ 
+ 
+ 
+ 
+ 
+ REVE(6)                  GAMES AND DEMOS                  REVE(6)
+ 
+ 
+ 
            value.
  
       -c   The computer will play. Presence or absence of  -b  and
***************
*** 254,274 ****
            Used with the X11 variant  of  reve  to  give  geometry
            information.
  
!      -i   Invert the reve window before displaying it. For use by
  
  
! 
! Sun Release 4.1   Last change: 29 November 1990                 4
! 
! 
! 
! 
! 
! 
! REVE(6)                  GAMES AND DEMOS                  REVE(6)
! 
! 
! 
            people   who  started  their  graphics  environment  in
            inverse mode. This option is currently only implemented
            for the SunView version.
--- 290,306 ----
            Used with the X11 variant  of  reve  to  give  geometry
            information.
  
!      -h helpfile
!           Specify an alternate location for the reve online  help
!           file. Normally the location of this file is compiled in
!           when the program is created, but reve will search every
!           directory  on  your  search  path  looking  file a file
!           called reve.help.
  
+      -help
+           Initially show the reve help window.
  
!      -i   Invert the reve window before displaying it. For use by
            people   who  started  their  graphics  environment  in
            inverse mode. This option is currently only implemented
            for the SunView version.
***************
*** 289,299 ****
--- 321,348 ----
       -m   Always display in monochrome, even on a color screen.
  
       -notes
+ 
+ 
+ 
+ Sun Release 4.1   Last change: 15 December 1990                 5
+ 
+ 
+ 
+ 
+ 
+ 
+ REVE(6)                  GAMES AND DEMOS                  REVE(6)
+ 
+ 
+ 
            Display computer notes.
  
       -number
            Show the move number on the last stone placed.
  
+      -props
+           Initially show the reve property window.
+ 
       -quick
            Play a quick game. Don't flash the stones as  they  are
            being turned.
***************
*** 321,354 ****
  
  RESOURCES
       On startup, the X11 and XView version of reve will  use  the
  
  
  
! Sun Release 4.1   Last change: 29 November 1990                 5
  
  
  
  
  
  
- REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
!      following X resources:
  
-      Resource:      reve.animate
-      Values:        True, False (False)
-      Description    Indicates whether various  animation  effects
-                     are shown.
  
-      Resource:      reve.bestmove
-      Values:        True, False (False)
-      Description    Indicates whether  to  continually  show  the
-                     best  move  so far, as the computer is making
-                     it's move.
  
-      Resource:      reve.difficulty
       Values:        Difficulty value (numeric)
       Description    The computer difficulty level.
  
--- 370,406 ----
  
  RESOURCES
       On startup, the X11 and XView version of reve will  use  the
+      following  X resources. These resources can be placed in all
+      the normal  X  places.  You  can  also  set  a  REVEDEFAULTS
+      environment  variable to point to a file containing them, or
+      place them in a .reverc file in your home directory.
  
+      Resource:      reve.animate
+      Values:        True, False (False)
+      Description    Indicates whether various  animation  effects
+                     are shown.
  
+      Resource:      reve.bestmove
+      Values:        True, False (False)
+      Description    Indicates whether  to  continually  show  the
+                     best  move  so far, as the computer is making
+                     it's move.
  
!      Resource:      reve.difficulty
  
  
  
+ Sun Release 4.1   Last change: 15 December 1990                 6
  
  
  
  
  
  
! REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
       Values:        Difficulty value (numeric)
       Description    The computer difficulty level.
  
***************
*** 377,406 ****
                      played.  Stones  are  not flashed as they are
                      placed, if this resource is set true.
  
! REVE GAMES FILE FORMAT
!      Reve has the ability to load or save games.  The  format  of
!      the games files are:
!           1,   <C-4>     -    [ remarks field ]
!           2,   -    <E-3>     [ remarks field ]
!      There is one move per line. Lines starting with  a  '#'  and
!      blank lines are ignored. The first field of each line is the
!      move number. This will be present before the  comma.  It  is
!      used  as  a  consistency check. Next are the black and white
!      fields. If the '<' character is present  before  the  white.
  
  
  
! Sun Release 4.1   Last change: 29 November 1990                 6
  
  
  
  
  
  
  REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
       The  three  characters between the '<' and '>' are the move,
       and give the column and row. The column  letter  can  be  in
       either lower or upper case.
--- 429,501 ----
                      played.  Stones  are  not flashed as they are
                      placed, if this resource is set true.
  
!      Resource:      reve.properties
!      Values:        True, False (False)
!      Description    Indicates whether the  properties  window  is
!                     initially displayed.
  
+      Resource:      reve.showHelp
+      Values:        True, False (False)
+      Description    Indicates whether the online help  window  is
+                     initially displayed.
  
+      Resource:      reve.panelColor
+      Values:        Color  name  string  or   hexadecimal   color
+                     specification string
+      Description    The background color of the main and property
+                     panels.
  
!      Resource:      reve.boardColor
!      Values:        Color  name  string  or   hexadecimal   color
!                     specification string
!      Description    The color of the reve playing board.
  
+      Resource:      reve.boardBorderColor
+      Values:        Color  name  string  or   hexadecimal   color
+                     specification string
  
  
  
+ Sun Release 4.1   Last change: 15 December 1990                 7
  
  
+ 
+ 
+ 
+ 
  REVE(6)                  GAMES AND DEMOS                  REVE(6)
  
  
  
+      Description    The border color of the reve playing board.
+ 
+      Resource:      reve.gridColor
+      Values:        Color  name  string  or   hexadecimal   color
+                     specification string
+      Description    The color of the grid lines on the reve play-
+                     ing board.
+ 
+      Resource:      reve.textColor
+      Values:        Color  name  string  or   hexadecimal   color
+                     specification string
+      Description    The color of all text panel text items.
+ 
+      Resource:      reve.itemColor
+      Values:        Color  name  string  or   hexadecimal   color
+                     specification string
+      Description    The background color of the button and  cycle
+                     items.
+ 
+ REVE GAMES FILE FORMAT
+      Reve has the ability to load or save games.  The  format  of
+      the games files are:
+           1,   <C-4>     -    [ remarks field ]
+           2,   -    <E-3>     [ remarks field ]
+      There is one move per line. Lines starting with  a  '#'  and
+      blank lines are ignored. The first field of each line is the
+      move number. This will be present before the  comma.  It  is
+      used  as  a  consistency check. Next are the black and white
+      fields. If the '<' character is present  before  the  white.
       The  three  characters between the '<' and '>' are the move,
       and give the column and row. The column  letter  can  be  in
       either lower or upper case.
***************
*** 413,418 ****
--- 508,514 ----
       file, the board is updated.
  FILES
       /usr/local/lib/reve.edgetable
+      ~/.reverc
            edge stability table for  all  possible  edge  combina-
            tions.
  BUGS
***************
*** 426,462 ****
  
  
  
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! Sun Release 4.1   Last change: 29 November 1990                 7
  
  
  
--- 522,528 ----
  
  
  
! Sun Release 4.1   Last change: 15 December 1990                 8
  
  
  

richb@sunaus.oz (Rich Burridge) (12/18/90)

------CUT HERE------patch 4 - part 2------CUT HERE------

------- sunview.c -------
*** /tmp/da06711	Tue Dec 18 10:04:12 1990
--- sunview.c	Sat Dec 15 19:14:12 1990
***************
*** 49,54 ****
--- 49,55 ----
  #define  WINDOW_SET          (void) window_set
  
  #define  NORMALFONT          "/usr/lib/fonts/fixedwidthfonts/screen.r.12"
+ #define  HELPFONT            "/usr/lib/fonts/fixedwidthfonts/screen.r.10"
  #define  BOLDFONT            "/usr/lib/fonts/fixedwidthfonts/screen.b.12"
  
  mpr_static(button_stencil_pr, 64, 64, 1, button_stencil_image) ;
***************
*** 68,81 ****
  mpr_static(hglass_pr,         16, 16, 1, hglass_image) ;
  mpr_static(nocur_pr,          16, 16, 1, nocur_image) ;
  
! Canvas canvas, pcanvas ;
  Cursor cursor[MAXCURSORS] ;
  Event *cur_event ;
! Frame frame, pframe ;
  Icon reve_icon ;
  Pixfont *font[MAXFONTS] ;
  Pixrect *images[MAXIMAGES] ;
! Pixwin *cpw, *ppw ;
  
  void pw_batch() ;
  int opvals[3] ;         /* Pixrect rasterop values. */
--- 69,82 ----
  mpr_static(hglass_pr,         16, 16, 1, hglass_image) ;
  mpr_static(nocur_pr,          16, 16, 1, nocur_image) ;
  
! Canvas canvas, hcanvas, pcanvas ;
  Cursor cursor[MAXCURSORS] ;
  Event *cur_event ;
! Frame frame, hframe, pframe ;
  Icon reve_icon ;
  Pixfont *font[MAXFONTS] ;
  Pixrect *images[MAXIMAGES] ;
! Pixwin *cpw, *hpw, *ppw ;
  
  void pw_batch() ;
  int opvals[3] ;         /* Pixrect rasterop values. */
***************
*** 101,106 ****
--- 102,108 ----
  Event *event ;
  {
         if (c == canvas)  curwin = W_MAIN ;
+   else if (c == hcanvas) curwin = W_HELP ;
    else if (c == pcanvas) curwin = W_PROPS ;
  
    cur_event = event ;
***************
*** 109,126 ****
  
  
  void
- close_frame(wtype)        /* Iconise reve window. */
- enum win_type wtype ;
- {
-   Frame f ;
- 
-   if (wtype == W_MAIN) f = frame ;
-   else                 f = pframe ;
-   WINDOW_SET(f, FRAME_CLOSED, TRUE, 0) ;
- }
- 
- 
- void
  color_area(wtype, x, y, width, height, color)
  enum win_type wtype ;
  int x, y, width, height, color ;
--- 111,116 ----
***************
*** 127,133 ****
  {
    Pixwin *pw ;
  
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
    PW_WRITEBACKGROUND(pw, x, y, width, height, PIX_SRC | PIX_COLOR(color)) ;
  }
  
--- 117,125 ----
  {
    Pixwin *pw ;
  
!        if (wtype == W_MAIN)  pw = cpw ;
!   else if (wtype == W_HELP)  pw = hpw ;
!   else if (wtype == W_PROPS) pw = ppw ;
    PW_WRITEBACKGROUND(pw, x, y, width, height, PIX_SRC | PIX_COLOR(color)) ;
  }
  
***************
*** 147,153 ****
  {                        
    Pixwin *pw ;
  
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
    PW_ROP(pw, x, y, width, height, PIX_SRC | PIX_DST,
           images[(int) image], 0, 0) ;
  }
--- 139,147 ----
  {                        
    Pixwin *pw ;
  
!        if (wtype == W_MAIN)  pw = cpw ;
!   else if (wtype == W_HELP)  pw = hpw ;
!   else if (wtype == W_PROPS) pw = ppw ;
    PW_ROP(pw, x, y, width, height, PIX_SRC | PIX_DST,
           images[(int) image], 0, 0) ;
  }
***************
*** 162,168 ****
    Pixwin *pw ;
    int rop ;
  
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
    rop = opvals[(int) op] ;
    if (!iscolor[(int) cur_dpyno] && color == C_WHITE)
      rop = opvals[(int) RCLR] ;
--- 156,164 ----
    Pixwin *pw ;
    int rop ;
  
!        if (wtype == W_MAIN)  pw = cpw ;
!   else if (wtype == W_HELP)  pw = hpw ;
!   else if (wtype == W_PROPS) pw = ppw ;
    rop = opvals[(int) op] ;
    if (!iscolor[(int) cur_dpyno] && color == C_WHITE)
      rop = opvals[(int) RCLR] ;
***************
*** 180,186 ****
    Pixwin *pw ;
    int rop ;
  
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
    rop = opvals[(int) op] | PIX_COLOR(color) ;
    PW_STENCIL(pw, x, y, width, height, rop,
               images[(int) stencil], 0, 0, images[(int) image], 0, 0) ;
--- 176,184 ----
    Pixwin *pw ;
    int rop ;
  
!        if (wtype == W_MAIN)  pw = cpw ;
!   else if (wtype == W_HELP)  pw = hpw ;
!   else if (wtype == W_PROPS) pw = ppw ;
    rop = opvals[(int) op] | PIX_COLOR(color) ;
    PW_STENCIL(pw, x, y, width, height, rop,
               images[(int) stencil], 0, 0, images[(int) image], 0, 0) ;
***************
*** 196,202 ****
  {
    Pixwin *pw ;
  
!   pw = (wtype == W_MAIN) ? cpw : ppw ;
    PW_TTEXT(pw, x, y, PIX_SRC | PIX_COLOR(color), font[(int) ftype], str) ;
  }
  
--- 194,202 ----
  {
    Pixwin *pw ;
  
!        if (wtype == W_MAIN)  pw = cpw ;
!   else if (wtype == W_HELP)  pw = hpw ;
!   else if (wtype == W_PROPS) pw = ppw ;
    PW_TTEXT(pw, x, y, PIX_SRC | PIX_COLOR(color), font[(int) ftype], str) ;
  }
  
***************
*** 218,223 ****
--- 218,224 ----
  }
  
  
+ /*ARGSUSED*/
  char *
  get_resource(rtype)      /* Null routine (currently only X11 and XView). */
  enum res_type rtype ;
***************
*** 241,252 ****
--- 242,256 ----
  init_fonts()         /* Open the normal and bold fonts. */
  {
    font[(int) BFONT] = get_font(BOLDFONT) ;
+   font[(int) HFONT] = get_font(HELPFONT) ;
    font[(int) NFONT] = get_font(NORMALFONT) ;
    bfont_height = font[(int) BFONT]->pf_defaultsize.y ;
+   hfont_height = font[(int) HFONT]->pf_defaultsize.y ;
    nfont_height = font[(int) NFONT]->pf_defaultsize.y ;
  }
  
  
+ /*ARGSUSED*/
  init_graphics(argc, argv)
  int *argc ;
  char *argv[] ;
***************
*** 272,292 ****
  {
    Pixwin *frame_pw ;
    char colorname[CMS_NAMESIZE] ;
-   u_char red[OTH_COLORSIZE], green[OTH_COLORSIZE], blue[OTH_COLORSIZE] ;
  
    iscolor[(int) cur_dpyno] = (cpw->pw_pixrect->pr_depth == 8) ? 1 : 0 ;
!   SPRINTF(colorname, "%s%D", OTH_COLOR, getpid()) ;
    PW_SETCMSNAME(cpw, colorname) ;
  
!   oth_colorsetup(red, green, blue) ;
!   PW_PUTCOLORMAP(cpw, 0, OTH_COLORSIZE, red, green, blue) ;
!   if (inv_video) PW_REVERSEVIDEO(cpw, 0, OTH_COLORSIZE) ;
  
    if (iscolor[(int) cur_dpyno])
      {
        frame_pw = (Pixwin *) window_get(frame, WIN_PIXWIN) ;
        PW_SETCMSNAME(frame_pw, colorname) ;
!       PW_PUTCOLORMAP(frame_pw, 0, OTH_COLORSIZE, red, green, blue) ;
      }
  }
  
--- 276,294 ----
  {
    Pixwin *frame_pw ;
    char colorname[CMS_NAMESIZE] ;
  
    iscolor[(int) cur_dpyno] = (cpw->pw_pixrect->pr_depth == 8) ? 1 : 0 ;
!   SPRINTF(colorname, "%s%D", REVE_COLOR, getpid()) ;
    PW_SETCMSNAME(cpw, colorname) ;
  
!   PW_PUTCOLORMAP(cpw, 0, REVE_COLORSIZE, rcols, gcols, bcols) ;
!   if (inv_video) PW_REVERSEVIDEO(cpw, 0, REVE_COLORSIZE) ;
  
    if (iscolor[(int) cur_dpyno])
      {
        frame_pw = (Pixwin *) window_get(frame, WIN_PIXWIN) ;
        PW_SETCMSNAME(frame_pw, colorname) ;
!       PW_PUTCOLORMAP(frame_pw, 0, REVE_COLORSIZE, rcols, gcols, bcols) ;
      }
  }
  
***************
*** 315,321 ****
  void
  make_canvas()               /* Create canvas for game board. */
  {
!   canvas = window_create(frame, CANVAS,
                           CANVAS_RETAINED, FALSE,
                           WIN_HEIGHT,      TOTAL_HEIGHT,
                           WIN_WIDTH,       TOTAL_WIDTH,
--- 317,323 ----
  void
  make_canvas()               /* Create canvas for game board. */
  {
!   canvas = window_create(frame,           CANVAS,
                           CANVAS_RETAINED, FALSE,
                           WIN_HEIGHT,      TOTAL_HEIGHT,
                           WIN_WIDTH,       TOTAL_WIDTH,
***************
*** 331,337 ****
                           0) ;
    cpw = (Pixwin *) window_get(canvas, CANVAS_PIXWIN) ;
  
!   pcanvas = window_create(pframe, CANVAS,
                            CANVAS_RETAINED, FALSE,
                            WIN_HEIGHT,      PROPS_HEIGHT,
                            WIN_WIDTH,       PROPS_WIDTH,
--- 333,339 ----
                           0) ;
    cpw = (Pixwin *) window_get(canvas, CANVAS_PIXWIN) ;
  
!   pcanvas = window_create(pframe,          CANVAS,
                            CANVAS_RETAINED, FALSE,
                            WIN_HEIGHT,      PROPS_HEIGHT,
                            WIN_WIDTH,       PROPS_WIDTH,
***************
*** 395,415 ****
  
  
  void
! make_icon()
  {
!   reve_icon = icon_create(ICON_IMAGE, &icon_pr, 0) ;
  }
  
  
  void
! open_frame(wtype)
! enum win_type wtype ;
  {
!   Frame f ;
! 
!   if (wtype == W_MAIN) f = frame ;
!   else                 f = pframe ;
!   WINDOW_SET(f, WIN_SHOW, TRUE, 0) ;
  }
  
  
--- 397,440 ----
  
  
  void
! make_help_window(argc, argv)
! int argc ;
! char *argv[] ;
  {
!   int fontwidth ;
! 
!   hframe = window_create((Window) NULL,     FRAME,
!                           FRAME_ICON,       reve_icon,
!                           FRAME_LABEL,      "reve help",
!                           FRAME_NO_CONFIRM, TRUE,
!                           WIN_ERROR_MSG,    "Can't create window.",
!                           FRAME_ARGS,       argc, argv,
!                           0) ;
! 
!   fontwidth = font[(int) HFONT]->pf_defaultsize.x ;
!   help_height = ((hfont_height + 1) * HELP_ROWS) + (4 * CGAP) + CHEIGHT ;
!   help_width  = (fontwidth * HELP_COLS) + (2 * CGAP) ;
! 
!   hcanvas = window_create(hframe, CANVAS,
!                           CANVAS_RETAINED, FALSE,
!                           WIN_HEIGHT,      help_height,
!                           WIN_WIDTH,       help_width,
!                           WIN_CONSUME_PICK_EVENTS,
!                             MS_LEFT, MS_MIDDLE,
!                             0,
!                           WIN_CONSUME_KBD_EVENTS,
!                             KBD_USE, KBD_DONE, WIN_ASCII_EVENTS, WIN_UP_EVENTS,
!                             0,
!                           WIN_EVENT_PROC, canvas_proc,
!                           0) ;
!   hpw = (Pixwin *) window_get(hcanvas, CANVAS_PIXWIN) ;
  }
  
  
  void
! make_icon()
  {
!   reve_icon = icon_create(ICON_IMAGE, &icon_pr, 0) ;
  }
  
  
***************
*** 446,452 ****
      nextc = MOUSE_MOVING ;
    else if (id == WIN_REPAINT)
      {
!            if (curwin == W_MAIN) nextc = FRAME_REPAINT ;
        else if (curwin == W_PROPS) nextc = PROPS_REPAINT ;
      }
  }
--- 471,478 ----
      nextc = MOUSE_MOVING ;
    else if (id == WIN_REPAINT)
      {
!            if (curwin == W_MAIN)  nextc = FRAME_REPAINT ;
!       else if (curwin == W_HELP)  nextc = HELP_REPAINT ;
        else if (curwin == W_PROPS) nextc = PROPS_REPAINT ;
      }
  }
***************
*** 460,465 ****
--- 486,504 ----
  }
  
  
+ void
+ set_frame(wtype, showing)
+ enum win_type wtype ;
+ int showing ;
+ {
+   Frame f ;
+ 
+        if (wtype == W_HELP)  f = hframe ;
+   else if (wtype == W_PROPS) f = pframe ;
+   WINDOW_SET(f, WIN_SHOW, showing, 0) ;
+ }
+ 
+ 
  /*ARGSUSED*/
  void
  start_tool(dtype)      /* Display window and start the notifier. */
***************
*** 472,477 ****
--- 511,517 ----
        WINDOW_SET(frame, FRAME_ICON, reve_icon, 0) ;
      }
    window_fit(frame) ;
+   window_fit(hframe) ;
    window_fit(pframe) ;
    window_main_loop(frame) ;
  }

------- tty.c -------
*** /tmp/da06714	Tue Dec 18 10:04:13 1990
--- tty.c	Sat Dec 15 19:42:20 1990
***************
*** 65,74 ****
        {  1,  1,  43,  32, },      /* Load */
        { 11,  1, 117,  32, },      /* Moves? */
        { 22,  1, 191,  32, },      /* New game */
!       { 33,  1, 265,  32, },      /* Save */
!       { 44,  1, 339,  32, },      /* Suggest */
!       { 55,  1, 413,  32, },      /* Undo */
!       { -1, -1,  43,  74, },      /* Props  (not displayed). */
        { -1, -1, 339,  74, },      /* Cancel (not displayed). */
        { -1, -1, 413,  74, },      /* Quit   (not displayed). */
        { 60,  5,  15, 111, },      /* Black: */
--- 65,78 ----
        {  1,  1,  43,  32, },      /* Load */
        { 11,  1, 117,  32, },      /* Moves? */
        { 22,  1, 191,  32, },      /* New game */
!       { -1, -1, 265,  32, },      /* Help   (not displayed). */
!       { -1, -1, 339,  32, },      /* Redo   (not displayed). */
!       { -1, -1, 413,  32, },      /* Props  (not displayed). */
!       { 33,  1,  43,  74, },      /* Save */
!       { 44,  1, 117,  74, },      /* Suggest */
!       { -1, -1, 191,  74, },      /* Edit   (not displayed). */
!       { -1, -1, 265,  74, },      /* Stop   (not displayed). */
!       { 55,  1, 339,  74, },      /* Undo */
        { -1, -1, 339,  74, },      /* Cancel (not displayed). */
        { -1, -1, 413,  74, },      /* Quit   (not displayed). */
        { 60,  5,  15, 111, },      /* Black: */
***************
*** 86,91 ****
--- 90,96 ----
        { -1, -1,  -1,  -1, },      /* Show evaluation option. */
        { -1, -1,  -1,  -1, },      /* Number move option. */
        { -1, -1,  -1,  -1, },      /* Quick game option. */
+       { -1, -1,  -1,  -1, },      /* Help window page cycle.*/
  } ;
  
  struct other_info {   /* Information needed to place other text values. */
***************
*** 97,106 ****
        { -1, -1, },       /* Load     (ignored). */
        { -1, -1, },       /* Moves?   (ignored). */
        { -1, -1, },       /* New game (ignored). */
        { -1, -1, },       /* Save     (ignored). */
        { -1, -1, },       /* Suggest  (ignored). */
        { -1, -1, },       /* Undo     (ignored). */
-       { -1, -1, },       /* Done     (ignored). */
        { -1, -1, },       /* Cancel   (ignored). */
        { -1, -1, },       /* Quit     (ignored). */
        { 38,  5, },       /* Black: */
--- 102,115 ----
        { -1, -1, },       /* Load     (ignored). */
        { -1, -1, },       /* Moves?   (ignored). */
        { -1, -1, },       /* New game (ignored). */
+       { -1, -1, },       /* Help     (ignored). */
+       { -1, -1, },       /* Redo     (ignored). */
+       { -1, -1, },       /* Props    (ignored). */
        { -1, -1, },       /* Save     (ignored). */
        { -1, -1, },       /* Suggest  (ignored). */
+       { -1, -1, },       /* Edit     (ignored). */
+       { -1, -1, },       /* Stop     (ignored). */
        { -1, -1, },       /* Undo     (ignored). */
        { -1, -1, },       /* Cancel   (ignored). */
        { -1, -1, },       /* Quit     (ignored). */
        { 38,  5, },       /* Black: */
***************
*** 118,123 ****
--- 127,133 ----
        { 60, 11, },       /* Show evaluation option. */
        { -1, -1, },       /* Number move option. */
        { -1, -1, },       /* Quick game option. */
+       { -1, -1, },       /* Help window page cycle. */
  } ;
  
  
***************
*** 135,145 ****
  {}
  
  
- void
- close_frame()           /* This option does nothing with termcap. */
- {}
- 
- 
  /*ARGSUSED*/
  void
  color_area(wtype, x, y, width, height, color)
--- 145,150 ----
***************
*** 532,550 ****
  }
  
  
- void
- make_icon()             /* Null routine - no icon in termcap version. */
- {}
- 
- 
  /*ARGSUSED*/
  void
! open_frame(wtype)
! enum win_type wtype ;
  {
  }
  
  
  static void
  outc(c)                 /* Output the next character to the screen. */
  register int c ;
--- 537,556 ----
  }
  
  
  /*ARGSUSED*/
  void
! make_help_window(argc, argv)
! int argc ;
! char *argv[] ;
  {
  }
  
  
+ void
+ make_icon()             /* Null routine - no icon in termcap version. */
+ {}
+ 
+ 
  static void
  outc(c)                 /* Output the next character to the screen. */
  register int c ;
***************
*** 575,580 ****
--- 581,594 ----
  void
  set_cursor(cursor)        /* No cursors in termcap version. */
  enum curtype cursor ;
+ {}
+ 
+ 
+ /*ARGSUSED*/
+ void
+ set_frame(wtype, showing)
+ enum win_type wtype ;
+ int showing ;
  {}
  
  

------- x11.c -------
*** /tmp/da06717	Tue Dec 18 10:04:15 1990
--- x11.c	Mon Dec 17 10:26:26 1990
***************
*** 41,46 ****
--- 41,47 ----
  
  #define  BOLDFONT    "lucidasanstypewriter-bold-12"
  #define  DEFFONT     "fixed"
+ #define  HELPFONT    "lucidasanstypewriter-10"
  #define  NORMALFONT  "lucidasanstypewriter-12"
  
  #define  FRAME_MASK  (ButtonPressMask | ButtonReleaseMask | ExposureMask    | \
***************
*** 63,75 ****
  Pixmap images[MAXIMAGES] ;
  Pixmap no_pixmap ;
  Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
! Window frame[MAXDPY], pframe[MAXDPY], root[MAXDPY] ;
  XClassHint class_hint = { "reve", "Reve" } ;
  XColor BGcolor, FGcolor ;
  XEvent event ;
  XFontStruct *font[MAXFONTS] ;
  XrmDatabase reve_DB[MAXDPY] ;   /* Combined resources database. */
! XSizeHints psize, size ;
  XWMHints wm_hints ;
  XGCValues gc_val ;              /* Used to setup graphics context values. */
  int gc_flags ;                  /* Used to set up graphics context flags. */
--- 64,76 ----
  Pixmap images[MAXIMAGES] ;
  Pixmap no_pixmap ;
  Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
! Window frame[MAXDPY], hframe[MAXDPY], pframe[MAXDPY], root[MAXDPY] ;
  XClassHint class_hint = { "reve", "Reve" } ;
  XColor BGcolor, FGcolor ;
  XEvent event ;
  XFontStruct *font[MAXFONTS] ;
  XrmDatabase reve_DB[MAXDPY] ;   /* Combined resources database. */
! XSizeHints size ;
  XWMHints wm_hints ;
  XGCValues gc_val ;              /* Used to setup graphics context values. */
  int gc_flags ;                  /* Used to set up graphics context flags. */
***************
*** 78,84 ****
  unsigned long backgnd[MAXDPY] ; /* Default background color. */
  unsigned long foregnd[MAXDPY] ; /* Default foreground color. */
  unsigned long gc_mask ;         /* Mask for setting graphic context values. */
! unsigned long palette[OTH_COLORSIZE] ;     /* Xlib color palette. */
  
  #ifndef NOSELECT
  #ifdef NO_43SELECT
--- 79,85 ----
  unsigned long backgnd[MAXDPY] ; /* Default background color. */
  unsigned long foregnd[MAXDPY] ; /* Default foreground color. */
  unsigned long gc_mask ;         /* Mask for setting graphic context values. */
! unsigned long palette[REVE_COLORSIZE] ;     /* Xlib color palette. */
  
  #ifndef NOSELECT
  #ifdef NO_43SELECT
***************
*** 143,172 ****
  
  
  void
- close_frame(wtype)            /* Iconise reve window. */
- enum win_type wtype ;
- {
-   int d ;
-   XEvent event ;
-   Window window ;
- 
-   d = (int) cur_dpyno ;
-   if (wtype == W_MAIN) window = frame[d] ;
-   else                 window = pframe[d] ;
- 
-   iconic = 1 ;
-   event.xclient.type = ClientMessage ;
-   event.xclient.display = dpy[d] ;
-   event.xclient.window = window ;
-   event.xclient.message_type = XInternAtom(dpy[d], "WM_CHANGE_STATE", False) ;
-   event.xclient.format = 32 ;
-   event.xclient.data.l[0] = IconicState ;
-   XSendEvent(dpy[d], DefaultRootWindow(dpy[d]), False,
-               SubstructureRedirectMask | SubstructureNotifyMask, &event) ;
- }
- 
- 
- void
  color_area(wtype, x, y, width, height, color)
  enum win_type wtype ;
  int x, y, width, height, color ;
--- 144,149 ----
***************
*** 175,181 ****
    int d ;
  
    d = (int) cur_dpyno ;
!   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
--- 152,161 ----
    int d ;
  
    d = (int) cur_dpyno ;
!        if (wtype == W_MAIN)  window = frame[d] ;
!   else if (wtype == W_HELP)  window = hframe[d] ;
!   else if (wtype == W_PROPS) window = pframe[d] ;
! 
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
***************
*** 206,212 ****
    int d ;
  
    d = (int) cur_dpyno ;
!   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    gc_mask = GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
    gc_val.stipple = images[(int) image] ;
    gc_val.ts_x_origin = x ;
--- 186,195 ----
    int d ;
  
    d = (int) cur_dpyno ;
!        if (wtype == W_MAIN)  window = frame[d] ;
!   else if (wtype == W_HELP)  window = hframe[d] ;
!   else if (wtype == W_PROPS) window = pframe[d] ;
! 
    gc_mask = GCStipple | GCTileStipXOrigin | GCTileStipYOrigin ;
    gc_val.stipple = images[(int) image] ;
    gc_val.ts_x_origin = x ;
***************
*** 226,232 ****
    int d ;
  
    d = (int) cur_dpyno ;
!   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      {
--- 209,218 ----
    int d ;
  
    d = (int) cur_dpyno ;
!        if (wtype == W_MAIN)  window = frame[d] ;
!   else if (wtype == W_HELP)  window = hframe[d] ;
!   else if (wtype == W_PROPS) window = pframe[d] ;
! 
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      {
***************
*** 250,256 ****
    int d ;
  
    d = (int) cur_dpyno ;
!   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else            gc_val.foreground = foregnd[d] ;
    gc_val.function = opvals[(int) op] ;
--- 236,245 ----
    int d ;
  
    d = (int) cur_dpyno ;
!        if (wtype == W_MAIN)  window = frame[d] ;
!   else if (wtype == W_HELP)  window = hframe[d] ;
!   else if (wtype == W_PROPS) window = pframe[d] ;
! 
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else            gc_val.foreground = foregnd[d] ;
    gc_val.function = opvals[(int) op] ;
***************
*** 279,285 ****
    int d ;
  
    d = (int) cur_dpyno ;
!   window = (wtype == W_MAIN) ? frame[d] : pframe[d] ;
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
--- 268,277 ----
    int d ;
  
    d = (int) cur_dpyno ;
!        if (wtype == W_MAIN)  window = frame[d] ;
!   else if (wtype == W_HELP)  window = hframe[d] ;
!   else if (wtype == W_PROPS) window = pframe[d] ;
! 
    if (iscolor[d]) gc_val.foreground = palette[color] ;
    else
      { 
***************
*** 377,385 ****
--- 369,380 ----
  init_fonts()             /* Open the normal and bold fonts. */
  {
    font[(int) BFONT] = get_font(BOLDFONT) ;
+   font[(int) HFONT] = get_font(HELPFONT) ;
    font[(int) NFONT] = get_font(NORMALFONT) ;
    bfont_height = font[(int) BFONT]->max_bounds.ascent +
                   font[(int) BFONT]->max_bounds.descent ;
+   hfont_height = font[(int) HFONT]->max_bounds.ascent +
+                  font[(int) HFONT]->max_bounds.descent ;
    nfont_height = font[(int) NFONT]->max_bounds.ascent +
                   font[(int) NFONT]->max_bounds.descent ;
  }
***************
*** 439,445 ****
  load_colors()     /* Create and load reve color map. */
  {
    XColor ccol ;
-   u_char red[OTH_COLORSIZE], green[OTH_COLORSIZE], blue[OTH_COLORSIZE] ;
    int d, i, numcolors ;
  
    d = (int) cur_dpyno ;
--- 434,439 ----
***************
*** 446,465 ****
    iscolor[d] = 0 ;
    if (DisplayCells(dpy[d], screen[d]) > 2)
      {
-       oth_colorsetup(red, green, blue) ;
        iscolor[d] = 1 ;
        numcolors = 0 ;
!       for (i = 0; i < OTH_COLORSIZE; i++)
          {
!           ccol.flags = DoRed | DoGreen | DoBlue ;
!           ccol.red   = (unsigned short) (red[i]   << 8) ;
!           ccol.green = (unsigned short) (green[i] << 8) ;
!           ccol.blue  = (unsigned short) (blue[i]  << 8) ;
            if (XAllocColor(dpy[d],
                DefaultColormap(dpy[d], screen[d]), &ccol) == True)
              palette[numcolors++] = ccol.pixel ;
          }
!       if (numcolors < 2)
          {
            FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
            exit(1) ;
--- 440,463 ----
    iscolor[d] = 0 ;
    if (DisplayCells(dpy[d], screen[d]) > 2)
      {
        iscolor[d] = 1 ;
        numcolors = 0 ;
!       for (i = 0; i < REVE_COLORSIZE; i++)
          {
!           if (colstr[i] == NULL ||
!               (XParseColor(dpy[d], DefaultColormap(dpy[d], screen[d]),
!                            colstr[i], &ccol) == 0))
!             {
!               ccol.flags = DoRed | DoGreen | DoBlue ;
!               ccol.red   = (unsigned short) (rcols[i] << 8) ;
!               ccol.green = (unsigned short) (gcols[i] << 8) ;
!               ccol.blue  = (unsigned short) (bcols[i] << 8) ;
!             }
            if (XAllocColor(dpy[d],
                DefaultColormap(dpy[d], screen[d]), &ccol) == True)
              palette[numcolors++] = ccol.pixel ;
          }
!       if (numcolors < REVE_COLORSIZE)
          {
            FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
            exit(1) ;
***************
*** 525,530 ****
--- 523,530 ----
   *
   *  XENVIRONMENT environment variable or, if not set, .Xdefaults-hostname
   *  file.
+  *
+  *  REVEDEFAULTS environment variable or, if not set, the ~/.reverc file.
   */
  
  void
***************
*** 570,575 ****
--- 570,587 ----
      }
    else db = XrmGetFileDatabase(ptr) ;
    XrmMergeDatabases(db, &reve_DB[d]) ;
+ 
+ /*  Finally merge in Reve defaults via REVEDEFAULTS or, if not defined, the
+  *  ~/.reverc file.
+  */
+ 
+   if ((ptr = getenv("REVEDEFAULTS")) == NULL)
+     {
+       SPRINTF(name, "%s/.reverc", home) ;
+       db = XrmGetFileDatabase(name) ;
+     }
+   else db = XrmGetFileDatabase(ptr) ;
+   XrmMergeDatabases(db, &reve_DB[d]) ;
  }
  
  
***************
*** 655,673 ****
  
  /*  Setup property window. */
  
!   psize.flags = PMinSize | PMaxSize | PPosition | PSize ;
!   psize.x = TOTAL_WIDTH + 10 ;
!   psize.y = 0 ;
!   psize.max_width = size.min_width = size.width = PROPS_WIDTH ;
!   psize.max_height = size.min_height = size.height = PROPS_HEIGHT ;
  
    pframe[d] = XCreateSimpleWindow(dpy[d], root[d],
!                                   size.x + TOTAL_WIDTH + 10, size.y,
!                                   PROPS_WIDTH, PROPS_HEIGHT,
                                    REVE_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
  
    XSetStandardProperties(dpy[d], pframe[d], "reve properties",
!                          "Props", reve_icon[d], argv, argc, &psize) ;
  
  /* Create graphics contexts. */
  
--- 667,685 ----
  
  /*  Setup property window. */
  
!   size.flags = PMinSize | PMaxSize | PPosition | PSize ;
!   size.x = TOTAL_WIDTH + 10 ;
!   size.y = 0 ;
!   size.max_width = size.min_width = size.width = PROPS_WIDTH ;
!   size.max_height = size.min_height = size.height = PROPS_HEIGHT ;
  
    pframe[d] = XCreateSimpleWindow(dpy[d], root[d],
!                                   size.x, size.y,
!                                   size.max_width, size.max_height,
                                    REVE_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
  
    XSetStandardProperties(dpy[d], pframe[d], "reve properties",
!                          "Props", reve_icon[d], argv, argc, &size) ;
  
  /* Create graphics contexts. */
  
***************
*** 682,691 ****
--- 694,733 ----
  
    stencilgc[d] = XCreateGC(dpy[d], root[d], gc_mask, &gc_val) ;
    XSetFillStyle(dpy[d], stencilgc[d], FillOpaqueStippled) ;
+   XSynchronize(dpy[d], TRUE) ;
  }
  
  
  void
+ make_help_window(argc, argv)
+ int argc ;
+ char *argv[] ;
+ {
+   int d, fontwidth ;
+ 
+   d = (int) cur_dpyno ;
+   fontwidth = font[(int) HFONT]->max_bounds.rbearing +
+               font[(int) HFONT]->min_bounds.lbearing ;
+   help_height = ((hfont_height + 1) * HELP_ROWS) + (4 * CGAP) + CHEIGHT ;
+   help_width  = (fontwidth * HELP_COLS) + (2 * CGAP) ;
+ 
+   size.flags = PMinSize | PMaxSize | PPosition | PSize ;
+   size.x = TOTAL_WIDTH + 10 ;
+   size.y = 0 ;
+   size.max_width  = size.min_width  = size.width  = help_width ;
+   size.max_height = size.min_height = size.height = help_height ;
+ 
+   hframe[d] = XCreateSimpleWindow(dpy[d], root[d],
+                                   size.x, size.y,
+                                   size.max_width, size.max_height,
+                                   REVE_BORDER_WIDTH, foregnd[d], backgnd[d]) ;
+ 
+   XSetStandardProperties(dpy[d], hframe[d], "reve help",
+                          "Help", reve_icon[d], argv, argc, &size) ;
+ }
+ 
+ 
+ void
  make_icon() {}        /* Null routine - icon created in make_frame. */
  
  
***************
*** 719,739 ****
  
  
  void
- open_frame(wtype)
- enum win_type wtype ;
- {
-   int d ;
-   Window window ;
- 
-   d = (int) cur_dpyno ;
-   if (wtype == W_MAIN) window = frame[d] ;
-   else                 window = pframe[d] ;
-   XSelectInput(dpy[0], window, FRAME_MASK) ;
-   XMapWindow(dpy[0], window) ;
- }
- 
- 
- void
  process_event()         /* Determine event type. */
  {
    XClientMessageEvent *ev ;
--- 761,766 ----
***************
*** 743,749 ****
    int d ;
  
    d = (int) cur_dpyno ; 
!        if (event.xany.window == frame[(int) cur_dpyno])  curwin = W_MAIN ;
    else if (event.xany.window == pframe[(int) cur_dpyno]) curwin = W_PROPS ;
  
    switch (event.type)
--- 770,777 ----
    int d ;
  
    d = (int) cur_dpyno ; 
!        if (event.xany.window ==  frame[(int) cur_dpyno]) curwin = W_MAIN ;
!   else if (event.xany.window == hframe[(int) cur_dpyno]) curwin = W_HELP ;
    else if (event.xany.window == pframe[(int) cur_dpyno]) curwin = W_PROPS ;
  
    switch (event.type)
***************
*** 807,812 ****
--- 835,841 ----
  {
    int d ;
    int doframe  = 0 ;
+   int dohframe = 0 ;
    int dopframe = 0 ;
  
    d = (int) cur_dpyno ;
***************
*** 814,819 ****
--- 843,850 ----
      {
        if (event->count == 0 && event->window == frame[(int) cur_dpyno])
          doframe++ ;
+       if (event->count == 0 && event->window == hframe[(int) cur_dpyno])
+         dohframe++ ;
        if (event->count == 0 && event->window == pframe[(int) cur_dpyno])
          dopframe++ ;
      }
***************
*** 820,825 ****
--- 851,857 ----
    while (XCheckMaskEvent(dpy[d], ExposureMask, (XEvent *) event)) ;
  
         if (doframe)  return(FRAME_REPAINT) ;
+   else if (dohframe) return(HELP_REPAINT) ;
    else if (dopframe) return(PROPS_REPAINT) ;
    else               return(IGNORE_EVENT) ;
  }
***************
*** 838,847 ****
  
  
  void
  start_tool(dtype)            /* Start event dispatcher and display. */
  enum disp_type dtype ;
  {
!   open_frame(W_MAIN) ;
    XSelectInput(dpy[0], pframe[0], FRAME_MASK) ;
  
    if (dtype == XTWO)
--- 870,898 ----
  
  
  void
+ set_frame(wtype, showing)
+ enum win_type wtype ;
+ int showing ;
+ {
+   Window window ;
+   int d ;
+ 
+   d = (int) cur_dpyno ;
+        if (wtype == W_HELP)  window = hframe[d] ;
+   else if (wtype == W_PROPS) window = pframe[d] ;
+ 
+   if (showing) XMapWindow(dpy[d], window) ;
+   else         XUnmapWindow(dpy[d], window) ;
+ }
+ 
+ 
+ void
  start_tool(dtype)            /* Start event dispatcher and display. */
  enum disp_type dtype ;
  {
!   XSelectInput(dpy[0], frame[0], FRAME_MASK) ;
!   XMapWindow(dpy[0], frame[0]) ;
!   XSelectInput(dpy[0], hframe[0], FRAME_MASK) ;
    XSelectInput(dpy[0], pframe[0], FRAME_MASK) ;
  
    if (dtype == XTWO)
***************
*** 848,853 ****
--- 899,905 ----
      {
        XSelectInput(dpy[1], frame[1], FRAME_MASK) ;
        XMapWindow(dpy[1], frame[1]) ;
+       XSelectInput(dpy[1], hframe[1], FRAME_MASK) ;
        XSelectInput(dpy[1], pframe[1], FRAME_MASK) ;
      }
  

------- xview.c -------
*** /tmp/da06720	Tue Dec 18 10:04:16 1990
--- xview.c	Sun Dec 16 11:57:06 1990
***************
*** 38,43 ****
--- 38,44 ----
  #include <xview/cms.h>
  #include <xview/cursor.h>
  #include <xview/svrimage.h>
+ #include <xview/textsw.h>
  #include <xview/xv_xrect.h>
  #include <X11/Xlib.h>
  #include <X11/Xresource.h>
***************
*** 46,52 ****
  
  enum gr_type gtype = GXVIEW ;          /* Graphics type. */
  
! enum popup_pos {P_BELOW, P_RIGHT } ;   /* Positions relative to main frame. */
  
  #define  CLIENT_NO          10
  #define  DEPTH_MENU_ENTRY   9
--- 47,53 ----
  
  enum gr_type gtype = GXVIEW ;          /* Graphics type. */
  
! enum popup_pos { P_BELOW, P_RIGHT } ;  /* Positions relative to main frame. */
  
  #define  CLIENT_NO          10
  #define  DEPTH_MENU_ENTRY   9
***************
*** 59,64 ****
--- 60,66 ----
  
  #define  BOLDFONT           "lucidasanstypewriter-bold-12"
  #define  DEFFONT            "fixed"
+ #define  HELPFONT           "lucidasanstypewriter-12"
  #define  NORMALFONT         "lucidasanstypewriter-12"
  
  Canvas canvas ;
***************
*** 71,76 ****
--- 73,81 ----
  
  Notify_client client = (Notify_client) CLIENT_NO ;
  
+ Frame  h_frame ;                /* Help window frame. */
+ Textsw h_textsw ;               /* Text sub-window for help file. */
+ 
  Frame ls_frame ;                /* Frame for load/save pop-up window. */
  Panel ls_panel ;                /* Panel for load/save operations. */
  Panel_item ls_button ;          /* Button to start load/save operation. */
***************
*** 111,117 ****
  unsigned long backgnd ;         /* Default background color. */
  unsigned long foregnd ;         /* Default foreground color. */
  unsigned long gc_mask ;         /* Mask for setting graphic context values. */
! unsigned long palette[OTH_COLORSIZE] ;     /* Xlib color palette. */
  
  int opvals[3] ;         /* Pixrect rasterop values. */
  int pid ;               /* Process id of the reve_proc process. */
--- 116,122 ----
  unsigned long backgnd ;         /* Default background color. */
  unsigned long foregnd ;         /* Default foreground color. */
  unsigned long gc_mask ;         /* Mask for setting graphic context values. */
! unsigned long palette[REVE_COLORSIZE] ;     /* Xlib color palette. */
  
  int opvals[3] ;         /* Pixrect rasterop values. */
  int pid ;               /* Process id of the reve_proc process. */
***************
*** 121,128 ****
  
  Notify_value read_from_reve(), sigchldcatcher() ;
  void destroy_frame() ;
! static void menu_proc(),    set_depth(),   set_player() ;
! static void xv_load_game(), xv_new_game(), xv_save_game(), xv_set_props() ;
  
  
  void
--- 126,134 ----
  
  Notify_value read_from_reve(), sigchldcatcher() ;
  void destroy_frame() ;
! static void menu_proc(),    set_depth(),    set_player() ;
! static void xv_do_help(),   xv_load_game(), xv_new_game() ;
! static void xv_save_game(), xv_set_props() ;
  
  
  void
***************
*** 158,170 ****
  }
  
  
- void
- close_frame()        /* Iconise reve window. */
- {
-   XV_SET(frame, FRAME_CLOSED, TRUE, 0) ;
- }
- 
- 
  /*ARGSUSED*/
  void
  color_area(wtype, x, y, width, height, color)
--- 164,169 ----
***************
*** 427,435 ****
--- 426,437 ----
  init_fonts()         /* Open the normal and bold fonts. */
  {
    font[(int) BFONT] = get_font(BOLDFONT) ;
+   font[(int) HFONT] = get_font(HELPFONT) ;
    font[(int) NFONT] = get_font(NORMALFONT) ;
    bfont_height = font[(int) BFONT]->max_bounds.ascent +
                   font[(int) BFONT]->max_bounds.descent ;
+   hfont_height = font[(int) HFONT]->max_bounds.ascent +
+                  font[(int) HFONT]->max_bounds.descent ;
    nfont_height = font[(int) NFONT]->max_bounds.ascent +
                   font[(int) NFONT]->max_bounds.descent ;
  }
***************
*** 460,482 ****
  load_colors()      /* Create and load reve color map. */
  {
    XColor ccol ;
-   u_char red[OTH_COLORSIZE], green[OTH_COLORSIZE], blue[OTH_COLORSIZE] ;
    int i, numcolors ;
  
    if (iscolor[(int) cur_dpyno])
      {
-       oth_colorsetup(red, green, blue) ;
        numcolors = 0 ;
!       for (i = 0; i < OTH_COLORSIZE; i++)
          {
!           ccol.flags = DoRed | DoGreen | DoBlue ;
!           ccol.red = (unsigned short) (red[i] << 8) ;
!           ccol.green = (unsigned short) (green[i] << 8) ;
!           ccol.blue = (unsigned short) (blue[i] << 8) ;
            if (XAllocColor(dpy, DefaultColormap(dpy, screen), &ccol) == True)
              palette[numcolors++] = ccol.pixel ;
          }
!       if (numcolors < 2)
          {
            FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
            exit(1) ;
--- 462,487 ----
  load_colors()      /* Create and load reve color map. */
  {
    XColor ccol ;
    int i, numcolors ;
  
    if (iscolor[(int) cur_dpyno])
      {
        numcolors = 0 ;
!       for (i = 0; i < REVE_COLORSIZE; i++)
          {
!           if (colstr[i] == NULL ||
!               (XParseColor(dpy, DefaultColormap(dpy, screen),
!                            colstr[i], &ccol) == 0)) 
!             {
!               ccol.flags = DoRed | DoGreen | DoBlue ;
!               ccol.red   = (unsigned short) (rcols[i] << 8) ;
!               ccol.green = (unsigned short) (gcols[i] << 8) ;
!               ccol.blue  = (unsigned short) (bcols[i] << 8) ;
!             }
            if (XAllocColor(dpy, DefaultColormap(dpy, screen), &ccol) == True)
              palette[numcolors++] = ccol.pixel ;
          }
!       if (numcolors < REVE_COLORSIZE)
          {
            FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
            exit(1) ;
***************
*** 498,503 ****
--- 503,510 ----
   *
   *  XENVIRONMENT environment variable or, if not set, .Xdefaults-hostname
   *  file.
+  *
+  *  REVEDEFAULTS environment variable or, if not set, the ~/.reverc file.
   */
   
  void
***************
*** 541,546 ****
--- 548,565 ----
      }
    else db = XrmGetFileDatabase(ptr) ;
    XrmMergeDatabases(db, &reve_DB[d]) ;
+ 
+ /*  Finally merge in Reve defaults via REVEDEFAULTS or, if not defined, the
+  *  ~/.reverc file.
+  */
+   
+   if ((ptr = getenv("REVEDEFAULTS")) == NULL)
+     {
+       SPRINTF(name, "%s/.reverc", home) ;
+       db = XrmGetFileDatabase(name) ;
+     }
+   else db = XrmGetFileDatabase(ptr) ;
+   XrmMergeDatabases(db, &reve_DB[d]) ;
  }
  
  
***************
*** 652,659 ****
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 0),
              PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "Load Game...",
!             PANEL_NOTIFY_PROC,  xv_load_game,
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
--- 671,678 ----
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 0),
              PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_NOTIFY_PROC,  xv_new_game,
!             PANEL_LABEL_STRING, " New Game ",
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
***************
*** 666,687 ****
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 30),
              PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_NOTIFY_PROC,  xv_new_game,
!             PANEL_LABEL_STRING, " New Game ",
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 45),
              PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "   Props...   ",
!             PANEL_NOTIFY_PROC,  xv_set_props,
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 0),
              PANEL_ITEM_Y,       xv_row(panel, 1),
!             PANEL_LABEL_STRING, "Save Game...",
!             PANEL_NOTIFY_PROC,  xv_save_game,
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
--- 685,706 ----
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 30),
              PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "     Redo     ",
!             PANEL_NOTIFY_PROC,  redo,
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 45),
              PANEL_ITEM_Y,       xv_row(panel, 0),
!             PANEL_LABEL_STRING, "   Help...    ",
!             PANEL_NOTIFY_PROC,  xv_do_help,
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 0),
              PANEL_ITEM_Y,       xv_row(panel, 1),
!             PANEL_LABEL_STRING, "Load Game...",
!             PANEL_NOTIFY_PROC,  xv_load_game,
              0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
***************
*** 689,695 ****
              PANEL_ITEM_Y,       xv_row(panel, 1),
              PANEL_LABEL_STRING, "   Suggest   ",
              PANEL_NOTIFY_PROC,  suggest,
!             0) ;        
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 30),
--- 708,714 ----
              PANEL_ITEM_Y,       xv_row(panel, 1),
              PANEL_LABEL_STRING, "   Suggest   ",
              PANEL_NOTIFY_PROC,  suggest,
!             0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 30),
***************
*** 696,706 ****
              PANEL_ITEM_Y,       xv_row(panel, 1),
              PANEL_LABEL_STRING, "     Undo     ",
              PANEL_NOTIFY_PROC,  undo,
!             0) ;        
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 45),
              PANEL_ITEM_Y,       xv_row(panel, 1),
              PANEL_LABEL_STRING, "     Quit     ",
              PANEL_NOTIFY_PROC,  destroy_frame,
              0) ;
--- 715,739 ----
              PANEL_ITEM_Y,       xv_row(panel, 1),
              PANEL_LABEL_STRING, "     Undo     ",
              PANEL_NOTIFY_PROC,  undo,
!             0) ;
  
    XV_CREATE(panel,              PANEL_BUTTON,
              PANEL_ITEM_X,       xv_col(panel, 45),
              PANEL_ITEM_Y,       xv_row(panel, 1),
+             PANEL_LABEL_STRING, "   Props...   ",
+             PANEL_NOTIFY_PROC,  xv_set_props,
+             0) ;
+ 
+   XV_CREATE(panel,              PANEL_BUTTON,
+             PANEL_ITEM_X,       xv_col(panel, 0),
+             PANEL_ITEM_Y,       xv_row(panel, 2),
+             PANEL_LABEL_STRING, "Save Game...",
+             PANEL_NOTIFY_PROC,  xv_save_game,
+             0) ;
+ 
+   XV_CREATE(panel,              PANEL_BUTTON,
+             PANEL_ITEM_X,       xv_col(panel, 45),
+             PANEL_ITEM_Y,       xv_row(panel, 2),
              PANEL_LABEL_STRING, "     Quit     ",
              PANEL_NOTIFY_PROC,  destroy_frame,
              0) ;
***************
*** 707,713 ****
  
    XV_CREATE(panel, PANEL_MESSAGE,
              PANEL_ITEM_X,       xv_col(panel, 0),
!             PANEL_ITEM_Y,       xv_row(panel, 2),
              PANEL_LABEL_BOLD,   TRUE,
              PANEL_LABEL_STRING, "Black:",
              0) ;
--- 740,746 ----
  
    XV_CREATE(panel, PANEL_MESSAGE,
              PANEL_ITEM_X,       xv_col(panel, 0),
!             PANEL_ITEM_Y,       xv_row(panel, 3),
              PANEL_LABEL_BOLD,   TRUE,
              PANEL_LABEL_STRING, "Black:",
              0) ;
***************
*** 714,720 ****
    val = items[(int) BLACK_PLAYS].value ;
    black_item = xv_create(panel,                      PANEL_MESSAGE,
                           PANEL_ITEM_X,               xv_col(panel, 7),
!                          PANEL_ITEM_Y,               xv_row(panel, 2),
                           PANEL_LABEL_BOLD,           FALSE,
                           PANEL_LABEL_STRING,         player_values[val],
                           0) ;
--- 747,753 ----
    val = items[(int) BLACK_PLAYS].value ;
    black_item = xv_create(panel,                      PANEL_MESSAGE,
                           PANEL_ITEM_X,               xv_col(panel, 7),
!                          PANEL_ITEM_Y,               xv_row(panel, 3),
                           PANEL_LABEL_BOLD,           FALSE,
                           PANEL_LABEL_STRING,         player_values[val],
                           0) ;
***************
*** 721,727 ****
  
    XV_CREATE(panel, PANEL_MESSAGE,
              PANEL_ITEM_X,       xv_col(panel, 30),
!             PANEL_ITEM_Y,       xv_row(panel, 2),
              PANEL_LABEL_BOLD,   TRUE,
              PANEL_LABEL_STRING, "White:",
              0) ;
--- 754,760 ----
  
    XV_CREATE(panel, PANEL_MESSAGE,
              PANEL_ITEM_X,       xv_col(panel, 30),
!             PANEL_ITEM_Y,       xv_row(panel, 3),
              PANEL_LABEL_BOLD,   TRUE,
              PANEL_LABEL_STRING, "White:",
              0) ;
***************
*** 728,734 ****
    val = items[(int) WHITE_PLAYS].value ;
    white_item = xv_create(panel,                      PANEL_MESSAGE,
                           PANEL_ITEM_X,               xv_col(panel, 37),
!                          PANEL_ITEM_Y,               xv_row(panel, 2),
                           PANEL_LABEL_BOLD,           FALSE,
                           PANEL_LABEL_STRING,         player_values[val],
                           0) ;
--- 761,767 ----
    val = items[(int) WHITE_PLAYS].value ;
    white_item = xv_create(panel,                      PANEL_MESSAGE,
                           PANEL_ITEM_X,               xv_col(panel, 37),
!                          PANEL_ITEM_Y,               xv_row(panel, 3),
                           PANEL_LABEL_BOLD,           FALSE,
                           PANEL_LABEL_STRING,         player_values[val],
                           0) ;
***************
*** 735,759 ****
  
    mes_items[(int) (PANEL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 0),
!                        PANEL_ITEM_Y,       xv_row(panel, 3),
                         PANEL_LABEL_STRING, "",
                         0) ;
  
    mes_items[(int) (EVAL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 0),
!                        PANEL_ITEM_Y,       xv_row(panel, 4),
                         PANEL_LABEL_STRING, "",
                         0) ;
  
    mes_items[(int) (SCORE_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 0),
!                        PANEL_ITEM_Y,       xv_row(panel, 5),
                         PANEL_LABEL_STRING, "",
                         0) ;
  
    mes_items[(int) (TURN_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 30),
!                        PANEL_ITEM_Y,       xv_row(panel, 5),
                         PANEL_LABEL_STRING, "Black to move",
                         0) ;
    window_fit(panel) ;
--- 768,792 ----
  
    mes_items[(int) (PANEL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 0),
!                        PANEL_ITEM_Y,       xv_row(panel, 4),
                         PANEL_LABEL_STRING, "",
                         0) ;
  
    mes_items[(int) (EVAL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 0),
!                        PANEL_ITEM_Y,       xv_row(panel, 5),
                         PANEL_LABEL_STRING, "",
                         0) ;
  
    mes_items[(int) (SCORE_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 0),
!                        PANEL_ITEM_Y,       xv_row(panel, 6),
                         PANEL_LABEL_STRING, "",
                         0) ;
  
    mes_items[(int) (TURN_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
                         PANEL_ITEM_X,       xv_col(panel, 30),
!                        PANEL_ITEM_Y,       xv_row(panel, 6),
                         PANEL_LABEL_STRING, "Black to move",
                         0) ;
    window_fit(panel) ;
***************
*** 905,911 ****
--- 938,977 ----
  }
  
  
+ /*ARGSUSED*/
  void
+ make_help_window(argc, argv)
+ int argc ;
+ char *argv[] ;
+ {
+   h_frame = (Frame) xv_create(frame,                    FRAME_CMD,
+                               FRAME_ICON,               reve_icon,
+                               FRAME_LABEL,              "Reve Help",
+                               FRAME_CMD_PUSHPIN_IN,     TRUE,
+                               FRAME_NO_CONFIRM,         TRUE,
+                               XV_X,                     0,
+                               XV_Y,                     0,
+                               XV_WIDTH,                 500,
+                               XV_HEIGHT,                700,
+                               XV_SHOW,                  help_showing,
+                               FRAME_SHOW_RESIZE_CORNER, FALSE,
+                               0) ;
+   h_textsw = (Textsw) xv_create(h_frame,                 TEXTSW,
+                                 XV_X,                    0,
+                                 XV_Y,                    0,
+                                 XV_WIDTH,                500,
+                                 XV_HEIGHT,               700,
+                                 TEXTSW_FILE_CONTENTS,    helpfile,
+                                 TEXTSW_READ_ONLY,        TRUE,
+                                 TEXTSW_FIRST,            0,
+                                 TEXTSW_BROWSING,         TRUE,
+                                 0) ;
+   window_fit(h_textsw) ;
+   window_fit(h_frame) ;
+ }
+ 
+ 
+ void
  make_icon()
  {
  
***************
*** 973,985 ****
  
  
  void
! open_frame(wtype)                    /* **DUMMY ROUTINE** */
! enum win_type wtype ;
  {
  }
  
  
  void
  paint_prop_sheet()            /* **DUMMY ROUTINE** */
  {
  }
--- 1039,1056 ----
  
  
  void
! paint_help()                  /* **DUMMY ROUTINE** */
  {
  }
  
  
  void
+ paint_help_text()             /* **DUMMY ROUTINE** */
+ {
+ }
+ 
+ 
+ void
  paint_prop_sheet()            /* **DUMMY ROUTINE** */
  {
  }
***************
*** 1160,1165 ****
--- 1231,1245 ----
  
  /*ARGSUSED*/
  void
+ set_frame(wtype, showing)                       /* **DUMMY ROUTINE** */
+ enum win_type wtype ;
+ int showing ;
+ {
+ }
+ 
+ 
+ /*ARGSUSED*/
+ void
  set_cycle(wtype, mtype, str)                    /* **DUMMY ROUTINE** */
  enum win_type wtype ;
  enum panel_type mtype ;
***************
*** 1326,1331 ****
--- 1406,1423 ----
    reve_player = player ;
    processing  = TRUE ;
    WRITE(pipe_io[0][1], (char *) &in, sizeof(struct reve_in)) ;
+ }
+ 
+ 
+ /*ARGSUSED*/
+ static void
+ xv_do_help(item, value, event)    /* Callback for online help window. */
+ Panel_item item ;
+ int value ;
+ Event *event ;
+ {
+   position_popup(frame, h_frame, P_RIGHT) ;
+   XV_SET(h_frame, XV_SHOW, TRUE, 0) ;
  }
  
  

richb@sunaus.oz (Rich Burridge) (12/18/90)

------CUT HERE------patch 4 - part 3------CUT HERE------

------- color.h -------
*** /tmp/da06825	Tue Dec 18 10:08:17 1990
--- color.h	Tue Dec 11 18:19:51 1990
***************
*** 22,45 ****
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #define  OTH_COLOR      "othcolor"
! #define  OTH_COLORSIZE  8
  
  #define  C_WHITE    0
! #define  C_LGREY    1
! #define  C_LBROWN   2
! #define  C_BEIGE    3
! #define  C_DBROWN   4
! #define  C_BLACK    5
! #define  C_SPARE6   6
! #define  C_SPARE7   7
! 
! #define oth_colorsetup(r, g, b) \
!         (r)[C_WHITE] = 255 ;  (g)[C_WHITE] = 255 ;  (b)[C_WHITE] = 255 ; \
!         (r)[C_LGREY] = 200 ;  (g)[C_LGREY] = 200 ;  (b)[C_LGREY] = 200 ; \
!         (r)[C_LBROWN] = 200 ; (g)[C_LBROWN] = 150 ; (b)[C_LBROWN] = 100 ; \
!         (r)[C_BEIGE] = 255 ;  (g)[C_BEIGE] = 240 ;  (b)[C_BEIGE] = 220 ; \
!         (r)[C_DBROWN] = 185 ; (g)[C_DBROWN] = 145 ; (b)[C_DBROWN] = 100 ; \
!         (r)[C_BLACK] = 0 ;    (g)[C_BLACK] = 0 ;    (b)[C_BLACK] = 0 ; \
!         (r)[C_SPARE6] = 0 ;   (g)[C_SPARE6] = 0 ;   (b)[C_SPARE6] = 0 ; \
!         (r)[C_SPARE7] = 0 ;   (g)[C_SPARE7] = 0 ;   (b)[C_SPARE7] = 0 ;
--- 22,45 ----
   *  (see README file), then an attempt will be made to fix them.
   */
  
! #define  REVE_COLOR      "revecolor"
! #define  REVE_COLORSIZE  8
  
  #define  C_WHITE    0
! #define  C_BLACK    1
! #define  C_PANEL    2
! #define  C_SQUARE   3
! #define  C_BORDER   4
! #define  C_GRID     5
! #define  C_TEXT     6
! #define  C_ITEMS    7
!  
! #define reve_colorsetup(r, g, b) \
!         (r)[C_WHITE]  = 255 ;  (g)[C_WHITE]  = 255 ;  (b)[C_WHITE]  = 255 ; \
!         (r)[C_BLACK]  = 0   ;  (g)[C_BLACK]  = 0   ;  (b)[C_BLACK]  = 0   ; \
!         (r)[C_PANEL]  = 255 ;  (g)[C_PANEL]  = 240 ;  (b)[C_PANEL]  = 220 ; \
!         (r)[C_SQUARE] = 200 ;  (g)[C_SQUARE] = 150 ;  (b)[C_SQUARE] = 100 ; \
!         (r)[C_BORDER] = 185 ;  (g)[C_BORDER] = 145 ;  (b)[C_BORDER] = 100 ; \
!         (r)[C_GRID]   = 200 ;  (g)[C_GRID]   = 200 ;  (b)[C_GRID]   = 200 ; \
!         (r)[C_TEXT]   = 0 ;    (g)[C_TEXT]   = 0 ;    (b)[C_TEXT]   = 0 ;   \
!         (r)[C_ITEMS]  = 200 ;  (g)[C_ITEMS]  = 200 ;  (b)[C_ITEMS]  = 200 ;

------- extern.h -------
*** /tmp/da06828	Tue Dec 18 10:08:18 1990
--- extern.h	Sun Dec 16 10:53:55 1990
***************
*** 32,37 ****
--- 32,41 ----
  extern int cury ;          /* Current mouse Y position. */
  extern int down ;          /* Indicates is a mouse button is down. */
  extern int first_move ;    /* Set if computer plays first move. */
+ extern int help_height ;   /* Height of the help window. */
+ extern int help_showing ;  /* If set, the help window is visible. */
+ extern int help_width ;    /* Width of the help window. */
+ extern int hfont_height ;  /* Height in pixels for help font. */
  extern int iconic ;        /* Start as an icon if set. */
  extern int inv_video ;     /* Set if displaying in inverse video. */
  extern int iscolor[] ;     /* Set if this is a color screen. */
***************
*** 51,56 ****
--- 55,61 ----
  extern int nextc ;         /* Current event identifier. */
  extern int next_player ;   /* Next player (BLACK or WHITE) to move. */
  extern int nfont_height ;  /* Height in pixels for normal font. */
+ extern int old_diffval ;   /* Old difficulty value (possibly restored). */
  extern int piece_x ;       /* Current X position of moving piece. */
  extern int piece_y ;       /* Current Y position of moving piece */
  extern int play_computer ; /* Set if playing against the computer. */
***************
*** 75,80 ****
--- 80,94 ----
  extern int wx ;            /* Initial X position of the window. */
  extern int wy ;            /* Initial Y position of the window. */ 
  
+ extern FILE *hfp ;              /* File descriptor for online help file. */
+ 
+ extern long help_offsets[] ;    /* Offsets into the reve help file. */
+ 
+ extern char *colstr[] ;    /* X resource color values. */
+ extern int rcols[] ;       /* Red colormap values. */
+ extern int gcols[] ;       /* Green colormap values. */
+ extern int bcols[] ;       /* Blue colormap values. */
+ 
  extern time_t timeleft ;   /* Amount of time left for computer moves. */
  extern long edges[] ;      /* Edges Stability Table */
  extern long note ;         /* Note value for current computer move. */
***************
*** 84,89 ****
--- 98,104 ----
  extern char edgefile[] ;         /* Location of the reve edge table file. */
  extern char gamefile[] ;         /* Name of file for load/save. */
  extern char geometry[MAXDPY][MAXLINE] ;   /* X11 geometry information. */
+ extern char helpfile[] ;         /* Location of the reve online help file. */
  extern char line[] ;
  extern char *notes_values[] ;    /* Values for cyclic notes button. */
  extern char *player_values[] ;   /* Values for cyclic black/white item. */

------- reve.h -------
*** /tmp/da06831	Tue Dec 18 10:08:19 1990
--- reve.h	Sun Dec 16 02:37:24 1990
***************
*** 63,68 ****
--- 63,69 ----
  #define  BGAP          10       /* Width of the gap between buttons. */
  #define  BHEIGHT       32       /* Height of a reve button item. */
  #define  BWIDTH        64       /* Width of a reve button item. */
+ #define  CGAP          4        /* Size of the gap for a cycle item. */
  #define  CHEIGHT       20       /* Height of a reve cycle item. */
  #define  CHOICEGAP     5        /* Gap between choices in a choice item. */
  #define  CWIDTH        32       /* Width of a reve cycle item. */
***************
*** 103,111 ****
--- 104,115 ----
  #define  LINEFEED       13
  #define  RETURN         10
  
+ #define  CTL(n)        n - 96  /* Control characters. */
  #define  ESCAPE        27      /* ASCII escape character. */
  #define  EQUAL(a, b)   !strncmp(a, b, strlen(b))
  #define  FOR_BOARD(i)  for (i = 0; i < 64; i++)
+ #define  HELP_COLS     80      /* Number of columns in help window. */
+ #define  HELP_ROWS     60      /* Number of rows in help window. */
  #define  ICONHEIGHT    64      /* Height in pixels for reve icon. */
  #define  ICONWIDTH     64      /* Width in pixels of reve icon. */
  #define  INC           argc-- ; argv++ ;
***************
*** 117,130 ****
  #define  MAXCURSORS    3       /* Maximum number of cursor types. */
  #define  MAXDIFF       9       /* Number of levels of difficulty. */
  #define  MAXDPY        2       /* Maximum possible number of displays. */
! #define  MAXFONTS      2       /* Maximum number of font types. */
  #define  MAXIMAGES     11      /* Maximum number of image types. */
! #define  MAXITEMS      24      /* Number of different panel items. */
  
  #ifndef  MAXLINE
! #define  MAXLINE       80      /* Length of character strings. */
  #endif /*!MAXLINE*/
  
  #define  MAX_PROFMAX   60      /* Maximum search depth. */
  #define  NIVEAUMAX     25      /* Maximum possible depth. */
  
--- 121,135 ----
  #define  MAXCURSORS    3       /* Maximum number of cursor types. */
  #define  MAXDIFF       9       /* Number of levels of difficulty. */
  #define  MAXDPY        2       /* Maximum possible number of displays. */
! #define  MAXFONTS      3       /* Maximum number of font types. */
  #define  MAXIMAGES     11      /* Maximum number of image types. */
! #define  MAXITEMS      29      /* Number of different panel items. */
  
  #ifndef  MAXLINE
! #define  MAXLINE       120     /* Length of character strings. */
  #endif /*!MAXLINE*/
  
+ #define  MAXPAGES      10      /* Maximum number of pages in reve help file. */
  #define  MAX_PROFMAX   60      /* Maximum search depth. */
  #define  NIVEAUMAX     25      /* Maximum possible depth. */
  
***************
*** 150,155 ****
--- 155,163 ----
  #define  PROPS_WIDTH   ((NOBUTS*BWIDTH)   + ((NOBUTS-1)*BGAP)  + (2*BBORDER))
  #define  PSIZE         40      /* Diameter of playing piece. */
  
+ #define  B_COLOR(c)   (iscolor[(int) cur_dpyno] ? c : C_BLACK)
+ #define  W_COLOR(c)   (iscolor[(int) cur_dpyno] ? c : C_WHITE)
+ 
  #define  TICKHEIGHT    16      /* Height of the tick toggle box. */
  #define  TICKWIDTH     16      /* Width of the tick toggle box. */
  
***************
*** 157,162 ****
--- 165,174 ----
  #define  EDGENAME      "reve.edgetable"
  #endif /*!EDGENAME*/
  
+ #ifndef  HELPNAME
+ #define  HELPNAME      "reve.help"
+ #endif /*!HELPNAME*/
+ 
  #ifndef  INT_SIGNAL
  #define  SIGRET        void
  #else
***************
*** 191,197 ****
  #define  KEYBOARD         109    /* Keyboard character has been pressed. */
  #define  MOUSE_MOVING     110    /* Mouse is moving. */
  #define  PROPS_REPAINT    111    /* Property window needs repainting. */
! #define  IGNORE_EVENT     112    /* No interest in this event. */
  
  /* Batch, last move, locking or show all direction (ON or OFF). */
  enum bltype   { IS_OFF, IS_ON } ;
--- 203,210 ----
  #define  KEYBOARD         109    /* Keyboard character has been pressed. */
  #define  MOUSE_MOVING     110    /* Mouse is moving. */
  #define  PROPS_REPAINT    111    /* Property window needs repainting. */
! #define  HELP_REPAINT     112    /* Help window needs repainting. */
! #define  IGNORE_EVENT     113    /* No interest in this event. */
  
  /* Batch, last move, locking or show all direction (ON or OFF). */
  enum bltype   { IS_OFF, IS_ON } ;
***************
*** 207,213 ****
  
  enum dpy_type { DPY1, DPY2 } ;                    /* Possible dpy types. */
  
! enum font_type { NFONT, BFONT } ;                 /* Text font definitions. */
  
  enum gr_type { GSUNVIEW, GTTY, GX11, GXVIEW } ;   /* Graphical systems. */
  
--- 220,226 ----
  
  enum dpy_type { DPY1, DPY2 } ;                    /* Possible dpy types. */
  
! enum font_type { BFONT, HFONT, NFONT} ;           /* Text font definitions. */
  
  enum gr_type { GSUNVIEW, GTTY, GX11, GXVIEW } ;   /* Graphical systems. */
  
***************
*** 223,237 ****
  enum move_type { M_BEST, M_MOVE, M_PROFMAX, M_SUGGESTION, M_TIME } ;
  
  /* Different panel items. */
! enum panel_type { LOAD_BUT,    MOVES_BUT,    NEW_GAME_BUT, SAVE_BUT,
!                   SUGGEST_BUT, UNDO_BUT,     PROPS_BUT,    CANCEL_BUT,
                    QUIT_BUT,    BLACK_PLAYS,  WHITE_PLAYS,  PANEL_MES,
                    EVAL_MES,    SCORE_MES,    TURN_MES,     COMP_CHOICE,
                    DIFF_CHOICE, MAX_DEPTH,    OPT_ANIM,     OPT_BEST,
!                   OPT_LAST,    OPT_EVAL,     OPT_NUM,      OPT_FLIP } ;
  
  enum res_type { R_ANIMATE, R_BESTMOVE, R_DIFFICULTY, R_LAST,  /* Resources. */
!                 R_LOG,     R_NOTES,    R_NUMBER,     R_QUICK } ;
  
  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
  
--- 236,254 ----
  enum move_type { M_BEST, M_MOVE, M_PROFMAX, M_SUGGESTION, M_TIME } ;
  
  /* Different panel items. */
! enum panel_type { LOAD_BUT,    MOVES_BUT,    NEW_GAME_BUT, HELP_BUT,
!                   REDO_BUT,    PROPS_BUT,    SAVE_BUT,     SUGGEST_BUT,
!                   EDIT_BUT,    STOP_BUT,     UNDO_BUT,     CANCEL_BUT,
                    QUIT_BUT,    BLACK_PLAYS,  WHITE_PLAYS,  PANEL_MES,
                    EVAL_MES,    SCORE_MES,    TURN_MES,     COMP_CHOICE,
                    DIFF_CHOICE, MAX_DEPTH,    OPT_ANIM,     OPT_BEST,
!                   OPT_LAST,    OPT_EVAL,     OPT_NUM,      OPT_FLIP,
!                   HELP_PAGE } ;
  
  enum res_type { R_ANIMATE, R_BESTMOVE, R_DIFFICULTY, R_LAST,  /* Resources. */
!                 R_LOG,     R_NOTES,    R_NUMBER,     R_QUICK,
!                 R_PANELC,  R_BOARDC,   R_BOARDBC,    R_GRIDC,
!                 R_TEXTC,   R_ITEMC,    R_PROPS,      R_HELP } ;
  
  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
  
***************
*** 239,247 ****
  
  enum playtype { PLAY_BLACK, PLAY_WHITE } ; /* What the computer is playing. */
  
! enum win_type { W_MAIN, W_PROPS } ;        /* Window types. */
  
! extern char *getenv() ;
  extern void exit() ;
  
  typedef struct {
--- 256,264 ----
  
  enum playtype { PLAY_BLACK, PLAY_WHITE } ; /* What the computer is playing. */
  
! enum win_type { W_MAIN, W_HELP, W_PROPS } ;      /* Window types. */
  
! extern char *getenv(), *malloc() ;
  extern void exit() ;
  
  typedef struct {
***************
*** 288,305 ****
      int depth ;
    } ;
  
  char *getenv(), *index() ;
  char *get_resource() ;
  
  void animate_move(),       batch(),              check_button_down() ;
  void check_choice_down(),  check_cycle_down(),   check_item_down() ;
! void check_item_up(),      check_toggle_down(),  close_frame() ;
! void color_area() ;
  void computer_move(),      computer_plays(),     connect_to_reve() ;
! void create_menu(),        destroy_frame() ;
! void do_action(),          do_computer_move(),   do_cycle_key() ;
! void do_key_move(),        do_move(),            do_props() ;
! void do_selection(),       do_suggest(),         domove() ;
  void done(),               draw_button(),        draw_choice() ;
  void draw_cycle(),         draw_cycle_item(),    draw_image() ;
  void draw_line(),          draw_outline(),       draw_piece() ;
--- 305,325 ----
      int depth ;
    } ;
  
+ FILE *find_file() ;
+ 
  char *getenv(), *index() ;
  char *get_resource() ;
  
  void animate_move(),       batch(),              check_button_down() ;
  void check_choice_down(),  check_cycle_down(),   check_item_down() ;
! void check_item_up(),      check_toggle_down(),  color_area() ;
  void computer_move(),      computer_plays(),     connect_to_reve() ;
! void create_menu(),        destroy_frame(),      display_help() ;
! void do_action() ;
! void do_computer_move(),   do_edit(),            do_help() ;
! void do_key(),             do_key_move(),        do_move() ;
! void do_props(),           do_selection() ;
! void do_stop(),            do_suggest(),         domove() ;
  void done(),               draw_button(),        draw_choice() ;
  void draw_cycle(),         draw_cycle_item(),    draw_image() ;
  void draw_line(),          draw_outline(),       draw_piece() ;
***************
*** 309,329 ****
  void get_options(),        get_xy(),             getparam() ;
  void handle_board_event(), handle_event(),       handle_item() ;
  void handle_key(),         init_canvas(),        init_edge_table() ;
! void init_fonts(),         initboard(),          initialise() ;
! void load_colors(),        load_game() ;
! void load_resources(),     lock_screen() ;
! void make_canvas(),        make_frame(),         make_icon() ;
  void make_message(),       make_move(),          make_panel() ;
  void message(),            nap_upto(),           new_game() ;
! void open_frame(),         paint_prop_sheet(),   position_popup() ;
! void process_event(),      quit() ;
! void read_resources(),     remove_textfield(),   reset_time() ;
  void save_game(),          set_computer(),       set_cursor() ;
  void set_cycle(),          set_display_types(),  set_eval() ;
! void set_option(),         set_score(),          set_timer() ;
  void set_turn(),           show_all(),           show_all_moves() ;
  void show_best(),          show_last(),          show_number() ;
! void show_suggestion(),    start_tool() ;
! void suggest(),            think(),              undo() ;
  void update_board_image(), usage(),              who_wins() ;
  void write_to_reve() ;
--- 329,352 ----
  void get_options(),        get_xy(),             getparam() ;
  void handle_board_event(), handle_event(),       handle_item() ;
  void handle_key(),         init_canvas(),        init_edge_table() ;
! void init_help_file(),     init_fonts(),         initboard() ;
! void initialise(),         load_colors(),        load_game() ;
! void load_resources(),     lock_screen(),        make_canvas() ;
! void make_frame(),         make_help_window(),   make_icon() ;
  void make_message(),       make_move(),          make_panel() ;
  void message(),            nap_upto(),           new_game() ;
! void paint_help(),         paint_help_text(),    paint_prop_sheet() ;
! void position_popup() ;
! void process_event(),      quit(),               read_resources() ;
! void read_str(),           redo(),               redo_move() ;
! void remove_textfield(),   reset_time() ;
  void save_game(),          set_computer(),       set_cursor() ;
  void set_cycle(),          set_display_types(),  set_eval() ;
! void set_frame(),          set_option() ;
! void set_score(),          set_timer() ;
  void set_turn(),           show_all(),           show_all_moves() ;
  void show_best(),          show_last(),          show_number() ;
! void show_suggestion(),    start_tool(),         suggest() ;
! void think(),              undo(),               undo_move() ;
  void update_board_image(), usage(),              who_wins() ;
  void write_to_reve() ;

------- Imakefile -------
*** /tmp/da06834	Tue Dec 18 10:08:19 1990
--- Imakefile	Wed Dec 12 16:22:49 1990
***************
*** 58,64 ****
       
  /*  Compilation flags and standard macro definitions.  */
  
! SYS_LIBRARIES	= $(XLIB)     
  CDEFS		= $(NOSELECT) $(NO_USLEEP) $(EDGENAME) $(SELTYPE) \
  		  $(SIGRET)
  DEFINES         = $(CDEFS) -DX11
--- 58,65 ----
       
  /*  Compilation flags and standard macro definitions.  */
  
! X11LIBS		= $(XLIB)     
! TTYLIBS		= -ltermcap
  CDEFS		= $(NOSELECT) $(NO_USLEEP) $(EDGENAME) $(SELTYPE) \
  		  $(SIGRET)
  DEFINES         = $(CDEFS) -DX11
***************
*** 72,85 ****
  EDGENAME        = -DEDGENAME=\"$(EDGENAMEFILE)\"
  
       
! SRCS		= boardstuff.c events.c items.c makemove.c main.c \
! 		  procs.c rev_eval.c rev_ip.c rev_iycp.c x11.c
! OBJS		= boardstuff.o events.o items.o makemove.o main.o \
! 		  procs.o rev_eval.o rev_ip.o rev_iycp.o x11.o
  
! ComplexProgramTarget(reve)
  MakeDirectories(install,$(USRLIBDIR)$(PATHSEP)reve)
  InstallNonExec($(ETABLE),$(USRLIBDIR)$(PATHSEP)reve)
  
  install:: install.man
  
--- 73,99 ----
  EDGENAME        = -DEDGENAME=\"$(EDGENAMEFILE)\"
  
       
! REVESRCS        = rev_eval.c rev_ip.c rev_iycp.c
! STDSRCS         = boardstuff.c events.c makemove.c main.c procs.c
! REVEOBJS        = rev_eval.o rev_ip.o rev_iycp.o
! STDOBJS         = boardstuff.o events.o makemove.o main.o procs.o
  
! SRCS1		= $(STDSRCS) $(REVESRCS) common.c items.c x11.c
! OBJS1		= $(STDOBJS) $(REVEOBJS) common.o items.o x11.o
! SRCS2		= $(STDSRCS) $(REVESRCS) common.c items.c tty.c
! OBJS2		= $(STDOBJS) $(REVEOBJS) common.o items.o tty.o
! 
! 
! PROGRAMS	= reve
! 
! ComplexProgramTarget_1(reve, $(X11LIBS), /**/)
  MakeDirectories(install,$(USRLIBDIR)$(PATHSEP)reve)
  InstallNonExec($(ETABLE),$(USRLIBDIR)$(PATHSEP)reve)
+ 
+ tty: tty_reve
+ 	-cp tty_reve reve
+ 
+ NormalProgramTarget(tty_reve, $(OBJS2), /**/, /**/, $(TTYLIBS))
  
  install:: install.man
  

------- reve_proc.c -------
*** /tmp/da06837	Tue Dec 18 10:08:20 1990
--- reve_proc.c	Sun Dec 16 11:09:45 1990
***************
*** 31,36 ****
--- 31,38 ----
  
  int saveres = 0 ;            /* If set, save computer results to log file. */
  
+ char edgefile[MAXLINE] ;     /* Location of the reve edge table file. */
+ 
  /* REVE global variables */
  
  int damier[NIVEAUMAX][64] ;  /* Boards at different depth level */

------- common.c -------
*** /tmp/da06840	Tue Dec 18 10:08:21 1990
--- common.c	Sun Dec 16 11:01:07 1990
***************
*** 25,43 ****
  #include "reve.h"
  #include "extern.h"
  
! void
! init_edge_table(edgefile)     /* Load reve edge table values. */
! char *edgefile ;
  {
!   char buf[MAXLINE], *getenv(), name[MAXLINE], *paths, *ptr ;
!   int i, line ;
    FILE *fp = NULL ;
  
!   i = 0 ;
!   if ((fp = fopen(edgefile, "r")) == NULL)
      {
        paths = getenv("PATH") ;
!       if ((ptr = paths) && edgefile[0] != '/')
          for (;;)
            if (*ptr == ':' || *ptr == 0)
              {
--- 25,42 ----
  #include "reve.h"
  #include "extern.h"
  
! FILE *
! find_file(filename)
! char *filename ;
  {
!   char name[MAXLINE], *paths, *ptr ;
!   int i = 0 ;
    FILE *fp = NULL ;
  
!   if ((fp = fopen(filename, "r")) == NULL)
      {
        paths = getenv("PATH") ;
!       if ((ptr = paths) && filename[0] != '/')
          for (;;)
            if (*ptr == ':' || *ptr == 0)
              {
***************
*** 52,59 ****
              }
            else name[i++] = *ptr++ ;
      }
   
!   if (fp == NULL)
      {
        FPRINTF(stderr, "Cannot open Edge Stability Table file\n") ;
        exit(1) ;
--- 51,69 ----
              }
            else name[i++] = *ptr++ ;
      }
+   return(fp) ;
+ }
+ 
+ 
+ void
+ init_edge_table(edgefile)     /* Load reve edge table values. */
+ char *edgefile ;
+ {
+   char buf[MAXLINE], *ptr ;
+   int i, line ;
+   FILE *fp = NULL ;
   
!   if ((fp = find_file(edgefile)) == NULL)
      {
        FPRINTF(stderr, "Cannot open Edge Stability Table file\n") ;
        exit(1) ;

------- boardstuff.c -------
*** /tmp/da06843	Tue Dec 18 10:08:21 1990
--- boardstuff.c	Tue Dec 11 19:53:46 1990
***************
*** 235,242 ****
  {
    int color, x, y ;
  
!   if (iscolor[(int) cur_dpyno]) color = (state == IS_ON) ? C_BLACK : C_LBROWN ;
!   else                          color = (state == IS_ON) ? C_BLACK : C_WHITE ;
  
    x = (move & 7)  * CELL_SIZE + BBORDER ;
    y = (move >> 3) * CELL_SIZE + BBORDER ;
--- 235,242 ----
  {
    int color, x, y ;
  
!   if (state == IS_ON) color = C_BLACK ;
!   else                color = W_COLOR(C_SQUARE) ;
  
    x = (move & 7)  * CELL_SIZE + BBORDER ;
    y = (move >> 3) * CELL_SIZE + BBORDER ;
***************
*** 513,519 ****
  show_all(state)
  enum bltype state ;
  {
!   int color, d, i, x, y ;
  
    d = (int) cur_dpyno ;
    batch(IS_ON) ;
--- 513,519 ----
  show_all(state)
  enum bltype state ;
  {
!   int d, i, x, y ;
  
    d = (int) cur_dpyno ;
    batch(IS_ON) ;
***************
*** 547,554 ****
              s_all.square[i] = FREE ;
              x = (i & 7)  * CELL_SIZE + BBORDER + 1 ;
              y = (i >> 3) * CELL_SIZE + BBORDER + 1 ;  
!             color = (iscolor[d]) ? C_LBROWN : C_WHITE ;
!             color_area(W_MAIN, x, CY + y, CELL_SIZE - 2, CELL_SIZE - 2, color) ;
            }
      }    
    batch(IS_OFF) ;
--- 547,554 ----
              s_all.square[i] = FREE ;
              x = (i & 7)  * CELL_SIZE + BBORDER + 1 ;
              y = (i >> 3) * CELL_SIZE + BBORDER + 1 ;  
!             color_area(W_MAIN, x, CY + y,
!                        CELL_SIZE - 2, CELL_SIZE - 2, W_COLOR(C_SQUARE)) ;
            }
      }    
    batch(IS_OFF) ;
***************
*** 602,608 ****
    else if (board.square[move] == WHITE)
      color = (state == IS_ON) ? C_BLACK : C_WHITE ;
    else if (iscolor[(int) cur_dpyno])
!     color = (state == IS_ON) ? C_BLACK : C_LBROWN ;
    else
      color = (state == IS_ON) ? C_BLACK : C_WHITE ;
  
--- 602,608 ----
    else if (board.square[move] == WHITE)
      color = (state == IS_ON) ? C_BLACK : C_WHITE ;
    else if (iscolor[(int) cur_dpyno])
!     color = (state == IS_ON) ? C_BLACK : C_SQUARE ;
    else
      color = (state == IS_ON) ? C_BLACK : C_WHITE ;
  
***************
*** 627,638 ****
    if (suggestion != -1)
      {
        rop = RCLR ;
-       color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ;
        if (iscolor[(int) cur_dpyno]) rop = RSRC ;
        draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
!                         suggest_x+5, CY+suggest_y+5, rop, color) ;
        draw_line(W_MAIN, suggest_x-5, CY+suggest_y+5,
!                         suggest_x+5, CY+suggest_y-5, rop, color) ;
        suggestion = -1 ;
      }
  }
--- 627,637 ----
    if (suggestion != -1)
      {
        rop = RCLR ;
        if (iscolor[(int) cur_dpyno]) rop = RSRC ;
        draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
!                         suggest_x+5, CY+suggest_y+5, rop, W_COLOR(C_SQUARE)) ;
        draw_line(W_MAIN, suggest_x-5, CY+suggest_y+5,
!                         suggest_x+5, CY+suggest_y-5, rop, W_COLOR(C_SQUARE)) ;
        suggestion = -1 ;
      }
  }

------- events.c -------
*** /tmp/da06846	Tue Dec 18 10:08:22 1990
--- events.c	Sun Dec 16 02:47:52 1990
***************
*** 37,42 ****
--- 37,45 ----
    n = (int) item ;
    if (items[n].x == -1) return ;
    if (items[n].wtype != curwin) return ;
+   if (tinput && (n == (int) SUGGEST_BUT || n == (int) EDIT_BUT ||
+                  n == (int) STOP_BUT    || n == (int) UNDO_BUT))
+     return ;
    if ((curx >  items[n].x) && (curx < (items[n].x + items[n].width)) &&
        (cury >  items[n].y) && (cury < (items[n].y + items[n].height)))
      {
***************
*** 43,49 ****
        down = nextc ;
        itemno = n ;
        but_inverted = itemno ;
!       draw_button(W_MAIN, (enum panel_type) itemno, C_LGREY, BUT_INVERT) ;
      }
  }
  
--- 46,52 ----
        down = nextc ;
        itemno = n ;
        but_inverted = itemno ;
!       draw_button(W_MAIN, (enum panel_type) itemno, C_ITEMS, BUT_INVERT) ;
      }
  }
  
***************
*** 81,87 ****
        direction = INCREMENT ;
        down = nextc ;
        itemno = n ;
!       draw_cycle(curwin, (enum panel_type) n, C_LGREY, CY_LINVERT) ;
      }
    else if ((curx > ix) && (curx < (ix + CWIDTH)) &&
             (cury > items[n].y) && (cury < (items[n].y + CHEIGHT)) &&
--- 84,90 ----
        direction = INCREMENT ;
        down = nextc ;
        itemno = n ;
!       draw_cycle(curwin, (enum panel_type) n, C_ITEMS, CY_LINVERT) ;
      }
    else if ((curx > ix) && (curx < (ix + CWIDTH)) &&
             (cury > items[n].y) && (cury < (items[n].y + CHEIGHT)) &&
***************
*** 90,96 ****
        direction = DECREMENT ;
        down = nextc ;
        itemno = n ;
!       draw_cycle(curwin, (enum panel_type) n, C_LGREY, CY_RINVERT) ;
      }
  }
  
--- 93,99 ----
        direction = DECREMENT ;
        down = nextc ;
        itemno = n ;
!       draw_cycle(curwin, (enum panel_type) n, C_ITEMS, CY_RINVERT) ;
      }
  }
  
***************
*** 118,126 ****
  void
  check_item_up()
  {
-   int color, d ;
- 
-   d = (int) cur_dpyno ;
    if ((nextc == LEFT_UP   && down == LEFT_DOWN)   ||
        (nextc == MIDDLE_UP && down == MIDDLE_DOWN) ||
        (nextc == RIGHT_UP  && down == RIGHT_DOWN))
--- 121,126 ----
***************
*** 133,151 ****
            case P_BUTTON : if (items[itemno].x != -1)
                              draw_button(items[itemno].wtype,
                                          (enum panel_type) itemno,
!                                         C_LGREY, BUT_NORMAL) ;
                            break ;
!           case P_CHOICE : color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
!                           draw_choice(items[itemno].wtype,
!                                       (enum panel_type) itemno, color) ;
                            break ;
            case P_CYCLE  : draw_cycle(items[itemno].wtype,
                                       (enum panel_type) itemno,
!                                      C_LGREY, CY_NORMAL) ;
                            break ;
!           case P_TOGGLE : color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
!                           draw_toggle(items[itemno].wtype,
!                                       (enum panel_type) itemno, color) ;
          }
      } 
  }
--- 133,151 ----
            case P_BUTTON : if (items[itemno].x != -1)
                              draw_button(items[itemno].wtype,
                                          (enum panel_type) itemno,
!                                         W_COLOR(C_ITEMS), BUT_NORMAL) ;
                            break ;
!           case P_CHOICE : draw_choice(items[itemno].wtype,
!                                       (enum panel_type) itemno,
!                                       W_COLOR(C_PANEL)) ;
                            break ;
            case P_CYCLE  : draw_cycle(items[itemno].wtype,
                                       (enum panel_type) itemno,
!                                      W_COLOR(C_ITEMS), CY_NORMAL) ;
                            break ;
!           case P_TOGGLE : draw_toggle(items[itemno].wtype,
!                                       (enum panel_type) itemno,
!                                       W_COLOR(C_PANEL)) ;
          }
      } 
  }
***************
*** 218,236 ****
  
  
  void
! do_cycle_key(item, ch)
! enum panel_type item ;
! int ch ;
  {
!   int color, d, maxw, val ;
  
!   d = (int) cur_dpyno ;
!   color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
    if (!validkey)
      {
        validkey = cur_ch ;
!       if (item == OPT_EVAL) message(PANEL_MES, "Notes?") ;
!       else message(PANEL_MES, items[(int) item].label) ;
      }
    else
      {
--- 218,240 ----
  
  
  void
! do_key(item, ch)
! int item, ch ;
  {
!   int color, maxw, val ;
  
!   color = W_COLOR(C_PANEL) ;
    if (!validkey)
      {
        validkey = cur_ch ;
!       switch (item)
!         {
!           case 'C' : message(PANEL_MES, items[(int) COMP_CHOICE].label) ;
!                      break ;
!           case 'D' : message(PANEL_MES, items[(int) DIFF_CHOICE].label) ;
!                      break ;
!           case 'O' : message(PANEL_MES, "Option?") ;
!         }
      }
    else
      {
***************
*** 237,290 ****
        val = -1 ;
        switch (item)
          {
!           case COMP_CHOICE : switch (ch)
!                                {
!                                  case 'a' :                  /* All (both). */
!                                  case 'A' : val = CP_BOTH ;
!                                             break ;
!                                  case 'b' :                  /* Black. */
!                                  case 'B' : val = CP_BLACK ;
!                                             break ;
!                                  case 'n' :                  /* Neither. */
!                                  case 'N' : val = CP_NEITHER ;
!                                             break ;
!                                  case 'w' :                  /* White. */
!                                  case 'W' : val = CP_WHITE ;
!                                             break ;
!                                  default  : return ;
!                                }
!                              maxw = items[(int) item].width /
!                                     items[(int) item].nopts ;
!                              curx = items[(int) item].x + (maxw * val) ;
!                              itemno = (int) item ;
!                              items[(int) item].value = val ;
!                              draw_choice(W_PROPS, item, color) ;
!                              break ;
!           case DIFF_CHOICE : if (ch >= '1' && ch <= '9') val = ch - '1' ;
!                              items[(int) item].value = val ;
!                              draw_choice(W_PROPS, item, color) ;
!                              break ;
!           case OPT_EVAL    : color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
!                              switch (ch)
!                                {
!                                  case 'n' :
!                                  case 'N' : val = 0 ;
!                                             break ;
!                                  case 'y' :
!                                  case 'Y' : val = 1 ;
!                                             break ;
!                                  default  : return ;
!                                }
!                              items[(int) item].value = val ;
!                              draw_toggle(W_PROPS, OPT_EVAL, color) ;
          }
        if (val != -1)
          {
            validkey = 0 ;
            message(PANEL_MES, "") ;
!           items[(int) item].value = item_value = val ;
            direction = NONE ;
!           (*items[(int) item].func)() ;
          }
      }
  }
--- 241,315 ----
        val = -1 ;
        switch (item)
          {
!           case 'C' : itemno = (int) COMP_CHOICE ;
!                      switch (ch)
!                        {
!                          case 'a' :                  /* All (both). */
!                          case 'A' : val = CP_BOTH ;
!                                     break ;
!                          case 'b' :                  /* Black. */
!                          case 'B' : val = CP_BLACK ;
!                                     break ;
!                          case 'n' :                  /* Neither. */
!                          case 'N' : val = CP_NEITHER ;
!                                     break ;
!                          case 'w' :                  /* White. */
!                          case 'W' : val = CP_WHITE ;
!                                     break ;
!                          default  : return ;
!                        }
!                      maxw = items[itemno].width / items[itemno].nopts ;
!                      curx = items[itemno].x + (maxw * val) ;
!                      items[itemno].value = val ;
!                      break ;
! 
!           case 'D' : itemno = (int) DIFF_CHOICE ;
!                      if (ch >= '1' && ch <= '9') val = ch - '1' ;
!                      maxw = items[itemno].width / items[itemno].nopts ;
!                      curx = items[itemno].x + (maxw * val) ;
!                      items[itemno].value = val ;
!                      break ;
! 
!           case 'O' : switch (ch)
!                        {
!                          case 'a' :
!                          case 'A' : itemno = (int) OPT_ANIM ;
!                                     break ;
!                          case 'b' :
!                          case 'B' : itemno = (int) OPT_BEST ;
!                                     break ;
!                          case 'l' :
!                          case 'L' : itemno = (int) OPT_LAST ;
!                                     break ;
!                          case 'e' :
!                          case 'E' : itemno = (int) OPT_EVAL ;
!                                     break ;
!                          case 'n' :
!                          case 'N' : itemno = (int) OPT_NUM ;
!                                     break ;
!                          case 'f' :
!                          case 'F' : itemno = (int) OPT_FLIP ;
!                                     break ;
!                          default  : return ;
!                        }
!                      val = items[itemno].value ;
          }
        if (val != -1)
          {
            validkey = 0 ;
            message(PANEL_MES, "") ;
!           items[itemno].value = item_value = val ;
            direction = NONE ;
!           (*items[itemno].func)() ;
! 
!           switch (item)
!             {
!               case 'C' : draw_choice(W_PROPS, (enum panel_type) itemno, color) ;
!                          break ;
!               case 'D' : draw_choice(W_PROPS, (enum panel_type) itemno, color) ;
!                          break ;
!               case 'O' : draw_toggle(W_PROPS, (enum panel_type) itemno, color) ;
!             }
          }
      }
  }
***************
*** 342,352 ****
    process_event() ;
  
         if (nextc == FRAME_REPAINT) init_canvas() ;
    else if (nextc == PROPS_REPAINT) paint_prop_sheet() ;
    else if (nextc == KEYBOARD)      handle_key() ;
    else if (nextc == EXIT_WINDOW && but_inverted != -1)
      {
!       draw_button(W_MAIN, (enum panel_type) but_inverted, C_LGREY, BUT_NORMAL) ;
        but_inverted = -1 ;
        down = 0 ;
      }
--- 367,378 ----
    process_event() ;
  
         if (nextc == FRAME_REPAINT) init_canvas() ;
+   else if (nextc == HELP_REPAINT)  paint_help() ;
    else if (nextc == PROPS_REPAINT) paint_prop_sheet() ;
    else if (nextc == KEYBOARD)      handle_key() ;
    else if (nextc == EXIT_WINDOW && but_inverted != -1)
      {
!       draw_button(W_MAIN, (enum panel_type) but_inverted, C_ITEMS, BUT_NORMAL) ;
        but_inverted = -1 ;
        down = 0 ;
      }
***************
*** 388,400 ****
      }
    switch (cur_ch)
      {
!       case 'C' : do_cycle_key(COMP_CHOICE, nextc) ;    /* Cycle items. */
                   break ;
-       case 'D' : do_cycle_key(DIFF_CHOICE, nextc) ;
-                  break ;
-       case 'N' : do_cycle_key(OPT_EVAL,    nextc) ;
-                  break ;
  
        case 'M' : show_all_moves() ;                    /* Button items. */
                   break ;
        case 'L' : curx = 0 ;
--- 414,426 ----
      }
    switch (cur_ch)
      {
!       case 'C' :                                       /* Computer choice. */
!       case 'D' :                                       /* Difficulty. */
!       case 'O' : do_key(cur_ch, nextc) ;               /* Options. */
                   break ;
  
+       case 'H' : do_help() ;
+                  break ;
        case 'M' : show_all_moves() ;                    /* Button items. */
                   break ;
        case 'L' : curx = 0 ;
***************
*** 402,407 ****
--- 428,435 ----
                   break ;
        case 'n' : new_game() ;
                   break ;
+       case 'r' : redo() ;
+                  break ;
        case 'S' : curx = BBORDER + (2*(BWIDTH+BGAP)) ;
                   draw_textfield() ;
                   break ;
***************
*** 411,416 ****
--- 439,448 ----
                   break ;
        case 'p' : do_props() ;
                   break ;
+ 
+       case CTL('l') : init_canvas() ;
+                       paint_prop_sheet() ;
+                       break ;
  
        case 'q' : destroy_frame() ;
                   exit(0) ;

richb@sunaus.oz (Rich Burridge) (12/18/90)

------CUT HERE------patch 4 - part 4------CUT HERE------

------- items.c -------
*** /tmp/da06882	Tue Dec 18 10:10:23 1990
--- items.c	Mon Dec 17 10:24:06 1990
***************
*** 40,45 ****
--- 40,46 ----
  
    x = items[(int) item].x ;
    y = items[(int) item].y ;
+   if (x == -1 && y == -1) return ;
    if (iscolor[(int) cur_dpyno])
      {
        draw_stencil(wtype, x, y, BWIDTH, BHEIGHT, RSRC, color,
***************
*** 50,56 ****
                      BUT_STENCIL, image) ;
    label = items[(int) item].text ;
    if (image == BUT_INVERT) color = C_WHITE ;
!   else                     color = C_BLACK ;
    x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ;
    y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ;
    draw_text(wtype, x, y, NFONT, color, label) ;
--- 51,57 ----
                      BUT_STENCIL, image) ;
    label = items[(int) item].text ;
    if (image == BUT_INVERT) color = C_WHITE ;
!   else                     color = C_TEXT ;
    x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ;
    y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ;
    draw_text(wtype, x, y, NFONT, color, label) ;
***************
*** 64,75 ****
  int color ;
  {
    char *str ;
!   int height, i, maxw, val, width, x, xoff, y ;
  
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, C_BLACK, items[(int) item].label) ;
  
    maxw = 0 ;
    for (i = 0; i < items[(int) item].nopts; i++)
--- 65,77 ----
  int color ;
  {
    char *str ;
!   int height, i, maxw, tcol, val, width, x, xoff, y ;
  
+   tcol = B_COLOR(C_TEXT) ;
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, tcol, items[(int) item].label) ;
  
    maxw = 0 ;
    for (i = 0; i < items[(int) item].nopts; i++)
***************
*** 100,109 ****
        xoff = (maxw - val) / 2 ;
        draw_text(items[(int) item].wtype,
                  x + (i * maxw) + xoff,
!                 y + nfont_height + (nfont_height / 2), NFONT, C_BLACK, str) ;
      }
  
    val = items[(int) item].value ;
    draw_rect(wtype,
              x + (val * maxw) + 1, y + 1,
              x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ;
--- 102,112 ----
        xoff = (maxw - val) / 2 ;
        draw_text(items[(int) item].wtype,
                  x + (i * maxw) + xoff,
!                 y + nfont_height + (nfont_height / 2), NFONT, tcol, str) ;
      }
  
    val = items[(int) item].value ;
+   if (val < 0 || val >= items[(int) item].nopts) return ;
    draw_rect(wtype,
              x + (val * maxw) + 1, y + 1,
              x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ;
***************
*** 140,152 ****
  enum image_type image ;
  {
    char val[4] ;
  
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, C_BLACK, items[(int) item].label) ;
  
!   SPRINTF(val, "%d", items[(int) item].value) ;
    set_cycle(wtype, item, val) ;
    draw_cycle(wtype, item, color, image) ;
  }
--- 143,158 ----
  enum image_type image ;
  {
    char val[4] ;
+   int tcol ;
  
+   tcol = B_COLOR(C_TEXT) ;
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, tcol, items[(int) item].label) ;
  
!   if (item == MAX_DEPTH && !items[(int) item].value) STRCPY(val, "off") ;
!   else SPRINTF(val, "%d", items[(int) item].value) ;
    set_cycle(wtype, item, val) ;
    draw_cycle(wtype, item, color, image) ;
  }
***************
*** 158,166 ****
  {
    int y ;
  
!   color_area(W_MAIN, tx + 1, ty + 1, tw - 2, th - 2, C_WHITE) ;
    y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ;
!   draw_text(W_MAIN, tx + 5, y, NFONT, C_BLACK, str) ;
    draw_line(W_MAIN, tx + 5 + get_strwidth(NFONT, str), y + 5,
                      tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height,
                      RSRC, C_BLACK) ;
--- 164,172 ----
  {
    int y ;
  
!   color_area(W_MAIN, tx + 1, ty + 1, tw - 2, th - 2, W_COLOR(C_PANEL)) ;
    y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ;
!   draw_text(W_MAIN, tx + 5, y, NFONT, B_COLOR(C_TEXT), str) ;
    draw_line(W_MAIN, tx + 5 + get_strwidth(NFONT, str), y + 5,
                      tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height,
                      RSRC, C_BLACK) ;
***************
*** 174,185 ****
  int color ;
  {
    enum image_type image ;
!   int x, y ;
  
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, C_BLACK, items[(int) item].label) ;
  
    if (items[(int) item].value) image = TOGGLE_ON ;
    else                         image = TOGGLE_OFF ;
--- 180,192 ----
  int color ;
  {
    enum image_type image ;
!   int tcol, x, y ;
  
+   tcol = B_COLOR(C_TEXT) ;
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, tcol, items[(int) item].label) ;
  
    if (items[(int) item].value) image = TOGGLE_ON ;
    else                         image = TOGGLE_OFF ;
***************
*** 199,205 ****
      draw_text(items[(int) item].wtype,
                items[(int) item].x + TICKWIDTH + 10,
                items[(int) item].y + nfont_height,
!               NFONT, C_BLACK, items[(int) item].text) ;
  }
  
  
--- 206,212 ----
      draw_text(items[(int) item].wtype,
                items[(int) item].x + TICKWIDTH + 10,
                items[(int) item].y + nfont_height,
!               NFONT, tcol, items[(int) item].text) ;
  }
  
  
***************
*** 211,222 ****
    lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ;
    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
!   color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
    draw_rect(W_MAIN, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
                      y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
    draw_text(W_MAIN, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
              (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
!             BFONT, C_BLACK, "File:") ;
    tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ;
    ty = BBORDER + BHEIGHT + BGAP ;
    tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ;
--- 218,230 ----
    lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ;
    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
!   color_area(W_MAIN, x1, y1,
!              4 * (BWIDTH + BGAP), BHEIGHT + BGAP, W_COLOR(C_PANEL)) ;
    draw_rect(W_MAIN, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
                      y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
    draw_text(W_MAIN, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
              (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
!             BFONT, B_COLOR(C_TEXT), "File:") ;
    tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ;
    ty = BBORDER + BHEIGHT + BGAP ;
    tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ;
***************
*** 227,233 ****
    tinput = 1 ;
    items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ;
    items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ;
!   draw_button(W_MAIN, CANCEL_BUT, C_LGREY, BUT_NORMAL) ;
  }
  
  
--- 235,241 ----
    tinput = 1 ;
    items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ;
    items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ;
!   draw_button(W_MAIN, CANCEL_BUT, C_ITEMS, BUT_NORMAL) ;
  }
  
  
***************
*** 273,286 ****
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, C_BLACK, items[(int) item].label) ;
  
    message = items[(int) item].text ;
    x = items[(int) item].x ;
    y = items[(int) item].y ;
!   color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
!   color_area(wtype, x, y, TOTAL_WIDTH, 15, color) ;
!   draw_text(wtype, x, y + nfont_height, NFONT, C_BLACK, message) ;
  }
  
  
--- 281,293 ----
    if (strlen(items[(int) item].label))
      draw_text(items[(int) item].wtype,
                items[(int) item].lx, items[(int) item].ly + bfont_height,
!               BFONT, B_COLOR(C_TEXT), items[(int) item].label) ;
  
    message = items[(int) item].text ;
    x = items[(int) item].x ;
    y = items[(int) item].y ;
!   color_area(wtype, x, y, TOTAL_WIDTH, 15, W_COLOR(C_PANEL)) ;
!   draw_text(wtype, x, y + nfont_height, NFONT, B_COLOR(C_TEXT), message) ;
  }
  
  
***************
*** 287,301 ****
  void
  make_panel()
  {
!   draw_button(W_MAIN, LOAD_BUT,     C_LGREY, BUT_NORMAL) ;
!   draw_button(W_MAIN, MOVES_BUT,    C_LGREY, BUT_NORMAL) ;
!   draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
!   draw_button(W_MAIN, SAVE_BUT,     C_LGREY, BUT_NORMAL) ;
!   draw_button(W_MAIN, SUGGEST_BUT,  C_LGREY, BUT_NORMAL) ;
!   draw_button(W_MAIN, UNDO_BUT,     C_LGREY, BUT_NORMAL) ;
  
!   draw_button(W_MAIN, PROPS_BUT,    C_LGREY, BUT_NORMAL) ;
!   draw_button(W_MAIN, QUIT_BUT,     C_LGREY, BUT_NORMAL) ;
  
    make_message(W_MAIN, BLACK_PLAYS) ;
    make_message(W_MAIN, WHITE_PLAYS) ;
--- 294,312 ----
  void
  make_panel()
  {
!   draw_button(W_MAIN, LOAD_BUT,     C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, MOVES_BUT,    C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, NEW_GAME_BUT, C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, HELP_BUT,     C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, REDO_BUT,     C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, PROPS_BUT,    C_ITEMS, BUT_NORMAL) ;
  
!   draw_button(W_MAIN, SAVE_BUT,     C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, SUGGEST_BUT,  C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, EDIT_BUT,     C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, STOP_BUT,     C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, UNDO_BUT,     C_ITEMS, BUT_NORMAL) ;
!   draw_button(W_MAIN, QUIT_BUT,     C_ITEMS, BUT_NORMAL) ;
  
    make_message(W_MAIN, BLACK_PLAYS) ;
    make_message(W_MAIN, WHITE_PLAYS) ;
***************
*** 314,342 ****
    int n ;
  
    n = (int) mtype ;
-   color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
    color_area(W_MAIN, items[n].x, items[n].y,
!              get_strwidth(NFONT, items[n].text), nfont_height + 5, color) ;
    draw_text(W_MAIN, items[n].x, items[n].y + nfont_height,
!             NFONT, C_BLACK, str) ;
    STRCPY(items[n].text, str) ;
  }
  
  
  void
  paint_prop_sheet()
  {
!   int color, d ;
  
!   d = (int) cur_dpyno ;
!   color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
    color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ;
  
-   color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
    draw_choice(W_PROPS, COMP_CHOICE, color) ;
    draw_choice(W_PROPS, DIFF_CHOICE, color) ;
  
!   draw_cycle_item(W_PROPS, MAX_DEPTH, C_LGREY, CY_NORMAL) ;
  
    draw_toggle(W_PROPS, OPT_ANIM, color) ;
    draw_toggle(W_PROPS, OPT_BEST, color) ;
--- 325,383 ----
    int n ;
  
    n = (int) mtype ;
    color_area(W_MAIN, items[n].x, items[n].y,
!              get_strwidth(NFONT, items[n].text),
!              nfont_height + 5, W_COLOR(C_PANEL)) ;
    draw_text(W_MAIN, items[n].x, items[n].y + nfont_height,
!             NFONT, B_COLOR(C_TEXT), str) ;
    STRCPY(items[n].text, str) ;
  }
  
  
  void
+ paint_help()
+ {
+   if (hfp == NULL) return ;
+   color_area(W_HELP, 0, 0,
+              help_width, (2 * CGAP) + CHEIGHT, W_COLOR(C_PANEL)) ;
+   draw_cycle_item(W_HELP, HELP_PAGE, C_ITEMS, CY_NORMAL) ;
+   draw_line(W_HELP, 0,          (2 * CGAP) + CHEIGHT,
+                     help_width, (2 * CGAP) + CHEIGHT, RSRC, C_BLACK) ;
+   paint_help_text() ;
+ }
+ 
+ 
+ void
+ paint_help_text()
+ {
+   char buf[MAXLINE] ;
+   int i, y ;
+ 
+   color_area(W_HELP, 0, (2 * CGAP) + CHEIGHT + 1,
+              help_width, ((hfont_height + 1) * HELP_ROWS) + (2 * CGAP) - 1,
+              W_COLOR(C_PANEL)) ;
+   FSEEK(hfp, help_offsets[items[(int) HELP_PAGE].value], 0) ;
+   for (i = 0; i < HELP_ROWS; i++)
+     {
+       if (fgets(buf, MAXLINE, hfp) == NULL) return ;
+       y = (3 * CGAP) + CHEIGHT + ((i + 1) * (hfont_height + 1)) ;
+       draw_text(W_HELP, CGAP, y, NFONT, B_COLOR(C_TEXT), buf) ;
+     }
+ }
+ 
+ 
+ void
  paint_prop_sheet()
  {
!   int color ;
  
!   color = W_COLOR(C_PANEL) ;
    color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ;
  
    draw_choice(W_PROPS, COMP_CHOICE, color) ;
    draw_choice(W_PROPS, DIFF_CHOICE, color) ;
  
!   draw_cycle_item(W_PROPS, MAX_DEPTH, C_ITEMS, CY_NORMAL) ;
  
    draw_toggle(W_PROPS, OPT_ANIM, color) ;
    draw_toggle(W_PROPS, OPT_BEST, color) ;
***************
*** 355,364 ****
    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
    color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP,
!              (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE) ;
    tinput = 0 ;
    items[(int) CANCEL_BUT].x = -1 ;
    items[(int) CANCEL_BUT].y = -1 ;
  }
  
  
--- 396,410 ----
    x1 = BBORDER + BWIDTH + (BGAP / 2) ;
    y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
    color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP,
!              W_COLOR(C_PANEL)) ;
    tinput = 0 ;
    items[(int) CANCEL_BUT].x = -1 ;
    items[(int) CANCEL_BUT].y = -1 ;
+ 
+   draw_button(W_MAIN, SUGGEST_BUT,  C_ITEMS, BUT_NORMAL) ;
+   draw_button(W_MAIN, EDIT_BUT,     C_ITEMS, BUT_NORMAL) ;
+   draw_button(W_MAIN, STOP_BUT,     C_ITEMS, BUT_NORMAL) ;
+   draw_button(W_MAIN, UNDO_BUT,     C_ITEMS, BUT_NORMAL) ;
  }
  
  
***************
*** 368,379 ****
  enum panel_type item ;
  char *str ;
  {
-   color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
- 
    color_area(wtype, items[(int) item].x, items[(int) item].y,
!              items[(int) item].width, CHEIGHT, color) ;
    draw_text(wtype, items[(int) item].x, items[(int) item].y + nfont_height,
!             NFONT, C_BLACK, str) ;
    STRCPY(items[(int) item].text, str) ;
    items[(int) item].width = get_strwidth(NFONT, str) ;
  }
--- 414,423 ----
  enum panel_type item ;
  char *str ;
  {
    color_area(wtype, items[(int) item].x, items[(int) item].y,
!              items[(int) item].width, CHEIGHT, W_COLOR(C_PANEL)) ;
    draw_text(wtype, items[(int) item].x, items[(int) item].y + nfont_height,
!             NFONT, B_COLOR(C_TEXT), str) ;
    STRCPY(items[(int) item].text, str) ;
    items[(int) item].width = get_strwidth(NFONT, str) ;
  }

------- main.c -------
*** /tmp/da06885	Tue Dec 18 10:10:24 1990
--- main.c	Sun Dec 16 02:44:07 1990
***************
*** 38,46 ****
  } ;
  #endif /*NO_TIMEVAL*/
  
! /* Text values for the cyclic buttons. */
  char *comp_plays[]    = { "white", "black", "neither", "both" } ;
- char *diff_values[]   = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
  char *notes_values[]  = { "off", "on", NULL } ;
  char *player_values[] = { "human", "computer", NULL } ;
  
--- 38,48 ----
  } ;
  #endif /*NO_TIMEVAL*/
  
! char *diff_values[]   = {
!   " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 ", NULL
! } ;
! 
  char *comp_plays[]    = { "white", "black", "neither", "both" } ;
  char *notes_values[]  = { "off", "on", NULL } ;
  char *player_values[] = { "human", "computer", NULL } ;
  
***************
*** 52,58 ****
    "log",                   /* Boolean: write computer info to log file. */
    "notes",                 /* Boolean: show computer notes. */
    "number",                /* Boolean: show last move (number on stone). */
!   "quick"                  /* Boolean: play quick game (don't flip stones). */
  } ;
  
  enum cantype cmode, last_cmode ;
--- 54,68 ----
    "log",                   /* Boolean: write computer info to log file. */
    "notes",                 /* Boolean: show computer notes. */
    "number",                /* Boolean: show last move (number on stone). */
!   "quick",                 /* Boolean: play quick game (don't flip stones). */
!   "panelColor",            /* String:  main and property panels color. */
!   "boardColor",            /* String:  playing board color. */
!   "boardBorderColor",      /* String:  playing board border color. */
!   "gridColor",             /* String:  grid lines color. */
!   "textColor",             /* String:  text color. */
!   "itemColor",             /* String:  color of the panel items. */
!   "properties",            /* Boolean: initially show property window? */
!   "showHelp"               /* Boolean: initially show help window? */
  } ;
  
  enum cantype cmode, last_cmode ;
***************
*** 61,66 ****
--- 71,86 ----
  enum set_type direction ;   /* Incremental direction for cycle item. */
  enum win_type curwin ;      /* Window the current event for in. */
  
+ FILE *hfp ;                 /* File descriptor for online help file. */
+ 
+ char *colstr[REVE_COLORSIZE] = {
+   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ } ;
+ 
+ int rcols[REVE_COLORSIZE] ;   /* Red colormap values. */
+ int gcols[REVE_COLORSIZE] ;   /* Green colormap values. */
+ int bcols[REVE_COLORSIZE] ;   /* Blue colormap values. */
+ 
  int tx, ty, tw, th ;    /* Position and size of text field. */
  
  int piece_x ;           /* Current X position of moving piece. */
***************
*** 77,82 ****
--- 97,106 ----
  int down ;              /* Indicates is a mouse button is down. */
  int first_move = 0 ;    /* Set if computer plays first move. */
  int iconic ;            /* Set if window is currently iconic. */
+ int help_height ;       /* Height of the help window. */
+ int help_showing ;      /* If set, the help window is visible. */
+ int help_width ;        /* Width of the help window. */
+ int hfont_height ;      /* Height in pixels for help font. */
  int inv_video = 0 ;     /* Set if displaying in inverse video. */
  int isblack ;           /* Set if human to play the black pieces. */
  int iscolor[MAXDPY] ;   /* Set if this is a color screen. */
***************
*** 96,101 ****
--- 120,126 ----
  int nextc ;             /* Current event identifier. */
  int next_player ;       /* Next player (BLACK or WHITE) to move. */
  int nfont_height ;      /* Height in pixels for normal font. */
+ int old_diffval ;       /* Old difficulty value (possibly restored). */
  int play_computer ;     /* Set if playing against the computer. */
  int posspec ;           /* Set if -Wp or -g option is present (for X11) */
  int processing ;        /* If set, computer is procesing a move. */
***************
*** 110,115 ****
--- 135,142 ----
  int wx ;                /* Initial X position of the window. */
  int wy ;                /* Initial Y position of the window. */
  
+ long help_offsets[MAXPAGES] ;    /* Offsets into the reve help file. */
+ 
  /*  Globals for passing arguments to "sandwich";
   *  this is to save time putting arguments on and off the
   *  stack in a very heavily used piece of code
***************
*** 168,177 ****
      new_game
    },
  
!   {                                   /* save button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
      BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
      BWIDTH, BHEIGHT, "save", 0,
      (char **) NULL, 0,
      draw_textfield
--- 195,231 ----
      new_game
    },
  
!   {                                   /* help button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
      BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
+     BWIDTH, BHEIGHT, "help", 0,
+     (char **) NULL, 0,
+     do_help
+   },
+ 
+   {                                   /* redo button. */
+     W_MAIN, P_BUTTON, 0, 0,
+     "",
+     BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
+     BWIDTH, BHEIGHT, "redo", 0,
+     (char **) NULL, 0,
+     redo
+   },
+ 
+   {                                   /* props button. */
+     W_MAIN, P_BUTTON, 0, 0,
+     "",
+     BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
+     BWIDTH, BHEIGHT, "props", 0,
+     (char **) NULL, 0,
+     do_props
+   },
+ 
+   {                                   /* save button. */
+     W_MAIN, P_BUTTON, 0, 0,
+     "",
+     BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
      BWIDTH, BHEIGHT, "save", 0,
      (char **) NULL, 0,
      draw_textfield
***************
*** 180,209 ****
    {                                   /* suggest button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
!     BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
      BWIDTH, BHEIGHT, "suggest", 0,
      (char **) NULL, 0,
      suggest
    },
    
    {                                   /* undo button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
!     BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
      BWIDTH, BHEIGHT, "undo", 0,
      (char **) NULL, 0,
      undo
    },
    
-   {                                   /* props button. */
-     W_MAIN, P_BUTTON, 0, 0,
-     "",
-     BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
-     BWIDTH, BHEIGHT, "props", 0,
-     (char **) NULL, 0,
-     do_props
-   },
- 
    {                                   /* cancel button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
--- 234,274 ----
    {                                   /* suggest button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
!     BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
      BWIDTH, BHEIGHT, "suggest", 0,
      (char **) NULL, 0,
      suggest
    },
    
+   {                                   /* edit button. */
+     W_MAIN, P_BUTTON, 0, 0,
+     "",    
+ /*    BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), */
+     -1, -1,
+     BWIDTH, BHEIGHT, "edit", 0,
+     (char **) NULL, 0,
+     do_edit
+   },
+ 
+   {                                   /* stop button. */
+     W_MAIN, P_BUTTON, 0, 0,
+     "",    
+ /*    BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), */
+     -1, -1,
+     BWIDTH, BHEIGHT, "stop", 0,
+     (char **) NULL, 0,
+     do_stop
+   },
+ 
    {                                   /* undo button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
!     BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
      BWIDTH, BHEIGHT, "undo", 0,
      (char **) NULL, 0,
      undo
    },
    
    {                                   /* cancel button. */
      W_MAIN, P_BUTTON, 0, 0,
      "",
***************
*** 312,318 ****
      BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
      "Set search depth:",
      BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
!     0, 0, "", INIT_DEPTH,
      (char **) NULL, 0,
      set_option
    },
--- 377,383 ----
      BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
      "Set search depth:",
      BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
!     0, 0, "", 0,
      (char **) NULL, 0,
      set_option
    },
***************
*** 371,376 ****
--- 436,451 ----
      (char **) NULL, 0,
      set_option
    },
+ 
+   {                                   /* Help window page cycle. */
+     W_HELP, P_CYCLE,
+     BBORDER + (0*(BWIDTH+BGAP)), CGAP,
+     "Page",
+     BBORDER + (1*(BWIDTH+BGAP)), CGAP,
+     0, 0, "", 1,
+     (char **) NULL, 0,
+     display_help
+   },
  } ;
  
  char geometry[MAXDPY][MAXLINE] ;       /* X11 geometry information. */
***************
*** 378,383 ****
--- 453,459 ----
  char *black_dpy ;              /* Black piece display information. */
  char edgefile[MAXLINE] ;       /* Location of the reve edge table file. */
  char gamefile[MAXLINE] ;       /* Name of file for load/save. */
+ char helpfile[MAXLINE] ;       /* Location of the reve online help file. */
  char line[40] ;
  char progname[MAXLINE] ;       /* The name of this program. */
  char *white_dpy ;              /* White piece display information. */
***************
*** 405,410 ****
--- 481,487 ----
    STRCPY(gamefile, "reve.game") ;
    SPRINTF(line, " Reve.  V1.1.%1d", PATCHLEVEL) ;
    init_graphics(&argc, argv) ;
+   reve_colorsetup(rcols, gcols, bcols) ;  /* Setup default colors. */
    initialise() ;                /* Initialise variables used by reve. */
    load_resources() ;            /* Get resources from various places. */
    read_resources() ;            /* Read resources from merged database. */
***************
*** 414,420 ****
    init_edge_table(edgefile) ;   /* Load reve edge table values. */
  #endif /*XVIEW*/
  
!   set_display_types() ;         /* Work out what displays to initialise. */
    if (init_ws_type())           /* Determine window system type. */
      {
        FPRINTF(stderr,"Error initialising window system.\n") ;
--- 491,499 ----
    init_edge_table(edgefile) ;   /* Load reve edge table values. */
  #endif /*XVIEW*/
  
!   init_help_file(helpfile) ;    /* Load reve help file page offsets. */
! 
! set_display_types() ;         /* Work out what displays to initialise. */
    if (init_ws_type())           /* Determine window system type. */
      {
        FPRINTF(stderr,"Error initialising window system.\n") ;
***************
*** 450,458 ****
  {
    cur_dpyno = dpyno ;
    make_icon() ;
!   make_frame(argc, argv) ;      /* Create reve window/icon. */
!   make_canvas() ;               /* Create drawing canvas. */
!   init_fonts() ;                /* Load normal and bold fonts. */
    initboard() ;
    set_cursor(CANVASCUR) ;
  }
--- 529,538 ----
  {
    cur_dpyno = dpyno ;
    make_icon() ;
!   make_frame(argc, argv) ;        /* Create reve window/icon. */
!   make_canvas() ;                 /* Create drawing canvas. */
!   init_fonts() ;                  /* Load normal and bold fonts. */
!   make_help_window(argc, argv) ;  /* Make help window based on normal font. */
    initboard() ;
    set_cursor(CANVASCUR) ;
  }
***************
*** 521,527 ****
                         getparam(next, argv, "-d needs difficulty") ;
                         level = atoi(next) ;
                         if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
!                        items[(int) DIFF_CHOICE].value = level - 1 ;
                         break ;
              case 'e' : INC ;
                         getparam(edgefile, argv, "-e needs an edgetable file") ;
--- 601,607 ----
                         getparam(next, argv, "-d needs difficulty") ;
                         level = atoi(next) ;
                         if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
!                        items[(int) DIFF_CHOICE].value = old_diffval = level-1 ;
                         break ;
              case 'e' : INC ;
                         getparam(edgefile, argv, "-e needs an edgetable file") ;
***************
*** 530,535 ****
--- 610,622 ----
                         getparam(geometry[0], argv,
                                  "-g needs geometry information") ;
                         break ;
+             case 'h' : if (EQUAL(argv[0], "-help")) help_showing = TRUE ;
+                        else
+                          {
+                            INC ;
+                            getparam(helpfile, argv, "-h needs a help file") ;
+                          }
+                        break ;
              case 'i' : inv_video = 1 ;       /* Display in inverse video. */
                         break ;
              case 'l' :      if (EQUAL(argv[0], "-last")) DO_LAST = TRUE ;
***************
*** 547,552 ****
--- 634,641 ----
              case 'n' :      if (EQUAL(argv[0], "-notes")) SHOW_NOTES = TRUE ;
                         else if (EQUAL(argv[0], "-number")) DO_NUMBER = TRUE ;
                         break ;
+             case 'p' : if (EQUAL(argv[0], "-props")) props_showing = TRUE ;
+                        break ;
              case 'q' : if (EQUAL(argv[0], "-quick")) QUICKGAME = TRUE ;
                         break ;
              case '?' :
***************
*** 654,663 ****
    color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ;
    if (iscolor[d])
      {
!       color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_BEIGE) ;
!       color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_DBROWN) ;
        color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE,
!                  BOARD_SIZE * CELL_SIZE, C_LBROWN) ;
      }
    make_panel() ;                /* Create panel and panel items. */
  
--- 743,752 ----
    color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ;
    if (iscolor[d])
      {
!       color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_PANEL) ;
!       color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_BORDER) ;
        color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE,
!                  BOARD_SIZE * CELL_SIZE, C_SQUARE) ;
      }
    make_panel() ;                /* Create panel and panel items. */
  
***************
*** 666,674 ****
    batch(IS_ON) ;
    for (n = 0; n <= BOARD_SIZE; n++)
      {
!       color = (iscolor[d]) ? C_LGREY : C_BLACK ;
        if (n == 0 || n == BOARD_SIZE) color = C_BLACK ;
!       if (color == C_LGREY) adjust = 1 ;
        else adjust = 0 ;
        draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER,              /* Vertical. */
                  CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER,
--- 755,763 ----
    batch(IS_ON) ;
    for (n = 0; n <= BOARD_SIZE; n++)
      {
!       color = B_COLOR(C_GRID) ;
        if (n == 0 || n == BOARD_SIZE) color = C_BLACK ;
!       if (color == C_GRID) adjust = 1 ;
        else adjust = 0 ;
        draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER,              /* Vertical. */
                  CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER,
***************
*** 711,716 ****
--- 800,808 ----
    message(TURN_MES, "Black to move.") ;
    batch(IS_OFF) ;
  
+   if (help_showing)  set_frame(W_HELP,  help_showing) ;
+   if (props_showing) set_frame(W_PROPS, props_showing) ;
+ 
    if (loadgame)
      {
        loadgame = 0 ;
***************
*** 741,748 ****
    DO_BESTMOVE   = FALSE ;
    DO_LAST       = FALSE ;
    DO_NUMBER     = FALSE ;
    processing    = FALSE ;             /* No computer move initially. */
!   props_showing = FALSE ;
    QUICKGAME     = FALSE ;
    validkey      = 0 ;
    cmode         = BLACK_START ;
--- 833,841 ----
    DO_BESTMOVE   = FALSE ;
    DO_LAST       = FALSE ;
    DO_NUMBER     = FALSE ;
+   help_showing  = FALSE ;             /* Help window not visible. */
    processing    = FALSE ;             /* No computer move initially. */
!   props_showing = FALSE ;             /* Properties window not visible. */
    QUICKGAME     = FALSE ;
    validkey      = 0 ;
    cmode         = BLACK_START ;
***************
*** 751,757 ****
    isblack       = 0 ;
    iswhite       = 0 ;
    level         = INIT_DEPTH ;
!   items[(int) DIFF_CHOICE].value = level - 1 ;
  
    black_dpy = NULL ;              /* X11 black piece display information. */
    white_dpy = NULL ;              /* X11 white piece display information. */
--- 844,850 ----
    isblack       = 0 ;
    iswhite       = 0 ;
    level         = INIT_DEPTH ;
!   items[(int) DIFF_CHOICE].value = old_diffval = level - 1 ;
  
    black_dpy = NULL ;              /* X11 black piece display information. */
    white_dpy = NULL ;              /* X11 white piece display information. */
***************
*** 758,763 ****
--- 851,857 ----
    STRCPY(geometry[(int) DPY1], "") ;    /* X11 geometry information. */
    STRCPY(geometry[(int) DPY2], "") ;
    STRCPY(edgefile, EDGENAME) ;
+   STRCPY(helpfile, HELPNAME) ;
  }
  
  
***************
*** 765,770 ****
--- 859,865 ----
  read_resources()            /* Read all possible resources from database. */
  {
    int boolval, intval ;
+   char str[MAXLINE] ;
  
    if (get_bool_resource(R_ANIMATE,  &boolval)) ANIMATION   = boolval ;
    if (get_bool_resource(R_BESTMOVE, &boolval)) DO_BESTMOVE = boolval ;
***************
*** 773,779 ****
      {
        level = intval ;
        if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
!       items[(int) DIFF_CHOICE].value = level - 1 ;
      }
  
    if (get_bool_resource(R_LAST,   &boolval)) DO_LAST = boolval ;
--- 868,874 ----
      {
        level = intval ;
        if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
!       items[(int) DIFF_CHOICE].value = old_diffval = level - 1 ;
      }
  
    if (get_bool_resource(R_LAST,   &boolval)) DO_LAST = boolval ;
***************
*** 781,789 ****
--- 876,907 ----
    if (get_bool_resource(R_NOTES,  &boolval)) SHOW_NOTES = boolval ;
    if (get_bool_resource(R_NUMBER, &boolval)) DO_NUMBER = boolval ;
    if (get_bool_resource(R_QUICK,  &boolval)) QUICKGAME = boolval ;
+   if (get_bool_resource(R_PROPS,  &boolval)) props_showing = boolval ;
+   if (get_bool_resource(R_HELP,   &boolval)) help_showing  = boolval ;
+ 
+   if (get_str_resource(R_PANELC,  str)) read_str(&colstr[C_PANEL],  str) ;
+   if (get_str_resource(R_BOARDC,  str)) read_str(&colstr[C_SQUARE], str) ;
+   if (get_str_resource(R_BOARDBC, str)) read_str(&colstr[C_BORDER], str) ;
+   if (get_str_resource(R_GRIDC,   str)) read_str(&colstr[C_GRID],   str) ;
+   if (get_str_resource(R_TEXTC,   str)) read_str(&colstr[C_TEXT],   str) ;
+   if (get_str_resource(R_ITEMC,   str)) read_str(&colstr[C_ITEMS],  str) ;
  }
  
  
+ void
+ read_str(str, value)
+ char **str, *value ;
+ {
+   if (*str != NULL) (void) free(*str) ;
+   if (value != NULL && strlen(value))
+     {
+       *str = (char *) malloc((unsigned) (strlen(value) + 1)) ;
+       STRCPY(*str, value) ;
+     }
+   else *str = NULL ;
+ }
+ 
+ 
  /*  Setup the display information for the black and white displays.
   *  There are a fair number of combinations allowed. This table hopefully
   *  gives the setup information for each combination.
***************
*** 875,883 ****
    FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ;
    FPRINTF(stderr, "Usage: %s: [-animate] [-bestmove]\n", progname) ;
    FPRINTF(stderr, "\t[-black [display] ] [-c] [-d difficulty]\n") ;
!   FPRINTF(stderr, "\t[-e edgefile] [-g geometry] [-last]\n") ;
!   FPRINTF(stderr, "\t[-load gamefile] [-number] [-notes] [-v]\n") ;
!   FPRINTF(stderr, "\t[-w [display] ] [-?] [-Wi] [-Wp x y] [-WP x y]\n") ;
  }
  
  
--- 993,1002 ----
    FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ;
    FPRINTF(stderr, "Usage: %s: [-animate] [-bestmove]\n", progname) ;
    FPRINTF(stderr, "\t[-black [display] ] [-c] [-d difficulty]\n") ;
!   FPRINTF(stderr, "\t[-e edgefile] [-g geometry] [-h helpfile] [-help]\n") ;
!   FPRINTF(stderr, "\t[-i] [-last] [-load gamefile] [-log] [-m] [-number]\n") ;
!   FPRINTF(stderr, "\t[-notes] [-props] [-quick] [-v] [-w [display] ]\n") ;
!   FPRINTF(stderr, "\t[-?] [-Wi] [-Wp x y] [-WP x y]\n") ;
  }
  
  

------- procs.c -------
*** /tmp/da06888	Tue Dec 18 10:10:25 1990
--- procs.c	Mon Dec 17 10:32:34 1990
***************
*** 29,39 ****
  
  
  void
  do_props()
  {
    props_showing = !props_showing ;
!   if (props_showing == TRUE) open_frame(W_PROPS) ;
!   else                       close_frame(W_PROPS) ;
  }
  
  
--- 29,78 ----
  
  
  void
+ display_help()
+ {
+   char str[4] ;
+   int val ;
+ 
+   val = items[itemno].value ;
+   if (direction == INCREMENT && help_offsets[++val] != -1)
+     items[itemno].value++ ;
+   else if (direction == DECREMENT && help_offsets[--val] != -1)
+     items[itemno].value-- ;
+   else return ;
+   SPRINTF(str, "%d", items[itemno].value) ;
+   set_cycle(W_HELP, HELP_PAGE, str) ;
+   paint_help_text() ;
+ }
+ 
+ 
+ void
+ do_edit()
+ {
+   message(PANEL_MES, "Not currently implemented.") ;
+ }
+ 
+ 
+ void
+ do_help()
+ {
+   help_showing = !help_showing ;
+   set_frame(W_HELP, help_showing) ;
+ }
+ 
+ 
+ void
+ do_stop()
+ {
+   message(PANEL_MES, "Not currently implemented.") ;
+ }
+ 
+ 
+ void
  do_props()
  {
    props_showing = !props_showing ;
!   set_frame(W_PROPS, props_showing) ;
  }
  
  
***************
*** 81,89 ****
  
    suggest_x = BBORDER + ((suggestion & 7)  + 1) * CELL_SIZE - CELL_SIZE / 2 ;
    suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
!   if (state == IS_OFF)
!     color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ;
!   else color = C_BLACK ;
  
    draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
                      suggest_x+5, CY+suggest_y+5, RSRC, color) ;
--- 120,127 ----
  
    suggest_x = BBORDER + ((suggestion & 7)  + 1) * CELL_SIZE - CELL_SIZE / 2 ;
    suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
!   if (state == IS_OFF) color = W_COLOR(C_SQUARE) ;
!   else                 color = C_BLACK ;
  
    draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
                      suggest_x+5, CY+suggest_y+5, RSRC, color) ;
***************
*** 94,99 ****
--- 132,161 ----
  
  
  void
+ init_help_file(helpfile)     /* Load reve help page offsets. */
+ char *helpfile ;
+ {
+   char buf[MAXLINE] ;
+   int i, page ;
+   long offset ;
+ 
+   for (i = 0; i < MAXPAGES; i++) help_offsets[i] = -1 ;
+   if ((hfp = find_file(helpfile)) == NULL)
+     {
+       FPRINTF(stderr, "Cannot open online help file\n") ;
+       return ;
+     }
+   page = 1 ;
+   for (;;)
+     {
+       offset = ftell(hfp) ;
+       if (fgets(buf, MAXLINE, hfp) == NULL) return ;
+       if (EQUAL(buf, "REVE(6)")) help_offsets[page++] = offset ;
+     }
+ }
+ 
+ 
+ void
  make_move()
  {
    if (legal(move, next_player, &board) == FALSE)
***************
*** 129,135 ****
    init_canvas() ;
    message(EVAL_MES, "") ;
    message(PANEL_MES, "Use left mouse button to move") ;
!   draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
  }
  
  
--- 191,197 ----
    init_canvas() ;
    message(EVAL_MES, "") ;
    message(PANEL_MES, "Use left mouse button to move") ;
!   draw_button(W_MAIN, NEW_GAME_BUT, C_ITEMS, BUT_NORMAL) ;
  }
  
  
***************
*** 142,151 ****
  
  
  void
  set_computer(val)
  int val ;
  {
!   int color, curi ;
  
    if (val == CP_WHITE)
      {
--- 204,294 ----
  
  
  void
+ redo()
+ {
+   enum panel_type p ;
+ 
+  /*  The amount we redo is dependant upon two things:
+   *
+   *  1/ Whether the opponent is the computer, in which case we redo
+   *     two "moves". Otherwise we just redo one "move".
+   *
+   *  2/ A "move" is considered to be all consecutive moves by the opponent.
+   */
+ 
+   redo_move(next_player) ;
+   p = (next_player == BLACK) ? BLACK_PLAYS : WHITE_PLAYS ;
+   if (items[(int) p].value == COMPUTER) redo_move(next_player) ;
+ 
+   set_score() ;
+   set_turn(next_player) ;
+ }
+ 
+ 
+ void
+ redo_move(player)
+ int player ;
+ {
+   int i, limit, n, x, y ;
+  
+   n = 63 - board.moves_left ;
+   while (moves[n].move != -1 && moves[n].player != player) n++ ;
+  
+   if (moves[n].move == -1 || n > 63) message(PANEL_MES, "No moves to redo.") ;
+   else
+     {
+       if (DO_LAST) show_last(last_move, IS_OFF) ;
+       if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_OFF) ;
+       do_suggest(player, suggestion, note, IS_OFF) ;
+       FOR_BOARD(i)
+         {
+           if (moves[n].square[i] != board.square[i])
+             {
+               get_xy(i, &x, &y) ;
+               if (moves[n].square[i] == FREE)
+                 color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, W_COLOR(C_SQUARE)) ;
+               else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
+             }
+           board.square[i] = moves[n].square[i] ;
+         }
+       board.moves_left = moves[n].moves_left ;
+       board.player     = moves[n].player ;
+       board.move       = moves[n].move ;
+       board.note       = moves[n].note ;
+       board.timeleft   = moves[n].timeleft ;
+       last_move        = board.move ;
+ 
+       FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ;
+       old_board.moves_left = moves[n-1].moves_left ;
+       old_board.player     = moves[n-1].player ;
+       old_board.move       = moves[n-1].move ;
+       old_board.note       = moves[n-1].note ;
+       old_board.timeleft   = moves[n-1].timeleft ;
+ 
+       timeleft = board.timeleft ;
+ 
+ #ifdef XVIEW
+       reset_time(timeleft) ;
+ #endif /*XVIEW*/
+ 
+       if (OPPONENT(player) == BLACK) cmode = BLACK_START ;
+       else                           cmode = WHITE_START ;
+       message(PANEL_MES, "") ;
+ 
+       if (DO_LAST) show_last(last_move, IS_ON) ;
+       if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ;
+       if (SHOW_NOTES) set_eval(board.player, board.move, board.note) ;
+       else message(EVAL_MES, "") ;
+       next_player = OPPONENT(board.player) ;
+     }
+ }
+ 
+ 
+ void
  set_computer(val)
  int val ;
  {
!   int curi ;
  
    if (val == CP_WHITE)
      {
***************
*** 175,182 ****
        STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ; 
      }
  
!   color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
!   draw_choice(W_PROPS, COMP_CHOICE, color) ;
  
    val = items[(int) BLACK_PLAYS].value ;
    val = items[(int) WHITE_PLAYS].value ;
--- 318,326 ----
        STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ; 
      }
  
!   draw_choice(W_PROPS, COMP_CHOICE, W_COLOR(C_PANEL)) ;
!   make_message(W_MAIN, BLACK_PLAYS) ;
!   make_message(W_MAIN, WHITE_PLAYS) ;
  
    val = items[(int) BLACK_PLAYS].value ;
    val = items[(int) WHITE_PLAYS].value ;
***************
*** 194,202 ****
  set_option()
  {
    char str[4] ;
!   int color, d, maxw, n, val ;
  
-   d = (int) cur_dpyno ;
    switch (itemno)
      {
        case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ;
--- 338,345 ----
  set_option()
  {
    char str[4] ;
!   int maxw, n, val ;
  
    switch (itemno)
      {
        case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ;
***************
*** 214,233 ****
                           val = (curx - items[itemno].x) / maxw ;
                           level = val + 1 ;
                           items[itemno].value = val ;
!                          color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
!                          draw_choice(W_PROPS, DIFF_CHOICE, color) ;
                           break ;
  
        case MAX_DEPTH   : val = items[itemno].value ;
                           if (direction == INCREMENT && val < MAX_PROFMAX)
                             items[itemno].value++ ;
!                          else if (direction == DECREMENT && val > INIT_DEPTH)
                             items[itemno].value-- ;
!                          SPRINTF(str, "%d", items[itemno].value) ;
!                          color = (iscolor[d]) ? C_LGREY : C_WHITE ;
                           set_cycle(W_PROPS, MAX_DEPTH, str) ;
!                          profmax = items[itemno].value ;
!                          level = 1 ;
                           break ;
  
        case OPT_ANIM    : ANIMATION   = !ANIMATION ;
--- 357,390 ----
                           val = (curx - items[itemno].x) / maxw ;
                           level = val + 1 ;
                           items[itemno].value = val ;
!                          draw_choice(W_PROPS, DIFF_CHOICE, W_COLOR(C_PANEL)) ;
! 
!                          items[(int) MAX_DEPTH].value = 0 ;
!                          set_cycle(W_PROPS, MAX_DEPTH, "off") ;
                           break ;
  
        case MAX_DEPTH   : val = items[itemno].value ;
                           if (direction == INCREMENT && val < MAX_PROFMAX)
                             items[itemno].value++ ;
!                          else if (direction == DECREMENT && val > 0)
                             items[itemno].value-- ;
!                          if (!items[(int) itemno].value) STRCPY(str, "off") ;
!                          else SPRINTF(str, "%d", items[itemno].value) ;
                           set_cycle(W_PROPS, MAX_DEPTH, str) ;
! 
!                          if (items[itemno].value)
!                            {
!                              items[(int) DIFF_CHOICE].value = -1 ;
!                              level = 1 ;
!                              max_depth = items[itemno].value ;
!                            }
!                          else
!                            {
!                              items[(int) DIFF_CHOICE].value = old_diffval ;
!                              level = old_diffval + 1 ;
!                              max_depth = 2 ;
!                            }
!                          draw_choice(W_PROPS, DIFF_CHOICE, W_COLOR(C_PANEL)) ;
                           break ;
  
        case OPT_ANIM    : ANIMATION   = !ANIMATION ;
***************
*** 247,254 ****
  
        case OPT_NUM     : DO_NUMBER   = !DO_NUMBER ;
                           n = 63 - board.moves_left ;
!                          show_number(moves[n].move, 60 - board.moves_left,
!                                      DO_NUMBER, DO_NUMBER) ;
                           break ;
  
        case OPT_FLIP    : QUICKGAME   = !QUICKGAME ;
--- 404,412 ----
  
        case OPT_NUM     : DO_NUMBER   = !DO_NUMBER ;
                           n = 63 - board.moves_left ;
!                          if (board.moves_left < 60)
!                            show_number(moves[n].move, 60 - board.moves_left,
!                                        DO_NUMBER) ;
                           break ;
  
        case OPT_FLIP    : QUICKGAME   = !QUICKGAME ;
***************
*** 306,311 ****
--- 464,470 ----
  }
  
  
+ void
  undo_move(player)
  int player ;
  {
***************
*** 326,333 ****
              {
                get_xy(i, &x, &y) ;
                if (moves[n].square[i] == FREE)
!                 color_area(W_MAIN, x, CY+y, PSIZE, PSIZE,
!                            (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ;
                else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
              }
            board.square[i] = moves[n].square[i] ;
--- 485,491 ----
              {
                get_xy(i, &x, &y) ;
                if (moves[n].square[i] == FREE)
!                 color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, W_COLOR(C_SQUARE)) ;
                else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
              }
            board.square[i] = moves[n].square[i] ;
***************
*** 338,344 ****
        board.note       = moves[n].note ;
        board.timeleft   = moves[n].timeleft ;
        last_move        = board.move ;
-       moves[n+1].move  = -1 ;
  
        FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ;
        old_board.moves_left = moves[n-1].moves_left ;
--- 496,501 ----