4 #include <boost/program_options.hpp> 
    5 #include <boost/format.hpp> 
    6 #include <boost/scoped_ptr.hpp> 
   32   virtual bool isLoaded()
 const { 
return false; }
 
   41     for (
size_t i = 0; i < filenames.size(); ++i)
 
   82 int main(
int argc, 
char **argv)
 
   85   boost::program_options::options_description command_line_options;
 
   86   command_line_options.add_options()
 
   90      "Kisen filename to search")
 
   92      boost::program_options::value<std::string>(&predicate_name)->
 
   94      "Predicate to use.  Valid options are csa and stand")
 
   95     (
"input-file", boost::program_options::value< std::vector<std::string> >(),
 
   96      "input files in kisen format")
 
   97     (
"help", 
"Show help message");
 
   98   boost::program_options::variables_map 
vm;
 
   99   boost::program_options::positional_options_description p;
 
  100   p.add(
"input-file", -1);
 
  105       boost::program_options::command_line_parser(
 
  106         argc, argv).options(command_line_options).positional(p).
run(), vm);
 
  107     boost::program_options::notify(vm);
 
  108     if (vm.count(
"help"))
 
  110       std::cerr << 
"Usage: " << argv[0] << 
" [options] CSA_FILES" 
  112       std::cout << command_line_options << std::endl;
 
  116   catch (std::exception &e)
 
  118     std::cerr << 
"error in parsing options" << std::endl
 
  119               << e.what() << std::endl;
 
  120     std::cerr << 
"Usage: " << argv[0] << 
" [options] CSA_FILES" << std::endl;
 
  121     std::cerr << command_line_options << std::endl;
 
  125   std::vector<std::string> 
files;
 
  127   if (vm.count(
"input-file"))
 
  128     files = vm[
"input-file"].as< std::vector<std::string> >();
 
  130   boost::scoped_ptr<StatePredicate> predicate;
 
  131   if (predicate_name == 
"csa")
 
  135   else if (predicate_name == 
"stand")
 
  141     std::cerr << 
"Unknown predicate "  << predicate_name;
 
  145   if (!predicate->isLoaded())
 
  147     std::cerr << 
"No target" << std::endl;
 
  150   for (
size_t i = 0; i < kisen.
size(); i++)
 
  154     for (
size_t j = 0; j < moves.size(); j++)
 
  163       if (predicate->match(state))
 
  165         std::cout << i << 
" " << j << std::endl << state;