Added new wb2 protocol command "gui <GUI_NAME> <VERSION>.<SUBVERSION>". See engine...
[xboard.git] / backend.c
index aaa20a5..99c9fd1 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1489,14 +1489,9 @@ read_from_ics(isr, closure, data, count, error)
     int buf_len;
     int next_out;
     int tkind;
-#ifdef WIN32
-       /* For zippy color lines of winboard
-        * cleanup for gcc compiler */
-       int backup;
-#endif
+    int backup;
     char *p;
 
-#ifdef WIN32
     if (appData.debugMode) {
       if (!error) {
        fprintf(debugFP, "<ICS: ");
@@ -1504,7 +1499,6 @@ read_from_ics(isr, closure, data, count, error)
        fprintf(debugFP, "\n");
       }
     }
-#endif
 
     if (count > 0) {
        /* If last read ended with a partial line that we couldn't parse,
@@ -1750,19 +1744,19 @@ read_from_ics(isr, closure, data, count, error)
 
            oldi = i;
            if (appData.zippyTalk || appData.zippyPlay) {
+                /* Backup address for color zippy lines */
+                backup = i;
 #if ZIPPY
        #ifdef WIN32
-               /* Backup address for color zippy lines */
-               backup = i;
                if (loggedOn == TRUE)
                        if (ZippyControl(buf, &backup) || ZippyConverse(buf, &backup) ||
-                               (appData.zippyPlay && ZippyMatch(buf, &backup)));
+                       (appData.zippyPlay && ZippyMatch(buf, &backup)));
                #else
                if (ZippyControl(buf, &i) ||
                    ZippyConverse(buf, &i) ||
                    (appData.zippyPlay && ZippyMatch(buf, &i))) {
                    loggedOn = TRUE;
-                   continue;
+                   if (!appData.colorize) continue;
                }
        #endif
 #endif
@@ -2445,6 +2439,11 @@ read_from_ics(isr, closure, data, count, error)
                if (gameMode == IcsObserving &&
                    atoi(star_match[0]) == ics_gamenum)
                  {
+                         /* icsEngineAnalyze */
+                         if (appData.icsEngineAnalyze) {
+                            ExitAnalyzeMode();
+                                ModeHighlight();
+                         }
                      StopClocks();
                      gameMode = IcsIdle;
                      ics_gamenum = -1;
@@ -2856,7 +2855,7 @@ ParseBoard12(string)
     /* Update currentMove and known move number limits */
     newMove = newGame || moveNum > forwardMostMove;
 
-       /* If we found takebacks during icsEngineAnalyze 
+       /* If we found takebacks during icsEngineAnalyze
           try send to engine */
        if (!newGame && appData.icsEngineAnalyze && moveNum < forwardMostMove) {
                takeback = forwardMostMove - moveNum;
@@ -4393,6 +4392,7 @@ HandleMachineMove(message, cps)
            break;
          case AnalyzeMode:
          case AnalyzeFile:
+               break;
          /* icsEngineAnalyze */
          case IcsObserving:
                if (!appData.icsEngineAnalyze) ignore = TRUE;
@@ -5007,7 +5007,7 @@ StartChessProgram(cps)
 
     cps->isr = AddInputSource(cps->pr, TRUE, ReceiveFromProgram, cps);
     if (cps->protocolVersion > 1) {
-      sprintf(buf, "xboard\nprotover %d\n", cps->protocolVersion);
+      sprintf(buf, "xboard\ngui xboard %s\nprotover %d\n", VERSION, cps->protocolVersion);
       SendToProgram(buf, cps);
     } else {
       SendToProgram("xboard\n", cps);
@@ -7787,9 +7787,10 @@ void
 ExitAnalyzeMode()
 {
        /* icsEngineAnalyze - possible call from other functions */
-       if (appData.icsEngineAnalyze) 
+       if (appData.icsEngineAnalyze) {
            appData.icsEngineAnalyze = FALSE;
-
+               DisplayMessage("","Close ICS engine analyze...");
+       }
     if (first.analysisSupport && first.analyzing) {
       SendToProgram("exit\n", &first);
       first.analyzing = FALSE;
@@ -8920,12 +8921,12 @@ ReceiveFromProgram(isr, closure, message, count, error)
                cps->which, message);
     }
        /* if icsEngineAnalyze is active we block all
-          whisper and kibitz output, because nobody want 
-          see this 
+          whisper and kibitz output, because nobody want
+          see this
         */
        if (appData.icsEngineAnalyze) {
                if (strstr(message, "whisper") != NULL ||
-                   strstr(message, "kibitz") != NULL || 
+                   strstr(message, "kibitz") != NULL ||
                        strstr(message, "tellics") != NULL) return;
                HandleMachineMove(message, cps);
        } else {
@@ -9270,7 +9271,7 @@ DisplayAnalysisText(text)
 {
     char buf[MSG_SIZ];
 
-    if (gameMode == AnalyzeMode || gameMode == AnalyzeFile 
+    if (gameMode == AnalyzeMode || gameMode == AnalyzeFile
                || appData.icsEngineAnalyze) {
        sprintf(buf, "Analysis (%s)", first.tidy);
        AnalysisPopUp(buf, text);