Debug and update readme

This commit is contained in:
Loic Guegan 2022-01-27 14:26:09 +01:00
parent 2ec4942cc0
commit 0258e7d4f8
2 changed files with 43 additions and 6 deletions

View file

@ -10,7 +10,41 @@ PGN specification can be found [here](https://www.chessclub.com/help/PGN-spec).
- Basic PGN parsing (tags, move, comments, variations, NAG, etc.)
- Parse PGN files that contains multiple games
- Handle very large files: up to 2^(sizeof(unsigned long long)*8) bytes
- Efficiency
- Efficiency:
<b></b>
# cpu: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
# file name: lichess_db_standard_rated_2017-06.pgn
# file sha1sum: af8e01ab9709950be1804880d22d094324df5338
# file source: https://database.lichess.org/#standard_games
# file number of games: 11512600
# file size: 24.6GB
# pgnp FILE_BUFFER_SIZE: (1024 * 1024 / 2)
> User time (seconds): 599.81
> System time (seconds): 2.72
> Percent of CPU this job got: 99%
> Elapsed (wall clock) time (h:mm:ss or m:ss): 10:03.17
> Average shared text size (kbytes): 0
> Average unshared data size (kbytes): 0
> Average stack size (kbytes): 0
> Average total size (kbytes): 0
> Maximum resident set size (kbytes): 4484
> Average resident set size (kbytes): 0
> Major (requiring I/O) page faults: 0
> Minor (reclaiming a frame) page faults: 784
> Voluntary context switches: 4
> Involuntary context switches: 6649
> Swaps: 0
> File system inputs: 0
> File system outputs: 0
> Socket messages sent: 0
> Socket messages received: 0
> Signals delivered: 0
> Page size (bytes): 4096
> Exit status: 0
# How to use it ?
PGNP can be used as a shared library in your project.

View file

@ -59,6 +59,10 @@ void PGN::ParseNextGame() {
} else if (IS_DIGIT(c)) {
LastGameEndLoc = ParseHalfMove(loc, moves);
break;
} else if (c == '*') {
result = "*";
LastGameEndLoc=loc+1;
break;
} else if (c == '{') {
loc = ParseComment(loc, moves);
continue; // No need loc++
@ -330,11 +334,10 @@ loctype PGN::GotoNextToken(loctype loc) {
c = pgn_content[loc];
if (c == '%' || c == ';') {
loc = GotoEOL(loc);
if(!IS_EOF){
c=pgn_content[loc];
}
else{
return(loc);
if (!IS_EOF) {
c = pgn_content[loc];
} else {
return (loc);
}
}
}