1 
2 // pgn.h
3 
4 #ifndef PGN_H
5 #define PGN_H
6 
7 // includes
8 
9 #include <stdio.h>
10 
11 #include "util.h"
12 
13 // defines
14 
15 #define PGN_STRING_SIZE 256
16 
17 // types
18 
19 typedef struct {
20 
21    FILE * file;
22 
23    int char_hack;
24    int char_line;
25    int char_column;
26    bool char_unread;
27    bool char_first;
28 
29    int token_type;
30    char token_string[PGN_STRING_SIZE];
31    int token_length;
32    int token_line;
33    int token_column;
34    bool token_unread;
35    bool token_first;
36 
37    char result[PGN_STRING_SIZE];
38    char fen[PGN_STRING_SIZE];
39 
40    int move_line;
41    int move_column;
42    int game_nb;
43 } pgn_t;
44 
45 // functions
46 
47 extern void pgn_open      (pgn_t * pgn, const char file_name[]);
48 extern void pgn_close     (pgn_t * pgn);
49 
50 extern bool pgn_next_game (pgn_t * pgn);
51 extern bool pgn_next_move (pgn_t * pgn, char string[], int size);
52 
53 #endif // !defined PGN_H
54 
55 // end of pgn.h
56 
57