X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;h=8de43f57b2ec25284804c2ba9b211dcf02758a17;hp=c068847055b9b892159aee4b7417a8f1a4695c6f;hb=a7d1a64029687fd9ae404f0d7490e3bac8c69fb7;hpb=b42dab5e4509f49d27d78747e16a151962a237e2 diff --git a/UCI2WB.c b/UCI2WB.c index c068847..8de43f5 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -411,13 +411,6 @@ HandleEngineOutput() } } -void * -Engine2GUI() -{ - if(fromF = fopen("DefectiveEngineOptions.ini", "r")) printf("# fake engine input\n"); - HandleEngineOutput(); -} - void Move4Engine(char *m) { @@ -469,8 +462,6 @@ GUI2Engine() while(1) { int i, difficult; - LaunchSearch(); // start a search if we need one - nomove: for(difficult=0; !difficult; ) { // read and handle commands that can (or must) be handled during thinking fflush(toE); fflush(stdout); if(!ReadLine(stdin, line)) printf("# EOF\n"), sprintf(line, "quit -1\n"); @@ -525,18 +516,18 @@ GUI2Engine() searching = 0; pause = 2; moveNr++; startTime = GetTickCount(); // clock starts running now EPRINT((f, "# ponderhit%s\n", draw)) fflush(toE); fflush(stdout); searching = 3; // request blocking input during thinking - goto nomove; + continue; } StopPonder(1); searching = 0; } strcpy(move[moveNr++], command); // possibly overwrites ponder move - continue; - } + } else if(!strcmp(command, "resume")) { searching = 0; if(suspended == 2) StartPonder(moveNr); // restart interrupted ponder search - suspended = 0; continue; // causes thinking to start in normal way if on move or analyzing - } + suspended = 0; // causes thinking to start in normal way if on move or analyzing + } else + { if(searching == 3) { // command arrived during thinking; order abort for 'instant commands' if(!strcmp(command, "?") || !strcmp(command, "quit") || !strcmp(command, "force") || !strcmp(command, "result")) { EPRINT((f, "# stop\n")); fflush(toE); } @@ -544,7 +535,10 @@ GUI2Engine() } if(qStart == qEnd) qStart = qEnd = queue; p = line; while(qEnd < queue+10000 && (*qEnd++ = *p++) != '\n') {} - if(DoCommand()) goto nomove; + if(DoCommand()) continue; + } + + LaunchSearch(); // start a search if we need one } } @@ -648,6 +642,13 @@ DoCommand () return 0; } +void * +Engine2GUI() +{ + if(fromF = fopen("DefectiveEngineOptions.ini", "r")) printf("# fake engine input\n"); + HandleEngineOutput(); +} + int StartEngine(char *cmdLine, char *dir) {