X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=codegen%2Fmain.cpp;h=fb57155a516537067cdbdda0e909cd25f3b8f83b;hp=ec974036bac336b9fdeba37d059cf6411bde973b;hb=3907d211b0856140709b2376739bc462c4d37ba0;hpb=044cb458410020e50b1c40b7b5078fc203669ee1 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