last-position.cc
Go to the documentation of this file.
00001 /*
00002  * 
00003  */
00004 #include "osl/record/csaRecord.h"
00005 #include "osl/state/numEffectState.h"
00006 #include "osl/effect_util/effectUtil.h"
00007 
00008 #include <boost/foreach.hpp>
00009 #include <fstream>
00010 #include <iostream>
00011 #include <cstdlib>
00012 #include <cctype>
00013 #include <unistd.h>
00014 
00015 using namespace osl;
00016 
00017 void usage(const char *prog)
00018 {
00019   using namespace std;
00020   cerr << "Usage: " << prog << " csa-filenames "
00021        << endl;
00022   // kisenファイル と csaファイル を再生
00023   exit(1);
00024 }
00025 
00026 int main(int argc, char **argv)
00027 {
00028   try {
00029     nice(20);
00030       
00031     //次に CSAファイルを処理
00032     for (int i=1; i<argc; ++i) {
00033       CsaFile file(argv [i]);
00034       const vector<Move> moves=file.getRecord().getMoves();
00035       NumEffectState state((SimpleState(HIRATE)));
00036       BOOST_FOREACH(Move m, moves)
00037         state.makeMove(m);
00038       std::string new_name = std::string("tmp/")+argv[i];
00039       std::ofstream os(new_name.c_str());
00040       os << state;
00041     }
00042   }
00043   catch (std::exception& e) {
00044     std::cerr << e.what() << "\n";
00045     return 1;
00046   }
00047 }
00048 
00049 // ;;; Local Variables:
00050 // ;;; mode:c++
00051 // ;;; c-basic-offset:2
00052 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines