]> git.sesse.net Git - pgn-extract/blobdiff - grammar.c
Store start position in the binary output.
[pgn-extract] / grammar.c
index 85540c17f7a065c338dc574a8cf239c56eff844f..ab2278381a8c3250bd0c64a4143d134aa4128ff6 100644 (file)
--- a/grammar.c
+++ b/grammar.c
@@ -48,6 +48,9 @@ static TokenType current_symbol = NO_TOKEN;
  */
 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.
@@ -655,6 +658,7 @@ setup_for_new_game(void)
 {
     restart_lex_for_new_game();
     RAV_level = 0;
+    game_start_position = get_position();
 }
 
         /* Discard any data held in the GameHeader.Tags structure. */
@@ -822,6 +826,7 @@ DealWithGame(Move *move_list)
     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.