GlobalState.end_position = atol(associated_value);
return 2;
}
+ else if(stringcompare(argument, "startfilenum") == 0) {
+ GlobalState.start_file_number = atoi(associated_value);
+ return 2;
+ }
else if(stringcompare(argument, "version") == 0) {
fprintf(GlobalState.logfile, "pgn-extract %s\n", CURRENT_VERSION);
exit(0);
current_game.moves_checked = FALSE;
current_game.moves_ok = FALSE;
current_game.error_ply = 0;
+ current_game.file_number = GlobalState.current_file_number;
current_game.start_position = game_start_position;
/* Determine whether or not this game is wanted, on the
*/
if(open_input(list_of_files.files[file_number])){
GlobalState.current_file_type = list_of_files.file_type[file_number];
+ GlobalState.current_file_number = file_number + GlobalState.start_file_number;
return TRUE;
}
else{
"MATCH", /* position_match_comment (--markpositionmatches) */
(char *)NULL, /* current_input_file */
NORMALFILE, /* current_file_type */
+ -1, /* current_file_number */
+ 0, /* start_file_number */
0, /* start_position */
LONG_MAX, /* end_position */
DEFAULT_ECO_FILE, /* eco_file (-e) */
int white_elo = atoi(white_elo_tag);
int black_elo = atoi(black_elo_tag);
+ int file_num = current_game.file_number;
long start_position = current_game.start_position;
// Parse date and time, if it exists. Set invalid dates to year 3000.
fwrite(&black_elo, sizeof(black_elo), 1, outputfile);
fwrite(&opening, sizeof(opening), 1, outputfile);
fwrite(×tamp, sizeof(timestamp), 1, outputfile);
+ fwrite(&file_num, sizeof(file_num), 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 number this game comes from. */
+ int file_number;
/* File position of the first byte of the game, or -1
* if unknown.
*/
const char *current_input_file;
/* Whether this is a CHECKFILE or a NORMALFILE. */
SourceFileType current_file_type;
+ /* Current file number. Used to disambiguate PGN file positions. */
+ int current_file_number;
+ int start_file_number;
/* Byte positions to scan to and from in the PGN file.
* Starting in the middle of a game will yield unexpected
* results.