X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;h=4cbf5a87819667a4b3e66be87e2e24f96c6a9be0;hp=e87504ae4a616bb3fadee27287c5ccfd53e4735d;hb=f9b3d49480bbbf3200dde21ca58dcd5ae41bcfa1;hpb=0eb214919078bb63985e66a39b392a7d125e3218 diff --git a/UCI2WB.c b/UCI2WB.c index e87504a..4cbf5a8 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -436,10 +436,13 @@ Move4Engine(char *m) } } +int DoCommand (char *line); +char mySide; + void GUI2Engine() { - char line[256], command[256], *p, *q, *r, mySide, type[99]; + char line[256], command[256], *p; while(1) { int i, difficult, think=0; @@ -529,6 +532,18 @@ GUI2Engine() !strcmp(command, "force") || !strcmp(command, "result")) { EPRINT((f, "# stop\n")); fflush(toE); } Sync(PAUSE); Release(); // block processing of difficult commands during thinking; send backlog left because of race } + if(DoCommand(line)) goto nomove; + } +} + +int +DoCommand (char *line) +{ + char command[256], *p, *q, *r, type[99]; + int i; + + sscanf(line, "%s", command); + if(!strcmp(command, "new")) { computer = BLACK; moveNr = 0; depth = -1; move[0][0] = 0; stm = WHITE; strcpy(iniPos, "position startpos"); frc &= ~1; @@ -585,13 +600,13 @@ GUI2Engine() } else if(!strcmp(command, ".")) { printf("stat01: %d %d %d %d 100 %s\n", statTime, statNodes, statDepth, 100-currNr, currMove); - goto nomove; + return 1; } else if(!strcmp(command+2, "clude") && collect > 2) { // include or exclude int all = !strcmp(line+8, "all"), in = command[1] == 'n'; inex = 1; line[strlen(line)-1] = sm = 0; // strip LF and clear sm flag for(i=1; i