*/
static unsigned RAV_level = 0;
+/* At what file position the current game started. */
+static long game_start_position = -1;
+
/* Retain details of the header of a game.
* This comprises the Tags and any comment prefixing the
* moves of the game.
{
restart_lex_for_new_game();
RAV_level = 0;
+ game_start_position = get_position();
}
/* Discard any data held in the GameHeader.Tags structure. */
current_game.moves_checked = FALSE;
current_game.moves_ok = FALSE;
current_game.error_ply = 0;
+ current_game.start_position = game_start_position;
/* Determine whether or not this game is wanted, on the
* basis of the various selection criteria available.
}
}
+ /* Return the position in the current file. Returns -1 if it is unseekable. */
+long get_position(void)
+{
+ return ftell(yyin);
+}
LinePair gather_tag(char *line, unsigned char *linep);
LinePair gather_string(char *line, unsigned char *linep);
Boolean is_character_class(unsigned char ch, TokenType character_class);
+long get_position(void);
int white_elo = atoi(white_elo_tag);
int black_elo = atoi(black_elo_tag);
+ long start_position = current_game.start_position;
// Parse date and time, if it exists. Set invalid dates to year 3000.
const char *date_tag = current_game.tags[DATE_TAG];
fwrite(&black_elo, sizeof(black_elo), 1, outputfile);
fwrite(&opening, sizeof(opening), 1, outputfile);
fwrite(×tamp, sizeof(timestamp), 1, outputfile);
+ fwrite(&start_position, sizeof(start_position), 1, outputfile);
putc(strlen((char *)move->move), outputfile);
fwrite(move->move, strlen((char *)move->move), 1, outputfile);
}
* 0 => no error found.
*/
int error_ply;
+ /* File position of the first byte of the game, or -1
+ * if unknown.
+ */
+ long start_position;
} Game;
/* Define a type to distinguish between CHECK files, NORMAL files,