00001 // cwchessboard -- A C++ chessboard tool set 00002 // 00003 //! @file tstpgn.cc A test application to test reading PGN files. 00004 // 00005 // Copyright (C) 2010, by 00006 // 00007 // Carlo Wood, Run on IRC <carlo@alinoe.com> 00008 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt 00009 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61 00010 // 00011 // This program is free software: you can redistribute it and/or modify 00012 // it under the terms of the GNU General Public License as published by 00013 // the Free Software Foundation, either version 2 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 00024 #include "sys.h" 00025 #include <giomm/init.h> 00026 #include "ChessGame.h" 00027 #include "PgnDatabase.h" 00028 #include "debug.h" 00029 00030 //char const* filename="/home/carlo/projects/cwchessboard/chessgames/ftp.cis.uab.edu/crafty/enormous.pgn"; 00031 //char const* filename="test.pgn"; 00032 //char const* filename="/home/carlo/chess/jin.log.pgn"; 00033 //char const* filename="/opt/large/backups/usr-src-20080707.tar"; 00034 char const* filename="/home/carlo/projects/cwchessboard/cwchessboard/torture.pgn"; 00035 00036 using namespace cwchess; 00037 00038 Glib::RefPtr<Glib::MainLoop> main_loop; 00039 00040 void open_finished(size_t len) 00041 { 00042 std::cout << "Total size read: " << len << '\n'; 00043 main_loop->quit(); 00044 } 00045 00046 int main(int argc, char* argv[]) 00047 { 00048 Debug(debug::init()); 00049 if (!Glib::thread_supported()) 00050 Glib::thread_init(); 00051 Gio::init(); 00052 00053 char const* infile = filename; 00054 if (argc > 1) 00055 infile = argv[1]; 00056 Glib::RefPtr<pgn::Database> pgn_data_base = pgn::DatabaseSeekable::open(infile, sigc::ptr_fun(&open_finished)); 00057 main_loop = Glib::MainLoop::create(false); 00058 main_loop->run(); 00059 }