From: H.G. Muller Date: Sun, 19 Apr 2009 16:44:15 +0000 (-0700) Subject: changes from H.G. Muller; version 4.3.7 X-Git-Tag: v4.3.7 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=062fb2bd92324706eed1fba8d5f7b4015ef2b058 changes from H.G. Muller; version 4.3.7 --- diff --git a/backend.c b/backend.c index f3cffc5..6c79b03 100644 --- a/backend.c +++ b/backend.c @@ -1702,13 +1702,13 @@ CopyHoldings(Board board, char *holdings, ChessSquare lowestPiece) char p; ChessSquare piece; - if(gameInfo.holdingsWidth < 1) return; + if(gameInfo.holdingsWidth < 2) return; if( (int)lowestPiece >= BlackPawn ) { holdingsColumn = 0; countsColumn = 1; holdingsStartRow = BOARD_HEIGHT-1; - direction = 1; + direction = -1; } else { holdingsColumn = BOARD_WIDTH-1; countsColumn = BOARD_WIDTH-2; @@ -1723,12 +1723,13 @@ CopyHoldings(Board board, char *holdings, ChessSquare lowestPiece) while( (p=*holdings++) != NULLCHAR ) { piece = CharToPiece( ToUpper(p) ); if(piece == EmptySquare) continue; - j = (int) piece - (int) WhitePawn; + /*j = (int) piece - (int) WhitePawn;*/ + j = PieceToNumber(piece); if(j >= gameInfo.holdingsSize) continue; /* ignore pieces that do not fit */ if(j < 0) continue; /* should not happen */ - piece = (ChessSquare) ( (int)piece + (int)lowestPiece ); - board[holdingsStartRow+i*direction][holdingsColumn] = piece; - board[holdingsStartRow+i*direction][countsColumn]++; + piece = (ChessSquare) ( j + (int)lowestPiece ); + board[holdingsStartRow+j*direction][holdingsColumn] = piece; + board[holdingsStartRow+j*direction][countsColumn]++; } } @@ -2336,6 +2337,7 @@ read_from_ics(isr, closure, data, count, error) sprintf(str, "ICS %s %s match", star_match[0], star_match[1]); gameInfo.event = StrSave(str); gameInfo.variant = StringToVariant(gameInfo.event); + Reset(TRUE,TRUE); /* [HGM] possibly change board or holdings size */ continue; } @@ -2804,7 +2806,27 @@ read_from_ics(isr, closure, data, count, error) if (sscanf(parse, " game %d", &gamenum) == 1 && gamenum == ics_gamenum) { if (gameInfo.variant == VariantNormal) { + /* [HGM] We seem to switch variant during a game! + * Presumably no holdings were displayed, so we have + * to move the position two files to the right to + * create room for them! + */ + int i, j; + if(gameInfo.holdingsWidth == 0) /* to be sure */ + for(i=0; i=0; j--) + boards[currentMove][i][j+2] = boards[currentMove][i][j]; + + if (appData.debugMode) { + fprintf(debugFP, "Switch board to Crazy\n"); + setbuf(debugFP, NULL); + } gameInfo.variant = VariantCrazyhouse; /*temp guess*/ + gameInfo.boardWidth = 8; /* [HGM] guess board size as well */ + gameInfo.boardHeight = 8; + gameInfo.holdingsSize = 5; + gameInfo.holdingsWidth = 2; + InitDrawingSizes(-2, 0); /* Get a move list just to see the header, which will tell us whether this is really bug or zh */ if (ics_getting_history == H_FALSE) { @@ -2819,6 +2841,9 @@ read_from_ics(isr, closure, data, count, error) new_piece); white_holding[strlen(white_holding)-1] = NULLCHAR; black_holding[strlen(black_holding)-1] = NULLCHAR; + /* [HGM] copy holdings to board holdings area */ + CopyHoldings(boards[currentMove], white_holding, WhitePawn); + CopyHoldings(boards[currentMove], black_holding, BlackPawn); #if ZIPPY if (appData.zippyPlay && first.initDone) { ZippyHoldings(white_holding, black_holding, @@ -2837,9 +2862,6 @@ read_from_ics(isr, closure, data, count, error) gameInfo.black, black_holding); } - /* [HGM] copy holdings to board holdings area */ - CopyHoldings(boards[currentMove], white_holding, WhitePawn); - CopyHoldings(boards[currentMove], black_holding, BlackPawn); DrawPosition(FALSE, NULL); DisplayTitle(str); } @@ -3057,20 +3079,26 @@ ParseBoard12(string) movesPerSession = 0; gameInfo.timeControl = TimeControlTagValue(); gameInfo.variant = StringToVariant(gameInfo.event); + if (appData.debugMode) { + fprintf(debugFP, "ParseBoard says variant = '%s'\n", gameInfo.event); + fprintf(debugFP, "recognized as %s\n", VariantName(gameInfo.variant)); + setbuf(debugFP, NULL); + } + gameInfo.holdingsSize = 5; /* [HGM] prepare holdings */ + gameInfo.boardWidth = gameInfo.boardHeight = 8; switch(gameInfo.variant) { case VariantShogi: case VariantShowgi: - gameInfo.boardWidth = gameInfo.boardHeight = 9; - gameInfo.holdingsSize += 2; + gameInfo.boardWidth = 9; gameInfo.boardHeight = 9; + gameInfo.holdingsSize = 7; case VariantBughouse: case VariantCrazyhouse: - gameInfo.boardWidth = gameInfo.boardHeight = 8; gameInfo.holdingsWidth = 2; break; default: - gameInfo.boardWidth = gameInfo.boardHeight = 8; - gameInfo.holdingsWidth = 0; + gameInfo.holdingsWidth = gameInfo.holdingsSize = 0; } + InitDrawingSizes(-2, 0); gameInfo.outOfBook = NULL; /* Do we have the ratings? */ @@ -3132,9 +3160,14 @@ ParseBoard12(string) } /* Parse the board */ - for (k = 0; k < 8; k++) + for (k = 0; k < 8; k++) { for (j = 0; j < 8; j++) - board[k][j] = CharToPiece(board_chars[(7-k)*9 + j]); + board[k][j+gameInfo.holdingsWidth] = CharToPiece(board_chars[(7-k)*9 + j]); + if(gameInfo.holdingsWidth > 1) { + board[k][0] = board[k][BOARD_WIDTH-1] = EmptySquare; + board[k][1] = board[k][BOARD_WIDTH-2] = (ChessSquare) 0;; + } + } CopyBoard(boards[moveNum], board); if (moveNum == 0) { startedFromSetupPosition = @@ -3202,6 +3235,11 @@ ParseBoard12(string) /* Put the move on the move list, first converting to canonical algebraic form. */ if (moveNum > 0) { + if (appData.debugMode) { + fprintf(debugFP, "accepted move %s from ICS, parse it.\n", move_str); + fprintf(debugFP, "board = %d-d x%d\n", BOARD_LEFT, BOARD_RGHT, BOARD_HEIGHT); + setbuf(debugFP, NULL); + } if (moveNum <= backwardMostMove) { /* We don't know what the board looked like before this move. Punt. */ @@ -3222,7 +3260,8 @@ ParseBoard12(string) default: break; case MT_CHECK: - strcat(parseList[moveNum - 1], "+"); + if(gameInfo.variant != VariantShogi) + strcat(parseList[moveNum - 1], "+"); break; case MT_CHECKMATE: strcat(parseList[moveNum - 1], "#"); @@ -3255,6 +3294,10 @@ ParseBoard12(string) moveList[moveNum - 1][0] = NULLCHAR; fromX = fromY = toX = toY = -1; } + if (appData.debugMode) { + fprintf(debugFP, "Move parsed to '%s'\n", parseList[moveNum - 1]); + setbuf(debugFP, NULL); + } #if ZIPPY /* Send move to chess program (BEFORE animating it). */ @@ -3407,7 +3450,7 @@ SendMoveToProgram(moveNum, cps) sprintf(buf, "%s\n", parseList[moveNum]); } /* [HGM] decrement all digits to code ranks starting from 0 */ - if(BOARD_HEIGHT>8) { + if(BOARD_HEIGHT>9) { char *p = buf; while(*p) { if(*p < 'A') (*p)--; p++; } } @@ -3737,6 +3780,30 @@ static void SetupFRC( Board board, int pos_index ) } } +BOOL SetCharTable( char *table, const char * map ) +/* [HGM] moved here from winboard.c because of its general usefulness */ +/* Basically a safe strcpy that uses the last character as King */ +{ + BOOL result = FALSE; int NrPieces; + + if( map != NULL && (NrPieces=strlen(map)) <= (int) EmptySquare + && NrPieces >= 12 && !(NrPieces&1)) { + int i; /* [HGM] Accept even length from 12 to 34 */ + + for( i=0; i<(int) EmptySquare; i++ ) table[i] = '.'; + for( i=0; i>1; - castlingRights[0][3] = initialRights[3] = BOARD_RGHT-1; - castlingRights[0][4] = initialRights[4] = BOARD_LEFT; - castlingRights[0][5] = initialRights[5] = BOARD_WIDTH>>1; - - castlingRank[0] = castlingRank[1] = castlingRank[2] = 0; - castlingRank[3] = castlingRank[4] = castlingRank[5] = BOARD_HEIGHT-1; - initialRulePlies = 0; /* 50-move counter start */ } @@ -3785,6 +3840,9 @@ InitPosition(redraw) gameInfo.boardWidth = 8; gameInfo.boardHeight = 8; gameInfo.holdingsSize = 0; + nrCastlingRights = -1; /* [HGM] Kludge to indicate default should be used */ + for(i=0; i= 0) { - if(gameInfo.boardHeight != appData.NrRanks) overrule++; gameInfo.boardHeight = appData.NrRanks; } if(appData.holdingsSize >= 0) { @@ -3889,11 +3945,12 @@ InitPosition(redraw) if(BOARD_HEIGHT > BOARD_SIZE || BOARD_WIDTH > BOARD_SIZE) DisplayFatalError("Recompile to support this BOARD_SIZE!", 0, 2); - pawnRow = gameInfo.boardHeight - 7; /* seems to work in all variants */ + pawnRow = gameInfo.boardHeight - 7; /* seems to work in all common variants */ + if(pawnRow < 1) pawnRow = 1; /* User pieceToChar list overrules defaults */ if(appData.pieceToCharTable != NULL) - strcpy(pieceToChar, appData.pieceToCharTable); + SetCharTable(pieceToChar, appData.pieceToCharTable); for( j=0; j>1; + castlingRights[0][3] = initialRights[3] = BOARD_RGHT-1; + castlingRights[0][4] = initialRights[4] = BOARD_LEFT; + castlingRights[0][5] = initialRights[5] = BOARD_WIDTH>>1; + + castlingRank[0] = castlingRank[1] = castlingRank[2] = 0; + castlingRank[3] = castlingRank[4] = castlingRank[5] = BOARD_HEIGHT-1; + } + if(gameInfo.variant == VariantFischeRandom) { if( appData.defaultFrcPosition < 0 ) { ShuffleFRC( initialPosition ); @@ -3942,8 +4016,13 @@ InitPosition(redraw) if(oldx != gameInfo.boardWidth || oldy != gameInfo.boardHeight || - oldh != gameInfo.holdingsWidth ) - InitDrawingSizes(-1 ,0); + oldh != gameInfo.holdingsWidth +#ifdef GOTHIC + || oldv == VariantGothic || + gameInfo.variant == VariantGothic +#endif + ) + InitDrawingSizes(-2 ,0); if (redraw) DrawPosition(TRUE, boards[currentMove]); @@ -4014,7 +4093,10 @@ IsPromotion(fromX, fromY, toX, toY) piece = boards[currentMove][fromY][fromX]; if(gameInfo.variant == VariantShogi) { promotionZoneSize = 3; - highestPromotingPiece = (int)WhiteFerz; /* Silver */ + highestPromotingPiece = (int)WhiteKing; + /* [HGM] Should be Silver = Ferz, really, but legality testing is off, + and if in normal chess we then allow promotion to King, why not + allow promotion of other piece in Shogi? */ } if((int)piece >= BlackPawn) { if(toY >= promotionZoneSize && fromY >= promotionZoneSize) @@ -4165,14 +4247,13 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar) int promoChar; { ChessMove moveType; + ChessSquare pdown, pup; if (fromX < 0 || fromY < 0) return ImpossibleMove; if ((fromX == toX) && (fromY == toY)) { return ImpossibleMove; } - /* [HGM] suppress all moves into holdings area and guard band */ - if( toX < BOARD_LEFT || toX >= BOARD_RGHT ) return ImpossibleMove; - + /* Check if the user is playing in turn. This is complicated because we let the user "pick up" a piece before it is his turn. So the piece he tried to pick up may have been captured by the time he puts it down! @@ -4278,6 +4359,8 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar) break; case EditPosition: + /* EditPosition, empty square, or different color piece; + click-click move is possible */ if (toX == -2 || toY == -2) { boards[0][fromY][fromX] = EmptySquare; DrawPosition(FALSE, boards[currentMove]); @@ -4289,26 +4372,49 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar) return ImpossibleMove; } - if (toX < 0 || toY < 0) return ImpossibleMove; + /* [HGM] suppress all moves into holdings area and guard band */ + if( toX < BOARD_LEFT || toX >= BOARD_RGHT || toY < 0 ) + return ImpossibleMove; + + /* [HGM] moved to here from winboard.c */ + /* note: EditPosition already filtered out and performed! */ + pdown = boards[currentMove][fromY][fromX]; + pup = boards[currentMove][toY][toX]; + if ( + (WhitePawn <= pdown && pdown < BlackPawn && + WhitePawn <= pup && pup < BlackPawn) || + (BlackPawn <= pdown && pdown < EmptySquare && + BlackPawn <= pup && pup < EmptySquare) ) + return ImpossibleMove; /* [HGM] If move started in holdings, it means a drop */ - if( fromX == BOARD_LEFT-2 || fromX == BOARD_RGHT+1) { - if( boards[currentMove][toY][toX] != EmptySquare ) return ImpossibleMove; + if( fromX == BOARD_LEFT-2 || fromX == BOARD_RGHT+1) { + if( pup != EmptySquare ) return ImpossibleMove; + if(appData.testLegality) { + /* it would be more logical if LegalityTest() also figured out + * which drops are legal. For now we forbid pawns on back rank. + * Shogi is on its own here... + */ + if( (pdown == WhitePawn || pdown == BlackPawn) && + (toY == 0 || toY == BOARD_HEIGHT -1 ) ) + return(ImpossibleMove); /* no pawn drops on 1st/8th */ + } return WhiteDrop; /* Not needed to specify white or black yet */ } userOfferedDraw = FALSE; - if (appData.testLegality) { - moveType = LegalityTest(boards[currentMove], PosFlags(currentMove), - EP_UNKNOWN, castlingRights[currentMove], + /* [HGM] always test for legality, to get promotion info */ + moveType = LegalityTest(boards[currentMove], PosFlags(currentMove), + epStatus[currentMove], castlingRights[currentMove], fromY, fromX, toY, toX, promoChar); + + /* [HGM] but possibly ignore an IllegalMove result */ + if (appData.testLegality) { if (moveType == IllegalMove || moveType == ImpossibleMove) { DisplayMoveError("Illegal move"); return ImpossibleMove; } - } else { - moveType = PromoCharToMoveType(WhiteOnMove(currentMove), promoChar); } return moveType; @@ -4643,23 +4749,40 @@ HandleMachineMove(message, cps) /* to make sure an illegal e.p. capture does not slip through, */ /* to cause a forfeit on a justified illegal-move complaint */ /* of the opponent. */ - if(gameMode==TwoMachinesPlay && appData.testLegality && - fromY != DROP_RANK && /* [HGM] temporary; should still add legality test for drops */ - LegalityTest(boards[forwardMostMove], PosFlags(forwardMostMove), + if( gameMode==TwoMachinesPlay && appData.testLegality + && fromY != DROP_RANK /* [HGM] temporary; should still add legality test for drops */ + ) { + ChessMove moveType; + moveType = LegalityTest(boards[forwardMostMove], PosFlags(forwardMostMove), epStatus[forwardMostMove], castlingRights[forwardMostMove], - fromY, fromX, toY, toX, promoChar) == IllegalMove) - { + fromY, fromX, toY, toX, promoChar); if (appData.debugMode) { int i; for(i=0; i< nrCastlingRights; i++) fprintf(debugFP, "(%d,%d) ", castlingRights[forwardMostMove][i], castlingRank[i]); fprintf(debugFP, "castling rights\n"); } - sprintf(buf1, "Xboard: Forfeit due to illegal move: %s (%c%c%c%c)%c", - machineMove, fromX+AAA, fromY+ONE, toX+AAA, toY+ONE, 0); - GameEnds(machineWhite ? BlackWins : WhiteWins, - buf1, GE_XBOARD); + if(moveType == IllegalMove) { + sprintf(buf1, "Xboard: Forfeit due to illegal move: %s (%c%c%c%c)%c", + machineMove, fromX+AAA, fromY+ONE, toX+AAA, toY+ONE, 0); + GameEnds(machineWhite ? BlackWins : WhiteWins, + buf1, GE_XBOARD); + } else if(gameInfo.variant != VariantFischeRandom) + /* [HGM] Kludge to handle engines that send FRC-style castling + when they shouldn't (like TSCP-Gothic) */ + switch(moveType) { + case WhiteASideCastleFR: + case BlackASideCastleFR: + toY++; + currentMoveString[2]++; + break; + case WhiteHSideCastleFR: + case BlackHSideCastleFR: + toY--; + currentMoveString[2]--; + break; } + } hintRequested = FALSE; lastHint[0] = NULLCHAR; bookRequested = FALSE; @@ -4946,6 +5069,31 @@ HandleMachineMove(message, cps) cps->useSigterm = FALSE; } + /* [HGM] Allow engine to set up a position. Don't ask me why one would + * want this, I was asked to put it in, and obliged. + */ + if (!strncmp(message, "setboard ", 9)) { + Board initial_position; int i; + + GameEnds(GameIsDrawn, "Engine aborts game", GE_XBOARD); + + if (!ParseFEN(initial_position, &blackPlaysFirst, message + 9)) { + DisplayError("Bad FEN received from engine", 0); + return ; + } else { + Reset(FALSE, FALSE); + CopyBoard(boards[0], initial_position); + initialRulePlies = FENrulePlies; + epStatus[0] = FENepStatus; + for( i=0; i= gameInfo.holdingsSize) { p = 0; captured = BlackPawn; } board[p][BOARD_WIDTH-2]++; board[p][BOARD_WIDTH-1] = @@ -5972,6 +6125,7 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board) captured = (ChessSquare) (DEMOTED captured); p = DEMOTED p; } + p = PieceToNumber((ChessSquare)p); if(p >= gameInfo.holdingsSize) { p = 0; captured = WhitePawn; } board[BOARD_HEIGHT-1-p][1]++; board[BOARD_HEIGHT-1-p][0] = @@ -5993,7 +6147,7 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board) board[toY][toX] = EmptySquare; } } - if(gameInfo.variant == VariantShogi && promoChar != NULLCHAR) { + if(gameInfo.variant == VariantShogi && promoChar != NULLCHAR && promoChar != '=') { /* [HGM] Shogi promotions */ board[toY][toX] = (ChessSquare) (PROMOTED piece); } @@ -6073,12 +6227,17 @@ MakeMove(fromX, fromY, toX, toY, promoChar) default: break; case MT_CHECK: - strcat(parseList[forwardMostMove - 1], "+"); + if(gameInfo.variant != VariantShogi) + strcat(parseList[forwardMostMove - 1], "+"); break; case MT_CHECKMATE: strcat(parseList[forwardMostMove - 1], "#"); break; } + if (appData.debugMode) { + fprintf(debugFP, "move: %s, parse: %s (%c)\n", moveList[forwardMostMove-1], parseList[forwardMostMove-1], moveList[forwardMostMove-1][4]); + } + } /* Updates currentMove if not pausing */ @@ -6124,7 +6283,8 @@ InitChessProgram(cps) || gameInfo.boardWidth != 8 || gameInfo.boardHeight != 8 ) { char *v = VariantName(gameInfo.variant); - if (StrStr(cps->variants, v) == NULL) { + if (cps->protocolVersion != 1 && StrStr(cps->variants, v) == NULL) { + /* [HGM] in protocol 1 we have to assume all variants valid */ sprintf(buf, "Variant %s not supported by %s", v, cps->tidy); DisplayFatalError(buf, 0, 1); return; @@ -6144,15 +6304,13 @@ InitChessProgram(cps) overruled = gameInfo.boardWidth != 12 || gameInfo.boardHeight != 8 || gameInfo.holdingsSize != 0; if(overruled) { -#if 0 - // doesn't work in protocol 1 - if (StrStr(cps->variants, "boardsize") == NULL,) { + if (cps->protocolVersion != 1 && StrStr(cps->variants, "boardsize") == NULL) { sprintf(buf, "Board size %dx%d+%d not supported by %s", gameInfo.boardWidth, gameInfo.boardHeight, gameInfo.holdingsSize, cps->tidy); DisplayFatalError(buf, 0, 1); return; } -#endif + /* [HGM] here we really should compare with the maximum supported board size */ sprintf(buf, "%dx%d+%d_", gameInfo.boardWidth, gameInfo.boardHeight, gameInfo.holdingsSize ); while(*b++ != '_'); @@ -6802,12 +6960,10 @@ LoadGameOneMove(readAhead) case WhiteCapturesEnPassant: case BlackCapturesEnPassant: -#ifdef FAIRY case WhitePromotionChancellor: case BlackPromotionChancellor: case WhitePromotionArchbishop: case BlackPromotionArchbishop: -#endif case WhitePromotionQueen: case BlackPromotionQueen: case WhitePromotionRook: @@ -9336,6 +9492,7 @@ EditPositionMenuEvent(selection, x, y) int x, y; { char buf[MSG_SIZ]; + ChessSquare piece = boards[0][y][x]; if (gameMode != EditPosition && gameMode != IcsExamining) return; @@ -9385,7 +9542,40 @@ EditPositionMenuEvent(selection, x, y) } break; + case PromotePiece: + if(piece >= (int)WhitePawn && piece < (int)WhiteWazir || + piece >= (int)BlackPawn && piece < (int)BlackWazir ) { + selection = (ChessSquare) (PROMOTED piece); + } else if(piece == EmptySquare) selection = WhiteWazir; + else selection = (ChessSquare)((int)piece - 1); + goto defaultlabel; + + case DemotePiece: + if(piece >= (int)WhiteUnicorn && piece < (int)WhiteKing || + piece >= (int)BlackUnicorn && piece < (int)BlackKing ) { + selection = (ChessSquare) (DEMOTED piece); + } else if( piece == WhiteKing || piece == BlackKing ) + selection = (ChessSquare)((int)piece - (int)WhiteKing + (int)WhiteMan); + else if(piece == EmptySquare) selection = BlackWazir; + else selection = (ChessSquare)((int)piece + 1); + goto defaultlabel; + + case WhiteQueen: + case BlackQueen: + if(gameInfo.variant == VariantShatranj || + gameInfo.variant == VariantXiangqi || + gameInfo.variant == VariantCourier ) + selection = (ChessSquare)((int)selection - (int)WhiteQueen + (int)WhiteFerz); + goto defaultlabel; + + case WhiteKing: + case BlackKing: + if(gameInfo.variant == VariantXiangqi) + selection = (ChessSquare)((int)selection - (int)WhiteKing + (int)WhiteWazir); + if(gameInfo.variant == VariantKnightmate) + selection = (ChessSquare)((int)selection - (int)WhiteKing + (int)WhiteUnicorn); default: + defaultlabel: if (gameMode == IcsExamining) { sprintf(buf, "%s%c@%c%c\n", ics_prefix, PieceToChar(selection), AAA + x, ONE + y); @@ -11116,6 +11306,15 @@ NextTickLength(timeRemaining) return nextTickLength; } +/* Adjust clock one minute up or down */ +void +AdjustClock(Boolean which, int dir) +{ + if(which) blackTimeRemaining += 60000*dir; + else whiteTimeRemaining += 60000*dir; + DisplayBothClocks(); +} + /* Stop clocks and reset to a fresh time control */ void ResetClocks() @@ -11468,19 +11667,27 @@ PositionToFEN(move, useFEN960) for (j = BOARD_LEFT; j < BOARD_RGHT; j++) { if (boards[move][i][j] == EmptySquare) { emptycount++; - } else { + } else { ChessSquare piece = boards[move][i][j]; if (emptycount > 0) { if(emptycount<10) /* [HGM] can be >= 10 */ *p++ = '0' + emptycount; else { *p++ = '0' + emptycount/10; *p++ = '0' + emptycount%10; } emptycount = 0; } - *p++ = PieceToChar(boards[move][i][j]); - if(gameInfo.variant == VariantCrazyhouse) { + if(gameInfo.variant == VariantShogi) { + /* [HGM] write Shogi promoted pieces as + */ + if( (int)piece > (int) WhiteCannon && (int)piece < (int) WhiteKing || + (int)piece > (int) BlackCannon && (int)piece < (int) BlackKing ) { + *p++ = '+'; + piece = (ChessSquare)(DEMOTED piece); + } + } + *p++ = PieceToChar(piece); + if(gameInfo.variant == VariantCrazyhouse || gameInfo.variant == VariantBughouse) { /* [HGM] flag Crazyhouse promoted pieces */ - if( (int)boards[move][i][j] > (int) WhiteQueen && (int)boards[move][i][j] < (int) WhiteKing || - (int)boards[move][i][j] > (int) BlackQueen && (int)boards[move][i][j] < (int) BlackKing ) { - p[-1] = PieceToChar((ChessSquare)((int)boards[move][i][j]-(int)WhiteAlfil+(int)WhitePawn)); + if( (int)piece > (int) WhiteQueen && (int)piece < (int) WhiteKing || + (int)piece > (int) BlackQueen && (int)piece < (int) BlackKing ) { + p[-1] = PieceToChar((ChessSquare)(DEMOTED piece)); *p++ = '~'; } } @@ -11698,11 +11905,12 @@ ParseFEN(board, blackPlaysFirst, fen) if (j + emptycount > gameInfo.boardWidth) return FALSE; while (emptycount--) board[i][(j++)+gameInfo.holdingsWidth] = EmptySquare; - } else if (isalpha(*p)) { + } else if (*p == '+' || isalpha(*p)) { if (j >= gameInfo.boardWidth) return FALSE; - piece = CharToPiece(*p++); + if(*p=='+') { piece = (ChessSquare) (PROMOTED CharToPiece(*++p) ); p++; } + else piece = CharToPiece(*p++); if(*p == '~') { /* [HGM] make it a promoted piece for Crazyhouse */ - piece = (ChessSquare) ((int)piece + (int)WhiteAlfil - (int)WhitePawn); + piece = (ChessSquare) (PROMOTED piece); p++; } board[i][(j++)+gameInfo.holdingsWidth] = piece; diff --git a/backend.h b/backend.h index 0057b9d..8ef5bf3 100644 --- a/backend.h +++ b/backend.h @@ -131,6 +131,7 @@ void UserMoveEvent P((int fromX, int fromY, int toX, int toY, int promoChar)); void DecrementClocks P((void)); char *TimeString P((long millisec)); void AutoPlayGameLoop P((void)); +void AdjustClock P((Boolean which, int dir)); void DisplayBothClocks P((void)); void EditPositionMenuEvent P((ChessSquare selection, int x, int y)); void DropMenuEvent P((ChessSquare selection, int x, int y)); diff --git a/bitmaps/260px-Hanzi.svg b/bitmaps/260px-Hanzi.svg new file mode 100644 index 0000000..ab2e9ca Binary files /dev/null and b/bitmaps/260px-Hanzi.svg differ diff --git a/bitmaps/65px-Zhongwen.svg b/bitmaps/65px-Zhongwen.svg new file mode 100644 index 0000000..a1e4ad0 Binary files /dev/null and b/bitmaps/65px-Zhongwen.svg differ diff --git a/bitmaps/ANALYZE2_14.ICO b/bitmaps/ANALYZE2_14.ICO new file mode 100644 index 0000000..8f725f1 Binary files /dev/null and b/bitmaps/ANALYZE2_14.ICO differ diff --git a/bitmaps/ANALYZE_14.ICO b/bitmaps/ANALYZE_14.ICO new file mode 100644 index 0000000..f25d0fb Binary files /dev/null and b/bitmaps/ANALYZE_14.ICO differ diff --git a/bitmaps/BALOON_14.ICO b/bitmaps/BALOON_14.ICO new file mode 100644 index 0000000..dfe056f Binary files /dev/null and b/bitmaps/BALOON_14.ICO differ diff --git a/bitmaps/BLACK_14.ICO b/bitmaps/BLACK_14.ICO new file mode 100644 index 0000000..9661f7c Binary files /dev/null and b/bitmaps/BLACK_14.ICO differ diff --git a/bitmaps/CLOCK_14.ICO b/bitmaps/CLOCK_14.ICO new file mode 100644 index 0000000..0785d5c Binary files /dev/null and b/bitmaps/CLOCK_14.ICO differ diff --git a/bitmaps/PONDER_14.ICO b/bitmaps/PONDER_14.ICO new file mode 100644 index 0000000..484deaa Binary files /dev/null and b/bitmaps/PONDER_14.ICO differ diff --git a/bitmaps/README.bitmaps b/bitmaps/README.bitmaps index b868cfd..573108d 100644 --- a/bitmaps/README.bitmaps +++ b/bitmaps/README.bitmaps @@ -1,94 +1,20 @@ -This directory provides bitmaps with the same size and naming -conventions as those distributed till xboard-3.** -These bitmaps are distributed under the GNU GENERAL PUBLIC LICENSE -coming with xboard. - -The bitmaps contained herein were converted from my MetaFont -version of chess font. These are designed very well to deliver -good rastered images on low resolution devices. The general -shape of these fonts are designed after very old typefaces -used in printing chess books. They are not as fancy as the -currently used bitmaps of xboard, but I like them in their -'san serif'-ness - may be others too. - The MetaFont source of this font may be obtained from me -under the GNU GENERAL PUBLIC LICENSE. - To convert the pk-Files to bitmaps I used the conversion tool -mftobdf to generate X11-bdf - fonts, and then used a small C -program, to write the xbm-files. - -5.Feb.1994 Elmar Bartel -bartel@informatik.tu-muenchen.de - -[Elmar supplied only 80, 64, and 40 pixel bitmaps] - -* * * - -The 21-pixel bitmaps are also based on Elmar's font, but I hand-tuned -them quite a bit. I converted them from the Metafont gf file by -running gftype and applying a C program of my own to the -human-readable output. - -icon_white and icon_black were produced in the same way. - -21 Nov 1995 Tim Mann - -* * * - -The 33, 45, 49, 54, and 58 pixel bitmaps are also based on Elmar's font. -They were converted using dopkbm.sh, followed by a manual pass with the -X bitmap editor to adjust the size (adding blank borders as needed) and -to hand-tune the pixels in a few cases where that was badly needed. -Here is some data that may be useful in later conversions: - -Character numbers in fselch fonts: - -Piece Open Solid Open/bg Solid/bg -P 0 014 022 036 -N 1 015 023 037 -B 2 016 024 040 -R 3 017 025 041 -Q 4 020 026 042 -K 5 021 027 043 - -Sizes (WxH): - -fselch*.mf blank sq queen used for ----------- -------- ----- -------- -8 33x33 31x29 33x33 -9 37x37 33x32 none -10 42x42 41x37 none -11 46x46 43x41 45x45 -12 50x50 47x43 49x49 -13 54x54 50x47 54x54 -14 58x58 56x50 58x58 -20 83x83 71x76 none -21 87x87 76x81 87x87 -22 91x91 79x83 none -23 95x95 82x89 95x95 -25 104x104 91x99 none -26 108x108 94x103 108x108 -28 116x116 99x107 116x116 -30 125x125 110x118 none -31 129x129 113x122 129x129 -32 133x133 116x124 none - - -In each case, fselch*.mf was formatted for 300 dpi. On Linux with the -Red Hat tetex-0.4pl8-9 package, this required mag=0.5. Example: - - mf - \mode=localfont; mag=0.5; input fselch8.mf - gftopk fselch8.300gf - -On Red Hat with tetex-0.9-6, mag=1.0 was needed instead. - - mf - \mode=localfont; mag=1.0; input fselch26.mf - gftopk fselch26.300gf - - -15 Feb 1998 Tim Mann -25 Feb 1999 Tim Mann - -* * * - +This directory provides bitmaps with the same size and naming +conventions as those distributed till xboard-3.** +These bitmaps are distributed under the GNU GENERAL PUBLIC LICENSE +coming with xboard. + +The bitmaps contained herein were converted from my MetaFont +version of chess font. These are designed very well to deliver +good rastered images on low resolution devices. The general +shape of these fonts are designed after very old typefaces +used in printing chess books. They are not as fancy as the +currently used bitmaps of xboard, but I like them in their +'san serif'-ness - may be others too. + The MetaFont source of this font may be obtained from me +under the GNU GENERAL PUBLIC LICENSE. + To convert the pk-Files to bitmaps I used the conversion tool +mftobdf to generate X11-bdf - fonts, and then used a small C +program, to write the xbm-files. + +5.Feb.1994 Elmar Bartel +bartel@informatik.tu-muenchen.de diff --git a/bitmaps/TRANS_14.ICO b/bitmaps/TRANS_14.ICO new file mode 100644 index 0000000..a096131 Binary files /dev/null and b/bitmaps/TRANS_14.ICO differ diff --git a/bitmaps/UNKNOWN_14.ICO b/bitmaps/UNKNOWN_14.ICO new file mode 100644 index 0000000..ea3cef3 Binary files /dev/null and b/bitmaps/UNKNOWN_14.ICO differ diff --git a/bitmaps/WHITE_14.ICO b/bitmaps/WHITE_14.ICO new file mode 100644 index 0000000..4783e0f Binary files /dev/null and b/bitmaps/WHITE_14.ICO differ diff --git a/bitmaps/a49c.bmp b/bitmaps/a49c.bmp new file mode 100644 index 0000000..19b739a Binary files /dev/null and b/bitmaps/a49c.bmp differ diff --git a/bitmaps/b108o.bmp b/bitmaps/b108o.bmp new file mode 100644 index 0000000..a02c11f Binary files /dev/null and b/bitmaps/b108o.bmp differ diff --git a/bitmaps/b108s.bmp b/bitmaps/b108s.bmp new file mode 100644 index 0000000..aac8e9c Binary files /dev/null and b/bitmaps/b108s.bmp differ diff --git a/bitmaps/b108w.bmp b/bitmaps/b108w.bmp new file mode 100644 index 0000000..5086abf Binary files /dev/null and b/bitmaps/b108w.bmp differ diff --git a/bitmaps/b116o.bmp b/bitmaps/b116o.bmp new file mode 100644 index 0000000..26b226a Binary files /dev/null and b/bitmaps/b116o.bmp differ diff --git a/bitmaps/b116s.bmp b/bitmaps/b116s.bmp new file mode 100644 index 0000000..12d70e3 Binary files /dev/null and b/bitmaps/b116s.bmp differ diff --git a/bitmaps/b116w.bmp b/bitmaps/b116w.bmp new file mode 100644 index 0000000..f11ec11 Binary files /dev/null and b/bitmaps/b116w.bmp differ diff --git a/bitmaps/b129o.bmp b/bitmaps/b129o.bmp new file mode 100644 index 0000000..243ef28 Binary files /dev/null and b/bitmaps/b129o.bmp differ diff --git a/bitmaps/b129s.bmp b/bitmaps/b129s.bmp new file mode 100644 index 0000000..4209b45 Binary files /dev/null and b/bitmaps/b129s.bmp differ diff --git a/bitmaps/b129w.bmp b/bitmaps/b129w.bmp new file mode 100644 index 0000000..759f1ef Binary files /dev/null and b/bitmaps/b129w.bmp differ diff --git a/bitmaps/b21o.bmp b/bitmaps/b21o.bmp new file mode 100644 index 0000000..4a5dc5f Binary files /dev/null and b/bitmaps/b21o.bmp differ diff --git a/bitmaps/b21s.bmp b/bitmaps/b21s.bmp new file mode 100644 index 0000000..cb9e317 Binary files /dev/null and b/bitmaps/b21s.bmp differ diff --git a/bitmaps/b21w.bmp b/bitmaps/b21w.bmp new file mode 100644 index 0000000..0b8b1ee Binary files /dev/null and b/bitmaps/b21w.bmp differ diff --git a/bitmaps/b25o.bmp b/bitmaps/b25o.bmp new file mode 100644 index 0000000..dfd160e Binary files /dev/null and b/bitmaps/b25o.bmp differ diff --git a/bitmaps/b25s.bmp b/bitmaps/b25s.bmp new file mode 100644 index 0000000..c9c41af Binary files /dev/null and b/bitmaps/b25s.bmp differ diff --git a/bitmaps/b25w.bmp b/bitmaps/b25w.bmp new file mode 100644 index 0000000..1d79b9d Binary files /dev/null and b/bitmaps/b25w.bmp differ diff --git a/bitmaps/b29o.bmp b/bitmaps/b29o.bmp new file mode 100644 index 0000000..cb1ef88 Binary files /dev/null and b/bitmaps/b29o.bmp differ diff --git a/bitmaps/b29s.bmp b/bitmaps/b29s.bmp new file mode 100644 index 0000000..f14cbfa Binary files /dev/null and b/bitmaps/b29s.bmp differ diff --git a/bitmaps/b29w.bmp b/bitmaps/b29w.bmp new file mode 100644 index 0000000..a04ae00 Binary files /dev/null and b/bitmaps/b29w.bmp differ diff --git a/bitmaps/b33o.bmp b/bitmaps/b33o.bmp new file mode 100644 index 0000000..8a2779a Binary files /dev/null and b/bitmaps/b33o.bmp differ diff --git a/bitmaps/b33s.bmp b/bitmaps/b33s.bmp new file mode 100644 index 0000000..1955f6b Binary files /dev/null and b/bitmaps/b33s.bmp differ diff --git a/bitmaps/b33w.bmp b/bitmaps/b33w.bmp new file mode 100644 index 0000000..3d34cbc Binary files /dev/null and b/bitmaps/b33w.bmp differ diff --git a/bitmaps/b37o.bmp b/bitmaps/b37o.bmp new file mode 100644 index 0000000..2e46cd4 Binary files /dev/null and b/bitmaps/b37o.bmp differ diff --git a/bitmaps/b37s.bmp b/bitmaps/b37s.bmp new file mode 100644 index 0000000..de6f7c5 Binary files /dev/null and b/bitmaps/b37s.bmp differ diff --git a/bitmaps/b37w.bmp b/bitmaps/b37w.bmp new file mode 100644 index 0000000..432212c Binary files /dev/null and b/bitmaps/b37w.bmp differ diff --git a/bitmaps/b40o.bmp b/bitmaps/b40o.bmp new file mode 100644 index 0000000..bb0c457 Binary files /dev/null and b/bitmaps/b40o.bmp differ diff --git a/bitmaps/b40s.bmp b/bitmaps/b40s.bmp new file mode 100644 index 0000000..4664ff2 Binary files /dev/null and b/bitmaps/b40s.bmp differ diff --git a/bitmaps/b40w.bmp b/bitmaps/b40w.bmp new file mode 100644 index 0000000..239e2fe Binary files /dev/null and b/bitmaps/b40w.bmp differ diff --git a/bitmaps/b45o.bmp b/bitmaps/b45o.bmp new file mode 100644 index 0000000..5cd3765 Binary files /dev/null and b/bitmaps/b45o.bmp differ diff --git a/bitmaps/b45s.bmp b/bitmaps/b45s.bmp new file mode 100644 index 0000000..285e968 Binary files /dev/null and b/bitmaps/b45s.bmp differ diff --git a/bitmaps/b45w.bmp b/bitmaps/b45w.bmp new file mode 100644 index 0000000..dec307a Binary files /dev/null and b/bitmaps/b45w.bmp differ diff --git a/bitmaps/b49o.bmp b/bitmaps/b49o.bmp new file mode 100644 index 0000000..b643dc3 Binary files /dev/null and b/bitmaps/b49o.bmp differ diff --git a/bitmaps/b49s.bmp b/bitmaps/b49s.bmp new file mode 100644 index 0000000..1a7f30c Binary files /dev/null and b/bitmaps/b49s.bmp differ diff --git a/bitmaps/b49w.bmp b/bitmaps/b49w.bmp new file mode 100644 index 0000000..8a294bb Binary files /dev/null and b/bitmaps/b49w.bmp differ diff --git a/bitmaps/b54o.bmp b/bitmaps/b54o.bmp new file mode 100644 index 0000000..5020224 Binary files /dev/null and b/bitmaps/b54o.bmp differ diff --git a/bitmaps/b54s.bmp b/bitmaps/b54s.bmp new file mode 100644 index 0000000..cb770e5 Binary files /dev/null and b/bitmaps/b54s.bmp differ diff --git a/bitmaps/b54w.bmp b/bitmaps/b54w.bmp new file mode 100644 index 0000000..011e8a9 Binary files /dev/null and b/bitmaps/b54w.bmp differ diff --git a/bitmaps/b58o.bmp b/bitmaps/b58o.bmp new file mode 100644 index 0000000..c8d3bd8 Binary files /dev/null and b/bitmaps/b58o.bmp differ diff --git a/bitmaps/b58s.bmp b/bitmaps/b58s.bmp new file mode 100644 index 0000000..f7c9220 Binary files /dev/null and b/bitmaps/b58s.bmp differ diff --git a/bitmaps/b58w.bmp b/bitmaps/b58w.bmp new file mode 100644 index 0000000..6a808b2 Binary files /dev/null and b/bitmaps/b58w.bmp differ diff --git a/bitmaps/b64o.bmp b/bitmaps/b64o.bmp new file mode 100644 index 0000000..52f14ac Binary files /dev/null and b/bitmaps/b64o.bmp differ diff --git a/bitmaps/b64s.bmp b/bitmaps/b64s.bmp new file mode 100644 index 0000000..a24c96e Binary files /dev/null and b/bitmaps/b64s.bmp differ diff --git a/bitmaps/b64w.bmp b/bitmaps/b64w.bmp new file mode 100644 index 0000000..acf8351 Binary files /dev/null and b/bitmaps/b64w.bmp differ diff --git a/bitmaps/b72o.bmp b/bitmaps/b72o.bmp new file mode 100644 index 0000000..e0010bb Binary files /dev/null and b/bitmaps/b72o.bmp differ diff --git a/bitmaps/b72s.bmp b/bitmaps/b72s.bmp new file mode 100644 index 0000000..a91b41d Binary files /dev/null and b/bitmaps/b72s.bmp differ diff --git a/bitmaps/b72w.bmp b/bitmaps/b72w.bmp new file mode 100644 index 0000000..76f2128 Binary files /dev/null and b/bitmaps/b72w.bmp differ diff --git a/bitmaps/b80o.bmp b/bitmaps/b80o.bmp new file mode 100644 index 0000000..3a72bfe Binary files /dev/null and b/bitmaps/b80o.bmp differ diff --git a/bitmaps/b80s.bmp b/bitmaps/b80s.bmp new file mode 100644 index 0000000..c9eef7a Binary files /dev/null and b/bitmaps/b80s.bmp differ diff --git a/bitmaps/b80w.bmp b/bitmaps/b80w.bmp new file mode 100644 index 0000000..ecaf147 Binary files /dev/null and b/bitmaps/b80w.bmp differ diff --git a/bitmaps/b87o.bmp b/bitmaps/b87o.bmp new file mode 100644 index 0000000..202994b Binary files /dev/null and b/bitmaps/b87o.bmp differ diff --git a/bitmaps/b87s.bmp b/bitmaps/b87s.bmp new file mode 100644 index 0000000..d5baa5c Binary files /dev/null and b/bitmaps/b87s.bmp differ diff --git a/bitmaps/b87w.bmp b/bitmaps/b87w.bmp new file mode 100644 index 0000000..540b4c9 Binary files /dev/null and b/bitmaps/b87w.bmp differ diff --git a/bitmaps/b95o.bmp b/bitmaps/b95o.bmp new file mode 100644 index 0000000..fea8eff Binary files /dev/null and b/bitmaps/b95o.bmp differ diff --git a/bitmaps/b95s.bmp b/bitmaps/b95s.bmp new file mode 100644 index 0000000..c288c7f Binary files /dev/null and b/bitmaps/b95s.bmp differ diff --git a/bitmaps/b95w.bmp b/bitmaps/b95w.bmp new file mode 100644 index 0000000..565deb0 Binary files /dev/null and b/bitmaps/b95w.bmp differ diff --git a/bitmaps/board.ico b/bitmaps/board.ico new file mode 100644 index 0000000..62f0714 Binary files /dev/null and b/bitmaps/board.ico differ diff --git a/bitmaps/dk49o.bmp b/bitmaps/dk49o.bmp new file mode 100644 index 0000000..e3f6f3a Binary files /dev/null and b/bitmaps/dk49o.bmp differ diff --git a/bitmaps/dk49s.bmp b/bitmaps/dk49s.bmp new file mode 100644 index 0000000..46b05b1 Binary files /dev/null and b/bitmaps/dk49s.bmp differ diff --git a/bitmaps/dk49w.bmp b/bitmaps/dk49w.bmp new file mode 100644 index 0000000..4e05b8f Binary files /dev/null and b/bitmaps/dk49w.bmp differ diff --git a/bitmaps/dk72o.bmp b/bitmaps/dk72o.bmp new file mode 100644 index 0000000..e531478 Binary files /dev/null and b/bitmaps/dk72o.bmp differ diff --git a/bitmaps/dk72s.bmp b/bitmaps/dk72s.bmp new file mode 100644 index 0000000..da3d696 Binary files /dev/null and b/bitmaps/dk72s.bmp differ diff --git a/bitmaps/dk72w.bmp b/bitmaps/dk72w.bmp new file mode 100644 index 0000000..66ee835 Binary files /dev/null and b/bitmaps/dk72w.bmp differ diff --git a/bitmaps/e129o.bmp b/bitmaps/e129o.bmp new file mode 100644 index 0000000..f464adf Binary files /dev/null and b/bitmaps/e129o.bmp differ diff --git a/bitmaps/g49o.bmp b/bitmaps/g49o.bmp new file mode 100644 index 0000000..2930420 Binary files /dev/null and b/bitmaps/g49o.bmp differ diff --git a/bitmaps/g49s.bmp b/bitmaps/g49s.bmp new file mode 100644 index 0000000..835cd41 Binary files /dev/null and b/bitmaps/g49s.bmp differ diff --git a/bitmaps/g49w.bmp b/bitmaps/g49w.bmp new file mode 100644 index 0000000..4cf34ac Binary files /dev/null and b/bitmaps/g49w.bmp differ diff --git a/bitmaps/g72o.bmp b/bitmaps/g72o.bmp new file mode 100644 index 0000000..6eb6bcf Binary files /dev/null and b/bitmaps/g72o.bmp differ diff --git a/bitmaps/g72s.bmp b/bitmaps/g72s.bmp new file mode 100644 index 0000000..751be79 Binary files /dev/null and b/bitmaps/g72s.bmp differ diff --git a/bitmaps/g72w.bmp b/bitmaps/g72w.bmp new file mode 100644 index 0000000..aaae0c4 Binary files /dev/null and b/bitmaps/g72w.bmp differ diff --git a/bitmaps/galactic.bmp b/bitmaps/galactic.bmp new file mode 100644 index 0000000..7dc277e Binary files /dev/null and b/bitmaps/galactic.bmp differ diff --git a/bitmaps/h129o.bmp b/bitmaps/h129o.bmp new file mode 100644 index 0000000..563da93 Binary files /dev/null and b/bitmaps/h129o.bmp differ diff --git a/bitmaps/h49o.bmp b/bitmaps/h49o.bmp index dd279cf..8ae9967 100644 Binary files a/bitmaps/h49o.bmp and b/bitmaps/h49o.bmp differ diff --git a/bitmaps/h49s.bmp b/bitmaps/h49s.bmp index 97cdec9..1ace8fe 100644 Binary files a/bitmaps/h49s.bmp and b/bitmaps/h49s.bmp differ diff --git a/bitmaps/h49w.bmp b/bitmaps/h49w.bmp index 3de2f0c..0163d1e 100644 Binary files a/bitmaps/h49w.bmp and b/bitmaps/h49w.bmp differ diff --git a/bitmaps/h72o.bmp b/bitmaps/h72o.bmp index 3ad8904..cdef69a 100644 Binary files a/bitmaps/h72o.bmp and b/bitmaps/h72o.bmp differ diff --git a/bitmaps/h72s.bmp b/bitmaps/h72s.bmp index 85fd8c8..44baa80 100644 Binary files a/bitmaps/h72s.bmp and b/bitmaps/h72s.bmp differ diff --git a/bitmaps/h72w.bmp b/bitmaps/h72w.bmp index 5d9ecd0..eac2216 100644 Binary files a/bitmaps/h72w.bmp and b/bitmaps/h72w.bmp differ diff --git a/bitmaps/icon_b.bmp b/bitmaps/icon_b.bmp new file mode 100644 index 0000000..152809d Binary files /dev/null and b/bitmaps/icon_b.bmp differ diff --git a/bitmaps/icon_b.ico b/bitmaps/icon_b.ico new file mode 100644 index 0000000..8555e72 Binary files /dev/null and b/bitmaps/icon_b.ico differ diff --git a/bitmaps/icon_o.ico b/bitmaps/icon_o.ico new file mode 100644 index 0000000..e3051fd Binary files /dev/null and b/bitmaps/icon_o.ico differ diff --git a/bitmaps/icon_ob.ico b/bitmaps/icon_ob.ico new file mode 100644 index 0000000..27cfe72 Binary files /dev/null and b/bitmaps/icon_ob.ico differ diff --git a/bitmaps/icon_ow.ico b/bitmaps/icon_ow.ico new file mode 100644 index 0000000..5ba5631 Binary files /dev/null and b/bitmaps/icon_ow.ico differ diff --git a/bitmaps/icon_w.bmp b/bitmaps/icon_w.bmp new file mode 100644 index 0000000..c1a7c03 Binary files /dev/null and b/bitmaps/icon_w.bmp differ diff --git a/bitmaps/icon_w.ico b/bitmaps/icon_w.ico new file mode 100644 index 0000000..d0d803a Binary files /dev/null and b/bitmaps/icon_w.ico differ diff --git a/bitmaps/icon_whi.ico b/bitmaps/icon_whi.ico new file mode 100644 index 0000000..fd7b2db Binary files /dev/null and b/bitmaps/icon_whi.ico differ diff --git a/bitmaps/k108o.bmp b/bitmaps/k108o.bmp new file mode 100644 index 0000000..3a38071 Binary files /dev/null and b/bitmaps/k108o.bmp differ diff --git a/bitmaps/k108s.bmp b/bitmaps/k108s.bmp new file mode 100644 index 0000000..854baff Binary files /dev/null and b/bitmaps/k108s.bmp differ diff --git a/bitmaps/k108w.bmp b/bitmaps/k108w.bmp new file mode 100644 index 0000000..4fa8e67 Binary files /dev/null and b/bitmaps/k108w.bmp differ diff --git a/bitmaps/k116o.bmp b/bitmaps/k116o.bmp new file mode 100644 index 0000000..eafb1f7 Binary files /dev/null and b/bitmaps/k116o.bmp differ diff --git a/bitmaps/k116s.bmp b/bitmaps/k116s.bmp new file mode 100644 index 0000000..5fce825 Binary files /dev/null and b/bitmaps/k116s.bmp differ diff --git a/bitmaps/k116w.bmp b/bitmaps/k116w.bmp new file mode 100644 index 0000000..fd37812 Binary files /dev/null and b/bitmaps/k116w.bmp differ diff --git a/bitmaps/k129o.bmp b/bitmaps/k129o.bmp new file mode 100644 index 0000000..c2c9bb2 Binary files /dev/null and b/bitmaps/k129o.bmp differ diff --git a/bitmaps/k129s.bmp b/bitmaps/k129s.bmp new file mode 100644 index 0000000..91db0dd Binary files /dev/null and b/bitmaps/k129s.bmp differ diff --git a/bitmaps/k129w.bmp b/bitmaps/k129w.bmp new file mode 100644 index 0000000..2901b42 Binary files /dev/null and b/bitmaps/k129w.bmp differ diff --git a/bitmaps/k21o.bmp b/bitmaps/k21o.bmp new file mode 100644 index 0000000..0d753d9 Binary files /dev/null and b/bitmaps/k21o.bmp differ diff --git a/bitmaps/k21s.bmp b/bitmaps/k21s.bmp new file mode 100644 index 0000000..bbc70fc Binary files /dev/null and b/bitmaps/k21s.bmp differ diff --git a/bitmaps/k21w.bmp b/bitmaps/k21w.bmp new file mode 100644 index 0000000..ea0ad50 Binary files /dev/null and b/bitmaps/k21w.bmp differ diff --git a/bitmaps/k25o.bmp b/bitmaps/k25o.bmp new file mode 100644 index 0000000..8c17818 Binary files /dev/null and b/bitmaps/k25o.bmp differ diff --git a/bitmaps/k25s.bmp b/bitmaps/k25s.bmp new file mode 100644 index 0000000..fcf180c Binary files /dev/null and b/bitmaps/k25s.bmp differ diff --git a/bitmaps/k25w.bmp b/bitmaps/k25w.bmp new file mode 100644 index 0000000..bcc7986 Binary files /dev/null and b/bitmaps/k25w.bmp differ diff --git a/bitmaps/k29o.bmp b/bitmaps/k29o.bmp new file mode 100644 index 0000000..4284322 Binary files /dev/null and b/bitmaps/k29o.bmp differ diff --git a/bitmaps/k29s.bmp b/bitmaps/k29s.bmp new file mode 100644 index 0000000..aefee9a Binary files /dev/null and b/bitmaps/k29s.bmp differ diff --git a/bitmaps/k29w.bmp b/bitmaps/k29w.bmp new file mode 100644 index 0000000..9bea2c5 Binary files /dev/null and b/bitmaps/k29w.bmp differ diff --git a/bitmaps/k33o.bmp b/bitmaps/k33o.bmp new file mode 100644 index 0000000..ef6bd2a Binary files /dev/null and b/bitmaps/k33o.bmp differ diff --git a/bitmaps/k33s.bmp b/bitmaps/k33s.bmp new file mode 100644 index 0000000..8ac836d Binary files /dev/null and b/bitmaps/k33s.bmp differ diff --git a/bitmaps/k33w.bmp b/bitmaps/k33w.bmp new file mode 100644 index 0000000..4658756 Binary files /dev/null and b/bitmaps/k33w.bmp differ diff --git a/bitmaps/k37o.bmp b/bitmaps/k37o.bmp new file mode 100644 index 0000000..34b1702 Binary files /dev/null and b/bitmaps/k37o.bmp differ diff --git a/bitmaps/k37s.bmp b/bitmaps/k37s.bmp new file mode 100644 index 0000000..d5ac9ac Binary files /dev/null and b/bitmaps/k37s.bmp differ diff --git a/bitmaps/k37w.bmp b/bitmaps/k37w.bmp new file mode 100644 index 0000000..5be036f Binary files /dev/null and b/bitmaps/k37w.bmp differ diff --git a/bitmaps/k40o.bmp b/bitmaps/k40o.bmp new file mode 100644 index 0000000..52b02a3 Binary files /dev/null and b/bitmaps/k40o.bmp differ diff --git a/bitmaps/k40s.bmp b/bitmaps/k40s.bmp new file mode 100644 index 0000000..5965e8c Binary files /dev/null and b/bitmaps/k40s.bmp differ diff --git a/bitmaps/k40w.bmp b/bitmaps/k40w.bmp new file mode 100644 index 0000000..098cc61 Binary files /dev/null and b/bitmaps/k40w.bmp differ diff --git a/bitmaps/k45o.bmp b/bitmaps/k45o.bmp new file mode 100644 index 0000000..7fc08b3 Binary files /dev/null and b/bitmaps/k45o.bmp differ diff --git a/bitmaps/k45s.bmp b/bitmaps/k45s.bmp new file mode 100644 index 0000000..4412cb5 Binary files /dev/null and b/bitmaps/k45s.bmp differ diff --git a/bitmaps/k45w.bmp b/bitmaps/k45w.bmp new file mode 100644 index 0000000..f6ef58f Binary files /dev/null and b/bitmaps/k45w.bmp differ diff --git a/bitmaps/k49o.bmp b/bitmaps/k49o.bmp new file mode 100644 index 0000000..912e63a Binary files /dev/null and b/bitmaps/k49o.bmp differ diff --git a/bitmaps/k49s.bmp b/bitmaps/k49s.bmp new file mode 100644 index 0000000..bda98b0 Binary files /dev/null and b/bitmaps/k49s.bmp differ diff --git a/bitmaps/k49w.bmp b/bitmaps/k49w.bmp new file mode 100644 index 0000000..985b675 Binary files /dev/null and b/bitmaps/k49w.bmp differ diff --git a/bitmaps/k54o.bmp b/bitmaps/k54o.bmp new file mode 100644 index 0000000..f3e9047 Binary files /dev/null and b/bitmaps/k54o.bmp differ diff --git a/bitmaps/k54s.bmp b/bitmaps/k54s.bmp new file mode 100644 index 0000000..287d70b Binary files /dev/null and b/bitmaps/k54s.bmp differ diff --git a/bitmaps/k54w.bmp b/bitmaps/k54w.bmp new file mode 100644 index 0000000..0923c9b Binary files /dev/null and b/bitmaps/k54w.bmp differ diff --git a/bitmaps/k58o.bmp b/bitmaps/k58o.bmp new file mode 100644 index 0000000..95ac9de Binary files /dev/null and b/bitmaps/k58o.bmp differ diff --git a/bitmaps/k58s.bmp b/bitmaps/k58s.bmp new file mode 100644 index 0000000..8eb1ed7 Binary files /dev/null and b/bitmaps/k58s.bmp differ diff --git a/bitmaps/k58w.bmp b/bitmaps/k58w.bmp new file mode 100644 index 0000000..10b2338 Binary files /dev/null and b/bitmaps/k58w.bmp differ diff --git a/bitmaps/k64o.bmp b/bitmaps/k64o.bmp new file mode 100644 index 0000000..7418826 Binary files /dev/null and b/bitmaps/k64o.bmp differ diff --git a/bitmaps/k64s.bmp b/bitmaps/k64s.bmp new file mode 100644 index 0000000..d257d77 Binary files /dev/null and b/bitmaps/k64s.bmp differ diff --git a/bitmaps/k64w.bmp b/bitmaps/k64w.bmp new file mode 100644 index 0000000..b90bcb3 Binary files /dev/null and b/bitmaps/k64w.bmp differ diff --git a/bitmaps/k72o.bmp b/bitmaps/k72o.bmp new file mode 100644 index 0000000..1e0ad8f Binary files /dev/null and b/bitmaps/k72o.bmp differ diff --git a/bitmaps/k72s.bmp b/bitmaps/k72s.bmp new file mode 100644 index 0000000..2df1e5d Binary files /dev/null and b/bitmaps/k72s.bmp differ diff --git a/bitmaps/k72w.bmp b/bitmaps/k72w.bmp new file mode 100644 index 0000000..f710470 Binary files /dev/null and b/bitmaps/k72w.bmp differ diff --git a/bitmaps/k80o.bmp b/bitmaps/k80o.bmp new file mode 100644 index 0000000..d9bc797 Binary files /dev/null and b/bitmaps/k80o.bmp differ diff --git a/bitmaps/k80s.bmp b/bitmaps/k80s.bmp new file mode 100644 index 0000000..e5848e4 Binary files /dev/null and b/bitmaps/k80s.bmp differ diff --git a/bitmaps/k80w.bmp b/bitmaps/k80w.bmp new file mode 100644 index 0000000..1e9797a Binary files /dev/null and b/bitmaps/k80w.bmp differ diff --git a/bitmaps/k87o.bmp b/bitmaps/k87o.bmp new file mode 100644 index 0000000..929fa11 Binary files /dev/null and b/bitmaps/k87o.bmp differ diff --git a/bitmaps/k87s.bmp b/bitmaps/k87s.bmp new file mode 100644 index 0000000..a013148 Binary files /dev/null and b/bitmaps/k87s.bmp differ diff --git a/bitmaps/k87w.bmp b/bitmaps/k87w.bmp new file mode 100644 index 0000000..2f4a62a Binary files /dev/null and b/bitmaps/k87w.bmp differ diff --git a/bitmaps/k95o.bmp b/bitmaps/k95o.bmp new file mode 100644 index 0000000..7438de4 Binary files /dev/null and b/bitmaps/k95o.bmp differ diff --git a/bitmaps/k95s.bmp b/bitmaps/k95s.bmp new file mode 100644 index 0000000..098bc95 Binary files /dev/null and b/bitmaps/k95s.bmp differ diff --git a/bitmaps/k95w.bmp b/bitmaps/k95w.bmp new file mode 100644 index 0000000..15a98c8 Binary files /dev/null and b/bitmaps/k95w.bmp differ diff --git a/bitmaps/l49o.bmp b/bitmaps/l49o.bmp new file mode 100644 index 0000000..4a83007 Binary files /dev/null and b/bitmaps/l49o.bmp differ diff --git a/bitmaps/l49s.bmp b/bitmaps/l49s.bmp new file mode 100644 index 0000000..9dbea26 Binary files /dev/null and b/bitmaps/l49s.bmp differ diff --git a/bitmaps/l49w.bmp b/bitmaps/l49w.bmp new file mode 100644 index 0000000..da13b66 Binary files /dev/null and b/bitmaps/l49w.bmp differ diff --git a/bitmaps/l72o.bmp b/bitmaps/l72o.bmp new file mode 100644 index 0000000..130cbfd Binary files /dev/null and b/bitmaps/l72o.bmp differ diff --git a/bitmaps/l72s.bmp b/bitmaps/l72s.bmp new file mode 100644 index 0000000..798e908 Binary files /dev/null and b/bitmaps/l72s.bmp differ diff --git a/bitmaps/l72w.bmp b/bitmaps/l72w.bmp new file mode 100644 index 0000000..6914cb1 Binary files /dev/null and b/bitmaps/l72w.bmp differ diff --git a/bitmaps/m129o.bmp b/bitmaps/m129o.bmp new file mode 100644 index 0000000..243ef28 Binary files /dev/null and b/bitmaps/m129o.bmp differ diff --git a/bitmaps/n108o.bmp b/bitmaps/n108o.bmp new file mode 100644 index 0000000..773c91b Binary files /dev/null and b/bitmaps/n108o.bmp differ diff --git a/bitmaps/n108s.bmp b/bitmaps/n108s.bmp new file mode 100644 index 0000000..62691df Binary files /dev/null and b/bitmaps/n108s.bmp differ diff --git a/bitmaps/n108w.bmp b/bitmaps/n108w.bmp new file mode 100644 index 0000000..248dff0 Binary files /dev/null and b/bitmaps/n108w.bmp differ diff --git a/bitmaps/n116o.bmp b/bitmaps/n116o.bmp new file mode 100644 index 0000000..61e037d Binary files /dev/null and b/bitmaps/n116o.bmp differ diff --git a/bitmaps/n116s.bmp b/bitmaps/n116s.bmp new file mode 100644 index 0000000..fc2419a Binary files /dev/null and b/bitmaps/n116s.bmp differ diff --git a/bitmaps/n116w.bmp b/bitmaps/n116w.bmp new file mode 100644 index 0000000..a6299b1 Binary files /dev/null and b/bitmaps/n116w.bmp differ diff --git a/bitmaps/n129o.bmp b/bitmaps/n129o.bmp new file mode 100644 index 0000000..857a82f Binary files /dev/null and b/bitmaps/n129o.bmp differ diff --git a/bitmaps/n129s.bmp b/bitmaps/n129s.bmp new file mode 100644 index 0000000..d5f2142 Binary files /dev/null and b/bitmaps/n129s.bmp differ diff --git a/bitmaps/n129w.bmp b/bitmaps/n129w.bmp new file mode 100644 index 0000000..e1d630c Binary files /dev/null and b/bitmaps/n129w.bmp differ diff --git a/bitmaps/n21o.bmp b/bitmaps/n21o.bmp new file mode 100644 index 0000000..8ae7a73 Binary files /dev/null and b/bitmaps/n21o.bmp differ diff --git a/bitmaps/n21s.bmp b/bitmaps/n21s.bmp new file mode 100644 index 0000000..7c2aa5c Binary files /dev/null and b/bitmaps/n21s.bmp differ diff --git a/bitmaps/n21w.bmp b/bitmaps/n21w.bmp new file mode 100644 index 0000000..174e345 Binary files /dev/null and b/bitmaps/n21w.bmp differ diff --git a/bitmaps/n25o.bmp b/bitmaps/n25o.bmp new file mode 100644 index 0000000..9ebffd6 Binary files /dev/null and b/bitmaps/n25o.bmp differ diff --git a/bitmaps/n25s.bmp b/bitmaps/n25s.bmp new file mode 100644 index 0000000..c4f4ab5 Binary files /dev/null and b/bitmaps/n25s.bmp differ diff --git a/bitmaps/n25w.bmp b/bitmaps/n25w.bmp new file mode 100644 index 0000000..493f9b5 Binary files /dev/null and b/bitmaps/n25w.bmp differ diff --git a/bitmaps/n29o.bmp b/bitmaps/n29o.bmp new file mode 100644 index 0000000..5b78783 Binary files /dev/null and b/bitmaps/n29o.bmp differ diff --git a/bitmaps/n29s.bmp b/bitmaps/n29s.bmp new file mode 100644 index 0000000..88d0afb Binary files /dev/null and b/bitmaps/n29s.bmp differ diff --git a/bitmaps/n29w.bmp b/bitmaps/n29w.bmp new file mode 100644 index 0000000..d075211 Binary files /dev/null and b/bitmaps/n29w.bmp differ diff --git a/bitmaps/n33o.bmp b/bitmaps/n33o.bmp new file mode 100644 index 0000000..2677922 Binary files /dev/null and b/bitmaps/n33o.bmp differ diff --git a/bitmaps/n33s.bmp b/bitmaps/n33s.bmp new file mode 100644 index 0000000..85d2f83 Binary files /dev/null and b/bitmaps/n33s.bmp differ diff --git a/bitmaps/n33w.bmp b/bitmaps/n33w.bmp new file mode 100644 index 0000000..7a42f6a Binary files /dev/null and b/bitmaps/n33w.bmp differ diff --git a/bitmaps/n37o.bmp b/bitmaps/n37o.bmp new file mode 100644 index 0000000..a68f14a Binary files /dev/null and b/bitmaps/n37o.bmp differ diff --git a/bitmaps/n37s.bmp b/bitmaps/n37s.bmp new file mode 100644 index 0000000..27a6de2 Binary files /dev/null and b/bitmaps/n37s.bmp differ diff --git a/bitmaps/n37w.bmp b/bitmaps/n37w.bmp new file mode 100644 index 0000000..89d157e Binary files /dev/null and b/bitmaps/n37w.bmp differ diff --git a/bitmaps/n40o.bmp b/bitmaps/n40o.bmp new file mode 100644 index 0000000..9be7534 Binary files /dev/null and b/bitmaps/n40o.bmp differ diff --git a/bitmaps/n40s.bmp b/bitmaps/n40s.bmp new file mode 100644 index 0000000..1fa0fce Binary files /dev/null and b/bitmaps/n40s.bmp differ diff --git a/bitmaps/n40w.bmp b/bitmaps/n40w.bmp new file mode 100644 index 0000000..84eeea1 Binary files /dev/null and b/bitmaps/n40w.bmp differ diff --git a/bitmaps/n45o.bmp b/bitmaps/n45o.bmp new file mode 100644 index 0000000..81e3ee4 Binary files /dev/null and b/bitmaps/n45o.bmp differ diff --git a/bitmaps/n45s.bmp b/bitmaps/n45s.bmp new file mode 100644 index 0000000..67752a1 Binary files /dev/null and b/bitmaps/n45s.bmp differ diff --git a/bitmaps/n45w.bmp b/bitmaps/n45w.bmp new file mode 100644 index 0000000..e200f89 Binary files /dev/null and b/bitmaps/n45w.bmp differ diff --git a/bitmaps/n49o.bmp b/bitmaps/n49o.bmp new file mode 100644 index 0000000..44d9cec Binary files /dev/null and b/bitmaps/n49o.bmp differ diff --git a/bitmaps/n49s.bmp b/bitmaps/n49s.bmp new file mode 100644 index 0000000..7a5200b Binary files /dev/null and b/bitmaps/n49s.bmp differ diff --git a/bitmaps/n49w.bmp b/bitmaps/n49w.bmp new file mode 100644 index 0000000..f3f7311 Binary files /dev/null and b/bitmaps/n49w.bmp differ diff --git a/bitmaps/n54o.bmp b/bitmaps/n54o.bmp new file mode 100644 index 0000000..738c72b Binary files /dev/null and b/bitmaps/n54o.bmp differ diff --git a/bitmaps/n54s.bmp b/bitmaps/n54s.bmp new file mode 100644 index 0000000..1c3c3fa Binary files /dev/null and b/bitmaps/n54s.bmp differ diff --git a/bitmaps/n54w.bmp b/bitmaps/n54w.bmp new file mode 100644 index 0000000..da912e7 Binary files /dev/null and b/bitmaps/n54w.bmp differ diff --git a/bitmaps/n58o.bmp b/bitmaps/n58o.bmp new file mode 100644 index 0000000..b551c1c Binary files /dev/null and b/bitmaps/n58o.bmp differ diff --git a/bitmaps/n58s.bmp b/bitmaps/n58s.bmp new file mode 100644 index 0000000..39bf412 Binary files /dev/null and b/bitmaps/n58s.bmp differ diff --git a/bitmaps/n58w.bmp b/bitmaps/n58w.bmp new file mode 100644 index 0000000..b6ba799 Binary files /dev/null and b/bitmaps/n58w.bmp differ diff --git a/bitmaps/n64o.bmp b/bitmaps/n64o.bmp new file mode 100644 index 0000000..a932bce Binary files /dev/null and b/bitmaps/n64o.bmp differ diff --git a/bitmaps/n64s.bmp b/bitmaps/n64s.bmp new file mode 100644 index 0000000..e0a25e1 Binary files /dev/null and b/bitmaps/n64s.bmp differ diff --git a/bitmaps/n64w.bmp b/bitmaps/n64w.bmp new file mode 100644 index 0000000..1c20506 Binary files /dev/null and b/bitmaps/n64w.bmp differ diff --git a/bitmaps/n72o.bmp b/bitmaps/n72o.bmp new file mode 100644 index 0000000..be3f303 Binary files /dev/null and b/bitmaps/n72o.bmp differ diff --git a/bitmaps/n72s.bmp b/bitmaps/n72s.bmp new file mode 100644 index 0000000..d641b8e Binary files /dev/null and b/bitmaps/n72s.bmp differ diff --git a/bitmaps/n72w.bmp b/bitmaps/n72w.bmp new file mode 100644 index 0000000..ba9552b Binary files /dev/null and b/bitmaps/n72w.bmp differ diff --git a/bitmaps/n80o.bmp b/bitmaps/n80o.bmp new file mode 100644 index 0000000..05b1a33 Binary files /dev/null and b/bitmaps/n80o.bmp differ diff --git a/bitmaps/n80s.bmp b/bitmaps/n80s.bmp new file mode 100644 index 0000000..873c833 Binary files /dev/null and b/bitmaps/n80s.bmp differ diff --git a/bitmaps/n80w.bmp b/bitmaps/n80w.bmp new file mode 100644 index 0000000..ff874d4 Binary files /dev/null and b/bitmaps/n80w.bmp differ diff --git a/bitmaps/n87o.bmp b/bitmaps/n87o.bmp new file mode 100644 index 0000000..3466d4d Binary files /dev/null and b/bitmaps/n87o.bmp differ diff --git a/bitmaps/n87s.bmp b/bitmaps/n87s.bmp new file mode 100644 index 0000000..59b715b Binary files /dev/null and b/bitmaps/n87s.bmp differ diff --git a/bitmaps/n87w.bmp b/bitmaps/n87w.bmp new file mode 100644 index 0000000..f63f28f Binary files /dev/null and b/bitmaps/n87w.bmp differ diff --git a/bitmaps/n95o.bmp b/bitmaps/n95o.bmp new file mode 100644 index 0000000..f826a19 Binary files /dev/null and b/bitmaps/n95o.bmp differ diff --git a/bitmaps/n95s.bmp b/bitmaps/n95s.bmp new file mode 100644 index 0000000..6104c31 Binary files /dev/null and b/bitmaps/n95s.bmp differ diff --git a/bitmaps/n95w.bmp b/bitmaps/n95w.bmp new file mode 100644 index 0000000..68f7488 Binary files /dev/null and b/bitmaps/n95w.bmp differ diff --git a/bitmaps/ni49o.bmp b/bitmaps/ni49o.bmp new file mode 100644 index 0000000..42f9021 Binary files /dev/null and b/bitmaps/ni49o.bmp differ diff --git a/bitmaps/ni49s.bmp b/bitmaps/ni49s.bmp new file mode 100644 index 0000000..dbb4397 Binary files /dev/null and b/bitmaps/ni49s.bmp differ diff --git a/bitmaps/ni49w.bmp b/bitmaps/ni49w.bmp new file mode 100644 index 0000000..7964c14 Binary files /dev/null and b/bitmaps/ni49w.bmp differ diff --git a/bitmaps/ni72o.bmp b/bitmaps/ni72o.bmp new file mode 100644 index 0000000..fe4bd69 Binary files /dev/null and b/bitmaps/ni72o.bmp differ diff --git a/bitmaps/ni72s.bmp b/bitmaps/ni72s.bmp new file mode 100644 index 0000000..644a54b Binary files /dev/null and b/bitmaps/ni72s.bmp differ diff --git a/bitmaps/ni72w.bmp b/bitmaps/ni72w.bmp new file mode 100644 index 0000000..81cc086 Binary files /dev/null and b/bitmaps/ni72w.bmp differ diff --git a/bitmaps/p108o.bmp b/bitmaps/p108o.bmp new file mode 100644 index 0000000..08fe730 Binary files /dev/null and b/bitmaps/p108o.bmp differ diff --git a/bitmaps/p108s.bmp b/bitmaps/p108s.bmp new file mode 100644 index 0000000..099f9ee Binary files /dev/null and b/bitmaps/p108s.bmp differ diff --git a/bitmaps/p108w.bmp b/bitmaps/p108w.bmp new file mode 100644 index 0000000..2e28c9c Binary files /dev/null and b/bitmaps/p108w.bmp differ diff --git a/bitmaps/p116o.bmp b/bitmaps/p116o.bmp new file mode 100644 index 0000000..d9950a3 Binary files /dev/null and b/bitmaps/p116o.bmp differ diff --git a/bitmaps/p116s.bmp b/bitmaps/p116s.bmp new file mode 100644 index 0000000..7fcf7aa Binary files /dev/null and b/bitmaps/p116s.bmp differ diff --git a/bitmaps/p116w.bmp b/bitmaps/p116w.bmp new file mode 100644 index 0000000..b24fc2a Binary files /dev/null and b/bitmaps/p116w.bmp differ diff --git a/bitmaps/p129o.bmp b/bitmaps/p129o.bmp new file mode 100644 index 0000000..5a3713a Binary files /dev/null and b/bitmaps/p129o.bmp differ diff --git a/bitmaps/p129s.bmp b/bitmaps/p129s.bmp new file mode 100644 index 0000000..83df042 Binary files /dev/null and b/bitmaps/p129s.bmp differ diff --git a/bitmaps/p129w.bmp b/bitmaps/p129w.bmp new file mode 100644 index 0000000..360735a Binary files /dev/null and b/bitmaps/p129w.bmp differ diff --git a/bitmaps/p21o.bmp b/bitmaps/p21o.bmp new file mode 100644 index 0000000..ba739e5 Binary files /dev/null and b/bitmaps/p21o.bmp differ diff --git a/bitmaps/p21s.bmp b/bitmaps/p21s.bmp new file mode 100644 index 0000000..53fb5ab Binary files /dev/null and b/bitmaps/p21s.bmp differ diff --git a/bitmaps/p21w.bmp b/bitmaps/p21w.bmp new file mode 100644 index 0000000..e47cc23 Binary files /dev/null and b/bitmaps/p21w.bmp differ diff --git a/bitmaps/p25o.bmp b/bitmaps/p25o.bmp new file mode 100644 index 0000000..7cf8014 Binary files /dev/null and b/bitmaps/p25o.bmp differ diff --git a/bitmaps/p25s.bmp b/bitmaps/p25s.bmp new file mode 100644 index 0000000..1a59190 Binary files /dev/null and b/bitmaps/p25s.bmp differ diff --git a/bitmaps/p25w.bmp b/bitmaps/p25w.bmp new file mode 100644 index 0000000..bd7b65b Binary files /dev/null and b/bitmaps/p25w.bmp differ diff --git a/bitmaps/p29o.bmp b/bitmaps/p29o.bmp new file mode 100644 index 0000000..49b9985 Binary files /dev/null and b/bitmaps/p29o.bmp differ diff --git a/bitmaps/p29s.bmp b/bitmaps/p29s.bmp new file mode 100644 index 0000000..e3f5f87 Binary files /dev/null and b/bitmaps/p29s.bmp differ diff --git a/bitmaps/p29w.bmp b/bitmaps/p29w.bmp new file mode 100644 index 0000000..55169f6 Binary files /dev/null and b/bitmaps/p29w.bmp differ diff --git a/bitmaps/p33o.bmp b/bitmaps/p33o.bmp new file mode 100644 index 0000000..4ebb6f4 Binary files /dev/null and b/bitmaps/p33o.bmp differ diff --git a/bitmaps/p33s.bmp b/bitmaps/p33s.bmp new file mode 100644 index 0000000..88c9dd2 Binary files /dev/null and b/bitmaps/p33s.bmp differ diff --git a/bitmaps/p33w.bmp b/bitmaps/p33w.bmp new file mode 100644 index 0000000..0de8f7f Binary files /dev/null and b/bitmaps/p33w.bmp differ diff --git a/bitmaps/p37o.bmp b/bitmaps/p37o.bmp new file mode 100644 index 0000000..0d165cf Binary files /dev/null and b/bitmaps/p37o.bmp differ diff --git a/bitmaps/p37s.bmp b/bitmaps/p37s.bmp new file mode 100644 index 0000000..dd95792 Binary files /dev/null and b/bitmaps/p37s.bmp differ diff --git a/bitmaps/p37w.bmp b/bitmaps/p37w.bmp new file mode 100644 index 0000000..48e0dc7 Binary files /dev/null and b/bitmaps/p37w.bmp differ diff --git a/bitmaps/p40o.bmp b/bitmaps/p40o.bmp new file mode 100644 index 0000000..2164542 Binary files /dev/null and b/bitmaps/p40o.bmp differ diff --git a/bitmaps/p40s.bmp b/bitmaps/p40s.bmp new file mode 100644 index 0000000..438d142 Binary files /dev/null and b/bitmaps/p40s.bmp differ diff --git a/bitmaps/p40w.bmp b/bitmaps/p40w.bmp new file mode 100644 index 0000000..44567d9 Binary files /dev/null and b/bitmaps/p40w.bmp differ diff --git a/bitmaps/p45o.bmp b/bitmaps/p45o.bmp new file mode 100644 index 0000000..d878adb Binary files /dev/null and b/bitmaps/p45o.bmp differ diff --git a/bitmaps/p45s.bmp b/bitmaps/p45s.bmp new file mode 100644 index 0000000..c44efa7 Binary files /dev/null and b/bitmaps/p45s.bmp differ diff --git a/bitmaps/p45w.bmp b/bitmaps/p45w.bmp new file mode 100644 index 0000000..d1cb668 Binary files /dev/null and b/bitmaps/p45w.bmp differ diff --git a/bitmaps/p49o.bmp b/bitmaps/p49o.bmp new file mode 100644 index 0000000..74fb233 Binary files /dev/null and b/bitmaps/p49o.bmp differ diff --git a/bitmaps/p49s.bmp b/bitmaps/p49s.bmp new file mode 100644 index 0000000..a76357c Binary files /dev/null and b/bitmaps/p49s.bmp differ diff --git a/bitmaps/p49w.bmp b/bitmaps/p49w.bmp new file mode 100644 index 0000000..e34cb97 Binary files /dev/null and b/bitmaps/p49w.bmp differ diff --git a/bitmaps/p54o.bmp b/bitmaps/p54o.bmp new file mode 100644 index 0000000..fc0a928 Binary files /dev/null and b/bitmaps/p54o.bmp differ diff --git a/bitmaps/p54s.bmp b/bitmaps/p54s.bmp new file mode 100644 index 0000000..7bd3fba Binary files /dev/null and b/bitmaps/p54s.bmp differ diff --git a/bitmaps/p54w.bmp b/bitmaps/p54w.bmp new file mode 100644 index 0000000..ca35eda Binary files /dev/null and b/bitmaps/p54w.bmp differ diff --git a/bitmaps/p58o.bmp b/bitmaps/p58o.bmp new file mode 100644 index 0000000..6f1c81e Binary files /dev/null and b/bitmaps/p58o.bmp differ diff --git a/bitmaps/p58s.bmp b/bitmaps/p58s.bmp new file mode 100644 index 0000000..3336583 Binary files /dev/null and b/bitmaps/p58s.bmp differ diff --git a/bitmaps/p58w.bmp b/bitmaps/p58w.bmp new file mode 100644 index 0000000..8a45650 Binary files /dev/null and b/bitmaps/p58w.bmp differ diff --git a/bitmaps/p64o.bmp b/bitmaps/p64o.bmp new file mode 100644 index 0000000..336c228 Binary files /dev/null and b/bitmaps/p64o.bmp differ diff --git a/bitmaps/p64s.bmp b/bitmaps/p64s.bmp new file mode 100644 index 0000000..a134e41 Binary files /dev/null and b/bitmaps/p64s.bmp differ diff --git a/bitmaps/p64w.bmp b/bitmaps/p64w.bmp new file mode 100644 index 0000000..ebdd7e4 Binary files /dev/null and b/bitmaps/p64w.bmp differ diff --git a/bitmaps/p72o.bmp b/bitmaps/p72o.bmp new file mode 100644 index 0000000..7436520 Binary files /dev/null and b/bitmaps/p72o.bmp differ diff --git a/bitmaps/p72s.bmp b/bitmaps/p72s.bmp new file mode 100644 index 0000000..c155645 Binary files /dev/null and b/bitmaps/p72s.bmp differ diff --git a/bitmaps/p72w.bmp b/bitmaps/p72w.bmp new file mode 100644 index 0000000..542a9e0 Binary files /dev/null and b/bitmaps/p72w.bmp differ diff --git a/bitmaps/p80o.bmp b/bitmaps/p80o.bmp new file mode 100644 index 0000000..096c445 Binary files /dev/null and b/bitmaps/p80o.bmp differ diff --git a/bitmaps/p80s.bmp b/bitmaps/p80s.bmp new file mode 100644 index 0000000..0883c08 Binary files /dev/null and b/bitmaps/p80s.bmp differ diff --git a/bitmaps/p80w.bmp b/bitmaps/p80w.bmp new file mode 100644 index 0000000..2168385 Binary files /dev/null and b/bitmaps/p80w.bmp differ diff --git a/bitmaps/p87o.bmp b/bitmaps/p87o.bmp new file mode 100644 index 0000000..de4374c Binary files /dev/null and b/bitmaps/p87o.bmp differ diff --git a/bitmaps/p87s.bmp b/bitmaps/p87s.bmp new file mode 100644 index 0000000..c8b6e3a Binary files /dev/null and b/bitmaps/p87s.bmp differ diff --git a/bitmaps/p87w.bmp b/bitmaps/p87w.bmp new file mode 100644 index 0000000..15d9ea8 Binary files /dev/null and b/bitmaps/p87w.bmp differ diff --git a/bitmaps/p95o.bmp b/bitmaps/p95o.bmp new file mode 100644 index 0000000..d8d1acd Binary files /dev/null and b/bitmaps/p95o.bmp differ diff --git a/bitmaps/p95s.bmp b/bitmaps/p95s.bmp new file mode 100644 index 0000000..637365f Binary files /dev/null and b/bitmaps/p95s.bmp differ diff --git a/bitmaps/p95w.bmp b/bitmaps/p95w.bmp new file mode 100644 index 0000000..274c521 Binary files /dev/null and b/bitmaps/p95w.bmp differ diff --git a/bitmaps/q108o.bmp b/bitmaps/q108o.bmp new file mode 100644 index 0000000..e11a741 Binary files /dev/null and b/bitmaps/q108o.bmp differ diff --git a/bitmaps/q108s.bmp b/bitmaps/q108s.bmp new file mode 100644 index 0000000..0840506 Binary files /dev/null and b/bitmaps/q108s.bmp differ diff --git a/bitmaps/q108w.bmp b/bitmaps/q108w.bmp new file mode 100644 index 0000000..3cfe3fc Binary files /dev/null and b/bitmaps/q108w.bmp differ diff --git a/bitmaps/q116o.bmp b/bitmaps/q116o.bmp new file mode 100644 index 0000000..8d884cd Binary files /dev/null and b/bitmaps/q116o.bmp differ diff --git a/bitmaps/q116s.bmp b/bitmaps/q116s.bmp new file mode 100644 index 0000000..e526362 Binary files /dev/null and b/bitmaps/q116s.bmp differ diff --git a/bitmaps/q116w.bmp b/bitmaps/q116w.bmp new file mode 100644 index 0000000..ea987cc Binary files /dev/null and b/bitmaps/q116w.bmp differ diff --git a/bitmaps/q129o.bmp b/bitmaps/q129o.bmp new file mode 100644 index 0000000..f6393bf Binary files /dev/null and b/bitmaps/q129o.bmp differ diff --git a/bitmaps/q129s.bmp b/bitmaps/q129s.bmp new file mode 100644 index 0000000..e058bf6 Binary files /dev/null and b/bitmaps/q129s.bmp differ diff --git a/bitmaps/q129w.bmp b/bitmaps/q129w.bmp new file mode 100644 index 0000000..bbb98f5 Binary files /dev/null and b/bitmaps/q129w.bmp differ diff --git a/bitmaps/q21o.bmp b/bitmaps/q21o.bmp new file mode 100644 index 0000000..85f3359 Binary files /dev/null and b/bitmaps/q21o.bmp differ diff --git a/bitmaps/q21s.bmp b/bitmaps/q21s.bmp new file mode 100644 index 0000000..ee9ad79 Binary files /dev/null and b/bitmaps/q21s.bmp differ diff --git a/bitmaps/q21w.bmp b/bitmaps/q21w.bmp new file mode 100644 index 0000000..e3c9213 Binary files /dev/null and b/bitmaps/q21w.bmp differ diff --git a/bitmaps/q25o.bmp b/bitmaps/q25o.bmp new file mode 100644 index 0000000..caf5bee Binary files /dev/null and b/bitmaps/q25o.bmp differ diff --git a/bitmaps/q25s.bmp b/bitmaps/q25s.bmp new file mode 100644 index 0000000..b3dadda Binary files /dev/null and b/bitmaps/q25s.bmp differ diff --git a/bitmaps/q25w.bmp b/bitmaps/q25w.bmp new file mode 100644 index 0000000..565bab2 Binary files /dev/null and b/bitmaps/q25w.bmp differ diff --git a/bitmaps/q29o.bmp b/bitmaps/q29o.bmp new file mode 100644 index 0000000..bd08feb Binary files /dev/null and b/bitmaps/q29o.bmp differ diff --git a/bitmaps/q29s.bmp b/bitmaps/q29s.bmp new file mode 100644 index 0000000..f97f190 Binary files /dev/null and b/bitmaps/q29s.bmp differ diff --git a/bitmaps/q29w.bmp b/bitmaps/q29w.bmp new file mode 100644 index 0000000..929c7d4 Binary files /dev/null and b/bitmaps/q29w.bmp differ diff --git a/bitmaps/q33o.bmp b/bitmaps/q33o.bmp new file mode 100644 index 0000000..d1c7e0a Binary files /dev/null and b/bitmaps/q33o.bmp differ diff --git a/bitmaps/q33s.bmp b/bitmaps/q33s.bmp new file mode 100644 index 0000000..34798a2 Binary files /dev/null and b/bitmaps/q33s.bmp differ diff --git a/bitmaps/q33w.bmp b/bitmaps/q33w.bmp new file mode 100644 index 0000000..90a18a8 Binary files /dev/null and b/bitmaps/q33w.bmp differ diff --git a/bitmaps/q37o.bmp b/bitmaps/q37o.bmp new file mode 100644 index 0000000..972d9b5 Binary files /dev/null and b/bitmaps/q37o.bmp differ diff --git a/bitmaps/q37s.bmp b/bitmaps/q37s.bmp new file mode 100644 index 0000000..76f7282 Binary files /dev/null and b/bitmaps/q37s.bmp differ diff --git a/bitmaps/q37w.bmp b/bitmaps/q37w.bmp new file mode 100644 index 0000000..4ef25b0 Binary files /dev/null and b/bitmaps/q37w.bmp differ diff --git a/bitmaps/q40o.bmp b/bitmaps/q40o.bmp new file mode 100644 index 0000000..2777d46 Binary files /dev/null and b/bitmaps/q40o.bmp differ diff --git a/bitmaps/q40s.bmp b/bitmaps/q40s.bmp new file mode 100644 index 0000000..2952764 Binary files /dev/null and b/bitmaps/q40s.bmp differ diff --git a/bitmaps/q40w.bmp b/bitmaps/q40w.bmp new file mode 100644 index 0000000..2238f1d Binary files /dev/null and b/bitmaps/q40w.bmp differ diff --git a/bitmaps/q45o.bmp b/bitmaps/q45o.bmp new file mode 100644 index 0000000..e04239e Binary files /dev/null and b/bitmaps/q45o.bmp differ diff --git a/bitmaps/q45s.bmp b/bitmaps/q45s.bmp new file mode 100644 index 0000000..4a0b728 Binary files /dev/null and b/bitmaps/q45s.bmp differ diff --git a/bitmaps/q45w.bmp b/bitmaps/q45w.bmp new file mode 100644 index 0000000..30b954b Binary files /dev/null and b/bitmaps/q45w.bmp differ diff --git a/bitmaps/q49o.bmp b/bitmaps/q49o.bmp new file mode 100644 index 0000000..f0d9395 Binary files /dev/null and b/bitmaps/q49o.bmp differ diff --git a/bitmaps/q49s.bmp b/bitmaps/q49s.bmp new file mode 100644 index 0000000..a4baae5 Binary files /dev/null and b/bitmaps/q49s.bmp differ diff --git a/bitmaps/q49w.bmp b/bitmaps/q49w.bmp new file mode 100644 index 0000000..460f23f Binary files /dev/null and b/bitmaps/q49w.bmp differ diff --git a/bitmaps/q54o.bmp b/bitmaps/q54o.bmp new file mode 100644 index 0000000..7319504 Binary files /dev/null and b/bitmaps/q54o.bmp differ diff --git a/bitmaps/q54s.bmp b/bitmaps/q54s.bmp new file mode 100644 index 0000000..62245ff Binary files /dev/null and b/bitmaps/q54s.bmp differ diff --git a/bitmaps/q54w.bmp b/bitmaps/q54w.bmp new file mode 100644 index 0000000..8ecbfff Binary files /dev/null and b/bitmaps/q54w.bmp differ diff --git a/bitmaps/q58o.bmp b/bitmaps/q58o.bmp new file mode 100644 index 0000000..9f9ad7b Binary files /dev/null and b/bitmaps/q58o.bmp differ diff --git a/bitmaps/q58s.bmp b/bitmaps/q58s.bmp new file mode 100644 index 0000000..ff10ec8 Binary files /dev/null and b/bitmaps/q58s.bmp differ diff --git a/bitmaps/q58w.bmp b/bitmaps/q58w.bmp new file mode 100644 index 0000000..9370ff4 Binary files /dev/null and b/bitmaps/q58w.bmp differ diff --git a/bitmaps/q64o.bmp b/bitmaps/q64o.bmp new file mode 100644 index 0000000..0285e9b Binary files /dev/null and b/bitmaps/q64o.bmp differ diff --git a/bitmaps/q64s.bmp b/bitmaps/q64s.bmp new file mode 100644 index 0000000..23408ab Binary files /dev/null and b/bitmaps/q64s.bmp differ diff --git a/bitmaps/q64w.bmp b/bitmaps/q64w.bmp new file mode 100644 index 0000000..4aeba74 Binary files /dev/null and b/bitmaps/q64w.bmp differ diff --git a/bitmaps/q72o.bmp b/bitmaps/q72o.bmp new file mode 100644 index 0000000..2349650 Binary files /dev/null and b/bitmaps/q72o.bmp differ diff --git a/bitmaps/q72s.bmp b/bitmaps/q72s.bmp new file mode 100644 index 0000000..71ed548 Binary files /dev/null and b/bitmaps/q72s.bmp differ diff --git a/bitmaps/q72w.bmp b/bitmaps/q72w.bmp new file mode 100644 index 0000000..8c95eba Binary files /dev/null and b/bitmaps/q72w.bmp differ diff --git a/bitmaps/q80o.bmp b/bitmaps/q80o.bmp new file mode 100644 index 0000000..d462bae Binary files /dev/null and b/bitmaps/q80o.bmp differ diff --git a/bitmaps/q80s.bmp b/bitmaps/q80s.bmp new file mode 100644 index 0000000..456c99a Binary files /dev/null and b/bitmaps/q80s.bmp differ diff --git a/bitmaps/q80w.bmp b/bitmaps/q80w.bmp new file mode 100644 index 0000000..7004bc8 Binary files /dev/null and b/bitmaps/q80w.bmp differ diff --git a/bitmaps/q87o.bmp b/bitmaps/q87o.bmp new file mode 100644 index 0000000..4c702ac Binary files /dev/null and b/bitmaps/q87o.bmp differ diff --git a/bitmaps/q87s.bmp b/bitmaps/q87s.bmp new file mode 100644 index 0000000..a7f2e6a Binary files /dev/null and b/bitmaps/q87s.bmp differ diff --git a/bitmaps/q87w.bmp b/bitmaps/q87w.bmp new file mode 100644 index 0000000..9ee8e91 Binary files /dev/null and b/bitmaps/q87w.bmp differ diff --git a/bitmaps/q95o.bmp b/bitmaps/q95o.bmp new file mode 100644 index 0000000..9789e10 Binary files /dev/null and b/bitmaps/q95o.bmp differ diff --git a/bitmaps/q95s.bmp b/bitmaps/q95s.bmp new file mode 100644 index 0000000..69eac49 Binary files /dev/null and b/bitmaps/q95s.bmp differ diff --git a/bitmaps/q95w.bmp b/bitmaps/q95w.bmp new file mode 100644 index 0000000..bb4a847 Binary files /dev/null and b/bitmaps/q95w.bmp differ diff --git a/bitmaps/r108o.bmp b/bitmaps/r108o.bmp new file mode 100644 index 0000000..bb23012 Binary files /dev/null and b/bitmaps/r108o.bmp differ diff --git a/bitmaps/r108s.bmp b/bitmaps/r108s.bmp new file mode 100644 index 0000000..809111d Binary files /dev/null and b/bitmaps/r108s.bmp differ diff --git a/bitmaps/r108w.bmp b/bitmaps/r108w.bmp new file mode 100644 index 0000000..196f913 Binary files /dev/null and b/bitmaps/r108w.bmp differ diff --git a/bitmaps/r116o.bmp b/bitmaps/r116o.bmp new file mode 100644 index 0000000..2207e9b Binary files /dev/null and b/bitmaps/r116o.bmp differ diff --git a/bitmaps/r116s.bmp b/bitmaps/r116s.bmp new file mode 100644 index 0000000..d728062 Binary files /dev/null and b/bitmaps/r116s.bmp differ diff --git a/bitmaps/r116w.bmp b/bitmaps/r116w.bmp new file mode 100644 index 0000000..918d8d7 Binary files /dev/null and b/bitmaps/r116w.bmp differ diff --git a/bitmaps/r129o.bmp b/bitmaps/r129o.bmp new file mode 100644 index 0000000..e76cd84 Binary files /dev/null and b/bitmaps/r129o.bmp differ diff --git a/bitmaps/r129s.bmp b/bitmaps/r129s.bmp new file mode 100644 index 0000000..93b2c39 Binary files /dev/null and b/bitmaps/r129s.bmp differ diff --git a/bitmaps/r129w.bmp b/bitmaps/r129w.bmp new file mode 100644 index 0000000..cc3ad72 Binary files /dev/null and b/bitmaps/r129w.bmp differ diff --git a/bitmaps/r21o.bmp b/bitmaps/r21o.bmp new file mode 100644 index 0000000..3dd5f09 Binary files /dev/null and b/bitmaps/r21o.bmp differ diff --git a/bitmaps/r21s.bmp b/bitmaps/r21s.bmp new file mode 100644 index 0000000..3e731ea Binary files /dev/null and b/bitmaps/r21s.bmp differ diff --git a/bitmaps/r21w.bmp b/bitmaps/r21w.bmp new file mode 100644 index 0000000..6f01a85 Binary files /dev/null and b/bitmaps/r21w.bmp differ diff --git a/bitmaps/r25o.bmp b/bitmaps/r25o.bmp new file mode 100644 index 0000000..ddde075 Binary files /dev/null and b/bitmaps/r25o.bmp differ diff --git a/bitmaps/r25s.bmp b/bitmaps/r25s.bmp new file mode 100644 index 0000000..91b184e Binary files /dev/null and b/bitmaps/r25s.bmp differ diff --git a/bitmaps/r25w.bmp b/bitmaps/r25w.bmp new file mode 100644 index 0000000..cc4ee6f Binary files /dev/null and b/bitmaps/r25w.bmp differ diff --git a/bitmaps/r29o.bmp b/bitmaps/r29o.bmp new file mode 100644 index 0000000..6b725f6 Binary files /dev/null and b/bitmaps/r29o.bmp differ diff --git a/bitmaps/r29s.bmp b/bitmaps/r29s.bmp new file mode 100644 index 0000000..f8e2a12 Binary files /dev/null and b/bitmaps/r29s.bmp differ diff --git a/bitmaps/r29w.bmp b/bitmaps/r29w.bmp new file mode 100644 index 0000000..49d7640 Binary files /dev/null and b/bitmaps/r29w.bmp differ diff --git a/bitmaps/r33o.bmp b/bitmaps/r33o.bmp new file mode 100644 index 0000000..92e47c3 Binary files /dev/null and b/bitmaps/r33o.bmp differ diff --git a/bitmaps/r33s.bmp b/bitmaps/r33s.bmp new file mode 100644 index 0000000..da4d221 Binary files /dev/null and b/bitmaps/r33s.bmp differ diff --git a/bitmaps/r33w.bmp b/bitmaps/r33w.bmp new file mode 100644 index 0000000..4afebd1 Binary files /dev/null and b/bitmaps/r33w.bmp differ diff --git a/bitmaps/r37o.bmp b/bitmaps/r37o.bmp new file mode 100644 index 0000000..58139d7 Binary files /dev/null and b/bitmaps/r37o.bmp differ diff --git a/bitmaps/r37s.bmp b/bitmaps/r37s.bmp new file mode 100644 index 0000000..c461384 Binary files /dev/null and b/bitmaps/r37s.bmp differ diff --git a/bitmaps/r37w.bmp b/bitmaps/r37w.bmp new file mode 100644 index 0000000..528e2ff Binary files /dev/null and b/bitmaps/r37w.bmp differ diff --git a/bitmaps/r40o.bmp b/bitmaps/r40o.bmp new file mode 100644 index 0000000..000fc3e Binary files /dev/null and b/bitmaps/r40o.bmp differ diff --git a/bitmaps/r40s.bmp b/bitmaps/r40s.bmp new file mode 100644 index 0000000..e67094a Binary files /dev/null and b/bitmaps/r40s.bmp differ diff --git a/bitmaps/r40w.bmp b/bitmaps/r40w.bmp new file mode 100644 index 0000000..1af962c Binary files /dev/null and b/bitmaps/r40w.bmp differ diff --git a/bitmaps/r45o.bmp b/bitmaps/r45o.bmp new file mode 100644 index 0000000..3a84672 Binary files /dev/null and b/bitmaps/r45o.bmp differ diff --git a/bitmaps/r45s.bmp b/bitmaps/r45s.bmp new file mode 100644 index 0000000..2d8fe11 Binary files /dev/null and b/bitmaps/r45s.bmp differ diff --git a/bitmaps/r45w.bmp b/bitmaps/r45w.bmp new file mode 100644 index 0000000..b81d18e Binary files /dev/null and b/bitmaps/r45w.bmp differ diff --git a/bitmaps/r49o.bmp b/bitmaps/r49o.bmp new file mode 100644 index 0000000..e90e522 Binary files /dev/null and b/bitmaps/r49o.bmp differ diff --git a/bitmaps/r49s.bmp b/bitmaps/r49s.bmp new file mode 100644 index 0000000..2ad664e Binary files /dev/null and b/bitmaps/r49s.bmp differ diff --git a/bitmaps/r49w.bmp b/bitmaps/r49w.bmp new file mode 100644 index 0000000..f9aa784 Binary files /dev/null and b/bitmaps/r49w.bmp differ diff --git a/bitmaps/r54o.bmp b/bitmaps/r54o.bmp new file mode 100644 index 0000000..7d26cd7 Binary files /dev/null and b/bitmaps/r54o.bmp differ diff --git a/bitmaps/r54s.bmp b/bitmaps/r54s.bmp new file mode 100644 index 0000000..1b25f53 Binary files /dev/null and b/bitmaps/r54s.bmp differ diff --git a/bitmaps/r54w.bmp b/bitmaps/r54w.bmp new file mode 100644 index 0000000..44123f0 Binary files /dev/null and b/bitmaps/r54w.bmp differ diff --git a/bitmaps/r58o.bmp b/bitmaps/r58o.bmp new file mode 100644 index 0000000..0f8f018 Binary files /dev/null and b/bitmaps/r58o.bmp differ diff --git a/bitmaps/r58s.bmp b/bitmaps/r58s.bmp new file mode 100644 index 0000000..eaad170 Binary files /dev/null and b/bitmaps/r58s.bmp differ diff --git a/bitmaps/r58w.bmp b/bitmaps/r58w.bmp new file mode 100644 index 0000000..11f1ac7 Binary files /dev/null and b/bitmaps/r58w.bmp differ diff --git a/bitmaps/r64o.bmp b/bitmaps/r64o.bmp new file mode 100644 index 0000000..38e6ffe Binary files /dev/null and b/bitmaps/r64o.bmp differ diff --git a/bitmaps/r64s.bmp b/bitmaps/r64s.bmp new file mode 100644 index 0000000..940ebe9 Binary files /dev/null and b/bitmaps/r64s.bmp differ diff --git a/bitmaps/r64w.bmp b/bitmaps/r64w.bmp new file mode 100644 index 0000000..564c882 Binary files /dev/null and b/bitmaps/r64w.bmp differ diff --git a/bitmaps/r72o.bmp b/bitmaps/r72o.bmp new file mode 100644 index 0000000..2a53da7 Binary files /dev/null and b/bitmaps/r72o.bmp differ diff --git a/bitmaps/r72s.bmp b/bitmaps/r72s.bmp new file mode 100644 index 0000000..b438967 Binary files /dev/null and b/bitmaps/r72s.bmp differ diff --git a/bitmaps/r72w.bmp b/bitmaps/r72w.bmp new file mode 100644 index 0000000..bc615cc Binary files /dev/null and b/bitmaps/r72w.bmp differ diff --git a/bitmaps/r80o.bmp b/bitmaps/r80o.bmp new file mode 100644 index 0000000..6019342 Binary files /dev/null and b/bitmaps/r80o.bmp differ diff --git a/bitmaps/r80s.bmp b/bitmaps/r80s.bmp new file mode 100644 index 0000000..be2a5b6 Binary files /dev/null and b/bitmaps/r80s.bmp differ diff --git a/bitmaps/r80w.bmp b/bitmaps/r80w.bmp new file mode 100644 index 0000000..5964098 Binary files /dev/null and b/bitmaps/r80w.bmp differ diff --git a/bitmaps/r87o.bmp b/bitmaps/r87o.bmp new file mode 100644 index 0000000..e331f47 Binary files /dev/null and b/bitmaps/r87o.bmp differ diff --git a/bitmaps/r87s.bmp b/bitmaps/r87s.bmp new file mode 100644 index 0000000..8644fd9 Binary files /dev/null and b/bitmaps/r87s.bmp differ diff --git a/bitmaps/r87w.bmp b/bitmaps/r87w.bmp new file mode 100644 index 0000000..bafd3c4 Binary files /dev/null and b/bitmaps/r87w.bmp differ diff --git a/bitmaps/r95o.bmp b/bitmaps/r95o.bmp new file mode 100644 index 0000000..5395cf8 Binary files /dev/null and b/bitmaps/r95o.bmp differ diff --git a/bitmaps/r95s.bmp b/bitmaps/r95s.bmp new file mode 100644 index 0000000..adf44a0 Binary files /dev/null and b/bitmaps/r95s.bmp differ diff --git a/bitmaps/r95w.bmp b/bitmaps/r95w.bmp new file mode 100644 index 0000000..cfbd7c7 Binary files /dev/null and b/bitmaps/r95w.bmp differ diff --git a/bitmaps/tim.bmp b/bitmaps/tim.bmp new file mode 100644 index 0000000..0de2550 Binary files /dev/null and b/bitmaps/tim.bmp differ diff --git a/bitmaps/w49o.bmp b/bitmaps/w49o.bmp index 722b7f5..3ff1ce4 100644 Binary files a/bitmaps/w49o.bmp and b/bitmaps/w49o.bmp differ diff --git a/bitmaps/w49s.bmp b/bitmaps/w49s.bmp index 0dcd4f1..d51a73c 100644 Binary files a/bitmaps/w49s.bmp and b/bitmaps/w49s.bmp differ diff --git a/bitmaps/w54o.bmp b/bitmaps/w54o.bmp new file mode 100644 index 0000000..ee12647 Binary files /dev/null and b/bitmaps/w54o.bmp differ diff --git a/bitmaps/w54s.bmp b/bitmaps/w54s.bmp new file mode 100644 index 0000000..1984975 Binary files /dev/null and b/bitmaps/w54s.bmp differ diff --git a/bitmaps/w54w.bmp b/bitmaps/w54w.bmp new file mode 100644 index 0000000..8db2f9e Binary files /dev/null and b/bitmaps/w54w.bmp differ diff --git a/bitmaps/w72s.bmp b/bitmaps/w72s.bmp index 31d4be9..693e36c 100644 Binary files a/bitmaps/w72s.bmp and b/bitmaps/w72s.bmp differ diff --git a/bitmaps/wl49o.bmp b/bitmaps/wl49o.bmp new file mode 100644 index 0000000..b405ea9 Binary files /dev/null and b/bitmaps/wl49o.bmp differ diff --git a/bitmaps/wl49s.bmp b/bitmaps/wl49s.bmp new file mode 100644 index 0000000..d1a737a Binary files /dev/null and b/bitmaps/wl49s.bmp differ diff --git a/bitmaps/wl72o.bmp b/bitmaps/wl72o.bmp new file mode 100644 index 0000000..e45f0ac Binary files /dev/null and b/bitmaps/wl72o.bmp differ diff --git a/bitmaps/wl72s.bmp b/bitmaps/wl72s.bmp new file mode 100644 index 0000000..a64f466 Binary files /dev/null and b/bitmaps/wl72s.bmp differ diff --git a/bitmaps/wn49o.bmp b/bitmaps/wn49o.bmp new file mode 100644 index 0000000..e89eb7a Binary files /dev/null and b/bitmaps/wn49o.bmp differ diff --git a/bitmaps/wn49s.bmp b/bitmaps/wn49s.bmp new file mode 100644 index 0000000..0ab191a Binary files /dev/null and b/bitmaps/wn49s.bmp differ diff --git a/bitmaps/wn72o.bmp b/bitmaps/wn72o.bmp new file mode 100644 index 0000000..24f2a33 Binary files /dev/null and b/bitmaps/wn72o.bmp differ diff --git a/bitmaps/wn72s.bmp b/bitmaps/wn72s.bmp new file mode 100644 index 0000000..7a91eff Binary files /dev/null and b/bitmaps/wn72s.bmp differ diff --git a/bitmaps/wp49o.bmp b/bitmaps/wp49o.bmp new file mode 100644 index 0000000..f6e90fa Binary files /dev/null and b/bitmaps/wp49o.bmp differ diff --git a/bitmaps/wp49s.bmp b/bitmaps/wp49s.bmp new file mode 100644 index 0000000..88f96aa Binary files /dev/null and b/bitmaps/wp49s.bmp differ diff --git a/bitmaps/wp72o.bmp b/bitmaps/wp72o.bmp new file mode 100644 index 0000000..7c359be Binary files /dev/null and b/bitmaps/wp72o.bmp differ diff --git a/bitmaps/wp72s.bmp b/bitmaps/wp72s.bmp new file mode 100644 index 0000000..933f377 Binary files /dev/null and b/bitmaps/wp72s.bmp differ diff --git a/bitmaps/ws49o.bmp b/bitmaps/ws49o.bmp new file mode 100644 index 0000000..fe77467 Binary files /dev/null and b/bitmaps/ws49o.bmp differ diff --git a/bitmaps/ws49s.bmp b/bitmaps/ws49s.bmp new file mode 100644 index 0000000..5d2ad69 Binary files /dev/null and b/bitmaps/ws49s.bmp differ diff --git a/bitmaps/ws72o.bmp b/bitmaps/ws72o.bmp new file mode 100644 index 0000000..316da61 Binary files /dev/null and b/bitmaps/ws72o.bmp differ diff --git a/bitmaps/ws72s.bmp b/bitmaps/ws72s.bmp new file mode 100644 index 0000000..382b4dc Binary files /dev/null and b/bitmaps/ws72s.bmp differ diff --git a/common.h b/common.h index be6d4e8..9d3fd41 100644 --- a/common.h +++ b/common.h @@ -185,29 +185,26 @@ typedef enum { } GameMode; typedef enum { - WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, -#ifdef FAIRY /* [HGM] the order here is crucial for Crazyhouse & Shogi: */ /* only the first N pieces can go into the holdings, and */ - /* promotions in those variants shift P-W to E-M */ - WhiteFerz, WhiteWazir, WhiteAlfil, WhiteNightrider, WhiteCardinal, - WhiteMarshall, WhiteGrasshopper, WhiteCannon, WhiteMan, WhiteUnicorn, -#endif - WhiteKing, BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, -#ifdef FAIRY - BlackFerz, BlackWazir, BlackAlfil, BlackNightrider, BlackCardinal, - BlackMarshall, BlackGrasshopper, BlackCannon, BlackMan, BlackUnicorn, -#endif - BlackKing, + /* promotions in those variants shift P-W to U-S */ + WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, + WhiteFerz, WhiteWazir, WhiteAlfil, WhiteMan, WhiteCannon, WhiteUnicorn, + WhiteNightrider, WhiteCardinal, WhiteMarshall, WhiteGrasshopper, + WhiteSilver, WhiteKing, + BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, + BlackFerz, BlackWazir, BlackAlfil, BlackMan, BlackCannon, BlackUnicorn, + BlackNightrider, BlackCardinal, BlackMarshall, BlackGrasshopper, + BlackSilver, BlackKing, EmptySquare, - ClearBoard, WhitePlay, BlackPlay /*for use on EditPosition menus*/ + ClearBoard, WhitePlay, BlackPlay, PromotePiece, DemotePiece /*for use on EditPosition menus*/ } ChessSquare; /* [HGM] some macros that can be used as prefixes to convert piece types */ #define WHITE_TO_BLACK (int)BlackPawn - (int)WhitePawn + (int) #define BLACK_TO_WHITE (int)WhitePawn - (int)BlackPawn + (int) -#define PROMOTED (int)WhiteAlfil - (int)WhitePawn + (int) -#define DEMOTED (int)WhitePawn - (int)WhiteAlfil + (int) +#define PROMOTED (int)WhiteUnicorn - (int)WhitePawn + (int) +#define DEMOTED (int)WhitePawn - (int)WhiteUnicorn + (int) #define SHOGI (int)EmptySquare + (int) @@ -222,14 +219,10 @@ typedef enum { BlackHSideCastleFR, BlackASideCastleFR, WhitePromotionKnight, WhitePromotionBishop, WhitePromotionRook, WhitePromotionQueen, WhitePromotionKing, -#ifdef FAIRY WhitePromotionChancellor, WhitePromotionArchbishop, -#endif BlackPromotionKnight, BlackPromotionBishop, BlackPromotionRook, BlackPromotionQueen, BlackPromotionKing, -#ifdef FAIRY BlackPromotionChancellor, BlackPromotionArchbishop, -#endif WhiteCapturesEnPassant, BlackCapturesEnPassant, WhiteDrop, BlackDrop, NormalMove, AmbiguousMove, IllegalMove, ImpossibleMove, @@ -521,6 +514,9 @@ typedef struct { int NrRanks; int holdingsSize; int matchPause; + char * pieceToCharTable; + Boolean allWhite; + Boolean upsideDown; Boolean alphaRank; Boolean testClaims; Boolean checkMates; @@ -528,7 +524,6 @@ typedef struct { Boolean trivialDraws; int ruleMoves; int drawRepeats; - char * pieceToCharTable; #if ZIPPY char *zippyLines; @@ -599,6 +594,3 @@ typedef struct { #endif -/* extern int holdingsWidth; -extern int holdingsHeight; -/*extern int holdings[(int) EmptySquare];*/ diff --git a/config.h b/config.h index ec3ac90..7f3a083 100644 --- a/config.h +++ b/config.h @@ -47,7 +47,7 @@ #define LAST_PTY_LETTER 'q' -#define PATCHLEVEL "4" +#define PATCHLEVEL "7" #define PRODUCT "WinBoard" diff --git a/moves.c b/moves.c index 2070ef3..9aff915 100644 --- a/moves.c +++ b/moves.c @@ -196,23 +196,30 @@ ChessMove PromoCharToMoveType(whiteOnMove, promoChar) } char pieceToChar[] = { - 'P', 'N', 'B', 'R', 'Q', -#ifdef FAIRY - 'F', 'W', 'E', 'H', 'A', 'C', 'G', 'O', 'M', 'U', -#endif - 'K', 'p', 'n', 'b', 'r', 'q', -#ifdef FAIRY - 'f', 'w', 'e', 'h', 'a', 'c', 'g', 'o', 'm', 'u', -#endif + 'P', 'N', 'B', 'R', 'Q', 'F', + 'W', 'E', 'M', 'O', 'U', 'H', 'A', 'C', 'G', 'S', + 'K', 'p', 'n', 'b', 'r', 'q', 'f', + 'w', 'e', 'm', 'o', 'u', 'h', 'a', 'c', 'g', 's', 'k', 'x' }; char PieceToChar(p) ChessSquare p; { + if((int)p < 0 || (int)p >= (int)EmptySquare) return('x'); /* [HGM] for safety */ return pieceToChar[(int) p]; } +int PieceToNumber(p) + ChessSquare p; +{ + int i=0; + ChessSquare start = (int)p >= (int)BlackPawn ? BlackPawn : WhitePawn; + + while(start++ != p) if(pieceToChar[(int)start-1] != '.') i++; + return i; +} + ChessSquare CharToPiece(c) int c; { @@ -220,48 +227,6 @@ ChessSquare CharToPiece(c) for(i=0; i< (int) EmptySquare; i++) if(pieceToChar[i] == c) return (ChessSquare) i; return EmptySquare; -/* [HGM] code marked for deletion - switch (c) { - default: - case 'x': return EmptySquare; - case 'P': return WhitePawn; - case 'R': return WhiteRook; - case 'N': return WhiteKnight; - case 'B': return WhiteBishop; - case 'Q': return WhiteQueen; - case 'K': return WhiteKing; - case 'p': return BlackPawn; - case 'r': return BlackRook; - case 'n': return BlackKnight; - case 'b': return BlackBishop; - case 'q': return BlackQueen; - case 'k': return BlackKing; -#ifdef FAIRY - case 'A': return WhiteCardinal; - case 'C': return WhiteMarshall; - case 'F': return WhiteFerz; - case 'H': return WhiteNightrider; - case 'E': return WhiteAlfil; - case 'W': return WhiteWazir; - case 'U': return WhiteUnicorn; - case 'O': return WhiteCannon; - case 'G': return WhiteGrasshopper; - case 'M': return WhiteMan; - - case 'a': return BlackCardinal; - case 'c': return BlackMarshall; - case 'f': return BlackFerz; - case 'h': return BlackNightrider; - case 'e': return BlackAlfil; - case 'w': return BlackWazir; - case 'u': return BlackUnicorn; - case 'o': return BlackCannon; - case 'g': return BlackGrasshopper; - case 'm': return BlackMan; - -#endif - } -*/ } void CopyBoard(to, from) @@ -330,7 +295,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) break; case WhitePawn: -#ifdef FAIRY if(gameInfo.variant == VariantXiangqi) { /* [HGM] capture and move straight ahead in Xiangqi */ if (rf < BOARD_HEIGHT-1 && @@ -349,7 +313,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) } break; } -#endif if (rf < BOARD_HEIGHT-1 && board[rf + 1][ff] == EmptySquare) { callback(board, flags, rf == BOARD_HEIGHT-2 ? WhitePromotionQueen : NormalMove, @@ -383,7 +346,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) break; case BlackPawn: -#ifdef FAIRY if(gameInfo.variant == VariantXiangqi) { /* [HGM] capture straight ahead in Xiangqi */ if (rf > 0 && !SameColor(board[rf][ff], board[rf - 1][ff]) ) { @@ -401,7 +363,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) } break; } -#endif if (rf > 0 && board[rf - 1][ff] == EmptySquare) { callback(board, flags, rf == 1 ? BlackPromotionQueen : NormalMove, @@ -434,10 +395,8 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) } break; -#ifdef FAIRY case WhiteUnicorn: case BlackUnicorn: -#endif case WhiteKnight: case BlackKnight: mounted: @@ -454,13 +413,11 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) } break; -#ifdef FAIRY case SHOGI WhiteKnight: for (s = -1; s <= 1; s += 2) { if (rf < BOARD_HEIGHT-2 && ff + s >= BOARD_LEFT && ff + s < BOARD_RGHT && !SameColor(board[rf][ff], board[rf + 2][ff + s])) { - callback(board, flags, - rf == BOARD_HEIGHT-2 ? WhitePromotionQueen : NormalMove, + callback(board, flags, NormalMove, rf, ff, rf + 2, ff + s, closure); } } @@ -470,8 +427,7 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) for (s = -1; s <= 1; s += 2) { if (rf > 1 && ff + s >= BOARD_LEFT && ff + s < BOARD_RGHT && !SameColor(board[rf][ff], board[rf - 2][ff + s])) { - callback(board, flags, - rf == 1 ? BlackPromotionQueen : NormalMove, + callback(board, flags, NormalMove, rf, ff, rf - 2, ff + s, closure); } } @@ -508,8 +464,7 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) for (s = -1; s <= 1; s += 2) { if (rf < BOARD_HEIGHT-1 && ff + s >= BOARD_LEFT && ff + s < BOARD_RGHT && !SameColor(board[rf][ff], board[rf + 1][ff + s])) { - callback(board, flags, - rf == BOARD_HEIGHT-2 ? WhitePromotionQueen : NormalMove, + callback(board, flags, NormalMove, rf, ff, rf + 1, ff + s, closure); } } @@ -523,8 +478,7 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) for (s = -1; s <= 1; s += 2) { if (rf > 0 && ff + s >= BOARD_LEFT && ff + s < BOARD_RGHT && !SameColor(board[rf][ff], board[rf - 1][ff + s])) { - callback(board, flags, - rf == 1 ? BlackPromotionQueen : NormalMove, + callback(board, flags, NormalMove, rf, ff, rf - 1, ff + s, closure); } } @@ -574,7 +528,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) /* Shogi Bishops are ordinary Bishops */ case SHOGI WhiteBishop: case SHOGI BlackBishop: -#endif case WhiteBishop: case BlackBishop: for (rs = -1; rs <= 1; rs += 2) @@ -593,7 +546,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) /* Bishop falls through */ break; -#ifdef FAIRY /* Shogi Lance is unlike anything, and asymmetric at that */ case SHOGI WhiteQueen: for(i = 1;; i++) { @@ -632,7 +584,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) /* Shogi Rooks are ordinary Rooks */ case SHOGI WhiteRook: case SHOGI BlackRook: -#endif case WhiteRook: case BlackRook: for (d = 0; d <= 1; d++) @@ -667,7 +618,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) } break; -#ifdef FAIRY /* Shogi Pawn and Silver General: first the Pawn move, */ /* then the General continues like a Ferz */ case SHOGI WhitePawn: @@ -707,7 +657,6 @@ void GenPseudoLegal(board, flags, epfile, callback, closure) case BlackMan: case SHOGI WhiteKing: case SHOGI BlackKing: -#endif case WhiteKing: case BlackKing: walking: @@ -817,7 +766,7 @@ int GenLegal(board, flags, epfile, castlingRights, callback, closure) !CheckTest(board, flags, 0, ff, 0, ff + 2, FALSE)))) { callback(board, flags, - ff==4 ? WhiteKingSideCastle : WhiteKingSideCastleWild, + ff==BOARD_WIDTH>>1 ? WhiteKingSideCastle : WhiteKingSideCastleWild, 0, ff, 0, ff + ((gameInfo.boardWidth+2)>>2), closure); } if ((flags & F_WHITE_ON_MOVE) && @@ -1039,6 +988,41 @@ ChessMove LegalityTest(board, flags, epfile, castlingRights, rf, ff, rt, ft, pro cl.ft = ft; cl.kind = IllegalMove; GenLegal(board, flags, epfile, castlingRights, LegalityTestCallback, (VOIDSTAR) &cl); + + if(gameInfo.variant == VariantShogi) { + /* [HGM] Shogi promotions. '=' means defer */ + if(rf != DROP_RANK && cl.kind == NormalMove) { + ChessSquare piece = board[rf][ff]; + + if(promoChar == PieceToChar(BlackQueen)) promoChar = NULLCHAR; /* [HGM] Kludge */ + if(promoChar != NULLCHAR && promoChar != 'x' && + promoChar != '+' && promoChar != '=' && + ToUpper(PieceToChar(PROMOTED piece)) != ToUpper(promoChar) ) + cl.kind = IllegalMove; + else if(flags & F_WHITE_ON_MOVE) { + if( (int) piece < (int) WhiteWazir && + (rf > BOARD_HEIGHT-4 || rt > BOARD_HEIGHT-4) ) { + if( (piece == WhitePawn || piece == WhiteQueen) && rt > BOARD_HEIGHT-2 || + piece == WhiteKnight && rt > BOARD_HEIGHT-3) /* promotion mandatory */ + cl.kind = promoChar == '=' ? IllegalMove : WhitePromotionKnight; + else /* promotion optional, default is promote */ + cl.kind = promoChar == '=' ? NormalMove : WhitePromotionQueen; + + } else cl.kind = (promoChar == NULLCHAR || promoChar == 'x' || promoChar == '=') ? + NormalMove : IllegalMove; + } else { + if( (int) piece < (int) BlackWazir && (rf < 3 || rt < 3) ) { + if( (piece == BlackPawn || piece == BlackQueen) && rt < 1 || + piece == BlackKnight && rt < 2 ) /* promotion obligatory */ + cl.kind = promoChar == '=' ? IllegalMove : BlackPromotionKnight; + else /* promotion optional, default is promote */ + cl.kind = promoChar == '=' ? NormalMove : BlackPromotionQueen; + + } else cl.kind = (promoChar == NULLCHAR || promoChar == 'x' || promoChar == '=') ? + NormalMove : IllegalMove; + } + } + } else if (promoChar != NULLCHAR && promoChar != 'x') { if (cl.kind == WhitePromotionQueen || cl.kind == BlackPromotionQueen) { cl.kind = @@ -1047,6 +1031,7 @@ ChessMove LegalityTest(board, flags, epfile, castlingRights, rf, ff, rt, ft, pro cl.kind = IllegalMove; } } + /* [HGM] For promotions, 'ToQueen' = optional, 'ToKnight' = mandatory */ return cl.kind; } @@ -1110,7 +1095,7 @@ void DisambiguateCallback(board, flags, kind, rf, ff, rt, ft, closure) (cl->ftIn == -1 || cl->ftIn == ft)) { cl->count++; - cl->piece = board[rf][ff]; + cl->piece = board[rf][ff]; cl->rf = rf; cl->ff = ff; cl->rt = rt; @@ -1124,7 +1109,7 @@ void Disambiguate(board, flags, epfile, closure) int flags, epfile; DisambiguateClosure *closure; { - int illegal = 0; + int illegal = 0; char c = closure->promoCharIn; closure->count = 0; closure->rf = closure->ff = closure->rt = closure->ft = 0; closure->kind = ImpossibleMove; @@ -1139,6 +1124,51 @@ void Disambiguate(board, flags, epfile, closure) return; } } + + if (appData.debugMode) { + fprintf(debugFP, "Disambiguate in: %d(%d,%d)-(%d,%d) = %d (%c)\n", + closure->pieceIn,closure->ffIn,closure->rfIn,closure->ftIn,closure->rtIn,closure->promoCharIn,closure->promoCharIn); + } + if(gameInfo.variant == VariantShogi) { + /* [HGM] Shogi promotions. '=' means defer */ + if(closure->rfIn != DROP_RANK && closure->kind == NormalMove) { + ChessSquare piece = closure->piece; + + if (appData.debugMode) { + fprintf(debugFP, "Disambiguate A: %d(%d,%d)-(%d,%d) = %d (%c)\n", + closure->pieceIn,closure->ffIn,closure->rfIn,closure->ftIn,closure->rtIn,closure->promoCharIn,closure->promoCharIn); + } + if(c != NULLCHAR && c != 'x' && c != '+' && c != '=' && + ToUpper(PieceToChar(PROMOTED piece)) != ToUpper(c) ) + closure->kind = IllegalMove; + else if(flags & F_WHITE_ON_MOVE) { + if (appData.debugMode) { + fprintf(debugFP, "Disambiguate B: %d(%d,%d)-(%d,%d) = %d (%c)\n", + closure->pieceIn,closure->ffIn,closure->rfIn,closure->ftIn,closure->rtIn,closure->promoCharIn,closure->promoCharIn); + } + if( (int) piece < (int) WhiteWazir && + (closure->rf > BOARD_HEIGHT-4 || closure->rt > BOARD_HEIGHT-4) ) { + if( (piece == WhitePawn || piece == WhiteQueen) && closure->rt > BOARD_HEIGHT-2 || + piece == WhiteKnight && closure->rt > BOARD_HEIGHT-3) /* promotion mandatory */ + closure->kind = c == '=' ? IllegalMove : WhitePromotionKnight; + else /* promotion optional, default is promote */ + closure->kind = c == '=' ? NormalMove : WhitePromotionQueen; + + } else closure->kind = (c == NULLCHAR || c == 'x' || c == '=') ? + NormalMove : IllegalMove; + } else { + if( (int) piece < (int) BlackWazir && (closure->rf < 3 || closure->rt < 3) ) { + if( (piece == BlackPawn || piece == BlackQueen) && closure->rt < 1 || + piece == BlackKnight && closure->rt < 2 ) /* promotion obligatory */ + closure->kind = c == '=' ? IllegalMove : BlackPromotionKnight; + else /* promotion optional, default is promote */ + closure->kind = c == '=' ? NormalMove : BlackPromotionQueen; + + } else closure->kind = (c == NULLCHAR || c == 'x' || c == '=') ? + NormalMove : IllegalMove; + } + } + } else if (closure->promoCharIn != NULLCHAR && closure->promoCharIn != 'x') { if (closure->kind == WhitePromotionQueen || closure->kind == BlackPromotionQueen) { @@ -1149,7 +1179,14 @@ void Disambiguate(board, flags, epfile, closure) closure->kind = IllegalMove; } } - closure->promoChar = ToLower(PieceToChar(PromoPiece(closure->kind))); + if (appData.debugMode) { + fprintf(debugFP, "Disambiguate C: %d(%d,%d)-(%d,%d) = %d (%c)\n", + closure->pieceIn,closure->ffIn,closure->rfIn,closure->ftIn,closure->rtIn,closure->promoCharIn,closure->promoCharIn); + } + /* [HGM] returns 'q' for optional promotion, 'n' for mandatory */ + if(closure->promoCharIn != '=') + closure->promoChar = ToLower(PieceToChar(PromoPiece(closure->kind))); + else closure->promoChar = '='; if (closure->promoChar == 'x') closure->promoChar = NULLCHAR; if (closure->count > 1) { closure->kind = AmbiguousMove; @@ -1161,6 +1198,13 @@ void Disambiguate(board, flags, epfile, closure) */ closure->kind = IllegalMove; } + if(closure->kind == IllegalMove) + /* [HGM] might be a variant we don't understand, pass on promotion info */ + closure->promoChar = closure->promoCharIn; + if (appData.debugMode) { + fprintf(debugFP, "Disambiguate out: %d(%d,%d)-(%d,%d) = %d (%c)\n", + closure->piece,closure->ff,closure->rf,closure->ft,closure->rt,closure->promoChar,closure->promoChar); + } } @@ -1238,9 +1282,14 @@ ChessMove CoordsToAlgebraic(board, flags, epfile, if (promoChar == 'x') promoChar = NULLCHAR; piece = board[rf][ff]; + + if (appData.debugMode) + fprintf(debugFP, "CoordsToAlgebraic, piece=%d\n", (int)piece); switch (piece) { case WhitePawn: case BlackPawn: + if (appData.debugMode) + fprintf(debugFP, "CoordsToAlgebraic, Pawn\n"); kind = LegalityTest(board, flags, epfile, initialRights, rf, ff, rt, ft, promoChar); if (kind == IllegalMove && !(flags&F_IGNORE_CHECK)) { /* Keep short notation if move is illegal only because it @@ -1267,11 +1316,17 @@ ChessMove CoordsToAlgebraic(board, flags, epfile, else { *outp++ = (rt+ONE-'0')/10 + '0';*outp++ = (rt+ONE-'0')%10 + '0'; } } /* Use promotion suffix style "=Q" */ - if (promoChar != NULLCHAR && promoChar != 'x') { - *outp++ = '='; - *outp++ = ToUpper(promoChar); - } *outp = NULLCHAR; + if (promoChar != NULLCHAR) { + if(gameInfo.variant == VariantShogi) { + /* [HGM] ... but not in Shogi! */ + *outp++ = promoChar == '=' ? '=' : '+'; + } else { + *outp++ = '='; + *outp++ = ToUpper(promoChar); + } + *outp = NULLCHAR; + } AlphaRank(out, 10); return kind; @@ -1338,8 +1393,13 @@ ChessMove CoordsToAlgebraic(board, flags, epfile, else "N1f3" or "N5xf7", else "Ng1f3" or "Ng5xf7". */ - *outp++ = ToUpper(PieceToChar(piece)); - + if(PieceToChar(piece) == '.') { + /* [HGM] print nonexistent piece as its demoted version */ + piece = (ChessSquare) (DEMOTED piece); + if( gameInfo.variant == VariantShogi ) + *outp++ = '+'; + } + *outp++ = ToUpper(PieceToChar(piece)); if (cl.file || (cl.either && !cl.rank)) { *outp++ = ff + AAA; } @@ -1357,16 +1417,51 @@ ChessMove CoordsToAlgebraic(board, flags, epfile, *outp++ = rt + ONE; else { *outp++ = (rt+ONE-'0')/10 + '0';*outp++ = (rt+ONE-'0')%10 + '0'; } *outp = NULLCHAR; + if (gameInfo.variant == VariantShogi) { + /* [HGM] in Shogi non-pawns can promote */ + if(flags & F_WHITE_ON_MOVE) { + if( (int) cl.piece < (int) WhiteWazir && + (rf > BOARD_HEIGHT-4 || rt > BOARD_HEIGHT-4) ) { + if( (piece == WhitePawn || piece == WhiteQueen) && rt > BOARD_HEIGHT-2 || + piece == WhiteKnight && rt > BOARD_HEIGHT-3) /* promotion mandatory */ + cl.kind = promoChar == '=' ? IllegalMove : WhitePromotionKnight; + else cl.kind = WhitePromotionQueen; /* promotion optional */ + + } else cl.kind = (promoChar == NULLCHAR || promoChar == 'x' || promoChar == '=') ? + NormalMove : IllegalMove; + } else { + if( (int) cl.piece < (int) BlackWazir && (rf < 3 || rt < 3) ) { + if( (piece == BlackPawn || piece == BlackQueen) && rt < 1 || + piece == BlackKnight && rt < 2 ) /* promotion obligatory */ + cl.kind = promoChar == '=' ? IllegalMove : BlackPromotionKnight; + else cl.kind = BlackPromotionQueen; /* promotion optional */ + } else cl.kind = (promoChar == NULLCHAR || promoChar == 'x' || promoChar == '=') ? + NormalMove : IllegalMove; + } + if(cl.kind == WhitePromotionQueen || cl.kind == BlackPromotionQueen) { + /* for optional promotions append '+' or '=' */ + if(promoChar == '=') { + *outp++ = '='; + cl.kind = NormalMove; + } else *outp++ = '+'; + *outp = NULLCHAR; + } else if(cl.kind == IllegalMove) { + /* Illegal move specifies any given promotion */ + if(promoChar != NULLCHAR && promoChar != 'x') { + *outp++ = '='; + *outp++ = ToUpper(promoChar); + *outp = NULLCHAR; + } + } + } AlphaRank(out, 10); return cl.kind; -#ifdef FAIRY - /* [HGM] Always long notation for fairies, don't know how they move */ + /* [HGM] Always long notation for fairies we don't know */ case WhiteNightrider: case BlackNightrider: case WhiteGrasshopper: case BlackGrasshopper: -#endif case EmptySquare: /* Moving a nonexistent piece */ break; diff --git a/moves.h b/moves.h index 8324ef6..cc70260 100644 --- a/moves.h +++ b/moves.h @@ -50,6 +50,7 @@ extern ChessSquare PromoPiece P((ChessMove moveType)); extern ChessMove PromoCharToMoveType P((int whiteOnMove, int promoChar)); extern char PieceToChar P((ChessSquare p)); extern ChessSquare CharToPiece P((int c)); +extern int PieceToNumber P((ChessSquare p)); extern void CopyBoard P((Board to, Board from)); extern int CompareBoards P((Board board1, Board board2)); diff --git a/parser.l b/parser.l index 03e0adc..da4cbc7 100644 --- a/parser.l +++ b/parser.l @@ -1,4091 +1,1058 @@ -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include -#include - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#ifndef _WIN32 -#include -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - - -#define YY_USES_REJECT -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 42 -#define YY_END_OF_BUFFER 43 -static yyconst short int yy_acclist[709] = - { 0, - 43, 41, 42, 41, 42, 41, 42, 40, 41, 42, - 41, 42, 25, 41, 42, 41, 42, 40, 41, 42, - 40, 41, 42,16410, 40, 41, 42,16410, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 41, 42, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42,16410, - 40, 41, 42,16410, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 40, 41, 42, 40, 41, 42, 40, 41, 42, 40, - - 41, 42, 40, 41, 42, 40, 41, 42, 40, 41, - 42, 40, 41, 42, 40, 41, 42, 40, 41, 42, - 41, 42, 33, 40, 17, 40, 9, 40, 40, 40, - 16410, 8218, 40, 35, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 9, 40, 40, 40, 40, - 40, 40, 40, 36, 40, 3, 40, 40, 4, 40, - 40, 40, 3, 40, 40, 4, 40, 40, 40, 40, - 40, 40, 9, 40, 40, 34, 40, 40, 9, 40, - 40, 40,16410, 8218, 40, 40, 40, 40, 40, 40, - 40, 40, 40, 40, 40, 40, 9, 40, 40, 40, - - 40, 40, 40, 40, 40, 3, 40, 40, 4, 40, - 40, 40, 3, 40, 40, 4, 40, 40, 40, 40, - 40, 40, 9, 40, 40, 15, 9, 40, 23, 40, - 23, 8, 40, 8218, 22, 40, 22, 24, 40, 40, - 40, 6, 40, 40, 40, 40, 40, 40, 40, 9, - 40, 40, 40, 40, 40, 20, 40, 4, 40, 40, - 3, 40, 3, 40, 40, 4, 5, 40, 4, 40, - 40, 4, 40, 40, 3, 40, 40, 4, 4, 40, - 5, 6, 40, 4, 40, 40, 40, 9, 40, 40, - 34, 39, 9, 40, 23, 40, 8, 40, 22, 40, - - 35, 40, 40, 40, 6, 40, 40, 40, 40, 40, - 40, 40, 9, 40, 40, 40, 40, 40, 20, 40, - 4, 40, 40, 3, 40, 3, 40, 40, 5, 40, - 4, 40, 40, 4, 40, 40, 3, 40, 40, 4, - 40, 5, 6, 40, 4, 40, 40, 40, 9, 40, - 40, 38, 38, 37, 25, 25, 40, 6, 40, 7, - 40, 6, 10, 40, 40, 40, 40, 19, 40, 40, - 21, 40, 16, 40, 40, 40, 40, 40, 20, 20, - 40, 20, 40, 36, 3, 3, 2, 40, 5, 4, - 5, 40, 40, 4, 4, 40, 2, 7, 40, 5, - - 6, 5, 6, 40, 5, 40, 40, 40, 25, 39, - 40, 6, 40, 7, 40, 40, 40, 40, 40, 19, - 40, 40, 21, 40, 16, 40, 40, 40, 40, 40, - 20, 40, 20, 20, 40, 2, 40, 5, 40, 40, - 4, 40, 2, 7, 40, 5, 6, 40, 5, 40, - 40, 40, 7, 1, 40, 40, 40, 19, 40, 40, - 40, 21, 21, 40, 21, 40, 40, 40, 40, 30, - 36, 2, 2, 40, 5, 4, 5, 5, 40, 2, - 7, 39, 1, 40, 40, 40, 19, 40, 40, 40, - 21, 40, 21, 21, 40, 40, 40, 40, 20, 39, - - 2, 40, 5, 40, 27, 38, 23, 23, 22, 22, - 24, 24, 1, 1, 40, 20, 21, 40, 40, 40, - 11, 40, 40, 28, 36, 30, 2, 2, 5, 27, - 34, 39, 39, 1, 40, 40, 40, 40, 21, 39, - 11, 40, 40, 20, 39, 18, 24, 1, 1, 20, - 21, 19, 40, 40, 40, 11, 40, 40, 40, 40, - 21, 39, 40, 11, 40, 40, 12, 40, 40, 40, - 40, 12, 40, 40, 14, 40, 40, 40, 14, 40, - 40, 40, 39, 40, 40, 40, 40, 39, 39, 40, - 40, 31, 40, 39, 39, 31, 40, 13, 31, 32, - - 32, 35, 39, 39, 31, 39, 34, 29 - } ; - -static yyconst short int yy_accept[736] = - { 0, - 1, 1, 1, 2, 4, 6, 8, 11, 13, 16, - 18, 21, 25, 29, 31, 34, 37, 40, 43, 46, - 49, 52, 55, 58, 61, 64, 67, 70, 72, 75, - 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, - 108, 111, 114, 117, 119, 121, 124, 127, 131, 135, - 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, - 167, 170, 173, 176, 179, 182, 185, 188, 191, 194, - 197, 200, 203, 206, 209, 212, 215, 218, 221, 223, - 223, 224, 225, 225, 225, 225, 225, 226, 226, 226, - 227, 227, 229, 229, 229, 229, 230, 230, 230, 232, - - 232, 234, 234, 235, 236, 236, 237, 237, 237, 238, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 248, - 249, 250, 251, 252, 253, 254, 254, 254, 254, 254, - 255, 256, 258, 258, 259, 261, 262, 263, 265, 265, - 266, 268, 269, 270, 271, 272, 273, 275, 276, 276, - 276, 276, 277, 277, 278, 278, 279, 281, 281, 282, - 284, 284, 286, 286, 287, 288, 288, 289, 290, 291, - 292, 293, 294, 295, 296, 297, 299, 300, 301, 302, - 303, 304, 305, 306, 308, 308, 309, 311, 312, 313, - 315, 315, 316, 318, 319, 320, 321, 322, 323, 325, - - 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, - 326, 326, 327, 327, 327, 327, 329, 331, 332, 334, - 335, 335, 335, 335, 337, 338, 339, 340, 340, 341, - 341, 342, 342, 342, 344, 344, 344, 344, 344, 345, - 346, 347, 348, 349, 350, 352, 353, 354, 355, 356, - 358, 358, 358, 358, 358, 360, 360, 361, 361, 361, - 363, 365, 366, 367, 367, 369, 369, 371, 372, 374, - 375, 375, 377, 378, 379, 381, 384, 386, 387, 388, - 390, 391, 392, 392, 392, 392, 392, 393, 395, 397, - 399, 401, 401, 402, 402, 403, 404, 404, 405, 407, - - 408, 409, 410, 411, 412, 413, 415, 416, 417, 418, - 419, 421, 423, 424, 424, 426, 428, 429, 431, 433, - 434, 436, 437, 437, 439, 440, 442, 445, 447, 448, - 449, 451, 452, 452, 452, 453, 454, 454, 454, 455, - 455, 455, 456, 456, 457, 457, 457, 457, 458, 458, - 458, 458, 458, 458, 458, 458, 460, 460, 460, 462, - 463, 464, 465, 465, 466, 466, 466, 466, 466, 467, - 468, 470, 470, 471, 473, 475, 476, 477, 478, 479, - 480, 482, 484, 484, 484, 484, 484, 485, 486, 486, - 487, 489, 490, 491, 491, 491, 491, 493, 494, 495, - - 495, 497, 497, 500, 502, 505, 507, 508, 509, 509, - 510, 510, 510, 510, 510, 511, 511, 512, 512, 512, - 514, 516, 517, 517, 518, 519, 520, 522, 523, 525, - 527, 528, 529, 530, 531, 533, 534, 536, 538, 540, - 541, 543, 546, 549, 551, 552, 553, 553, 553, 553, - 553, 553, 553, 553, 553, 553, 553, 553, 553, 553, - 554, 556, 556, 556, 556, 556, 557, 558, 558, 560, - 560, 561, 562, 563, 565, 567, 568, 569, 570, 570, - 570, 572, 572, 572, 573, 573, 573, 575, 576, 576, - 577, 578, 578, 580, 580, 582, 582, 582, 582, 582, - - 582, 582, 583, 583, 583, 585, 586, 587, 589, 590, - 591, 593, 594, 596, 597, 598, 599, 601, 603, 605, - 605, 605, 607, 607, 607, 608, 608, 609, 609, 610, - 610, 611, 611, 612, 612, 613, 613, 613, 614, 614, - 614, 616, 616, 616, 618, 618, 619, 619, 619, 619, - 619, 619, 620, 621, 623, 624, 626, 626, 627, 628, - 629, 630, 630, 630, 632, 632, 632, 633, 634, 634, - 634, 636, 637, 638, 639, 641, 643, 644, 646, 646, - 647, 647, 647, 647, 648, 649, 650, 650, 650, 650, - 652, 652, 652, 653, 653, 653, 653, 653, 654, 655, - - 656, 658, 659, 659, 659, 659, 659, 659, 660, 661, - 663, 664, 666, 667, 667, 667, 667, 667, 667, 667, - 668, 668, 668, 668, 668, 669, 670, 670, 670, 670, - 670, 671, 672, 672, 672, 672, 672, 673, 673, 673, - 673, 674, 675, 677, 677, 677, 677, 677, 678, 678, - 679, 681, 681, 681, 681, 681, 682, 683, 683, 683, - 683, 683, 684, 685, 686, 686, 686, 686, 686, 686, - 687, 688, 688, 688, 688, 688, 689, 690, 691, 692, - 692, 692, 692, 692, 692, 694, 694, 694, 694, 694, - 695, 696, 698, 698, 698, 699, 699, 700, 700, 701, - - 701, 701, 703, 703, 704, 705, 705, 705, 705, 705, - 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, - 707, 707, 708, 709, 709 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 5, 6, 7, 8, 1, 9, 10, - 11, 12, 13, 1, 14, 15, 16, 17, 18, 19, - 20, 20, 20, 20, 20, 20, 20, 21, 22, 1, - 23, 1, 1, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 33, 43, 33, 44, 45, 33, 33, - 46, 1, 47, 1, 48, 1, 49, 50, 51, 52, - - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 40, 65, 66, 67, 68, 33, 69, 45, - 70, 33, 71, 1, 72, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[73] = - { 0, - 1, 2, 3, 2, 1, 1, 1, 1, 4, 5, - 6, 1, 1, 7, 1, 1, 8, 8, 8, 8, - 9, 1, 10, 1, 11, 11, 11, 12, 12, 12, - 12, 12, 4, 11, 4, 4, 11, 12, 12, 11, - 11, 4, 4, 12, 7, 1, 1, 1, 13, 13, - 13, 14, 15, 14, 14, 14, 14, 14, 13, 14, - 4, 11, 12, 12, 11, 4, 4, 4, 4, 4, - 1, 1 - } ; - -static yyconst short int yy_base[824] = - { 0, - 0, 72, 2710, 5057, 120, 129, 0, 140, 2705, 138, - 149, 169, 160, 2705, 226, 157, 2651, 151, 2679, 130, - 2639, 131, 227, 271, 2648, 2633, 244, 331, 390, 447, - 203, 239, 332, 338, 375, 340, 370, 428, 430, 249, - 2650, 201, 254, 397, 2694, 147, 253, 506, 344, 257, - 568, 189, 2641, 229, 2672, 339, 294, 248, 335, 620, - 2642, 284, 574, 667, 724, 318, 640, 555, 608, 709, - 590, 610, 690, 746, 761, 462, 449, 644, 577, 2639, - 455, 0, 2683, 303, 781, 309, 5057, 2679, 439, 354, - 2673, 2673, 2671, 419, 692, 2671, 491, 160, 809, 2670, - - 0, 2683, 5057, 782, 0, 829, 0, 0, 499, 862, - 712, 582, 2636, 2641, 2615, 2616, 736, 2640, 2639, 717, - 797, 2627, 769, 829, 2613, 2627, 927, 336, 999, 5057, - 1023, 1074, 0, 1091, 1142, 834, 1159, 1206, 0, 1218, - 1265, 838, 847, 842, 2606, 2609, 2608, 2613, 303, 2597, - 890, 2664, 2663, 572, 2662, 594, 633, 298, 634, 1324, - 401, 688, 429, 1386, 1433, 2661, 851, 927, 900, 903, - 751, 689, 892, 946, 2626, 946, 951, 960, 973, 968, - 972, 690, 1445, 1496, 2659, 1513, 1565, 1010, 1582, 1629, - 2658, 1641, 1688, 1018, 1036, 1040, 972, 1003, 1023, 694, - - 804, 2596, 446, 503, 518, 2649, 542, 1153, 1167, 2648, - 2586, 5057, 2649, 2648, 2647, 2636, 2643, 2638, 0, 5057, - 2632, 2627, 2626, 2625, 2624, 808, 1023, 1045, 1073, 0, - 1072, 1085, 1136, 1735, 2570, 2563, 2576, 2571, 1179, 1229, - 2554, 1154, 930, 2569, 2607, 0, 2563, 2559, 1214, 1795, - 569, 1240, 605, 1867, 1930, 0, 1947, 0, 2608, 2606, - 1218, 1204, 1278, 0, 1998, 2606, 755, 398, 1272, 2015, - 0, 1288, 1317, 1395, 1379, 2062, 1405, 1391, 2564, 2600, - 2546, 5057, 1446, 750, 2608, 127, 2608, 885, 1185, 996, - 1447, 789, 2606, 1238, 1410, 2114, 2602, 1452, 2161, 1602, - - 1652, 1181, 1707, 1458, 1506, 1412, 0, 1100, 1179, 1637, - 2221, 2285, 2302, 2601, 1101, 1701, 1706, 2353, 1523, 1580, - 1383, 2370, 2600, 1742, 1748, 1457, 2417, 1803, 1816, 1411, - 1499, 1608, 1103, 2550, 5057, 817, 834, 2591, 5057, 1828, - 2590, 2589, 2527, 2526, 2579, 2578, 2577, 2577, 388, 2576, - 349, 2575, 890, 1761, 1029, 0, 1326, 1560, 0, 5057, - 5057, 2429, 1436, 1590, 2525, 2525, 2522, 2522, 2528, 2522, - 815, 503, 841, 2489, 0, 2542, 2524, 2525, 2522, 0, - 2561, 2633, 858, 907, 910, 1727, 2565, 2553, 1645, 5057, - 2696, 1760, 1085, 618, 1805, 2549, 1241, 1003, 2505, 2493, - - 0, 1759, 0, 1834, 2752, 1875, 1834, 2491, 1882, 2549, - 1901, 1902, 2503, 2488, 2547, 434, 1522, 653, 953, 1219, - 1291, 2809, 2545, 1912, 1875, 1888, 1899, 1572, 2869, 1505, - 1519, 1604, 1898, 1915, 2941, 2544, 3013, 3077, 1916, 1951, - 1591, 0, 3133, 1967, 2025, 1841, 1663, 2494, 2535, 1637, - 2534, 2472, 2532, 2469, 2529, 2467, 2520, 1748, 1924, 5057, - 3189, 2483, 2479, 2479, 2474, 2526, 1268, 1972, 2525, 870, - 2498, 2473, 0, 3254, 3326, 2463, 2463, 2519, 1299, 1946, - 5057, 2515, 1971, 1097, 1394, 1506, 2508, 1319, 1239, 5057, - 2454, 2439, 0, 2483, 1817, 2013, 2474, 1582, 2448, 2400, - - 2393, 1048, 1250, 1594, 3389, 2005, 2020, 2073, 2069, 1937, - 3454, 2440, 3526, 2041, 1956, 2075, 2440, 2084, 2010, 2077, - 430, 5057, 2114, 2425, 2424, 2360, 2345, 2405, 2403, 2341, - 2339, 2397, 2394, 2328, 2326, 2379, 2373, 1850, 2076, 2077, - 2380, 2325, 2315, 2035, 2311, 2293, 2330, 2286, 2267, 2304, - 2279, 2288, 2263, 2044, 2278, 5057, 2008, 5057, 2312, 5057, - 5057, 2306, 2123, 2296, 2238, 2232, 2283, 1861, 872, 1450, - 2118, 2127, 2135, 2136, 2278, 2137, 2129, 2273, 2177, 5057, - 2187, 2142, 2203, 2200, 2177, 5057, 2125, 2129, 2103, 5057, - 2089, 2136, 2126, 2064, 2105, 2066, 1992, 2011, 1986, 1984, - - 0, 1960, 2180, 1990, 1924, 1065, 1113, 2229, 2175, 1960, - 2172, 2083, 2180, 2191, 1900, 1933, 1299, 1883, 1859, 2126, - 1806, 1072, 1787, 1760, 3598, 1728, 1719, 1697, 1506, 1747, - 3670, 2230, 2232, 1665, 1664, 1616, 5057, 1582, 1880, 1999, - 3742, 2081, 0, 1530, 1479, 1752, 1163, 3814, 2244, 2160, - 2244, 2252, 1487, 1478, 2229, 1476, 1419, 1392, 1372, 1591, - 1710, 2254, 1312, 1271, 2256, 1158, 1136, 2225, 2227, 1106, - 942, 906, 918, 1045, 1456, 2259, 2315, 875, 756, 2293, - 2211, 733, 2243, 2248, 0, 701, 584, 603, 1827, 2312, - 2314, 0, 2299, 538, 5057, 421, 2242, 473, 5057, 304, - - 315, 5057, 2151, 2378, 2346, 2302, 234, 206, 1795, 2379, - 2317, 203, 1623, 1642, 1664, 1887, 2369, 2370, 2382, 2383, - 2434, 2436, 2437, 2442, 2443, 2444, 2446, 2449, 2450, 2514, - 2030, 159, 5057, 5057, 3883, 3898, 3913, 3928, 3943, 3955, - 3970, 3985, 3999, 4002, 4005, 4008, 4023, 4038, 4041, 4044, - 4059, 4074, 4086, 4101, 4116, 4131, 4146, 4161, 4176, 4191, - 4194, 4209, 4224, 4239, 4254, 4269, 1899, 4272, 4283, 2048, - 4286, 4301, 4316, 4328, 4343, 4358, 4373, 4388, 4403, 4418, - 4433, 4448, 4457, 4472, 4487, 4502, 4517, 4532, 4547, 4562, - 4573, 4588, 4603, 4618, 4633, 4648, 4663, 4678, 4693, 4708, - - 4723, 4738, 4753, 4768, 4783, 4798, 4813, 4828, 4839, 4852, - 4867, 4882, 4897, 4908, 4921, 4936, 4951, 4966, 4981, 4996, - 5011, 5026, 5041 - } ; - -static yyconst short int yy_def[824] = - { 0, - 734, 734, 734, 734, 734, 734, 735, 736, 734, 734, - 735, 734, 12, 737, 735, 15, 15, 15, 15, 15, - 735, 15, 15, 735, 15, 735, 15, 738, 15, 15, - 29, 29, 29, 29, 29, 29, 29, 29, 30, 29, - 735, 735, 735, 739, 734, 740, 740, 734, 48, 737, - 740, 51, 51, 51, 51, 51, 740, 51, 51, 740, - 51, 740, 51, 51, 51, 64, 64, 64, 64, 64, - 64, 64, 64, 65, 64, 740, 740, 740, 739, 734, - 734, 735, 741, 742, 741, 734, 734, 734, 734, 735, - 734, 735, 734, 743, 743, 735, 743, 734, 12, 734, - - 735, 737, 734, 735, 744, 735, 745, 746, 106, 734, - 106, 106, 735, 735, 735, 735, 106, 104, 735, 735, - 106, 735, 106, 106, 735, 747, 738, 747, 748, 734, - 735, 735, 749, 735, 735, 735, 735, 132, 750, 735, - 135, 106, 106, 735, 735, 735, 735, 735, 739, 751, - 739, 734, 752, 753, 734, 753, 753, 734, 753, 734, - 734, 753, 754, 753, 164, 745, 165, 165, 165, 753, - 753, 753, 753, 165, 164, 753, 753, 165, 753, 165, - 165, 753, 164, 164, 749, 164, 753, 753, 164, 184, - 750, 164, 187, 165, 165, 753, 753, 753, 753, 753, - - 739, 734, 755, 756, 756, 757, 758, 755, 755, 759, - 760, 734, 734, 734, 734, 735, 735, 734, 735, 734, - 734, 734, 734, 735, 734, 734, 735, 734, 106, 761, - 735, 734, 734, 735, 734, 734, 734, 734, 735, 735, - 735, 735, 735, 735, 735, 234, 735, 735, 735, 762, - 763, 764, 765, 766, 735, 767, 735, 768, 767, 735, - 735, 735, 769, 770, 735, 770, 735, 735, 255, 735, - 771, 735, 735, 770, 255, 265, 735, 735, 735, 735, - 735, 734, 739, 734, 772, 734, 773, 774, 774, 774, - 774, 775, 772, 776, 774, 774, 761, 774, 296, 774, - - 774, 774, 774, 774, 774, 774, 299, 774, 774, 774, - 777, 774, 296, 768, 774, 774, 774, 312, 774, 774, - 312, 296, 771, 774, 774, 312, 318, 774, 774, 774, - 774, 774, 739, 734, 734, 778, 778, 779, 734, 780, - 781, 781, 782, 782, 734, 734, 734, 735, 734, 734, - 734, 734, 734, 734, 734, 735, 783, 734, 735, 734, - 734, 735, 783, 735, 734, 734, 734, 734, 735, 735, - 735, 734, 735, 784, 735, 735, 735, 735, 735, 785, - 786, 786, 787, 787, 788, 789, 790, 734, 734, 734, - 735, 791, 734, 734, 791, 395, 735, 735, 734, 734, - - 735, 734, 391, 395, 391, 735, 735, 735, 739, 734, - 734, 734, 734, 734, 792, 734, 774, 793, 793, 774, - 774, 774, 363, 774, 774, 774, 774, 774, 794, 774, - 774, 774, 774, 774, 795, 785, 795, 774, 774, 774, - 774, 438, 438, 774, 774, 774, 739, 734, 796, 797, - 798, 799, 800, 801, 802, 803, 734, 734, 734, 734, - 735, 734, 734, 734, 734, 735, 735, 734, 735, 734, - 735, 735, 804, 805, 805, 735, 735, 735, 806, 807, - 734, 808, 734, 809, 809, 809, 735, 734, 734, 734, - 734, 734, 735, 734, 809, 739, 734, 734, 734, 734, - - 734, 810, 811, 811, 438, 774, 774, 774, 774, 774, - 812, 804, 812, 774, 774, 774, 813, 774, 774, 739, - 734, 734, 797, 798, 798, 799, 799, 800, 800, 801, - 801, 802, 802, 803, 803, 734, 734, 814, 814, 814, - 735, 734, 734, 734, 734, 735, 815, 734, 734, 734, - 734, 735, 735, 735, 735, 734, 734, 734, 734, 734, - 734, 734, 739, 734, 734, 734, 810, 810, 811, 811, - 774, 774, 774, 774, 816, 774, 774, 813, 739, 734, - 734, 797, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 815, 815, 734, 734, 734, 734, 735, 735, 735, - - 735, 735, 739, 734, 734, 811, 811, 774, 774, 816, - 774, 774, 774, 739, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 817, 735, 734, 734, 811, 811, - 818, 774, 739, 734, 734, 734, 734, 734, 819, 819, - 817, 641, 735, 734, 734, 811, 811, 818, 819, 648, - 774, 739, 734, 734, 819, 641, 641, 734, 734, 811, - 811, 820, 648, 648, 739, 734, 734, 819, 819, 641, - 641, 734, 734, 811, 811, 820, 820, 648, 648, 739, - 734, 734, 819, 819, 641, 821, 734, 822, 811, 820, - 820, 648, 739, 734, 734, 734, 819, 821, 734, 734, - - 822, 734, 811, 820, 820, 739, 734, 734, 811, 820, - 739, 734, 811, 739, 823, 823, 823, 823, 823, 823, - 823, 823, 823, 823, 823, 823, 823, 823, 823, 823, - 823, 734, 734, 0, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734 - } ; - -static yyconst short int yy_nxt[5130] = - { 0, - 4, 4, 4, 5, 4, 4, 6, 4, 7, 8, - 4, 9, 10, 7, 4, 4, 11, 12, 13, 13, - 4, 14, 4, 4, 15, 16, 17, 18, 19, 19, - 20, 19, 7, 19, 21, 22, 15, 23, 24, 15, - 25, 26, 7, 27, 7, 28, 4, 4, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 15, 42, 24, 25, 26, 7, 7, 43, 7, - 44, 4, 4, 4, 4, 5, 4, 45, 6, 45, - 7, 8, 4, 9, 10, 46, 4, 4, 47, 48, - 49, 49, 4, 50, 4, 4, 51, 52, 53, 54, - - 55, 55, 56, 55, 46, 55, 57, 58, 51, 59, - 60, 51, 61, 62, 46, 63, 46, 28, 4, 4, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 51, 77, 60, 61, 62, 46, 46, - 78, 46, 79, 4, 80, 81, 81, 81, 81, 84, - 87, 88, 89, 734, 734, 82, 85, 85, 85, 85, - 110, 733, 90, 94, 91, 92, 114, 155, 80, 93, - 94, 94, 95, 82, 734, 734, 225, 82, 226, 117, - 734, 413, 96, 97, 98, 99, 99, 99, 99, 100, - 414, 115, 110, 101, 101, 101, 101, 101, 101, 101, - - 101, 82, 101, 82, 82, 101, 101, 101, 101, 101, - 82, 82, 101, 82, 146, 113, 111, 101, 101, 101, - 101, 101, 101, 101, 101, 101, 101, 101, 101, 82, - 101, 101, 101, 101, 82, 82, 82, 82, 82, 104, - 118, 105, 106, 106, 106, 106, 107, 110, 168, 108, - 734, 136, 734, 135, 135, 686, 89, 110, 144, 103, - 163, 82, 734, 147, 119, 712, 156, 734, 91, 157, - 104, 734, 734, 158, 109, 109, 109, 109, 109, 109, - 109, 109, 109, 109, 109, 109, 105, 136, 136, 135, - 135, 135, 82, 170, 108, 580, 174, 136, 136, 123, - - 124, 287, 82, 113, 155, 150, 125, 135, 135, 148, - 125, 116, 206, 207, 155, 218, 125, 702, 210, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 126, 127, 127, 127, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 128, 126, 126, 94, 175, 251, - 179, 126, 126, 126, 126, 734, 173, 154, 734, 734, - 708, 734, 734, 734, 155, 225, 188, 226, 187, 187, - 216, 217, 176, 196, 152, 171, 126, 130, 126, 211, - 136, 136, 130, 135, 135, 135, 136, 136, 136, 136, - 135, 135, 135, 734, 135, 135, 135, 451, 734, 150, - - 172, 126, 126, 131, 287, 734, 132, 132, 132, 132, - 133, 114, 400, 151, 151, 151, 151, 225, 136, 136, - 94, 94, 94, 136, 136, 135, 135, 135, 135, 135, - 135, 293, 294, 734, 134, 502, 115, 502, 135, 135, - 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, - 110, 734, 213, 734, 214, 204, 335, 82, 452, 215, - 137, 401, 198, 138, 138, 138, 138, 139, 152, 155, - 82, 81, 81, 81, 81, 699, 136, 136, 142, 142, - 142, 580, 155, 707, 135, 135, 135, 141, 141, 141, - 581, 140, 94, 94, 94, 141, 141, 141, 142, 142, - - 142, 142, 142, 142, 142, 142, 143, 94, 94, 95, - 197, 199, 206, 336, 82, 234, 234, 234, 234, 159, - 97, 98, 160, 160, 160, 160, 161, 206, 336, 470, - 162, 162, 162, 162, 162, 162, 162, 162, 154, 162, - 154, 154, 162, 162, 162, 162, 162, 154, 154, 162, - 154, 338, 339, 470, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 154, 162, 162, 162, - 162, 154, 154, 154, 154, 154, 82, 110, 734, 150, - 82, 164, 384, 105, 165, 165, 165, 165, 166, 695, - 201, 108, 155, 151, 151, 151, 151, 734, 234, 234, - - 234, 234, 82, 188, 188, 702, 187, 187, 187, 386, - 288, 289, 164, 734, 155, 130, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 82, 180, - 181, 734, 400, 734, 240, 105, 182, 700, 188, 188, - 155, 82, 82, 108, 187, 187, 187, 110, 152, 290, - 291, 387, 82, 155, 155, 103, 188, 188, 188, 188, - 187, 187, 187, 734, 155, 187, 187, 187, 177, 177, - 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, - 183, 490, 734, 184, 184, 184, 184, 185, 188, 188, - 187, 187, 187, 94, 94, 94, 82, 82, 82, 200, - - 182, 503, 82, 699, 170, 221, 182, 222, 155, 155, - 155, 186, 223, 734, 155, 187, 187, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 110, 234, 234, - 234, 234, 734, 246, 246, 246, 246, 189, 188, 188, - 190, 190, 190, 190, 191, 171, 187, 187, 187, 734, - 332, 311, 234, 234, 234, 234, 303, 188, 188, 82, - 239, 410, 187, 187, 187, 399, 411, 412, 192, 734, - 172, 155, 193, 193, 193, 194, 194, 194, 194, 194, - 194, 194, 194, 195, 734, 234, 234, 234, 234, 696, - 204, 293, 294, 303, 194, 194, 194, 208, 208, 208, - - 208, 209, 244, 193, 193, 193, 150, 268, 692, 188, - 188, 354, 94, 234, 234, 234, 234, 333, 468, 187, - 187, 355, 82, 173, 734, 249, 338, 339, 355, 734, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 229, 338, 339, 234, 234, 234, 234, 230, - 265, 265, 265, 265, 276, 276, 276, 276, 265, 265, - 265, 265, 247, 276, 276, 276, 276, 299, 299, 299, - 299, 384, 471, 229, 103, 152, 469, 231, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 231, 231, 235, - 250, 236, 150, 82, 279, 239, 472, 237, 417, 453, - - 82, 550, 238, 692, 130, 155, 151, 151, 151, 151, - 283, 82, 155, 235, 386, 236, 299, 299, 299, 299, - 479, 687, 237, 155, 606, 551, 238, 126, 127, 127, - 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 299, 299, 299, 299, 126, 126, 126, - 126, 302, 301, 130, 82, 103, 387, 304, 686, 82, - 454, 152, 299, 299, 299, 299, 155, 307, 307, 307, - 307, 155, 126, 130, 126, 300, 299, 299, 299, 299, - 82, 82, 374, 290, 299, 299, 299, 299, 299, 299, - 299, 299, 155, 155, 685, 374, 374, 126, 126, 126, - - 252, 252, 252, 253, 82, 126, 126, 126, 126, 126, - 126, 82, 305, 126, 126, 504, 155, 492, 82, 126, - 126, 309, 126, 155, 310, 308, 318, 318, 318, 318, - 155, 82, 457, 311, 327, 327, 327, 327, 305, 356, - 356, 356, 356, 155, 126, 130, 458, 103, 82, 568, - 416, 568, 327, 327, 327, 327, 318, 318, 318, 318, - 155, 357, 357, 357, 357, 331, 493, 103, 629, 126, - 126, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 256, 300, 290, 82, 257, 359, 359, - 359, 359, 330, 734, 258, 399, 259, 688, 260, 260, - - 260, 360, 360, 360, 360, 150, 485, 260, 82, 82, - 260, 390, 548, 260, 260, 103, 447, 82, 257, 486, - 155, 155, 261, 261, 261, 262, 262, 262, 262, 262, - 262, 262, 261, 262, 685, 260, 548, 394, 260, 135, - 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 264, 361, 361, 361, 361, 432, 372, 265, 265, - 265, 265, 204, 335, 266, 103, 267, 267, 267, 208, - 208, 208, 208, 209, 152, 267, 204, 335, 267, 630, - 373, 267, 267, 340, 340, 340, 340, 82, 349, 82, - 267, 267, 267, 82, 268, 359, 359, 359, 359, 155, - - 267, 155, 682, 267, 373, 155, 267, 269, 269, 269, - 269, 269, 269, 269, 269, 269, 269, 269, 269, 270, - 391, 391, 391, 391, 681, 661, 271, 82, 390, 369, - 359, 359, 359, 359, 391, 391, 391, 391, 433, 155, - 103, 252, 252, 252, 253, 359, 359, 359, 359, 427, - 270, 491, 103, 492, 272, 272, 272, 273, 273, 273, - 273, 273, 273, 273, 272, 273, 275, 275, 275, 275, - 275, 275, 275, 275, 275, 275, 275, 275, 229, 370, - 379, 276, 276, 276, 276, 230, 130, 264, 356, 356, - 356, 356, 418, 398, 392, 392, 392, 392, 390, 82, - - 266, 419, 561, 546, 403, 403, 403, 403, 455, 229, - 569, 155, 479, 277, 277, 277, 231, 278, 231, 231, - 231, 231, 231, 277, 231, 94, 94, 94, 546, 491, - 394, 679, 82, 403, 403, 403, 403, 154, 97, 363, - 160, 160, 160, 160, 155, 556, 363, 678, 162, 162, - 162, 162, 162, 162, 162, 162, 154, 162, 154, 154, - 162, 162, 162, 162, 162, 154, 154, 162, 154, 456, - 363, 489, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 154, 162, 162, 162, 162, 154, - 154, 154, 154, 154, 82, 405, 405, 405, 405, 420, - - 420, 420, 420, 734, 264, 400, 155, 359, 359, 359, - 359, 404, 404, 404, 404, 399, 734, 266, 82, 82, - 82, 359, 359, 359, 359, 431, 420, 420, 420, 420, - 155, 155, 155, 673, 295, 295, 295, 295, 295, 295, - 295, 295, 295, 295, 295, 295, 296, 394, 150, 734, - 353, 672, 103, 297, 401, 82, 734, 268, 103, 689, - 82, 426, 409, 409, 409, 409, 82, 155, 421, 421, - 421, 421, 155, 443, 443, 443, 443, 296, 155, 671, - 734, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 312, 312, 312, 312, 312, 312, 312, - - 312, 312, 312, 312, 312, 256, 607, 82, 103, 313, - 429, 670, 446, 82, 82, 485, 314, 152, 259, 155, - 315, 315, 315, 429, 429, 155, 155, 82, 734, 315, - 82, 82, 315, 399, 667, 315, 315, 666, 290, 155, - 313, 659, 155, 155, 316, 316, 316, 317, 317, 317, - 317, 317, 317, 317, 316, 317, 290, 315, 430, 646, - 315, 187, 187, 187, 187, 187, 187, 187, 187, 187, - 187, 187, 187, 82, 264, 320, 460, 460, 460, 460, - 82, 318, 318, 318, 318, 155, 658, 266, 82, 319, - 319, 319, 155, 103, 400, 221, 103, 222, 319, 82, - - 155, 319, 223, 509, 319, 319, 461, 461, 461, 461, - 82, 155, 82, 319, 319, 319, 82, 320, 421, 421, - 421, 421, 155, 319, 155, 103, 319, 510, 155, 319, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 322, 441, 715, 82, 204, 522, 654, 323, - 674, 523, 425, 421, 421, 421, 421, 155, 514, 570, - 82, 484, 484, 484, 484, 150, 717, 637, 421, 421, - 421, 421, 155, 322, 434, 688, 520, 324, 324, 324, - 325, 325, 325, 325, 325, 325, 325, 324, 325, 326, - 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, - - 326, 296, 426, 434, 327, 327, 327, 327, 297, 82, - 372, 390, 103, 152, 82, 82, 653, 438, 438, 438, - 438, 155, 438, 438, 438, 438, 155, 155, 480, 480, - 480, 580, 296, 428, 152, 282, 328, 328, 328, 298, - 329, 298, 298, 298, 298, 298, 328, 298, 362, 103, - 82, 536, 390, 645, 103, 363, 82, 428, 442, 442, - 442, 442, 155, 537, 442, 442, 442, 442, 155, 395, - 455, 675, 644, 481, 355, 495, 495, 495, 495, 362, - 643, 355, 396, 364, 364, 364, 364, 364, 364, 364, - 364, 364, 364, 364, 364, 380, 380, 103, 380, 380, - - 380, 380, 380, 647, 380, 380, 380, 380, 660, 380, - 380, 82, 489, 399, 734, 380, 380, 380, 380, 421, - 421, 421, 421, 155, 82, 639, 485, 734, 639, 103, - 400, 456, 421, 421, 421, 421, 155, 204, 335, 486, - 380, 380, 380, 395, 450, 450, 450, 450, 492, 82, - 461, 461, 461, 461, 713, 320, 396, 734, 638, 539, - 382, 155, 568, 416, 568, 380, 380, 126, 252, 252, - 252, 253, 540, 126, 126, 126, 126, 126, 126, 441, - 703, 126, 126, 82, 150, 491, 489, 126, 126, 717, - 126, 461, 461, 461, 461, 155, 82, 493, 496, 496, - - 496, 496, 468, 290, 89, 498, 82, 82, 155, 388, - 655, 388, 126, 130, 497, 499, 91, 98, 155, 155, - 82, 93, 100, 82, 82, 620, 491, 398, 505, 505, - 505, 505, 155, 506, 655, 155, 155, 126, 126, 264, - 538, 538, 538, 538, 635, 82, 507, 480, 480, 480, - 515, 584, 266, 152, 267, 267, 267, 155, 282, 82, - 508, 634, 416, 267, 82, 492, 267, 516, 440, 267, - 267, 155, 557, 557, 557, 82, 155, 491, 267, 267, - 267, 547, 268, 505, 505, 505, 505, 155, 267, 574, - 628, 267, 481, 627, 267, 262, 262, 262, 262, 262, - - 262, 262, 262, 262, 262, 262, 262, 395, 110, 557, - 557, 557, 548, 82, 519, 150, 577, 558, 82, 440, - 396, 549, 397, 397, 397, 155, 626, 563, 82, 655, - 155, 397, 717, 82, 397, 601, 548, 397, 397, 492, - 155, 505, 505, 505, 505, 155, 397, 397, 397, 82, - 398, 625, 625, 655, 558, 572, 397, 624, 393, 397, - 393, 155, 397, 273, 273, 273, 273, 273, 273, 273, - 273, 273, 273, 273, 273, 362, 468, 82, 110, 150, - 572, 82, 363, 82, 564, 734, 539, 589, 519, 155, - 579, 82, 82, 155, 560, 155, 600, 573, 734, 734, - - 590, 732, 576, 155, 155, 656, 362, 623, 622, 601, - 406, 406, 406, 364, 407, 364, 364, 364, 364, 364, - 406, 364, 82, 204, 335, 150, 82, 621, 586, 657, - 582, 582, 582, 582, 155, 82, 593, 82, 155, 603, - 603, 603, 603, 82, 82, 82, 593, 155, 152, 155, - 620, 204, 522, 103, 590, 155, 155, 155, 582, 582, - 582, 582, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 422, 197, 608, 613, 636, 150, - 82, 423, 150, 82, 663, 619, 618, 586, 82, 611, - 614, 637, 155, 150, 152, 155, 603, 603, 603, 603, - - 155, 609, 612, 617, 633, 422, 616, 709, 664, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, - 424, 380, 380, 612, 380, 380, 380, 380, 380, 381, - 380, 380, 380, 380, 150, 380, 380, 82, 82, 615, - 631, 436, 380, 380, 380, 652, 632, 662, 152, 155, - 155, 564, 82, 668, 150, 655, 416, 655, 150, 655, - 683, 416, 152, 694, 155, 665, 380, 380, 380, 680, - 631, 697, 655, 655, 655, 416, 695, 669, 655, 655, - 416, 655, 651, 655, 677, 416, 437, 684, 605, 677, - 604, 380, 380, 82, 264, 150, 655, 655, 655, 284, - - 697, 150, 655, 152, 150, 155, 693, 266, 677, 319, - 319, 319, 706, 677, 416, 711, 416, 416, 319, 150, - 561, 319, 560, 152, 319, 319, 602, 152, 599, 598, - 714, 597, 596, 319, 319, 319, 595, 320, 594, 690, - 593, 145, 677, 319, 677, 677, 319, 704, 416, 319, - 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - 317, 317, 395, 691, 152, 591, 677, 588, 677, 677, - 152, 717, 717, 152, 705, 396, 677, 439, 439, 439, - 416, 416, 718, 719, 717, 717, 439, 587, 152, 439, - 586, 584, 439, 439, 583, 720, 721, 535, 710, 535, - - 677, 439, 439, 439, 533, 440, 710, 533, 677, 677, - 531, 439, 531, 529, 439, 529, 527, 439, 325, 325, - 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, - 422, 527, 677, 677, 525, 525, 717, 423, 717, 717, - 282, 282, 416, 575, 717, 717, 717, 722, 717, 723, - 724, 717, 717, 282, 282, 725, 726, 727, 566, 728, - 565, 422, 729, 730, 225, 444, 444, 444, 424, 445, - 424, 424, 424, 424, 424, 444, 424, 364, 364, 364, - 364, 364, 364, 364, 364, 364, 364, 364, 364, 473, - 473, 218, 473, 473, 473, 473, 473, 490, 473, 473, - - 473, 473, 562, 473, 473, 282, 489, 282, 282, 473, - 473, 473, 473, 282, 282, 282, 717, 282, 560, 483, - 282, 282, 110, 555, 554, 553, 552, 731, 468, 110, - 545, 544, 543, 542, 473, 473, 473, 458, 535, 533, - 531, 475, 529, 527, 525, 207, 521, 517, 287, 416, - 501, 500, 86, 219, 475, 475, 494, 394, 395, 473, - 473, 380, 380, 390, 380, 380, 380, 380, 380, 483, - 380, 380, 380, 380, 478, 380, 380, 477, 476, 219, - 467, 380, 380, 380, 380, 282, 466, 465, 464, 463, - 462, 225, 225, 219, 218, 218, 218, 344, 344, 342, - - 342, 207, 448, 287, 287, 287, 380, 380, 380, 286, - 416, 286, 379, 408, 370, 264, 390, 256, 378, 377, - 376, 375, 371, 368, 367, 366, 365, 353, 353, 352, - 351, 380, 380, 380, 380, 350, 380, 380, 380, 380, - 380, 349, 380, 380, 380, 380, 349, 380, 380, 348, - 347, 346, 345, 380, 380, 380, 380, 344, 342, 335, - 334, 287, 287, 306, 287, 287, 286, 284, 282, 281, - 219, 280, 244, 130, 250, 248, 219, 245, 380, 380, - 380, 243, 242, 242, 241, 103, 225, 224, 218, 219, - 218, 212, 204, 202, 178, 734, 169, 153, 145, 122, - - 121, 116, 734, 380, 380, 485, 112, 103, 86, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 486, 734, - 487, 487, 487, 734, 734, 734, 734, 734, 734, 487, - 734, 734, 487, 734, 734, 487, 487, 734, 734, 734, - 734, 734, 734, 734, 487, 487, 487, 734, 734, 734, - 734, 734, 734, 734, 487, 734, 734, 487, 734, 734, - 487, 395, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 396, 734, 397, 397, 397, 734, - 734, 734, 734, 734, 734, 397, 734, 734, 397, 734, - 734, 397, 397, 734, 734, 734, 734, 734, 734, 734, - - 397, 397, 397, 734, 398, 734, 734, 734, 734, 734, - 397, 734, 734, 397, 734, 734, 397, 82, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 155, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 424, 424, 424, - 424, 424, 424, 424, 424, 424, 424, 424, 424, 473, - 473, 734, 473, 473, 473, 473, 473, 474, 473, 473, - 473, 473, 734, 473, 473, 734, 734, 734, 734, 512, - 473, 473, 473, 734, 734, 734, 734, 734, 734, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 473, 473, 473, 734, 734, 734, - 734, 513, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 513, 513, 734, 734, 734, 473, - 473, 380, 380, 734, 380, 380, 380, 380, 380, 381, - 380, 380, 380, 380, 734, 380, 380, 734, 734, 734, - 734, 436, 380, 380, 380, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 380, 380, 380, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 380, 380, 380, 380, 734, 380, 380, 380, 380, - 380, 381, 380, 380, 380, 380, 734, 380, 380, 734, - 734, 734, 734, 436, 380, 380, 380, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 380, 380, - 380, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 380, 380, 82, 485, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 155, 734, 486, - - 734, 518, 518, 518, 734, 734, 734, 734, 734, 734, - 518, 734, 734, 518, 734, 734, 518, 518, 734, 734, - 734, 734, 734, 734, 734, 518, 518, 518, 734, 734, - 734, 734, 734, 734, 734, 518, 734, 734, 518, 734, - 734, 518, 395, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 396, 734, 439, 439, 439, - 734, 734, 734, 734, 734, 734, 439, 734, 734, 439, - 734, 734, 439, 439, 734, 734, 734, 734, 734, 734, - 734, 439, 439, 439, 734, 440, 734, 734, 734, 734, - 734, 439, 734, 734, 439, 734, 734, 439, 539, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 540, 734, 541, 541, 541, 734, 734, 734, 734, - 734, 734, 541, 734, 734, 541, 734, 734, 541, 541, - 734, 734, 734, 734, 734, 734, 734, 541, 541, 541, - 734, 734, 734, 734, 734, 734, 734, 541, 734, 734, - 541, 734, 734, 541, 473, 473, 734, 473, 473, 473, - 473, 473, 734, 473, 473, 473, 473, 734, 473, 473, - 734, 734, 734, 734, 473, 473, 473, 473, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 473, - - 473, 473, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 473, 473, 473, 473, 734, 473, - 473, 473, 473, 473, 734, 473, 473, 473, 473, 734, - 473, 473, 734, 734, 734, 734, 473, 473, 473, 473, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 473, 473, 473, 734, 734, 734, 734, 475, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 475, 475, 734, 734, 734, 473, 473, 539, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 540, 734, 571, 571, 571, 734, 734, 734, 734, - 734, 734, 571, 734, 734, 571, 734, 734, 571, 571, - 734, 734, 734, 734, 734, 734, 734, 571, 571, 571, - 734, 734, 734, 734, 734, 734, 734, 571, 734, 734, - 571, 734, 734, 571, 473, 473, 734, 473, 473, 473, - 473, 473, 474, 473, 473, 473, 473, 734, 473, 473, - 734, 734, 734, 734, 512, 473, 473, 473, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 473, - - 473, 473, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 473, 473, 473, 473, 734, 473, - 473, 473, 473, 473, 474, 473, 473, 473, 473, 734, - 473, 473, 734, 734, 734, 734, 512, 473, 473, 473, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 473, 473, 473, 734, 734, 734, 734, 513, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 513, 513, 734, 734, 734, 473, 473, 640, 640, - - 734, 640, 640, 640, 640, 640, 734, 640, 640, 640, - 640, 734, 640, 640, 734, 734, 734, 734, 640, 640, - 640, 640, 734, 734, 734, 734, 734, 734, 642, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 640, 640, 640, 734, 734, 734, 734, - 734, 734, 642, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 640, 640, - 640, 640, 734, 640, 640, 640, 640, 640, 641, 640, - 640, 640, 640, 734, 640, 640, 734, 734, 734, 734, - 649, 640, 640, 640, 734, 734, 734, 734, 734, 734, - - 650, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 640, 640, 640, 734, 734, - 734, 734, 734, 734, 650, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 640, 640, 640, 640, 734, 640, 640, 640, 640, 640, - 734, 640, 640, 640, 640, 734, 640, 640, 734, 734, - 734, 734, 640, 640, 640, 640, 734, 734, 734, 734, - 734, 734, 642, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 640, 640, 640, - 734, 734, 734, 734, 734, 734, 642, 734, 734, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 640, 640, 640, 640, 734, 640, 640, 640, - 640, 640, 641, 640, 640, 640, 640, 734, 640, 640, - 734, 734, 734, 734, 649, 640, 640, 640, 734, 734, - 734, 734, 734, 734, 650, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 640, - 640, 640, 734, 734, 734, 734, 734, 734, 650, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 640, 640, 82, 734, 734, 82, - 82, 734, 734, 82, 82, 82, 82, 82, 83, 83, - - 83, 83, 83, 734, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 129, 129, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 129, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 154, 734, - 734, 154, 154, 154, 734, 154, 154, 154, 154, 154, - 203, 203, 203, 203, 203, 734, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 205, 205, 205, 205, 205, - 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, - - 220, 220, 734, 734, 734, 734, 734, 734, 734, 220, - 220, 220, 220, 220, 228, 228, 228, 232, 232, 232, - 233, 233, 233, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 263, 263, 263, 274, 274, 274, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 285, 285, 285, 285, 285, 285, - 285, 285, 285, 285, 285, 285, 285, 285, 285, 154, - 734, 734, 154, 154, 154, 734, 154, 154, 154, 154, - - 154, 292, 292, 292, 292, 292, 292, 292, 292, 292, - 292, 292, 292, 292, 292, 292, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, - 203, 205, 205, 205, 205, 205, 205, 205, 205, 205, - 205, 205, 205, 205, 205, 205, 206, 206, 206, 206, - 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, - 206, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 341, 341, 734, 341, - 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, - 341, 343, 343, 734, 343, 343, 343, 343, 343, 343, - - 343, 343, 343, 343, 343, 343, 358, 358, 358, 381, - 381, 734, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 385, 385, 385, 385, 385, 385, - 385, 385, 385, 385, 385, 385, 385, 385, 385, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 389, 389, 389, 393, 734, 734, - 393, 734, 393, 393, 734, 393, 734, 393, 402, 402, - - 402, 285, 285, 285, 285, 285, 285, 285, 285, 285, - 285, 285, 285, 285, 285, 285, 415, 415, 415, 415, - 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, - 415, 154, 734, 734, 154, 154, 154, 734, 154, 154, - 154, 154, 154, 292, 292, 292, 292, 292, 292, 292, - 292, 292, 292, 292, 292, 292, 292, 292, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 435, 435, 734, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - - 337, 337, 337, 449, 449, 449, 449, 734, 449, 449, - 449, 449, 449, 449, 449, 449, 449, 449, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 341, 341, 734, 341, 341, 341, 341, - 341, 341, 341, 341, 341, 341, 341, 341, 343, 343, - 734, 343, 343, 343, 343, 343, 343, 343, 343, 343, - 343, 343, 343, 459, 734, 459, 734, 734, 734, 459, - 459, 459, 474, 474, 734, 474, 474, 474, 474, 474, - 474, 474, 474, 474, 474, 474, 474, 380, 380, 734, - 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, - - 380, 380, 381, 381, 734, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 385, 385, 385, 385, 385, 385, 385, 385, - 385, 385, 385, 385, 385, 385, 385, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 482, 482, 482, 482, 482, 482, 482, 482, - 482, 482, 482, 482, 482, 482, 482, 488, 734, 734, - 734, 734, 488, 488, 734, 488, 734, 488, 415, 415, - 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, - - 415, 415, 415, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 511, 511, - 734, 511, 511, 511, 511, 511, 511, 511, 511, 511, - 511, 511, 511, 435, 435, 734, 435, 435, 435, 435, - 435, 435, 435, 435, 435, 435, 435, 435, 449, 449, - 449, 449, 734, 449, 449, 449, 449, 449, 449, 449, - 449, 449, 449, 203, 203, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 203, 203, 203, 524, 524, - 734, 524, 524, 524, 524, 524, 524, 524, 524, 524, - 524, 524, 524, 526, 526, 734, 526, 526, 526, 526, - - 526, 526, 526, 526, 526, 526, 526, 526, 528, 528, - 734, 528, 528, 528, 528, 528, 528, 528, 528, 528, - 528, 528, 528, 530, 530, 734, 530, 530, 530, 530, - 530, 530, 530, 530, 530, 530, 530, 530, 532, 532, - 734, 532, 532, 532, 532, 532, 532, 532, 532, 532, - 532, 532, 532, 534, 534, 734, 534, 534, 534, 534, - 534, 534, 534, 534, 534, 534, 534, 534, 473, 473, - 734, 473, 473, 473, 473, 473, 473, 473, 473, 473, - 473, 473, 473, 474, 474, 734, 474, 474, 474, 474, - 474, 474, 474, 474, 474, 474, 474, 474, 383, 383, - - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 482, 482, - 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, - 482, 482, 482, 559, 734, 734, 734, 734, 559, 559, - 734, 559, 567, 567, 567, 567, 567, 567, 567, 567, - 567, 567, 567, 567, 567, 567, 567, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 511, 511, 734, 511, 511, 511, 511, 511, - 511, 511, 511, 511, 511, 511, 511, 578, 578, 578, - - 578, 578, 578, 578, 578, 578, 578, 578, 578, 578, - 578, 578, 585, 734, 734, 734, 734, 585, 585, 734, - 585, 592, 592, 734, 592, 592, 592, 592, 592, 592, - 592, 592, 592, 592, 592, 592, 610, 610, 610, 610, - 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, - 610, 641, 641, 734, 641, 641, 641, 641, 641, 641, - 641, 641, 641, 641, 641, 641, 648, 648, 734, 648, - 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, - 648, 640, 640, 734, 640, 640, 640, 640, 640, 640, - 640, 640, 640, 640, 640, 640, 676, 676, 676, 676, - - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 698, 698, 698, 698, 698, 698, 698, 698, 698, - 698, 698, 698, 698, 698, 698, 701, 701, 701, 701, - 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, - 701, 716, 716, 716, 716, 716, 716, 716, 716, 716, - 716, 716, 716, 716, 716, 716, 3, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734 - } ; - -static yyconst short int yy_chk[5130] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 5, 6, 6, 6, 6, 8, - 10, 10, 11, 20, 22, 46, 8, 8, 8, 8, - 16, 732, 11, 13, 11, 11, 20, 46, 5, 11, - 12, 12, 12, 13, 18, 13, 98, 12, 98, 22, - 13, 286, 12, 12, 12, 12, 12, 12, 12, 12, - 286, 20, 52, 12, 12, 12, 12, 12, 12, 12, - - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 42, 18, 16, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, - 23, 15, 15, 15, 15, 15, 15, 27, 52, 15, - 23, 31, 54, 31, 31, 712, 47, 43, 31, 50, - 50, 47, 32, 42, 23, 708, 47, 27, 47, 47, - 15, 58, 40, 47, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 24, 32, 32, 32, - 32, 32, 62, 54, 24, 707, 58, 40, 40, 27, - - 27, 158, 57, 32, 62, 149, 27, 40, 40, 43, - 43, 40, 84, 84, 57, 158, 43, 701, 86, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 49, 59, 128, - 62, 28, 28, 28, 28, 33, 57, 49, 59, 49, - 700, 34, 56, 36, 49, 351, 66, 351, 66, 66, - 90, 90, 59, 66, 149, 56, 28, 28, 28, 86, - 33, 33, 128, 33, 33, 33, 34, 34, 36, 36, - 34, 34, 34, 37, 36, 36, 36, 349, 35, 44, - - 56, 28, 28, 29, 161, 29, 29, 29, 29, 29, - 29, 35, 268, 44, 44, 44, 44, 161, 37, 37, - 94, 94, 94, 35, 35, 37, 37, 37, 35, 35, - 35, 163, 163, 39, 29, 416, 35, 416, 29, 29, - 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 30, 38, 89, 39, 89, 203, 203, 77, 349, 89, - 30, 268, 77, 30, 30, 30, 30, 30, 44, 77, - 76, 81, 81, 81, 81, 698, 38, 38, 39, 39, - 39, 521, 76, 696, 38, 38, 38, 39, 39, 39, - 521, 30, 97, 97, 97, 30, 30, 30, 30, 30, - - 30, 30, 30, 30, 30, 30, 30, 48, 48, 48, - 76, 77, 204, 204, 48, 109, 109, 109, 109, 48, - 48, 48, 48, 48, 48, 48, 48, 205, 205, 372, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 207, 207, 372, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 51, 63, 68, 79, - 154, 51, 251, 51, 51, 51, 51, 51, 51, 694, - 79, 51, 154, 79, 79, 79, 79, 63, 112, 112, - - 112, 112, 156, 68, 68, 688, 68, 68, 68, 253, - 156, 156, 51, 71, 156, 251, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 60, 63, - 63, 69, 394, 72, 112, 60, 63, 687, 71, 71, - 60, 157, 159, 60, 71, 71, 71, 78, 79, 157, - 159, 253, 78, 157, 159, 418, 69, 69, 72, 72, - 69, 69, 69, 67, 78, 72, 72, 72, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 64, 394, 64, 64, 64, 64, 64, 64, 67, 67, - 67, 67, 67, 95, 95, 95, 162, 172, 182, 78, - - 78, 418, 200, 686, 67, 95, 78, 95, 162, 172, - 182, 64, 95, 73, 200, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 65, 111, 111, - 111, 111, 70, 120, 120, 120, 120, 65, 73, 73, - 65, 65, 65, 65, 65, 70, 73, 73, 73, 74, - 200, 182, 117, 117, 117, 117, 172, 70, 70, 171, - 111, 284, 70, 70, 70, 267, 284, 284, 65, 74, - 70, 171, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 75, 123, 123, 123, 123, 682, - 85, 292, 292, 171, 74, 74, 74, 85, 85, 85, - - 85, 85, 117, 74, 74, 74, 201, 267, 679, 75, - 75, 226, 99, 121, 121, 121, 121, 201, 371, 75, - 75, 226, 99, 75, 99, 123, 336, 336, 226, 99, - 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, - 104, 104, 106, 337, 337, 124, 124, 124, 124, 106, - 136, 136, 136, 136, 142, 142, 142, 142, 144, 144, - 144, 144, 121, 143, 143, 143, 143, 167, 167, 167, - 167, 383, 373, 106, 569, 201, 371, 106, 106, 106, - 106, 106, 106, 106, 106, 106, 106, 106, 106, 110, - 124, 110, 151, 288, 144, 143, 373, 110, 288, 353, - - 173, 470, 110, 678, 383, 288, 151, 151, 151, 151, - 151, 170, 173, 110, 385, 110, 169, 169, 169, 169, - 384, 673, 110, 170, 569, 470, 110, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 168, 168, 168, 168, 127, 127, 127, - 127, 170, 169, 384, 176, 419, 385, 173, 672, 177, - 353, 151, 174, 174, 174, 174, 176, 177, 177, 177, - 177, 177, 127, 127, 127, 168, 178, 178, 178, 178, - 197, 179, 243, 176, 180, 180, 180, 180, 181, 181, - 181, 181, 197, 179, 671, 243, 243, 127, 127, 129, - - 129, 129, 129, 129, 290, 129, 129, 129, 129, 129, - 129, 198, 174, 129, 129, 419, 290, 398, 188, 129, - 129, 179, 129, 198, 180, 178, 188, 188, 188, 188, - 188, 199, 355, 181, 194, 194, 194, 194, 197, 227, - 227, 227, 227, 199, 129, 129, 355, 674, 196, 502, - 502, 502, 195, 195, 195, 195, 196, 196, 196, 196, - 196, 228, 228, 228, 228, 198, 398, 606, 606, 129, - 129, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 132, 195, 199, 229, 132, 231, 231, - 231, 231, 196, 229, 132, 393, 132, 674, 132, 132, - - 132, 232, 232, 232, 232, 333, 484, 132, 308, 315, - 132, 315, 622, 132, 132, 607, 333, 229, 132, 484, - 308, 315, 132, 132, 132, 132, 132, 132, 132, 132, - 132, 132, 132, 132, 670, 132, 622, 393, 132, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 135, 233, 233, 233, 233, 308, 242, 135, 135, - 135, 135, 208, 208, 135, 647, 135, 135, 135, 208, - 208, 208, 208, 208, 333, 135, 209, 209, 135, 607, - 242, 135, 135, 209, 209, 209, 209, 309, 289, 302, - 135, 135, 135, 289, 135, 239, 239, 239, 239, 309, - - 135, 302, 667, 135, 242, 289, 135, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 138, - 262, 262, 262, 262, 666, 647, 138, 420, 261, 239, - 249, 249, 249, 249, 261, 261, 261, 261, 309, 420, - 294, 252, 252, 252, 252, 240, 240, 240, 240, 302, - 138, 397, 503, 489, 138, 138, 138, 138, 138, 138, - 138, 138, 138, 138, 138, 138, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 141, 240, - 249, 141, 141, 141, 141, 141, 252, 263, 269, 269, - 269, 269, 294, 397, 263, 263, 263, 263, 272, 421, - - 263, 294, 489, 467, 272, 272, 272, 272, 617, 141, - 503, 421, 479, 141, 141, 141, 141, 141, 141, 141, - 141, 141, 141, 141, 141, 160, 160, 160, 467, 488, - 263, 664, 160, 273, 273, 273, 273, 160, 160, 357, - 160, 160, 160, 160, 160, 479, 357, 663, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, 160, 617, - 357, 488, 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 160, 160, 160, 160, 160, 160, - 160, 160, 160, 160, 164, 275, 275, 275, 275, 321, - - 321, 321, 321, 485, 274, 278, 164, 278, 278, 278, - 278, 274, 274, 274, 274, 277, 485, 274, 295, 330, - 306, 277, 277, 277, 277, 306, 295, 295, 295, 295, - 295, 330, 306, 659, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 165, 274, 283, 363, - 291, 658, 570, 165, 278, 291, 363, 277, 675, 675, - 298, 330, 283, 283, 283, 283, 304, 291, 298, 298, - 298, 298, 298, 326, 326, 326, 326, 165, 304, 657, - 363, 165, 165, 165, 165, 165, 165, 165, 165, 165, - 165, 165, 165, 183, 183, 183, 183, 183, 183, 183, - - 183, 183, 183, 183, 183, 184, 570, 331, 629, 184, - 304, 656, 331, 430, 305, 486, 184, 283, 184, 331, - 184, 184, 184, 304, 304, 430, 305, 431, 486, 184, - 417, 319, 184, 319, 654, 184, 184, 653, 417, 431, - 184, 645, 417, 319, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 431, 184, 305, 629, - 184, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 187, 187, 319, 358, 358, 358, 358, - 428, 187, 187, 187, 187, 187, 644, 187, 320, 187, - 187, 187, 428, 660, 320, 498, 504, 498, 187, 441, - - 320, 187, 498, 428, 187, 187, 364, 364, 364, 364, - 300, 441, 432, 187, 187, 187, 332, 187, 300, 300, - 300, 300, 300, 187, 432, 713, 187, 428, 332, 187, - 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, - 189, 189, 190, 320, 714, 310, 450, 450, 638, 190, - 660, 450, 300, 310, 310, 310, 310, 310, 432, 504, - 301, 389, 389, 389, 389, 447, 715, 636, 301, 301, - 301, 301, 301, 190, 332, 713, 447, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 192, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - - 192, 193, 301, 310, 193, 193, 193, 193, 193, 316, - 303, 316, 661, 714, 317, 303, 635, 316, 316, 316, - 316, 316, 317, 317, 317, 317, 317, 303, 386, 386, - 386, 634, 193, 303, 447, 715, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, 234, 630, - 324, 458, 324, 628, 646, 234, 325, 303, 324, 324, - 324, 324, 324, 458, 325, 325, 325, 325, 325, 392, - 354, 661, 627, 386, 354, 402, 402, 402, 402, 234, - 626, 354, 392, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 250, 250, 709, 250, 250, - - 250, 250, 250, 630, 250, 250, 250, 250, 646, 250, - 250, 328, 392, 328, 395, 250, 250, 250, 250, 328, - 328, 328, 328, 328, 329, 624, 495, 395, 623, 689, - 329, 354, 329, 329, 329, 329, 329, 340, 340, 495, - 250, 250, 250, 404, 340, 340, 340, 340, 407, 446, - 407, 407, 407, 407, 709, 328, 404, 395, 621, 538, - 250, 446, 568, 568, 568, 250, 250, 254, 254, 254, - 254, 254, 538, 254, 254, 254, 254, 254, 254, 329, - 689, 254, 254, 425, 409, 406, 404, 254, 254, 716, - 254, 406, 406, 406, 406, 425, 426, 407, 409, 409, - - 409, 409, 427, 446, 411, 412, 433, 427, 426, 767, - 639, 767, 254, 254, 411, 412, 411, 412, 433, 427, - 424, 411, 412, 434, 439, 619, 439, 406, 424, 424, - 424, 424, 424, 425, 639, 434, 439, 254, 254, 255, - 459, 459, 459, 459, 618, 510, 426, 480, 480, 480, - 433, 616, 255, 409, 255, 255, 255, 510, 716, 440, - 427, 615, 610, 255, 515, 440, 255, 434, 439, 255, - 255, 440, 483, 483, 483, 444, 515, 444, 255, 255, - 255, 468, 255, 444, 444, 444, 444, 444, 255, 510, - 605, 255, 480, 604, 255, 257, 257, 257, 257, 257, - - 257, 257, 257, 257, 257, 257, 257, 265, 506, 557, - 557, 557, 468, 506, 440, 496, 515, 483, 519, 444, - 265, 468, 265, 265, 265, 506, 602, 496, 507, 640, - 519, 265, 731, 445, 265, 600, 468, 265, 265, 445, - 507, 445, 445, 445, 445, 445, 265, 265, 265, 514, - 265, 599, 598, 640, 557, 507, 265, 597, 770, 265, - 770, 514, 265, 270, 270, 270, 270, 270, 270, 270, - 270, 270, 270, 270, 270, 276, 508, 509, 516, 520, - 507, 508, 276, 516, 496, 539, 540, 544, 445, 509, - 520, 612, 518, 508, 518, 516, 554, 509, 539, 540, - - 544, 731, 514, 612, 518, 642, 276, 596, 595, 554, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, - 276, 276, 296, 523, 523, 563, 571, 594, 571, 642, - 523, 523, 523, 523, 296, 572, 593, 577, 571, 563, - 563, 563, 563, 573, 574, 576, 592, 572, 520, 577, - 591, 582, 582, 703, 589, 573, 574, 576, 582, 582, - 582, 582, 296, 296, 296, 296, 296, 296, 296, 296, - 296, 296, 296, 296, 299, 572, 573, 577, 620, 579, - 611, 299, 603, 609, 650, 588, 587, 585, 613, 576, - 579, 620, 611, 614, 563, 609, 603, 603, 603, 603, - - 613, 574, 576, 584, 614, 299, 583, 703, 650, 299, - 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, - 299, 311, 311, 611, 311, 311, 311, 311, 311, 311, - 311, 311, 311, 311, 633, 311, 311, 608, 632, 581, - 609, 311, 311, 311, 311, 633, 613, 649, 579, 608, - 632, 603, 651, 655, 652, 668, 662, 669, 665, 655, - 668, 676, 614, 681, 651, 652, 311, 311, 311, 665, - 608, 683, 697, 683, 649, 578, 681, 655, 684, 668, - 575, 669, 632, 655, 662, 567, 311, 669, 566, 676, - 565, 311, 311, 312, 312, 680, 697, 683, 649, 564, - - 684, 693, 684, 633, 706, 312, 680, 312, 662, 312, - 312, 312, 693, 676, 690, 706, 691, 677, 312, 711, - 562, 312, 559, 652, 312, 312, 555, 665, 553, 552, - 711, 551, 550, 312, 312, 312, 549, 312, 548, 677, - 547, 546, 690, 312, 691, 677, 312, 690, 705, 312, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 318, 677, 680, 545, 690, 543, 691, 677, - 693, 717, 718, 706, 691, 318, 705, 318, 318, 318, - 704, 710, 717, 718, 719, 720, 318, 542, 711, 318, - 541, 537, 318, 318, 536, 719, 720, 535, 705, 534, - - 705, 318, 318, 318, 533, 318, 704, 532, 704, 710, - 531, 318, 530, 529, 318, 528, 527, 318, 322, 322, - 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, - 327, 526, 704, 710, 525, 524, 721, 327, 722, 723, - 717, 718, 517, 512, 724, 725, 726, 721, 727, 722, - 723, 728, 729, 719, 720, 724, 725, 726, 501, 727, - 500, 327, 728, 729, 499, 327, 327, 327, 327, 327, - 327, 327, 327, 327, 327, 327, 327, 362, 362, 362, - 362, 362, 362, 362, 362, 362, 362, 362, 362, 374, - 374, 497, 374, 374, 374, 374, 374, 494, 374, 374, - - 374, 374, 492, 374, 374, 721, 491, 722, 723, 374, - 374, 374, 374, 724, 725, 726, 730, 727, 487, 482, - 728, 729, 478, 477, 476, 472, 471, 730, 469, 466, - 465, 464, 463, 462, 374, 374, 374, 457, 456, 455, - 454, 374, 453, 452, 451, 449, 448, 436, 423, 415, - 414, 413, 410, 408, 374, 374, 400, 399, 396, 374, - 374, 381, 381, 388, 381, 381, 381, 381, 381, 387, - 381, 381, 381, 381, 379, 381, 381, 378, 377, 376, - 370, 381, 381, 381, 381, 730, 369, 368, 367, 366, - 365, 352, 350, 348, 347, 346, 345, 344, 343, 342, - - 341, 338, 334, 323, 314, 297, 381, 381, 381, 293, - 287, 285, 281, 280, 279, 266, 260, 259, 248, 247, - 245, 244, 241, 238, 237, 236, 235, 225, 224, 223, - 222, 381, 381, 382, 382, 221, 382, 382, 382, 382, - 382, 218, 382, 382, 382, 382, 217, 382, 382, 216, - 215, 214, 213, 382, 382, 382, 382, 211, 210, 206, - 202, 191, 185, 175, 166, 155, 153, 152, 150, 148, - 147, 146, 145, 126, 125, 122, 119, 118, 382, 382, - 382, 116, 115, 114, 113, 102, 100, 96, 93, 92, - 91, 88, 83, 80, 61, 55, 53, 45, 41, 26, - - 25, 21, 19, 382, 382, 391, 17, 14, 9, 3, - 0, 0, 0, 0, 0, 0, 0, 0, 391, 0, - 391, 391, 391, 0, 0, 0, 0, 0, 0, 391, - 0, 0, 391, 0, 0, 391, 391, 0, 0, 0, - 0, 0, 0, 0, 391, 391, 391, 0, 0, 0, - 0, 0, 0, 0, 391, 0, 0, 391, 0, 0, - 391, 405, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 405, 0, 405, 405, 405, 0, - 0, 0, 0, 0, 0, 405, 0, 0, 405, 0, - 0, 405, 405, 0, 0, 0, 0, 0, 0, 0, - - 405, 405, 405, 0, 405, 0, 0, 0, 0, 0, - 405, 0, 0, 405, 0, 0, 405, 422, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 422, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, 422, 429, - 429, 0, 429, 429, 429, 429, 429, 429, 429, 429, - 429, 429, 0, 429, 429, 0, 0, 0, 0, 429, - 429, 429, 429, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 429, 429, 429, 0, 0, 0, - 0, 429, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 429, 429, 0, 0, 0, 429, - 429, 435, 435, 0, 435, 435, 435, 435, 435, 435, - 435, 435, 435, 435, 0, 435, 435, 0, 0, 0, - 0, 435, 435, 435, 435, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 435, 435, 435, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 435, 435, 437, 437, 0, 437, 437, 437, 437, - 437, 437, 437, 437, 437, 437, 0, 437, 437, 0, - 0, 0, 0, 437, 437, 437, 437, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 437, 437, - 437, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 437, 437, 438, 438, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 438, 0, 438, - - 0, 438, 438, 438, 0, 0, 0, 0, 0, 0, - 438, 0, 0, 438, 0, 0, 438, 438, 0, 0, - 0, 0, 0, 0, 0, 438, 438, 438, 0, 0, - 0, 0, 0, 0, 0, 438, 0, 0, 438, 0, - 0, 438, 443, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 443, 0, 443, 443, 443, - 0, 0, 0, 0, 0, 0, 443, 0, 0, 443, - 0, 0, 443, 443, 0, 0, 0, 0, 0, 0, - 0, 443, 443, 443, 0, 443, 0, 0, 0, 0, - 0, 443, 0, 0, 443, 0, 0, 443, 461, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 461, 0, 461, 461, 461, 0, 0, 0, 0, - 0, 0, 461, 0, 0, 461, 0, 0, 461, 461, - 0, 0, 0, 0, 0, 0, 0, 461, 461, 461, - 0, 0, 0, 0, 0, 0, 0, 461, 0, 0, - 461, 0, 0, 461, 474, 474, 0, 474, 474, 474, - 474, 474, 0, 474, 474, 474, 474, 0, 474, 474, - 0, 0, 0, 0, 474, 474, 474, 474, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 474, - - 474, 474, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 474, 474, 475, 475, 0, 475, - 475, 475, 475, 475, 0, 475, 475, 475, 475, 0, - 475, 475, 0, 0, 0, 0, 475, 475, 475, 475, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 475, 475, 475, 0, 0, 0, 0, 475, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 475, 475, 0, 0, 0, 475, 475, 505, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 505, 0, 505, 505, 505, 0, 0, 0, 0, - 0, 0, 505, 0, 0, 505, 0, 0, 505, 505, - 0, 0, 0, 0, 0, 0, 0, 505, 505, 505, - 0, 0, 0, 0, 0, 0, 0, 505, 0, 0, - 505, 0, 0, 505, 511, 511, 0, 511, 511, 511, - 511, 511, 511, 511, 511, 511, 511, 0, 511, 511, - 0, 0, 0, 0, 511, 511, 511, 511, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 511, - - 511, 511, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 511, 511, 513, 513, 0, 513, - 513, 513, 513, 513, 513, 513, 513, 513, 513, 0, - 513, 513, 0, 0, 0, 0, 513, 513, 513, 513, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 513, 513, 513, 0, 0, 0, 0, 513, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 513, 513, 0, 0, 0, 513, 513, 625, 625, - - 0, 625, 625, 625, 625, 625, 0, 625, 625, 625, - 625, 0, 625, 625, 0, 0, 0, 0, 625, 625, - 625, 625, 0, 0, 0, 0, 0, 0, 625, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 625, 625, 625, 0, 0, 0, 0, - 0, 0, 625, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 625, 625, - 631, 631, 0, 631, 631, 631, 631, 631, 631, 631, - 631, 631, 631, 0, 631, 631, 0, 0, 0, 0, - 631, 631, 631, 631, 0, 0, 0, 0, 0, 0, - - 631, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 631, 631, 631, 0, 0, - 0, 0, 0, 0, 631, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 631, 631, 641, 641, 0, 641, 641, 641, 641, 641, - 0, 641, 641, 641, 641, 0, 641, 641, 0, 0, - 0, 0, 641, 641, 641, 641, 0, 0, 0, 0, - 0, 0, 641, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 641, 641, 641, - 0, 0, 0, 0, 0, 0, 641, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 641, 641, 648, 648, 0, 648, 648, 648, - 648, 648, 648, 648, 648, 648, 648, 0, 648, 648, - 0, 0, 0, 0, 648, 648, 648, 648, 0, 0, - 0, 0, 0, 0, 648, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 648, - 648, 648, 0, 0, 0, 0, 0, 0, 648, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 648, 648, 735, 0, 0, 735, - 735, 0, 0, 735, 735, 735, 735, 735, 736, 736, - - 736, 736, 736, 0, 736, 736, 736, 736, 736, 736, - 736, 736, 736, 737, 737, 737, 737, 737, 737, 737, - 737, 737, 737, 737, 737, 737, 737, 737, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 740, 0, - 0, 740, 740, 740, 0, 740, 740, 740, 740, 740, - 741, 741, 741, 741, 741, 0, 741, 741, 741, 741, - 741, 741, 741, 741, 741, 742, 742, 742, 742, 742, - 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, - - 743, 743, 0, 0, 0, 0, 0, 0, 0, 743, - 743, 743, 743, 743, 744, 744, 744, 745, 745, 745, - 746, 746, 746, 747, 747, 747, 747, 747, 747, 747, - 747, 747, 747, 747, 747, 747, 747, 747, 748, 748, - 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, - 748, 748, 748, 749, 749, 749, 750, 750, 750, 751, - 751, 751, 751, 751, 751, 751, 751, 751, 751, 751, - 751, 751, 751, 751, 752, 752, 752, 752, 752, 752, - 752, 752, 752, 752, 752, 752, 752, 752, 752, 753, - 0, 0, 753, 753, 753, 0, 753, 753, 753, 753, - - 753, 754, 754, 754, 754, 754, 754, 754, 754, 754, - 754, 754, 754, 754, 754, 754, 755, 755, 755, 755, - 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, - 755, 756, 756, 756, 756, 756, 756, 756, 756, 756, - 756, 756, 756, 756, 756, 756, 757, 757, 757, 757, - 757, 757, 757, 757, 757, 757, 757, 757, 757, 757, - 757, 758, 758, 758, 758, 758, 758, 758, 758, 758, - 758, 758, 758, 758, 758, 758, 759, 759, 0, 759, - 759, 759, 759, 759, 759, 759, 759, 759, 759, 759, - 759, 760, 760, 0, 760, 760, 760, 760, 760, 760, - - 760, 760, 760, 760, 760, 760, 761, 761, 761, 762, - 762, 0, 762, 762, 762, 762, 762, 762, 762, 762, - 762, 762, 762, 762, 763, 763, 763, 763, 763, 763, - 763, 763, 763, 763, 763, 763, 763, 763, 763, 764, - 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, - 764, 764, 764, 764, 765, 765, 765, 765, 765, 765, - 765, 765, 765, 765, 765, 765, 765, 765, 765, 766, - 766, 766, 766, 766, 766, 766, 766, 766, 766, 766, - 766, 766, 766, 766, 768, 768, 768, 769, 0, 0, - 769, 0, 769, 769, 0, 769, 0, 769, 771, 771, - - 771, 772, 772, 772, 772, 772, 772, 772, 772, 772, - 772, 772, 772, 772, 772, 772, 773, 773, 773, 773, - 773, 773, 773, 773, 773, 773, 773, 773, 773, 773, - 773, 774, 0, 0, 774, 774, 774, 0, 774, 774, - 774, 774, 774, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 776, 776, - 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, - 776, 776, 776, 777, 777, 0, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 778, 778, - 778, 778, 778, 778, 778, 778, 778, 778, 778, 778, - - 778, 778, 778, 779, 779, 779, 779, 0, 779, 779, - 779, 779, 779, 779, 779, 779, 779, 779, 780, 780, - 780, 780, 780, 780, 780, 780, 780, 780, 780, 780, - 780, 780, 780, 781, 781, 0, 781, 781, 781, 781, - 781, 781, 781, 781, 781, 781, 781, 781, 782, 782, - 0, 782, 782, 782, 782, 782, 782, 782, 782, 782, - 782, 782, 782, 783, 0, 783, 0, 0, 0, 783, - 783, 783, 784, 784, 0, 784, 784, 784, 784, 784, - 784, 784, 784, 784, 784, 784, 784, 785, 785, 0, - 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, - - 785, 785, 786, 786, 0, 786, 786, 786, 786, 786, - 786, 786, 786, 786, 786, 786, 786, 787, 787, 787, - 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, - 787, 787, 788, 788, 788, 788, 788, 788, 788, 788, - 788, 788, 788, 788, 788, 788, 788, 789, 789, 789, - 789, 789, 789, 789, 789, 789, 789, 789, 789, 789, - 789, 789, 790, 790, 790, 790, 790, 790, 790, 790, - 790, 790, 790, 790, 790, 790, 790, 791, 0, 0, - 0, 0, 791, 791, 0, 791, 0, 791, 792, 792, - 792, 792, 792, 792, 792, 792, 792, 792, 792, 792, - - 792, 792, 792, 793, 793, 793, 793, 793, 793, 793, - 793, 793, 793, 793, 793, 793, 793, 793, 794, 794, - 0, 794, 794, 794, 794, 794, 794, 794, 794, 794, - 794, 794, 794, 795, 795, 0, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, 796, 796, - 796, 796, 0, 796, 796, 796, 796, 796, 796, 796, - 796, 796, 796, 797, 797, 797, 797, 797, 797, 797, - 797, 797, 797, 797, 797, 797, 797, 797, 798, 798, - 0, 798, 798, 798, 798, 798, 798, 798, 798, 798, - 798, 798, 798, 799, 799, 0, 799, 799, 799, 799, - - 799, 799, 799, 799, 799, 799, 799, 799, 800, 800, - 0, 800, 800, 800, 800, 800, 800, 800, 800, 800, - 800, 800, 800, 801, 801, 0, 801, 801, 801, 801, - 801, 801, 801, 801, 801, 801, 801, 801, 802, 802, - 0, 802, 802, 802, 802, 802, 802, 802, 802, 802, - 802, 802, 802, 803, 803, 0, 803, 803, 803, 803, - 803, 803, 803, 803, 803, 803, 803, 803, 804, 804, - 0, 804, 804, 804, 804, 804, 804, 804, 804, 804, - 804, 804, 804, 805, 805, 0, 805, 805, 805, 805, - 805, 805, 805, 805, 805, 805, 805, 805, 806, 806, - - 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, - 806, 806, 806, 807, 807, 807, 807, 807, 807, 807, - 807, 807, 807, 807, 807, 807, 807, 807, 808, 808, - 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, - 808, 808, 808, 809, 0, 0, 0, 0, 809, 809, - 0, 809, 810, 810, 810, 810, 810, 810, 810, 810, - 810, 810, 810, 810, 810, 810, 810, 811, 811, 811, - 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, - 811, 811, 812, 812, 0, 812, 812, 812, 812, 812, - 812, 812, 812, 812, 812, 812, 812, 813, 813, 813, - - 813, 813, 813, 813, 813, 813, 813, 813, 813, 813, - 813, 813, 814, 0, 0, 0, 0, 814, 814, 0, - 814, 815, 815, 0, 815, 815, 815, 815, 815, 815, - 815, 815, 815, 815, 815, 815, 816, 816, 816, 816, - 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, - 816, 817, 817, 0, 817, 817, 817, 817, 817, 817, - 817, 817, 817, 817, 817, 817, 818, 818, 0, 818, - 818, 818, 818, 818, 818, 818, 818, 818, 818, 818, - 818, 819, 819, 0, 819, 819, 819, 819, 819, 819, - 819, 819, 819, 819, 819, 819, 820, 820, 820, 820, - - 820, 820, 820, 820, 820, 820, 820, 820, 820, 820, - 820, 821, 821, 821, 821, 821, 821, 821, 821, 821, - 821, 821, 821, 821, 821, 821, 822, 822, 822, 822, - 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, - 822, 823, 823, 823, 823, 823, 823, 823, 823, 823, - 823, 823, 823, 823, 823, 823, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 734, 734, 734 - } ; - -static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; -static char *yy_full_match; -static int yy_lp; -static int yy_looking_for_trail_begin = 0; -static int yy_full_lp; -static int *yy_full_state; -#define YY_TRAILING_MASK 0x2000 -#define YY_TRAILING_HEAD_MASK 0x4000 -#define REJECT \ -{ \ -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ -yy_cp = yy_full_match; /* restore poss. backed-over text */ \ -yy_lp = yy_full_lp; /* restore orig. accepting pos. */ \ -yy_state_ptr = yy_full_state; /* restore orig. state */ \ -yy_current_state = *yy_state_ptr; /* restore curr. state */ \ -++yy_lp; \ -goto find_rule; \ -} -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#define INITIAL 0 -/* - * parser.l -- lex parser of algebraic chess moves for XBoard - * $Id: parser.l,v 2.1 2003/10/27 19:21:00 mann Exp $ - * - * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts. - * Enhancements Copyright 1992-95 Free Software Foundation, Inc. - * - * The following terms apply to Digital Equipment Corporation's copyright - * interest in XBoard: - * ------------------------------------------------------------------------ - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Digital not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * ------------------------------------------------------------------------ - * - * The following terms apply to the enhanced version of XBoard distributed - * by the Free Software Foundation: - * ------------------------------------------------------------------------ - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ------------------------------------------------------------------------ - */ - -/* This parser handles all forms of promotion. - * The parser resolves ambiguous moves by searching and check-testing. - * It also parses comments of the form [anything] or (anything). - */ - -#include "config.h" - -#define NO_CONSTRAINT -1 -#undef YYLMAX -#define YYLMAX 4096 -#define UNPUT_BUF_SIZE YYLMAX - -#ifdef FLEX_SCANNER -/* yytext is probably a char*, but could be a char[]. yy_text is set - in YY_DECL below, because if yytext is a char*, its value is not - constant. */ -char *yy_text; -#else /*!FLEX_SCANNER*/ -/* yytext is definitely a char[], so yy_text can be set here, statically. */ -char *yy_text = (char *) yytext; -#endif - -#ifdef FLEX_SCANNER -/* This is flex */ -#undef YY_INPUT -#define YY_INPUT(buf, result, max_size) my_yy_input(buf, &result, max_size) -#undef YY_DECL -#define YY_DECL \ - int _yylex YY_PROTO((void)); \ - int yylex YY_PROTO((void)) \ - { \ - int result = _yylex(); \ - yy_text = (char *) yytext; \ - return(result); \ - } \ - int _yylex YY_PROTO((void)) -#else -/* This is lex */ -#undef input -#undef output -#undef unput -#endif - -/* The includes must be here, below the #undef input */ - -#include - -#if STDC_HEADERS -# include -# include -#else /* not STDC_HEADERS */ -# if HAVE_STRING_H -# include -# else /* not HAVE_STRING_H */ -# include -# endif /* not HAVE_STRING_H */ -#endif /* not STDC_HEADERS */ - -#if HAVE_UNISTD_H -# include -#endif - -#if defined(_amigados) -# include -# if HAVE_FCNTL_H -# include /* isatty() prototype */ -# endif /* HAVE_FCNTL_H */ -#endif /* defined(_amigados) */ - -#include "common.h" -#include "backend.h" -#include "frontend.h" -#include "parser.h" -#include "moves.h" - -extern int PosFlags P((int)); - -extern Board boards[MAX_MOVES]; -int yyboardindex; -int yyskipmoves = FALSE; -char currentMoveString[YYLMAX]; -#ifndef FLEX_SCANNER -char unputBuffer[UNPUT_BUF_SIZE]; -int unputCount = 0; -#endif - -#ifdef FLEX_SCANNER -void my_yy_input P((char *buf, int *result, int max_size)); -#else /*!FLEX_SCANNER*/ -static int input P((void)); -static void output P((int ch)); -static void unput P((int ch)); -int yylook P((void)); -int yyback P((int *, int)); -#endif -#undef yywrap -int yywrap P((void)); -extern void CopyBoard P((Board to, Board from)); - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - } -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - - - - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; - yy_current_state += YY_AT_BOL(); - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 735 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 5057 ); - -yy_find_action: - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; -find_rule: /* we branch to this label when backing up */ - for ( ; ; ) /* until we find what rule we matched */ - { - if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) - { - yy_act = yy_acclist[yy_lp]; - if ( yy_act & YY_TRAILING_HEAD_MASK || - yy_looking_for_trail_begin ) - { - if ( yy_act == yy_looking_for_trail_begin ) - { - yy_looking_for_trail_begin = 0; - yy_act &= ~YY_TRAILING_HEAD_MASK; - break; - } - } - else if ( yy_act & YY_TRAILING_MASK ) - { - yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; - yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; - } - else - { - yy_full_match = yy_cp; - yy_full_state = yy_state_ptr; - yy_full_lp = yy_lp; - break; - } - ++yy_lp; - goto find_rule; - } - --yy_cp; - yy_current_state = *--yy_state_ptr; - yy_lp = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ -case 1: -YY_RULE_SETUP -{ - /* - * Fully-qualified algebraic move, possibly with promotion - * [HGM] Bigger-than-8x8 boards must rely on long algebraic formats - * where I allowed piece types A & C (also as promotions) - * files a-l and ranks 0-9 - */ - int skip1 = 0, skip2 = 0; - ChessSquare piece; - ChessMove result; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove the / */ - if (yytext[1] == '/') skip1 = 1; - - /* remove the [xX:-] */ - if ((yytext[3+skip1] == 'x') || (yytext[3+skip1] == 'X') || - (yytext[3+skip1] == '-') || (yytext[3+skip1] == ':')) skip2 = 1; - - currentMoveString[0] = yytext[1+skip1]; - currentMoveString[1] = yytext[2+skip1]; - currentMoveString[2] = yytext[3+skip1+skip2]; - currentMoveString[3] = yytext[4+skip1+skip2]; - currentMoveString[4] = NULLCHAR; - - if (yyleng-skip1-skip2 > 5) { - if (yytext[yyleng-1] == ')') { - currentMoveString[4] = ToLower(yytext[yyleng-2]); - } else { - currentMoveString[4] = ToLower(yytext[yyleng-1]); - } - currentMoveString[5] = NULLCHAR; - } - - if (appData.debugMode) { - fprintf(debugFP, "parser: %s\n", currentMoveString); - } - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[1] - ONE >= BOARD_HEIGHT || - currentMoveString[0] - AAA >= BOARD_WIDTH || - currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[2] - AAA >= BOARD_WIDTH ) - return 0; - - piece = boards[yyboardindex] - [currentMoveString[1] - ONE][currentMoveString[0] - AAA]; - if (ToLower(yytext[0]) != ToLower(PieceToChar(piece))) - return (int) IllegalMove; - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, - initialRights, /* [HGM] assume all castlings allowed */ - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (currentMoveString[4] == NULLCHAR && - (result == WhitePromotionQueen || result == BlackPromotionQueen)) { - currentMoveString[4] = 'q'; - currentMoveString[5] = NULLCHAR; - } - - return (int) result; -} - YY_BREAK -case 2: -YY_RULE_SETUP -{ - /* - * Simple algebraic move, possibly with promotion - * [HGM] Bigger-than-8x8 boards must rely on this format - * where I allowed piece types A & C (also as promotions) - * files a-l and ranks 0-9 - */ - int skip = 0; - ChessMove result; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove the [xX:-] */ - if ((yytext[2] == 'x') || (yytext[2] == 'X') || - (yytext[2] == '-') || (yytext[2] == ':')) skip = 1; - - currentMoveString[0] = yytext[0]; - currentMoveString[1] = yytext[1]; - currentMoveString[2] = yytext[2+skip]; - currentMoveString[3] = yytext[3+skip]; - currentMoveString[4] = NULLCHAR; - - if (yyleng-skip > 4) { - if (yytext[yyleng-1] == ')') { - currentMoveString[4] = ToLower(yytext[yyleng-2]); - } else { - currentMoveString[4] = ToLower(yytext[yyleng-1]); - } - currentMoveString[5] = NULLCHAR; - } - - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[1] - ONE >= BOARD_HEIGHT || - currentMoveString[0] - AAA >= BOARD_WIDTH || - currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[2] - AAA >= BOARD_WIDTH ) - return 0; - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, - initialRights, /* [HGM] assume all castlings allowed */ - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (currentMoveString[4] == NULLCHAR && - (result == WhitePromotionQueen || result == BlackPromotionQueen)) { - currentMoveString[4] = 'q'; - currentMoveString[5] = NULLCHAR; - } - - return (int) result; -} - YY_BREAK -case 3: -YY_RULE_SETUP -{ - /* - * Pawn move, possibly with promotion - */ - DisambiguateClosure cl; - int skip = 0; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove the =() */ - if (yytext[2] == '=') skip++; - if (yytext[2+skip] == '(') skip++; - - cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; - cl.rfIn = -1; - cl.ffIn = yytext[0] - AAA; - cl.rtIn = yytext[1] - ONE; - cl.ftIn = yytext[0] - AAA; - cl.promoCharIn = yytext[2+skip]; - - /* [HGM] do not allow values beyond board size */ - if(cl.rtIn >= BOARD_HEIGHT || - cl.ffIn >= BOARD_WIDTH || - cl.ftIn >= BOARD_WIDTH ) - return 0; - - - Disambiguate(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 4: -YY_RULE_SETUP -{ - /* - * Pawn capture, possibly with promotion, possibly ambiguous - */ - DisambiguateClosure cl; - int skip1 = 0, skip2 = 0; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove trailing ep or e.p. (nonstandard PGN) */ - if (yytext[yyleng-1] == 'p') { - yyleng -= 2; - yytext[yyleng] = NULLCHAR; - } else if (yytext[yyleng-1] == '.') { - yyleng -= 4; - yytext[yyleng] = NULLCHAR; - } - - /* remove the [xX:-] and =() */ - if ((yytext[1] == 'x') || (yytext[1] == 'X') - || (yytext[1] == ':') || (yytext[1] == '-')) skip1 = 1; - if (yytext[2+skip1] == '=') skip2++; - if (yytext[2+skip1+skip2] == '(') skip2++; - - cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; - cl.rfIn = -1; - cl.ffIn = yytext[0] - AAA; - cl.rtIn = -1; - cl.ftIn = yytext[1+skip1] - AAA; - cl.promoCharIn = yytext[2+skip1+skip2]; - - /* [HGM] do not allow values beyond board size */ - if(cl.ffIn >= BOARD_WIDTH || - cl.ftIn >= BOARD_WIDTH ) - return 0; - - Disambiguate(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 5: -YY_RULE_SETUP -{ - /* - * unambiguously abbreviated Pawn capture, possibly with promotion - */ - int skip = 0; - ChessMove result; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove trailing ep or e.p. (nonstandard PGN) */ - if (yytext[yyleng-1] == 'p') { - yyleng -= 2; - yytext[yyleng] = NULLCHAR; - } else if (yytext[yyleng-1] == '.') { - yyleng -= 4; - yytext[yyleng] = NULLCHAR; - } - - /* remove the [xX:-] */ - if ((yytext[1] == 'x') || (yytext[1] == 'X') - || (yytext[1] == ':') || (yytext[1] == '-')) skip = 1; - - currentMoveString[0] = yytext[0]; - currentMoveString[2] = yytext[1+skip]; - currentMoveString[3] = yytext[2+skip]; - - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[0] - AAA >= BOARD_WIDTH || - currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[2] - AAA >= BOARD_WIDTH ) - return 0; - - if (gameInfo.variant == VariantXiangqi && /* [HGM] In Xiangqi rank stays same */ - currentMoveString[0] != currentMoveString[2] ) { - if (yytext[2+skip] == ONE) return (int) ImpossibleMove; - currentMoveString[1] = yytext[2+skip]; - } else - if (WhiteOnMove(yyboardindex)) { - if (yytext[2+skip] == ONE) return (int) ImpossibleMove; - currentMoveString[1] = yytext[2+skip] - 1; - } else { - currentMoveString[1] = currentMoveString[3] + 1; - if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove; - } - if (yyleng-skip > 3) { - if (yytext[yyleng-1] == ')') - currentMoveString[4] = ToLower(yytext[yyleng-2]); - else - currentMoveString[4] = ToLower(yytext[yyleng-1]); - currentMoveString[5] = NULLCHAR; - } else { - currentMoveString[4] = NULLCHAR; - } - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, - initialRights, /* [HGM] assume all castlings allowed */ - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (currentMoveString[4] == NULLCHAR && - (result == WhitePromotionQueen || result == BlackPromotionQueen)) { - currentMoveString[4] = 'q'; - currentMoveString[5] = NULLCHAR; - } - - if (result != IllegalMove) return (int) result; - - /* Special case: improperly written en passant capture */ - if (WhiteOnMove(yyboardindex)) { - if (currentMoveString[3] == '5') { - currentMoveString[1] = '5'; - currentMoveString[3] = '6'; - } else { - return (int) IllegalMove; - } - } else { - if (currentMoveString[3] == '4') { - currentMoveString[1] = '4'; - currentMoveString[3] = '3'; - } else { - return (int) IllegalMove; - } - } - - result = LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, - initialRights, /* [HGM] assume all castlings allowed */ - currentMoveString[1] - ONE, - currentMoveString[0] - AAA, - currentMoveString[3] - ONE, - currentMoveString[2] - AAA, - currentMoveString[4]); - - if (result == WhiteCapturesEnPassant || result == BlackCapturesEnPassant) - return (int) result; - else - return (int) IllegalMove; -} - YY_BREAK -case 6: -YY_RULE_SETUP -{ - /* - * piece move, possibly ambiguous - */ - DisambiguateClosure cl; - int skip = 0; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove the [xX:-] */ - if ((yytext[1] == 'x') || (yytext[1] == 'X') - || (yytext[1] == ':') || (yytext[1] == '-')) skip = 1; - - if (WhiteOnMove(yyboardindex)) { - cl.pieceIn = CharToPiece(ToUpper(yytext[0])); - } else { - cl.pieceIn = CharToPiece(ToLower(yytext[0])); - } - cl.rfIn = -1; - cl.ffIn = -1; - cl.rtIn = yytext[2+skip] - ONE; - cl.ftIn = yytext[1+skip] - AAA; - cl.promoCharIn = NULLCHAR; - - /* [HGM] but do not allow values beyond board size */ - if(cl.rtIn >= BOARD_HEIGHT || - cl.ftIn >= BOARD_WIDTH ) - return 0; - - Disambiguate(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 7: -YY_RULE_SETUP -{ - /* - * piece move with rank or file disambiguator - */ - DisambiguateClosure cl; - int skip = 0; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* remove the [xX:-] */ - if ((yytext[2] == 'x') || (yytext[2] == 'X') - || (yytext[2] == ':') || (yytext[2] == '-')) skip = 1; - - if (WhiteOnMove(yyboardindex)) { - cl.pieceIn = CharToPiece(ToUpper(yytext[0])); - } else { - cl.pieceIn = CharToPiece(ToLower(yytext[0])); - } - if (isalpha(yytext[1])) { - cl.rfIn = -1; - cl.ffIn = yytext[1] - AAA; - } else { - cl.rfIn = yytext[1] - ONE; - cl.ffIn = -1; - } - cl.rtIn = yytext[3+skip] - ONE; - cl.ftIn = yytext[2+skip] - AAA; - cl.promoCharIn = NULLCHAR; - - /* [HGM] do not allow values beyond board size */ - if(cl.rtIn >= BOARD_HEIGHT || - cl.rfIn >= BOARD_HEIGHT || - cl.ffIn >= BOARD_WIDTH || - cl.ftIn >= BOARD_WIDTH ) - return 0; - - Disambiguate(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, &cl); - - currentMoveString[0] = cl.ff + AAA; - currentMoveString[1] = cl.rf + ONE; - currentMoveString[2] = cl.ft + AAA; - currentMoveString[3] = cl.rt + ONE; - currentMoveString[4] = cl.promoChar; - currentMoveString[5] = NULLCHAR; - - return (int) cl.kind; -} - YY_BREAK -case 8: -YY_RULE_SETUP -{ - int rf, ff, rt, ft; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - /* [HGM] all squares referenced to board edges in stead of absolute */ - if (WhiteOnMove(yyboardindex)) { - if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { - /* ICS wild castling */ - rf = 0; - ff = (BOARD_WIDTH-1)>>1; - rt = 0; - ft = BOARD_RGHT-3; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } else { - rf = 0; - ff = BOARD_WIDTH>>1; - rt = 0; - ft = BOARD_LEFT+2; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } - } else{ - if (boards[yyboardindex][BOARD_HEIGHT-1][3] == BlackKing) { - /* ICS wild castling */ - rf = BOARD_HEIGHT-1; - ff = (BOARD_WIDTH-1)>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_RGHT-3; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } else { - rf = BOARD_HEIGHT-1; - ff = BOARD_WIDTH>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_LEFT+2; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } - } - return (int) LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, - initialRights, /* [HGM] assume all castlings allowed */ - rf, ff, rt, ft, NULLCHAR); -} - YY_BREAK -case 9: -YY_RULE_SETUP -{ - int rf, ff, rt, ft; - - if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ - - if (WhiteOnMove(yyboardindex)) { - if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { - /* ICS wild castling */ - rf = 0; - ff = (BOARD_WIDTH-1)>>1; - rt = 0; - ft = BOARD_LEFT+1; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } else { - rf = 0; - ff = BOARD_WIDTH>>1; - rt = 0; - ft = BOARD_RGHT-2; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } - } else { - if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) { - /* ICS wild castling */ - rf = BOARD_HEIGHT-1; - ff = (BOARD_WIDTH-1)>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_LEFT+1; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } else { - rf = BOARD_HEIGHT-1; - ff = BOARD_WIDTH>>1; - rt = BOARD_HEIGHT-1; - ft = BOARD_RGHT-2; - sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); - } - } - return (int) LegalityTest(boards[yyboardindex], - PosFlags(yyboardindex), EP_UNKNOWN, - initialRights, /* [HGM] assume all castlings allowed */ - rf, ff, rt, ft, NULLCHAR); -} - YY_BREAK -case 10: -YY_RULE_SETUP -{ - /* Bughouse piece drop. No legality checking for now. */ - currentMoveString[1] = '@'; - currentMoveString[2] = yytext[2]; - currentMoveString[3] = yytext[3]; - currentMoveString[4] = NULLCHAR; - - if (appData.debugMode) { - fprintf(debugFP, "Drop: %s\n", currentMoveString); - } - /* [HGM] do not allow values beyond board size */ - if(currentMoveString[3] - ONE >= BOARD_HEIGHT || - currentMoveString[2] - AAA >= BOARD_WIDTH ) - return 0; - - if (WhiteOnMove(yyboardindex)) { - currentMoveString[0] = ToUpper(yytext[0]); - return (int) WhiteDrop; - } else { - currentMoveString[0] = ToLower(yytext[0]); - return (int) BlackDrop; - } -} - YY_BREAK -case 11: -YY_RULE_SETUP -{ - if (WhiteOnMove(yyboardindex)) - return (int) BlackWins; - else - return (int) WhiteWins; -} - YY_BREAK -case 12: -YY_RULE_SETUP -{ - return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); -} - YY_BREAK -case 13: -YY_RULE_SETUP -{ - return (int) GameUnfinished; -} - YY_BREAK -case 14: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 15: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 16: -YY_RULE_SETUP -{ - if (WhiteOnMove(yyboardindex)) - return (int) BlackWins; - else - return (int) WhiteWins; -} - YY_BREAK -case 17: -YY_RULE_SETUP -{ - if (WhiteOnMove(yyboardindex)) - return (int) BlackWins; - else - return (int) WhiteWins; -} - YY_BREAK -case 18: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 19: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 20: -YY_RULE_SETUP -{ - return (int) (ToUpper(yytext[0]) == 'W' ? WhiteWins : BlackWins); -} - YY_BREAK -case 21: -YY_RULE_SETUP -{ - return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); -} - YY_BREAK -case 22: -YY_RULE_SETUP -{ - return (int) WhiteWins; -} - YY_BREAK -case 23: -YY_RULE_SETUP -{ - return (int) BlackWins; -} - YY_BREAK -case 24: -YY_RULE_SETUP -{ - return (int) GameIsDrawn; -} - YY_BREAK -case 25: -YY_RULE_SETUP -{ - return (int) GameUnfinished; -} - YY_BREAK -case 26: -YY_RULE_SETUP -{ - /* move numbers */ - if ((yyleng == 1) && (yytext[0] == '1')) - return (int) MoveNumberOne; -} - YY_BREAK -case 27: -YY_RULE_SETUP -{ - /* elapsed time indication, e.g. (0:12) or {10:21.071} */ - return (int) ElapsedTime; -} - YY_BREAK -case 28: -YY_RULE_SETUP -{ - /* position diagram enclosed in [-- --] */ - return (int) PositionDiagram; -} - YY_BREAK -case 29: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ - /* position diagram enclosed in {-- --} */ - return (int) PositionDiagram; -} - YY_BREAK -case 30: -YY_RULE_SETUP -{ - return (int) PGNTag; -} - YY_BREAK -case 31: -YY_RULE_SETUP -{ - return (int) GNUChessGame; -} - YY_BREAK -case 32: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ - return (int) XBoardGame; -} - YY_BREAK -case 33: -YY_RULE_SETUP -{ /* numeric annotation glyph */ - return (int) NAG; -} - YY_BREAK -case 34: -YY_RULE_SETUP -{ /* anything in {} */ - return (int) Comment; -} - YY_BREAK -case 35: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ /* ; to end of line */ - return (int) Comment; -} - YY_BREAK -case 36: -YY_RULE_SETUP -{ /* anything in [] */ - return (int) Comment; -} - YY_BREAK -case 37: -YY_RULE_SETUP -{ /* nested () */ - return (int) Comment; -} - YY_BREAK -case 38: -YY_RULE_SETUP -{ /* >=2 chars in () */ - return (int) Comment; -} - YY_BREAK -case 39: -YY_RULE_SETUP -{ - /* Skip mail headers */ -} - YY_BREAK -case 40: -YY_RULE_SETUP -{ - /* Skip random words */ -} - YY_BREAK -case 41: -YY_RULE_SETUP -{ - /* Skip everything else */ -} - YY_BREAK -case 42: -YY_RULE_SETUP -ECHO; - YY_BREAK - case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - yy_current_state += YY_AT_BOL(); - yy_state_ptr = yy_state_buf; - *yy_state_ptr++ = yy_current_state; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 735 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - *yy_state_ptr++ = yy_current_state; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - - register YY_CHAR yy_c = 1; - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 735 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 734); - if ( ! yy_is_jam ) - *yy_state_ptr++ = yy_current_state; - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - yy_current_buffer->yy_at_bol = (c == '\n'); - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef _WIN32 -#include -#else -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif - - - -static char *StringToLex; - -#ifndef FLEX_SCANNER -static FILE *lexFP; - -static int input() -{ - int ret; - - if (StringToLex != NULL) { - ret = *StringToLex; - if (ret == NULLCHAR) - ret = EOF; - else - StringToLex++; - } else if (unputCount > 0) { - ret = unputBuffer[--unputCount]; - } else { - ret = fgetc(lexFP); - } - - if (ret == EOF) - return 0; - else - return ret; -} - -/* - * Return offset of next pattern within current file - */ -int yyoffset() -{ - int offset = ftell(lexFP) - unputCount; - - if (offset < 0) { - offset = 0; - } - return(offset); -} - -static void output(ch) - int ch; -{ - fprintf(stderr, "PARSER BUG: unmatched character '%c' (0%o)\n", - ch, ch); -} - -static void unput(ch) - int ch; -{ - if (ch == 0) return; - if (StringToLex != NULL) { - StringToLex--; - } else { - if (unputCount >= UNPUT_BUF_SIZE) - fprintf(stderr, "PARSER BUG: unput buffer overflow '%c' (0%o)\n", - ch, ch); - unputBuffer[unputCount++] = ch; - } -} - -/* Get ready to lex from a new file. Kludge below sticks - an artificial newline at the front of the file, which the - above grammar ignores, but which makes ^ at start of pattern - match at the real start of the file. -*/ -void yynewfile(f) - FILE *f; -{ - lexFP = f; - StringToLex = NULL; - unputCount = 0; - unput('\n'); /* kludge */ -} - -/* Get ready to lex from a string. ^ at start of pattern WON'T - match at the start of the string! -*/ -void yynewstr(s) - char *s; -{ - lexFP = NULL; - StringToLex = s; - unputCount = 0; -} -#endif /*!FLEX_SCANNER*/ - -#ifdef FLEX_SCANNER -void my_yy_input(buf, result, max_size) - char *buf; - int *result; - int max_size; -{ - int count; - - if (StringToLex != NULL) { - count = 0; - while (*StringToLex != NULLCHAR) { - *buf++ = *StringToLex++; - count++; - } - *result = count; - return; - } else { - count = fread(buf, 1, max_size, yyin); - if (count == 0) { - *result = YY_NULL; - } else { - *result = count; - } - return; - } -} - -static YY_BUFFER_STATE my_file_buffer = NULL; - -/* - Return offset of next pattern in the current file. -*/ -int yyoffset() -{ - int pos = yy_c_buf_p - yy_current_buffer->yy_ch_buf; - - return(ftell(yy_current_buffer->yy_input_file) - - yy_n_chars + pos); -} - - -void yynewstr(s) - char *s; -{ - if (my_file_buffer != NULL) - yy_delete_buffer(my_file_buffer); - StringToLex = s; - my_file_buffer = yy_create_buffer(stdin, YY_BUF_SIZE); - yy_switch_to_buffer(my_file_buffer); -} - -void yynewfile(f) - FILE *f; -{ - if (my_file_buffer != NULL) - yy_delete_buffer(my_file_buffer); - StringToLex = NULL; - my_file_buffer = yy_create_buffer(f, YY_BUF_SIZE); - yy_switch_to_buffer(my_file_buffer); -} -#endif /*FLEX_SCANNER*/ - -int yywrap() -{ - return TRUE; -} - -/* Parse a move from the given string s */ -/* ^ at start of pattern WON'T work here unless using flex */ -ChessMove yylexstr(boardIndex, s) - int boardIndex; - char *s; -{ - ChessMove ret; - char *oldStringToLex; -#ifdef FLEX_SCANNER - YY_BUFFER_STATE buffer, oldBuffer; -#endif - - yyboardindex = boardIndex; - oldStringToLex = StringToLex; - StringToLex = s; -#ifdef FLEX_SCANNER - buffer = yy_create_buffer(stdin, YY_BUF_SIZE); - oldBuffer = YY_CURRENT_BUFFER; - yy_switch_to_buffer(buffer); -#endif /*FLEX_SCANNER*/ - - ret = (ChessMove) yylex(); - -#ifdef FLEX_SCANNER - if (oldBuffer != NULL) - yy_switch_to_buffer(oldBuffer); - yy_delete_buffer(buffer); -#endif /*FLEX_SCANNER*/ - StringToLex = oldStringToLex; - - return ret; -} +%a 10000 +%o 10000 +%e 2000 +%k 2500 +%p 7000 +%n 1000 +%{ +/* + * parser.l -- lex parser of algebraic chess moves for XBoard + * $Id: parser.l,v 2.1 2003/10/27 19:21:00 mann Exp $ + * + * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts. + * Enhancements Copyright 1992-95 Free Software Foundation, Inc. + * + * The following terms apply to Digital Equipment Corporation's copyright + * interest in XBoard: + * ------------------------------------------------------------------------ + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * ------------------------------------------------------------------------ + * + * The following terms apply to the enhanced version of XBoard distributed + * by the Free Software Foundation: + * ------------------------------------------------------------------------ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ------------------------------------------------------------------------ + */ + +/* This parser handles all forms of promotion. + * The parser resolves ambiguous moves by searching and check-testing. + * It also parses comments of the form [anything] or (anything). + * + * [HGM] Parser extensively modified for bigger boards, Shogi-like syntax, + * and unknow pieces. All pieces are now mandatory upper case, but can be + * any letter A-Z. Files must be lower case (as before), but can run upto 'l'. + * Ranks can be 0-9. The parser returns 0 for off-board files and ranks. + * For an unknown piece (as mover or promotion piece) it returns + * IllegalMove, like it does when the piece doesn't match. + * Promotions can now also be appended Shogi-style, a bare '=' or '+', + * and this is then returned as promotion character. The piece indicator + * can be prefixed by a '+' to indicate it is a promoted piece. + */ + +#include "config.h" + +#define NO_CONSTRAINT -1 +#undef YYLMAX +#define YYLMAX 4096 +#define UNPUT_BUF_SIZE YYLMAX + +#ifdef FLEX_SCANNER +/* yytext is probably a char*, but could be a char[]. yy_text is set + in YY_DECL below, because if yytext is a char*, its value is not + constant. */ +char *yy_text; +#else /*!FLEX_SCANNER*/ +/* yytext is definitely a char[], so yy_text can be set here, statically. */ +char *yy_text = (char *) yytext; +#endif + +#ifdef FLEX_SCANNER +/* This is flex */ +#undef YY_INPUT +#define YY_INPUT(buf, result, max_size) my_yy_input(buf, &result, max_size) +#undef YY_DECL +#define YY_DECL \ + int _yylex YY_PROTO((void)); \ + int yylex YY_PROTO((void)) \ + { \ + int result = _yylex(); \ + yy_text = (char *) yytext; \ + return(result); \ + } \ + int _yylex YY_PROTO((void)) +#else +/* This is lex */ +#undef input +#undef output +#undef unput +#endif + +/* The includes must be here, below the #undef input */ + +#include + +#if STDC_HEADERS +# include +# include +#else /* not STDC_HEADERS */ +# if HAVE_STRING_H +# include +# else /* not HAVE_STRING_H */ +# include +# endif /* not HAVE_STRING_H */ +#endif /* not STDC_HEADERS */ + +#if HAVE_UNISTD_H +# include +#endif + +#if defined(_amigados) +# include +# if HAVE_FCNTL_H +# include /* isatty() prototype */ +# endif /* HAVE_FCNTL_H */ +#endif /* defined(_amigados) */ + +#include "common.h" +#include "backend.h" +#include "frontend.h" +#include "parser.h" +#include "moves.h" + +extern int PosFlags P((int)); + +extern Board boards[MAX_MOVES]; +int yyboardindex; +int yyskipmoves = FALSE; +char currentMoveString[YYLMAX]; +#ifndef FLEX_SCANNER +char unputBuffer[UNPUT_BUF_SIZE]; +int unputCount = 0; +#endif + +#ifdef FLEX_SCANNER +void my_yy_input P((char *buf, int *result, int max_size)); +#else /*!FLEX_SCANNER*/ +static int input P((void)); +static void output P((int ch)); +static void unput P((int ch)); +int yylook P((void)); +int yyback P((int *, int)); +#endif +#undef yywrap +int yywrap P((void)); +extern void CopyBoard P((Board to, Board from)); + +%} +%% + +"+"?[A-Z][/]?[a-l][0-9][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|=)? { + /* + * Fully-qualified algebraic move, possibly with promotion + */ + int skip1 = 0, skip2 = 0, skip3 = 0, promoted = 0; + ChessSquare piece; + ChessMove result; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if (yytext[0] == '+') skip1 = skip3 = promoted = 1; /* [HGM] Shogi promoted */ + + /* remove the / */ + if (yytext[1+skip1] == '/') skip1++; + + /* remove the [xX:-] */ + if ((yytext[3+skip1] == 'x') || (yytext[3+skip1] == 'X') || + (yytext[3+skip1] == '-') || (yytext[3+skip1] == ':')) skip2 = 1; + + currentMoveString[0] = yytext[1+skip1]; + currentMoveString[1] = yytext[2+skip1]; + currentMoveString[2] = yytext[3+skip1+skip2]; + currentMoveString[3] = yytext[4+skip1+skip2]; + currentMoveString[4] = NULLCHAR; + + if (yyleng-skip1-skip2 > 5) { char c; + if (yytext[yyleng-1] == ')') { + c = currentMoveString[4] = ToLower(yytext[yyleng-2]); + } else { + c = currentMoveString[4] = ToLower(yytext[yyleng-1]); + } + currentMoveString[5] = NULLCHAR; + if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) + return IllegalMove; /* [HGM] promotion to invalid piece */ + } + + if (appData.debugMode) { + fprintf(debugFP, "parser: %s\n", currentMoveString); + } + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[1] - ONE >= BOARD_HEIGHT || + currentMoveString[1] - ONE < 0 || + currentMoveString[0] - AAA >= BOARD_RGHT || + currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[3] - ONE < 0 || + currentMoveString[2] - AAA >= BOARD_RGHT || + currentMoveString[0] - AAA < BOARD_LEFT || + currentMoveString[2] - AAA < BOARD_LEFT ) + return 0; + + piece = boards[yyboardindex] + [currentMoveString[1] - ONE][currentMoveString[0] - AAA]; + if(promoted) piece = (ChessSquare) (DEMOTED piece); + if (ToLower(yytext[skip3]) != ToLower(PieceToChar(piece))) + return (int) IllegalMove; + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, + initialRights, /* [HGM] assume all castlings allowed */ + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (currentMoveString[4] == NULLCHAR && + (result == WhitePromotionKnight || result == BlackPromotionKnight || + result == WhitePromotionQueen || result == BlackPromotionQueen)) { + currentMoveString[4] = PieceToChar(BlackQueen); + currentMoveString[5] = NULLCHAR; + } + + return (int) result; +} + +[a-l][0-9][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|=)? { + /* + * Simple algebraic move, possibly with promotion + */ + int skip = 0; + ChessMove result; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove the [xX:-] */ + if ((yytext[2] == 'x') || (yytext[2] == 'X') || + (yytext[2] == '-') || (yytext[2] == ':')) skip = 1; + + currentMoveString[0] = yytext[0]; + currentMoveString[1] = yytext[1]; + currentMoveString[2] = yytext[2+skip]; + currentMoveString[3] = yytext[3+skip]; + currentMoveString[4] = NULLCHAR; + + if (yyleng-skip > 4) { char c; + if (yytext[yyleng-1] == ')') { + c = currentMoveString[4] = ToLower(yytext[yyleng-2]); + } else { + c = currentMoveString[4] = ToLower(yytext[yyleng-1]); + } + currentMoveString[5] = NULLCHAR; + if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) + return IllegalMove; + } + + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[1] - ONE >= BOARD_HEIGHT || + currentMoveString[1] - ONE < 0 || + currentMoveString[0] - AAA >= BOARD_RGHT || + currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[3] - ONE < 0 || + currentMoveString[2] - AAA >= BOARD_RGHT || + currentMoveString[0] - AAA < BOARD_LEFT || + currentMoveString[2] - AAA < BOARD_LEFT ) + return 0; + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, + initialRights, /* [HGM] assume all castlings allowed */ + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (currentMoveString[4] == NULLCHAR && + (result == WhitePromotionKnight || result == BlackPromotionKnight || + result == WhitePromotionQueen || result == BlackPromotionQueen)) { + currentMoveString[4] = PieceToChar(BlackQueen); + currentMoveString[5] = NULLCHAR; + } + + return (int) result; +} + +[a-l][0-9]((=?\(?[A-Z]\)?)|=)? { + /* + * Pawn move, possibly with promotion + */ + DisambiguateClosure cl; + int skip = 0; char c; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove the =() */ + if (yytext[2] == '=' && yytext[3] != NULLCHAR) skip++; + if (yytext[2+skip] == '(') skip++; + + cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; + cl.rfIn = -1; + cl.ffIn = yytext[0] - AAA; + cl.rtIn = yytext[1] - ONE; + cl.ftIn = yytext[0] - AAA; + c = cl.promoCharIn = yytext[2+skip]; + + /* [HGM] do not allow values beyond board size */ + if(cl.rtIn >= BOARD_HEIGHT || + cl.rtIn < 0 || + cl.ffIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare) + return IllegalMove; + + + Disambiguate(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + + +(ab|bc|cd|de|ef|fg|gh|hi|ij|jk|kl|lk|kj|ji|ih|hg|gf|fe|ed|dc|cb|ba|aa|bb|cc|dd|ee|ff|gg|hh|ii|jj|kk|ll|([a-l][xX:-][a-l]))((=?\(?[A-Z]\)?)|ep|"e.p."|=)? { + /* + * Pawn capture, possibly with promotion, possibly ambiguous + */ + DisambiguateClosure cl; + int skip1 = 0, skip2 = 0; char c; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove trailing ep or e.p. (nonstandard PGN) */ + if (yytext[yyleng-1] == 'p') { + yyleng -= 2; + yytext[yyleng] = NULLCHAR; + } else if (yytext[yyleng-1] == '.') { + yyleng -= 4; + yytext[yyleng] = NULLCHAR; + } + + /* remove the [xX:-] and =() */ + if ((yytext[1] == 'x') || (yytext[1] == 'X') + || (yytext[1] == ':') || (yytext[1] == '-')) skip1 = 1; + if (yytext[2+skip1] == '=' && yytext[3+skip1] != NULLCHAR) skip2++; + if (yytext[2+skip1+skip2] == '(') skip2++; + + cl.pieceIn = WhiteOnMove(yyboardindex) ? WhitePawn : BlackPawn; + cl.rfIn = -1; + cl.ffIn = yytext[0] - AAA; + cl.rtIn = -1; + cl.ftIn = yytext[1+skip1] - AAA; + c = cl.promoCharIn = yytext[2+skip1+skip2]; + + /* [HGM] do not allow values beyond board size */ + if(cl.ffIn >= BOARD_RGHT || + cl.ffIn < BOARD_LEFT || + cl.ftIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + if(c != '=' && c != '+' && c != NULLCHAR && CharToPiece(c) == EmptySquare) + return IllegalMove; + + Disambiguate(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + +[a-l][xX:]?[a-l][0-9]((=?\(?[A-Z]\)?)|ep|"e.p."|=)? { + /* + * unambiguously abbreviated Pawn capture, possibly with promotion + */ + int skip = 0; + ChessMove result; char c; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* remove trailing ep or e.p. (nonstandard PGN) */ + if (yytext[yyleng-1] == 'p') { + yyleng -= 2; + yytext[yyleng] = NULLCHAR; + } else if (yytext[yyleng-1] == '.') { + yyleng -= 4; + yytext[yyleng] = NULLCHAR; + } + + /* remove the [xX:-] */ + if ((yytext[1] == 'x') || (yytext[1] == 'X') + || (yytext[1] == ':') || (yytext[1] == '-')) skip = 1; + + currentMoveString[0] = yytext[0]; + currentMoveString[2] = yytext[1+skip]; + currentMoveString[3] = yytext[2+skip]; + + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[0] - AAA >= BOARD_RGHT || + currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[3] - ONE < 0 || + currentMoveString[2] - AAA >= BOARD_RGHT || + currentMoveString[0] - AAA < BOARD_LEFT || + currentMoveString[2] - AAA < BOARD_LEFT ) + return 0; + + if (gameInfo.variant == VariantXiangqi && /* [HGM] In Xiangqi rank stays same */ + currentMoveString[0] != currentMoveString[2] ) { + if (yytext[2+skip] == ONE) return (int) ImpossibleMove; + currentMoveString[1] = yytext[2+skip]; + } else + if (WhiteOnMove(yyboardindex)) { + if (yytext[2+skip] == ONE) return (int) ImpossibleMove; + currentMoveString[1] = yytext[2+skip] - 1; + } else { + currentMoveString[1] = currentMoveString[3] + 1; + if (currentMoveString[3] == ONE+BOARD_HEIGHT-1) return (int) ImpossibleMove; + } + if (yyleng-skip > 3) { + if (yytext[yyleng-1] == ')') + c = currentMoveString[4] = ToLower(yytext[yyleng-2]); + else + c = currentMoveString[4] = ToLower(yytext[yyleng-1]); + currentMoveString[5] = NULLCHAR; + if(c != '=' && c != '+' && CharToPiece(c) == EmptySquare) + return IllegalMove; + } else { + currentMoveString[4] = NULLCHAR; + } + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, + initialRights, /* [HGM] assume all castlings allowed */ + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (currentMoveString[4] == NULLCHAR && + (result == WhitePromotionQueen || result == BlackPromotionQueen || + result == WhitePromotionKnight || result == BlackPromotionKnight)) { + currentMoveString[4] = PieceToChar(BlackQueen); + currentMoveString[5] = NULLCHAR; + } + + if (result != IllegalMove) return (int) result; + + /* Special case: improperly written en passant capture */ + if (WhiteOnMove(yyboardindex)) { + if (currentMoveString[3] == '5') { + currentMoveString[1] = '5'; + currentMoveString[3] = '6'; + } else { + return (int) IllegalMove; + } + } else { + if (currentMoveString[3] == '4') { + currentMoveString[1] = '4'; + currentMoveString[3] = '3'; + } else { + return (int) IllegalMove; + } + } + + result = LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, + initialRights, /* [HGM] assume all castlings allowed */ + currentMoveString[1] - ONE, + currentMoveString[0] - AAA, + currentMoveString[3] - ONE, + currentMoveString[2] - AAA, + currentMoveString[4]); + + if (result == WhiteCapturesEnPassant || result == BlackCapturesEnPassant) + return (int) result; + else + return (int) IllegalMove; +} + +"+"?[A-Z][xX:-]?[a-l][0-9]=? { + /* + * piece move, possibly ambiguous + */ + DisambiguateClosure cl; + int skip = 0, skip2 = 0, promoted = 0; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if(yytext[0] == '+') promoted = skip = skip2 = 1; + + /* remove the [xX:-] */ + if ((yytext[1+skip] == 'x') || (yytext[1+skip] == 'X') + || (yytext[1+skip] == ':') || (yytext[1+skip] == '-')) skip++; + + if (WhiteOnMove(yyboardindex)) { + cl.pieceIn = CharToPiece(ToUpper(yytext[skip2])); + } else { + cl.pieceIn = CharToPiece(ToLower(yytext[skip2])); + } + if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn); + + cl.rfIn = -1; + cl.ffIn = -1; + cl.rtIn = yytext[2+skip] - ONE; + cl.ftIn = yytext[1+skip] - AAA; + cl.promoCharIn = NULLCHAR; + + if(yyleng-skip > 3) /* [HGM] can have Shogi-style promotion */ + cl.promoCharIn = yytext[yyleng-1]; + + /* [HGM] but do not allow values beyond board size */ + if(cl.rtIn >= BOARD_HEIGHT || + cl.rtIn < 0 || + cl.ftIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + Disambiguate(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + +"+"?[A-Z][a-l0-9][xX:-]?[a-l][0-9]=? { + /* + * piece move with rank or file disambiguator + */ + DisambiguateClosure cl; + int skip = 0, skip2 = 0; int promoted=0; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if(yytext[0]=='+') promoted = skip = skip2 = 1; + + /* remove the [xX:-] */ + if ((yytext[2+skip] == 'x') || (yytext[2+skip] == 'X') + || (yytext[2+skip] == ':') || (yytext[2+skip] == '-')) skip++; + + if (WhiteOnMove(yyboardindex)) { + cl.pieceIn = CharToPiece(ToUpper(yytext[skip2])); + } else { + cl.pieceIn = CharToPiece(ToLower(yytext[skip2])); + } + if(promoted) cl.pieceIn = (ChessSquare) (PROMOTED cl.pieceIn); + + if (isalpha(yytext[1+skip2])) { + cl.rfIn = -1; + cl.ffIn = yytext[1+skip2] - AAA; + + if(cl.ffIn >= BOARD_RGHT || + cl.ffIn < BOARD_LEFT ) return 0; + } else { + cl.rfIn = yytext[1+skip2] - ONE; + cl.ffIn = -1; + if(cl.rfIn >= BOARD_HEIGHT || + cl.rfIn < 0) return 0; + } + cl.rtIn = yytext[3+skip] - ONE; + cl.ftIn = yytext[2+skip] - AAA; + cl.promoCharIn = NULLCHAR; + + if(yyleng-skip > 4) /* [HGM] can have Shogi-style promotion */ + cl.promoCharIn = yytext[yyleng-1]; + + /* [HGM] do not allow values beyond board size */ + if(cl.rtIn >= BOARD_HEIGHT || + cl.rtIn < 0 || + cl.ftIn >= BOARD_RGHT || + cl.ftIn < BOARD_LEFT ) + return 0; + + Disambiguate(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, &cl); + + currentMoveString[0] = cl.ff + AAA; + currentMoveString[1] = cl.rf + ONE; + currentMoveString[2] = cl.ft + AAA; + currentMoveString[3] = cl.rt + ONE; + currentMoveString[4] = cl.promoChar; + currentMoveString[5] = NULLCHAR; + + return (int) cl.kind; +} + +000|0-0-0|ooo|OOO|o-o-o|O-O-O { + int rf, ff, rt, ft; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + /* [HGM] all squares referenced to board edges in stead of absolute */ + if (WhiteOnMove(yyboardindex)) { + if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { + /* ICS wild castling */ + rf = 0; + ff = (BOARD_WIDTH-1)>>1; + rt = 0; + ft = BOARD_RGHT-3; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } else { + rf = 0; + ff = BOARD_WIDTH>>1; + rt = 0; + ft = BOARD_LEFT+2; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } + } else{ + if (boards[yyboardindex][BOARD_HEIGHT-1][3] == BlackKing) { + /* ICS wild castling */ + rf = BOARD_HEIGHT-1; + ff = (BOARD_WIDTH-1)>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_RGHT-3; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } else { + rf = BOARD_HEIGHT-1; + ff = BOARD_WIDTH>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_LEFT+2; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } + } + return (int) LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, + initialRights, /* [HGM] assume all castlings allowed */ + rf, ff, rt, ft, NULLCHAR); +} + +00|0-0|oo|OO|o-o|O-O { + int rf, ff, rt, ft; + + if (yyskipmoves) return (int) AmbiguousMove; /* not disambiguated */ + + if (WhiteOnMove(yyboardindex)) { + if (boards[yyboardindex][0][(BOARD_WIDTH-1)>>1] == WhiteKing) { + /* ICS wild castling */ + rf = 0; + ff = (BOARD_WIDTH-1)>>1; + rt = 0; + ft = BOARD_LEFT+1; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } else { + rf = 0; + ff = BOARD_WIDTH>>1; + rt = 0; + ft = BOARD_RGHT-2; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } + } else { + if (boards[yyboardindex][BOARD_HEIGHT-1][(BOARD_WIDTH-1)>>1] == BlackKing) { + /* ICS wild castling */ + rf = BOARD_HEIGHT-1; + ff = (BOARD_WIDTH-1)>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_LEFT+1; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } else { + rf = BOARD_HEIGHT-1; + ff = BOARD_WIDTH>>1; + rt = BOARD_HEIGHT-1; + ft = BOARD_RGHT-2; + sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE); + } + } + return (int) LegalityTest(boards[yyboardindex], + PosFlags(yyboardindex), EP_UNKNOWN, + initialRights, /* [HGM] assume all castlings allowed */ + rf, ff, rt, ft, NULLCHAR); +} + +[A-Z][@*][a-l][0-9] { + /* Bughouse piece drop. No legality checking for now. */ + currentMoveString[1] = '@'; + currentMoveString[2] = yytext[2]; + currentMoveString[3] = yytext[3]; + currentMoveString[4] = NULLCHAR; + + if (appData.debugMode) { + fprintf(debugFP, "Drop: %s\n", currentMoveString); + } + /* [HGM] do not allow values beyond board size */ + if(currentMoveString[3] - ONE >= BOARD_HEIGHT || + currentMoveString[2] - AAA >= BOARD_WIDTH ) + return 0; + + if (WhiteOnMove(yyboardindex)) { + currentMoveString[0] = ToUpper(yytext[0]); + return (int) WhiteDrop; + } else { + currentMoveString[0] = ToLower(yytext[0]); + return (int) BlackDrop; + } +} + +[Rr]esign(s|ed)? { + if (WhiteOnMove(yyboardindex)) + return (int) BlackWins; + else + return (int) WhiteWins; +} + +(([Ww](hite)?)|([Bb](lack)?))" "(([Rr]esign)|([Ff]orfeit))(s|ed)? { + return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); +} + +(([Ww](hite)?)|([Bb](lack)?))" "[Dd]isconnect(s|ed) { + return (int) GameUnfinished; +} + +[Ss]talemate { + return (int) GameIsDrawn; +} + +"+-+" { + return (int) GameIsDrawn; +} + +([Cc]heck)?[Mm]ate { + if (WhiteOnMove(yyboardindex)) + return (int) BlackWins; + else + return (int) WhiteWins; +} + +"++" { + if (WhiteOnMove(yyboardindex)) + return (int) BlackWins; + else + return (int) WhiteWins; +} + +[Dd]raw(n)?(" "by)?(" "[Rr]epetition)|(" "[Aa]gree(d|ment)) { + return (int) GameIsDrawn; +} + +[Dd]raw(n)?(" (".*")")? { + return (int) GameIsDrawn; +} + +(([Ww](hite)?)|([Bb](lack)?))" "([Mm]ate(s|ed)?)|([Ww][io]n(s)?.*) { + return (int) (ToUpper(yytext[0]) == 'W' ? WhiteWins : BlackWins); +} + +(([Ww](hite)?)|([Bb](lack)?))" "([Mm]ate(s|ed)?)|([Ll]os[tes]+.*) { + return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins); +} + +("{"[^\}\n]*"} ")?(1-0|"1 - 0"|"1/0"|"1 / 0"|"1:0"|"1 : 0")(" (".*")"|" {".*"}")? { + return (int) WhiteWins; +} + +("{"[^\}\n]*"} ")?(0-1|"0 - 1"|"0/1"|"0 / 1"|"0:1"|"0 : 1")(" (".*")"|" {".*"}")? { + return (int) BlackWins; +} + +("{"[^\}\n]*"} ")?("1/2"|"1 / 2")(" "?[-:]" "?("1/2"|"1 / 2"))?(" (".*")"|" {".*"}")? { + return (int) GameIsDrawn; +} + +("{"[^\}\n]*"} ")?"*"(" (".*")"|" {".*"}")? { + return (int) GameUnfinished; +} + +[1-9][0-9]*/"."?[ \t\n]*[a-lNnPpRrBQqKACFEWDGHOo] { + /* move numbers */ + if ((yyleng == 1) && (yytext[0] == '1')) + return (int) MoveNumberOne; +} + +\([0-9]+:[0-9][0-9](\.[0-9]+)?\)|\{[0-9]+:[0-9][0-9](\.[0-9]+)?\} { + /* elapsed time indication, e.g. (0:12) or {10:21.071} */ + return (int) ElapsedTime; +} + +"[--"[^\]]*"--]" { + /* position diagram enclosed in [-- --] */ + return (int) PositionDiagram; +} + +^"{--------------"\n[^\}]*\n"--------------}"$ { + /* position diagram enclosed in {-- --} */ + return (int) PositionDiagram; +} + +\[[ \t\n]*[A-Za-z0-9][A-Za-z0-9_+#=-]*[ \t\n]*\"[^"]*\"[ \t\n]*\] { + return (int) PGNTag; +} + +[Gg](nu|NU)" "?[Cc](hess|HESS).*[Gg](ame|AME) { + return (int) GNUChessGame; +} + +^[#;%]" "[^ ]*(" game file"|" position file").*$ { + return (int) XBoardGame; +} + +\$[0-9]+ { /* numeric annotation glyph */ + return (int) NAG; +} + +\{[^\}]*\} { /* anything in {} */ + return (int) Comment; +} + +;.*$ { /* ; to end of line */ + return (int) Comment; +} + +\[[^\]]*\] { /* anything in [] */ + return (int) Comment; +} + +\([^()]*(\([^()]*\)[^()]*)+[^()]*\) { /* nested () */ + return (int) Comment; +} + +\([^)][^)]+\) { /* >=2 chars in () */ + return (int) Comment; +} + +^[-a-zA-Z0-9]+:" ".*(\n[ \t]+.*)* { + /* Skip mail headers */ +} + +[a-zA-Z0-9'-]+ { + /* Skip random words */ +} + +.|\n { + /* Skip everything else */ +} + +%% + + +static char *StringToLex; + +#ifndef FLEX_SCANNER +static FILE *lexFP; + +static int input() +{ + int ret; + + if (StringToLex != NULL) { + ret = *StringToLex; + if (ret == NULLCHAR) + ret = EOF; + else + StringToLex++; + } else if (unputCount > 0) { + ret = unputBuffer[--unputCount]; + } else { + ret = fgetc(lexFP); + } + + if (ret == EOF) + return 0; + else + return ret; +} + +/* + * Return offset of next pattern within current file + */ +int yyoffset() +{ + int offset = ftell(lexFP) - unputCount; + + if (offset < 0) { + offset = 0; + } + return(offset); +} + +static void output(ch) + int ch; +{ + fprintf(stderr, "PARSER BUG: unmatched character '%c' (0%o)\n", + ch, ch); +} + +static void unput(ch) + int ch; +{ + if (ch == 0) return; + if (StringToLex != NULL) { + StringToLex--; + } else { + if (unputCount >= UNPUT_BUF_SIZE) + fprintf(stderr, "PARSER BUG: unput buffer overflow '%c' (0%o)\n", + ch, ch); + unputBuffer[unputCount++] = ch; + } +} + +/* Get ready to lex from a new file. Kludge below sticks + an artificial newline at the front of the file, which the + above grammar ignores, but which makes ^ at start of pattern + match at the real start of the file. +*/ +void yynewfile(f) + FILE *f; +{ + lexFP = f; + StringToLex = NULL; + unputCount = 0; + unput('\n'); /* kludge */ +} + +/* Get ready to lex from a string. ^ at start of pattern WON'T + match at the start of the string! +*/ +void yynewstr(s) + char *s; +{ + lexFP = NULL; + StringToLex = s; + unputCount = 0; +} +#endif /*!FLEX_SCANNER*/ + +#ifdef FLEX_SCANNER +void my_yy_input(buf, result, max_size) + char *buf; + int *result; + int max_size; +{ + int count; + + if (StringToLex != NULL) { + count = 0; + while (*StringToLex != NULLCHAR) { + *buf++ = *StringToLex++; + count++; + } + *result = count; + return; + } else { + count = fread(buf, 1, max_size, yyin); + if (count == 0) { + *result = YY_NULL; + } else { + *result = count; + } + return; + } +} + +static YY_BUFFER_STATE my_file_buffer = NULL; + +/* + Return offset of next pattern in the current file. +*/ +int yyoffset() +{ + int pos = yy_c_buf_p - yy_current_buffer->yy_ch_buf; + + return(ftell(yy_current_buffer->yy_input_file) - + yy_n_chars + pos); +} + + +void yynewstr(s) + char *s; +{ + if (my_file_buffer != NULL) + yy_delete_buffer(my_file_buffer); + StringToLex = s; + my_file_buffer = yy_create_buffer(stdin, YY_BUF_SIZE); + yy_switch_to_buffer(my_file_buffer); +} + +void yynewfile(f) + FILE *f; +{ + if (my_file_buffer != NULL) + yy_delete_buffer(my_file_buffer); + StringToLex = NULL; + my_file_buffer = yy_create_buffer(f, YY_BUF_SIZE); + yy_switch_to_buffer(my_file_buffer); +} +#endif /*FLEX_SCANNER*/ + +int yywrap() +{ + return TRUE; +} + +/* Parse a move from the given string s */ +/* ^ at start of pattern WON'T work here unless using flex */ +ChessMove yylexstr(boardIndex, s) + int boardIndex; + char *s; +{ + ChessMove ret; + char *oldStringToLex; +#ifdef FLEX_SCANNER + YY_BUFFER_STATE buffer, oldBuffer; +#endif + + yyboardindex = boardIndex; + oldStringToLex = StringToLex; + StringToLex = s; +#ifdef FLEX_SCANNER + buffer = yy_create_buffer(stdin, YY_BUF_SIZE); + oldBuffer = YY_CURRENT_BUFFER; + yy_switch_to_buffer(buffer); +#endif /*FLEX_SCANNER*/ + + ret = (ChessMove) yylex(); + +#ifdef FLEX_SCANNER + if (oldBuffer != NULL) + yy_switch_to_buffer(oldBuffer); + yy_delete_buffer(buffer); +#endif /*FLEX_SCANNER*/ + StringToLex = oldStringToLex; + + return ret; +} diff --git a/readme_HGM.txt b/readme_HGM.txt index 63d27d4..5769521 100644 --- a/readme_HGM.txt +++ b/readme_HGM.txt @@ -1,3 +1,97 @@ +Winboard_F.4.3.7 release notes + +This Winboard supports the following new options (shown here with their default values): + +/variant=normal +This (already existing) option has been expanded with several new variants, involving non-conventional pieces and deviating board sizes. The board size is automatically adapted to the selected variant, unless explicitly overruled (see below). The new variants are (with default board size, files x ranks, in parentheses): + +variant name Game board description +knightmate Knightmate (8x8) Variant where the King moves as a Knight, and vice versa +capablanca Capablanca Chess (10x8) Variant featuring Archbishop and Chancellor as new pieces +gothic Gothic Chess (10x8) Same as Capablanca, with a more interesting opening position +courier Courier Chess (12x8) a Medieval form that combines elements of Shatranj and modern Chess +shogi Shogi (9x9) Japanese Chess +xiangqi Xiangqi (9x10) Chinese Chess +fairy Fairy Chess (8x8) Variant were you can use all pieces of other variants together + +The variant can be set from the newly added "File -> New Variant..." sub-menu. +Extra board files are indicated by the letters i, j, k, l, ... For boards with more than 9 ranks, the counting starts at zero! Non-FIDE pieces will be referred to in FENs and PGN by letters that depend on the variant, and might collide with piece designators in other variants. E.g. in Xiangqi 'C' is a Cannon, in Capablanca Chess it is a Chancellor. Pieces that do not belong in a variant cannot be addressed in FEN and PGN either as long as that variant is selected, unless the letter assignment is overruled by the /pieceToCharTable option. The variant is not saved in the winboard.ini file; on start-up we always get variant "normal" unless we use the command-line opton, or have added the option to the winboard.ini file manually (in which case it will disappear when this file is overwritten). +WinBoard_F knows the movement of all pieces occurring in Capablanca Chess (of which FIDE Chess is a subset), Shatranj, Courier, Xiangqi and 9x9 Shogi, so that these games can be played with legality testing enabled. + +/pieceToCharTable="PNBRQFWEMOUHACGSKpnbrqfwemouhacgsk" +Each piece that WinBoard knows (in its legality test) has a letter associated with it, by which it will be referred to in FEN or PGN. The default assignment can be overruled with this option. The value has to be a string of even length, with at least 12 characters. The first half of the string designates the white pieces, the second half the black. +The last letter for each color will be assigned to the King. (This is the piece that moves as an orthodox King; note that Nightmate and Xiangqi have a different royal piece.) All letters before it will be assigned to the other pieces in the order: + +P Pawn (move often depends on variant) +N Knight (move subtly different in Xiangqi (where it is written as H) or Shogi) +B Bishop +R Rook +Q Queen (Lance L in Shogi) +F Ferz/General (Silver General S in Shogi) +W Wazir/GrandVizer (Gold General G in Shogi, in Xiangqi it is royal and denoted by K) +E Alfil/Elephant (Moves subtly different in Xiangqi vs Shatranj/Courier) +M Commoner/Man +O Cannon/Pao +U Unicorn (representation of Royal Knight in Knightmate, used as promoted Pawn in Shogi) +H Nightrider (Promoted Knight in Shogi and CrazyHouse) +A Archbishop/Cardinal (Promoted Bishop in Shogi and CrazyHouse) +C Chancellor/Marshall (Promoted Rook in Shogi and CrazyHouse) +G Grasshopper (Promoted Queen in Crazyhouse, promoted Lance in Shogi) +S (Promoted Silver in Shogi) +K King + +Pieces that are not mentioned (because the argument has less than 34 characters) will remain disabled. Mentioned pieces can be disabled by assigning them a '.' (period). They are then not recognized in FEN or PGN input. It is not advisable to disable a piece that is present in the opening position of the selected variant, though. +Promoted pieces that need to be distinguished from original pieces of the same type (because of demotion on capture and transfer to the holdings) will be indicated by the letter for the unpromoted piece with a '+' in front of it (Shogi), or by the letter of the promoted piece with a '~' after it (Crazyhouse, Bughouse, in general everything with holdings that is not Shogi). +All the new pieces have a native biytmap representation in the board sizes 'bulky' and 'middling'. For all window sizes that do not support such fairy bitmaps, promoted NBRQ are represented as a 2-sizes-smaller normal piece symbol, so that Crazyhouse can be played at any size. People disliking the fairy representations might even prefer that. +There is an enhanced 'Edit Position' menu popup (right-clicking on the squares after selecting this mode in the main menu), featuring some common non-FIDE pieces, and 'promote' and 'demote' options to make those not directly in the menu. The promotion popup shows ArchBishop and Chancellor in Capablanca and Gothic, (or in fact in any game where this piece is not disabled), and leaves only the options YES / NO in Shogi. In Xiangqi there are no promotions. + +/fontPieceToCharTable="PNBRQFWEMOUHACGSKpnbrqfwemouhacgsk" +This option is similar to /pieceToCharTable, but sets the font character that is used to display the piece on the screen (when font-based rendering is in use), rather than in the FEN or PGN. The default setting should work with the WinboardF font, which uses the 'intuitive' mapping of font characters to symbols. +Note that UHACGS are also used to represent the promoted versions of PNBRQF, in games like Crazyhouse and Shogi, where the promotion has to be undone on capture. + +/boardWidth=-1 /boardHeight=-1 +Set a number of files and ranks of the playing board to a value that will override the defaults for the variant that is selected. A value of -1 means the variant default board size will be used for the corresponding parameter (and is itself the default value of these options). These parameters can be set in the "Files -> New Variant..." sub-menu, where they are reset to the default -1 is you OK the chosen variant without typing something to overrule it. These parameters are saved in the winboard.ini file. (But unless you saved while a variant with board-size override was selected, they will always be saved as -1.) +A variant with a non-standard board size will be communicated to the engine(s) with the board size prefixed to the variant name, e.g. "variant 12x8_capablanca". In protocol 2 the engine must first enable this feature by sending "boardsizeFxR" amongst the accepted variants, where F is the maximum number of files, and R the maximum number of ranks, as decimal numbers. + +/holdingsSize=-1 +Set the size of the holdings for dropable pieces to a value that will override the default for the variant that is selected. A value of -1 means the variant default holdings size will be used for that parameter (and is itself the default value of this options). This parameter can be set in the Files -> New Variant... sub-menu, where it is reset to the default -1 is you OK the chosen variant without typing something to overrule it. This parameters is saved in the winboard.ini file. +To disable holdings, set their size to 0. They will then not be displayed. For non-zero holding size N, the holdings are displayed left and right of the board, and piece drops can be effected by dragging pieces from the holdings to the drop square. In bughouse, the holdings will be filled by the ICS. In all other variants, captured pieces will go into the holdings (after reversing their color). Only the first N pieces of the /pieceToCharTable argument will go into the holdings. All other pieces will be converted to Pawns. (In Shogi, however they will be demoted in the regular way before determining if they fit.) Pieces that are disabled (per default and per /pieceToCharTable option) might not be counted when determining what are the first N pieces. +Non-standard holdingsize will be communicated to the engine by prefixing it (together with the board size, even if this is standard) to the variant name, e.g. "variant 7x7+5_shogi". In protocol 2 the engine should enable this feature by sending "holdingsH" amongst the variant names, where H is the maximum acceptable holdings size as a decimal number. + +/alphaRank=FALSE +When this parameter is true, a-h are converted to 1-9, and vice versa, in all move output and input (to PGN files or SAN move display as well as in communication with the engine). This might be useful for Shogi, where conventionally one uses letters to designate ranks, and digits to designate files. Engines that want to use this option must make sure pieces are never represented by lower case! This option can be set from the Files -> New Variant... menu, where it defaults to FALSE unless you explicitly set it. It is not saved in the winboard.ini file. +Note that the PGN format in Shogi also leaves out the trailing '+' as check indicator: In Shogi such a trailing '+' means promotion, while a trailing '=' means defer promotion. Prefix '+' signs are used on moves with promoted pieces, disambiguation is done western SAN style. + +/allWhite=FALSE +Causes the outline of the 'white' pieces to be superimposed onto the 'black' piece symbols as well (as a black outline) when native bitmaps are used (as opposed to font-based rendering). This is useful if we choose a very light color to represent the 'black' pieces. It might be particularly useful in Shogi, where the conventional representation of the 'black' pieces is as upside-down white pieces, so that both colors would be white. This option is saved in the winboard.ini file, and can be set in the "Options -> Board..." sub-menu. + +/flipBlack=FALSE +This option is reserved for future use. It will cause upside-down display of the 'black' native piece bitmaps, as would be needed for Shogi. For now it can be set from the "Options -> Board..." sub-menu, and it is saved in the winboard.ini file, but it is ignored. + +/detectMate=TRUE +/testClaim=TRUE +/materialDraws=TRUE +/trivialDraws=FALSE +/ruleMoves=51 +/repeatsToDraw=6 +These are all options that only affect engine-engine play, and can be set from the "Options -> Engine..." sub-menu. They are all related to adjudication of games by the GUI. Legality checking must be switched on for them to work. +If /detectMate is TRUE, the GUI recognizes checkmate and stalemate (but not in games with holdings!), and ends the game accordingly before the engines can claim. This is convenient for play with engines that fail to claim, and just exit. +With /testClaim set, all result and illegal-move claims by engines that claim more than their own loss are scrutinized for validity, and false claims result in forfeit of the game. Useful with buggy engines. +The option /materialDraws=TRUE causes games with insufficient mating material to be adjudicated immediately as draws, in case the engines would not claim them. +The option /trivialDraws adjudicates KNNK, KBKB, KNKN, KBKN, KRKR and KQKQ to draws after 3 moves (to allow for a quick tactical win. Note that in KQKQ this might not be sound, but that problem would disappear once bitbase probing is added). +The /ruleMoves determine after how many reversible moves the game is adjudicated as a draw. Setting this to 0 turns this option off. Draw claims by the engine are still accepted (by /testClaim) after 50 reversible moves, even if /ruleMoves species a larger number. Note that it is perfectly legal according to FIDE rules to play on after 50 reversible moves, but in tournaments having two engines that want to play on forever is a nuisance in endings like KBNKR, where one of the engines thinks it is ahead and can avoids repeats virtually forever. +The option /repeatsToDraw makes the GUI adjudicate a game as draw after the same position has occurred the specified number of times. If it is set to a value > 3, engines can still claim the draw after 3-fold repeat. +All these options are saved in the winboard.ini file. + +/matchPause=10000 +Determines the number of milliseconds that is paused between two games of a match. Saved in the Winboard.ini. + +Clocks +There is an "Options -> flip Clocks" command, that swaps the position of white and black clocks (convenient in over-the-board matches, where the screen is next to the board, and you want your own time to be displayed on your side of the screen). The clocks can be adjusted in "edit game" mode: right-clicking them adds one minute, left-clicking subtracts one minute. (Also for OTB matches, to keep them synchronized with the official match clock.) The flag-fell condition is now indicated as (!) behind the time. + +Other improvements +Castling rights and e.p. rights are now fully maintained, and considered in legality testing. They are imported from and written to FEN, as is the 50-move counter. +------------------------------------------------------------------- These are the release notes of Winboard_F 4.3.2, which is released under the GPL. This version was derived from Allessandro Scotti's Winboard_x 4.2.7 source files. diff --git a/winboard/resource.h b/winboard/resource.h index 67f2932..8c4ba3e 100644 --- a/winboard/resource.h +++ b/winboard/resource.h @@ -131,6 +131,22 @@ #define DP_Bishop 618 #define DP_Rook 619 #define DP_Queen 620 + +#define EP_WhiteCardinal 630 +#define EP_WhiteMarshall 631 +#define EP_WhiteAlfil 632 +#define EP_WhiteCannon 633 +#define EP_WhiteFerz 634 +#define EP_WhiteWazir 635 +#define EP_BlackCardinal 640 +#define EP_BlackMarshall 641 +#define EP_BlackAlfil 642 +#define EP_BlackCannon 643 +#define EP_BlackFerz 644 +#define EP_BlackWazir 645 +#define EP_Promote 650 +#define EP_Demote 651 + #define DLG_LoadOptions 700 #define DLG_SaveOptions 800 #define OPT_PGN 802 @@ -445,6 +461,9 @@ #define IDC_TrivialDraws 1603 #define IDC_RuleMoves 1604 #define IDC_DrawRepeats 1605 +#define IDM_FlipClock 1700 +#define OPT_AllWhite 1701 +#define OPT_UpsideDown 1702 #define IDC_STATIC -1 // Next default values for new objects diff --git a/winboard/winboard.c b/winboard/winboard.c index 21460fd..7369520 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -92,6 +92,7 @@ void InitEngineUCI( const char * iniDir, ChessProgramState * cps ); void mysrandom(unsigned int seed); extern int whiteFlag, blackFlag; +Boolean flipClock = FALSE; void DisplayHoldingsCount(HDC hdc, int x, int y, int align, int copyNumber); @@ -137,7 +138,7 @@ char installDir[MSG_SIZ]; BoardSize boardSize; BOOLEAN chessProgram; static int boardX, boardY, consoleX, consoleY, consoleW, consoleH; -static int squareSize, lineGap; +static int squareSize, lineGap, minorSize; static int winWidth, winHeight; static RECT messageRect, whiteRect, blackRect; static char messageText[MESSAGE_TEXT_MAX]; @@ -423,7 +424,7 @@ VOID EngineOutputPopDown(); BOOL EngineOutputIsUp(); VOID EngineOutputUpdate( FrontEndProgramStats * stats ); -VOID GothicPopUp(char *title); +VOID GothicPopUp(char *title, char up); /* * Setting "frozen" should disable all user input other than deleting * the window. We do this while engines are initializing themselves. @@ -694,13 +695,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine) if( gameInfo.variant != VariantFischeRandom ) { EnableMenuItem( GetMenu(hwndMain), IDM_NewGameFRC, MF_GRAYED ); } -#ifdef FAIRY -#ifdef GOTHIC - /* [HGM] Gothic licensing requirement */ - if(gameInfo.variant == VariantGothic) - GothicPopUp(GOTHIC); -#endif // GOTHIC -#endif // FAIRY + if (hwndConsole) { #if AOT_CONSOLE SetWindowPos(hwndConsole, alwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, @@ -1171,8 +1166,11 @@ ArgDescriptor argDescriptors[] = { { "boardWidth", ArgInt, (LPVOID) &appData.NrFiles, TRUE }, { "boardHeight", ArgInt, (LPVOID) &appData.NrRanks, TRUE }, { "holdingsSize", ArgInt, (LPVOID) &appData.holdingsSize, TRUE }, - { "matchPause", ArgInt, (LPVOID) &appData.matchPause, FALSE }, - { "alphaRank", ArgBoolean, (LPVOID) &appData.alphaRank, TRUE }, + { "matchPause", ArgInt, (LPVOID) &appData.matchPause, TRUE }, + { "pieceToCharTable", ArgString, (LPVOID) &appData.pieceToCharTable, FALSE }, + { "flipBlack", ArgBoolean, (LPVOID) &appData.allWhite, TRUE }, + { "allWhite", ArgBoolean, (LPVOID) &appData.allWhite, TRUE }, + { "alphaRank", ArgBoolean, (LPVOID) &appData.alphaRank, FALSE }, { "testClaims", ArgBoolean, (LPVOID) &appData.testClaims, TRUE }, { "checkMates", ArgBoolean, (LPVOID) &appData.checkMates, TRUE }, { "materialDraws", ArgBoolean, (LPVOID) &appData.materialDraws, TRUE }, @@ -1896,6 +1894,8 @@ InitAppData(LPSTR lpCmdLine) appData.drawRepeats = 6; appData.matchPause = 10000; appData.alphaRank = FALSE; + appData.allWhite = FALSE; + appData.upsideDown = FALSE; #ifdef ZIPPY appData.zippyTalk = ZIPPY_TALK; @@ -2300,36 +2300,32 @@ enum { PM_WB = (int) WhiteBishop, PM_WR = (int) WhiteRook, PM_WQ = (int) WhiteQueen, -#ifdef FAIRY PM_WF = (int) WhiteFerz, PM_WW = (int) WhiteWazir, PM_WE = (int) WhiteAlfil, + PM_WM = (int) WhiteMan, + PM_WO = (int) WhiteCannon, + PM_WU = (int) WhiteUnicorn, PM_WH = (int) WhiteNightrider, PM_WA = (int) WhiteCardinal, PM_WC = (int) WhiteMarshall, PM_WG = (int) WhiteGrasshopper, - PM_WO = (int) WhiteCannon, - PM_WM = (int) WhiteMan, - PM_WU = (int) WhiteUnicorn, -#endif PM_WK = (int) WhiteKing, PM_BP = (int) BlackPawn, PM_BN = (int) BlackKnight, PM_BB = (int) BlackBishop, PM_BR = (int) BlackRook, PM_BQ = (int) BlackQueen, -#ifdef FAIRY PM_BF = (int) BlackFerz, PM_BW = (int) BlackWazir, PM_BE = (int) BlackAlfil, + PM_BM = (int) BlackMan, + PM_BO = (int) BlackCannon, + PM_BU = (int) BlackUnicorn, PM_BH = (int) BlackNightrider, PM_BA = (int) BlackCardinal, PM_BC = (int) BlackMarshall, PM_BG = (int) BlackGrasshopper, - PM_BO = (int) BlackCannon, - PM_BM = (int) BlackMan, - PM_BU = (int) BlackUnicorn, -#endif PM_BK = (int) BlackKing }; @@ -2339,36 +2335,13 @@ static HBITMAP hPieceFace[(int) EmptySquare]; static int fontBitmapSquareSize = 0; static char pieceToFontChar[(int) EmptySquare] = { 'p', 'n', 'b', 'r', 'q', -#ifdef FAIRY 'n', 'b', 'p', 'n', 'b', 'r', 'b', 'r', 'q', 'k', -#endif 'k', 'o', 'm', 'v', 't', 'w', -#ifdef FAIRY 'v', 't', 'o', 'm', 'v', 't', 'v', 't', 'w', 'l', -#endif 'l' }; -static BOOL SetPieceToFontCharTable( const char * map ) -{ - BOOL result = FALSE; int NrPieces; - - if( map != NULL && (NrPieces=strlen(map)) <= (int) EmptySquare - && NrPieces >= 12 && !(NrPieces&1)) { - int i; /* [HGM] Accept even length from 12 to 32 */ - - for( i=0; i<(int) EmptySquare; i++ ) pieceToFontChar[i] = 0; - for( i=0; i= 0 && appData.overrideLineGap <= 5 ) { lineGap = appData.overrideLineGap; @@ -3085,7 +3057,12 @@ InitDrawingSizes(BoardSize boardSize, int flags) } } - if (boardSize == oldBoardSize) return; +#ifdef GOTHIC + /* [HGM] Gothic licensing requirement */ + GothicPopUp( GOTHIC, gameInfo.variant == VariantGothic ); +#endif + +/* if (boardSize == oldBoardSize) return; [HGM] variant might have changed */ oldBoardSize = boardSize; oldTinyLayout = tinyLayout; @@ -3103,21 +3080,26 @@ InitDrawingSizes(BoardSize boardSize, int flags) pieceBitmap[0][WhiteKnight] = DoLoadBitmap(hInst, "n", squareSize, "s"); pieceBitmap[0][WhiteBishop] = DoLoadBitmap(hInst, "b", squareSize, "s"); pieceBitmap[0][WhiteRook] = DoLoadBitmap(hInst, "r", squareSize, "s"); - pieceBitmap[0][WhiteQueen] = DoLoadBitmap(hInst, "q", squareSize, "s"); pieceBitmap[0][WhiteKing] = DoLoadBitmap(hInst, "k", squareSize, "s"); pieceBitmap[1][WhitePawn] = DoLoadBitmap(hInst, "p", squareSize, "o"); pieceBitmap[1][WhiteKnight] = DoLoadBitmap(hInst, "n", squareSize, "o"); pieceBitmap[1][WhiteBishop] = DoLoadBitmap(hInst, "b", squareSize, "o"); pieceBitmap[1][WhiteRook] = DoLoadBitmap(hInst, "r", squareSize, "o"); - pieceBitmap[1][WhiteQueen] = DoLoadBitmap(hInst, "q", squareSize, "o"); pieceBitmap[1][WhiteKing] = DoLoadBitmap(hInst, "k", squareSize, "o"); pieceBitmap[2][WhitePawn] = DoLoadBitmap(hInst, "p", squareSize, "w"); pieceBitmap[2][WhiteKnight] = DoLoadBitmap(hInst, "n", squareSize, "w"); pieceBitmap[2][WhiteBishop] = DoLoadBitmap(hInst, "b", squareSize, "w"); pieceBitmap[2][WhiteRook] = DoLoadBitmap(hInst, "r", squareSize, "w"); - pieceBitmap[2][WhiteQueen] = DoLoadBitmap(hInst, "q", squareSize, "w"); pieceBitmap[2][WhiteKing] = DoLoadBitmap(hInst, "k", squareSize, "w"); -#ifdef FAIRY + if( !strcmp(appData.variant, "shogi") && (squareSize==72 || squareSize==49)) { + pieceBitmap[0][WhiteQueen] = DoLoadBitmap(hInst, "l", squareSize, "s"); + pieceBitmap[1][WhiteQueen] = DoLoadBitmap(hInst, "l", squareSize, "o"); + pieceBitmap[2][WhiteQueen] = DoLoadBitmap(hInst, "l", squareSize, "w"); + } else { + pieceBitmap[0][WhiteQueen] = DoLoadBitmap(hInst, "q", squareSize, "s"); + pieceBitmap[1][WhiteQueen] = DoLoadBitmap(hInst, "q", squareSize, "o"); + pieceBitmap[2][WhiteQueen] = DoLoadBitmap(hInst, "q", squareSize, "w"); + } if(squareSize==72 || squareSize==49) { /* experiment with some home-made bitmaps */ pieceBitmap[0][WhiteFerz] = DoLoadBitmap(hInst, "f", squareSize, "s"); pieceBitmap[1][WhiteFerz] = DoLoadBitmap(hInst, "f", squareSize, "o"); @@ -3125,43 +3107,46 @@ InitDrawingSizes(BoardSize boardSize, int flags) pieceBitmap[0][WhiteWazir] = DoLoadBitmap(hInst, "w", squareSize, "s"); pieceBitmap[1][WhiteWazir] = DoLoadBitmap(hInst, "w", squareSize, "o"); pieceBitmap[2][WhiteWazir] = DoLoadBitmap(hInst, "w", squareSize, "w"); - if(!strcmp(appData.variant, "shogi")) { /* promoted Gold represemtations */ - pieceBitmap[0][WhiteAlfil] = DoLoadBitmap(hInst, "wp", squareSize, "s"); - pieceBitmap[1][WhiteAlfil] = DoLoadBitmap(hInst, "wp", squareSize, "o"); - pieceBitmap[2][WhiteAlfil] = DoLoadBitmap(hInst, "w", squareSize, "w"); + pieceBitmap[0][WhiteAlfil] = DoLoadBitmap(hInst, "e", squareSize, "s"); + pieceBitmap[1][WhiteAlfil] = DoLoadBitmap(hInst, "e", squareSize, "o"); + pieceBitmap[2][WhiteAlfil] = DoLoadBitmap(hInst, "e", squareSize, "w"); + pieceBitmap[0][WhiteMan] = DoLoadBitmap(hInst, "m", squareSize, "s"); + pieceBitmap[1][WhiteMan] = DoLoadBitmap(hInst, "m", squareSize, "o"); + pieceBitmap[2][WhiteMan] = DoLoadBitmap(hInst, "m", squareSize, "w"); + pieceBitmap[0][WhiteCannon] = DoLoadBitmap(hInst, "o", squareSize, "s"); + pieceBitmap[1][WhiteCannon] = DoLoadBitmap(hInst, "o", squareSize, "o"); + pieceBitmap[2][WhiteCannon] = DoLoadBitmap(hInst, "o", squareSize, "w"); + pieceBitmap[0][WhiteCardinal] = DoLoadBitmap(hInst, "a", squareSize, "s"); + pieceBitmap[1][WhiteCardinal] = DoLoadBitmap(hInst, "a", squareSize, "o"); + pieceBitmap[2][WhiteCardinal] = DoLoadBitmap(hInst, "a", squareSize, "w"); + if(gameInfo.variant == VariantShogi) { /* promoted Gold represemtations */ + pieceBitmap[0][WhiteUnicorn] = DoLoadBitmap(hInst, "wp", squareSize, "s"); + pieceBitmap[1][WhiteUnicorn] = DoLoadBitmap(hInst, "wp", squareSize, "o"); + pieceBitmap[2][WhiteUnicorn] = DoLoadBitmap(hInst, "w", squareSize, "w"); pieceBitmap[0][WhiteNightrider] = DoLoadBitmap(hInst, "wn", squareSize, "s"); pieceBitmap[1][WhiteNightrider] = DoLoadBitmap(hInst, "wn", squareSize, "o"); pieceBitmap[2][WhiteNightrider] = DoLoadBitmap(hInst, "w", squareSize, "w"); - pieceBitmap[0][WhiteCannon] = DoLoadBitmap(hInst, "wl", squareSize, "s"); - pieceBitmap[1][WhiteCannon] = DoLoadBitmap(hInst, "wl", squareSize, "o"); - pieceBitmap[2][WhiteCannon] = DoLoadBitmap(hInst, "w", squareSize, "w"); - pieceBitmap[0][WhiteGrasshopper] = DoLoadBitmap(hInst, "ws", squareSize, "s"); - pieceBitmap[1][WhiteGrasshopper] = DoLoadBitmap(hInst, "ws", squareSize, "o"); + pieceBitmap[0][WhiteSilver] = DoLoadBitmap(hInst, "ws", squareSize, "s"); + pieceBitmap[1][WhiteSilver] = DoLoadBitmap(hInst, "ws", squareSize, "o"); + pieceBitmap[2][WhiteSilver] = DoLoadBitmap(hInst, "w", squareSize, "w"); + pieceBitmap[0][WhiteGrasshopper] = DoLoadBitmap(hInst, "wl", squareSize, "s"); + pieceBitmap[1][WhiteGrasshopper] = DoLoadBitmap(hInst, "wl", squareSize, "o"); pieceBitmap[2][WhiteGrasshopper] = DoLoadBitmap(hInst, "w", squareSize, "w"); } else { - pieceBitmap[0][WhiteAlfil] = DoLoadBitmap(hInst, "e", squareSize, "s"); - pieceBitmap[1][WhiteAlfil] = DoLoadBitmap(hInst, "e", squareSize, "o"); - pieceBitmap[2][WhiteAlfil] = DoLoadBitmap(hInst, "e", squareSize, "w"); + pieceBitmap[0][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "s"); + pieceBitmap[1][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "o"); + pieceBitmap[2][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "w"); pieceBitmap[0][WhiteNightrider] = DoLoadBitmap(hInst, "h", squareSize, "s"); pieceBitmap[1][WhiteNightrider] = DoLoadBitmap(hInst, "h", squareSize, "o"); pieceBitmap[2][WhiteNightrider] = DoLoadBitmap(hInst, "h", squareSize, "w"); - pieceBitmap[0][WhiteCardinal] = DoLoadBitmap(hInst, "a", squareSize, "s"); - pieceBitmap[1][WhiteCardinal] = DoLoadBitmap(hInst, "a", squareSize, "o"); - pieceBitmap[2][WhiteCardinal] = DoLoadBitmap(hInst, "a", squareSize, "w"); - pieceBitmap[0][WhiteCannon] = DoLoadBitmap(hInst, "o", squareSize, "s"); - pieceBitmap[1][WhiteCannon] = DoLoadBitmap(hInst, "o", squareSize, "o"); - pieceBitmap[2][WhiteCannon] = DoLoadBitmap(hInst, "o", squareSize, "w"); pieceBitmap[0][WhiteGrasshopper] = DoLoadBitmap(hInst, "g", squareSize, "s"); pieceBitmap[1][WhiteGrasshopper] = DoLoadBitmap(hInst, "g", squareSize, "o"); pieceBitmap[2][WhiteGrasshopper] = DoLoadBitmap(hInst, "g", squareSize, "w"); + pieceBitmap[0][WhiteSilver] = DoLoadBitmap(hInst, "l", squareSize, "s"); + pieceBitmap[1][WhiteSilver] = DoLoadBitmap(hInst, "l", squareSize, "o"); + pieceBitmap[2][WhiteSilver] = DoLoadBitmap(hInst, "l", squareSize, "w"); } - pieceBitmap[0][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "s"); - pieceBitmap[1][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "o"); - pieceBitmap[2][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "w"); - pieceBitmap[0][WhiteMan] = DoLoadBitmap(hInst, "m", squareSize, "s"); - pieceBitmap[1][WhiteMan] = DoLoadBitmap(hInst, "m", squareSize, "o"); - pieceBitmap[2][WhiteMan] = DoLoadBitmap(hInst, "m", squareSize, "w"); - if(strcmp(appData.variant, "crazyhouse") && strcmp(appData.variant, "shogi")) { + if(gameInfo.variant != VariantCrazyhouse && gameInfo.variant != VariantShogi) { pieceBitmap[0][WhiteMarshall] = DoLoadBitmap(hInst, "c", squareSize, "s"); pieceBitmap[1][WhiteMarshall] = DoLoadBitmap(hInst, "c", squareSize, "o"); pieceBitmap[2][WhiteMarshall] = DoLoadBitmap(hInst, "c", squareSize, "w"); @@ -3170,17 +3155,22 @@ InitDrawingSizes(BoardSize boardSize, int flags) pieceBitmap[1][WhiteMarshall] = DoLoadBitmap(hInst, "dk", squareSize, "o"); pieceBitmap[2][WhiteMarshall] = DoLoadBitmap(hInst, "dk", squareSize, "w"); } - if(!strcmp(appData.variant, "xiangqi") || !strcmp(appData.variant, "shogi")) { - for(i=0; i<2; i++) - if (pieceBitmap[i][WhiteQueen] != NULL) - DeleteObject(pieceBitmap[i][WhiteQueen]); - pieceBitmap[0][WhiteQueen] = DoLoadBitmap(hInst, "o", squareSize, "s"); - pieceBitmap[1][WhiteQueen] = DoLoadBitmap(hInst, "o", squareSize, "o"); - pieceBitmap[2][WhiteQueen] = DoLoadBitmap(hInst, "o", squareSize, "w"); - } + } else { /* other size, no special bitmaps available. Use smaller symbols */ + if((int)boardSize < 2) minorSize = sizeInfo[0].squareSize; + else minorSize = sizeInfo[(int)boardSize - 2].squareSize; + pieceBitmap[0][WhiteNightrider] = DoLoadBitmap(hInst, "n", minorSize, "s"); + pieceBitmap[1][WhiteNightrider] = DoLoadBitmap(hInst, "n", minorSize, "o"); + pieceBitmap[2][WhiteNightrider] = DoLoadBitmap(hInst, "n", minorSize, "w"); + pieceBitmap[0][WhiteCardinal] = DoLoadBitmap(hInst, "b", minorSize, "s"); + pieceBitmap[1][WhiteCardinal] = DoLoadBitmap(hInst, "b", minorSize, "o"); + pieceBitmap[2][WhiteCardinal] = DoLoadBitmap(hInst, "b", minorSize, "w"); + pieceBitmap[0][WhiteMarshall] = DoLoadBitmap(hInst, "r", minorSize, "s"); + pieceBitmap[1][WhiteMarshall] = DoLoadBitmap(hInst, "r", minorSize, "o"); + pieceBitmap[2][WhiteMarshall] = DoLoadBitmap(hInst, "r", minorSize, "w"); + pieceBitmap[0][WhiteGrasshopper] = DoLoadBitmap(hInst, "q", minorSize, "s"); + pieceBitmap[1][WhiteGrasshopper] = DoLoadBitmap(hInst, "q", minorSize, "o"); + pieceBitmap[2][WhiteGrasshopper] = DoLoadBitmap(hInst, "q", minorSize, "w"); } -#endif - } HBITMAP @@ -3368,9 +3358,19 @@ DrawPieceOnDC(HDC hdc, ChessSquare piece, int color, int sqcolor, int x, int y, BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, sqcolor ? SRCCOPY : NOTSRCCOPY); } else { - if (color) { + if(minorSize && + (piece >= (int)WhiteNightrider && piece <= WhiteGrasshopper || + piece >= (int)BlackNightrider && piece <= BlackGrasshopper) ) { + /* [HGM] no bitmap available for promoted pieces in Crazyhouse */ + /* Bitmaps of smaller size are substituted, but we have to align them */ + x += (squareSize - minorSize)>>1; + y += squareSize - minorSize - 2; + } + if (color || appData.allWhite ) { oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, WHITE_PIECE)); - oldBrush = SelectObject(hdc, whitePieceBrush); + if( color ) + oldBrush = SelectObject(hdc, whitePieceBrush); + else oldBrush = SelectObject(hdc, blackPieceBrush); BitBlt(hdc, x, y, squareSize, squareSize, tmphdc, 0, 0, 0x00B8074A); #if 0 /* Use black piece color for outline of white pieces */ @@ -4351,18 +4351,22 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (y == -2) { /* Downclick vertically off board; check if on clock */ if (PtInRect((LPRECT) &whiteRect, pt)) { - if (gameMode == EditPosition) { + if (gameMode == EditPosition) { SetWhiteToPlayEvent(); } else if (gameMode == IcsPlayingBlack || gameMode == MachinePlaysWhite) { CallFlagEvent(); - } + } else if (gameMode == EditGame) { + AdjustClock(flipClock, -1); + } } else if (PtInRect((LPRECT) &blackRect, pt)) { if (gameMode == EditPosition) { SetBlackToPlayEvent(); } else if (gameMode == IcsPlayingWhite || gameMode == MachinePlaysBlack) { CallFlagEvent(); + } else if (gameMode == EditGame) { + AdjustClock(!flipClock, -1); } } if (!appData.highlightLastMove) { @@ -4378,6 +4382,8 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) || x == BOARD_LEFT-1 || x == BOARD_RGHT || x == BOARD_LEFT-2 && y < BOARD_HEIGHT-gameInfo.holdingsSize || x == BOARD_RGHT+1 && y >= gameInfo.holdingsSize + /* EditPosition, empty square, or different color piece; + click-click move is possible */ ) { break; } else if (fromX == x && fromY == y) { @@ -4390,37 +4396,29 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) ) { /* Downclick on different square. */ /* [HGM] if on holdings file, should count as new first click ! */ - - ChessSquare pdown, pup; - pdown = boards[currentMove][fromY][fromX]; - pup = boards[currentMove][y][x]; - if (gameMode == EditPosition || /* [HGM] max piece > King! */ - !((WhitePawn <= pdown && pdown < BlackPawn && - WhitePawn <= pup && pup < BlackPawn) || - (BlackPawn <= pdown && pdown < EmptySquare && - BlackPawn <= pup && pup < EmptySquare))) { - /* EditPosition, empty square, or different color piece; - click-click move is possible */ + { /* [HGM] now always do UserMoveTest(), and check colors there */ toX = x; toY = y; + /* [HGM] UserMoveEvent requires two calls now, + to make sure move is legal before showing promotion popup */ moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR); if(moveType != ImpossibleMove) { - if (IsPromotion(fromX, fromY, toX, toY)) { - /* [HGM] UserMoveEvent requires two calls now, - to make sure move is legal before showing promotion popup */ - if (appData.alwaysPromoteToQueen) { + /* [HGM] We use PromotionToKnight in Shogi to indicate frorced promotion */ + if (moveType == WhitePromotionKnight || moveType == BlackPromotionKnight || + (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) && + appData.alwaysPromoteToQueen) { FinishMove(moveType, fromX, fromY, toX, toY, 'q'); if (!appData.highlightLastMove) { ClearHighlights(); DrawPosition(forceFullRepaint || FALSE, NULL); } - } else { + } else + if (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen ) { SetHighlights(fromX, fromY, toX, toY); DrawPosition(forceFullRepaint || FALSE, NULL); /* [HGM] Popup calls FinishMove now. If promotion to Q is legal, all are legal! */ PromotionPopup(hwnd); - } } else { /* not a promotion */ if (appData.animate || appData.highlightLastMove) { SetHighlights(fromX, fromY, toX, toY); @@ -4489,13 +4487,16 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) appData.animate = appData.animate && !appData.animateDragging; moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR); if(moveType != ImpossibleMove) { - if (IsPromotion(fromX, fromY, toX, toY)) { - if (appData.alwaysPromoteToQueen) - FinishMove(moveType, fromX, fromY, toX, toY, 'q'); - else { - DrawPosition(forceFullRepaint || FALSE, NULL); - PromotionPopup(hwnd); /* [HGM] Popup now calls FinishMove */ - } + /* [HGM] use move type to determine if move is promotion. + Knight is Shogi kludge for mandatory promotion, Queen means choice */ + if (moveType == WhitePromotionKnight || moveType == BlackPromotionKnight || + (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) && + appData.alwaysPromoteToQueen) + FinishMove(moveType, fromX, fromY, toX, toY, 'q'); + else + if (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen ) { + DrawPosition(forceFullRepaint || FALSE, NULL); + PromotionPopup(hwnd); /* [HGM] Popup now calls FinishMove */ } else FinishMove(moveType, fromX, fromY, toX, toY, NULLCHAR); } if (gotPremove) SetPremoveHighlights(fromX, fromY, toX, toY); @@ -4549,6 +4550,14 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (appData.highlightDragging) { ClearHighlights(); } + if(y == -2) { + /* [HGM] right mouse button in clock area edit-game mode ups clock */ + if (PtInRect((LPRECT) &whiteRect, pt)) { + if (gameMode == EditGame) AdjustClock(flipClock, 1); + } else if (PtInRect((LPRECT) &blackRect, pt)) { + if (gameMode == EditGame) AdjustClock(!flipClock, 1); + } + } DrawPosition(TRUE, NULL); switch (gameMode) { @@ -4577,7 +4586,10 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Just have one menu, on the right button. Windows users don't think to try the middle one, and sometimes other software steals it, or it doesn't really exist. */ - MenuPopup(hwnd, pt, LoadMenu(hInst, "PieceMenu"), -1); + if(gameInfo.variant != VariantShogi) + MenuPopup(hwnd, pt, LoadMenu(hInst, "PieceMenu"), -1); + else + MenuPopup(hwnd, pt, LoadMenu(hInst, "ShogiPieceMenu"), -1); #endif } break; @@ -4678,17 +4690,22 @@ Promotion(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) (!appData.testLegality || gameInfo.variant == VariantSuicide || gameInfo.variant == VariantGiveaway) ? SW_SHOW : SW_HIDE); -#ifdef FAIRY - /* [HGM] Only allow C & A promotions in Capablanca Chess */ + /* [HGM] Only allow C & A promotions if these pieces are defined */ ShowWindow(GetDlgItem(hDlg, PB_Archbishop), - (gameInfo.variant == VariantCapablanca || - gameInfo.variant == VariantGothic) ? + (PieceToChar(WhiteCardinal) != '.' || + PieceToChar(BlackCardinal) != '.' ) ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hDlg, PB_Chancellor), - (gameInfo.variant == VariantCapablanca || - gameInfo.variant == VariantGothic) ? + (PieceToChar(WhiteMarshall) != '.' || + PieceToChar(BlackMarshall) != '.' ) ? + SW_SHOW : SW_HIDE); + /* [HGM] Hide B & R button in Shogi, use Q as promote, N as defer */ + ShowWindow(GetDlgItem(hDlg, PB_Rook), + gameInfo.variant != VariantShogi ? + SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hDlg, PB_Bishop), + gameInfo.variant != VariantShogi ? SW_SHOW : SW_HIDE); -#endif return TRUE; case WM_COMMAND: /* message: received a command */ @@ -4699,27 +4716,25 @@ Promotion(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) DrawPosition(FALSE, NULL); return TRUE; case PB_King: - promoChar = 'k'; + promoChar = PieceToChar(BlackKing); break; case PB_Queen: - promoChar = 'q'; + promoChar = gameInfo.variant == VariantShogi ? '+' : PieceToChar(BlackQueen); break; case PB_Rook: - promoChar = 'r'; + promoChar = PieceToChar(BlackRook); break; case PB_Bishop: - promoChar = 'b'; + promoChar = PieceToChar(BlackBishop); break; -#ifdef FAIRY case PB_Chancellor: - promoChar = 'c'; + promoChar = PieceToChar(BlackMarshall); break; case PB_Archbishop: - promoChar = 'a'; + promoChar = PieceToChar(BlackCardinal); break; -#endif case PB_Knight: - promoChar = 'n'; + promoChar = gameInfo.variant == VariantShogi ? '=' : PieceToChar(BlackKnight); break; default: return FALSE; @@ -5288,6 +5303,11 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) DrawPosition(FALSE, NULL); break; + case IDM_FlipClock: + flipClock = !flipClock; + DisplayBothClocks(); + break; + case IDM_GeneralOptions: GeneralOptionsPopup(hwnd); DrawPosition(TRUE, NULL); @@ -5437,6 +5457,36 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) fromX = fromY = -1; break; + case EP_WhiteFerz: + EditPositionMenuEvent(WhiteFerz, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_WhiteWazir: + EditPositionMenuEvent(WhiteWazir, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_WhiteAlfil: + EditPositionMenuEvent(WhiteAlfil, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_WhiteCannon: + EditPositionMenuEvent(WhiteCannon, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_WhiteCardinal: + EditPositionMenuEvent(WhiteCardinal, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_WhiteMarshall: + EditPositionMenuEvent(WhiteMarshall, fromX, fromY); + fromX = fromY = -1; + break; + case EP_WhiteKing: EditPositionMenuEvent(WhiteKing, fromX, fromY); fromX = fromY = -1; @@ -5467,6 +5517,36 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) fromX = fromY = -1; break; + case EP_BlackFerz: + EditPositionMenuEvent(BlackFerz, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_BlackWazir: + EditPositionMenuEvent(BlackWazir, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_BlackAlfil: + EditPositionMenuEvent(BlackAlfil, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_BlackCannon: + EditPositionMenuEvent(BlackCannon, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_BlackCardinal: + EditPositionMenuEvent(BlackCardinal, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_BlackMarshall: + EditPositionMenuEvent(BlackMarshall, fromX, fromY); + fromX = fromY = -1; + break; + case EP_BlackKing: EditPositionMenuEvent(BlackKing, fromX, fromY); fromX = fromY = -1; @@ -5492,6 +5572,16 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) fromX = fromY = -1; break; + case EP_Promote: + EditPositionMenuEvent(PromotePiece, fromX, fromY); + fromX = fromY = -1; + break; + + case EP_Demote: + EditPositionMenuEvent(DemotePiece, fromX, fromY); + fromX = fromY = -1; + break; + case DP_Pawn: DropMenuEvent(WhitePawn, fromX, fromY); fromX = fromY = -1; @@ -6626,6 +6716,8 @@ ErrorDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } #ifdef GOTHIC +HWND gothicDialog = NULL; + LRESULT CALLBACK GothicDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { @@ -6646,7 +6738,7 @@ GothicDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) and it doesn't work when you resize the dialog. For now, just give it a default position. */ - + gothicDialog = hDlg; SetWindowText(hDlg, errorTitle); hwndText = GetDlgItem(hDlg, OPT_ErrorText); SetDlgItemText(hDlg, OPT_ErrorText, errorMessage); @@ -6669,7 +6761,7 @@ GothicDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } VOID -GothicPopUp(char *title) +GothicPopUp(char *title, char up) { FARPROC lpProc; char *p, *q; @@ -6677,11 +6769,16 @@ GothicPopUp(char *title) strncpy(errorTitle, title, sizeof(errorTitle)); errorTitle[sizeof(errorTitle) - 1] = '\0'; - + + if(up && gothicDialog == NULL) { lpProc = MakeProcInstance((FARPROC)GothicDialog, hInst); CreateDialog(hInst, MAKEINTRESOURCE(DLG_Error), hwndMain, (DLGPROC)lpProc); FreeProcInstance(lpProc); + } else if(!up && gothicDialog != NULL) { + DestroyWindow(gothicDialog); + gothicDialog = NULL; + } } #endif @@ -8694,7 +8791,7 @@ DisplayWhiteClock(long timeRemaining, int highlight) char *flag = whiteFlag && gameMode == TwoMachinesPlay ? "(!)" : ""; if (!IsIconic(hwndMain)) { - DisplayAClock(hdc, timeRemaining, highlight, &whiteRect, "White", flag); + DisplayAClock(hdc, timeRemaining, highlight, flipClock ? &blackRect : &whiteRect, "White", flag); } if (highlight && iconCurrent == iconBlack) { iconCurrent = iconWhite; @@ -8716,7 +8813,7 @@ DisplayBlackClock(long timeRemaining, int highlight) hdc = GetDC(hwndMain); if (!IsIconic(hwndMain)) { - DisplayAClock(hdc, timeRemaining, highlight, &blackRect, "Black", flag); + DisplayAClock(hdc, timeRemaining, highlight, flipClock ? &whiteRect : &blackRect, "Black", flag); } if (highlight && iconCurrent == iconWhite) { iconCurrent = iconBlack; diff --git a/winboard/winboard.rc b/winboard/winboard.rc index d9387f9..0f85a93 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -185,6 +185,8 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Promote to:" FONT 8, "MS Sans Serif" BEGIN + LTEXT "YES ",IDC_STATIC,49,27,40,14 + RTEXT "NO ",IDC_STATIC,94,27,40,14 PUSHBUTTON "Chance&llor",PB_Chancellor,49,4,40,14,NOT WS_TABSTOP PUSHBUTTON "&Archbishop",PB_Archbishop,94,4,40,14,NOT WS_TABSTOP PUSHBUTTON "&Queen",PB_Queen,4,23,40,14,WS_GROUP @@ -565,6 +567,10 @@ BEGIN PUSHBUTTON "...",OPT_ChoosePremoveHighlightColor,110,184,20,15 CONTROL "Monochrome",OPT_Monochrome,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,210,64,10 + CONTROL "All White",OPT_AllWhite,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,180,53,10 + CONTROL "Flip Black",OPT_UpsideDown,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,140,192,53,10 PUSHBUTTON "Defaults",OPT_DefaultBoardColors,80,206,50,15 EDITTEXT OPT_DarkSquareColor,80,112,25,15,ES_READONLY | WS_DISABLED | NOT WS_BORDER | NOT WS_TABSTOP @@ -1061,6 +1067,7 @@ BEGIN POPUP "&Options" BEGIN MENUITEM "Flip &View\tF2", IDM_FlipView + MENUITEM "Flip &Clocks", IDM_FlipClock MENUITEM SEPARATOR MENUITEM "&General...", IDM_GeneralOptions MENUITEM "&Board...", IDM_BoardOptions @@ -1098,6 +1105,8 @@ BEGIN BEGIN MENUITEM "White", EP_White MENUITEM SEPARATOR + MENUITEM "Promote", EP_Promote + MENUITEM SEPARATOR MENUITEM "Pawn", EP_WhitePawn MENUITEM "Knight", EP_WhiteKnight MENUITEM "Bishop", EP_WhiteBishop @@ -1105,9 +1114,16 @@ BEGIN MENUITEM "Queen", EP_WhiteQueen MENUITEM "King", EP_WhiteKing MENUITEM SEPARATOR + MENUITEM "Archbishop", EP_WhiteCardinal + MENUITEM "Chancellor", EP_WhiteMarshall + MENUITEM "Elephant", EP_WhiteAlfil + MENUITEM "Cannon", EP_WhiteCannon + MENUITEM SEPARATOR MENUITEM "Empty Square", EP_EmptySquare MENUITEM "Black", EP_Black, MENUBARBREAK MENUITEM SEPARATOR + MENUITEM "Demote", EP_Demote + MENUITEM SEPARATOR MENUITEM "Pawn", EP_BlackPawn MENUITEM "Knight", EP_BlackKnight MENUITEM "Bishop", EP_BlackBishop @@ -1115,6 +1131,46 @@ BEGIN MENUITEM "Queen", EP_BlackQueen MENUITEM "King", EP_BlackKing MENUITEM SEPARATOR + MENUITEM "Archbishop", EP_BlackCardinal + MENUITEM "Chancellor", EP_BlackMarshall + MENUITEM "Elephant", EP_BlackAlfil + MENUITEM "Cannon", EP_BlackCannon + MENUITEM SEPARATOR + MENUITEM "Clear Board ", EP_ClearBoard + END +END + +SHOGIPIECEMENU MENU DISCARDABLE +BEGIN + POPUP "" + BEGIN + MENUITEM "White", EP_White + MENUITEM SEPARATOR + MENUITEM "Pawn", EP_WhitePawn + MENUITEM "Knight", EP_WhiteKnight + MENUITEM "Bishop", EP_WhiteBishop + MENUITEM "Rook", EP_WhiteRook + MENUITEM "Lance", EP_WhiteQueen + MENUITEM "Silver", EP_WhiteFerz + MENUITEM "Gold", EP_WhiteWazir + MENUITEM "King", EP_WhiteKing + MENUITEM SEPARATOR + MENUITEM "Promote", EP_Promote + MENUITEM SEPARATOR + MENUITEM "Empty Square", EP_EmptySquare + MENUITEM "Black", EP_Black, MENUBARBREAK + MENUITEM SEPARATOR + MENUITEM "Pawn", EP_BlackPawn + MENUITEM "Knight", EP_BlackKnight + MENUITEM "Bishop", EP_BlackBishop + MENUITEM "Rook", EP_BlackRook + MENUITEM "Lance", EP_BlackQueen + MENUITEM "Silver", EP_BlackFerz + MENUITEM "Gold", EP_BlackWazir + MENUITEM "King", EP_BlackKing + MENUITEM SEPARATOR + MENUITEM "Demote", EP_Demote + MENUITEM SEPARATOR MENUITEM "Clear Board ", EP_ClearBoard END END @@ -1609,6 +1665,7 @@ O72O BITMAP MOVEABLE PURE "bitmaps\\o72o.bmp" U72O BITMAP MOVEABLE PURE "bitmaps\\u72o.bmp" H72O BITMAP MOVEABLE PURE "bitmaps\\h72o.bmp" G72O BITMAP MOVEABLE PURE "bitmaps\\g72o.bmp" +L72O BITMAP MOVEABLE PURE "bitmaps\\l72o.bmp" DK72O BITMAP MOVEABLE PURE "bitmaps\\dk72o.bmp" WP72O BITMAP MOVEABLE PURE "bitmaps\\wp72o.bmp" WN72O BITMAP MOVEABLE PURE "bitmaps\\wn72o.bmp" @@ -1624,6 +1681,7 @@ O72S BITMAP MOVEABLE PURE "bitmaps\\o72s.bmp" U72S BITMAP MOVEABLE PURE "bitmaps\\u72s.bmp" H72S BITMAP MOVEABLE PURE "bitmaps\\h72s.bmp" G72S BITMAP MOVEABLE PURE "bitmaps\\g72s.bmp" +L72S BITMAP MOVEABLE PURE "bitmaps\\l72s.bmp" DK72S BITMAP MOVEABLE PURE "bitmaps\\dk72s.bmp" WP72S BITMAP MOVEABLE PURE "bitmaps\\wp72s.bmp" WN72S BITMAP MOVEABLE PURE "bitmaps\\wn72s.bmp" @@ -1639,6 +1697,7 @@ O72W BITMAP MOVEABLE PURE "bitmaps\\o72w.bmp" U72W BITMAP MOVEABLE PURE "bitmaps\\u72w.bmp" H72W BITMAP MOVEABLE PURE "bitmaps\\h72w.bmp" G72W BITMAP MOVEABLE PURE "bitmaps\\g72w.bmp" +L72W BITMAP MOVEABLE PURE "bitmaps\\l72w.bmp" DK72W BITMAP MOVEABLE PURE "bitmaps\\dk72w.bmp" E49O BITMAP MOVEABLE PURE "bitmaps\\e49o.bmp" A49O BITMAP MOVEABLE PURE "bitmaps\\a49o.bmp" @@ -1650,6 +1709,7 @@ O49O BITMAP MOVEABLE PURE "bitmaps\\o49o.bmp" U49O BITMAP MOVEABLE PURE "bitmaps\\u49o.bmp" H49O BITMAP MOVEABLE PURE "bitmaps\\h49o.bmp" G49O BITMAP MOVEABLE PURE "bitmaps\\g49o.bmp" +L49O BITMAP MOVEABLE PURE "bitmaps\\l49o.bmp" DK49O BITMAP MOVEABLE PURE "bitmaps\\dk49o.bmp" WP49O BITMAP MOVEABLE PURE "bitmaps\\wp49o.bmp" WN49O BITMAP MOVEABLE PURE "bitmaps\\wn49o.bmp" @@ -1665,6 +1725,7 @@ O49S BITMAP MOVEABLE PURE "bitmaps\\o49s.bmp" U49S BITMAP MOVEABLE PURE "bitmaps\\u49s.bmp" H49S BITMAP MOVEABLE PURE "bitmaps\\h49s.bmp" G49S BITMAP MOVEABLE PURE "bitmaps\\g49s.bmp" +L49S BITMAP MOVEABLE PURE "bitmaps\\l49s.bmp" DK49S BITMAP MOVEABLE PURE "bitmaps\\dk49s.bmp" WP49S BITMAP MOVEABLE PURE "bitmaps\\wp49s.bmp" WN49S BITMAP MOVEABLE PURE "bitmaps\\wn49s.bmp" @@ -1680,6 +1741,7 @@ O49W BITMAP MOVEABLE PURE "bitmaps\\o49w.bmp" U49W BITMAP MOVEABLE PURE "bitmaps\\u49w.bmp" H49W BITMAP MOVEABLE PURE "bitmaps\\h49w.bmp" G49W BITMAP MOVEABLE PURE "bitmaps\\g49w.bmp" +L49W BITMAP MOVEABLE PURE "bitmaps\\l49w.bmp" DK49W BITMAP MOVEABLE PURE "bitmaps\\dk49w.bmp" diff --git a/winboard/woptions.c b/winboard/woptions.c index 1d92129..4f91822 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -495,7 +495,7 @@ BoardOptionsWhichRadio(HWND hDlg) LRESULT CALLBACK BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - static Boolean mono; + static Boolean mono, white, flip; static BoardSize size; static COLORREF lsc, dsc, wpc, bpc, hsc, phc; static HBITMAP pieces[3]; @@ -564,6 +564,12 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if (appData.monoMode) CheckDlgButton(hDlg, OPT_Monochrome, TRUE); + if (appData.allWhite) + CheckDlgButton(hDlg, OPT_AllWhite, TRUE); + + if (appData.upsideDown) + CheckDlgButton(hDlg, OPT_UpsideDown, TRUE); + pieces[0] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "s"); pieces[1] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "w"); pieces[2] = DoLoadBitmap(hInst, "n", SAMPLE_SQ_SIZE, "o"); @@ -575,6 +581,8 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) hsc = highlightSquareColor; phc = premoveHighlightColor; mono = appData.monoMode; + white= appData.allWhite; + flip = appData.upsideDown; size = boardSize; SetBoardOptionEnables(hDlg); @@ -619,6 +627,8 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) (wpc != whitePieceColor) || (bpc != blackPieceColor) || (hsc != highlightSquareColor) || + (flip != appData.upsideDown) || + (white != appData.allWhite) || (phc != premoveHighlightColor)) { lightSquareColor = lsc; @@ -628,6 +638,8 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) highlightSquareColor = hsc; premoveHighlightColor = phc; appData.monoMode = mono; + appData.allWhite = white; + appData.upsideDown = flip; InitDrawingColors(); InitDrawingSizes(boardSize, 0); @@ -713,6 +725,16 @@ BoardOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) mono = !mono; SetBoardOptionEnables(hDlg); break; + + case OPT_AllWhite: + white = !white; + SetBoardOptionEnables(hDlg); + break; + + case OPT_UpsideDown: + flip = !flip; + SetBoardOptionEnables(hDlg); + break; } break; }