From: Arun Persaud Date: Wed, 13 Jan 2010 04:11:06 +0000 (-0800) Subject: Merge branch 'master' into gtk X-Git-Tag: gtk-20100118~10 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=344885687fdf87558b7932280545f5f4ea78771c Merge branch 'master' into gtk Conflicts: backend.c xboard.c --- 344885687fdf87558b7932280545f5f4ea78771c diff --cc Makefile.am index c0dc779,9450077..7c6ddb3 --- a/Makefile.am +++ b/Makefile.am @@@ -30,10 -27,9 +30,10 @@@ xboard_SOURCES = backend.c backend.h ba xhistory.c xhistory.h \ xoptions.c \ $(ZPY) -xboard_LDADD = -lm @XAW_LIBS@ @X_LIBS@ + +xboard_LDADD = -lm @XAW_LIBS@ @GTK_LIBS@ - EXTRA_DIST = pixmaps bitmaps winboard\ + EXTRA_DIST = pixmaps bitmaps winboard sounds \ xboard.texi gpl.texinfo texi2man texinfo.tex xboard.man \ COPYRIGHT FAQ.html engine-intf.html ics-parsing.txt readme.htm readme_HGM.txt zippy.README diff --cc backend.c index 96e898a,937ba59..2574673 --- a/backend.c +++ b/backend.c @@@ -2164,9 -2168,10 +2167,10 @@@ read_from_ics(isr, closure, data, count } buf[buf_len] = NULLCHAR; - next_out = leftover_len; + // next_out = leftover_len; // [HGM] should we set this to 0, and not print it in advance? + next_out = 0; leftover_start = 0; - + i = 0; while (i < buf_len) { /* Deal with part of the TELNET option negotiation @@@ -2443,12 -2449,14 +2448,14 @@@ savingComment = TRUE; suppressKibitz = gameMode != IcsObserving ? 2 : (StrStr(star_match[0], gameInfo.white) == NULL) + 1; - } + } continue; } else - if(looking_at(buf, &i, "kibitzed to")) { // suppress the acknowledgements of our own autoKibitz - started = STARTED_CHATTER; - suppressKibitz = TRUE; + if(looking_at(buf, &i, "kibitzed to *\n") && atoi(star_match[0])) { + // suppress the acknowledgements of our own autoKibitz + SendToPlayer(star_match[0], strlen(star_match[0])); + looking_at(buf, &i, "*% "); // eat prompt + next_out = i; } } // [HGM] kibitz: end of patch @@@ -3351,14 -3364,15 +3363,15 @@@ i++; /* skip unparsed character and loop back */ } - - if (started != STARTED_MOVES && started != STARTED_BOARD && !suppressKibitz && // [HGM] kibitz suppress printing in ICS interaction window - started != STARTED_HOLDINGS && i > next_out) { - SendToPlayer(&buf[next_out], i - next_out); + + if (started != STARTED_MOVES && started != STARTED_BOARD && !suppressKibitz && // [HGM] kibitz + // started != STARTED_HOLDINGS && i > next_out) { // [HGM] should we compare to leftover_start in stead of i? + // SendToPlayer(&buf[next_out], i - next_out); + started != STARTED_HOLDINGS && leftover_start > next_out) { + SendToPlayer(&buf[next_out], leftover_start - next_out); next_out = i; } - suppressKibitz = FALSE; // [HGM] kibitz: has done its duty in if-statement above - + leftover_len = buf_len - leftover_start; /* if buffer ends with something we couldn't parse, reparse it after appending the next read */ @@@ -5553,16 -5647,53 +5681,53 @@@ UserMoveEvent(fromX, fromY, toX, toY, p slip a promotion popup in between. But that it always needs two calls, to the first part, (now called UserMoveTest() ), and to FinishMove if the first part succeeded. Calls that do not need - to do anything in between, can call this routine the old way. + to do anything in between, can call this routine the old way. */ - ChessMove moveType = UserMoveTest(fromX, fromY, toX, toY, promoChar, FALSE); -if(appData.debugMode) fprintf(debugFP, "moveType 4 = %d, promochar = %x\n", moveType, promoChar); - if(moveType == AmbiguousMove) - DrawPosition(FALSE, boards[currentMove]); - else if(moveType != ImpossibleMove && moveType != Comment) - FinishMove(moveType, fromX, fromY, toX, toY, promoChar); + ChessMove moveType = UserMoveTest(fromX, fromY, toX, toY, promoChar, FALSE); + if(appData.debugMode) fprintf(debugFP, "moveType 4 = %d, promochar = %x\n", moveType, promoChar); + if(moveType == AmbiguousMove) + DrawPosition(FALSE, boards[currentMove]); + else if(moveType != ImpossibleMove && moveType != Comment) + FinishMove(moveType, fromX, fromY, toX, toY, promoChar); } + void + Mark(board, flags, kind, rf, ff, rt, ft, closure) + Board board; + int flags; + ChessMove kind; + int rf, ff, rt, ft; + VOIDSTAR closure; + { + typedef char Markers[BOARD_RANKS][BOARD_FILES]; + Markers *m = (Markers *) closure; + if(rf == fromY && ff == fromX) + (*m)[rt][ft] = 1 + (board[rt][ft] != EmptySquare + || kind == WhiteCapturesEnPassant + || kind == BlackCapturesEnPassant); + else if(flags & F_MANDATORY_CAPTURE && board[rt][ft] != EmptySquare) (*m)[rt][ft] = 3; + } + + void + MarkTargetSquares(int clear) + { + int x, y; + if(!appData.markers || !appData.highlightDragging || + !appData.testLegality || gameMode == EditPosition) return; + if(clear) { + for(x=0; x1) capt++; + if(capt) + for(x=0; xR: ResignProc() \n \ - :r: ResetProc() \n \ - :g: LoadGameProc() \n \ - :N: LoadNextGameProc() \n \ - :P: LoadPrevGameProc() \n \ - :Q: QuitProc() \n \ - :F: ToEndProc() \n \ - :f: ForwardProc() \n \ - :B: ToStartProc() \n \ - :b: BackwardProc() \n \ - :p: PauseProc() \n \ - :d: DrawProc() \n \ - :t: CallFlagProc() \n \ - :i: Iconify() \n \ - :c: Iconify() \n \ - :v: FlipViewProc() \n \ - Control_L: BackwardProc() \n \ - Control_L: ForwardProc() \n \ - Control_R: BackwardProc() \n \ - Control_R: ForwardProc() \n \ - Shift1: AskQuestionProc(\"Direct command\",\ - \"Send to chess program:\",,1) \n \ - Shift2: AskQuestionProc(\"Direct command\",\ - \"Send to second chess program:\",,2) \n"; - -char boardTranslations[] = - ": HandleUserMove() \n \ - : HandleUserMove() \n \ - : AnimateUserMove() \n \ - : HandlePV() \n \ - : UnLoadPV() \n \ - Shift: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD)\ - PieceMenuPopup(menuB) \n \ - Any: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD) \ - PieceMenuPopup(menuW) \n \ - Shift: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD)\ - PieceMenuPopup(menuW) \n \ - Any: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD) \ - PieceMenuPopup(menuB) \n"; - -char whiteTranslations[] = ": WhiteClock()\n"; -char blackTranslations[] = ": BlackClock()\n"; ++//char globalTranslations[] = ++// ":R: ResignProc() \n \ ++// :r: ResetProc() \n \ ++// :g: LoadGameProc() \n \ ++// :N: LoadNextGameProc() \n \ ++// :P: LoadPrevGameProc() \n \ ++// :Q: QuitProc() \n \ ++// :F: ToEndProc() \n \ ++// :f: ForwardProc() \n \ ++// :B: ToStartProc() \n \ ++// :b: BackwardProc() \n \ ++// :p: PauseProc() \n \ ++// :d: DrawProc() \n \ ++// :t: CallFlagProc() \n \ ++// :i: Iconify() \n \ ++// :c: Iconify() \n \ ++// :v: FlipViewProc() \n \ ++// Control_L: BackwardProc() \n \ ++// Control_L: ForwardProc() \n \ ++// Control_R: BackwardProc() \n \ ++// Control_R: ForwardProc() \n \ ++// Shift1: AskQuestionProc(\"Direct command\",\ ++// \"Send to chess program:\",,1) \n \ ++// Shift2: AskQuestionProc(\"Direct command\",\ ++// \"Send to second chess program:\",,2) \n"; ++// ++//char boardTranslations[] = ++// ": HandleUserMove() \n \ ++// : HandleUserMove() \n \ ++// : AnimateUserMove() \n \ ++// : HandlePV() \n \ ++// : UnLoadPV() \n \ ++// Shift: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD)\ ++// PieceMenuPopup(menuB) \n \ ++// Any: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD) \ ++// PieceMenuPopup(menuW) \n \ ++// Shift: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD)\ ++// PieceMenuPopup(menuW) \n \ ++// Any: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD) \ ++// PieceMenuPopup(menuB) \n"; ++// ++//char whiteTranslations[] = ": WhiteClock()\n"; ++//char blackTranslations[] = ": BlackClock()\n"; char ICSInputTranslations[] = "Return: EnterKeyProc() \n";