X-Git-Url: http://winboard.nl/cgi-bin?p=polyglot.git;a=blobdiff_plain;f=main.cpp;h=9dd5e04ac98f09c31ca86dc08acc6993df5d38bd;hp=b46be4a10cc77f5f56cd4ee5e19a2959b9df5945;hb=HEAD;hpb=6442b61046f46f65bfc4bf0b3727abe2dc27acb8 diff --git a/main.cpp b/main.cpp index b46be4a..9dd5e04 100644 --- a/main.cpp +++ b/main.cpp @@ -35,14 +35,17 @@ // constants -static const char * const Version = "1.4W10UCIb17"; +static const char * const Version = "1.4b27"; static const char * const HelpMessage = "\ SYNTAX\n\ -polyglot [configfile]\n\ -polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply] [-min-game games] [-min-score score] [-only-white] [-only-black] [-uniform]\n\ -polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]\n\ -polyglot [configfile] epd-test [-epd inputfile] [-min-depth depth] [-max-depth depth] [-max-time time] [-depth-delta delta]\n\ -polyglot perft [-fen fen] [-max-depth depth]\ +* polyglot [configfile]\n\ +* polyglot -ec enginecommand\n\ +* polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply] [-min-game games] [-min-score score] [-only-white] [-only-black] [-uniform]\n\ +* polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]\n\ +* polyglot info-book [-bin inputfile] [-exact]\n\ +* polyglot dumb-book [-bin inputfile] -color color [-out outputfile]\n\ +* polyglot [configfile] epd-test [-epd inputfile] [-min-depth depth] [-max-depth depth] [-min-time time] [-max-time time] [-depth-delta delta]\n\ +* polyglot perft [-fen fen] [-max-depth depth]\ "; static const int SearchDepth = 63; @@ -59,7 +62,6 @@ static void parse_option (); static void init_book (); static bool parse_line (char line[], char * * name_ptr, char * * value_ptr); static void stop_search (); -static void sig_quit(int); // functions @@ -101,6 +103,21 @@ int main(int argc, char * argv[]) { book_merge(argc,argv); return EXIT_SUCCESS; } + + if (argc >= 2 && my_string_equal(argv[1],"merge-book")) { + book_merge(argc,argv); + return EXIT_SUCCESS; + } + + if (argc >= 2 && my_string_equal(argv[1],"dump-book")) { + book_dump(argc,argv); + return EXIT_SUCCESS; + } + + if (argc >= 2 && my_string_equal(argv[1],"info-book")) { + book_info(argc,argv); + return EXIT_SUCCESS; + } if (argc >= 2 && my_string_equal(argv[1],"perft")) { do_perft(argc,argv); @@ -185,7 +202,6 @@ void polyglot_set_option(char *name, char *value){ // this must be cleaned up! // init_book() static void init_book(){ - const char *empty_var[]={}; book_clear(); if (option_get_bool("Book")){ my_log("POLYGLOT *** SETTING BOOK ***\n"); @@ -221,8 +237,6 @@ static void parse_option() { my_fatal("parse_option(): missing [Engine] section\n"); } - if(line[0]=='#') continue; - if (my_string_case_equal(line,"[engine]")) break; if (parse_line(line,&name,&value)) { @@ -239,7 +253,7 @@ static void parse_option() { my_log("POLYGLOT INI file \"%s\"\n",file_name); engine_open(Engine); if(!engine_active(Engine)){ - my_fatal("Could not start \"%s\"",option_get("EngineCommand")); + my_fatal("Could not start \"%s\"\n",option_get("EngineCommand")); } if (option_get_bool("UCI")) { @@ -249,8 +263,6 @@ static void parse_option() { Init = true; while (my_file_read_line(file,line,256)) { if (line[0] == '[') my_fatal("parse_option(): unknown section %s\n",line); - if (line[0]=='#') continue; - if (parse_line(line,&name,&value)) { uci_send_option(Uci,name,"%s",value); //to get a decent display in winboard_x we need to now if an engine really is doing multipv analysis @@ -331,9 +343,11 @@ void quit() { stop_search(); engine_send(Engine,"quit"); + my_log("POLYGLOT Closing engine\n"); engine_close(Engine); } + my_log("POLYGLOT Calling exit\n"); exit(EXIT_SUCCESS); }