1 #include <msp/core/getopt.h>
2 #include <msp/io/buffered.h>
3 #include <msp/io/console.h>
4 #include <msp/io/file.h>
5 #include <msp/datafile/parser.h>
6 #include <msp/datafile/statement.h>
7 #include <msp/datafile/writer.h>
14 DataTool::DataTool(int argc, char **argv):
21 getopt.add_option('b', "binary", binary, GetOpt::NO_ARG);
22 getopt.add_option('c', "compile", compile, GetOpt::NO_ARG);
23 getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG);
26 const vector<string> &args = getopt.get_args();
37 in = new IO::File(in_fn);
43 out = new IO::File(out_fn, IO::M_WRITE);
46 IO::Buffered in_buf(*in);
47 DataFile::Parser parser(in_buf, in_fn);
48 IO::Buffered out_buf(*out);
49 DataFile::Writer writer(out_buf);
51 writer.set_binary(true);
55 Compiler compiler(writer);
56 compiler.load(parser);
62 DataFile::Statement st = parser.parse();