From b3da85b21462b01c2c0c7f574ac2423703342c55 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 3 Sep 2009 22:30:18 -0700 Subject: [PATCH] updated polyglot protocol I added a new option type "-reset" to the protocol for the new option feature. 4.4.0 does not implement it yet, but Michel wants it for future Polyglots, and I think it is best to update the protocol in one big swoop. So I want to already include it in the specs now. (engine-intf.html) I made xboard's response to an unknown option type compliant with the new protocol specs. --- backend.c | 6 +++++- engine-intf.html | 26 +++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/backend.c b/backend.c index fda1171..b0d9351 100644 --- a/backend.c +++ b/backend.c @@ -12549,7 +12549,11 @@ ParseFeatures(args, cps) if (BoolFeature(&p, "smp", &cps->maxCores, cps)) continue; if (StringFeature(&p, "egt", &cps->egtFormats, cps)) continue; if (StringFeature(&p, "option", &(cps->option[cps->nrOptions].name), cps)) { - ParseOption(&(cps->option[cps->nrOptions++]), cps); // [HGM] options: add option feature + if(!ParseOption(&(cps->option[cps->nrOptions++]), cps)) { // [HGM] options: add option feature + sprintf(buf, "rejected option %s\n", cps->option[--cps->nrOptions].name); + SendToProgram(buf, cps); + continue; + } if(cps->nrOptions >= MAX_OPTIONS) { cps->nrOptions--; sprintf(buf, "%s engine has too many options\n", cps->which); diff --git a/engine-intf.html b/engine-intf.html index bd6bcd7..8ff98ce 100644 --- a/engine-intf.html +++ b/engine-intf.html @@ -8,7 +8,7 @@

Chess Engine Communication Protocol

Tim Mann & H.G.Muller

-Version 2; implemented in xboard/WinBoard 4.2.1 and later.
+Version 2; implemented in xboard/WinBoard 4.2.1 and later. (Sept 3, 2009)
Changes since version 1 are indicated in red.
Changes for WinBoard 4.3.xx are indicated in green.
Changes for WinBoard 4.4.xx are indicated in blue. @@ -1212,6 +1212,10 @@ protocol version by rejecting some features that are defined in that version; however, you should realize that engine authors are likely to code for xboard and may not be prepared to have a feature that they depend on be rejected. +If the GUI rejects an option feature because of the +syntax of the value, it should print the value string with the +"rejected" command, e.g. "rejected option nonsense" in response +to receiving feature option="nonsense".

@@ -1453,14 +1457,19 @@ and will not send any "egtpath" commands to inform the engine about their wherea

This feature is used by the engine to define an option command to appear in a GUI menu, -so that the user can change the corresponding setting of the engine through the GUI. +so that the user can change the corresponding setting of the engine through the GUI interactively. The string describes the option by defining a name, type, current value and (sometimes) the acceptable value range. -There are nine different options types, each requiring a slighly different syntax of the defining string: +Unlike other features, option features are accumulated by the GUI, +and the GUI must be able to add a new option to the list at any time, +even after having received feature done=1. +There are ten different options types, each requiring a slighly different syntax of the defining string:
feature option="NAME -button"
feature option="NAME -save"
+feature option="NAME -reset" +
feature option="NAME -check VALUE"
feature option="NAME -string VALUE" @@ -1483,13 +1492,20 @@ the minimum or maximum value of numeric (-spin) options, or arbitrary text labels (for -combo option). In the latter case, the current value will be preceded by an asterisk. The -file and -path options are similar to -string, but can be used to inform the GUI that -the text represents a file name or folder name respectively, so the GUI dialog to set it -could add the appropriate browse button to the text-edit field. +the text represents a file name or folder name respectively, +so the GUI dialog could add the appropriate browse button to the text-edit field. Similarly, a -slider option is like a -spin, but the GUI might make a different graphical representation for it. A -save option is like a -button, and defines an immediate command to be sent by the engine. With -save the GUI will make sure all current option settings are flushed to the engine before it sends this command. +A -reset option is like a -button, but use of it purges the list of options before sending +the corresponding option command to the engine. +This enables the engine to completely redefine its options or their current settings, +by sending a new set of option feature commands to the GUI, +terminated by feature done=1. +(The effect of sending an option feature for an option with the same name as was defined before, +without first receiving a -reset option command, is undefined.)
-- 1.7.0.4