Merge commit 'v4.3.16'
[xboard.git] / backend.c
index 25ee4c0..b8cfa92 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -120,6 +120,16 @@ extern int gettimeofday(struct timeval *, struct timezone *);
 # include "zippy.h"\r
 #endif\r
 #include "backendz.h"\r
+#include "gettext.h" \r
\r
+#ifdef ENABLE_NLS \r
+# define _(s) gettext (s) \r
+# define N_(s) gettext_noop (s) \r
+#else \r
+# define _(s) (s) \r
+# define N_(s) s \r
+#endif \r
+\r
 \r
 /* A point in time */\r
 typedef struct {\r
@@ -198,6 +208,11 @@ void ParseFeatures P((char* args, ChessProgramState *cps));
 void InitBackEnd3 P((void));\r
 void FeatureDone P((ChessProgramState* cps, int val));\r
 void InitChessProgram P((ChessProgramState *cps, int setup));\r
+\r
+#ifdef WIN32\r
+       extern void ConsoleCreate();\r
+#endif\r
+\r
 ChessProgramState *WhitePlayer();\r
 void InsertIntoMemo P((int which, char *text)); // [HGM] kibitz: in engineo.c\r
 int VerifyDisplayMode P(());\r
@@ -290,6 +305,26 @@ static char * safeStrCat( char * dst, const char * src, size_t count )
     return dst;\r
 }\r
 \r
+/* Some compiler can't cast u64 to double\r
+ * This function do the job for us:\r
+\r
+ * We use the highest bit for cast, this only\r
+ * works if the highest bit is not\r
+ * in use (This should not happen)\r
+ *\r
+ * We used this for all compiler\r
+ */\r
+double\r
+u64ToDouble(u64 value)\r
+{\r
+  double r;\r
+  u64 tmp = value & u64Const(0x7fffffffffffffff);\r
+  r = (double)(s64)tmp;\r
+  if (value & u64Const(0x8000000000000000))\r
+       r +=  9.2233720368547758080e18; /* 2^63 */\r
+ return r;\r
+}\r
+\r
 /* Fake up flags for now, as we aren't keeping track of castling\r
    availability yet. [HGM] Change of logic: the flag now only\r
    indicates the type of castlings allowed by the rule of the game.\r
@@ -355,12 +390,8 @@ int gotPremove = 0;
 Boolean alarmSounded;\r
 /* end premove variables */\r
 \r
-#define ICS_GENERIC 0\r
-#define ICS_ICC 1\r
-#define ICS_FICS 2\r
-#define ICS_CHESSNET 3 /* not really supported */\r
-int ics_type = ICS_GENERIC;\r
 char *ics_prefix = "$";\r
+int ics_type = ICS_GENERIC;\r
 \r
 int currentMove = 0, forwardMostMove = 0, backwardMostMove = 0;\r
 int pauseExamForwardMostMove = 0;\r
@@ -626,7 +657,7 @@ InitBackEnd1()
     if (!ParseTimeControl(appData.timeControl, appData.timeIncrement,\r
                          appData.movesPerSession)) {\r
        char buf[MSG_SIZ];\r
-       sprintf(buf, "bad timeControl option %s", appData.timeControl);\r
+       sprintf(buf, _("bad timeControl option %s"), appData.timeControl);\r
        DisplayFatalError(buf, 0, 2);\r
     }\r
 \r
@@ -641,7 +672,7 @@ InitBackEnd1()
            searchTime = min * 60 + sec;\r
        } else {\r
            char buf[MSG_SIZ];\r
-           sprintf(buf, "bad searchTime option %s", appData.searchTime);\r
+           sprintf(buf, _("bad searchTime option %s"), appData.searchTime);\r
            DisplayFatalError(buf, 0, 2);\r
        }\r
     }\r
