"--append - see -a",
"--checkfile - see -c",
"--checkmate - see -M",
+ "--dumpeco - dump a list of all ECO hashes with names, then quit",
"--duplicates - see -d",
"--evaluation - include a position evaluation after each move",
"--fencomments - include a FEN string after each move",
process_argument(MATCH_CHECKMATE_ARGUMENT, "");
return 1;
}
+ else if(stringcompare(argument, "dumpeco") == 0) {
+ GlobalState.dump_eco = TRUE;
+ return 1;
+ }
else if(stringcompare(argument, "duplicates") == 0) {
process_argument(DUPLICATES_FILE_ARGUMENT, associated_value);
return 2;
#define ECO_TABLE_SIZE 4096
static EcoLog **EcoTable;
-#if INCLUDE_UNUSED_FUNCTIONS
-static void
+void
dumpEcoTable(void)
{ unsigned ix;
for(ix = 0; ix < ECO_TABLE_SIZE; ix++){
if(EcoTable[ix] != NULL){
EcoLog *entry = NULL;
for(entry = EcoTable[ix]; entry != NULL; entry = entry->next){
- fprintf(stderr,"%s %lu %lu ",entry->ECO_tag,
- entry->required_hash_value,
- entry->cumulative_hash_value);
+ printf("%u\t", (unsigned int)(entry->cumulative_hash_value));
+ printf("%s\t", entry->ECO_tag ? entry->ECO_tag : "");
+ printf("%s\t", entry->Opening_tag ? entry->Opening_tag : "");
+ printf("%s\t", entry->Variation_tag ? entry->Variation_tag : "");
+ printf("%s\n", entry->Sub_Variation_tag ? entry->Sub_Variation_tag : "");
}
- fprintf(stderr,"\n");
}
}
}
+#if INCLUDE_UNUSED_FUNCTIONS
/* Return at how many points this match works.
* required_hash_value
* cumulative_hash_value
struct EcoLog *next;
} EcoLog;
+void dumpEcoTable(void);
EcoLog *eco_matches(HashCode current_hash_value, HashCode cumulative_hash_value,
unsigned half_moves_played);
Boolean add_ECO(Game game_details);
move_list = NULL;
setup_for_new_game();
}
+ if(file_type == ECOFILE && GlobalState.dump_eco) {
+ dumpEcoTable();
+ exit(0);
+ }
}
/* Parse a game and return a pointer to any valid list of moves
FALSE, /* add_position_match_comments (--markmatches) */
FALSE, /* output_total_plycount (--totalplycount) */
FALSE, /* add_hashcode_tag (--addhashcode) */
+ FALSE, /* dump-eco (--dumpeco) */
"MATCH", /* position_match_comment (--markpositionmatches) */
(char *)NULL, /* current_input_file */
NORMALFILE, /* current_file_type */
int black_elo = atoi(black_elo_tag);
for (move = current_game.moves; move != NULL; move = move->next) {
- unsigned int opening = move->eco ? move->eco->cumulative_hash_value : 0;
+ unsigned int opening = move->eco ? move->eco->cumulative_hash_value : 0; // Truncate to 32 bits.
// key
putc(move->bpfen_len + strlen((char *)move->move), outputfile);
Boolean output_total_plycount;
/* Whether to add a HashCode tag. */
Boolean add_hashcode_tag;
+ /* Whether to dump ECO data to stdout after loading.*/
+ Boolean dump_eco;
/* The comment to use for position matches, if required. */
const char *position_match_comment;
/* Current input file name. */