3 #include <msp/core/application.h>
4 #include <msp/core/getopt.h>
5 #include <msp/io/buffered.h>
6 #include <msp/io/file.h>
7 #include "source/parser.h"
8 #include "source/statement.h"
9 #include "source/writer.h"
14 class DataTool: public Application
21 DataTool(int argc, char **argv);
24 static Application::RegApp<DataTool> reg;
28 DataTool::DataTool(int argc, char **argv):
33 getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG);
34 getopt.add_option('b', "binary", binary, GetOpt::NO_ARG);
37 const vector<string> &args=getopt.get_args();
46 throw Exception("stdin/out not supported at the moment");
48 in=new IO::File(in_fn);
52 throw Exception("stdin/out not supported at the moment");
54 out=new IO::File(out_fn, IO::M_WRITE);
56 IO::Buffered in_buf(*in);
57 DataFile::Parser parser(in_buf, in_fn);
58 IO::Buffered out_buf(*out);
59 DataFile::Writer writer(out_buf);
61 writer.set_binary(true);
65 DataFile::Statement st=parser.parse();
76 Application::RegApp<DataTool> DataTool::reg;