X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=a23803c49888e76df349ab7b4ac50db8e8a930de;hb=389e190b1edefb62005e5ff30e5c79080e985168;hp=c7e0473af08e65585882feaf5710c049f81baeb9;hpb=8b519f2abff956ac1ccfcc4b51c7b9736e075d6c;p=xboard.git diff --git a/backend.c b/backend.c index c7e0473..a23803c 100644 --- a/backend.c +++ b/backend.c @@ -131,7 +131,7 @@ typedef struct { int nr_moves; /* Total nr of root moves */ int moves_left; /* Moves remaining to be searched */ char move_name[MOVE_LEN]; /* Current move being searched, if provided */ - unsigned long nodes; /* # of nodes searched */ + u64 nodes; /* # of nodes searched */ int time; /* Search time (centiseconds) */ int score; /* Score (centipawns) */ int got_only_move; /* If last msg was "(only move)" */ @@ -212,10 +212,10 @@ void ParseFeatures P((char* args, ChessProgramState *cps)); void InitBackEnd3 P((void)); void FeatureDone P((ChessProgramState* cps, int val)); void InitChessProgram P((ChessProgramState *cps)); - -#ifdef WIN32 - extern void ConsoleCreate(); -#endif + +#ifdef WIN32 + extern void ConsoleCreate(); +#endif extern int tinyLayout, smallLayout; static ChessProgramStats programStats; @@ -305,7 +305,7 @@ Boolean alarmSounded; /* end premove variables */ char *ics_prefix = "$"; -ics_type = ICS_GENERIC; +int ics_type = ICS_GENERIC; int currentMove = 0, forwardMostMove = 0, backwardMostMove = 0; int pauseExamForwardMostMove = 0; @@ -692,12 +692,12 @@ InitBackEnd3 P((void)) char buf[MSG_SIZ]; int err; - InitChessProgram(&first); - - #ifdef WIN32 - /* Make a console window if needed */ - if (appData.icsActive) ConsoleCreate(); - #endif + InitChessProgram(&first); + + #ifdef WIN32 + /* Make a console window if needed */ + if (appData.icsActive) ConsoleCreate(); + #endif if (appData.icsActive) { err = establish(); @@ -1466,11 +1466,11 @@ read_from_ics(isr, closure, data, count, error) int i, oldi; int buf_len; int next_out; - int tkind; -#ifdef WIN32 - /* For zippy color lines of winboard - * cleanup for gcc compiler */ - int backup; + int tkind; +#ifdef WIN32 + /* For zippy color lines of winboard + * cleanup for gcc compiler */ + int backup; #endif char *p; @@ -1728,20 +1728,20 @@ read_from_ics(isr, closure, data, count, error) oldi = i; if (appData.zippyTalk || appData.zippyPlay) { -#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))); +#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))); #else if (ZippyControl(buf, &i) || ZippyConverse(buf, &i) || (appData.zippyPlay && ZippyMatch(buf, &i))) { loggedOn = TRUE; continue; - } + } #endif #endif } @@ -4344,7 +4344,7 @@ HandleMachineMove(message, cps) if (appData.showThinking) { int plylev, mvleft, mvtot, curscore, time; char mvname[MOVE_LEN]; - unsigned long nodes; + u64 nodes; char plyext; int ignore = FALSE; int prefixHint = FALSE; @@ -4375,7 +4375,7 @@ HandleMachineMove(message, cps) if (!ignore) { buf1[0] = NULLCHAR; - if (sscanf(message, "%d%c %d %d %lu %[^\n]\n", + if (sscanf(message, "%d%c %d %d" u64Display "%[^\n]\n", &plylev, &plyext, &curscore, &time, &nodes, buf1) >= 5) { if (plyext != ' ' && plyext != '\t') { @@ -4455,7 +4455,7 @@ HandleMachineMove(message, cps) DisplayAnalysis(); } return; - } else if (sscanf(message,"stat01: %d %lu %d %d %d %s", + } else if (sscanf(message,"stat01: %d" u64Display "%d %d %d %s", &time, &nodes, &plylev, &mvleft, &mvtot, mvname) >= 5) { /* The stat01: line is from Crafty (9.29+) in response @@ -6975,7 +6975,7 @@ MailMoveEvent() || (nCmailMovesRegistered + nCmailResults == nCmailGames)) { sprintf(string, partCommandString, appData.debugMode ? " -v" : "", appData.cmailGameName); - commandOutput = popen(string, "rb"); + commandOutput = popen(string, "r"); if (commandOutput == NULL) { DisplayError(_("Failed to invoke cmail"), 0); @@ -9251,7 +9251,7 @@ DisplayAnalysis() if (programStats.got_only_move) { strcpy(buf, programStats.movelist); } else { - nps = (((double)programStats.nodes) / + nps = (((u64)programStats.nodes) / (((double)programStats.time)/100.0)); cs = programStats.time % 100; @@ -9263,32 +9263,32 @@ DisplayAnalysis() if (programStats.moves_left > 0 && appData.periodicUpdates) { if (programStats.move_name[0] != NULLCHAR) { - sprintf(buf, "depth=%d %d/%d(%s) %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d", + sprintf(buf, "depth=%d %d/%d(%s) %+.2f %s%s\nNodes: "u64Display" NPS: %d\nTime: %02d:%02d:%02d.%02d", programStats.depth, programStats.nr_moves-programStats.moves_left, programStats.nr_moves, programStats.move_name, ((float)programStats.score)/100.0, programStats.movelist, only_one_move(programStats.movelist)? xtra[programStats.got_fail] : "", - programStats.nodes, (int)nps, h, m, s, cs); + (u64)programStats.nodes, (int)nps, h, m, s, cs); } else { - sprintf(buf, "depth=%d %d/%d %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d", + sprintf(buf, "depth=%d %d/%d %+.2f %s%s\nNodes: "u64Display" NPS: %d\nTime: %02d:%02d:%02d.%02d", programStats.depth, programStats.nr_moves-programStats.moves_left, programStats.nr_moves, ((float)programStats.score)/100.0, programStats.movelist, only_one_move(programStats.movelist)? xtra[programStats.got_fail] : "", - programStats.nodes, (int)nps, h, m, s, cs); + (u64)programStats.nodes, (int)nps, h, m, s, cs); } } else { - sprintf(buf, "depth=%d %+.2f %s%s\nNodes: %lu NPS: %d\nTime: %02d:%02d:%02d.%02d", + sprintf(buf, "depth=%d %+.2f %s%s\nNodes: "u64Display" NPS: %d\nTime: %02d:%02d:%02d.%02d", programStats.depth, ((float)programStats.score)/100.0, programStats.movelist, only_one_move(programStats.movelist)? xtra[programStats.got_fail] : "", - programStats.nodes, (int)nps, h, m, s, cs); + (u64)programStats.nodes, (int)nps, h, m, s, cs); } } DisplayAnalysisText(buf);