9 #include <boost/algorithm/string/trim.hpp> 
   10 #include <boost/foreach.hpp> 
   11 #include <boost/program_options.hpp> 
   12 #include <boost/lambda/lambda.hpp> 
   13 #include <boost/lambda/bind.hpp> 
   23 boost::program_options::variables_map 
vm;
 
   26 using namespace boost::lambda;
 
   28 void process( 
const std::string& file_name)
 
   32     if (
vm.count(
"verbose"))
 
   35       std::cout << 
"Processing...  " << file_name << std::endl;
 
   36     const osl::Ki2File ki2(file_name, verbose);
 
   37     const osl::Record& record = ki2.getRecord();
 
   40     if (check_duplicate.
regist(moves)) {
 
   41       std::cerr << 
"Found a duplicated play: " << file_name << 
"\n";
 
   45     osl::NumEffectState state;
 
   46     BOOST_FOREACH(
const osl::Move& move, moves)
 
   48       if (!state.isValidMove(move, 
false))
 
   50         std::cout << file_name << 
"\n";
 
   55   } 
catch (osl::Ki2IOError& err) {
 
   56     std::cerr << err.what() << 
"\n";
 
   57     std::cerr << 
"Found an error: " << file_name << 
"\n";
 
   62 int main(
int argc, 
char **argv)
 
   64   boost::program_options::options_description command_line_options;
 
   65   command_line_options.add_options()
 
   66     (
"input-file", boost::program_options::value< std::vector<std::string> >(),
 
   67      "input files in ki2 format (.ki2)")
 
   68     (
"verbose,v", 
"Verbose mode")
 
   69     (
"help,h", 
"Show this help message");
 
   70   boost::program_options::positional_options_description p;
 
   71   p.add(
"input-file", -1);
 
   76       boost::program_options::command_line_parser(
 
   77         argc, argv).options(command_line_options).positional(p).
run(), 
vm);
 
   78     boost::program_options::notify(
vm);
 
   81       std::cout << 
"Usage: " << argv[0] << 
" [options] ki2-file [ki2-file...]\n";
 
   82       std::cout << 
"       " << argv[0] << 
" [options]\n";
 
   83       std::cout << command_line_options << std::endl;
 
   87   catch (std::exception &e)
 
   89     std::cerr << 
"error in parsing options" << std::endl
 
   90               << e.what() << std::endl;
 
   91     std::cerr << 
"Usage: " << argv[0] << 
" [options] ki2-file [ki2-file...]\n";
 
   92     std::cerr << 
"       " << argv[0] << 
" [options]\n";
 
   93     std::cerr << command_line_options << std::endl;
 
   97   std::vector<std::string> 
files;
 
   98   if (
vm.count(
"input-file"))
 
  100     const std::vector<std::string> temp = 
vm[
"input-file"].as<std::vector<std::string> >();
 
  101     files.insert(files.end(), temp.begin(), temp.end());
 
  106     while(std::getline(std::cin , line))
 
  108       boost::algorithm::trim(line);
 
  109       files.push_back(line);
 
  114   std::for_each(files.begin(), files.end(), bind(&
process, _1));
 
  116   check_duplicate.
print(std::cout);