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):
23 getopt.add_option('b', "binary", binary, GetOpt::NO_ARG);
24 getopt.add_option('c', "compile", compile, GetOpt::NO_ARG);
25 getopt.add_option('f', "float-size", float_size, GetOpt::REQUIRED_ARG);
26 getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG);
27 getopt.add_option('z', "compress", compress, GetOpt::NO_ARG);
30 const vector<string> &args = getopt.get_args();
41 in = new IO::File(in_fn);
47 out = new IO::File(out_fn, IO::M_WRITE);
50 IO::Buffered in_buf(*in);
51 DataFile::Parser parser(in_buf, in_fn);
52 IO::Buffered out_buf(*out);
53 DataFile::Writer writer(out_buf);
55 writer.set_compressed();
57 writer.set_binary(true);
59 writer.set_float_precision(float_size);
63 Compiler compiler(writer);
64 compiler.load(parser);
70 DataFile::Statement st = parser.parse();