1 /* pgn.h 2 3 GNU Chess protocol adapter 4 5 Copyright (C) 2001-2011 Free Software Foundation, Inc. 6 7 This program is free software: you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation, either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 22 // pgn.h 23 24 #ifndef PGN_H 25 #define PGN_H 26 27 // includes 28 29 #include <cstdio> 30 31 #include "util.h" 32 33 namespace adapter { 34 35 // constants 36 37 const int PGN_STRING_SIZE = 256; 38 39 // types 40 41 struct pgn_t { 42 43 FILE * file; 44 45 int char_hack; 46 int char_line; 47 int char_column; 48 bool char_unread; 49 bool char_first; 50 51 int token_type; 52 char token_string[PGN_STRING_SIZE]; 53 int token_length; 54 int token_line; 55 int token_column; 56 bool token_unread; 57 bool token_first; 58 59 char result[PGN_STRING_SIZE]; 60 char fen[PGN_STRING_SIZE]; 61 62 int move_line; 63 int move_column; 64 }; 65 66 // functions 67 68 extern void pgn_open (pgn_t * pgn, const char file_name[]); 69 extern void pgn_close (pgn_t * pgn); 70 71 extern bool pgn_next_game (pgn_t * pgn); 72 extern bool pgn_next_move (pgn_t * pgn, char string[], int size); 73 74 } // namespace adapter 75 76 #endif // !defined PGN_H 77 78 // end of pgn.h 79 80