From 0897bd94a7d430a3d14a2de01a109191bb89c86e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 8 Mar 2012 11:20:20 +0200 Subject: Print usage/version information to STDOUT instead of STDERR --- xsd/xsd.cxx | 63 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'xsd/xsd.cxx') 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 () || 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 ()) { - 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 () || 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 " << endl + o << "--disable-warning " << endl << " Disable printing warning with id . 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 " << endl + o << "--anonymous-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
    =" << endl + o << "--location-map
      =" << endl << " Map the original schema location
        that is\n" << " specified in the XML Schema include or import\n" << " elements to new schema location . Repeat\n" << " this option to map more than one schema location." << endl; - e << "--location-regex " << endl + o << "--location-regex " << endl << " Add 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 " << endl + o << "--type-file-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 " << endl + o << "--schema-file-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 " << endl + o << "--file-list " << endl << " Write a list of generated C++ files to ." << endl; - e << "--file-list-prologue

        " << endl + o << "--file-list-prologue

        " << endl << " Insert

        at the beginning of the file list. All\n" << " occurrences of the \\n character sequence in

        \n" << " are replaced with new lines." << endl; - e << "--file-list-prologue " << endl + o << "--file-list-prologue " << endl << " Insert at the end of the file list. All\n" << " occurrences of the \\n character sequence in \n" << " are replaced with new lines." << endl; - e << "--file-list-delim " << endl + o << "--file-list-delim " << endl << " Delimit file names written to the file list with\n" << " instead of new lines. All occurrences of the\n" << " \\n character sequence in are replaced with\n" @@ -432,20 +437,20 @@ main (Int argc, Char* argv[]) } else { - e << "Usage: " << args[0] << " ..." << endl + o << "Usage: " << args[0] << " ..." << endl << "Commands:" << endl; - e << " help Print usage information and exit. Use\n" + o << " help Print usage information and exit. Use\n" << " 'help ' 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; } -- cgit v1.1