From: H.G.Muller Date: Fri, 7 Dec 2018 14:02:14 +0000 (+0100) Subject: Put handling of engine output in separate routine X-Git-Tag: v4.0~24 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=0eb214919078bb63985e66a39b392a7d125e3218;p=uci2wb.git 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. --- 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) {