X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=parser.l;h=bdf11d0858cc47fa13a7a8f1c37ab9039e2ebdb5;hb=36da20342a0bc5ef6c36587944cb2f35b2ea46da;hp=41feced8bc25fb412b8e45b1d9d15b3c3f3a1081;hpb=0efdc4c5ef60cf4c15e9dddf3658d2115e4d5d93;p=xboard.git diff --git a/parser.l b/parser.l old mode 100644 new mode 100755 index 41feced..bdf11d0 --- a/parser.l +++ b/parser.l @@ -87,6 +87,16 @@ char *yy_text = (char *) yytext; #ifdef FLEX_SCANNER /* This is flex */ +/* [AP] use prototypes in function declarations */ +#define YY_USE_PROTOS + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif +/* end of [AP] fix */ + #undef YY_INPUT #define YY_INPUT(buf, result, max_size) my_yy_input(buf, &result, max_size) #undef YY_DECL @@ -304,6 +314,8 @@ extern void CopyBoard P((Board to, Board from)); result == WhitePromotionQueen || result == BlackPromotionQueen)) { if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier) currentMoveString[4] = PieceToChar(BlackFerz); + else if(gameInfo.variant == VariantGreat) + currentMoveString[4] = PieceToChar(BlackMan); else currentMoveString[4] = PieceToChar(BlackQueen); currentMoveString[5] = NULLCHAR; @@ -448,7 +460,6 @@ extern void CopyBoard P((Board to, Board from)); 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)) { @@ -483,6 +494,11 @@ extern void CopyBoard P((Board to, Board from)); (result == WhitePromotionQueen || result == BlackPromotionQueen || result == WhitePromotionKnight || result == BlackPromotionKnight)) { currentMoveString[4] = PieceToChar(BlackQueen); + // [HGM] shatranj: take care of variants without Queen + if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier) + currentMoveString[4] = PieceToChar(BlackFerz); + if(gameInfo.variant == VariantGreat) + currentMoveString[4] = PieceToChar(BlackMan); currentMoveString[5] = NULLCHAR; } @@ -1034,9 +1050,9 @@ static YY_BUFFER_STATE my_file_buffer = NULL; */ int yyoffset() { - int pos = yy_c_buf_p - yy_current_buffer->yy_ch_buf; + int pos = yy_c_buf_p - YY_CURRENT_BUFFER->yy_ch_buf; - return(ftell(yy_current_buffer->yy_input_file) - + return(ftell(YY_CURRENT_BUFFER->yy_input_file) - yy_n_chars + pos); }