\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
#include "line.h"\r
#include "uci.h"\r
\r
+\r
// constants\r
\r
static const bool UseDebug = FALSE;\r
\r
// functions\r
\r
+\r
+// uci_adapt_UCI3()\r
+\r
+static void apply_UCI3_heuristics(option_t *opt){\r
+ if(option_get_int(Option,"UCIVersion")>2){\r
+ return;\r
+ }\r
+ if(!my_string_equal(opt->type,"string")){\r
+ return;\r
+ }\r
+ if(!strncmp(opt->name,"UCI_",4)){\r
+ return;\r
+ }\r
+ if(my_string_case_contains(opt->name,"file")){\r
+ my_string_set(&opt->type,"file");\r
+ return;\r
+ }\r
+ if(my_string_case_contains(opt->name,"path")){\r
+ my_string_set(&opt->type,"path");\r
+ return;\r
+ }\r
+}\r
+\r
// uci_set_threads()\r
\r
void uci_set_threads(uci_t * uci, int n) {\r
\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
opt=option_find(uci->option,option);\r
if(opt){\r
found=TRUE;\r
- if(!my_string_case_equal(opt->type,"button")){\r
+ if(!IS_BUTTON(opt->type)){\r
if(!my_string_equal(opt->value,value)){\r
engine_send(uci->engine,"setoption name %s value %s",\r
opt->name,value);\r
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
}\r
\r
parse_close(parse);\r
+\r
+ apply_UCI3_heuristics(opt);\r
option_insert(uci->option,opt);\r
option_free(opt);\r
\r