From 3907d211b0856140709b2376739bc462c4d37ba0 Mon Sep 17 00:00:00 2001 From: Jens Thiele Date: Mon, 4 Dec 2006 12:44:22 +0000 Subject: [PATCH] include VERSION --- codegen/main.cpp | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/codegen/main.cpp b/codegen/main.cpp index ec97403..fb57155 100644 --- a/codegen/main.cpp +++ b/codegen/main.cpp @@ -6,6 +6,9 @@ #include #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif //! convert string to upper case std::string @@ -444,7 +447,7 @@ struct header_file : public std::ofstream header_file(const char* fname) : std::ofstream(fname) { std::cerr << "create header: '" << fname << "'" << std::endl; std::string macro(replace(toupper(fname),'.','_')); - *this << "// automatically generated code - do not edit\n" << std::endl; + *this << "// automatically generated code (generated by libt2n-codegen " << VERSION << ") - do not edit\n" << std::endl; *this << "#ifndef " << macro << "\n" << "#define " << macro << "\n"; } @@ -464,12 +467,18 @@ struct cpp_file : public std::ofstream int main(int argc, char* argv[]) { - if (argc < 3) { - std::cerr << "Usage: " << argv[0] << "default-group gccxml-file1 gccxml-file2 ... " << std::endl; - return 1; - } + // todo: maybe use getopt + if ((argc>1)&&(std::string(argv[1])=="--version")) { + std::cerr << VERSION << std::endl; + return 0; + } + if (argc < 3) + { + std::cerr << "Usage: " << argv[0] << "default-group gccxml-file1 gccxml-file2 ... " << std::endl; + return 1; + } - try{ + try{ std::string group(argv[1]); std::list xmlfiles; for (int i=2;i