@@ -738,7 +769,7 @@ InitBackEnd1()
     if (appData.firstProtocolVersion > PROTOVER ||\r
        appData.firstProtocolVersion < 1) {\r
       char buf[MSG_SIZ];\r
-      sprintf(buf, "protocol version %d not supported",\r
+      sprintf(buf, _("protocol version %d not supported"),\r
              appData.firstProtocolVersion);\r
       DisplayFatalError(buf, 0, 2);\r
     } else {\r
@@ -748,7 +779,7 @@ InitBackEnd1()
     if (appData.secondProtocolVersion > PROTOVER ||\r
        appData.secondProtocolVersion < 1) {\r
       char buf[MSG_SIZ];\r
-      sprintf(buf, "protocol version %d not supported",\r
+      sprintf(buf, _("protocol version %d not supported"),\r
              appData.secondProtocolVersion);\r
       DisplayFatalError(buf, 0, 2);\r
     } else {\r
@@ -806,7 +837,7 @@ InitBackEnd1()
       case VariantBughouse:     /* need four players and two boards */\r
       case VariantKriegspiel:   /* need to hide pieces and move details */\r
       /* case VariantFischeRandom: (Fabien: moved below) */\r
-       sprintf(buf, "Variant %s supported only in ICS mode", appData.variant);\r
+       sprintf(buf, _("Variant %s supported only in ICS mode"), appData.variant);\r
        DisplayFatalError(buf, 0, 2);\r
        return;\r
 \r
@@ -821,7 +852,7 @@ InitBackEnd1()
       case Variant35:\r
       case Variant36:\r
       default:\r
-       sprintf(buf, "Unknown variant name %s", appData.variant);\r
+       sprintf(buf, _("Unknown variant name %s"), appData.variant);\r
        DisplayFatalError(buf, 0, 2);\r
        return;\r
 \r
@@ -1049,7 +1080,7 @@ InitBackEnd2()
     } else {\r
       /* kludge: allow timeout for initial "feature" commands */\r
       FreezeUI();\r
-      DisplayMessage("", "Starting chess program");\r
+      DisplayMessage("", _("Starting chess program"));\r
       ScheduleDelayedEvent(InitBackEnd3, FEATURE_TIMEOUT);\r
     }\r
 }\r
@@ -1063,14 +1094,19 @@ InitBackEnd3 P((void))
 \r
     InitChessProgram(&first, startedFromSetupPosition);\r
 \r
+\r
     if (appData.icsActive) {\r
+#ifdef WIN32\r
+        /* [DM] Make a console window if needed [HGM] merged ifs */\r
+        ConsoleCreate(); \r
+#endif\r
        err = establish();\r
        if (err != 0) {\r
            if (*appData.icsCommPort != NULLCHAR) {\r
-               sprintf(buf, "Could not open comm port %s",  \r
+               sprintf(buf, _("Could not open comm port %s"),  \r
                        appData.icsCommPort);\r
            } else {\r
-               sprintf(buf, "Could not connect to host %s, port %s",  \r
+               sprintf(buf, _("Could not connect to host %s, port %s"),  \r
                        appData.icsHost, appData.icsPort);\r
            }\r
            DisplayFatalError(buf, err, 1);\r
@@ -1115,7 +1151,7 @@ InitBackEnd3 P((void))
     } else if (StrCaseCmp(appData.initialMode, "Training") == 0) {\r
       initialMode = Training;\r
     } else {\r
-      sprintf(buf, "Unknown initialMode %s", appData.initialMode);\r
+      sprintf(buf, _("Unknown initialMode %s"), appData.initialMode);\r
       DisplayFatalError(buf, 0, 2);\r
       return;\r
     }\r
@@ -1123,7 +1159,7 @@ InitBackEnd3 P((void))
     if (appData.matchMode) {\r
        /* Set up machine vs. machine match */\r
        if (appData.noChessProgram) {\r
-           DisplayFatalError("Can't have a match with no chess programs",\r
+           DisplayFatalError(_("Can't have a match with no chess programs"),\r
                              0, 2);\r
            return;\r
        }\r
@@ -1135,7 +1171,7 @@ InitBackEnd3 P((void))
            if (!LoadGameFromFile(appData.loadGameFile,\r
                                  index,\r
                                  appData.loadGameFile, FALSE)) {\r
-               DisplayFatalError("Bad game file", 0, 1);\r
+               DisplayFatalError(_("Bad game file"), 0, 1);\r
                return;\r
            }\r
        } else if (*appData.loadPositionFile != NULLCHAR) {\r
@@ -1144,7 +1180,7 @@ InitBackEnd3 P((void))
            if (!LoadPositionFromFile(appData.loadPositionFile,\r
                                      index,\r
                                      appData.loadPositionFile)) {\r
-               DisplayFatalError("Bad position file", 0, 1);\r
+               DisplayFatalError(_("Bad position file"), 0, 1);\r
                return;\r
            }\r
        }\r
@@ -1156,7 +1192,7 @@ InitBackEnd3 P((void))
        /* Set up other modes */\r
        if (initialMode == AnalyzeFile) {\r
          if (*appData.loadGameFile == NULLCHAR) {\r
-           DisplayFatalError("AnalyzeFile mode requires a game file", 0, 1);\r
+           DisplayFatalError(_("AnalyzeFile mode requires a game file"), 0, 1);\r
            return;\r
          }\r
        }\r
@@ -1184,11 +1220,11 @@ InitBackEnd3 P((void))
        }\r
        if (initialMode == AnalyzeMode) {\r
          if (appData.noChessProgram) {\r
-           DisplayFatalError("Analysis mode requires a chess engine", 0, 2);\r
+           DisplayFatalError(_("Analysis mode requires a chess engine"), 0, 2);\r
            return;\r
          }\r
          if (appData.icsActive) {\r
-           DisplayFatalError("Analysis mode does not work with ICS mode",0,2);\r
+           DisplayFatalError(_("Analysis mode does not work with ICS mode"),0,2);\r
            return;\r
          }\r
          AnalyzeModeEvent();\r
@@ -1199,36 +1235,36 @@ InitBackEnd3 P((void))
          AnalysisPeriodicEvent(1);\r
        } else if (initialMode == MachinePlaysWhite) {\r
          if (appData.noChessProgram) {\r
-           DisplayFatalError("MachineWhite mode requires a chess engine",\r
+           DisplayFatalError(_("MachineWhite mode requires a chess engine"),\r
                              0, 2);\r
            return;\r
          }\r
          if (appData.icsActive) {\r
-           DisplayFatalError("MachineWhite mode does not work with ICS mode",\r
+           DisplayFatalError(_("MachineWhite mode does not work with ICS mode"),\r
                              0, 2);\r
            return;\r
          }\r
          MachineWhiteEvent();\r
        } else if (initialMode == MachinePlaysBlack) {\r
          if (appData.noChessProgram) {\r
-           DisplayFatalError("MachineBlack mode requires a chess engine",\r
+           DisplayFatalError(_("MachineBlack mode requires a chess engine"),\r
                              0, 2);\r
            return;\r
          }\r
          if (appData.icsActive) {\r
-           DisplayFatalError("MachineBlack mode does not work with ICS mode",\r
+           DisplayFatalError(_("MachineBlack mode does not work with ICS mode"),\r
                              0, 2);\r
            return;\r
          }\r
          MachineBlackEvent();\r
        } else if (initialMode == TwoMachinesPlay) {\r
          if (appData.noChessProgram) {\r
-           DisplayFatalError("TwoMachines mode requires a chess engine",\r
+           DisplayFatalError(_("TwoMachines mode requires a chess engine"),\r
                              0, 2);\r
            return;\r
          }\r
          if (appData.icsActive) {\r
-           DisplayFatalError("TwoMachines mode does not work with ICS mode",\r
+           DisplayFatalError(_("TwoMachines mode does not work with ICS mode"),\r
                              0, 2);\r
            return;\r
          }\r
@@ -1239,7 +1275,7 @@ InitBackEnd3 P((void))
          EditPositionEvent();\r
        } else if (initialMode == Training) {\r
          if (*appData.loadGameFile == NULLCHAR) {\r
-           DisplayFatalError("Training mode requires a game file", 0, 2);\r
+           DisplayFatalError(_("Training mode requires a game file"), 0, 2);\r
            return;\r
          }\r
          TrainingEvent();\r
@@ -1387,14 +1423,14 @@ read_from_player(isr, closure, message, count, error)
        gotEof = 0;\r
        outCount = OutputMaybeTelnet(icsPR, message, count, &outError);\r
        if (outCount < count) {\r
-            DisplayFatalError("Error writing to ICS", outError, 1);\r
+            DisplayFatalError(_("Error writing to ICS"), outError, 1);\r
        }\r
     } else if (count < 0) {\r
        RemoveInputSource(isr);\r
-       DisplayFatalError("Error reading from keyboard", error, 1);\r
+       DisplayFatalError(_("Error reading from keyboard"), error, 1);\r
     } else if (gotEof++ > 0) {\r
        RemoveInputSource(isr);\r
-       DisplayFatalError("Got end of file from keyboard", 0, 0);\r
+       DisplayFatalError(_("Got end of file from keyboard"), 0, 0);\r
     }\r
 }\r
 \r
@@ -1409,7 +1445,7 @@ SendToICS(s)
     count = strlen(s);\r
     outCount = OutputMaybeTelnet(icsPR, s, count, &outError);\r
     if (outCount < count) {\r
-       DisplayFatalError("Error writing to ICS", outError, 1);\r
+       DisplayFatalError(_("Error writing to ICS"), outError, 1);\r
     }\r
 }\r
 \r
@@ -1434,7 +1470,7 @@ SendToICSDelayed(s,msdelay)
     outCount = OutputToProcessDelayed(icsPR, s, count, &outError,\r
                                      msdelay);\r
     if (outCount < count) {\r
-       DisplayFatalError("Error writing to ICS", outError, 1);\r
+       DisplayFatalError(_("Error writing to ICS"), outError, 1);\r
     }\r
 }\r
 \r
@@ -1678,7 +1714,7 @@ StringToVariant(e)
          v = VariantNormal;\r
          break;\r
        default:\r
-         sprintf(buf, "Unknown wild type %d", wnum);\r
+         sprintf(buf, _("Unknown wild type %d"), wnum);\r
          DisplayError(buf, 0);\r
          v = VariantUnknown;\r
          break;\r
@@ -1686,7 +1722,7 @@ StringToVariant(e)
       }\r
     }\r
     if (appData.debugMode) {\r
-      fprintf(debugFP, "recognized '%s' (%d) as variant %s\n",\r
+      fprintf(debugFP, _("recognized '%s' (%d) as variant %s\n"),\r
              e, wnum, VariantName(v));\r
     }\r
     return v;\r
@@ -1751,7 +1787,7 @@ SendToPlayer(data, length)
     int error, outCount;\r
     outCount = OutputToProcess(NoProc, data, length, &error);\r
     if (outCount < length) {\r
-       DisplayFatalError("Error writing to display", error, 1);\r
+       DisplayFatalError(_("Error writing to display"), error, 1);\r
     }\r
 }\r
 \r
@@ -1837,7 +1873,7 @@ TelnetRequest(ddww, option)
     msg[2] = option;\r
     outCount = OutputToProcess(icsPR, (char *)msg, 3, &outError);\r
     if (outCount < 3) {\r
-       DisplayFatalError("Error writing to ICS", outError, 1);\r
+       DisplayFatalError(_("Error writing to ICS"), outError, 1);\r
     }\r
 }\r
 \r
@@ -2027,9 +2063,9 @@ read_from_ics(isr, closure, data, count, error)
     int buf_len;\r
     int next_out;\r
     int tkind;\r
+    int backup;    /* [DM] For zippy color lines */\r
     char *p;\r
 \r
-#ifdef WIN32\r
     if (appData.debugMode) {\r
       if (!error) {\r
        fprintf(debugFP, "<ICS: ");\r
@@ -2037,7 +2073,6 @@ read_from_ics(isr, closure, data, count, error)
        fprintf(debugFP, "\n");\r
       }\r
     }\r
-#endif\r
 \r
     if (appData.debugMode) { int f = forwardMostMove;\r
         fprintf(debugFP, "ics input %d, castling = %d %d %d %d %d %d\n", f,\r
@@ -2226,7 +2261,7 @@ read_from_ics(isr, closure, data, count, error)
                            OutputKibitz(suppressKibitz, parse);\r
                        } else {\r
                            char tmp[MSG_SIZ];\r
-                           sprintf(tmp, "your opponent kibitzes: %s", parse);\r
+                           sprintf(tmp, _("your opponent kibitzes: %s"), parse);\r
                            SendToPlayer(tmp, strlen(tmp));\r
                        }\r
                    }\r
@@ -2312,6 +2347,7 @@ read_from_ics(isr, closure, data, count, error)
            oldi = i;\r
            // [HGM] kibitz: try to recognize opponent engine-score kibitzes, to divert them to engine-output window\r
            if (appData.autoKibitz && started == STARTED_NONE && \r
+                !appData.icsEngineAnalyze &&                     // [HGM] [DM] ICS analyze\r
                (gameMode == IcsPlayingWhite || gameMode == IcsPlayingBlack || gameMode == IcsObserving)) {\r
                if(looking_at(buf, &i, "* kibitzes: ") &&\r
                   (StrStr(star_match[0], gameInfo.white) == star_match[0] || \r
@@ -2338,16 +2374,24 @@ read_from_ics(isr, closure, data, count, error)
            } // [HGM] kibitz: end of patch\r
 \r
            if (appData.zippyTalk || appData.zippyPlay) {\r
+                /* [DM] Backup address for color zippy lines */\r
+                backup = i;\r
 #if ZIPPY\r
-               if (ZippyControl(buf, &i) ||\r
-                   ZippyConverse(buf, &i) ||\r
-                   (appData.zippyPlay && ZippyMatch(buf, &i))) {\r
-                   loggedOn = TRUE;\r
-                   continue;\r
+       #ifdef WIN32\r
+               if (loggedOn == TRUE)\r
+                       if (ZippyControl(buf, &backup) || ZippyConverse(buf, &backup) ||\r
+                          (appData.zippyPlay && ZippyMatch(buf, &backup)));\r
+       #else\r
+                if (ZippyControl(buf, &i) ||\r
+                    ZippyConverse(buf, &i) ||\r
+                    (appData.zippyPlay && ZippyMatch(buf, &i))) {\r
+                     loggedOn = TRUE;\r
+                      if (!appData.colorize) continue;\r
                }\r
+       #endif\r
 #endif\r
-           } else {\r
-               if (/* Don't color "message" or "messages" output */\r
+           } // [DM] 'else { ' deleted\r
+               if (/* Don't color "message" or "messages" output */\r
                    (tkind = 5, looking_at(buf, &i, "*. * (*:*): ")) ||\r
                    looking_at(buf, &i, "*. * at *:*: ") ||\r
                    looking_at(buf, &i, "--* (*:*): ") ||\r
@@ -2502,7 +2546,6 @@ read_from_ics(isr, closure, data, count, error)
                        curColor = ColorSeek;\r
                    }\r
                    continue;\r
-               }\r
            }\r
 \r
            if (looking_at(buf, &i, "\\   ")) {\r
@@ -2613,7 +2656,7 @@ read_from_ics(isr, closure, data, count, error)
                  case H_GOT_UNWANTED_HEADER:\r
                  case H_GETTING_MOVES:\r
                    /* Should not happen */\r
-                   DisplayError("Error gathering move list: two headers", 0);\r
+                   DisplayError(_("Error gathering move list: two headers"), 0);\r
                    ics_getting_history = H_FALSE;\r
                    break;\r
                }\r
@@ -2627,7 +2670,7 @@ read_from_ics(isr, closure, data, count, error)
                    gameInfo.whiteRating = string_to_rating(star_match[1]);\r
                    gameInfo.blackRating = string_to_rating(star_match[3]);\r
                    if (appData.debugMode)\r
-                     fprintf(debugFP, "Ratings from header: W %d, B %d\n", \r
+                     fprintf(debugFP, _("Ratings from header: W %d, B %d\n"), \r
                              gameInfo.whiteRating, gameInfo.blackRating);\r
                }\r
                continue;\r
@@ -2660,7 +2703,7 @@ read_from_ics(isr, closure, data, count, error)
                    break;\r
                  case H_GETTING_MOVES:\r
                    /* Should not happen */\r
-                   DisplayError("Error gathering move list: nested", 0);\r
+                   DisplayError(_("Error gathering move list: nested"), 0);\r
                    ics_getting_history = H_FALSE;\r
                    break;\r
                  case H_GOT_REQ_HEADER:\r
@@ -2897,7 +2940,7 @@ read_from_ics(isr, closure, data, count, error)
                    if (forwardMostMove > backwardMostMove) {\r
                        currentMove = --forwardMostMove;\r
                        DisplayMove(currentMove - 1); /* before DMError */\r
-                       DisplayMoveError("Illegal move (rejected by ICS)");\r
+                       DisplayMoveError(_("Illegal move (rejected by ICS)"));\r
                        DrawPosition(FALSE, boards[currentMove]);\r
                        SwitchClocks();\r
                        DisplayBothClocks();\r
@@ -3052,6 +3095,11 @@ read_from_ics(isr, closure, data, count, error)
                if (gameMode == IcsObserving &&\r
                    atoi(star_match[0]) == ics_gamenum)\r
                  {\r
+                      /* icsEngineAnalyze */\r
+                      if (appData.icsEngineAnalyze) {\r
+                            ExitAnalyzeMode();\r
+                            ModeHighlight();\r
+                      }\r
                      StopClocks();\r
                      gameMode = IcsIdle;\r
                      ics_gamenum = -1;\r
@@ -3206,9 +3254,9 @@ read_from_ics(isr, closure, data, count, error)
        \r
     } else if (count == 0) {\r
        RemoveInputSource(isr);\r
-        DisplayFatalError("Connection closed by ICS", 0, 0);\r
+        DisplayFatalError(_("Connection closed by ICS"), 0, 0);\r
     } else {\r
-       DisplayFatalError("Error reading from ICS", error, 1);\r
+       DisplayFatalError(_("Error reading from ICS"), error, 1);\r
     }\r
 }\r
 \r
@@ -3238,8 +3286,8 @@ ParseBoard12(string)
      char *string;\r
 { \r
     GameMode newGameMode;\r
-    int gamenum, newGame, newMove, relation, basetime, increment, ics_flip = 0;\r
-    int j, k, n, moveNum, white_stren, black_stren, white_time, black_time;\r
+    int gamenum, newGame, newMove, relation, basetime, increment, ics_flip = 0, i;\r
+    int j, k, n, moveNum, white_stren, black_stren, white_time, black_time, takeback;\r
     int double_push, castle_ws, castle_wl, castle_bs, castle_bl, irrev_count;\r
     char to_play, board_chars[200];\r
     char move_str[500], str[500], elapsed_time[500];\r
@@ -3258,7 +3306,7 @@ ParseBoard12(string)
     newGame = FALSE;\r
 \r
     if (appData.debugMode)\r
-      fprintf(debugFP, "Parsing board: %s\n", string);\r
+      fprintf(debugFP, _("Parsing board: %s\n"), string);\r
 \r
     move_str[0] = NULLCHAR;\r
     elapsed_time[0] = NULLCHAR;\r
@@ -3281,7 +3329,7 @@ ParseBoard12(string)
               &ticking);\r
 \r
     if (n < 21) {\r
-       sprintf(str, "Failed to parse board string:\n\"%s\"", string);\r
+       sprintf(str, _("Failed to parse board string:\n\"%s\""), string);\r
        DisplayError(str, 0);\r
        return;\r
     }\r
@@ -3290,7 +3338,7 @@ ParseBoard12(string)
     moveNum = (moveNum - 1) * 2;\r
     if (to_play == 'B') moveNum++;\r
     if (moveNum >= MAX_MOVES) {\r
-      DisplayFatalError("Game too long; increase MAX_MOVES and recompile",\r
+      DisplayFatalError(_("Game too long; increase MAX_MOVES and recompile"),\r
                        0, 1);\r
       return;\r
     }\r
@@ -3352,7 +3400,7 @@ ParseBoard12(string)
        return;\r
       case H_GETTING_MOVES:\r
        /* Should not happen */\r
-       DisplayError("Error gathering move list: extra board", 0);\r
+       DisplayError(_("Error gathering move list: extra board"), 0);\r
        ics_getting_history = H_FALSE;\r
        return;\r
     }\r
@@ -3553,6 +3601,16 @@ ParseBoard12(string)
     \r
     /* Update currentMove and known move number limits */\r
     newMove = newGame || moveNum > forwardMostMove;\r
+\r
+    /* [DM] If we found takebacks during icsEngineAnalyze try send to engine */\r
+    if (!newGame && appData.icsEngineAnalyze && moveNum < forwardMostMove) {\r
+        takeback = forwardMostMove - moveNum;\r
+        for (i = 0; i < takeback; i++) {\r
+             if (appData.debugMode) fprintf(debugFP, "take back move\n");\r
+             SendToProgram("undo\n", &first);\r
+        }\r
+    }\r
+\r
     if (newGame) {\r
        forwardMostMove = backwardMostMove = currentMove = moveNum;\r
        if (gameMode == IcsExamining && moveNum == 0) {\r
@@ -3708,7 +3766,7 @@ ParseBoard12(string)
            if ((gameMode == IcsPlayingWhite && WhiteOnMove(moveNum)) ||\r
                (gameMode == IcsPlayingBlack && !WhiteOnMove(moveNum))) {\r
                if (moveList[moveNum - 1][0] == NULLCHAR) {\r
-                   sprintf(str, "Couldn't parse move \"%s\" from ICS",\r
+                   sprintf(str, _("Couldn't parse move \"%s\" from ICS"),\r
                            move_str);\r
                    DisplayError(str, 0);\r
                } else {\r
@@ -3730,7 +3788,7 @@ ParseBoard12(string)
                }\r
            } else if (gameMode == IcsObserving || gameMode == IcsExamining) {\r
              if (moveList[moveNum - 1][0] == NULLCHAR) {\r
-               sprintf(str, "Couldn't parse move \"%s\" from ICS", move_str);\r
+               sprintf(str, _("Couldn't parse move \"%s\" from ICS"), move_str);\r
                DisplayError(str, 0);\r
              } else {\r
                if(gameInfo.variant == currentlyInitializedVariant) // [HGM] refrain sending moves engine can't understand!\r
@@ -3932,7 +3990,7 @@ SendMoveToICS(moveType, fromX, fromY, toX, toY)
 \r
     switch (moveType) {\r
       default:\r
-       sprintf(user_move, "say Internal error; bad moveType %d (%d,%d-%d,%d)",\r
+       sprintf(user_move, _("say Internal error; bad moveType %d (%d,%d-%d,%d)"),\r
                (int)moveType, fromX, fromY, toX, toY);\r
        DisplayError(user_move + strlen("say "), 0);\r
        break;\r
@@ -4668,7 +4726,7 @@ InitPosition(redraw)
     }\r
     if(gameInfo.holdingsSize) gameInfo.holdingsWidth = 2;\r
     if(BOARD_HEIGHT > BOARD_SIZE || BOARD_WIDTH > BOARD_SIZE)\r
-        DisplayFatalError("Recompile to support this BOARD_SIZE!", 0, 2);\r
+        DisplayFatalError(_("Recompile to support this BOARD_SIZE!"), 0, 2);\r
 \r
     pawnRow = gameInfo.boardHeight - 7; /* seems to work in all common variants */\r
     if(pawnRow < 1) pawnRow = 1;\r
@@ -4934,7 +4992,7 @@ OKToStartUserMove(x, y)
       case IcsPlayingBlack:\r
        if (appData.zippyPlay) return FALSE;\r
        if (white_piece) {\r
-           DisplayMoveError("You are playing Black");\r
+           DisplayMoveError(_("You are playing Black"));\r
            return FALSE;\r
        }\r
        break;\r
@@ -4943,18 +5001,18 @@ OKToStartUserMove(x, y)
       case IcsPlayingWhite:\r
        if (appData.zippyPlay) return FALSE;\r
        if (!white_piece) {\r
-           DisplayMoveError("You are playing White");\r
+           DisplayMoveError(_("You are playing White"));\r
            return FALSE;\r
        }\r
        break;\r
 \r
       case EditGame:\r
        if (!white_piece && WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is White's turn");\r
+           DisplayMoveError(_("It is White's turn"));\r
            return FALSE;\r
        }           \r
        if (white_piece && !WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is Black's turn");\r
+           DisplayMoveError(_("It is Black's turn"));\r
            return FALSE;\r
        }           \r
        if (cmailMsgLoaded && (currentMove < cmailOldMove)) {\r
@@ -4974,7 +5032,7 @@ OKToStartUserMove(x, y)
        if (appData.icsActive) return FALSE;\r
        if (!appData.noChessProgram) {\r
            if (!white_piece) {\r
-               DisplayMoveError("You are playing White");\r
+               DisplayMoveError(_("You are playing White"));\r
                return FALSE;\r
            }\r
        }\r
@@ -4982,11 +5040,11 @@ OKToStartUserMove(x, y)
        \r
       case Training:\r
        if (!white_piece && WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is White's turn");\r
+           DisplayMoveError(_("It is White's turn"));\r
            return FALSE;\r
        }           \r
        if (white_piece && !WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is Black's turn");\r
+           DisplayMoveError(_("It is Black's turn"));\r
            return FALSE;\r
        }           \r
        break;\r
@@ -4997,7 +5055,7 @@ OKToStartUserMove(x, y)
     }\r
     if (currentMove != forwardMostMove && gameMode != AnalyzeMode\r
        && gameMode != AnalyzeFile && gameMode != Training) {\r
-       DisplayMoveError("Displayed position is not current");\r
+       DisplayMoveError(_("Displayed position is not current"));\r
        return FALSE;\r
     }\r
     return TRUE;\r
@@ -5067,7 +5125,7 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
       case MachinePlaysWhite:\r
        /* User is moving for Black */\r
        if (WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is White's turn");\r
+           DisplayMoveError(_("It is White's turn"));\r
             return ImpossibleMove;\r
        }\r
        break;\r
@@ -5075,7 +5133,7 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
       case MachinePlaysBlack:\r
        /* User is moving for White */\r
        if (!WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is Black's turn");\r
+           DisplayMoveError(_("It is Black's turn"));\r
             return ImpossibleMove;\r
        }\r
        break;\r
@@ -5089,13 +5147,13 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
             (int) boards[currentMove][fromY][fromX] < (int) EmptySquare) {\r
            /* User is moving for Black */\r
            if (WhiteOnMove(currentMove)) {\r
-               DisplayMoveError("It is White's turn");\r
+               DisplayMoveError(_("It is White's turn"));\r
                 return ImpossibleMove;\r
            }\r
        } else {\r
            /* User is moving for White */\r
            if (!WhiteOnMove(currentMove)) {\r
-               DisplayMoveError("It is Black's turn");\r
+               DisplayMoveError(_("It is Black's turn"));\r
                 return ImpossibleMove;\r
            }\r
        }\r
@@ -5105,7 +5163,7 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
        /* User is moving for Black */\r
        if (WhiteOnMove(currentMove)) {\r
            if (!appData.premove) {\r
-               DisplayMoveError("It is White's turn");\r
+               DisplayMoveError(_("It is White's turn"));\r
            } else if (toX >= 0 && toY >= 0) {\r
                premoveToX = toX;\r
                premoveToY = toY;\r
@@ -5126,7 +5184,7 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
        /* User is moving for White */\r
        if (!WhiteOnMove(currentMove)) {\r
            if (!appData.premove) {\r
-               DisplayMoveError("It is Black's turn");\r
+               DisplayMoveError(_("It is Black's turn"));\r
            } else if (toX >= 0 && toY >= 0) {\r
                premoveToX = toX;\r
                premoveToY = toY;\r
@@ -5185,7 +5243,7 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
     /* [HGM] but possibly ignore an IllegalMove result */\r
     if (appData.testLegality) {\r
        if (moveType == IllegalMove || moveType == ImpossibleMove) {\r
-           DisplayMoveError("Illegal move");\r
+           DisplayMoveError(_("Illegal move"));\r
             return ImpossibleMove;\r
        }\r
     }\r
@@ -5262,10 +5320,10 @@ if(appData.debugMode) fprintf(debugFP, "moveType 1 = %d, promochar = %x\n", move
          gameMode = PlayFromGameFile;\r
          ModeHighlight();\r
          SetTrainingModeOff();\r
-         DisplayInformation("End of game");\r
+         DisplayInformation(_("End of game"));\r
        }\r
       } else {\r
-       DisplayError("Incorrect move", 0);\r
+       DisplayError(_("Incorrect move"), 0);\r
       }\r
       return 1;\r
     }\r
@@ -5602,7 +5660,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
         if (!ParseOneMove(machineMove, forwardMostMove, &moveType,\r
                               &fromX, &fromY, &toX, &toY, &promoChar)) {\r
            /* Machine move could not be parsed; ignore it. */\r
-            sprintf(buf1, "Illegal move \"%s\" from %s machine",\r
+            sprintf(buf1, _("Illegal move \"%s\" from %s machine"),\r
                    machineMove, cps->which);\r
            DisplayError(buf1, 0);\r
             sprintf(buf1, "Xboard: Forfeit due to invalid move: %s (%c%c%c%c) res=%d%c",\r
@@ -5666,7 +5724,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
            first.initDone) {\r
          SendMoveToICS(moveType, fromX, fromY, toX, toY);\r
          ics_user_moved = 1;\r
-         if(appData.autoKibitz) { /* [HGM] kibitz: send most-recent PV info to ICS */\r
+         if(appData.autoKibitz && !appData.icsEngineAnalyze ) { /* [HGM] kibitz: send most-recent PV info to ICS */\r
                char buf[3*MSG_SIZ];\r
 \r
                sprintf(buf, "kibitz %d/%+.2f (%.2f sec, %.0f nodes, %1.0f knps) PV = %s\n",\r
@@ -6084,7 +6142,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
         GameEnds(GameUnfinished, "Engine aborts game", GE_XBOARD);\r
 \r
         if (!ParseFEN(initial_position, &blackPlaysFirst, message + 9)) {\r
-            DisplayError("Bad FEN received from engine", 0);\r
+            DisplayError(_("Bad FEN received from engine"), 0);\r
             return ;\r
         } else {\r
            Reset(FALSE, FALSE);\r
@@ -6226,7 +6284,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
            cps->analysisSupport = FALSE;\r
            cps->analyzing = FALSE;\r
            Reset(FALSE, TRUE);\r
-           sprintf(buf2, "%s does not support analysis", cps->tidy);\r
+           sprintf(buf2, _("%s does not support analysis"), cps->tidy);\r
            DisplayError(buf2, 0);\r
            return;\r
        }\r
@@ -6272,7 +6330,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
        DisplayMove(currentMove-1); /* before DisplayMoveError */\r
        SwitchClocks();\r
        DisplayBothClocks();\r
-       sprintf(buf1, "Illegal move \"%s\" (rejected by %s chess program)",\r
+       sprintf(buf1, _("Illegal move \"%s\" (rejected by %s chess program)"),\r
                parseList[currentMove], cps->which);\r
        DisplayMoveError(buf1);\r
        DrawPosition(FALSE, boards[currentMove]);\r
@@ -6304,7 +6362,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
        || (StrStr(message, "Permission denied") != NULL)) {\r
 \r
        cps->maybeThinking = FALSE;\r
-       sprintf(buf1, "Failed to start %s chess program %s on %s: %s\n",\r
+       sprintf(buf1, _("Failed to start %s chess program %s on %s: %s\n"),\r
                cps->which, cps->program, cps->host, message);\r
        RemoveInputSource(cps->isr);\r
        DisplayFatalError(buf1, 0, 1);\r
@@ -6322,12 +6380,12 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
                (void) CoordsToAlgebraic(boards[forwardMostMove],\r
                                    PosFlags(forwardMostMove), EP_UNKNOWN,\r
                                    fromY, fromX, toY, toX, promoChar, buf1);\r
-               sprintf(buf2, "Hint: %s", buf1);\r
+               sprintf(buf2, _("Hint: %s"), buf1);\r
                DisplayInformation(buf2);\r
            } else {\r
                /* Hint move could not be parsed!? */\r
                sprintf(buf2,\r
-                       "Illegal hint move \"%s\"\nfrom %s chess program",\r
+                       _("Illegal hint move \"%s\"\nfrom %s chess program"),\r
                        buf1, cps->which);\r
                DisplayError(buf2, 0);\r
            }\r
@@ -6509,10 +6567,10 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
        } else if (gameMode == MachinePlaysWhite ||\r
                   gameMode == MachinePlaysBlack) {\r
          if (userOfferedDraw) {\r
-           DisplayInformation("Machine accepts your draw offer");\r
+           DisplayInformation(_("Machine accepts your draw offer"));\r
            GameEnds(GameIsDrawn, "Draw agreed", GE_XBOARD);\r
          } else {\r
-            DisplayInformation("Machine offers a draw\nSelect Action / Draw to agree");\r
+            DisplayInformation(_("Machine offers a draw\nSelect Action / Draw to agree"));\r
          }\r
        }\r
     }\r
@@ -6526,7 +6584,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
                                ) {\r
        int plylev, mvleft, mvtot, curscore, time;\r
        char mvname[MOVE_LEN];\r
-       unsigned long nodes;\r
+       u64 nodes; // [DM]\r
        char plyext;\r
        int ignore = FALSE;\r
        int prefixHint = FALSE;\r
@@ -6543,6 +6601,9 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
            break;\r
          case AnalyzeMode:\r
          case AnalyzeFile:\r
+            break;\r
+          case IcsObserving: /* [DM] icsEngineAnalyze */\r
+            if (!appData.icsEngineAnalyze) ignore = TRUE;\r
            break;\r
          case TwoMachinesPlay:\r
            if ((cps->twoMachinesColor[0] == 'w') != WhiteOnMove(forwardMostMove)) {\r
@@ -6556,7 +6617,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
 \r
        if (!ignore) {\r
            buf1[0] = NULLCHAR;\r
-           if (sscanf(message, "%d%c %d %d %lu %[^\n]\n",\r
+           if (sscanf(message, "%d%c %d %d " u64Display " %[^\n]\n",\r
                       &plylev, &plyext, &curscore, &time, &nodes, buf1) >= 5) {\r
 \r
                if (plyext != ' ' && plyext != '\t') {\r
@@ -6640,7 +6701,8 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
                     strcat( thinkOutput, buf1 );\r
                 }\r
 \r
-               if (currentMove == forwardMostMove || gameMode == AnalyzeMode || gameMode == AnalyzeFile) {\r
+                if (currentMove == forwardMostMove || gameMode == AnalyzeMode\r
+                        || gameMode == AnalyzeFile || appData.icsEngineAnalyze) {\r
                    DisplayMove(currentMove - 1);\r
                    DisplayAnalysis();\r
                }\r
@@ -6667,12 +6729,13 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
 \r
                 SendProgramStatsToFrontend( cps, &programStats );\r
                 \r
-               if (currentMove == forwardMostMove || gameMode==AnalyzeMode || gameMode == AnalyzeFile) {\r
+               if (currentMove == forwardMostMove || gameMode==AnalyzeMode || \r
+                           gameMode == AnalyzeFile || appData.icsEngineAnalyze) {\r
                    DisplayMove(currentMove - 1);\r
                    DisplayAnalysis();\r
                }\r
                return;\r
-           } else if (sscanf(message,"stat01: %d %lu %d %d %d %s",\r
+           } else if (sscanf(message,"stat01: %d " u64Display " %d %d %d %s",\r
                              &time, &nodes, &plylev, &mvleft,\r
                              &mvtot, mvname) >= 5) {\r
                /* The stat01: line is from Crafty (9.29+) in response\r
@@ -6727,7 +6790,8 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
                    strcat(programStats.movelist, p);\r
                 }\r
 \r
-               if (currentMove == forwardMostMove || gameMode==AnalyzeMode || gameMode == AnalyzeFile) {\r
+               if (currentMove == forwardMostMove || gameMode==AnalyzeMode ||\r
+                           gameMode == AnalyzeFile || appData.icsEngineAnalyze) {\r
                    DisplayMove(currentMove - 1);\r
                    DisplayAnalysis();\r
                }\r
@@ -6871,7 +6935,7 @@ ParseGameHistory(game)
            break;\r
          case AmbiguousMove:\r
            /* bug? */\r
-           sprintf(buf, "Ambiguous move in ICS output: \"%s\"", yy_text);\r
+           sprintf(buf, _("Ambiguous move in ICS output: \"%s\""), yy_text);\r
   if (appData.debugMode) {\r
     fprintf(debugFP, "Ambiguous move from ICS: '%s'\n", yy_text);\r
     fprintf(debugFP, "board L=%d, R=%d, H=%d, holdings=%d\n", BOARD_LEFT, BOARD_RGHT, BOARD_HEIGHT, gameInfo.holdingsWidth);\r
@@ -6881,7 +6945,7 @@ ParseGameHistory(game)
            return;\r
          case ImpossibleMove:\r
            /* bug? */\r
-           sprintf(buf, "Illegal move in ICS output: \"%s\"", yy_text);\r
+           sprintf(buf, _("Illegal move in ICS output: \"%s\""), yy_text);\r
   if (appData.debugMode) {\r
     fprintf(debugFP, "Impossible move from ICS: '%s'\n", yy_text);\r
     fprintf(debugFP, "board L=%d, R=%d, H=%d, holdings=%d\n", BOARD_LEFT, BOARD_RGHT, BOARD_HEIGHT, gameInfo.holdingsWidth);\r
@@ -6892,7 +6956,7 @@ ParseGameHistory(game)
          case (ChessMove) 0:   /* end of file */\r
            if (boardIndex < backwardMostMove) {\r
                /* Oops, gap.  How did that happen? */\r
-               DisplayError("Gap in move list", 0);\r
+               DisplayError(_("Gap in move list"), 0);\r
                return;\r
            }\r
            backwardMostMove =  blackPlaysFirst ? 1 : 0;\r
@@ -7312,7 +7376,7 @@ MakeMove(fromX, fromY, toX, toY, promoChar)
     }\r
 \r
     if (forwardMostMove >= MAX_MOVES) {\r
-      DisplayFatalError("Game too long; increase MAX_MOVES and recompile",\r
+      DisplayFatalError(_("Game too long; increase MAX_MOVES and recompile"),\r
                        0, 1);\r
       return;\r
     }\r
@@ -7363,6 +7427,7 @@ ShowMove(fromX, fromY, toX, toY)
 {\r
     int instant = (gameMode == PlayFromGameFile) ?\r
        (matchMode || (appData.timeDelay == 0 && !pausing)) : pausing;\r
+    if(appData.noGUI) return;\r
     if (!pausing || gameMode == PlayFromGameFile || gameMode == AnalyzeFile) {\r
        if (!instant) {\r
            if (forwardMostMove == currentMove + 1) {\r
@@ -7448,7 +7513,7 @@ InitChessProgram(cps, setup)
       char *v = VariantName(gameInfo.variant);\r
       if (cps->protocolVersion != 1 && StrStr(cps->variants, v) == NULL) {\r
         /* [HGM] in protocol 1 we have to assume all variants valid */\r
-       sprintf(buf, "Variant %s not supported by %s", v, cps->tidy);\r
+       sprintf(buf, _("Variant %s not supported by %s"), v, cps->tidy);\r
        DisplayFatalError(buf, 0, 1);\r
        return;\r
       }\r
@@ -7560,7 +7625,7 @@ StartChessProgram(cps)
     }\r
     \r
     if (err != 0) {\r
-       sprintf(buf, "Startup failure on '%s'", cps->program);\r
+       sprintf(buf, _("Startup failure on '%s'"), cps->program);\r
        DisplayFatalError(buf, err, 1);\r
        cps->pr = NoProc;\r
        cps->isr = NULL;\r
@@ -7583,13 +7648,13 @@ void
 TwoMachinesEventIfReady P((void))\r
 {\r
   if (first.lastPing != first.lastPong) {\r
-    DisplayMessage("", "Waiting for first chess program");\r
-    ScheduleDelayedEvent(TwoMachinesEventIfReady, 1000);\r
+    DisplayMessage("", _("Waiting for first chess program"));\r
+    ScheduleDelayedEvent(TwoMachinesEventIfReady, 10); // [HGM] fast: lowered from 1000\r
     return;\r
   }\r
   if (second.lastPing != second.lastPong) {\r
-    DisplayMessage("", "Waiting for second chess program");\r
-    ScheduleDelayedEvent(TwoMachinesEventIfReady, 1000);\r
+    DisplayMessage("", _("Waiting for second chess program"));\r
+    ScheduleDelayedEvent(TwoMachinesEventIfReady, 10); // [HGM] fast: lowered from 1000\r
     return;\r
   }\r
   ThawUI();\r
@@ -7962,7 +8027,7 @@ GameEnds(result, resultDetails, whosays)
        } else {\r
            char buf[MSG_SIZ];\r
            gameMode = nextGameMode;\r
-           sprintf(buf, "Match %s vs. %s: final score %d-%d-%d",\r
+           sprintf(buf, _("Match %s vs. %s: final score %d-%d-%d"),\r
                    first.tidy, second.tidy,\r
                    first.matchWins, second.matchWins,\r
                    appData.matchGames - (first.matchWins + second.matchWins));\r
@@ -8031,8 +8096,8 @@ ResurrectChessProgram()
        timeRemaining[1][currentMove] = blackTimeRemaining;\r
     }\r
 \r
-    if ((gameMode == AnalyzeMode || gameMode == AnalyzeFile) &&\r
-       first.analysisSupport) {\r
+    if ((gameMode == AnalyzeMode || gameMode == AnalyzeFile ||\r
+                appData.icsEngineAnalyze) && first.analysisSupport) {\r
       SendToProgram("analyze\n", &first);\r
       first.analyzing = TRUE;\r
     }\r
@@ -8376,7 +8441,7 @@ LoadGameOneMove(readAhead)
        if (appData.testLegality) {\r
            if (appData.debugMode)\r
              fprintf(debugFP, "Parsed IllegalMove: %s\n", yy_text);\r
-           sprintf(move, "Illegal move: %d.%s%s",\r
+           sprintf(move, _("Illegal move: %d.%s%s"),\r
                    (forwardMostMove / 2) + 1,\r
                    WhiteOnMove(forwardMostMove) ? " " : ".. ", yy_text);\r
            DisplayError(move, 0);\r
@@ -8396,7 +8461,7 @@ LoadGameOneMove(readAhead)
       case AmbiguousMove:\r
        if (appData.debugMode)\r
          fprintf(debugFP, "Parsed AmbiguousMove: %s\n", yy_text);\r
-       sprintf(move, "Ambiguous move: %d.%s%s",\r
+       sprintf(move, _("Ambiguous move: %d.%s%s"),\r
                (forwardMostMove / 2) + 1,\r
                WhiteOnMove(forwardMostMove) ? " " : ".. ", yy_text);\r
        DisplayError(move, 0);\r
@@ -8407,7 +8472,7 @@ LoadGameOneMove(readAhead)
       case ImpossibleMove:\r
        if (appData.debugMode)\r
          fprintf(debugFP, "Parsed ImpossibleMove (type = %d): %s\n", moveType, yy_text);\r
-       sprintf(move, "Illegal move: %d.%s%s",\r
+       sprintf(move, _("Illegal move: %d.%s%s"),\r
                (forwardMostMove / 2) + 1,\r
                WhiteOnMove(forwardMostMove) ? " " : ".. ", yy_text);\r
        DisplayError(move, 0);\r
@@ -8455,7 +8520,7 @@ LoadGameFromFile(filename, n, title, useList)
     } else {\r
        f = fopen(filename, "rb");\r
        if (f == NULL) {\r
-           sprintf(buf, "Can't open \"%s\"", filename);\r
+           sprintf(buf, _("Can't open \"%s\""), filename);\r
            DisplayError(buf, errno);\r
            return FALSE;\r
        }\r
@@ -8467,7 +8532,7 @@ LoadGameFromFile(filename, n, title, useList)
     if (useList && n == 0) {\r
        int error = GameListBuild(f);\r
        if (error) {\r
-           DisplayError("Cannot build game list", error);\r
+           DisplayError(_("Cannot build game list"), error);\r
        } else if (!ListEmpty(&gameList) &&\r
                   ((ListGame *) gameList.tailPred)->number > 1) {\r
            GameListPopUp(f, title);\r
@@ -8556,7 +8621,7 @@ CmailLoadGame(f, gameNumber, title, useList)
     int retVal;\r
 \r
     if (gameNumber > nCmailGames) {\r
-       DisplayError("No more games in this message", 0);\r
+       DisplayError(_("No more games in this message"), 0);\r
        return FALSE;\r
     }\r
     if (f == lastLoadGameFP) {\r
@@ -8597,11 +8662,11 @@ ReloadGame(offset)
 {\r
     int gameNumber = lastLoadGameNumber + offset;\r
     if (lastLoadGameFP == NULL) {\r
-       DisplayError("No game has been loaded yet", 0);\r
+       DisplayError(_("No game has been loaded yet"), 0);\r
        return FALSE;\r
     }\r
     if (gameNumber <= 0) {\r
-       DisplayError("Can't back up any further", 0);\r
+       DisplayError(_("Can't back up any further"), 0);\r
        return FALSE;\r
     }\r
     if (cmailMsgLoaded) {\r
@@ -8657,7 +8722,7 @@ LoadGame(f, gameNumber, title, useList)
            gn = 1;\r
        }\r
        else {\r
-           DisplayError("Game number out of range", 0);\r
+           DisplayError(_("Game number out of range"), 0);\r
            return FALSE;\r
        }\r
     } else {\r
@@ -8668,7 +8733,7 @@ LoadGame(f, gameNumber, title, useList)
                gameNumber == 1) {\r
                gn = 1;\r
            } else {\r
-               DisplayError("Can't seek on game file", 0);\r
+               DisplayError(_("Can't seek on game file"), 0);\r
                return FALSE;\r
            }\r
        }\r
@@ -8726,7 +8791,7 @@ LoadGame(f, gameNumber, title, useList)
                nCmailGames = CMAIL_MAX_GAMES - gn;\r
            } else {\r
                Reset(TRUE, TRUE);\r
-               DisplayError("Game not found in file", 0);\r
+               DisplayError(_("Game not found in file"), 0);\r
            }\r
            return FALSE;\r
 \r
@@ -8853,7 +8918,7 @@ LoadGame(f, gameNumber, title, useList)
          startedFromSetupPosition = TRUE;\r
          if (!ParseFEN(initial_position, &blackPlaysFirst, gameInfo.fen)) {\r
            Reset(TRUE, TRUE);\r
-           DisplayError("Bad FEN position in file", 0);\r
+           DisplayError(_("Bad FEN position in file"), 0);\r
            return FALSE;\r
          }\r
          CopyBoard(boards[0], initial_position);\r
@@ -9011,7 +9076,7 @@ LoadGame(f, gameNumber, title, useList)
     if ((cm == (ChessMove) 0 && lastLoadGameStart != (ChessMove) 0) ||\r
        cm == WhiteWins || cm == BlackWins ||\r
        cm == GameIsDrawn || cm == GameUnfinished) {\r
-       DisplayMessage("", "No moves in game");\r
+       DisplayMessage("", _("No moves in game"));\r
        if (cmailMsgLoaded) {\r
            if (appData.debugMode)\r
              fprintf(debugFP, "Setting flipView to %d.\n", FALSE);\r
@@ -9082,11 +9147,11 @@ ReloadPosition(offset)
 {\r
     int positionNumber = lastLoadPositionNumber + offset;\r
     if (lastLoadPositionFP == NULL) {\r
-       DisplayError("No position has been loaded yet", 0);\r
+       DisplayError(_("No position has been loaded yet"), 0);\r
        return FALSE;\r
     }\r
     if (positionNumber <= 0) {\r
-       DisplayError("Can't back up any further", 0);\r
+       DisplayError(_("Can't back up any further"), 0);\r
        return FALSE;\r
     }\r
     return LoadPosition(lastLoadPositionFP, positionNumber,\r
@@ -9108,7 +9173,7 @@ LoadPositionFromFile(filename, n, title)
     } else {\r
        f = fopen(filename, "rb");\r
        if (f == NULL) {\r
-           sprintf(buf, "Can't open \"%s\"", filename);\r
+           sprintf(buf, _("Can't open \"%s\""), filename);\r
            DisplayError(buf, errno);\r
            return FALSE;\r
        } else {\r
@@ -9149,7 +9214,7 @@ LoadPosition(f, positionNumber, title)
     if (positionNumber < 0) {\r
        /* Negative position number means to seek to that byte offset */\r
        if (fseek(f, -positionNumber, 0) == -1) {\r
-           DisplayError("Can't seek on position file", 0);\r
+           DisplayError(_("Can't seek on position file"), 0);\r
            return FALSE;\r
        };\r
        pn = 1;\r
@@ -9160,14 +9225,14 @@ LoadPosition(f, positionNumber, title)
                positionNumber == 1) {\r
                pn = 1;\r
            } else {\r
-               DisplayError("Can't seek on position file", 0);\r
+               DisplayError(_("Can't seek on position file"), 0);\r
                return FALSE;\r
            }\r
        }\r
     }\r
     /* See if this file is FEN or old-style xboard */\r
     if (fgets(line, MSG_SIZ, f) == NULL) {\r
-       DisplayError("Position not found in file", 0);\r
+       DisplayError(_("Position not found in file"), 0);\r
        return FALSE;\r
     }\r
 #if 0\r
@@ -9197,7 +9262,7 @@ LoadPosition(f, positionNumber, title)
            /* skip positions before number pn */\r
            if (fgets(line, MSG_SIZ, f) == NULL) {\r
                Reset(TRUE, TRUE);\r
-               DisplayError("Position not found in file", 0);\r
+               DisplayError(_("Position not found in file"), 0);\r
                return FALSE;\r
            }\r
            if (fenMode || line[0] == '#') pn--;\r
@@ -9206,7 +9271,7 @@ LoadPosition(f, positionNumber, title)
 \r
     if (fenMode) {\r
        if (!ParseFEN(initial_position, &blackPlaysFirst, line)) {\r
-           DisplayError("Bad FEN position in file", 0);\r
+           DisplayError(_("Bad FEN position in file"), 0);\r
            return FALSE;\r
        }\r
     } else {\r
@@ -9238,10 +9303,10 @@ LoadPosition(f, positionNumber, title)
        strcpy(moveList[0], "");\r
        strcpy(parseList[0], "");\r
        CopyBoard(boards[1], initial_position);\r
-       DisplayMessage("", "Black to play");\r
+       DisplayMessage("", _("Black to play"));\r
     } else {\r
        currentMove = forwardMostMove = backwardMostMove = 0;\r
-       DisplayMessage("", "White to play");\r
+       DisplayMessage("", _("White to play"));\r
     }\r
           /* [HGM] copy FEN attributes as well */\r
           {   int i;\r
@@ -9322,7 +9387,7 @@ SaveGameToFile(filename, append)
     } else {\r
        f = fopen(filename, append ? "a" : "w");\r
        if (f == NULL) {\r
-           sprintf(buf, "Can't open \"%s\"", filename);\r
+           sprintf(buf, _("Can't open \"%s\""), filename);\r
            DisplayError(buf, errno);\r
            return FALSE;\r
        } else {\r
@@ -9693,7 +9758,7 @@ SavePositionToFile(filename)
     } else {\r
        f = fopen(filename, "a");\r
        if (f == NULL) {\r
-           sprintf(buf, "Can't open \"%s\"", filename);\r
+           sprintf(buf, _("Can't open \"%s\""), filename);\r
            DisplayError(buf, errno);\r
            return FALSE;\r
        } else {\r
@@ -9823,17 +9888,17 @@ RegisterMove()
     }\r
 \r
     if (cmailOldMove == -1) {\r
-       DisplayError("You have edited the game history.\nUse Reload Same Game and make your move again.", 0);\r
+       DisplayError(_("You have edited the game history.\nUse Reload Same Game and make your move again."), 0);\r
        return FALSE;\r
     }\r
 \r
     if (currentMove > cmailOldMove + 1) {\r
-       DisplayError("You have entered too many moves.\nBack up to the correct position and try again.", 0);\r
+       DisplayError(_("You have entered too many moves.\nBack up to the correct position and try again."), 0);\r
        return FALSE;\r
     }\r
 \r
     if (currentMove < cmailOldMove) {\r
-       DisplayError("Displayed position is not current.\nStep forward to the correct position and try again.", 0);\r
+       DisplayError(_("Displayed position is not current.\nStep forward to the correct position and try again."), 0);\r
        return FALSE;\r
     }\r
 \r
@@ -9881,7 +9946,7 @@ RegisterMove()
        cmailMoveRegistered[lastLoadGameNumber - 1] = TRUE;\r
        nCmailMovesRegistered ++;\r
     } else if (nCmailGames == 1) {\r
-       DisplayError("You have not made a move yet", 0);\r
+       DisplayError(_("You have not made a move yet"), 0);\r
        return FALSE;\r
     }\r
 \r
@@ -9902,18 +9967,18 @@ MailMoveEvent()
     char *arcDir;\r
 \r
     if (! cmailMsgLoaded) {\r
-       DisplayError("The cmail message is not loaded.\nUse Reload CMail Message and make your move again.", 0);\r
+       DisplayError(_("The cmail message is not loaded.\nUse Reload CMail Message and make your move again."), 0);\r
        return;\r
     }\r
 \r
     if (nCmailGames == nCmailResults) {\r
-       DisplayError("No unfinished games", 0);\r
+       DisplayError(_("No unfinished games"), 0);\r
        return;\r
     }\r
 \r
 #if CMAIL_PROHIBIT_REMAIL\r
     if (cmailMailedMove) {\r
-       sprintf(msg, "You have already mailed a move.\nWait until a move arrives from your opponent.\nTo resend the same move, type\n\"cmail -remail -game %s\"\non the command line.", appData.cmailGameName);\r
+       sprintf(msg, _("You have already mailed a move.\nWait until a move arrives from your opponent.\nTo resend the same move, type\n\"cmail -remail -game %s\"\non the command line."), appData.cmailGameName);\r
        DisplayError(msg, 0);\r
        return;\r
     }\r
@@ -9925,10 +9990,10 @@ MailMoveEvent()
        || (nCmailMovesRegistered + nCmailResults == nCmailGames)) {\r
        sprintf(string, partCommandString,\r
                appData.debugMode ? " -v" : "", appData.cmailGameName);\r
-       commandOutput = popen(string, "rb");\r
+       commandOutput = popen(string, "r");\r
 \r
        if (commandOutput == NULL) {\r
-           DisplayError("Failed to invoke cmail", 0);\r
+           DisplayError(_("Failed to invoke cmail"), 0);\r
        } else {\r
            for (nBuffers = 0; (! feof(commandOutput)); nBuffers ++) {\r
                nBytes = fread(buffer, 1, MSG_SIZ - 1, commandOutput);\r
@@ -9990,7 +10055,7 @@ CmailMsg()
     if (!cmailMsgLoaded) return "";\r
 \r
     if (cmailMailedMove) {\r
-       sprintf(cmailMsg, "Waiting for reply from opponent\n");\r
+       sprintf(cmailMsg, _("Waiting for reply from opponent\n"));\r
     } else {\r
        /* Create a list of games left */\r
        sprintf(string, "[");\r
@@ -10013,17 +10078,17 @@ CmailMsg()
            switch (nCmailGames) {\r
              case 1:\r
                sprintf(cmailMsg,\r
-                       "Still need to make move for game\n");\r
+                       _("Still need to make move for game\n"));\r
                break;\r
                \r
              case 2:\r
                sprintf(cmailMsg,\r
-                       "Still need to make moves for both games\n");\r
+                       _("Still need to make moves for both games\n"));\r
                break;\r
                \r
              default:\r
                sprintf(cmailMsg,\r
-                       "Still need to make moves for all %d games\n",\r
+                       _("Still need to make moves for all %d games\n"),\r
                        nCmailGames);\r
                break;\r
            }\r
@@ -10031,21 +10096,21 @@ CmailMsg()
            switch (nCmailGames - nCmailMovesRegistered - nCmailResults) {\r
              case 1:\r
                sprintf(cmailMsg,\r
-                       "Still need to make a move for game %s\n",\r
+                       _("Still need to make a move for game %s\n"),\r
                        string);\r
                break;\r
                \r
              case 0:\r
                if (nCmailResults == nCmailGames) {\r
-                   sprintf(cmailMsg, "No unfinished games\n");\r
+                   sprintf(cmailMsg, _("No unfinished games\n"));\r
                } else {\r
-                   sprintf(cmailMsg, "Ready to send mail\n");\r
+                   sprintf(cmailMsg, _("Ready to send mail\n"));\r
                }\r
                break;\r
                \r
              default:\r
                sprintf(cmailMsg,\r
-                       "Still need to make moves for games %s\n",\r
+                       _("Still need to make moves for games %s\n"),\r
                        string);\r
            }\r
        }\r
@@ -10213,9 +10278,9 @@ EditCommentEvent()
     char title[MSG_SIZ];\r
 \r
     if (currentMove < 1 || parseList[currentMove - 1][0] == NULLCHAR) {\r
-       strcpy(title, "Edit comment");\r
+       strcpy(title, _("Edit comment"));\r
     } else {\r
-       sprintf(title, "Edit comment on %d.%s%s", (currentMove - 1) / 2 + 1,\r
+       sprintf(title, _("Edit comment on %d.%s%s"), (currentMove - 1) / 2 + 1,\r
                WhiteOnMove(currentMove - 1) ? " " : ".. ",\r
                parseList[currentMove - 1]);\r
     }\r
@@ -10239,17 +10304,19 @@ AnalyzeModeEvent()
       return;\r
 \r
     if (gameMode != AnalyzeFile) {\r
-       EditGameEvent();\r
-       if (gameMode != EditGame) return;\r
+        if (!appData.icsEngineAnalyze) {\r
+               EditGameEvent();\r
+               if (gameMode != EditGame) return;\r
+        }\r
        ResurrectChessProgram();\r
        SendToProgram("analyze\n", &first);\r
        first.analyzing = TRUE;\r
        /*first.maybeThinking = TRUE;*/\r
        first.maybeThinking = FALSE; /* avoid killing GNU Chess */\r
-       AnalysisPopUp("Analysis",\r
-                     "Starting analysis mode...\nIf this message stays up, your chess program does not support analysis.");\r
+       AnalysisPopUp(_("Analysis"),\r
+                     _("Starting analysis mode...\nIf this message stays up, your chess program does not support analysis."));\r
     }\r
-    gameMode = AnalyzeMode;\r
+    if (!appData.icsEngineAnalyze) gameMode = AnalyzeMode;\r
     pausing = FALSE;\r
     ModeHighlight();\r
     SetGameInfo();\r
@@ -10273,8 +10340,8 @@ AnalyzeFileEvent()
        first.analyzing = TRUE;\r
        /*first.maybeThinking = TRUE;*/\r
        first.maybeThinking = FALSE; /* avoid killing GNU Chess */\r
-       AnalysisPopUp("Analysis",\r
-                     "Starting analysis mode...\nIf this message stays up, your chess program does not support analysis.");\r
+       AnalysisPopUp(_("Analysis"),\r
+                     _("Starting analysis mode...\nIf this message stays up, your chess program does not support analysis."));\r
     }\r
     gameMode = AnalyzeFile;\r
     pausing = FALSE;\r
@@ -10307,7 +10374,7 @@ MachineWhiteEvent()
         EditPositionDone();\r
 \r
     if (!WhiteOnMove(currentMove)) {\r
-       DisplayError("It is not White's turn", 0);\r
+       DisplayError(_("It is not White's turn"), 0);\r
        return;\r
     }\r
   \r
@@ -10387,7 +10454,7 @@ MachineBlackEvent()
         EditPositionDone();\r
 \r
     if (WhiteOnMove(currentMove)) {\r
-       DisplayError("It is not Black's turn", 0);\r
+       DisplayError(_("It is not Black's turn"), 0);\r
        return;\r
     }\r
     \r
@@ -10480,7 +10547,7 @@ TwoMachinesEvent P((void))
       case MachinePlaysWhite:\r
       case MachinePlaysBlack:\r
        if (WhiteOnMove(forwardMostMove) == (gameMode == MachinePlaysWhite)) {\r
-           DisplayError("Wait until your turn,\nor select Move Now", 0);\r
+           DisplayError(_("Wait until your turn,\nor select Move Now"), 0);\r
            return;\r
        }\r
        /* fall through */\r
@@ -10512,7 +10579,7 @@ TwoMachinesEvent P((void))
        } else {\r
          /* kludge: allow timeout for initial "feature" command */\r
          FreezeUI();\r
-         DisplayMessage("", "Starting second chess program");\r
+         DisplayMessage("", _("Starting second chess program"));\r
          ScheduleDelayedEvent(TwoMachinesEventIfReady, FEATURE_TIMEOUT);\r
        }\r
        return;\r
@@ -10593,7 +10660,7 @@ TrainingEvent()
     if (gameMode == Training) {\r
       SetTrainingModeOff();\r
       gameMode = PlayFromGameFile;\r
-      DisplayMessage("", "Training mode off");\r
+      DisplayMessage("", _("Training mode off"));\r
     } else {\r
       gameMode = Training;\r
       animateTraining = appData.animate;\r
@@ -10601,10 +10668,10 @@ TrainingEvent()
       /* make sure we are not already at the end of the game */\r
       if (currentMove < forwardMostMove) {\r
        SetTrainingModeOn();\r
-       DisplayMessage("", "Training mode on");\r
+       DisplayMessage("", _("Training mode on"));\r
       } else {\r
        gameMode = PlayFromGameFile;\r
-       DisplayError("Already at end of game", 0);\r
+       DisplayError(_("Already at end of game"), 0);\r
       }\r
     }\r
     ModeHighlight();\r
@@ -10685,13 +10752,13 @@ EditGameEvent()
        break;\r
       case IcsPlayingBlack:\r
       case IcsPlayingWhite:\r
-       DisplayError("Warning: You are still playing a game", 0);\r
+       DisplayError(_("Warning: You are still playing a game"), 0);\r
        break;\r
       case IcsObserving:\r
-       DisplayError("Warning: You are still observing a game", 0);\r
+       DisplayError(_("Warning: You are still observing a game"), 0);\r
        break;\r
       case IcsExamining:\r
-       DisplayError("Warning: You are still examining a game", 0);\r
+       DisplayError(_("Warning: You are still examining a game"), 0);\r
        break;\r
       case IcsIdle:\r
        break;\r
@@ -10761,6 +10828,12 @@ EditPositionEvent()
 void\r
 ExitAnalyzeMode()\r
 {\r
+    /* [DM] icsEngineAnalyze - possible call from other functions */\r
+    if (appData.icsEngineAnalyze) {\r
+        appData.icsEngineAnalyze = FALSE;\r
+\r
+        DisplayMessage("",_("Close ICS engine analyze..."));\r
+    }\r
     if (first.analysisSupport && first.analyzing) {\r
       SendToProgram("exit\n", &first);\r
       first.analyzing = FALSE;\r
@@ -10981,7 +11054,7 @@ DropMenuEvent(selection, x, y)
       case IcsPlayingWhite:\r
       case MachinePlaysBlack:\r
        if (!WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is Black's turn");\r
+           DisplayMoveError(_("It is Black's turn"));\r
            return;\r
        }\r
        moveType = WhiteDrop;\r
@@ -10989,7 +11062,7 @@ DropMenuEvent(selection, x, y)
       case IcsPlayingBlack:\r
       case MachinePlaysWhite:\r
        if (WhiteOnMove(currentMove)) {\r
-           DisplayMoveError("It is White's turn");\r
+           DisplayMoveError(_("It is White's turn"));\r
            return;\r
        }\r
        moveType = BlackDrop;\r
@@ -11006,7 +11079,7 @@ DropMenuEvent(selection, x, y)
                                 + (int) BlackPawn - (int) WhitePawn);\r
     }\r
     if (boards[currentMove][y][x] != EmptySquare) {\r
-       DisplayMoveError("That square is occupied");\r
+       DisplayMoveError(_("That square is occupied"));\r
        return;\r
     }\r
 \r
@@ -11030,7 +11103,7 @@ AcceptEvent()
            GameEnds(GameIsDrawn, "Draw agreed", GE_PLAYER);\r
            cmailMoveType[lastLoadGameNumber - 1] = CMAIL_ACCEPT;\r
        } else {\r
-           DisplayError("There is no pending offer on this move", 0);\r
+           DisplayError(_("There is no pending offer on this move"), 0);\r
            cmailMoveType[lastLoadGameNumber - 1] = CMAIL_MOVE;\r
        }\r
     } else {\r
@@ -11056,7 +11129,7 @@ DeclineEvent()
            DisplayComment(cmailOldMove - 1, "Draw declined");\r
 #endif /*NOTDEF*/\r
        } else {\r
-           DisplayError("There is no pending offer on this move", 0);\r
+           DisplayError(_("There is no pending offer on this move"), 0);\r
        }\r
     } else {\r
        /* Not used for offers from chess program */\r
@@ -11092,7 +11165,7 @@ CallFlagEvent()
                else\r
                  GameEnds(BlackWins, "Black wins on time", GE_PLAYER);\r
            } else {\r
-               DisplayError("Your opponent is not out of time", 0);\r
+               DisplayError(_("Your opponent is not out of time"), 0);\r
            }\r
            break;\r
          case MachinePlaysBlack:\r
@@ -11103,7 +11176,7 @@ CallFlagEvent()
                else\r
                  GameEnds(WhiteWins, "White wins on time", GE_PLAYER);\r
            } else {\r
-               DisplayError("Your opponent is not out of time", 0);\r
+               DisplayError(_("Your opponent is not out of time"), 0);\r
            }\r
            break;\r
        }\r
@@ -11138,7 +11211,7 @@ DrawEvent()
            DisplayComment(currentMove - 1, offer);\r
            cmailMoveType[lastLoadGameNumber - 1] = CMAIL_DRAW;\r
        } else {\r
-           DisplayError("You must make your move before offering a draw", 0);\r
+           DisplayError(_("You must make your move before offering a draw"), 0);\r
            cmailMoveType[lastLoadGameNumber - 1] = CMAIL_MOVE;\r
        }\r
     } else if (first.offeredDraw) {\r
@@ -11452,11 +11525,11 @@ void
 RevertEvent()\r
 {\r
     if (gameMode != IcsExamining) {\r
-       DisplayError("You are not examining a game", 0);\r
+       DisplayError(_("You are not examining a game"), 0);\r
        return;\r
     }\r
     if (pausing) {\r
-       DisplayError("You can't revert while pausing", 0);\r
+       DisplayError(_("You can't revert while pausing"), 0);\r
        return;\r
     }\r
     SendToICS(ics_prefix);\r
@@ -11470,7 +11543,7 @@ RetractMoveEvent()
       case MachinePlaysWhite:\r
       case MachinePlaysBlack:\r
        if (WhiteOnMove(forwardMostMove) == (gameMode == MachinePlaysWhite)) {\r
-           DisplayError("Wait until your turn,\nor select Move Now", 0);\r
+           DisplayError(_("Wait until your turn,\nor select Move Now"), 0);\r
            return;\r
        }\r
        if (forwardMostMove < 2) return;\r
@@ -11510,14 +11583,14 @@ MoveNowEvent()
     switch (gameMode) {\r
       case MachinePlaysWhite:\r
        if (!WhiteOnMove(forwardMostMove)) {\r
-           DisplayError("It is your turn", 0);\r
+           DisplayError(_("It is your turn"), 0);\r
            return;\r
        }\r
        cps = &first;\r
        break;\r
       case MachinePlaysBlack:\r
        if (WhiteOnMove(forwardMostMove)) {\r
-           DisplayError("It is your turn", 0);\r
+           DisplayError(_("It is your turn"), 0);\r
            return;\r
        }\r
        cps = &first;\r
@@ -11567,19 +11640,19 @@ HintEvent()
     switch (gameMode) {\r
       case MachinePlaysWhite:\r
        if (WhiteOnMove(forwardMostMove)) {\r
-           DisplayError("Wait until your turn", 0);\r
+           DisplayError(_("Wait until your turn"), 0);\r
            return;\r
        }\r
        break;\r
       case BeginningOfGame:\r
       case MachinePlaysBlack:\r
        if (!WhiteOnMove(forwardMostMove)) {\r
-           DisplayError("Wait until your turn", 0);\r
+           DisplayError(_("Wait until your turn"), 0);\r
            return;\r
        }\r
        break;\r
       default:\r
-       DisplayError("No hint available", 0);\r
+       DisplayError(_("No hint available"), 0);\r
        return;\r
     }\r
     SendToProgram("hint\n", &first);\r
@@ -11593,14 +11666,14 @@ BookEvent()
     switch (gameMode) {\r
       case MachinePlaysWhite:\r
        if (WhiteOnMove(forwardMostMove)) {\r
-           DisplayError("Wait until your turn", 0);\r
+           DisplayError(_("Wait until your turn"), 0);\r
            return;\r
        }\r
        break;\r
       case BeginningOfGame:\r
       case MachinePlaysBlack:\r
        if (!WhiteOnMove(forwardMostMove)) {\r
-           DisplayError("Wait until your turn", 0);\r
+           DisplayError(_("Wait until your turn"), 0);\r
            return;\r
        }\r
        break;\r
@@ -11982,7 +12055,7 @@ SendToProgram(message, cps)
     outCount = OutputToProcess(cps->pr, message, count, &error);\r
     if (outCount < count && !exiting \r
                          && !endingGame) { /* [HGM] crash: to not hang GameEnds() writing to deceased engines */\r
-       sprintf(buf, "Error writing to %s chess program", cps->which);\r
+       sprintf(buf, _("Error writing to %s chess program"), cps->which);\r
         if(gameInfo.resultDetails==NULL) { /* [HGM] crash: if game in progress, give reason for abort */\r
             if(epStatus[forwardMostMove] <= EP_DRAWS) {\r
                 gameInfo.result = GameIsDrawn; /* [HGM] accept exit as draw claim */\r
@@ -12012,12 +12085,12 @@ ReceiveFromProgram(isr, closure, message, count, error)
     if (count <= 0) {\r
        if (count == 0) {\r
            sprintf(buf,\r
-                   "Error: %s chess program (%s) exited unexpectedly",\r
+                   _("Error: %s chess program (%s) exited unexpectedly"),\r
                    cps->which, cps->program);\r
         if(gameInfo.resultDetails==NULL) { /* [HGM] crash: if game in progress, give reason for abort */\r
                 if(epStatus[forwardMostMove] <= EP_DRAWS) {\r
                     gameInfo.result = GameIsDrawn; /* [HGM] accept exit as draw claim */\r
-                    sprintf(buf, "%s program exits in draw position (%s)", cps->which, cps->program);\r
+                    sprintf(buf, _("%s program exits in draw position (%s)"), cps->which, cps->program);\r
                 } else {\r
                     gameInfo.result = cps->twoMachinesColor[0]=='w' ? BlackWins : WhiteWins;\r
                 }\r
@@ -12027,7 +12100,7 @@ ReceiveFromProgram(isr, closure, message, count, error)
            DisplayFatalError(buf, 0, 1);\r
        } else {\r
            sprintf(buf,\r
-                   "Error reading from %s chess program (%s)",\r
+                   _("Error reading from %s chess program (%s)"),\r
                    cps->which, cps->program);\r
            RemoveInputSource(cps->isr);\r
 \r
@@ -12071,6 +12144,14 @@ ReceiveFromProgram(isr, closure, message, count, error)
                        message);\r
        }\r
     }\r
+\r
+    /* [DM] if icsEngineAnalyze is active we block all whisper and kibitz output, because nobody want to see this */\r
+    if (appData.icsEngineAnalyze) {\r
+        if (strstr(message, "whisper") != NULL ||\r
+             strstr(message, "kibitz") != NULL || \r
+            strstr(message, "tellics") != NULL) return;\r
+    }\r
+\r
     HandleMachineMove(message, cps);\r
 }\r
 \r
@@ -12557,7 +12638,8 @@ DisplayAnalysisText(text)
 {\r
     char buf[MSG_SIZ];\r
 \r
-    if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {\r
+    if (gameMode == AnalyzeMode || gameMode == AnalyzeFile \r
+               || appData.icsEngineAnalyze) {\r
        sprintf(buf, "Analysis (%s)", first.tidy);\r
        AnalysisPopUp(buf, text);\r
     }\r
@@ -12593,8 +12675,8 @@ DisplayAnalysis()
     } else {\r
         safeStrCpy( lst, programStats.movelist, sizeof(lst));\r
 \r
-       nps = (((double)programStats.nodes) /\r
-              (((double)programStats.time)/100.0));\r
+        nps = (u64ToDouble(programStats.nodes) /\r
+             ((double)programStats.time /100.0));\r
 \r
        cs = programStats.time % 100;\r
        s = programStats.time / 100;\r
@@ -12605,32 +12687,32 @@ DisplayAnalysis()
 \r
        if (programStats.moves_left > 0 && appData.periodicUpdates) {\r
          if (programStats.move_name[0] != NULLCHAR) {\r
-           sprintf(buf, "depth=%d %d/%d(%s) %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d",\r
+           sprintf(buf, "depth=%d %d/%d(%s) %+.2f %s%s\nNodes: " u64Display " NPS: %d\nTime: %02d:%02d:%02d.%02d",\r
                    programStats.depth,\r
                    programStats.nr_moves-programStats.moves_left,\r
                    programStats.nr_moves, programStats.move_name,\r
                    ((float)programStats.score)/100.0, lst,\r
                    only_one_move(lst)?\r
                    xtra[programStats.got_fail] : "",\r
-                   programStats.nodes, (int)nps, h, m, s, cs);\r
+                   (u64)programStats.nodes, (int)nps, h, m, s, cs);\r
          } else {\r
-           sprintf(buf, "depth=%d %d/%d %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d",\r
+           sprintf(buf, "depth=%d %d/%d %+.2f %s%s\nNodes: " u64Display " NPS: %d\nTime: %02d:%02d:%02d.%02d",\r
                    programStats.depth,\r
                    programStats.nr_moves-programStats.moves_left,\r
                    programStats.nr_moves, ((float)programStats.score)/100.0,\r
                    lst,\r
                    only_one_move(lst)?\r
                    xtra[programStats.got_fail] : "",\r
-                   programStats.nodes, (int)nps, h, m, s, cs);\r
+                   (u64)programStats.nodes, (int)nps, h, m, s, cs);\r
          }\r
        } else {\r
-           sprintf(buf, "depth=%d %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d",\r
+           sprintf(buf, "depth=%d %+.2f %s%s\nNodes: " u64Display " NPS: %d\nTime: %02d:%02d:%02d.%02d",\r
                    programStats.depth,\r
                    ((float)programStats.score)/100.0,\r
                    lst,\r
                    only_one_move(lst)?\r
                    xtra[programStats.got_fail] : "",\r
-                   programStats.nodes, (int)nps, h, m, s, cs);\r
+                   (u64)programStats.nodes, (int)nps, h, m, s, cs);\r
        }\r
     }\r
     DisplayAnalysisText(buf);\r
@@ -12715,9 +12797,9 @@ CheckFlags()
                }\r
            } else {\r
                if (blackFlag) {\r
-                    if(gameMode != TwoMachinesPlay) DisplayTitle("Both flags fell");\r
+                    if(gameMode != TwoMachinesPlay) DisplayTitle(_("Both flags fell"));\r
                } else {\r
-                    if(gameMode != TwoMachinesPlay) DisplayTitle("White's flag fell");\r
+                    if(gameMode != TwoMachinesPlay) DisplayTitle(_("White's flag fell"));\r
                    if (appData.autoCallFlag) {\r
                        GameEnds(BlackWins, "Black wins on time", GE_XBOARD);\r
                        return TRUE;\r
@@ -12737,9 +12819,9 @@ CheckFlags()
                }\r
            } else {\r
                if (whiteFlag) {\r
-                    if(gameMode != TwoMachinesPlay) DisplayTitle("Both flags fell");\r
+                    if(gameMode != TwoMachinesPlay) DisplayTitle(_("Both flags fell"));\r
                } else {\r
-                    if(gameMode != TwoMachinesPlay) DisplayTitle("Black's flag fell");\r
+                    if(gameMode != TwoMachinesPlay) DisplayTitle(_("Black's flag fell"));\r
                    if (appData.autoCallFlag) {\r
                        GameEnds(WhiteWins, "White wins on time", GE_XBOARD);\r
                        return TRUE;\r
@@ -13616,7 +13698,7 @@ EditPositionPasteFEN(char *fen)
     Board initial_position;\r
 \r
     if (!ParseFEN(initial_position, &blackPlaysFirst, fen)) {\r
-      DisplayError("Bad FEN position in clipboard", 0);\r
+      DisplayError(_("Bad FEN position in clipboard"), 0);\r
       return ;\r
     } else {\r
       int savedBlackPlaysFirst = blackPlaysFirst;\r