version 1.4.50b
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 9 Jun 2011 08:08:21 +0000 (10:08 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 9 Jun 2011 08:08:21 +0000 (10:08 +0200)
18 files changed:
ChangeLog
README
config.guess
config.h
config.sub
configure
configure.ac
debian/changelog
debian/files
main.c
option.c
option.h
polyglot.man
polyglot.pod
polyglot.spec
uci.c
util.c
util.h

index 203101c..6495598 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+=========1.4.50b================\r
+- Change in architecture. Persistence is disabled. The user is required to push the "Save" button explicitly to save the settings. What is retained is that in case PG is invoked with -noini (or as a special exception for WB 4.4.0 when the config files are polyglot_1st.ini or polyglot_2nd.ini) then PG uses a default config file whose name is derived from the engine name. \r
+- New option: OnlyWbOptions (default: true). Restrict the options that PG sends to those that are potentially useful for WinBoard.\r
+=========1.4.47b================\r
+- Try to detect if the engine is not an UCI engine.\r
 =========1.4.46b================\r
 - The default persistence directory on Windows is now _PG. The names of the engine specific ini files are mangled so as not to contain spaces. \r
 - PG now tries to guess if a string option is really a file or a path (like in the Arena GUI). \r
diff --git a/README b/README
index 499acf1..4358d8e 100644 (file)
--- a/README
+++ b/README
@@ -5,8 +5,8 @@ POLYGLOT(6)                                                        POLYGLOT(6)
 NAME
        PolyGlot -  Winboard protocol to UCI protocol adapter
                 -  book engine for Polyglot books
-                -  a collection of utilities for creating and analyzing
-       opening books
+                -  a collection of utilities for creating and analyzing open-
+       ing books
                 -  a utility for analyzing epd files
                 -  a perft counter
 
@@ -16,8 +16,8 @@ SYNOPSIS
        <name>=<value>]* [-uci <name>=<value>]*
 
        polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply]
-       [-min-game games] [-min-score score] [-only-white] [-only-black]
-       [-uniform]
+       [-min-game games] [-min-score score] [-only-white] [-only-black] [-uni-
+       form]
 
        polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]
 
@@ -32,16 +32,17 @@ SYNOPSIS
        polyglot perft [-fen fen] [-max-depth depth]
 
 DESCRIPTION
-   PolyGlot as adapter and book engine
+       PolyGlot as adapter and book engine
+
        PolyGlot is a "UCI adapter".  It connects a GUI interface (such as
        XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
 
        By specifying an opening book (in PolyGlot book format) chess engines
        can transparently use such books.
 
-       PolyGlot understands the two main GUI protocols: UCI and xboard.
-       Normally the protocol will be auto detected but this can be overridden
-       in the configuration file.
+       PolyGlot understands the two main GUI protocols: UCI and xboard. Nor-
+       mally the protocol will be auto detected but this can be overridden in
+       the configuration file.
 
        In xboard mode PolyGlot fully translates between the xboard and UCI
        protocols.  In addition it tries to solve known problems with other
@@ -52,9 +53,9 @@ DESCRIPTION
        engine and vice versa, except that it will play book moves on behalf of
        the engine when the occasion arises.
 
-       The engine options are exported as UCI options in UCI mode and as
-       "feature option=" commands in xboard mode. The latter form an extension
-       of the xboard protocol as defined by H.G. Muller.
+       The engine options are exported as UCI options in UCI mode and as "fea-
+       ture option=" commands in xboard mode. The latter form an extension of
+       the xboard protocol as defined by H.G. Muller.
 
        Options which normally appear in the [PolyGlot] section of the config
        file (see below) are exported as options with their name prefixed by
@@ -63,10 +64,11 @@ DESCRIPTION
        NOTE: Not all options are exported, only those that make sense in the
        given mode.
 
-   Book making utilities
+       Book making utilities
+
        PolyGlot supports the "PolyGlot opening book format". This is the
-       defacto standard non-proprietary opening book format. It is fully
-       documented here
+       defacto standard non-proprietary opening book format. It is fully docu-
+       mented here
 
        http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
 
@@ -79,13 +81,13 @@ DESCRIPTION
        .abk format are undocumented and proprietary. They can only be used by
        their own GUIs.
 
-       PolyGlot can compile a pgn file into a binary PolyGlot book and
-       furthermore it can merge two such binary books into a third one.
+       PolyGlot can compile a pgn file into a binary PolyGlot book and fur-
+       thermore it can merge two such binary books into a third one.
 
        PolyGlot can also extract some useful information from PolyGlot books.
        The utility "dump-book" dumps the "lines" in a book for a given color.
-       By definition a line is a sequence of moves (from the starting
-       position) in which the given color makes only book moves and the other
+       By definition a line is a sequence of moves (from the starting posi-
+       tion) in which the given color makes only book moves and the other
        color makes arbitrary moves (i.e. not necessarily book moves).
 
        Since a PolyGlot book is built up from positions and not lines there
@@ -109,15 +111,17 @@ DESCRIPTION
        Due to the possibility of transpositions this is not a fool proof
        method.
 
-   Epd test mode
+       Epd test mode
+
        In epd test mode, PolyGlot will search positions in an epd file and
-       record the number of times the right best move was found.  The
-       arguments specify when to stop the search in any given position.
+       record the number of times the right best move was found.  The argu-
+       ments specify when to stop the search in any given position.
+
+       Perft counts
 
-   Perft counts
        A perft count is the number of legal move sequence in a given position
-       up to a given depth. PolyGlot can perform such perft counts. It is
-       however much slower than other more dedicated programs.
+       up to a given depth. PolyGlot can perform such perft counts. It is how-
+       ever much slower than other more dedicated programs.
 
 OPTIONS
        When PolyGlot is invoked as an adapter of in epd-test mode it gets its
@@ -138,26 +142,25 @@ OPTIONS
            The argument is a string of the form <name>=<value>. This option
            will set the engine option <name> to <value>.
 
-       -ec This sets the EngineCommand.
+       -ec This is an alias for -pg "EngineCommand=<value>"
 
-       -ed This sets the EngineDir.
+       -ed This is an alias for -pg "EngineDir=<value>"
 
-       -en This sets the EngineName.
+       -en This is an alias for -pg "EngineName=<value>"
 
-       -hash
-           This is an alias for -uci "Hash=<value>".
-
-       -log
-           This is an alias for -pg "Log=true".
+       -log (default: false)
+           This is an alias for -pg "Log=<value>"
 
        -lf (default: "polyglot.log")
            This is an alias for -pg "LogFile=<value>".
 
-       -bk This is an alias for -pg "Book=true" -pg "BookFile=<value>".
+       -wb (default: "true")
+           This is an alias for -pg "OnlyWbOptions=<value>".
 
        When invoked as
 
-   polyglot make-book
+       polyglot make-book
+
        PolyGlot supports the following options
 
        -pgn (default: "book.pgn")
@@ -190,7 +193,8 @@ OPTIONS
 
        When invoked as
 
-   polyglot merge-book
+       polyglot merge-book
+
        PolyGlot supports the following options
 
        -in1
@@ -208,7 +212,8 @@ OPTIONS
 
        When invoked as
 
-   polyglot dump-book
+       polyglot dump-book
+
        PolyGlot supports the following options
 
        -bin (default: book.bin)
@@ -222,19 +227,21 @@ OPTIONS
 
        When invoked as
 
-   polyglot info-book
+       polyglot info-book
+
        PolyGlot supports the following options
 
        -bin (default: book.bin)
            Input file in PolyGlot book format.
 
        -exact
-           Attempt to count the provably unreachable positions among the
-           isolated ones.  Note that this takes a very long time.
+           Attempt to count the provably unreachable positions among the iso-
+           lated ones.  Note that this takes a very long time.
 
        When invoked as
 
-   polyglot epd-test
+       polyglot epd-test
+
        (possibly with a config file as first argument) PolyGlot supports
        besides the generic options described above the following additional
        options.
@@ -260,7 +267,8 @@ OPTIONS
 
        When invoked as
 
-   polyglot perft
+       polyglot perft
+
        PolyGlot supports the following options
 
        -fen (default: starting position)
@@ -283,12 +291,13 @@ CONFIG FILE FORMAT
 
        The characters "#" and ";" serve as comment characters.
 
-       By default initial and final white space is stripped from option
-       values. If you want to avoid this, or if you want use one of the
-       comment characters # or ; in option values (such as for NalimovPath),
-       enclose the value in quotes.
+       By default initial and final white space is stripped from option val-
+       ues. If you want to avoid this, or if you want use one of the comment
+       characters # or ; in option values (such as for NalimovPath), enclose
+       the value in quotes.
+
+       [PolyGlot] section
 
-   [PolyGlot] section
        This section is used by PolyGlot only.  The engine is unaware of these
        options.  The list of available options is detailed below.
 
@@ -308,6 +317,14 @@ CONFIG FILE FORMAT
            command-line arguments.  Path searching is used and the current
            directory will be "EngineDir".
 
+       SettingsDir (default: $HOME/.polyglot on Linux; ".\_PG" on Windows)
+           The directory where ini files are stored for engines that are
+           started with -noini. Such ini files may be created by pushing the
+           "Save" button in the Engine settings dialog in WB/XB 4.4.0 and
+           higher. As a special exception (for WB/XB 4.4.0 compatibility) this
+           directory is also used in case PolyGlot is started with config
+           files named "polyglot_1st.ini" or "polyglot_2nd.ini".
+
        Log (default: false)
            Whether PolyGlot should log all transactions with the interface and
            the engine.  This should be necessary only to locate problems.
@@ -333,8 +350,8 @@ CONFIG FILE FORMAT
            move are ignored.
 
        ResignScore (default: 600)
-           This is the score in centipawns that will trigger resign
-           "counting".
+           This is the score in centipawns that will trigger resign "count-
+           ing".
 
        ShowPonder (default: true)
            Show search information during engine pondering.  Turning this off
@@ -351,8 +368,8 @@ CONFIG FILE FORMAT
            move).
 
        KibitzCommand (default: "tellall")
-           xboard command to use for kibitzing, normally "tellall" for
-           kibitzing or "tellothers" for whispering.
+           xboard command to use for kibitzing, normally "tellall" for kibitz-
+           ing or "tellothers" for whispering.
 
        KibitzDelay (default: 5)
            How many seconds to wait before starting kibitzing.  This has an
@@ -381,8 +398,8 @@ CONFIG FILE FORMAT
        BookFile (default: book.bin)
            The name of the (binary) book file.  Note that PolyGlot will look
            for it in the directory it was launched from, not in the engine
-           directory.  Of course, full path can be used in which case the
-           current directory does not matter.
+           directory.  Of course, full path can be used in which case the cur-
+           rent directory does not matter.
 
        BookRandom (default: true)
            Select moves according to their weights in the book. If false the
@@ -415,29 +432,19 @@ CONFIG FILE FORMAT
            This a bit vector in which each bit represents the processors that
            a process is allowed to run on. This option works only on Windows.
 
-       Persist (default: true)
-           If true then PolyGlot will implement persistence by loading options
-           from an additional INI file whose name is by default derived from
-           the engine name. At exit PolyGlot will also save its options to
-           this INI file.
-
-       PersistFile (default: <EngineName>.ini)
-           The name of the file from which to take the additional options.  It
-           is probably best to stick with the default. You can safely edit
-           this file, or delete it to restore the default options.
+       OnlyWbOptions (default: true)
+           If true then PolyGlot restricts the options it sends to those that
+           are potentially useful for WinBoard.
 
-       PersistDir (default: $HOME/.polyglot on Linux; ".\Polyglot Settings" on
-       Windows)
-           The directory where the PersistFile is stored.
+       Work arounds
 
-   Work arounds
        Work arounds are identical to options except that they should be used
        only when necessary.  Their purpose is to try to hide problems with
        various software (not just engines).
 
