From 0eb214919078bb63985e66a39b392a7d125e3218 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 7 Dec 2018 15:02:14 +0100 Subject: [PATCH] Put handling of engine output in separate routine The reading, decoding and handling of the engine output is now put in a routine HandleEngineOutput(), which is still an infinite loop that wakes up a blocked GUI thread after a 'uciok', 'readyok' or 'bestmove' command. This in preparation of a new design, where it would break out of the loop and return after these commands, to let its caller process any queued GUI commands. --- UCI2WB.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index c0ace0f..e87504a 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -250,12 +250,11 @@ ReadLine (FILE *f, char *line) return (x != EOF); } -void * -Engine2GUI() +void +HandleEngineOutput() { char line[1024], command[256]; static char egts[999]; - if(fromF = fopen("DefectiveEngineOptions.ini", "r")) printf("# fake engine input\n"); while(1) { int i=0, x; char *p, dummy, len; @@ -412,6 +411,13 @@ Engine2GUI() } } +void * +Engine2GUI() +{ + if(fromF = fopen("DefectiveEngineOptions.ini", "r")) printf("# fake engine input\n"); + HandleEngineOutput(); +} + void Move4Engine(char *m) { -- 1.7.0.4