diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-08 11:20:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-08 11:20:20 +0200 |
commit | 0897bd94a7d430a3d14a2de01a109191bb89c86e (patch) | |
tree | de46076b328298182f3f13d2fc4ec6445ce685f4 /xsd/xsd.cxx | |
parent | 4c408a85759eb42b6b84b8cdab81453df31cd289 (diff) |
Print usage/version information to STDOUT instead of STDERR
Diffstat (limited to 'xsd/xsd.cxx')
-rw-r--r-- | xsd/xsd.cxx | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/xsd/xsd.cxx b/xsd/xsd.cxx index bba866f..3199e82 100644 --- a/xsd/xsd.cxx +++ b/xsd/xsd.cxx @@ -50,6 +50,7 @@ namespace SemanticGraph = XSDFrontend::SemanticGraph; namespace Transformations = XSDFrontend::Transformations; using std::wcerr; +using std::wcout; using std::endl; namespace CLI @@ -257,7 +258,9 @@ main (Int argc, Char* argv[]) if (help_options.value<CLI::version> () || cmd == "version") { - e << "CodeSynthesis XSD XML Schema to C++ compiler " << + std::wostream& o (wcout); + + o << "CodeSynthesis XSD XML Schema to C++ compiler " << XSD_STR_VERSION << endl << "Copyright (c) 2005-2011 Code Synthesis Tools CC" << endl; @@ -273,13 +276,13 @@ main (Int argc, Char* argv[]) if (help_options.value<CLI::proprietary_license> ()) { - e << "The compiler was invoked in the Proprietary License mode. You " + o << "The compiler was invoked in the Proprietary License mode. You " << "should have\nreceived a proprietary license from Code Synthesis " << "Tools CC that entitles\nyou to use it in this mode." << endl; } else { - e << "This is free software; see the source for copying conditions. " + o << "This is free software; see the source for copying conditions. " << "There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS " << "FOR A PARTICULAR PURPOSE." << endl; } @@ -289,13 +292,15 @@ main (Int argc, Char* argv[]) if (help_options.value<CLI::help> () || cmd == "help") { + std::wostream& o (wcout); + if (cmd == "help" && args.size () > 1) { NarrowString arg (args[1]); if (arg == "cxx-tree") { - e << "Usage: " << args[0] << " cxx-tree [options] file [file ...]" + o << "Usage: " << args[0] << " cxx-tree [options] file [file ...]" << endl << "Options:" << endl; @@ -303,7 +308,7 @@ main (Int argc, Char* argv[]) } else if (arg == "cxx-parser") { - e << "Usage: " << args[0] << " cxx-parser [options] file [file ...]" + o << "Usage: " << args[0] << " cxx-parser [options] file [file ...]" << endl << "Options:" << endl; @@ -311,18 +316,18 @@ main (Int argc, Char* argv[]) } else { - e << "error: unknown command '" << arg.c_str () << "'" << endl + o << "error: unknown command '" << arg.c_str () << "'" << endl << "info: try '" << args[0] << " help' for the list of commands" << endl; return 1; } - ::CLI::Indent::Clip< ::CLI::OptionsUsage, WideChar> clip (e); + ::CLI::Indent::Clip< ::CLI::OptionsUsage, WideChar> clip (o); // Disable warning option. // - e << "--disable-warning <warn>" << endl + o << "--disable-warning <warn>" << endl << " Disable printing warning with id <warn>. If 'all'\n" << " is specified for the warning id then all warnings\n" << " are disabled." @@ -330,76 +335,76 @@ main (Int argc, Char* argv[]) // Anonymous morphing options. // - e << "--preserve-anonymous" << endl + o << "--preserve-anonymous" << endl << " Preserve anonymous types. By default anonymous\n" << " types are automatically named with names derived\n" << " from the enclosing elements/attributes." << endl; - e << "--anonymous-regex <regex>" << endl + o << "--anonymous-regex <regex>" << endl << " Add the provided regular expression to the list of\n" << " regular expressions used to derive names for\n" << " anonymous types from the names of the enclosing\n" << " attributes/elements." << endl; - e << "--anonymous-regex-trace" << endl + o << "--anonymous-regex-trace" << endl << " Trace the process of applying regular expressions\n" << " specified with the --anonymous-regex option." << endl; // Location mapping options. // - e << "--location-map <ol>=<nl>" << endl + o << "--location-map <ol>=<nl>" << endl << " Map the original schema location <ol> that is\n" << " specified in the XML Schema include or import\n" << " elements to new schema location <nl>. Repeat\n" << " this option to map more than one schema location." << endl; - e << "--location-regex <regex>" << endl + o << "--location-regex <regex>" << endl << " Add <regex> to the list of regular expressions\n" << " used to map schema locations that are specified\n" << " in the XML Schema include or import elements." << endl; - e << "--location-regex-trace" << endl + o << "--location-regex-trace" << endl << " Trace the process of applying regular expressions\n" << " specified with the --location-regex option." << endl; // File-per-type compilation mode options. // - e << "--file-per-type" << endl + o << "--file-per-type" << endl << " Generate a separate set of C++ files for each\n" << " type defined in XML Schema." << endl; - e << "--type-file-regex <regex>" << endl + o << "--type-file-regex <regex>" << endl << " Add the provided regular expression to the list of\n" << " regular expressions used to translate type names\n" << " to file names when the --file-per-type option is\n" << " specified." << endl; - e << "--type-file-regex-trace" << endl + o << "--type-file-regex-trace" << endl << " Trace the process of applying regular expressions\n" << " specified with the --type-file-regex option." << endl; - e << "--schema-file-regex <regex>" << endl + o << "--schema-file-regex <regex>" << endl << " Add the provided regular expression to the list\n" << " of regular expressions used to translate schema\n" << " file names when the --file-per-type option is\n" << " specified." << endl; - e << "--schema-file-regex-trace" << endl + o << "--schema-file-regex-trace" << endl << " Trace the process of applying regular expressions\n" << " specified with the --schema-file-regex option." << endl; - e << "--fat-type-file" << endl + o << "--fat-type-file" << endl << " Generate code corresponding to global elements\n" << " into type files instead of schema files when the\n" << " --file-per-type option is specified." @@ -407,23 +412,23 @@ main (Int argc, Char* argv[]) // File list options. // - e << "--file-list <file>" << endl + o << "--file-list <file>" << endl << " Write a list of generated C++ files to <file>." << endl; - e << "--file-list-prologue <p>" << endl + o << "--file-list-prologue <p>" << endl << " Insert <p> at the beginning of the file list. All\n" << " occurrences of the \\n character sequence in <p>\n" << " are replaced with new lines." << endl; - e << "--file-list-prologue <e>" << endl + o << "--file-list-prologue <e>" << endl << " Insert <e> at the end of the file list. All\n" << " occurrences of the \\n character sequence in <e>\n" << " are replaced with new lines." << endl; - e << "--file-list-delim <d>" << endl + o << "--file-list-delim <d>" << endl << " Delimit file names written to the file list with\n" << " <d> instead of new lines. All occurrences of the\n" << " \\n character sequence in <d> are replaced with\n" @@ -432,20 +437,20 @@ main (Int argc, Char* argv[]) } else { - e << "Usage: " << args[0] << " <cmd> ..." << endl + o << "Usage: " << args[0] << " <cmd> ..." << endl << "Commands:" << endl; - e << " help Print usage information and exit. Use\n" + o << " help Print usage information and exit. Use\n" << " 'help <cmd>' for command-specific options." << endl; - e << " version Print version and exit." + o << " version Print version and exit." << endl; - e << " cxx-tree Generate the C++/Tree mapping." + o << " cxx-tree Generate the C++/Tree mapping." << endl; - e << " cxx-parser Generate the C++/Parser mapping." + o << " cxx-parser Generate the C++/Parser mapping." << endl; } |