]> git.tdb.fi Git - libs/datafile.git/commitdiff
Preserve source declarations when transferring a collection
authorMikko Rasa <tdb@tdb.fi>
Fri, 28 Sep 2012 22:55:03 +0000 (01:55 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 28 Sep 2012 22:55:03 +0000 (01:55 +0300)
Optionally print all internal statements (useful to see what's happening
inside a binary datafile).

tool/tool.cpp
tool/tool.h

index 59c5cbcb1df30f33a6263697e216a2fb26719e38..5469106f50322b7497ea9626c5a4b2400187aa1c 100644 (file)
@@ -15,12 +15,14 @@ DataTool::DataTool(int argc, char **argv):
        binary(false),
        compile(false),
        float_size(0),
-       compress(false)
+       compress(false),
+       debug(false)
 {
        GetOpt getopt;
        getopt.add_option('b', "binary", binary, GetOpt::NO_ARG);
        getopt.add_option('c', "compile", compile, GetOpt::NO_ARG);
        getopt.add_option('f', "float-size", float_size, GetOpt::REQUIRED_ARG);
+       getopt.add_option('g', "debug", debug, GetOpt::NO_ARG);
        getopt.add_option('o', "output", out_fn, GetOpt::REQUIRED_ARG);
        getopt.add_option('z', "compress", compress, GetOpt::NO_ARG);
        getopt(argc, argv);
@@ -52,8 +54,8 @@ void DataTool::do_transfer()
 
                while(parser)
                {
-                       DataFile::Statement st = parser.parse();
-                       if(st.valid)
+                       DataFile::Statement st = parser.parse(true);
+                       if(st.valid && (st.keyword.compare(0, 2, "__") || st.keyword=="__src" || debug))
                                writer->write(st);
                }
 
index 0c5a77a85bed010c51807b5862509795e3ae4bca..c2a1d7bb98d4eec3d1637c9b084940518f3707b1 100644 (file)
@@ -14,6 +14,7 @@ private:
        bool compile;
        unsigned float_size;
        bool compress;
+       bool debug;
 
 public:
        DataTool(int argc, char **argv);