2 * Program: pgn-extract: a Portable Game Notation (PGN) extractor.
3 * Copyright (C) 1994-2014 David Barnes
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 1, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 * David Barnes may be contacted as D.J.Barnes@kent.ac.uk
19 * http://www.cs.kent.ac.uk/people/staff/djb/
23 /* Define a type to make it easy to return where we are
24 * in the input line. This type is returned from those functions
25 * that may modify the line/linep pair in next_token().
28 /* Start of the malloc'ed line. */
30 /* The next char to access in line, if line is not NULL. */
32 /* What token resulted. */
36 /* Define a type to hold a list of input files. */
38 /* The list should have a (char *)NULL on the end. */
40 SourceFileType *file_type;
41 /* Keep track of the number of files in the list. */
43 /* Keep track of how many the list may hold. */
48 #define RUSSIAN_KNIGHT_OR_KING (0x008a)
49 #define RUSSIAN_KING_SECOND_LETTER (0x00e0)
50 #define RUSSIAN_QUEEN (0x0094)
51 #define RUSSIAN_ROOK (0x008b)
52 #define RUSSIAN_BISHOP (0x0091)
53 #define RUSSIAN_PAWN (0x00af)
55 #define RUSSIAN_KNIGHT_OR_KING (0x00eb)
56 #define RUSSIAN_KING_SECOND_LETTER (0x00d2)
57 #define RUSSIAN_QUEEN (0x00e6)
58 #define RUSSIAN_ROOK (0x00ec)
59 #define RUSSIAN_BISHOP (0x00f3)
61 /* Define a macro for checking the value of a char against
62 * one of the Russian piece letters.
64 #define RUSSIAN_PIECE_CHECK(c) ((c) & 0x00ff)
66 /* Shared prototypes for the non-static functions in the
69 void yyerror(const char *s);
70 void save_assessment(const char *assess);
71 void restart_lex_for_new_game(void);
72 void free_move_list(Move *move_list);
73 void print_error_context(FILE *fp);
74 void init_lex_tables(void);
75 TokenType next_token(void);
76 TokenType skip_to_next_game(TokenType token);
77 const char *tag_header_string(TagName tag);
78 Boolean open_first_file(void);
79 const char *input_file_name(unsigned file_number);
80 unsigned current_file_number(void);
81 Boolean open_eco_file(const char *eco_file);
83 void add_filename_to_source_list(const char *filename,SourceFileType file_type);
84 void add_filename_list_from_file(FILE *fp,SourceFileType file_type);
85 void reset_line_number(void);
86 char *next_input_line(FILE *fp);
87 LinePair gather_tag(char *line, unsigned char *linep);
88 LinePair gather_string(char *line, unsigned char *linep);
89 Boolean is_character_class(unsigned char ch, TokenType character_class);