From: H.G.Muller Date: Sat, 8 Dec 2018 09:02:49 +0000 (+0100) Subject: Put launching of searches in a separate routine X-Git-Tag: v4.0~19 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=b42dab5e4509f49d27d78747e16a151962a237e2;p=uci2wb.git Put launching of searches in a separate routine The code section that tested if the engine should search, and would start the required search if this was the case, is now put in a routine LaunchSearch(). This is then called from the infinite loop that handles the GUI commands (where it was located before). --- diff --git a/UCI2WB.c b/UCI2WB.c index 1fc24fc..c068847 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -441,12 +441,9 @@ char mySide; char queue[10000], *qStart, *qEnd; void -GUI2Engine() +LaunchSearch() { - char line[256], command[256], *p; - - while(1) { - int i, difficult; + int i; if((computer == stm || computer == ANALYZE && !searching) && !suspended) { DPRINT("# start search\n"); @@ -462,6 +459,17 @@ GUI2Engine() EPRINT((f, "\n")) searching = 2; // suppresses spurious commands during analysis starting new searches } else pause = 2, searching = 3, StartSearch(""); // request suspending of input processing while thinking } else if(ponderAlways && computer == NONE) move[moveNr][0] = 0, StartPonder(moveNr-1); +} + +void +GUI2Engine() +{ + char line[256], command[256], *p; + + 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);