-       IMPORTANT: Any of these work arounds might be removed in future
-       versions of PolyGlot.  You are strongly recommended to contact the
-       author of faulty software and truly fix the problem.
+       IMPORTANT: Any of these work arounds might be removed in future ver-
+       sions of PolyGlot.  You are strongly recommended to contact the author
+       of faulty software and truly fix the problem.
 
        PolyGlot supports the following work arounds:
 
@@ -448,16 +455,16 @@ CONFIG FILE FORMAT
        CanPonder (default: false)
            PolyGlot now conforms to the documented UCI behaviour: the engine
            will be allowed to ponder only if it (the engine) declares the
-           "Ponder" UCI option.  However some engines which can actually
-           ponder do not declare the option.  This work around lets PolyGlot
-           know that they can ponder.
+           "Ponder" UCI option.  However some engines which can actually pon-
+           der do not declare the option.  This work around lets PolyGlot know
+           that they can ponder.
 
        SyncStop (default: false)
-           When a ponder miss occurs, Polyglot interrupts the engine and
-           IMMEDIATELY launches a new search.  While there should be no
-           problem with this, some engines seem confused and corrupt their
-           search board.  "SyncStop" forces PolyGlot to wait for the (now
-           useless) ponder search to finish before launching the new search.
+           When a ponder miss occurs, Polyglot interrupts the engine and IMME-
+           DIATELY launches a new search.  While there should be no problem
+           with this, some engines seem confused and corrupt their search
+           board.  "SyncStop" forces PolyGlot to wait for the (now useless)
+           ponder search to finish before launching the new search.
 
        PromoteWorkAround (default: false)
            Some engines do not specify a promotion piece, e.g. they send
@@ -473,29 +480,15 @@ CONFIG FILE FORMAT
            to the way kibitzing is implemented, KibitzMove is disabled in that
            case.
 
-       WbWorkArounds (default: true)
-           The intention of these options is to provide work arounds for
-           xboard/winboard bugs should they arise.  This one decapitalizes the
-           word Draw in options that contain this word. Some versions of
-           xboard/winboard contain a bug which causes such options to be
-           interpreted as draw claims by the engine.
-
-           Engines that send options with "Draw" in their name are Rybka and
-           HIARCS.
-
-       WbWorkArounds2 (default: false)
-           Old version of Winboard clear the engine output window at depth 1.
-           With this work around PG will send info lines at depth >=2. This
-           may or may not improve the display.
+       [Engine] section
 
-   [Engine] section
        This section contains engine UCI options.  PolyGlot does not understand
        them, but sends the information to the engine at startup (converted to
        UCI form).  You can add any UCI option that makes sense to the engine
        (not just the common options about hash-table size and tablebases).
 
-       NOTE: use INI syntax, not UCI.  For example "OwnBook = true" is
-       correct.  It will be replaced by PolyGlot with "setoption name OwnBook
+       NOTE: use INI syntax, not UCI.  For example "OwnBook = true" is cor-
+       rect.  It will be replaced by PolyGlot with "setoption name OwnBook
        value true" at engine startup.
 
        Standard UCI options are
@@ -559,7 +552,7 @@ AUTHORS
 
        Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
 
-       UCI port, option persistence and new WB protocol: Michel Van den Bergh
+       UCI port and implementation of new WB protocol: Michel Van den Bergh
        <michel.vandenbergh(at)uhasselt.be>
 
 SEE ALSO
@@ -567,4 +560,4 @@ SEE ALSO
 
 
 
-                                  2009-09-05                       POLYGLOT(6)
+                                  2009-09-11                       POLYGLOT(6)
index f32079a..278f9e9 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2008-01-23'
+timestamp='2007-07-22'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -56,8 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -532,7 +532,7 @@ EOF
                echo rs6000-ibm-aix3.2
        fi
        exit ;;
-    *:AIX:*:[456])
+    *:AIX:*:[45])
        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
        if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
                IBM_ARCH=rs6000
@@ -799,9 +799,6 @@ EOF
            EM64T | authenticamd)
                echo x86_64-unknown-interix${UNAME_RELEASE}
                exit ;;
-           IA64)
-               echo ia64-unknown-interix${UNAME_RELEASE}
-               exit ;;
        esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
        echo i${UNAME_MACHINE}-pc-mks
@@ -836,14 +833,7 @@ EOF
        echo ${UNAME_MACHINE}-pc-minix
        exit ;;
     arm*:Linux:*:*)
-       eval $set_cc_for_build
-       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
-           | grep -q __ARM_EABI__
-       then
-           echo ${UNAME_MACHINE}-unknown-linux-gnu
-       else
-           echo ${UNAME_MACHINE}-unknown-linux-gnueabi
-       fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
     avr32*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -964,8 +954,8 @@ EOF
     x86_64:Linux:*:*)
        echo x86_64-unknown-linux-gnu
        exit ;;
-    xtensa*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
+    xtensa:Linux:*:*)
+       echo xtensa-unknown-linux-gnu
        exit ;;
     i*86:Linux:*:*)
        # The BFD linker knows what the default object file format is, so
@@ -1484,9 +1474,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
 and
-  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
index bd86e86..d80095b 100644 (file)
--- a/config.h
+++ b/config.h
 #define PACKAGE_NAME "polyglot"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "polyglot 1.4.46b"
+#define PACKAGE_STRING "polyglot 1.4.50b"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "polyglot"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.4.46b"
+#define PACKAGE_VERSION "1.4.50b"
 
 /* Define to 1 if the C compiler supports function prototypes. */
 #define PROTOTYPES 1
 #define TIME_WITH_SYS_TIME 1
 
 /* Version number of package */
-#define VERSION "1.4.46b"
+#define VERSION "1.4.50b"
 
 /* Define like PROTOTYPES; this can be used by system headers. */
 #define __PROTOTYPES 1
index 6759825..1761d8b 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-#   Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2008-01-16'
+timestamp='2007-06-28'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -369,14 +369,10 @@ case $basic_machine in
        | v850-* | v850e-* | vax-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-       | xstormy16-* | xtensa*-* \
+       | xstormy16-* | xtensa-* \
        | ymp-* \
        | z8k-*)
                ;;
-       # Recognize the basic CPU types without company name, with glob match.
-       xtensa*)
-               basic_machine=$basic_machine-unknown
-               ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
        386bsd)
@@ -447,14 +443,6 @@ case $basic_machine in
                basic_machine=ns32k-sequent
                os=-dynix
                ;;
-       blackfin)
-               basic_machine=bfin-unknown
-               os=-linux
-               ;;
-       blackfin-*)
-               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
-               os=-linux
-               ;;
        c90)
                basic_machine=c90-cray
                os=-unicos
@@ -680,14 +668,6 @@ case $basic_machine in
                basic_machine=m68k-isi
                os=-sysv
                ;;
-       m68knommu)
-               basic_machine=m68k-unknown
-               os=-linux
-               ;;
-       m68knommu-*)
-               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
-               os=-linux
-               ;;
        m88k-omron*)
                basic_machine=m88k-omron
                ;;
@@ -833,14 +813,6 @@ case $basic_machine in
                basic_machine=i860-intel
                os=-osf
                ;;
-       parisc)
-               basic_machine=hppa-unknown
-               os=-linux
-               ;;
-       parisc-*)
-               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
-               os=-linux
-               ;;
        pbd)
                basic_machine=sparc-tti
                ;;
@@ -1049,10 +1021,6 @@ case $basic_machine in
                basic_machine=tic6x-unknown
                os=-coff
                ;;
-       tile*)
-               basic_machine=tile-unknown
-               os=-linux-gnu
-               ;;
        tx39)
                basic_machine=mipstx39-unknown
                ;;
index d03e34c..b5b969a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for polyglot 1.4.46b.
+# Generated by GNU Autoconf 2.61 for polyglot 1.4.50b.
 #
 # Report bugs to <michel.vandenbergh@uhasselt.be>.
 #
@@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='polyglot'
 PACKAGE_TARNAME='polyglot'
-PACKAGE_VERSION='1.4.46b'
-PACKAGE_STRING='polyglot 1.4.46b'
+PACKAGE_VERSION='1.4.50b'
+PACKAGE_STRING='polyglot 1.4.50b'
 PACKAGE_BUGREPORT='michel.vandenbergh@uhasselt.be'
 
 ac_unique_file="mainloop.c"
