All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sort.cc
Go to the documentation of this file.
1 /*
2  *
3  */
4 
9 #include "osl/record/csaRecord.h"
11 
12 #include <iostream>
13 #include <cstdlib>
14 #include <cstdio>
15 #include <unistd.h>
16 
17 using namespace osl;
18 
19 int main(int argc, char **argv)
20 {
21  // const char *program_name = argv[0];
22  bool error_flag = false;
23  bool verbose = false;
24  // const char *kisenFilename = 0;
25 
26  // extern char *optarg;
27  extern int optind;
28  char c;
29  // size_t num_records = 1;
30  while ((c = getopt(argc, argv, "vh")) != EOF) {
31  switch(c)
32  {
33  case 'v': verbose = true;
34  break;
35  default: error_flag = true;
36  }
37  }
38  argc -= optind;
39  argv += optind;
40 
41  if (error_flag)
42  return 1;
43 
44  try {
45  nice(20);
46  // size_t record_processed = 0;
47 
48  for (int i=0; i<argc; ++i) {
49  CsaFile file(argv [i]);
50  const Record record = file.getRecord();
51  NumEffectState state(record.getInitialState());
52 
53  MoveVector moves;
54  GenerateAllMoves::generate(state.turn(), state, moves);
56  std::cout << state << moves << "\n";
57  }
58  }
59  catch (std::exception& e) {
60  std::cerr << e.what() << "\n";
61  return 1;
62  }
63 }
64 
65 // ;;; Local Variables:
66 // ;;; mode:c++
67 // ;;; c-basic-offset:2
68 // ;;; End: