From 38c35631217316e2fd0453a8ef7a1eea9e47c5dc Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 29 Sep 2012 01:55:03 +0300 Subject: [PATCH] Preserve source declarations when transferring a collection Optionally print all internal statements (useful to see what's happening inside a binary datafile). --- tool/tool.cpp | 8 +++++--- tool/tool.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tool/tool.cpp b/tool/tool.cpp index 59c5cbc..5469106 100644 --- a/tool/tool.cpp +++ b/tool/tool.cpp @@ -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); } diff --git a/tool/tool.h b/tool/tool.h index 0c5a77a..c2a1d7b 100644 --- a/tool/tool.h +++ b/tool/tool.h @@ -14,6 +14,7 @@ private: bool compile; unsigned float_size; bool compress; + bool debug; public: DataTool(int argc, char **argv); -- 2.45.2