@@ -1207,7 +1207,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures polyglot 1.4.46b to adapt to many kinds of systems.
+\`configure' configures polyglot 1.4.50b to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1273,7 +1273,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of polyglot 1.4.46b:";;
+     short | recursive ) echo "Configuration of polyglot 1.4.50b:";;
    esac
   cat <<\_ACEOF
 
@@ -1357,7 +1357,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-polyglot configure 1.4.46b
+polyglot configure 1.4.50b
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1371,7 +1371,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by polyglot $as_me 1.4.46b, which was
+It was created by polyglot $as_me 1.4.50b, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2061,7 +2061,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='polyglot'
- VERSION='1.4.46b'
+ VERSION='1.4.50b'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -6848,7 +6848,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by polyglot $as_me 1.4.46b, which was
+This file was extended by polyglot $as_me 1.4.50b, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6901,7 +6901,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-polyglot config.status 1.4.46b
+polyglot config.status 1.4.50b
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
index 7386c1a..2ad1c89 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT([polyglot], [1.4.46b], [michel.vandenbergh@uhasselt.be])
+AC_INIT([polyglot], [1.4.50b], [michel.vandenbergh@uhasselt.be])
 AM_INIT_AUTOMAKE
 AC_CONFIG_SRCDIR([mainloop.c])
 AC_CONFIG_HEADER([config.h])
index 0eb0168..1d4c545 100644 (file)
@@ -1,3 +1,57 @@
+polyglot (1.4.50b) unstable; urgency=low
+
+  * Change in architecture. Persistence is disabled. The user is required to push th "Save" button explicitly to save the settings. What is retained is that in case PG is invoked with -noini (or as a special exception for WB 4.4.0 when the config files are polyglot_1st.ini or polyglot_2nd.ini) then PG uses a default config file whose name is derived from the engine name. 
+
+  * New option: OnlyWbOptions (default: true). Restrict the options that PG sends to those that are potentially useful for WinBoard.
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be>  Fri, 9 Sep 2009 21:00:00 +0100
+       
+polyglot (1.4.46b) unstable; urgency=low
+
+  * The default persistence directory on Windows is now _PG. The names of the engine specific ini files are mangled so as not to contain spaces. 
+       
+  * PG now tries to guess if a string option is really a file or a path (like in the Arena GUI). 
+       
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be>  Fri, 4 Sep 2009 21:00:00 +0100
+
+polyglot (1.4.45b) unstable; urgency=low
+
+  * The engine specific config files (<myname>.ini) are now stored in a separate directory. $HOME/.polyglot on Linux and "./Polyglot Settings" on Windows. 
+       
+  * The engine specific config files are now complete config files. So they can be used in a stand alone fashion.
+
+  * Implemented a minor hack to make xboard show error messages during startup.
+       
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be>  Fri, 4 Sep 2009 21:00:00 +0100
+
+polyglot (1.4.44b) unstable; urgency=low
+
+  * "Implementation" of new buttons and controls.
+       
+  * The "Persist" option is now persistent. That is if you turn of "Persist" then as a special case PG will remember this.
+       
+  * There is now a "reset" button which restores the default options. The code is commented out since WB does not support it yet.
+       
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be>  Thu, 3 Sep 2009 21:00:00 +0100
+
+polyglot (1.4.42b) unstable; urgency=low
+
+  * SaveSettingsOnExit/SaveFile renamed as Persist/PersistFile.
+       
+  * Many bug fixes in the persistence feature.
+       
+  * The PG_<myname>.ini file now contains only options that have been changed. So the resulting ini files are much smaller. This makes this version of PG usable on WB 4.3.15 as now the engine specific ini file will be empty (the user has no way to change options).       
+       
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be>  Mon, 1 Sep 2009 21:00:00 +0100
+
+polyglot (1.4.41b) unstable; urgency=low
+       
+  * Some segfaults fixed in case of corrupt config files.
+       
+  * Persistence of options. If the option SaveSettingsOnExit is true (the default) PolyGlot now saves its options in a file whose name is given by the option SaveFile which by default is equal to the engine name, prefixed by PG_ suffixed by ".ini".
+       
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be>  Sun, 31 Aug 2009 21:00:00 +0100
+
 polyglot (1.4.39b) unstable; urgency=low
        
   * Refactoring of config file parsing
index 0bc7c99..d93b7da 100644 (file)
@@ -1 +1 @@
-polyglot_1.4.39b_i386.deb games extra
+polyglot_1.4.50b_i386.deb games extra
diff --git a/main.c b/main.c
index aaadc82..830dfa2 100644 (file)
--- a/main.c
+++ b/main.c
@@ -39,7 +39,7 @@
 // constants\r
 \r
 \r
-static const char * const Version = "1.4.46b";\r
+static const char * const Version = "1.4.50b";\r
 static const char * const HelpMessage = "\\r
 SYNTAX\n\\r
 * polyglot [configfile] [-noini] [-ec engine] [-ed enginedirectory] [-en enginename] [-log] [-lf logfile] [-hash value] [-bk book] [-pg <name>=<value>]* [-uci <name>=<value>]*\n\\r
@@ -55,29 +55,12 @@ static const int SearchDepth = 63;
 static const double SearchTime = 3600.0;\r
 static const int StringSize = 4096;\r
 \r
-static const char * const IniIntro=\r
-              "; This ini file is used internally by PolyGlot\n"\r
-              "; to remember the settings for the UCI engine\n"\r
-              "; whose name is \"%s\".\n"\r
-              "\n"\r
-              "; The values for these settings would be typicallly\n"\r
-              "; obtained from the engine settings dialog\n"\r
-              "; in WinBoard/xboard 4.4.0 and higher.\n"\r
-              "\n" \r
-              "; If the value of the option \"Persist\" is false\n"\r
-              "; then the content of this file is ignored.\n"\r
-              "\n"\r
-              "; It is allowed to manually edit this file\n"\r
-              "; and you may safely delete it as well.\n"\r
-              "\n";\r
-\r
 // variables\r
 \r
 static bool Init;\r
 \r
 // prototypes\r
 \r
-static void init_book ();\r
 static void stop_search  ();\r
 \r
 // functions\r
@@ -91,34 +74,108 @@ static void arg_shift_left(char **argv, int index){
     }\r
 }\r
 \r
+// parse_args()\r
+\r
+static void parse_args(ini_t *ini, char **argv){\r
+    int arg_index;\r
+    char *arg;\r
+    arg_index=0;\r
+    while((arg=argv[arg_index])){\r
+        if(my_string_equal(arg,"-ec") && argv[arg_index+1]){\r
+            ini_insert_ex(ini,"PolyGlot","EngineCommand",argv[arg_index+1]);\r
+            arg_shift_left(argv,arg_index);\r
+            arg_shift_left(argv,arg_index);\r
+            continue;\r
+        }if(my_string_equal(arg,"-ed") && argv[arg_index+1]){\r
+            ini_insert_ex(ini,"PolyGlot","EngineDir",argv[arg_index+1]);\r
+            arg_shift_left(argv,arg_index);\r
+            arg_shift_left(argv,arg_index);\r
+            continue;\r
+        }\r
+        if(my_string_equal(arg,"-en") && argv[arg_index+1]){\r
+            ini_insert_ex(ini,"PolyGlot","EngineName",argv[arg_index+1]);\r
+            arg_shift_left(argv,arg_index);\r
+            arg_shift_left(argv,arg_index);\r
+            continue;\r
+        }\r
+        if(my_string_equal(arg,"-log") &&\r
+           argv[arg_index+1] &&\r
+           IS_BOOL(argv[arg_index+1])){\r
+            ini_insert_ex(ini,\r
+                          "PolyGlot",\r
+                          "Log",\r
+                          TO_BOOL(argv[arg_index+1])?"true":"false");\r
+            arg_shift_left(argv,arg_index);\r
+            arg_shift_left(argv,arg_index);\r
+            continue;\r
+        }\r
+        if(my_string_equal(arg,"-lf") && argv[arg_index+1]){\r
+            ini_insert_ex(ini,"PolyGlot","LogFile",argv[arg_index+1]);\r
+            arg_shift_left(argv,arg_index);\r
+            arg_shift_left(argv,arg_index);\r
+            continue;\r
+        }\r
+        if(my_string_equal(arg,"-wb") &&\r
+           argv[arg_index+1]&&\r
+           IS_BOOL(argv[arg_index+1])){\r
+               ini_insert_ex(ini,"PolyGlot",\r
+                             "OnlyWbOptions",\r
+                             TO_BOOL(argv[arg_index+1])?"true":"false");\r
+               arg_shift_left(argv,arg_index);\r
+               arg_shift_left(argv,arg_index);\r
+               continue;\r
+        }\r
+        if((my_string_equal(arg,"-pg")||my_string_equal(arg,"-uci")) &&\r
+           argv[arg_index+1]){\r
+            int ret;\r
+            char section[StringSize];\r
+            char name[StringSize];\r
+            char value[StringSize];\r
+            ret=ini_line_parse(argv[arg_index+1],section,name,value);\r
+            if(ret==NAME_VALUE){\r
+                if(my_string_equal(arg,"-pg")){\r
+                    ini_insert_ex(ini,"PolyGlot",name,value);\r
+                }else{\r
+                    ini_insert_ex(ini,"Engine",name,value);\r
+                }\r
+            }\r
+            arg_shift_left(argv,arg_index);\r
+            arg_shift_left(argv,arg_index);\r
+            continue;\r
+        }\r
+        arg_index++;\r
+    }\r
+}\r
+\r
 \r
 // make_ini()\r
 \r
 static void make_ini(ini_t *ini){\r
     option_t *opt;\r
-    char tmp[StringSize];\r
-    ini_insert_ex(ini,"polyglot",\r
-                 "EngineName",\r
-                 option_get_string(Option,"EngineName"));\r
     ini_insert_ex(ini,"polyglot",\r
                  "EngineCommand",\r
-                 option_get_string(Option,"EngineCommand"));\r
+                 option_get(Option,"EngineCommand"));\r
     ini_insert_ex(ini,"polyglot",\r
                  "EngineDir",\r
-                 option_get_string(Option,"EngineDir"));\r
+                 option_get(Option,"EngineDir"));\r
     option_start_iter(Option);\r
     while((opt=option_next(Option))){\r
-        if(!my_string_equal(opt->value,opt->default_)&&\r
-           !IS_BUTTON(opt->type) &&\r
-           (opt->mode & XBOARD)){\r
-         ini_insert_ex(ini,"polyglot",opt->name,opt->value);\r
+        if(my_string_case_equal(opt->name,"SettingsFile")) continue;\r
+        if(my_string_case_equal(opt->name,"EngineCommand")) continue;\r
+        if(my_string_case_equal(opt->name,"EngineDir")) continue;\r
+        if(!my_string_equal(opt->value,opt->default_)&& !IS_BUTTON(opt->type))\r
+        {\r
+            ini_insert_ex(ini,"polyglot",opt->name,opt->value);\r
         }\r
     }\r
     option_start_iter(Uci->option);\r
     while((opt=option_next(Uci->option))){\r
+        if(!strncmp(opt->name,"UCI_",4) &&\r
+            !my_string_case_equal(opt->name,"UCI_LimitStrength") &&\r
+            !my_string_case_equal(opt->name,"UCI_Elo"))continue;\r
         if(!my_string_equal(opt->value,opt->default_)&&\r
            !IS_BUTTON(opt->type)){\r
-         ini_insert_ex(ini,"engine",opt->name,opt->value);\r
+            ini_insert_ex(ini,"engine",opt->name,opt->value);\r
         }\r
     }\r
 }\r
@@ -128,27 +185,32 @@ static void make_ini(ini_t *ini){
 \r
 static void write_ini(const char *filename,\r
                         ini_t *ini){\r
+    const char *quote;\r
     ini_entry_t *entry;\r
     char tmp[StringSize];\r
     FILE *f;\r
     time_t t=time(NULL);\r
     f=fopen(filename,"w");\r
     if(!f){\r
-      // alas this does nothing....\r
       gui_send(GUI,"tellusererror write_ini(): %s: %s.",filename,strerror(errno));\r
-      // but at least we log the error\r
       my_log("POLYGLOT write_ini(): %s: %s.\n",filename,strerror(errno));\r
       return;\r
     }\r
-    fprintf(f,"; %s\n",ctime(&t));\r
-    fprintf(f,IniIntro,option_get_string(Option,"EngineName"));\r
+    fprintf(f,"; Created: %s\n",ctime(&t));\r
     fprintf(f,"[PolyGlot]\n");\r
     ini_start_iter(ini);\r
     while((entry=ini_next(ini))){\r
       if(my_string_case_equal(entry->section,"polyglot")){\r
-       snprintf(tmp,sizeof(tmp),"%s=%s\n",\r
-                entry->name,\r
-                entry->value);\r
+          if(strchr(entry->value,';')|| strchr(entry->value,'#')|| strchr(entry->value,'"')){\r
+              quote="\"";\r
+          }else{\r
+              quote="";\r
+          }\r
+          snprintf(tmp,sizeof(tmp),"%s=%s%s%s\n",\r
+                   entry->name,\r
+                   quote,\r
+                   entry->value,\r
+                   quote);\r
        tmp[sizeof(tmp)-1]='\0';\r
        fprintf(f,"%s",tmp);\r
       }\r
@@ -156,10 +218,17 @@ static void write_ini(const char *filename,
     fprintf(f,"[Engine]\n");\r
     ini_start_iter(ini);\r
     while((entry=ini_next(ini))){\r
-      if(my_string_case_equal(entry->section,"engine")){\r
-       snprintf(tmp,sizeof(tmp),"%s=%s\n",\r
-                entry->name,\r
-                entry->value);\r
+        if(my_string_case_equal(entry->section,"engine")){\r
+            if(strchr(entry->value,';')|| strchr(entry->value,'#')|| strchr(entry->value,'"')){\r
+                quote="\"";\r
+            }else{\r
+                quote="";\r
+            }\r
+            snprintf(tmp,sizeof(tmp),"%s=%s%s%s\n",\r
+                     entry->name,\r
+                     quote,\r
+                     entry->value,\r
+                     quote);\r
        tmp[sizeof(tmp)-1]='\0';\r
        fprintf(f,"%s",tmp);\r
       }\r
@@ -167,22 +236,47 @@ static void write_ini(const char *filename,
     fclose(f);\r
 }\r
 \r
+// welcome_message()\r
+\r
+void welcome_message(char *buf){\r
+    if(!DEBUG){\r
+        sprintf(buf,\r
+                "PolyGlot %s by Fabien Letouzey.\n",\r
+                Version);\r
+    }else{\r
+        sprintf(buf,\r
+                "PolyGlot %s by Fabien Letouzey (debug build).\n",\r
+                Version);\r
+    }\r
+}\r
+\r
+int wb_select(){\r
+    option_t *opt;\r
+    option_start_iter(Option);\r
+    while((opt=option_next(Option))){\r
+        opt->mode&=~XBOARD;\r
+        if(opt->mode & XBSEL){\r
+            opt->mode|=XBOARD; \r
+        }\r
+    }\r
+}\r
 \r
 // main()\r
 \r
 int main(int argc, char * argv[]) {\r
-    ini_t ini[1],ini_save[1];\r
+    ini_t ini[1], ini_command[1];\r
     ini_entry_t *entry;\r
     char *arg;\r
     int arg_index;\r
-    bool NoIni, Persist;\r
-    char persist_path[StringSize];\r
+    bool NoIni;\r
+    option_t *opt;\r
+    char welcome[StringSize];\r
+\r
+\r
+    welcome_message(welcome);\r
  \r
-    if(!DEBUG){\r
-        printf("PolyGlot %s by Fabien Letouzey.\n",Version);\r
-    }else{\r
-        printf("PolyGlot %s by Fabien Letouzey (debug build).\n",Version);\r
-    }\r
+    printf("%s",welcome);\r
+\r
 \r
     if(argc>=2 && ((my_string_case_equal(argv[1],"help")) || (my_string_case_equal(argv[1],"-help")) || (my_string_case_equal(argv[1],"--help")) ||  (my_string_case_equal(argv[1],"-h")) ||  my_string_case_equal(argv[1],"/?"))){\r
         printf("%s\n",HelpMessage);\r
@@ -205,9 +299,9 @@ int main(int argc, char * argv[]) {
     my_random_init();\r
 \r
     ini_init(ini);\r
-    ini_init(ini_save);\r
+    ini_init(ini_command);\r
 \r
-        // book utilities\r
+        // book utilities: do not touch these\r
     \r
     if (argc >= 2 && my_string_equal(argv[1],"make-book")) {\r
         book_make(argc,argv);\r
@@ -235,9 +329,6 @@ int main(int argc, char * argv[]) {
         do_perft(argc,argv);\r
         return EXIT_SUCCESS;\r
     }\r
-\r
-        // TODO: If logging is enabled on the command line turn it on NOW\r
-        // and do not allow it to be overridden later. \r
     \r
         // What is the config file? This is very hacky right now.\r
 \r
@@ -252,8 +343,9 @@ int main(int argc, char * argv[]) {
         }\r
     }\r
     arg_shift_left(argv,arg_index-1);\r
+    parse_args(ini_command,argv+1);\r
     if(NoIni){\r
-        option_set(Option,"OptionFile","<empty>");\r
+        option_set(Option,"SettingsFile","<empty>");\r
     }\r
 \r
         // Ok see if first argument looks like config file\r
@@ -261,7 +353,7 @@ int main(int argc, char * argv[]) {
     if(argv[1] && !my_string_equal(argv[1],"epd-test") && !(argv[1][0]=='-')){\r
                 // first argument must be  config file\r
         if(!NoIni){\r
-            option_set(Option,"OptionFile",argv[1]);\r
+            option_set(Option,"SettingsFile",argv[1]);\r
         }else{\r
                 // ignore\r
         }\r
@@ -270,33 +362,59 @@ int main(int argc, char * argv[]) {
             // Config file is the default.\r
             // This has already been set above or in "option_init_pg()"\r
     }\r
-    \r
+\r
+\r
 \r
         // if we use a config file: load it!\r
     \r
-    if(!my_string_equal(option_get_string(Option,"OptionFile"),"<empty>")){\r
-        if(ini_parse(ini,option_get_string(Option,"OptionFile"))){\r
+    if(!my_string_equal(option_get_string(Option,"SettingsFile"),"<empty>")){\r
+        if(ini_parse(ini,option_get_string(Option,"SettingsFile"))){\r
             my_fatal("main(): Can't open file \"%s\": %s\n",\r
-                   option_get_string(Option,"OptionFile"),\r
+                   option_get_string(Option,"SettingsFile"),\r
                    strerror(errno));\r
         }\r
     }\r
-        // remind the reader of what options are in effect\r
 \r
-    my_log("POLYGLOG Options from ini file\n");\r
-    ini_disp(ini);\r
+        // Extract some important options\r
 \r
-        // extract PG options\r
+    if((entry=ini_find(ini,"polyglot","EngineCommand"))){\r
+        option_set(Option,entry->name,entry->value);\r
+    }\r
+    if((entry=ini_find(ini,"polyglot","EngineDir"))){\r
+        option_set(Option,entry->name,entry->value);\r
+    }\r
+    if((entry=ini_find(ini,"polyglot","EngineName"))){\r
+        option_set(Option,entry->name,entry->value);\r
+    }\r
+    if((entry=ini_find(ini,"polyglot","Log"))){\r
+        polyglot_set_option(entry->name,entry->value);\r
+    }\r
+    if((entry=ini_find(ini,"polyglot","LogFile"))){\r
+        polyglot_set_option(entry->name,entry->value);\r
+    }\r
     \r
-    ini_start_iter(ini);\r
-    while((entry=ini_next(ini))){\r
-        if(my_string_case_equal(entry->section,"polyglot")){\r
-            option_set(Option,entry->name,entry->value);\r
-            option_set_default(Option,entry->name,entry->value);\r
+        // Concession to WB 4.4.0\r
+        // Treat "polyglot_1st.ini" and "polyglot_2nd.ini" specially\r
+\r
+    if(option_get_bool(Option,"WbWorkArounds3")){\r
+        const char *SettingsFile=option_get(Option,"SettingsFile");\r
+        if(strstr(SettingsFile,"polyglot_1st.ini")||\r
+           strstr(SettingsFile,"polyglot_2nd.ini")){\r
+            option_set(Option,"SettingsFile","<empty>");\r
         }\r
     }\r
 \r
-        // start logging if required\r
+        // Look at command line for logging option. It is important\r
+        // to start logging as soon as possible.\r
+\r
+     if((entry=ini_find(ini_command,"PolyGlot","Log"))){\r
+         option_set(Option,entry->name,entry->value);\r
+    }\r
+    if((entry=ini_find(ini_command,"PolyGlot","LogFile"))){\r
+        option_set(Option,entry->name,entry->value);\r
+    }\r
+    \r
+       // start logging if required\r
     \r
     if (option_get_bool(Option,"Log")) {\r
         my_log_open(option_get_string(Option,"LogFile"));\r
@@ -304,41 +422,24 @@ int main(int argc, char * argv[]) {
 \r
         // log welcome stuff\r
     \r
-    if(!DEBUG){\r
-        my_log("PolyGlot %s by Fabien Letouzey\n",Version);\r
-    }else{\r
-        my_log("PolyGlot %s by Fabien Letouzey (debug build)\n",Version);\r
-    }    \r
+    my_log("%s",welcome);\r
     my_log("POLYGLOT *** START ***\n");\r
-    my_log("POLYGLOT INI file \"%s\"\n",option_get_string(Option,"OptionFile"));\r
+    if(!my_string_equal(option_get_string(Option,"SettingsFile"),"<empty>")){\r
+        my_log("POLYGLOT INI file \"%s\"\n",option_get_string(Option,"SettingsFile"));\r
+    }\r
 \r
-        // open book (presumably this should go else where)\r
-    \r
-    init_book();\r
 \r
         // scavenge command line for options necessary to start the engine\r
-    \r
-    arg_index=1;\r
-    while((arg=argv[arg_index])){\r
-        if(my_string_equal(arg,"-ec") && argv[arg_index+1]){\r
-            option_set(Option,"EngineCommand",argv[arg_index+1]);\r
-            arg_shift_left(argv,arg_index);\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
-        }\r
-        if(my_string_equal(arg,"-ed") && argv[arg_index+1]){\r
-            option_set(Option,"EngineDir",argv[arg_index+1]);\r
-            arg_shift_left(argv,arg_index);\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
-        }\r
-        if(my_string_equal(arg,"-en") && argv[arg_index+1]){\r
-            option_set(Option,"EngineName",argv[arg_index+1]);\r
-            arg_shift_left(argv,arg_index);\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
-        }\r
-        arg_index++;\r
+\r
+\r
+    if((entry=ini_find(ini_command,"PolyGlot","EngineCommand"))){\r
+        option_set(Option,entry->name,entry->value);\r
+    }\r
+    if((entry=ini_find(ini_command,"PolyGlot","EngineDir"))){\r
+        option_set(Option,entry->name,entry->value);\r
+    }\r
+    if((entry=ini_find(ini_command,"PolyGlot","EngineName"))){\r
+        option_set(Option,entry->name,entry->value);\r
     }\r
 \r
         // start engine\r
@@ -359,130 +460,76 @@ int main(int argc, char * argv[]) {
     \r
     uci_open(Uci,Engine);\r
 \r
-        // get engine name from engine if not supplied in config file\r
-    \r
+    option_set_default(Option,"EngineName",Uci->name);\r
+\r
+        // get engine name from engine if not supplied in config file or on\r
+        // the command line\r
+\r
     if (my_string_equal(option_get_string(Option,"EngineName"),"<empty>")) {\r
         option_set(Option,"EngineName",Uci->name);\r
     }\r
 \r
-        // what is the name of the persist file?\r
 \r
-    if(my_string_equal(option_get_string(Option,"PersistFile"),"<empty>")){\r
+        // In the case we have been invoked with NoIni or StandardIni\r
+        // we still have to load a config file.\r
+\r
+    if(my_string_equal(option_get_string(Option,"SettingsFile"),"<empty>")){\r
+\r
+            //  construct the name of the ConfigFile from the EngineName\r
+        \r
         char tmp[StringSize];\r
-       int i;\r
+        char option_file[StringSize];\r
+        int i;\r
         snprintf(tmp,sizeof(tmp),"%s.ini",\r
                  option_get_string(Option,"EngineName"));\r
         tmp[sizeof(tmp)-1]='\0';\r
-       for(i=0;i<strlen(tmp);i++){\r
-         if(tmp[i]==' '){\r
-           tmp[i]='_';\r
-         }\r
-       }\r
-        option_set(Option,"PersistFile",tmp);\r
+        for(i=0;i<strlen(tmp);i++){\r
+            if(tmp[i]==' '){\r
+                tmp[i]='_';\r
+            }\r
+        }\r
+        my_path_join(option_file,\r
+                     option_get_string(Option,"SettingsDir"),\r
+                     tmp);\r
+    // Load the config file\r
+        option_set(Option,"SettingsFile",option_file);\r
+\r
+        my_log("POLYGLOT INI file \"%s\"\n",option_get_string(Option,"SettingsFile"));\r
+        if(ini_parse(ini,option_file)){\r
+            my_log("POLYGLOT Unable to open %s\n",\r
+                   option_get_string(Option,"SettingsFile")); \r
+        }\r
     }\r
 \r
-    // Load the persist file\r
 \r
-    my_path_join(persist_path,\r
-                 option_get_string(Option,"PersistDir"),\r
-                 option_get_string(Option,"PersistFile"));\r
+    // Parse the command line and merge remaining options.\r
 \r
-    my_log("POLYGLOT PersistFile=%s\n",persist_path);   \r
-    if(ini_parse(ini_save,persist_path)){\r
-      my_log("POLYGLOT Unable to open PersistFile\n"); \r
+    ini_start_iter(ini_command);\r
+    while((entry=ini_next(ini_command))){\r
+        ini_insert(ini,entry);\r
     }\r
 \r
-    // Do we want to use the persist file?\r
-\r
-    entry=ini_find(ini_save,"polyglot","Persist");\r
-    if(!entry){\r
-      Persist=option_get_bool(Option,"Persist");\r
-    }else{\r
-      Persist=(my_string_case_equal(entry->value,"false") || \r
-              my_string_equal(entry->value,"0"))?FALSE:TRUE;\r
-    }\r
-\r
-    // if "Persist" now happens to be false, forget about the\r
-    // persist file    \r
-\r
-    if(!Persist){\r
-      my_log("POLYGLOT Ignoring PersistFile");\r
-      ini_clear(ini_save);\r
-    }\r
+        // Remind the reader about the options that are now in effect.\r
 \r
-    option_set(Option,"Persist",Persist?"true":"false");\r
-\r
-    // parse the command line and merge remaining options\r
+    my_log("POLYGLOG OPTIONS \n");\r
+    ini_disp(ini);\r
 \r
-    arg_index=1;\r
-    while((arg=argv[arg_index])){\r
-        if(my_string_equal(arg,"-log")){\r
-            ini_insert_ex(ini_save,"PolyGlot","Log","true");\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
-        }\r
-        if(my_string_equal(arg,"-lf") && argv[arg_index+1]){\r
-            ini_insert_ex(ini_save,"PolyGlot","LogFile",argv[arg_index+1]);\r
-            arg_shift_left(argv,arg_index);\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
-        }\r
-        if(my_string_equal(arg,"-hash") && argv[arg_index+1]){\r
-            ini_insert_ex(ini_save,"Engine","Hash",argv[arg_index+1]);\r
-            arg_shift_left(argv,arg_index);\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
-        }\r
-        if(my_string_equal(arg,"-bk") && argv[arg_index+1]){\r
-            ini_insert_ex(ini_save,"PolyGlot","Book","true");\r
-            ini_insert_ex(ini_save,"PolyGlot","BookFile",argv[arg_index+1]);\r
-            arg_shift_left(argv,arg_index);\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
-        }\r
-        if((my_string_equal(arg,"-pg")||my_string_equal(arg,"-uci")) &&\r
-           argv[arg_index]){\r
-            int ret;\r
-            char section[StringSize];\r
-            char name[StringSize];\r
-            char value[StringSize];\r
-            ret=ini_line_parse(argv[arg_index++],section,name,value);\r
-            if(ret==NAME_VALUE){\r
-                if(my_string_equal(arg,"-pg")){\r
-                    ini_insert_ex(ini_save,"PolyGlot",name,value);\r
-                }else{\r
-                    ini_insert_ex(ini_save,"Engine",name,value);\r
-                }\r
+            // extract PG options\r
+    \r
+    ini_start_iter(ini);\r
+    while((entry=ini_next(ini))){\r
+        if(my_string_case_equal(entry->section,"polyglot")){\r
+            opt=option_find(Option,entry->name);\r
+            if(opt && !IS_BUTTON(opt->type)){\r
+                polyglot_set_option(entry->name,entry->value);\r
             }\r
-            arg_shift_left(argv,arg_index);\r
-            arg_shift_left(argv,arg_index);\r
-            continue;\r
         }\r
-        arg_index++;\r
     }\r
 \r
-        // remind the reader once again about options\r
-\r
-    my_log("POLYGLOG Options from PersistFile and command line\n");\r
-    ini_disp(ini_save);\r
-\r
-        // Extract PG options; this time do not set the default.\r
-        // polyglot_set_option() performs the necessary actions such\r
-        // as opening the log file/opening book etcetera.\r
-        // Ignore EngineName, EngineCommand and EngineDir\r
-        // as these are really meant as comments.\r
+        // Cater to our biggest customer:-)\r
     \r
-    ini_start_iter(ini_save);\r
-    while((entry=ini_next(ini_save))){\r
-        if(my_string_case_equal(entry->section,"polyglot")){\r
-           if(my_string_case_equal(entry->value,"EngineName")) \r
-              continue;\r
-           if(my_string_case_equal(entry->value,"EngineCommand")) \r
-              continue;\r
-           if(my_string_case_equal(entry->value,"EngineDir")) \r
-              continue;\r
-            polyglot_set_option(entry->name,entry->value);\r
-        }\r
+    if(option_get_bool(Option,"OnlyWbOptions")){\r
+        wb_select();\r
     }\r
 \r
         // done initializing\r
@@ -496,8 +543,6 @@ int main(int argc, char * argv[]) {
         if(my_string_case_equal(entry->section,"engine")){\r
                 // also updates value in Uci->option\r
             uci_send_option(Uci,entry->name,"%s",entry->value);\r
-                // since this comes from the ini file, also update default\r
-            option_set_default(Uci->option,entry->name,entry->value);\r
                 // this is inherited, it probably does not work correctly\r
            if(my_string_case_equal(entry->name,"MultiPV") &&\r
               atoi(entry->value)>1){\r
@@ -505,19 +550,8 @@ int main(int argc, char * argv[]) {
            }\r
         }\r
     }\r
-    ini_start_iter(ini_save);\r
-    while((entry=ini_next(ini_save))){\r
-        if(my_string_case_equal(entry->section,"engine")){\r
-                // also updates value in Uci->option\r
-            uci_send_option(Uci,entry->name,"%s",entry->value);\r
-                // this is inherited, it probably does not work correctly\r
-            if(my_string_case_equal(entry->name,"MultiPV") &&\r
-               atoi(entry->value)>1){\r
-                Uci->multipv_mode=TRUE;\r
-            }\r
-        }\r
-    }\r
-   \r
+\r
+    \r
     \r
         // EPD test\r
     \r
@@ -529,12 +563,16 @@ int main(int argc, char * argv[]) {
     }\r
     \r
         // Anything that hasn't been parsed yet is a syntax error\r
+        // It seems that XBoard sometimes passes empty strings as arguments\r
+        // to PolyGlot. We ignore these. \r
 \r
-    if(argv[1]){\r
-        my_fatal("main(): Unknown option: %s\n",argv[1]);\r
+    argc=1;\r
+    while((arg=argv[argc++])){\r
+        if(!my_string_equal(arg,"")){\r
+            my_fatal("main(): Option: \"%s\" not found\n",argv[argc-1]);\r
+        }\r
     }\r
 \r
-\r
     gui_init(GUI);\r
     mainloop();\r
     return EXIT_SUCCESS; \r
@@ -543,24 +581,27 @@ int main(int argc, char * argv[]) {
 // polyglot_set_option()\r
 \r
 void polyglot_set_option(const char *name, const char *value){ // this must be cleaned up!\r
-    option_t *opt;\r
+    ini_t ini[1];\r
+    int ret;\r
+    ini_init(ini);\r
     my_log("POLYGLOT Setting PolyGlot option %s=\"%s\"\n",name,value);\r
-    if(my_string_case_equal(name,"Defaults")){\r
-      option_start_iter(Uci->option);\r
-      while((opt=option_next(Uci->option))){\r
-       if(!IS_BUTTON(opt->type)){\r
-       // also sets opt->value\r
-         uci_send_option(Uci,opt->name,opt->default_);\r
-       }\r
-      }\r
-      option_start_iter(Option);\r
-      while((opt=option_next(Option))){\r
-       if(!IS_BUTTON(opt->type)){\r
-         polyglot_set_option(opt->name,opt->default_);\r
-       }\r
-      }\r
-      xboard2uci_send_options();\r
-    }\r
+    if(my_string_case_equal(name,"Save")){\r
+        ret=my_mkdir(option_get(Option,"SettingsDir"));\r
+        if(ret){\r
+            my_log("POLYGLOT polyglot_set_option(): %s: %s\n",\r
+                   option_get(Option,"SettingsDir"),\r
+                   strerror(errno));\r
+        }\r
+        make_ini(ini);\r
+        write_ini(option_get(Option,"SettingsFile"),ini);\r
+        return;\r
+    }\r
+//    if(my_string_equal(option_get(Option,name),value)){\r
+//        my_log("Not setting PolyGlot option \"%s\" "\r
+//               "since it already as the correct value.\n",\r
+//               name);\r
+//        return;\r
+//    }\r
     option_set(Option,name,value);\r
     if(option_get_bool(Option,"Book")&&(my_string_case_equal(name,"BookFile")||my_string_case_equal(name,"Book"))){\r
         my_log("POLYGLOT *** SETTING BOOK ***\n");\r
@@ -573,7 +614,7 @@ void polyglot_set_option(const char *name, const char *value){ // this must be c
         }\r
     }else if(option_get_bool(Option,"Log")&&(my_string_case_equal(name,"LogFile") ||my_string_case_equal(name,"Log"))){\r
         my_log("POLYGLOT *** SWITCHING LOGFILE ***\n");\r
-        my_log("POLYGLOT LOGFILE \"%s\"\n",option_get_string(Option,"LogFile"));\r
+        my_log("POLYGLOT NEW LOGFILE \"%s\"\n",option_get_string(Option,"LogFile"));\r
         my_log_close();\r
         my_log_open(option_get_string(Option,"LogFile"));\r
     }else if(option_get_bool(Option,"UseNice") &&(my_string_case_equal(name,"NiceValue")||my_string_case_equal(name,"UseNice"))){\r
@@ -592,32 +633,11 @@ void polyglot_set_option(const char *name, const char *value){ // this must be c
 }\r
 \r
 \r
-// init_book()\r
-\r
-static void init_book(){\r
-    book_clear();\r
-    if (option_get_bool(Option,"Book")){\r
-        my_log("POLYGLOT *** SETTING BOOK ***\n");\r
-        my_log("POLYGLOT BOOK \"%s\"\n",option_get_string(Option,"BookFile"));\r
-        book_open(option_get_string(Option,"BookFile"));\r
-        if(!book_is_open()){\r
-            my_log("POLYGLOT Unable to open book \"%s\"\n",\r
-                   option_get_string(Option,"BookFile"));\r
-        }\r
-    }\r
-}\r
-\r
 \r
 // quit()\r
 \r
 void quit() {\r
 \r
-    ini_t ini[1];\r
-    char persist_path[StringSize];\r
-    int ret;\r
-\r
-    ini_init(ini);\r
-\r
     my_log("POLYGLOT *** QUIT ***\n");\r
     \r
     if (Init) {\r
@@ -628,34 +648,7 @@ void quit() {
         engine_close(Engine);\r
         \r
     }\r
-    ret=my_mkdir(option_get(Option,"PersistDir"));\r
-    if(ret){\r
-      my_log("POLYGLOT quit(): %s: %s\n",option_get(Option,"PersistDir"),strerror(errno));\r
-    }\r
-    // PersistFile can be named "<empty>" in case of a crash before the\r
-    // engine is started. \r
-    if(!my_string_case_equal(option_get(Option,"PersistFile"),\r
-                            "<empty>")){\r
-      // Persistence should only work in XBOARD mode.\r
-      // In UCI mode the GUI is responsible for remembering options.\r
-      if(!option_get_bool(Option,"UCI")){\r
-       my_path_join(persist_path,\r
-                    option_get(Option,"PersistDir"),\r
-                    option_get(Option,"PersistFile"));\r
-       make_ini(ini);\r
-       if(option_get_bool(Option,"Persist")){\r
-         write_ini(persist_path,ini);\r
-       }else if(!my_string_case_equal(option_get_default(Option,"Persist"),\r
-                                      option_get_string(Option,"Persist"))){\r
-         // Hack\r
-         ini_insert_ex(ini,"polyglot","Persist","false");\r
-         write_ini(persist_path,ini);\r
-       }else{\r
-         write_ini(persist_path,ini);\r
-       }\r
        my_log("POLYGLOT Calling exit\n");\r
-      }\r
-    }\r
     exit(EXIT_SUCCESS);\r
 }\r
 \r
@@ -679,5 +672,5 @@ static void stop_search() {
 }\r
 \r
 \r
-// end of main.cpp\r
+// end of main.c\r
 \r
index 0052fe3..e415b5b 100644 (file)
--- a/option.c
+++ b/option.c
@@ -9,6 +9,11 @@
 #include "option.h"\r
 #include "util.h"\r
 \r
+\r
+// defines\r
+\r
+#define NNB { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }\r
+\r
 // constants\r
 \r
 static const bool UseDebug = FALSE;\r
@@ -16,44 +21,41 @@ static const int  StringSize = 4096;
 \r
 // variables\r
 \r
-#define NNB { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }\r
 \r
 option_list_t Option[1];\r
 \r
 option_t DefaultOptions[] = {    \r
-    { "OptionFile",       "file","0","0",     "polyglot.ini", NULL,0,NNB,  PG}, \r
-\r
    // options\r
 \r
-    { "Persist",          "check","0","0",      "true"      , NULL,0,NNB,  PG|XBOARD},\r
-    { "PersistFile",      "file","0","0",     "<empty>"   , NULL,0,NNB,  PG},\r
-    { "PersistDir",       "path","0","0",     "<empty>"   , NULL,0,NNB,  PG},\r
-    \r
+    { "SettingsFile",     "file","0","0",       "polyglot.ini", NULL,0,NNB,  PG|XBOARD|XBSEL}, \r
+\r
+    { "SettingsDir",      "path","0","0",       "<empty>"   , NULL,0,NNB,  PG},\r
+\r
+    { "OnlyWbOptions",    "check","0","0",      "true"      , NULL,0,NNB,  PG|XBOARD},\r
+\r
     { "EngineName",       "string","0","0",     "<empty>"   , NULL,0,NNB,  PG}, \r
-    { "EngineDir",        "path","0","0",     "."         , NULL,0,NNB,  PG}, \r
+    { "EngineDir",        "path","0","0",       "."         , NULL,0,NNB,  PG}, \r
     { "EngineCommand",    "string","0","0",     "<empty>"   , NULL,0,NNB,  PG}, \r
 \r
-    { "Log",              "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD|UCI}, \r
-    { "LogFile",          "file","0","0",     "polyglot.log", NULL,0,NNB,  PG|XBOARD|UCI}, \r
+    { "Log",              "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD|XBSEL|UCI}, \r
+    { "LogFile",          "file","0","0",       "polyglot.log", NULL,0,NNB,  PG|XBOARD|XBSEL|UCI}, \r
 \r
     { "UCI",              "check","0","0",      "false"     , NULL,0,NNB,  PG}, \r
 \r
     { "UseNice",          "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD|UCI}, \r
     { "NiceValue",        "spin", "0","20",     "5"         , NULL,0,NNB,  PG|XBOARD|UCI}, \r
 \r
-    { "Chess960",         "check","0","0",      "false"     , NULL,0,NNB,  PG}, \r
-\r
-    { "Resign",           "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD}, \r
-    { "ResignMoves",      "spin","0","10000",    "3"        , NULL,0,NNB,  PG|XBOARD}, \r
-    { "ResignScore",      "spin","0","10000",   "600"       , NULL,0,NNB,  PG|XBOARD}, \r
+    { "Resign",           "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD|XBSEL}, \r
+    { "ResignMoves",      "spin","0","10000",    "3"        , NULL,0,NNB,  PG|XBOARD|XBSEL}, \r
+    { "ResignScore",      "spin","0","10000",   "600"       , NULL,0,NNB,  PG|XBOARD|XBSEL}, \r
 \r
     { "MateScore",        "spin","0","100000",  "10000"     , NULL,0,NNB,  PG|XBOARD}, \r
 \r
-    { "Book",             "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD|UCI}, \r
-    { "BookFile",         "file","0","0",     "book.bin"  , NULL,0,NNB,  PG|XBOARD|UCI}, \r
+    { "Book",             "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD|XBSEL|UCI}, \r
+    { "BookFile",         "file","0","0",       "book.bin"  , NULL,0,NNB,  PG|XBOARD|XBSEL|UCI}, \r
 \r
-    { "BookRandom",       "check","0","0",      "true"      , NULL,0,NNB,  PG|XBOARD|UCI}, \r
-    { "BookDepth",        "spin","0","256",     "256"       , NULL,0,NNB,  PG|XBOARD}, \r
+    { "BookRandom",       "check","0","0",      "true"      , NULL,0,NNB,  PG|XBOARD|XBSEL|UCI}, \r
+    { "BookDepth",        "spin","0","256",     "256"       , NULL,0,NNB,  PG|XBOARD|XBSEL}, \r
     { "BookTreshold",     "spin","0","1000",    "5"         , NULL,0,NNB,  PG|XBOARD|UCI}, \r
     { "BookLearn",        "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD}, \r
 \r
@@ -64,7 +66,7 @@ option_t DefaultOptions[] = {
     { "KibitzDelay",      "spin","0","1000",    "5"         , NULL,0,NNB,  PG|XBOARD}, \r
     { "KibitzInterval",   "spin","0","1000",    "0"         , NULL,0,NNB,  PG|XBOARD}, \r
 \r
-    { "ShowPonder",       "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD}, \r
+    { "ShowPonder",       "check","0","0",      "true"     , NULL,0,NNB,  PG|XBOARD}, \r
     { "ScoreWhite",       "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD}, \r
 \r
    // work-arounds\r
@@ -74,15 +76,26 @@ option_t DefaultOptions[] = {
     { "SyncStop",         "check","1","2",      "false"     , NULL,0,NNB,  PG|XBOARD}, \r
     { "Affinity",         "spin","-1","32",     "-1"        , NULL,0,NNB,  PG}, \r
     { "RepeatPV",         "check","0","0",      "true"      , NULL,0,NNB,  PG|XBOARD},\r
-    { "PromoteWorkAround","check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD}, \r
+    { "PromoteWorkAround","check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD},\r
+\r
+   // internal\r
 \r
-    { "WbWorkArounds",    "check","0","0",      "true"      , NULL,0,NNB,  PG|XBOARD}, \r
-    { "WbWorkArounds2",   "check","0","0",      "false"     , NULL,0,NNB,  PG|XBOARD}, \r
+    { "Chess960",         "check","0","0",      "false"     , NULL,0,NNB,  PG}, \r
+\r
+   // These options flag various hacks in the source to work around\r
+   // WB quirks. They will eventually all be set to false. Probably\r
+   // in 4.5.0\r
+    \r
+    { "WbWorkArounds",    "check","0","0",      "true"      , NULL,0,NNB,  PG}, \r
+    { "WbWorkArounds2",   "check","0","0",      "false"     , NULL,0,NNB,  PG}, \r
+    { "WbWorkArounds3",   "check","0","0",      "true"      , NULL,0,NNB,  PG}, \r
 \r
     // Buttons\r
 \r
-//    { "Defaults",         "reset","0","0",     "false"     , NULL,0,NNB,  PG|XBOARD},\r
+    { "Save",             "save","0","0",       "false"     , NULL,0,NNB,  PG|XBOARD|XBSEL},\r
 \r
+    // Sentinel\r
+    \r
     { NULL,               NULL,"0","0",         NULL        , NULL,0,NNB,  0},\r
 \r
 };\r
@@ -106,7 +119,7 @@ void option_init_pg() {
     int i;\r
     option_t *p=DefaultOptions;\r
     char *home_dir;\r
-    char PersistDir[StringSize];\r
+    char SettingsDir[StringSize];\r
     \r
     option_init(Option);\r
     while(p){\r
@@ -125,13 +138,13 @@ void option_init_pg() {
     if(!home_dir){\r
         home_dir=".";\r
     }\r
-    snprintf(PersistDir,sizeof(PersistDir),"%s/.polyglot",home_dir);\r
-    PersistDir[sizeof(PersistDir)-1]='\0';\r
+    snprintf(SettingsDir,sizeof(SettingsDir),"%s/.polyglot",home_dir);\r
+    SettingsDir[sizeof(SettingsDir)-1]='\0';\r
 #else\r
-    sprintf(PersistDir,".\\_PG");\r
+    sprintf(SettingsDir,".\\_PG");\r
 #endif\r
-    option_set(Option,"PersistDir",PersistDir);\r
-    option_set_default(Option,"PersistDir",PersistDir);\r
+    option_set(Option,"SettingsDir",SettingsDir);\r
+    option_set_default(Option,"SettingsDir",SettingsDir);\r
 }\r
 \r
 // option_init()\r
index 17468ba..7a842e6 100644 (file)
--- a/option.h
+++ b/option.h
@@ -15,6 +15,7 @@
 #define XBOARD   (1<<0)\r
 #define UCI      (1<<1)\r
 #define PG       (1<<2)\r
+#define XBSEL    (1<<3)\r
 #define OptionNb 256\r
 \r
 #define IS_BUTTON(str) (my_string_case_equal(str,"button") ||      \\r
index ded75ff..12f1611 100644 (file)
@@ -1,7 +1,15 @@
-.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
 .\"
 .\" Standard preamble:
 .\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
 .de Sp \" Vertical space (when we can't use .PP)
 .if t .sp .5v
 .if n .sp
 .    ds R" ''
 'br\}
 .\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el       .ds Aq '
-.\"
 .\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
-.ie \nF \{\
+.if \nF \{\
 .    de IX
 .    tm Index:\\$1\t\\n%\t"\\$2"
 ..
 .    nr % 0
 .    rr F
 .\}
-.el \{\
-.    de IX
-..
-.\}
+.\"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
 .\" ========================================================================
 .\"
 .IX Title "POLYGLOT 6"
-.TH POLYGLOT 6 "2009-09-05" "" ""
-.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
+.TH POLYGLOT 6 "2009-09-11" "" ""
 .SH "NAME"
 PolyGlot \-  Winboard protocol to UCI protocol adapter
          \-  book engine for Polyglot books 
@@ -147,12 +148,12 @@ polyglot info-book [\-bin inputfile] [\-exact]
 .PP
 polyglot dump-book [\-bin inputfile] \-color color [\-out outputfile]
 .PP
-polyglot [configfile] epd-test [engineoptions] [\-epd inputfile] [\-min\-depth depth] [\-max\-depth depth] [\-max\-time time] [\-depth\-delta delta]
+polyglot [configfile] epd-test [engineoptions] [\-epd inputfile] [\-min\-depth depth] [\-max\-depth depth] [\-max\-time time] [\-depth\-delta delta] 
 .PP
 polyglot perft [\-fen fen] [\-max\-depth depth]
 .SH "DESCRIPTION"
 .IX Header "DESCRIPTION"
-.SS "PolyGlot as adapter and book engine"
+.Sh "PolyGlot as adapter and book engine"
 .IX Subsection "PolyGlot as adapter and book engine"
 PolyGlot is a \*(L"\s-1UCI\s0 adapter\*(R".  It connects a \s-1GUI\s0 interface (such as
 XBoard, Winboard, Arena or Chessbase) to a \s-1UCI\s0 chess engine.
@@ -183,7 +184,7 @@ by \*(L"Polyglot\*(R". This makes it easy to filter them in the \s-1GUI\s0.
 .PP
 \&\s-1NOTE:\s0 Not all options are exported, only those that make sense in the
 given mode.
-.SS "Book making utilities"
+.Sh "Book making utilities"
 .IX Subsection "Book making utilities"
 PolyGlot supports the \*(L"PolyGlot opening book format\*(R". This is the
 defacto standard non-proprietary opening book format. It is fully documented
@@ -194,17 +195,17 @@ http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
 Roughly speaking a PolyGlot opening book is a collection of triples
 (position, move, weight). A \*(L"position\*(R" is represented by a 64\-bit
 Zobrist hash key. The weight is proportional to the probability the move should
-be played.
+be played. 
 .PP
 Other opening book formats such as ChessBase's .ctg format and Arena's
 \&.abk format are undocumented and proprietary. They can only be used 
-by their own GUIs.
+by their own GUIs. 
 .PP
 PolyGlot can compile a pgn file into a binary PolyGlot book and furthermore
 it can merge two such binary books into a third one.
 .PP
 PolyGlot can also extract some useful information from PolyGlot books. The utility
-\&\*(L"dump-book\*(R" dumps the \*(L"lines\*(R" in a book for a given color. By definition
+\&\*(L"dump\-book\*(R" dumps the \*(L"lines\*(R" in a book for a given color. By definition
 a line is a sequence of moves (from the starting position) in which
 the given color makes only book moves and the other color makes 
 arbitrary moves (i.e. not necessarily book moves).
@@ -212,7 +213,7 @@ arbitrary moves (i.e. not necessarily book moves).
 Since a PolyGlot book is built up from positions and not lines there
 may be (and there usually are) many positions in the book that are not
 on a \*(L"line\*(R" as defined in the previous paragraph. It is convenient
-to call such positions \*(L"isolated\*(R" positions. The utility \*(L"info-book\*(R"
+to call such positions \*(L"isolated\*(R" positions. The utility \*(L"info\-book\*(R"
 counts such isolated positions.
 .PP
 Some of the isolated positions are provably unreachable and they
@@ -228,12 +229,12 @@ it is difficult to identify the latter. If invoked with \*(L"\-exact\*(R" the
 utility info-book will attempt to count the isolated positions which
 require a player to make a non-book move when a book move is available.
 Due to the possibility of transpositions this is not a fool proof method.
-.SS "Epd test mode"
+.Sh "Epd test mode"
 .IX Subsection "Epd test mode"
 In epd test mode, PolyGlot will search positions in an epd file and
 record the number of times the right best move was found.  The
 arguments specify when to stop the search in any given position.
-.SS "Perft counts"
+.Sh "Perft counts"
 .IX Subsection "Perft counts"
 A perft count is the number of legal move sequence in a given position
 up to a given depth. PolyGlot can perform such perft counts. It
@@ -253,46 +254,44 @@ Do not use a config file, even if one was specified on the command line.
 .IP "\fB\-pg\fR" 4
 .IX Item "-pg"
 The argument is a string of the form <name>=<value>. This option will
-set the Polyglot option <name> to <value>.
+set the Polyglot option <name> to <value>. 
 .IP "\fB\-uci\fR" 4
 .IX Item "-uci"
 The argument is a string of the form <name>=<value>. This option will
-set the engine option <name> to <value>.
+set the engine option <name> to <value>. 
 .IP "\fB\-ec\fR" 4
 .IX Item "-ec"
-This sets the EngineCommand.
+This is an alias for \-pg \*(L"EngineCommand=<value>\*(R"
 .IP "\fB\-ed\fR" 4
 .IX Item "-ed"
-This sets the EngineDir.
+This is an alias for \-pg \*(L"EngineDir=<value>\*(R"
 .IP "\fB\-en\fR" 4
 .IX Item "-en"
-This sets the EngineName.
-.IP "\fB\-hash\fR" 4
-.IX Item "-hash"
-This is an alias for \-uci \*(L"Hash=<value>\*(R".
-.IP "\fB\-log\fR" 4
-.IX Item "-log"
-This is an alias for \-pg \*(L"Log=true\*(R".
+This is an alias for \-pg \*(L"EngineName=<value>\*(R"
+.IP "\fB\-log\fR (default: false)" 4
+.IX Item "-log (default: false)"
+This is an alias for \-pg \*(L"Log=<value>\*(R"
 .ie n .IP "\fB\-lf\fR (default: ""polyglot.log"")" 4
 .el .IP "\fB\-lf\fR (default: ``polyglot.log'')" 4
 .IX Item "-lf (default: polyglot.log)"
 This is an alias for \-pg \*(L"LogFile=<value>\*(R".
-.IP "\fB\-bk\fR" 4
-.IX Item "-bk"
-This is an alias for \-pg \*(L"Book=true\*(R" \-pg \*(L"BookFile=<value>\*(R".
+.ie n .IP "\fB\-wb\fR (default: ""true"")" 4
+.el .IP "\fB\-wb\fR (default: ``true'')" 4
+.IX Item "-wb (default: true)"
+This is an alias for \-pg \*(L"OnlyWbOptions=<value>\*(R".
 .PP
 When invoked as
-.SS "polyglot make-book"
+.Sh "polyglot make-book"
 .IX Subsection "polyglot make-book"
 PolyGlot supports the following options
 .ie n .IP "\fB\-pgn\fR (default: ""book.pgn"")" 4
 .el .IP "\fB\-pgn\fR (default: ``book.pgn'')" 4
 .IX Item "-pgn (default: book.pgn)"
-Input file in pgn format.
+Input file in pgn format. 
 .ie n .IP "\fB\-bin\fR (default: ""book.bin"")" 4
 .el .IP "\fB\-bin\fR (default: ``book.bin'')" 4
 .IX Item "-bin (default: book.bin)"
-Output file in PolyGlot format.
+Output file in PolyGlot format. 
 .IP "\fB\-max\-ply\fR (default: 1024)" 4
 .IX Item "-max-ply (default: 1024)"
 Specifies the maximum ply-depth of lines included in the book.
@@ -303,7 +302,7 @@ Specifies the minimum number of games that have to contain this move for it to b
 .IX Item "-min-score (default: 0.0)"
 Specifies the minimum score (or weight) this move should have received for 
 it to  be included in the book. The score is 2*(wins)+(draws), globally scaled
-to fit into 16 bits.
+to fit into 16 bits. 
 .IP "\fB\-only\-white\fR" 4
 .IX Item "-only-white"
 Include only moves for white in the book.
@@ -313,11 +312,11 @@ Include only moves for black in the book.
 .IP "\fB\-uniform\fR" 4
 .IX Item "-uniform"
 Set all weights to 1. In other words, all moves will be selected with 
-equal probability.
+equal probability. 
 .PP
 When invoked
 as
-.SS "polyglot merge-book"
+.Sh "polyglot merge-book"
 .IX Subsection "polyglot merge-book"
 PolyGlot supports the following options
 .IP "\fB\-in1\fR" 4
@@ -336,7 +335,7 @@ moves and weights from \*(L"in1\*(R" will be retained in \*(L"out\*(R".
 .PP
 When invoked
 as
-.SS "polyglot dump-book"
+.Sh "polyglot dump-book"
 .IX Subsection "polyglot dump-book"
 PolyGlot supports the following options
 .IP "\fB\-bin\fR (default: book.bin)" 4
@@ -351,7 +350,7 @@ The name of the output file.
 .PP
 When invoked
 as
-.SS "polyglot info-book"
+.Sh "polyglot info-book"
 .IX Subsection "polyglot info-book"
 PolyGlot supports the following options
 .IP "\fB\-bin\fR (default: book.bin)" 4
@@ -360,10 +359,10 @@ Input file in PolyGlot book format.
 .IP "\fB\-exact\fR" 4
 .IX Item "-exact"
 Attempt to count the provably unreachable positions among the isolated ones.
-Note that this takes a very long time.
+Note that this takes a very long time. 
 .PP
 When invoked as
-.SS "polyglot epd-test"
+.Sh "polyglot epd-test"
 .IX Subsection "polyglot epd-test"
 (possibly with a config file as first argument) PolyGlot supports
 besides the generic options described above the following additional
@@ -388,7 +387,7 @@ Minimal search depth when the search is stopped using \*(L"\-depth\-delta\*(R".
 Minimal search time when the search is stopped using \*(L"\-depth\-delta\*(R".
 .PP
 When invoked as
-.SS "polyglot perft"
+.Sh "polyglot perft"
 .IX Subsection "polyglot perft"
 PolyGlot supports the following
 options
@@ -400,9 +399,9 @@ Fen at which to start searching.
 Maximum depth to search.
 .SH "CONFIG FILE FORMAT"
 .IX Header "CONFIG FILE FORMAT"
-There should be a different config file for each engine.
+There should be a different config file for each engine.  
 .PP
-The config file is in the traditional \s-1INI\s0 format.
+The config file is in the traditional \s-1INI\s0 format.  
 .PP
 .Vb 6
 \&    [PolyGLot]
@@ -413,13 +412,13 @@ The config file is in the traditional \s-1INI\s0 format.
 \&    ...
 .Ve
 .PP
-The characters \*(L"#\*(R" and \*(L";\*(R" serve as comment characters.
+The characters \*(L"#\*(R" and \*(L";\*(R" serve as comment characters. 
 .PP
 By default initial and final white space is stripped from option
 values. If you want to avoid this, or if you want use one of
 the comment characters # or ; in option values (such as for NalimovPath), 
 enclose the value in quotes.
-.SS "[PolyGlot] section"
+.Sh "[PolyGlot] section"
 .IX Subsection "[PolyGlot] section"
 This section is used by PolyGlot only.  The engine is unaware of these
 options.  The list of available options is detailed below.
@@ -440,6 +439,15 @@ any data file.
 Put here the name of the engine executable file.  You can also add
 command-line arguments.  Path searching is used and the current
 directory will be \*(L"EngineDir\*(R".
+.ie n .IP "\fBSettingsDir\fR (default: $HOME/.polyglot on Linux; "".\e_PG"" on Windows)" 4
+.el .IP "\fBSettingsDir\fR (default: \f(CW$HOME\fR/.polyglot on Linux; ``.\e_PG'' on Windows)" 4
+.IX Item "SettingsDir (default: $HOME/.polyglot on Linux; ._PG on Windows)"
+The directory where ini files are stored for engines that are started with
+\&\-noini. Such ini files may be created by pushing the \*(L"Save\*(R" button in the
+Engine settings dialog in \s-1WB/XB\s0 4.4.0 and higher. As a special exception
+(for \s-1WB/XB\s0 4.4.0 compatibility) this directory is also used in case
+PolyGlot is started with config files named \*(L"polyglot_1st.ini\*(R" or
+\&\*(L"polyglot_2nd.ini\*(R".
 .IP "\fBLog\fR (default: false)" 4
 .IX Item "Log (default: false)"
 Whether PolyGlot should log all transactions with the interface and
@@ -493,10 +501,10 @@ regardless of the delay.
 .IP "\fBKibitzInterval\fR (default: 0)" 4
 .IX Item "KibitzInterval (default: 0)"
 This is another form of throttling. PolyGlot will usually wait this
-many seconds before doing the next kibitz.
+many seconds before doing the next kibitz. 
 .IP "\fB\s-1UCI\s0\fR (default: false)" 4
 .IX Item "UCI (default: false)"
-If true PolyGlot will not understand xboard commands.
+If true PolyGlot will not understand xboard commands. 
 .IP "\fBMateScore\fR (default: 10000)" 4
 .IX Item "MateScore (default: 10000)"
 Mate score reported to \s-1GUI\s0 when in xboard mode.
@@ -518,17 +526,17 @@ does not matter.
 .IP "\fBBookRandom\fR (default: true)" 4
 .IX Item "BookRandom (default: true)"
 Select moves according to their weights in the book. If false the move
-with the highest weight is selected.
+with the highest weight is selected. 
 .IP "\fBBookLearn\fR (default: false)" 4
 .IX Item "BookLearn (default: false)"
 Store learning information in the book (which must be writable). Currently
-no engine actually uses this information.
+no engine actually uses this information. 
 .IP "\fBBookDepth\fR (default: 256)" 4
 .IX Item "BookDepth (default: 256)"
-Stop using the book after this number of moves.
+Stop using the book after this number of moves. 
 .IP "\fBBookTreshold\fR (default: 5)" 4
 .IX Item "BookTreshold (default: 5)"
-Do not play moves with a weight (probability) lower than this (in per mil).
+Do not play moves with a weight (probability) lower than this (in per mil). 
 .IP "\fBUseNice\fR (default: false)" 4
 .IX Item "UseNice (default: false)"
 Run the engine at nice level 5, or \*(L"NiceValue\*(R" if it set.  On some
@@ -543,27 +551,16 @@ Win32 priority levels are mapped in a sensible way to Unix nice levels.
 .IP "\fBAffinity\fR (default: \-1)" 4
 .IX Item "Affinity (default: -1)"
 This a bit vector in which each bit represents the processors that a
-process is allowed to run on. This option works only on Windows.
-.IP "\fBPersist\fR (default: true)" 4
-.IX Item "Persist (default: true)"
-If true then PolyGlot will implement persistence by loading options
-from an additional \s-1INI\s0 file whose name is by default derived from the
-engine name. At exit PolyGlot will also save its options to this \s-1INI\s0
-file.
-.IP "\fBPersistFile\fR (default: <EngineName>.ini)" 4
-.IX Item "PersistFile (default: <EngineName>.ini)"
-The name of the file from which to take the additional options.  It is
-probably best to stick with the default. You can safely edit this
-file, or delete it to restore the default options.
-.ie n .IP "\fBPersistDir\fR (default: $HOME/.polyglot on Linux; "".\ePolyglot Settings"" on Windows)" 4
-.el .IP "\fBPersistDir\fR (default: \f(CW$HOME\fR/.polyglot on Linux; ``.\ePolyglot Settings'' on Windows)" 4
-.IX Item "PersistDir (default: $HOME/.polyglot on Linux; .Polyglot Settings on Windows)"
-The directory where the PersistFile is stored.
-.SS "Work arounds"
+process is allowed to run on. This option works only on Windows. 
+.IP "\fBOnlyWbOptions\fR (default: true)" 4
+.IX Item "OnlyWbOptions (default: true)"
+If true then PolyGlot restricts the options it sends to those that
+are potentially useful for WinBoard. 
+.Sh "Work arounds"
 .IX Subsection "Work arounds"
 Work arounds are identical to options except that they should be used
 only when necessary.  Their purpose is to try to hide problems with
-various software (not just engines).
+various software (not just engines).  
 .PP
 \&\s-1IMPORTANT:\s0 Any of these work arounds might be removed in future
 versions of PolyGlot.  You are strongly recommended to contact the
@@ -599,22 +596,8 @@ score,depth and time usage) it got from the engine. Some engines
 however do not send a new pv string just before sending the move.
 In that case the output of PolyGlot would be inconsistent. 
 When RepeatPV is false PolyGlot does not repeat the last pv string.
-Due to the way kibitzing is implemented, KibitzMove is disabled in that case.
-.IP "\fBWbWorkArounds\fR (default: true)" 4
-.IX Item "WbWorkArounds (default: true)"
-The intention of these options is to provide work arounds for
-xboard/winboard bugs should they arise.  This one decapitalizes
-the word Draw in options that contain this word. Some versions of
-xboard/winboard contain a bug which causes such options to be
-interpreted as draw claims by the engine.
-.Sp
-Engines that send options with \*(L"Draw\*(R" in their name are Rybka and \s-1HIARCS\s0.
-.IP "\fBWbWorkArounds2\fR (default: false)" 4
-.IX Item "WbWorkArounds2 (default: false)"
-Old version of Winboard clear the engine output window at depth 1. With this
-work around \s-1PG\s0 will send info lines at depth >=2. This may or may not improve
-the display.
-.SS "[Engine] section"
+Due to the way kibitzing is implemented, KibitzMove is disabled in that case. 
+.Sh "[Engine] section"
 .IX Subsection "[Engine] section"
 This section contains engine \s-1UCI\s0 options.  PolyGlot does not
 understand them, but sends the information to the engine at startup
@@ -626,7 +609,7 @@ tablebases).
 correct.  It will be replaced by PolyGlot with \*(L"setoption name OwnBook
 value true\*(R" at engine startup.
 .PP
-Standard \s-1UCI\s0 options are
+Standard \s-1UCI\s0 options are 
 .PP
 .Vb 4
 \&    Hash 
@@ -638,7 +621,7 @@ Standard \s-1UCI\s0 options are
 Hidden options like \*(L"Ponder\*(R" or \*(L"UCI_xxx\*(R" are automatic
 and should not be put in an \s-1INI\s0 file.
 .PP
-The other options are engine-specific.  Check their name using a \s-1UCI\s0
+The other options are engine\-specific.  Check their name using a \s-1UCI\s0
 \&\s-1GUI\s0 or launch the engine in a console and type \*(L"uci\*(R".
 .SH "EXAMPLES"
 .IX Header "EXAMPLES"
@@ -690,7 +673,7 @@ Test epd file \*(L"test.epd\*(R" with a (maximum) search time of 7 minutes per p
 .Ve
 .SH "EXIT STATUS"
 .IX Header "EXIT STATUS"
-PolyGlot always returns 0 on exit.
+PolyGlot always returns 0 on exit. 
 .SH "AUTHORS"
 .IX Header "AUTHORS"
 Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
@@ -699,7 +682,7 @@ Native Windows port:  Huang Chen<webmaster@elephantbase.net> (\*(L"Morning Yello
 .PP
 Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
 .PP
-\&\s-1UCI\s0 port, option persistence and new \s-1WB\s0 protocol: Michel Van den Bergh
+\&\s-1UCI\s0 port and implementation of new \s-1WB\s0 protocol: Michel Van den Bergh
 <michel.vandenbergh(at)uhasselt.be>
 .SH "SEE ALSO"
 .IX Header "SEE ALSO"
index a7c60d7..7d3a15d 100644 (file)
@@ -142,31 +142,27 @@ set the engine option <name> to <value>.
 
 =item B<-ec> 
 
-This sets the EngineCommand.
+This is an alias for -pg "EngineCommand=<value>"
 
 =item B<-ed>
 
-This sets the EngineDir.
+This is an alias for -pg "EngineDir=<value>"
 
 =item B<-en>
 
-This sets the EngineName.
+This is an alias for -pg "EngineName=<value>"
 
-=item B<-hash>
+=item B<-log> (default: false)
 
-This is an alias for -uci "Hash=<value>".
-
-=item B<-log>
-
-This is an alias for -pg "Log=true".
+This is an alias for -pg "Log=<value>"
 
 =item B<-lf> (default: "polyglot.log")
 
 This is an alias for -pg "LogFile=<value>".
 
-=item B<-bk> 
+=item B<-wb> (default: "true")
 
-This is an alias for -pg "Book=true" -pg "BookFile=<value>".
+This is an alias for -pg "OnlyWbOptions=<value>".
 
 =back
 
@@ -386,6 +382,15 @@ Put here the name of the engine executable file.  You can also add
 command-line arguments.  Path searching is used and the current
 directory will be "EngineDir".
 
+=item B<SettingsDir> (default: $HOME/.polyglot on Linux; ".\_PG" on Windows)
+
+The directory where ini files are stored for engines that are started with
+-noini. Such ini files may be created by pushing the "Save" button in the
+Engine settings dialog in WB/XB 4.4.0 and higher. As a special exception
+(for WB/XB 4.4.0 compatibility) this directory is also used in case
+PolyGlot is started with config files named "polyglot_1st.ini" or
+"polyglot_2nd.ini".
+
 =item B<Log> (default: false)
 
 Whether PolyGlot should log all transactions with the interface and
@@ -513,22 +518,10 @@ Win32 priority levels are mapped in a sensible way to Unix nice levels.
 This a bit vector in which each bit represents the processors that a
 process is allowed to run on. This option works only on Windows. 
 
-=item B<Persist> (default: true)
-
-If true then PolyGlot will implement persistence by loading options
-from an additional INI file whose name is by default derived from the
-engine name. At exit PolyGlot will also save its options to this INI
-file.
-
-=item B<PersistFile> (default: <EngineName>.ini)
-
-The name of the file from which to take the additional options.  It is
-probably best to stick with the default. You can safely edit this
-file, or delete it to restore the default options.
+=item B<OnlyWbOptions> (default: true)
 
-=item B<PersistDir> (default: $HOME/.polyglot on Linux; ".\Polyglot Settings" on Windows)
-
-The directory where the PersistFile is stored.
+If true then PolyGlot restricts the options it sends to those that
+are potentially useful for WinBoard. 
 
 =back
 
@@ -581,22 +574,6 @@ In that case the output of PolyGlot would be inconsistent.
 When RepeatPV is false PolyGlot does not repeat the last pv string.
 Due to the way kibitzing is implemented, KibitzMove is disabled in that case. 
 
-=item B<WbWorkArounds> (default: true)
-
-The intention of these options is to provide work arounds for
-xboard/winboard bugs should they arise.  This one decapitalizes
-the word Draw in options that contain this word. Some versions of
-xboard/winboard contain a bug which causes such options to be
-interpreted as draw claims by the engine.
-
-Engines that send options with "Draw" in their name are Rybka and HIARCS. 
-
-=item B<WbWorkArounds2> (default: false)
-
-Old version of Winboard clear the engine output window at depth 1. With this
-work around PG will send info lines at depth >=2. This may or may not improve
-the display. 
-
 =back
 
 
@@ -672,7 +649,7 @@ Native Windows port:  Huang Chen<webmaster@elephantbase.net> ("Morning Yellow")
 
 Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
 
-UCI port, option persistence and new WB protocol: Michel Van den Bergh
+UCI port and implementation of new WB protocol: Michel Van den Bergh
 <michel.vandenbergh(at)uhasselt.be>
 
 
index f3c173f..6e5d7f4 100644 (file)
@@ -1,6 +1,6 @@
 Summary: A Winboard protocol to UCI protocol adapter
 Name: polyglot
-Version: 1.4.46b
+Version: 1.4.50b
 Release: 1
 License: GPL
 Group: Amusement/Games
diff --git a/uci.c b/uci.c
index 9326ec7..5eff8cc 100644 (file)
--- a/uci.c
+++ b/uci.c
@@ -10,6 +10,7 @@
 \r
 #include "board.h"\r
 #include "engine.h"\r
+#include "gui.h"\r
 #include "move.h"\r
 #include "move_do.h"\r
 #include "move_legal.h"\r
@@ -18,6 +19,7 @@
 #include "line.h"\r
 #include "uci.h"\r
 \r
+\r
 // constants\r
 \r
 static const bool UseDebug = FALSE;\r
@@ -148,6 +150,11 @@ void uci_open(uci_t * uci, engine_t * engine) {
 \r
    do {\r
       engine_get(uci->engine,string);\r
+      // Handle the case that the engine is really a WB engine somewhat gracefully.\r
+      if((strstr(string,"Illegal") || strstr(string,"Error"))\r
+         &&strstr(string,"uci")){\r
+          my_fatal("uci_open(): Not an UCI engine (not found).\n");\r
+      }\r
       event = uci_parse(uci,string);\r
    } while (!engine_eof(Engine) && (event & EVENT_UCI) == 0);\r
 }\r
@@ -331,7 +338,7 @@ int uci_parse(uci_t * uci, const char string[]) {
    parse_open(parse,string);\r
 \r
    if (parse_get_word(parse,command,StringSize)) {\r
-\r
+       \r
       parse_get_string(parse,argument,StringSize);\r
       if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" ARGUMENT \"%s\"\n",command,argument);\r
 \r
diff --git a/util.c b/util.c
index 32413ab..28e56b5 100644 (file)
--- a/util.c
+++ b/util.c
@@ -150,6 +150,10 @@ void my_log_open(const char file_name[]) {
 //line buffering doesn't work too well in MSVC and/or windows \r
    if (LogFile != NULL) setvbuf(LogFile,NULL,_IOLBF,0); // line buffering\r
 #endif\r
+   if(LogFile!=NULL){\r
+       my_log("POLYGLOT *** LOGFILE OPENED ***\n");\r
+   }\r
+\r
 }\r
 \r
 // my_log_close()\r
diff --git a/util.h b/util.h
index 4eee73a..50eec99 100644 (file)
--- a/util.h
+++ b/util.h
         }                                                                \\r
     }                                                                    \\r
 \r
+#define TO_BOOL(string) ((my_string_case_equal(string,"false") ||   \\r
+                          my_string_equal(string,"0"))?FALSE:TRUE)\r
 \r
-\r
+#define IS_BOOL(string) (my_string_case_equal(string,"false")||     \\r
+                         my_string_case_equal(string,"true") ||     \\r
+                         my_string_case_equal(string,"1")    ||     \\r
+                         my_string_case_equal(string,"0"))\r
 // types\r
 \r
 typedef signed char sint8;\r