aboutsummaryrefslogtreecommitdiff
path: root/xsde
diff options
context:
space:
mode:
Diffstat (limited to 'xsde')
-rw-r--r--xsde/cxx/hybrid/generator.cxx516
-rw-r--r--xsde/cxx/hybrid/options.cli353
-rw-r--r--xsde/cxx/options.cli515
-rw-r--r--xsde/cxx/parser/generator.cxx347
-rw-r--r--xsde/cxx/parser/options.cli159
-rw-r--r--xsde/cxx/serializer/generator.cxx343
-rw-r--r--xsde/cxx/serializer/options.cli148
-rw-r--r--xsde/makefile80
-rw-r--r--xsde/options.cli302
-rw-r--r--xsde/xsde.cxx117
10 files changed, 1551 insertions, 1329 deletions
diff --git a/xsde/cxx/hybrid/generator.cxx b/xsde/cxx/hybrid/generator.cxx
index 4db77ea..3a61c95 100644
--- a/xsde/cxx/hybrid/generator.cxx
+++ b/xsde/cxx/hybrid/generator.cxx
@@ -17,8 +17,6 @@
#include <cutl/compiler/cxx-indenter.hxx>
#include <cutl/compiler/sloc-counter.hxx>
-#include <backend-elements/indentation/clip.hxx>
-
#include <xsd-frontend/semantic-graph.hxx>
#include <cxx/hybrid/elements.hxx>
@@ -52,7 +50,7 @@
#include <cxx/hybrid/serializer-aggregate-header.hxx>
#include <cxx/hybrid/serializer-aggregate-source.hxx>
-#include <usage.hxx>
+#include <cxx/hybrid/options.hxx>
#include "../../../libxsde/xsde/cxx/version.hxx"
@@ -61,7 +59,6 @@ using std::wcerr;
using std::wcout;
using namespace XSDFrontend::SemanticGraph;
-namespace Indentation = BackendElements::Indentation;
//
//
@@ -213,515 +210,8 @@ namespace CXX
Void Hybrid::Generator::
usage ()
{
- std::wostream& o (wcout);
- ::CLI::Indent::Clip< ::CLI::OptionsUsage, WideChar> clip (o);
-
- o << "--char-encoding <enc>" << endl
- << " Specify the character encoding that should be\n"
- << " used in the object model. Valid values are 'utf8'\n"
- << " (default) and 'iso8859-1'."
- << endl;
-
- o << "--no-stl" << endl
- << " Generate code that does not use STL."
- << endl;
-
- o << "--no-iostream" << endl
- << " Generate code that does not use the iostream\n"
- << " library."
- << endl;
-
- o << "--no-exceptions" << endl
- << " Generate code that does not use C++ exceptions."
- << endl;
-
- o << "--no-long-long" << endl
- << " Generate code that does not use the long long\n"
- << " and unsigned long long types."
- << endl;
-
- o << "--generate-parser" << endl
- << " Generate XML parsing code."
- << endl;
-
- o << "--generate-serializer" << endl
- << " Generate XML serialization code."
- << endl;
-
- o << "--generate-aggregate" << endl
- << " Generate parser/serializer aggregates for root\n"
- << " elements and/or types."
- << endl;
-
- o << "--suppress-validation" << endl
- << " Suppress the generation of validation code in\n"
- << " parser and serializer."
- << endl;
-
- o << "--suppress-parser-val" << endl
- << " Suppress the generation of validation code in\n"
- << " parser."
- << endl;
-
- o << "--suppress-serializer-val" << endl
- << " Suppress the generation of validation code in\n"
- << " serializer."
- << endl;
-
- o << "--omit-default-attributes" << endl
- << " Omit attributes with default and fixed values\n"
- << " from serialized XML documents."
- << endl;
-
- o << "--suppress-enum" << endl
- << " Suppress the generation of the XML Schema\n"
- << " enumeration to C++ enum mapping."
- << endl;
-
- o << "--generate-clone" << endl
- << " Generate clone functions for variable-length\n"
- << " types."
- << endl;
-
- o << "--generate-detach" << endl
- << " Generate detach functions for elements and\n"
- << " attributes of variable-length types."
- << endl;
-
- o << "--generate-insertion <os>" << endl
- << " Generate data representation stream insertion\n"
- << " operators for the <os> output stream type."
- << endl;
-
- o << "--generate-extraction <is>" << endl
- << " Generate data representation stream extraction\n"
- << " operators for the <is> input stream type."
- << endl;
-
- o << "--generate-inline" << endl
- << " Generate certain functions inline."
- << endl;
-
- o << "--generate-forward" << endl
- << " Generate forward declaration file."
- << endl;
-
- o << "--generate-xml-schema" << endl
- << " Generate C++ header files as if the schema being\n"
- << " compiled defines the XML Schema namespace."
- << endl;
-
- o << "--extern-xml-schema <file>" << endl
- << " Generate code as if the XML Schema namespace was\n"
- << " defined in <file> and xsd:included in the schema\n"
- << " being compiled."
- << endl;
-
- o << "--suppress-reset" << endl
- << " Suppress the generation of parser and serializer\n"
- << " reset code."
- << endl;
-
- o << "--custom-allocator" << endl
- << " Generate code that uses custom allocator functions\n"
- << " instead of operator new/delete."
- << endl;
-
- o << "--generate-polymorphic" << endl
- << " Generate polymorphism-aware code. Specify this\n"
- << " option if you use substitution groups or xsi:type."
- << endl;
-
- o << "--runtime-polymorphic" << endl
- << " Generate non-polymorphic code that uses the\n"
- << " runtime library configured with polymorphism\n"
- << " support."
- << endl;
-
- o << "--polymorphic-type <type>" << endl
- << " Indicate that <type> is a root of a polymorphic\n"
- << " type hierarchy."
- << endl;
-
- o << "--generate-typeinfo" << endl
- << " Generate type information functions for\n"
- << " polymorphic object model types."
- << endl;
-
- o << "--polymorphic-schema <file>" << endl
- << " Indicate that <file> contains derivations of\n"
- << " polymorphic types."
- << endl;
-
- o << "--reuse-style-mixin" << endl
- << " Generate code that supports the mixin base\n"
- << " parser/serializer implementation reuse style."
- << endl;
-
- o << "--custom-data <type>" << endl
- << " Add custom data to the C++ class generated for\n"
- << " XML Schema type <type>."
- << endl;
-
- o << "--custom-type <map>" << endl
- << " Use a custom type implementation instead of the\n"
- << " generated version. The <map> argument is in the\n"
- << " form name[=[flags][/[type][/[base][/include]]]],\n"
- << " where <name> is an XML Schema type name,\n"
- << " optional <flags> specify whether the custom type\n"
- << " is fixed or variable-length, optional <type> is\n"
- << " a C++ type name that should be used instead,\n"
- << " optional <base> is a C++ name that should be\n"
- << " given to the generated version, and optional\n"
- << " <include> is the header file that defines the\n"
- << " custom implementation."
- << endl;
-
- o << "--custom-parser <map>" << endl
- << " Use a custom parser implementation instead of the\n"
- << " generated version. The <map> argument is in the\n"
- << " form name[=[base][/include]], where <name> is an\n"
- << " XML Schema type name, optional <base> is a C++\n"
- << " name that should be given to the generated\n"
- << " version, and optional <include> is the header\n"
- << " file that defines the custom implementation."
- << endl;
-
- o << "--custom-serializer <map>" << endl
- << " Use a custom serializer implementation instead of\n"
- << " the generated version. The <map> argument is in\n"
- << " the form name[=[base][/include]], where <name> is\n"
- << " an XML Schema type name, optional <base> is a C++\n"
- << " name that should be given to the generated\n"
- << " version, and optional <include> is the header\n"
- << " file that defines the custom implementation."
- << endl;
-
- o << "--root-element-first" << endl
- << " Treat only the first global element as a document\n"
- << " root."
- << endl;
-
- o << "--root-element-last" << endl
- << " Treat only the last global element as a document\n"
- << " root."
- << endl;
-
- o << "--root-element-all" << endl
- << " Treat all global elements as document roots."
- << endl;
-
- o << "--root-element-none" << endl
- << " Don't treat any global elements as document roots."
- << endl;
-
- o << "--root-element <element>" << endl
- << " Treat only <element> as a document root. Repeat\n"
- << " this option to specify more than one root element."
- << endl;
-
- o << "--root-type <type>" << endl
- << " Generate parser/serializer aggregate for <type>.\n"
- << " Repeat this option to specify more than one type."
- << endl;
-
- o << "--output-dir <dir>" << endl
- << " Write generated files to <dir> instead of the\n"
- << " current directory."
- << endl;
-
- o << "--pskel-type-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '_pskel' suffix\n"
- << " to construct the names of generated parser\n"
- << " skeletons."
- << endl;
-
- o << "--sskel-type-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '_sskel' suffix\n"
- << " to construct the names of generated serializer\n"
- << " skeletons."
- << endl;
-
- o << "--pskel-file-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '-pskel' suffix\n"
- << " to construct the names of generated parser\n"
- << " skeleton files."
- << endl;
-
- o << "--sskel-file-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '-sskel' suffix\n"
- << " to construct the names of generated serializer\n"
- << " skeleton files."
- << endl;
-
- o << "--pimpl-type-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '_pimpl' suffix\n"
- << " to construct the names of generated parser\n"
- << " implementations."
- << endl;
-
- o << "--simpl-type-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '_simpl' suffix\n"
- << " to construct the names of generated serializer\n"
- << " implementations."
- << endl;
-
- o << "--pimpl-file-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '-pimpl' suffix\n"
- << " to construct the names of generated parser\n"
- << " implementation files."
- << endl;
-
- o << "--simpl-file-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '-simpl' suffix\n"
- << " to construct the names of generated serializer\n"
- << " implementation files."
- << endl;
-
- o << "--paggr-type-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '_paggs' suffix\n"
- << " to construct the names of generated parser\n"
- << " aggregates."
- << endl;
-
- o << "--saggr-type-suffix <sfx>" << endl
- << " Use <sfx> instead of the default '_saggr' suffix\n"
- << " to construct the names of generated serializer\n"
- << " aggregates."
- << endl;
-
- o << "--namespace-map <xns>=<cns>" << endl
- << " Map XML Schema namespace <xns> to C++ namespace\n"
- << " <cns>. Repeat this option to specify mapping for\n"
- << " more than one XML Schema namespace."
- << endl;
-
- o << "--namespace-regex <regex>" << endl
- << " Add <regex> to the list of regular expressions\n"
- << " used to translate XML Schema namespace names to\n"
- << " C++ namespace names."
- << endl;
-
- o << "--namespace-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --namespace-regex option."
- << endl;
-
- o << "--reserved-name <name>" << endl
- << " Add <name> to the list of names that should not\n"
- << " be used as identifiers. The name can optionally\n"
- << " be followed by '=' and the replacement name that\n"
- << " should be used instead."
- << endl;
-
- o << "--include-with-brackets" << endl
- << " Use angle brackets (<>) instead of quotes (\"\") in\n"
- << " generated #include directives."
- << endl;
-
- o << "--include-prefix <prefix>" << endl
- << " Add <prefix> to generated #include directive\n"
- << " paths."
- << endl;
-
- o << "--include-regex <regex>" << endl
- << " Add <regex> to the list of regular expressions\n"
- << " used to transform #include directive paths."
- << endl;
-
- o << "--include-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --include-regex option."
- << endl;
-
- o << "--guard-prefix <prefix>" << endl
- << " Add <prefix> to generated header inclusion guards."
- << endl;
-
- // File suffix.
- //
- o << "--hxx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.hxx' to\n"
- << " construct the name of the header files."
- << endl;
-
- o << "--ixx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.ixx' to\n"
- << " construct the name of the inline files."
- << endl;
-
- o << "--cxx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.cxx' to\n"
- << " construct the name of the source files."
- << endl;
-
- o << "--fwd-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '-fwd.hxx'\n"
- << " to construct the name of the forward declaration\n"
- << " file."
- << endl;
-
- // File regex.
- //
- o << "--hxx-regex <regex>" << endl
- << " Use <regex> to construct the names of the header\n"
- << " files."
- << endl;
-
- o << "--ixx-regex <regex>" << endl
- << " Use <regex> to construct the names of the inline\n"
- << " files."
- << endl;
-
- o << "--cxx-regex <regex>" << endl
- << " Use <regex> to construct the names of the source\n"
- << " files."
- << endl;
-
- o << "--fwd-regex <regex>" << endl
- << " Use <regex> to construct the name of the forward\n"
- << " declaration file."
- << endl;
-
-
- // Prologues.
- //
- o << "--hxx-prologue <text>" << endl
- << " Insert <text> at the beginning of the header\n"
- << " files."
- << endl;
-
- o << "--ixx-prologue <text>" << endl
- << " Insert <text> at the beginning of the inline\n"
- << " files."
- << endl;
-
- o << "--cxx-prologue <text>" << endl
- << " Insert <text> at the beginning of the source\n"
- << " files."
- << endl;
-
- o << "--fwd-prologue <text>" << endl
- << " Insert <text> at the beginning of the forward\n"
- << " declaration file."
- << endl;
-
- o << "--prologue <text>" << endl
- << " Insert <text> at the beginning of each generated\n"
- << " file for which there is no file-specific prologue."
- << endl;
-
-
- // Epilogues.
- //
- o << "--hxx-epilogue <text>" << endl
- << " Insert <text> at the end of the header files."
- << endl;
-
- o << "--ixx-epilogue <text>" << endl
- << " Insert <text> at the end of the inline files."
- << endl;
-
- o << "--cxx-epilogue <text>" << endl
- << " Insert <text> at the end of the source files."
- << endl;
-
- o << "--fwd-epilogue <text>" << endl
- << " Insert <text> at the end of the forward\n"
- << " declaration file."
- << endl;
-
- o << "--epilogue <text>" << endl
- << " Insert <text> at the end of each generated file\n"
- << " for which there is no file-specific epilogue."
- << endl;
-
-
- // Prologue files.
- //
- o << "--hxx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the header files."
- << endl;
-
- o << "--ixx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the inline files."
- << endl;
-
- o << "--cxx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the source files."
- << endl;
-
- o << "--fwd-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the forward declaration file."
- << endl;
-
- o << "--prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of each generated file for which there is no file-\n"
- << " specific prologue file."
- << endl;
-
-
- // Epilogue files.
- //
- o << "--hxx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the header files."
- << endl;
-
- o << "--ixx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the inline files."
- << endl;
-
- o << "--cxx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the source files."
- << endl;
-
- o << "--fwd-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the forward declaration file."
- << endl;
-
- o << "--epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " each generated file for which there is no file-\n"
- << " specific epilogue file."
- << endl;
-
-
- // Misc.
- //
- o << "--show-anonymous" << endl
- << " Show elements and attributes that are of anonymous\n"
- << " types."
- << endl;
-
- o << "--show-sloc" << endl
- << " Show the number of generated physical source lines\n"
- << " of code (SLOC)."
- << endl;
-
- o << "--sloc-limit <num>" << endl
- << " Check that the number of generated physical source\n"
- << " lines of code (SLOC) does not exceed <num>."
- << endl;
-
- o << "--options-file <file>" << endl
- << " Read additional options from <file>. Each option\n"
- << " should appear on a separate line optionally\n"
- << " followed by space and an argument."
- << endl;
-
- o << "--proprietary-license" << endl
- << " Indicate that the generated code is licensed under\n"
- << " a proprietary license instead of the GPL."
- << endl;
+ CXX::Hybrid::options::print_usage (wcout);
+ CXX::options::print_usage (wcout);
}
Hybrid::CLI::OptionsSpec Hybrid::Generator::
diff --git a/xsde/cxx/hybrid/options.cli b/xsde/cxx/hybrid/options.cli
new file mode 100644
index 0000000..40df945
--- /dev/null
+++ b/xsde/cxx/hybrid/options.cli
@@ -0,0 +1,353 @@
+// file : xsde/cxx/hybrid/options.cli
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include <vector>;
+include <string>;
+include <cstddef>; // std::size_t
+
+include <cult/types.hxx>; // NarrowString
+
+include <cxx/options.cli>;
+
+namespace CXX
+{
+ namespace Hybrid
+ {
+ class options: CXX::options
+ {
+ // Features.
+ //
+ bool --generate-parser
+ {
+ "Generate XML parsing code."
+ };
+
+ bool --generate-serializer
+ {
+ "Generate XML serialization code."
+ };
+
+ bool --generate-aggregate
+ {
+ "Generate parser/serializer aggregates for root elements and/or types.
+ See also the \cb{--root-element-*} and \cb{--root-type} options."
+ };
+
+ bool --suppress-validation
+ {
+ "Suppress the generation of validation code in parser and serializer."
+ };
+
+ bool --suppress-parser-val
+ {
+ "Suppress the generation of validation code in parser."
+ };
+
+ bool --suppress-serializer-val
+ {
+ "Suppress the generation of validation code in serializer."
+ };
+
+ bool --omit-default-attributes
+ {
+ "Omit attributes with default and fixed values from serialized
+ XML documents."
+ };
+
+ bool --suppress-enum
+ {
+ "Suppress the generation of the XML Schema enumeration to C++
+ \cb{enum} mapping."
+ };
+
+ bool --generate-clone
+ {
+ "Generate clone functions for variable-length types. These
+ functions allow you to make dynamically-allocated copies of
+ variable-length objects."
+ };
+
+ bool --generate-detach
+ {
+ "Generate detach functions for elements and attributes of
+ variable-length types. These functions, for example, allow
+ you to move sub-trees in the object model either within the
+ same tree or between different trees."
+ };
+
+ std::vector<Cult::Types::NarrowString> --generate-insertion
+ {
+ "<os>",
+ "Generate data representation stream insertion operators for the
+ <os> output stream type. Repeat this option to specify more than
+ one stream type. The special \cb{CDR} and \cb{XDR} arguments are
+ recognized as ACE CDR and Sun RPC XDR stream types and the
+ corresponding stream wrappers provided by the XSD/e runtime are
+ automatically used. For custom stream types use the
+ \cb{--hxx-prologue*} options to include the necessary declarations."
+ };
+
+ std::vector<Cult::Types::NarrowString> --generate-extraction
+ {
+ "<is>",
+ "Generate data representation stream extraction operators for the
+ <is> input stream type. Repeat this option to specify more than
+ one stream type. The special \cb{CDR} and \cb{XDR} arguments are
+ recognized as ACE CDR and Sun RPC XDR stream types and the
+ corresponding stream wrappers provided by the XSD/e runtime are
+ automatically used. For custom stream types use the
+ \cb{--hxx-prologue*} options to include the necessary declarations."
+ };
+
+ bool --generate-forward
+ {
+ "Generate forward declaration file."
+ };
+
+ // Polymorphism.
+ //
+ bool --generate-polymorphic
+ {
+ "Generate polymorphism-aware code. Specify this option if you use
+ substitution groups or \cb{xsi:type}. Use the \cb{--polymorphic-type}
+ option to specify which type hierarchies are polymorphic."
+ };
+
+ bool --runtime-polymorphic
+ {
+ "Generate non-polymorphic code that uses the runtime library
+ configured with polymorphism support."
+ };
+
+ std::vector<Cult::Types::NarrowString> --polymorphic-type
+ {
+ "<type>",
+ "Indicate that <type> is a root of a polymorphic type hierarchy. The
+ XSD/e compiler can often automatically determine which types are
+ polymorphic based on the substitution group declarations. However,
+ you may need to use this option if you are not using substitution
+ groups or if substitution groups are defined in another schema.
+ You need to specify this option when compiling every schema file
+ that references <type>."
+ };
+
+ bool --generate-typeinfo
+ {
+ "Generate custom type information querying functions for polymorphic
+ object model types. These functions can be used instead of the
+ standard C++ RTTI mechanism to determine object's type at runtime."
+ };
+
+ std::vector<Cult::Types::NarrowString> --polymorphic-schema
+ {
+ "<file>",
+ "Indicate that <file> contains derivations of polymorphic types that
+ are not otherwise visible from the schema being compiled. This
+ option is used to make sure that during the generation of parser
+ and serializer aggregates the compiler is aware of all possible
+ derivations of polymorphic types. Repeat this option to specify
+ more than one schema file."
+ };
+
+ // Reuse style.
+ //
+ bool --reuse-style-mixin
+ {
+ "Generate code that supports the mixin base parser/serializer
+ implementation reuse style. Note that this reuse style relies on
+ virtual inheritance and may result in a substantial object code
+ size increase for large vocabularies. By default the tiein reuse
+ style is used."
+ };
+
+ // Custom data/type.
+ //
+ std::vector<Cult::Types::NarrowString> --custom-data
+ {
+ "<type>",
+ "Add the ability to store custom data to the C++ class generated for
+ XML Schema type <type>. To add custom data to a nested compositor
+ class use the qualified name starting from the XML Schema type
+ containing the compositor, for example, \cb{foo::sequence::choise1}."
+ };
+
+ std::vector<Cult::Types::NarrowString> --custom-type
+ {
+ "<map>",
+ "Use a custom type implementation instead of the generated version.
+ The <map> argument is in the form
+ \c{\i{name}[\b{=}[\i{flags}][\b{/}[\i{type}][\b{/}[\i{base}][\b{/}\i{include}]]]]},
+ where the \ci{name} component is the XML Schema type name being
+ customized. Optional \ci{flags} allow you to specify whether the
+ custom type is fixed or variable-length. The \cb{f} flag indicates
+ the type is fixed-length and the \cb{v} flag indicates the type is
+ variable-length. If omitted, the default rules are used to determine
+ the type length. Optional \ci{type} is a C++ type name that should
+ be used instead. If specified, the object model type is defined as
+ a \cb{typedef} alias for this C++ type. Optional \ci{base} is a C++
+ name that should be given to the generated version. It is normally
+ used as a base for the custom implementation. Optional \ci{include}
+ is the header file that defines the custom implementation. It is
+ \cb{#include}'ed into the generated code immediately after (if
+ \ci{base} is specified) or instead of the generated version."
+ };
+
+ std::vector<Cult::Types::NarrowString> --custom-parser
+ {
+ "<map>",
+ "Use a custom parser implementation instead of the generated version.
+ The <map> argument is in the form
+ \c{\i{name}[\b{=}[\i{base}][\b{/}\i{include}]]}, where the \ci{name}
+ component is the XML Schema type name being customized. Optional
+ \ci{base} is a C++ name that should be given to the generated
+ version. It is normally used as a base for the custom implementation.
+ Optional \ci{include} is the header file that defines the custom
+ implementation. It is \cb{#include}'ed into the generated code
+ immediately after (if \ci{base} is specified) or instead of the
+ generated version."
+ };
+
+ std::vector<Cult::Types::NarrowString> --custom-serializer
+ {
+ "<map>",
+ "Use a custom serializer implementation instead of the generated
+ version. The <map> argument is in the form
+ \c{\i{name}[\b{=}[\i{base}][\b{/}\i{include}]]}, where The \ci{name}
+ component is the XML Schema type name being customized. Optional
+ \ci{base} is a C++ name that should be given to the generated
+ version. It is normally used as a base for the custom implementation.
+ Optional \ci{include} is the header file that defines the custom
+ implementation. It is \cb{#include}'ed into the generated code
+ immediately after (if \ci{base} is specified) or instead of the
+ generated version."
+ };
+
+ // Root element/type.
+ //
+
+ bool --root-element-first
+ {
+ "Treat only the first global element as a document root. This
+ determines for which elements parser and serializer aggregates
+ are generated. By default all global elements are considered
+ document roots. See also the \cb{--generate-aggregate} option."
+ };
+
+ bool --root-element-last
+ {
+ "Treat only the last global element as a document root. This
+ determines for which elements parser and serializer aggregates
+ are generated. By default all global elements are considered
+ document roots. See also the \cb{--generate-aggregate} option."
+ };
+
+ bool --root-element-all
+ {
+ "Treat all global elements as document roots (the default behavior).
+ This determines for which elements parser and serializer aggregates
+ are generated. By explicitly specifying this option you can suppress
+ the warning that is issued if more than one global element is
+ defined. See also the \cb{--generate-aggregate} option."
+ };
+
+ bool --root-element-none
+ {
+ "Do not treat any global elements as document roots. This determines
+ for which elements parser and serializer aggregates are generated.
+ By default all global elements are considered document roots. See
+ also the \cb{--generate-aggregate} option."
+ };
+
+ std::vector<Cult::Types::NarrowString> --root-element
+ {
+ "<element>",
+ "Treat only <element> as a document root. This determines for which
+ elements parser and serializer aggregates are generated. Repeat
+ this option to specify more than one root element. See also the
+ \cb{--generate-aggregate} option."
+ };
+
+ std::vector<Cult::Types::NarrowString> --root-type
+ {
+ "<type>",
+ "Generate parser/serializer aggregate for <type>. Repeat this option
+ to specify more than one type. See also the \cb{--generate-aggregate}
+ option."
+ };
+
+ // Suffixes.
+ //
+ Cult::Types::NarrowString --pskel-type-suffix = "_pskel"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{_pskel} to construct the
+ names of generated parser skeletons."
+ };
+
+ Cult::Types::NarrowString --sskel-type-suffix = "_sskel"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{_sskel} to construct the
+ names of generated serializer skeletons."
+ };
+
+ Cult::Types::NarrowString --pskel-file-suffix = "-pskel"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{-pskel} to construct the
+ names of generated parser skeleton files."
+ };
+
+ Cult::Types::NarrowString --sskel-file-suffix = "-sskel"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{-sskel} to construct the
+ names of generated serializer skeleton files."
+ };
+
+ Cult::Types::NarrowString --pimpl-type-suffix = "_pimpl"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{_pimpl} to construct the
+ names of generated parser implementations."
+ };
+
+ Cult::Types::NarrowString --simpl-type-suffix = "_simpl"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{_simpl} to construct the
+ names of generated serializer implementations."
+ };
+
+ Cult::Types::NarrowString --pimpl-file-suffix = "-pimpl"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{-pimpl} to construct the
+ names of generated parser implementation files."
+ };
+
+ Cult::Types::NarrowString --simpl-file-suffix = "-simpl"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{-simpl} to construct the
+ names of generated serializer implementation files."
+ };
+
+ Cult::Types::NarrowString --paggr-type-suffix = "_paggs"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{_paggs} to construct the
+ names of generated parser aggregates."
+ };
+
+ Cult::Types::NarrowString --saggr-type-suffix = "_saggr"
+ {
+ "<suffix>",
+ "Use <suffix> instead of the default \cb{_saggr} to construct the
+ names of generated serializer aggregates."
+ };
+ };
+ }
+}
diff --git a/xsde/cxx/options.cli b/xsde/cxx/options.cli
new file mode 100644
index 0000000..45425ea
--- /dev/null
+++ b/xsde/cxx/options.cli
@@ -0,0 +1,515 @@
+// file : xsde/cxx/options.cli
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include <vector>;
+include <string>;
+include <cstddef>; // std::size_t
+
+include <cult/types.hxx>; // NarrowString
+
+include <options.cli>;
+
+namespace CXX
+{
+ class options: ::options = 0
+ {
+ Cult::Types::NarrowString --output-dir
+ {
+ "<dir>",
+ "Write generated files to <dir> instead of the current directory."
+ };
+
+ Cult::Types::NarrowString --char-encoding = "utf8"
+ {
+ "<enc>",
+ "Specify the application character encoding. Valid values are \cb{utf8}
+ (default) and \cb{iso8859-1}. Note that this encoding is not the same
+ as the XML document encoding that is being parsed or serialized.
+ Rather, it is the encoding that is used inside the application. When
+ an XML document is parsed, the character data is automatically
+ converted to the application encoding. Similarly, when an XML
+ document is serialized, the data in the application encoding is
+ automatically converted to the resulting document encoding."
+ };
+
+ // C++ features.
+ //
+ bool --no-stl
+ {
+ "Generate code that does not use the C++ Standard Template Library
+ (STL)."
+ };
+
+ bool --no-iostream
+ {
+ "Generate code that does not use the C++ standard input/output stream
+ library (iostream)."
+ };
+
+ bool --no-exceptions
+ {
+ "Generate code that does not use C++ exceptions."
+ };
+
+ bool --no-long-long
+ {
+ "Generate code that does not use the \cb{long long} and \cb{unsigned
+ long long} types. The 64 bit \cb{long} and \cb{unsignedLong} built-in
+ XML Schema types are then mapped to \cb{long} and \cb{unsigned long}."
+ };
+
+ bool --custom-allocator
+ {
+ "Generate code that performs memory management using custom allocator
+ functions provided by your application instead of the standard operator
+ \cb{new} and \cb{delete}."
+ };
+
+ bool --generate-inline
+ {
+ "Generate simple functions inline. This option triggers creation of the
+ inline file."
+ };
+
+ bool --suppress-reset
+ {
+ "Suppress the generation of parser/serializer reset code. Reset support
+ allows you to reuse parsers/serializers after an error."
+ };
+
+ // Extern XML Schema.
+ //
+ bool --generate-xml-schema
+ {
+ "Generate a C++ header files as if the schema being compiled defines the
+ XML Schema namespace. For the C++/Parser mapping, the resulting file
+ will contain definitions for all the parser skeletons and
+ implementations corresponding to the XML Schema built-in types. For
+ the C++/Serializer mapping, the resulting file will contain definitions
+ for all the serializer skeletons and implementations corresponding to
+ the XML Schema built-in types. For the C++/Hybrid mapping, in addition
+ the the above, a third header file will contain definitions for all
+ the object model types corresponding to the XML Schema built-in types.
+
+ The schema file provided to the compiler need not exist and is only
+ used to derive the name of the resulting header file. Use the
+ \cb{--extern-xml-schema} option to include this file in the
+ generated files for other schemas."
+ };
+
+ Cult::Types::NarrowString --extern-xml-schema
+ {
+ "<file>",
+ "Include a header file derived from <file> instead of generating the
+ XML Schema namespace mapping inline. The provided file need not
+ exist and is only used to derive the name of the included header
+ file. Use the \cb{--generate-xml-schema} option to generate this
+ header file."
+ };
+
+ // Namespace mapping.
+ //
+ std::vector<Cult::Types::NarrowString> --namespace-map
+ {
+ "<xns>=<cns>",
+ "Map XML Schema namespace <xns> to C++ namespace <cns>. Repeat
+ this option to specify mapping for more than one XML Schema namespace.
+ For example, the following option:
+
+ \cb{--namespace-map http://example.com/foo/bar=foo::bar}
+
+ Will map the \cb{http://example.com/foo/bar} XML Schema namespace to
+ the \cb{foo::bar} C++ namespace."
+ };
+
+ std::vector<Cult::Types::NarrowString> --namespace-regex
+ {
+ "<regex>",
+ "Add <regex> to the list of regular expressions used to translate XML
+ Schema namespace names to C++ namespace names. <regex> is a Perl-like
+ regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}. Any character can be
+ used as a delimiter instead of \cb{/}. Escaping of the delimiter
+ character in \ci{pattern} or \ci{replacement} is not supported.
+
+ All the regular expressions are pushed into a stack with the last
+ specified expression considered first. The first match that
+ succeeds is used. Regular expressions are applied to a string in
+ the form
+
+ \c{\i{filename} \i{namespace}}
+
+ For example, if you have file \cb{hello.xsd} with namespace
+ \cb{http://example.com/hello} and you run \cb{xsd} on this file,
+ then the string in question will be:
+
+ \cb{hello.xsd. http://example.com/hello}
+
+ For the built-in XML Schema namespace the string is:
+
+ \cb{XMLSchema.xsd http://www.w3.org/2001/XMLSchema}
+
+ The following three steps are performed for each regular expression
+ until the match is found:
+
+ 1. The expression is applied and if the result is empty the next
+ expression is considered.
+
+ 2. All \cb{/} are replaced with \cb{::}.
+
+ 3. The result is verified to be a valid C++ scope name (e.g.,
+ \cb{foo::bar}). If this test succeeds, the result is used as a
+ C++ namespace name.
+
+ As an example, the following expression maps XML Schema namespaces
+ in the form \cb{http://example.com/foo/bar} to C++ namespaces in the
+ form \cb{foo::bar}:
+
+ \cb{%.* http://example.com/(.+)%$1%}
+
+ See also the REGEX AND SHELL QUOTING section below."
+ };
+
+ bool --namespace-regex-trace
+ {
+ "Trace the process of applying regular expressions specified with the
+ \cb{--namespace-regex} option. Use this option to find out why your
+ regular expressions don't do what you expected them to do."
+ };
+
+ // Reserved names.
+ //
+ std::vector<Cult::Types::NarrowString> --reserved-name
+ {
+ "<n>[=<r>]",
+ "Add name <n> to the list of names that should not be used as
+ identifiers. The name can optionally be followed by \cb{=} and the
+ replacement name <r> that should be used instead. All the C++ keywords
+ are already in this list."
+ };
+
+ // Include options.
+ //
+ bool --include-with-brackets
+ {
+ "Use angle brackets (<>) instead of quotes (\"\") in generated
+ \cb{#include} directives."
+ };
+
+ Cult::Types::NarrowString --include-prefix
+ {
+ "<prefix>",
+ "Add <prefix> to generated \cb{#include} directive paths.
+
+ For example, if you had the following import element in your schema
+
+ \cb{<import namespace=\"...\" schemaLocation=\"base.xsd\"/>}
+
+ and compiled this fragment with \cb{--include-prefix schemas/}, then
+ the include directive in the generated code would be:
+
+ \cb{#include \"schemas/base.hxx\"}"
+ };
+
+ std::vector<Cult::Types::NarrowString> --include-regex
+ {
+ "<regex>",
+ "Add <regex> to the list of regular expressions used to transform
+ \cb{#include} directive paths. <regex> is a Perl-like regular
+ expression in the form \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}.
+ Any character can be used as a delimiter instead of \cb{/}. Escaping
+ of the delimiter character in \ci{pattern} or \ci{replacement} is not
+ supported.
+
+ All the regular expressions are pushed into a stack with the last
+ specified expression considered first. The first match that succeeds
+ is used.
+
+ As an example, the following expression transforms paths in the form
+ \cb{schemas/foo/bar} to paths in the form \cb{generated/foo/bar}:
+
+ \cb{%schemas/(.+)%generated/$1%}
+
+ See also the REGEX AND SHELL QUOTING section below."
+ };
+
+ bool --include-regex-trace
+ {
+ "Trace the process of applying regular expressions specified with the
+ \cb{--include-regex} option. Use this option to find out why your
+ regular expressions don't do what you expected them to do."
+ };
+
+ Cult::Types::NarrowString --guard-prefix
+ {
+ "<prefix>",
+ "Add <prefix> to generated header inclusion guards. The prefix is
+ transformed to upper case and characters that are illegal in a
+ preprocessor macro name are replaced with underscores. If this
+ option is not specified then the directory part of the input schema
+ file is used as a prefix."
+ };
+
+ // File suffixes.
+ //
+ Cult::Types::NarrowString --hxx-suffix = ".hxx"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{.hxx} to
+ construct the name of the header file. Note that this suffix is also
+ used to construct names of header files corresponding to
+ included/imported schemas."
+ };
+
+ Cult::Types::NarrowString --ixx-suffix = ".ixx"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{.ixx} to
+ construct the name of the inline file."
+ };
+
+ Cult::Types::NarrowString --cxx-suffix = ".cxx"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{.cxx} to
+ construct the name of the source file."
+ };
+
+ Cult::Types::NarrowString --fwd-suffix = "-fwd.hxx"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{-fwd.hxx} to
+ construct the name of the forward declaration file."
+ };
+
+ Cult::Types::NarrowString --hxx-regex
+ {
+ "<regex>",
+ "Use the provided expression to construct the name of the header file.
+ <regex> is a Perl-like regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}.
+ Note that this expression is also used to construct names of header
+ files corresponding to included/imported schemas.
+
+ For the C++/Hybrid mapping, the <regex> argument can be optionally
+ prefixed with a file key in the form \c{\i{key}=\i{regex}}. The valid
+ values for \ci{key} are \cb{pskel} (parser skeleton files), \cb{pimpl}
+ (parser implementation files), \cb{sskel} (serializer skeleton files),
+ \cb{simpl} (serializer implementation files), and \cb{*} (all files).
+ If \ci{key} is empty or not present then the expression is used for the
+ object model files only.
+
+ See also the REGEX AND SHELL QUOTING section below."
+ };
+
+ Cult::Types::NarrowString --ixx-regex
+ {
+ "<regex>",
+ "Use the provided expression to construct the name of the inline file.
+ <regex> is a Perl-like regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}. For the C++/Hybrid
+ mapping, the <regex> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-regex} option for details. See also the REGEX
+ AND SHELL QUOTING section below."
+ };
+
+ Cult::Types::NarrowString --cxx-regex
+ {
+ "<regex>",
+ "Use the provided expression to construct the name of the source file.
+ <regex> is a Perl-like regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}. For the C++/Hybrid
+ mapping, the <regex> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-regex} option for details. See also the REGEX
+ AND SHELL QUOTING section below."
+ };
+
+ Cult::Types::NarrowString --fwd-regex
+ {
+ "<regex>",
+ "Use the provided expression to construct the name of the forward
+ declaration file. <regex> is a Perl-like regular expression in the
+ form \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}. See also the REGEX
+ AND SHELL QUOTING section below."
+ };
+
+ // Prologues/epilogues.
+ //
+ std::vector<Cult::Types::NarrowString> --hxx-prologue
+ {
+ "<text>",
+ "Insert <text> at the beginning of the header file.
+
+ For the C++/Hybrid mapping, the <text> argument can be optionally
+ prefixed with a file key in the form \c{\i{key}=\i{text}}. The valid
+ values for \ci{key} are \cb{pskel} (parser skeleton files), \cb{pimpl}
+ (parser implementation files), \cb{sskel} (serializer skeleton files),
+ \cb{simpl} (serializer implementation files), and \cb{*} (all files).
+ If \ci{key} is empty or not present then the text is used for the
+ object model files only."
+ };
+
+ std::vector<Cult::Types::NarrowString> --ixx-prologue
+ {
+ "<text>",
+ "Insert <text> at the beginning of the inline file. For the C++/Hybrid
+ mapping, the <text> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-prologue} option for details."
+ };
+
+ std::vector<Cult::Types::NarrowString> --cxx-prologue
+ {
+ "<text>",
+ "Insert <text> at the beginning of the source file. For the C++/Hybrid
+ mapping, the <text> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-prologue} option for details."
+ };
+
+ std::vector<Cult::Types::NarrowString> --fwd-prologue
+ {
+ "<text>",
+ "Insert <text> at the beginning of the forward declaration file."
+ };
+
+ std::vector<Cult::Types::NarrowString> --prologue
+ {
+ "<text>",
+ "Insert <text> at the beginning of each generated file for which
+ there is no file-specific prologue. For the C++/Hybrid mapping, the
+ <text> argument can be optionally prefixed with a file key. See the
+ \cb{--hxx-prologue} option for details."
+ };
+
+ std::vector<Cult::Types::NarrowString> --hxx-epilogue
+ {
+ "<text>",
+ "Insert <text> at the end of the header file. For the C++/Hybrid
+ mapping, the <text> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-prologue} option for details."
+ };
+
+ std::vector<Cult::Types::NarrowString> --ixx-epilogue
+ {
+ "<text>",
+ "Insert <text> at the end of the inline file. For the C++/Hybrid
+ mapping, the <text> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-prologue} option for details."
+ };
+
+ std::vector<Cult::Types::NarrowString> --cxx-epilogue
+ {
+ "<text>",
+ "Insert <text> at the end of the source file. For the C++/Hybrid
+ mapping, the <text> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-prologue} option for details."
+ };
+
+ std::vector<Cult::Types::NarrowString> --fwd-epilogue
+ {
+ "<text>",
+ "Insert <text> at the end of the forward declaration file."
+ };
+
+ std::vector<Cult::Types::NarrowString> --epilogue
+ {
+ "<text>",
+ "Insert <text> at the end of each generated file for which there
+ is no file-specific epilogue. For the C++/Hybrid mapping, the <text>
+ argument can be optionally prefixed with a file key. See the
+ \cb{--hxx-prologue} option for details."
+ };
+
+ Cult::Types::NarrowString --hxx-prologue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the beginning of the header file.
+
+ For the C++/Hybrid mapping, the <file> argument can be optionally
+ prefixed with a file key in the form \c{\i{key}=\i{file}}. The valid
+ values for \ci{key} are \cb{pskel} (parser skeleton files), \cb{pimpl}
+ (parser implementation files), \cb{sskel} (serializer skeleton files),
+ \cb{simpl} (serializer implementation files), and \cb{*} (all files).
+ If \ci{key} is empty or not present then the file is used for the
+ object model files only."
+ };
+
+ Cult::Types::NarrowString --ixx-prologue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the beginning of the inline file.
+ For the C++/Hybrid mapping, the <file> argument can be optionally
+ prefixed with a file key. See the \cb{--hxx-prologue-file} option
+ for details."
+ };
+
+ Cult::Types::NarrowString --cxx-prologue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the beginning of the source file.
+ For the C++/Hybrid mapping, the <file> argument can be optionally
+ prefixed with a file key. See the \cb{--hxx-prologue-file} option
+ for details."
+ };
+
+ Cult::Types::NarrowString --fwd-prologue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the beginning of the forward
+ declaration file."
+ };
+
+ Cult::Types::NarrowString --prologue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the beginning of each generated
+ file for which there is no file-specific prologue file. For the
+ C++/Hybrid mapping, the <file> argument can be optionally prefixed
+ with a file key. See the \cb{--hxx-prologue-file} option for details."
+ };
+
+ Cult::Types::NarrowString --hxx-epilogue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the end of the header file.
+ For the C++/Hybrid mapping, the <file> argument can be optionally
+ prefixed with a file key. See the \cb{--hxx-prologue-file} option
+ for details."
+ };
+
+ Cult::Types::NarrowString --ixx-epilogue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the end of the inline file.
+ For the C++/Hybrid mapping, the <file> argument can be optionally
+ prefixed with a file key. See the \cb{--hxx-prologue-file} option
+ for details."
+ };
+
+ Cult::Types::NarrowString --cxx-epilogue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the end of the source file.
+ For the C++/Hybrid mapping, the <file> argument can be optionally
+ prefixed with a file key. See the \cb{--hxx-prologue-file} option
+ for details."
+ };
+
+ Cult::Types::NarrowString --fwd-epilogue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the end of the forward declaration
+ file."
+ };
+
+ Cult::Types::NarrowString --epilogue-file
+ {
+ "<file>",
+ "Insert the content of the <file> at the end of each generated file
+ for which there is no file-specific epilogue file. For the C++/Hybrid
+ mapping, the <file> argument can be optionally prefixed with a file
+ key. See the \cb{--hxx-prologue-file} option for details."
+ };
+ };
+}
diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx
index 6c8f8c7..828368a 100644
--- a/xsde/cxx/parser/generator.cxx
+++ b/xsde/cxx/parser/generator.cxx
@@ -16,8 +16,6 @@
#include <cutl/compiler/cxx-indenter.hxx>
#include <cutl/compiler/sloc-counter.hxx>
-#include <backend-elements/indentation/clip.hxx>
-
#include <xsd-frontend/semantic-graph.hxx>
#include <type-map/lexer.hxx>
@@ -44,7 +42,7 @@
#include <cxx/parser/attribute-validation-source.hxx>
#include <cxx/parser/characters-validation-source.hxx>
-#include <usage.hxx>
+#include <cxx/parser/options.hxx>
#include "../../../libxsde/xsde/cxx/version.hxx"
@@ -184,346 +182,8 @@ namespace CXX
Void Parser::Generator::
usage ()
{
- std::wostream& o (wcout);
- ::CLI::Indent::Clip< ::CLI::OptionsUsage, WideChar> clip (o);
-
- o << "--type-map <mapfile>" << endl
- << " Read XML Schema to C++ type mapping information\n"
- << " from <mapfile>. Repeat this option to specify\n"
- << " several type maps. Type maps are considered in\n"
- << " order of appearance and the first match is used."
- << endl;
-
- o << "--char-encoding <enc>" << endl
- << " Specify the character encoding that should be\n"
- << " used for the extracted text data. Valid values\n"
- << " are 'utf8' (default) and 'iso8859-1'."
- << endl;
-
- o << "--no-stl" << endl
- << " Generate code that does not use STL."
- << endl;
-
- o << "--no-iostream" << endl
- << " Generate code that does not use the iostream\n"
- << " library."
- << endl;
-
- o << "--no-exceptions" << endl
- << " Generate code that does not use C++ exceptions."
- << endl;
-
- o << "--no-long-long" << endl
- << " Generate code that does not use the long long\n"
- << " and unsigned long long types."
- << endl;
-
- o << "--reuse-style-mixin" << endl
- << " Generate code that supports the mixin base parser\n"
- << " implementation reuse style."
- << endl;
-
- o << "--reuse-style-none" << endl
- << " Do not generate any support for base parser\n"
- << " implementation reuse."
- << endl;
-
- o << "--generate-inline" << endl
- << " Generate certain functions inline."
- << endl;
-
- o << "--suppress-validation" << endl
- << " Suppress the generation of validation code."
- << endl;
-
- o << "--generate-polymorphic" << endl
- << " Generate polymorphism-aware code. Specify this\n"
- << " option if you use substitution groups or xsi:type."
- << endl;
-
- o << "--runtime-polymorphic" << endl
- << " Generate non-polymorphic code that uses the\n"
- << " runtime library configured with polymorphism\n"
- << " support."
- << endl;
-
- o << "--suppress-reset" << endl
- << " Suppress the generation of parser reset code."
- << endl;
-
- o << "--custom-allocator" << endl
- << " Generate code that uses custom allocator functions\n"
- << " instead of operator new/delete."
- << endl;
-
- o << "--generate-noop-impl" << endl
- << " Generate a sample parser implementation that\n"
- << " does nothing (no operation)."
- << endl;
-
- o << "--generate-print-impl" << endl
- << " Generate a sample parser implementation that\n"
- << " prints the XML data to STDOUT."
- << endl;
-
- o << "--generate-test-driver" << endl
- << " Generate a test driver for the sample parser\n"
- << " implementation."
- << endl;
-
- o << "--force-overwrite" << endl
- << " Force overwriting of the existing implementation\n"
- << " and test driver files."
- << endl;
-
- o << "--root-element-first" << endl
- << " Indicate that the first global element is the\n"
- << " document root."
- << endl;
-
- o << "--root-element-last" << endl
- << " Indicate that the last global element is the\n"
- << " document root."
- << endl;
-
- o << "--root-element <element>" << endl
- << " Indicate that <element> is the document root."
- << endl;
-
- o << "--generate-xml-schema" << endl
- << " Generate a C++ header file as if the schema being\n"
- << " compiled defines the XML Schema namespace."
- << endl;
-
- o << "--extern-xml-schema <file>" << endl
- << " Generate code as if the XML Schema namespace was\n"
- << " defined in <file> and xsd:included in the schema\n"
- << " being compiled."
- << endl;
-
- o << "--output-dir <dir>" << endl
- << " Write generated files to <dir> instead of the\n"
- << " current directory."
- << endl;
-
- o << "--skel-type-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '_pskel' to\n"
- << " construct the names of generated parser skeletons."
- << endl;
-
- o << "--skel-file-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '-pskel' to\n"
- << " construct the names of generated parser skeleton\n"
- << " files."
- << endl;
-
- o << "--impl-type-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '_pimpl' to\n"
- << " construct the names of parser implementations for\n"
- << " the built-in XML Schema types and sample parser\n"
- << " implementations."
- << endl;
-
- o << "--impl-file-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '-pimpl' to\n"
- << " construct the names of generated sample parser\n"
- << " implementation files."
- << endl;
-
- o << "--namespace-map <xns>=<cns>" << endl
- << " Map XML Schema namespace <xns> to C++ namespace\n"
- << " <cns>. Repeat this option to specify mapping for\n"
- << " more than one XML Schema namespace."
- << endl;
-
- o << "--namespace-regex <regex>" << endl
- << " Add <regex> to the list of regular expressions\n"
- << " used to translate XML Schema namespace names to\n"
- << " C++ namespace names."
- << endl;
-
- o << "--namespace-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --namespace-regex option."
- << endl;
-
- o << "--reserved-name <name>" << endl
- << " Add <name> to the list of names that should not\n"
- << " be used as identifiers. The name can optionally\n"
- << " be followed by '=' and the replacement name that\n"
- << " should be used instead."
- << endl;
-
- o << "--include-with-brackets" << endl
- << " Use angle brackets (<>) instead of quotes (\"\") in\n"
- << " generated #include directives."
- << endl;
-
- o << "--include-prefix <prefix>" << endl
- << " Add <prefix> to generated #include directive\n"
- << " paths."
- << endl;
-
- o << "--include-regex <regex>" << endl
- << " Add <regex> to the list of regular expressions\n"
- << " used to transform #include directive paths."
- << endl;
-
- o << "--include-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --include-regex option."
- << endl;
-
- o << "--guard-prefix <prefix>" << endl
- << " Add <prefix> to generated header inclusion guards."
- << endl;
-
- o << "--hxx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.hxx' to\n"
- << " construct the name of the header file."
- << endl;
-
- o << "--ixx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.ixx' to\n"
- << " construct the name of the inline file."
- << endl;
-
- o << "--cxx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.cxx' to\n"
- << " construct the name of the source file."
- << endl;
-
- o << "--hxx-regex <regex>" << endl
- << " Use <regex> to construct the name of the header\n"
- << " file."
- << endl;
-
- o << "--ixx-regex <regex>" << endl
- << " Use <regex> to construct the name of the inline\n"
- << " file."
- << endl;
-
- o << "--cxx-regex <regex>" << endl
- << " Use <regex> to construct the name of the source\n"
- << " file."
- << endl;
-
-
- // Prologues.
- //
- o << "--hxx-prologue <text>" << endl
- << " Insert <text> at the beginning of the header file."
- << endl;
-
- o << "--ixx-prologue <text>" << endl
- << " Insert <text> at the beginning of the inline file."
- << endl;
-
- o << "--cxx-prologue <text>" << endl
- << " Insert <text> at the beginning of the source file."
- << endl;
-
- o << "--prologue <text>" << endl
- << " Insert <text> at the beginning of each generated\n"
- << " file for which there is no file-specific prologue."
- << endl;
-
-
- // Epilogues.
- //
- o << "--hxx-epilogue <text>" << endl
- << " Insert <text> at the end of the header file."
- << endl;
-
- o << "--ixx-epilogue <text>" << endl
- << " Insert <text> at the end of the inline file."
- << endl;
-
- o << "--cxx-epilogue <text>" << endl
- << " Insert <text> at the end of the source file."
- << endl;
-
- o << "--epilogue <text>" << endl
- << " Insert <text> at the end of each generated file\n"
- << " for which there is no file-specific epilogue."
- << endl;
-
-
- // Prologue files.
- //
- o << "--hxx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the header file."
- << endl;
-
- o << "--ixx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the inline file."
- << endl;
-
- o << "--cxx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the source file."
- << endl;
-
- o << "--prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of each generated file for which there is no file-\n"
- << " specific prologue file."
- << endl;
-
-
- // Epilogue files.
- //
- o << "--hxx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the header file."
- << endl;
-
- o << "--ixx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the inline file."
- << endl;
-
- o << "--cxx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the source file."
- << endl;
-
- o << "--epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " each generated file for which there is no file-\n"
- << " specific epilogue file."
- << endl;
-
-
- // Misc.
- //
- o << "--show-anonymous" << endl
- << " Show elements and attributes that are of anonymous\n"
- << " types."
- << endl;
-
- o << "--show-sloc" << endl
- << " Show the number of generated physical source lines\n"
- << " of code (SLOC)."
- << endl;
-
- o << "--sloc-limit <num>" << endl
- << " Check that the number of generated physical source\n"
- << " lines of code (SLOC) does not exceed <num>."
- << endl;
-
- o << "--options-file <file>" << endl
- << " Read additional options from <file>. Each option\n"
- << " should appear on a separate line optionally\n"
- << " followed by space and an argument."
- << endl;
-
- o << "--proprietary-license" << endl
- << " Indicate that the generated code is licensed under\n"
- << " a proprietary license instead of the GPL."
- << endl;
+ CXX::Parser::options::print_usage (wcout);
+ CXX::options::print_usage (wcout);
}
Parser::CLI::OptionsSpec Parser::Generator::
@@ -631,7 +291,6 @@ namespace CXX
AutoUnlinks& unlinks)
{
using std::ios_base;
- namespace Indentation = BackendElements::Indentation;
typedef cutl::re::regexsub Regex;
diff --git a/xsde/cxx/parser/options.cli b/xsde/cxx/parser/options.cli
new file mode 100644
index 0000000..552b473
--- /dev/null
+++ b/xsde/cxx/parser/options.cli
@@ -0,0 +1,159 @@
+// file : xsde/cxx/parser/options.cli
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include <vector>;
+include <string>;
+include <cstddef>; // std::size_t
+
+include <cult/types.hxx>; // NarrowString
+
+include <cxx/options.cli>;
+
+namespace CXX
+{
+ namespace Parser
+ {
+ class options: CXX::options
+ {
+ std::vector<Cult::Types::NarrowString> --type-map
+ {
+ "<mapfile>",
+ "Read XML Schema to C++ type mapping information from <mapfile>.
+ Repeat this option to specify several type maps. Type maps are
+ considered in order of appearance and the first match is used.
+ By default all user-defined types are mapped to \cb{void}. See
+ the TYPE MAP section below for more information."
+ };
+
+ bool --suppress-validation
+ {
+ "Suppress the generation of validation code."
+ };
+
+ // Reuse style.
+ //
+ bool --reuse-style-mixin
+ {
+ "Generate code that supports the mixin base parser implementation
+ reuse style. Note that this reuse style relies on virtual
+ inheritance and may result in a substantial object code size
+ increase for large vocabularies. By default support for the tiein
+ style is generated."
+ };
+
+ bool --reuse-style-none
+ {
+ "Do not generate any support for base parser implementation reuse.
+ By default support for the tiein style is generated."
+ };
+
+ // Polymorphism.
+ //
+ bool --generate-polymorphic
+ {
+ "Generate polymorphism-aware code. Specify this option if you use
+ substitution groups or \cb{xsi:type}."
+ };
+
+ bool --runtime-polymorphic
+ {
+ "Generate non-polymorphic code that uses the runtime library
+ configured with polymorphism support."
+ };
+
+ // Implementation/driver.
+ //
+ bool --generate-noop-impl
+ {
+ "Generate a sample parser implementation that does nothing (no
+ operation). The sample implementation can then be filled with
+ the application-specific code. For an input file in the form
+ \cb{name.xsd} this option triggers the generation of the two
+ additional C++ files in the form: \cb{name-pimpl.hxx} (parser
+ implementation header file) and \cb{name-pimpl.cxx} (parser
+ implementation source file)."
+ };
+
+ bool --generate-print-impl
+ {
+ "Generate a sample parser implementation that prints the XML data
+ to \c{STDOUT}. For an input file in the form \cb{name.xsd} this
+ option triggers the generation of the two additional C++ files
+ in the form: \cb{name-pimpl.hxx} (parser implementation header
+ file) and \cb{name-pimpl.cxx} (parser implementation source file)."
+ };
+
+ bool --generate-test-driver
+ {
+ "Generate a test driver for the sample parser implementation. For
+ an input file in the form \cb{name.xsd} this option triggers the
+ generation of an additional C++ file in the form
+ \cb{name-pdriver.cxx}."
+ };
+
+ bool --force-overwrite
+ {
+ "Force overwriting of the existing implementation and test driver
+ files. Use this option only if you do not mind loosing the changes
+ you have made in the sample implementation or test driver files."
+ };
+
+ // Root element.
+ //
+ bool --root-element-first
+ {
+ "Indicate that the first global element is the document root. This
+ information is used to generate the test driver for the sample
+ implementation."
+ };
+
+ bool --root-element-last
+ {
+ "Indicate that the last global element is the document root. This
+ information is used to generate the test driver for the sample
+ implementation."
+ };
+
+ Cult::Types::NarrowString --root-element
+ {
+ "<element>",
+ "Indicate that <element> is the document root. This information is
+ used to generate the test driver for the sample implementation."
+ };
+
+ // Suffixes.
+ //
+ Cult::Types::NarrowString --skel-type-suffix = "_pskel"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{_pskel} to
+ construct the names of generated parser skeletons."
+ };
+
+ Cult::Types::NarrowString --skel-file-suffix = "-pskel"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{-pskel} to
+ construct the names of generated parser skeleton files."
+ };
+
+ Cult::Types::NarrowString --impl-type-suffix = "_pimpl"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{_pimpl} to
+ construct the names of parser implementations for the built-in
+ XML Schema types and sample parser implementations."
+ };
+
+ Cult::Types::NarrowString --impl-file-suffix = "-pimpl"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{-pimpl} to
+ construct the names of generated sample parser implementation
+ files."
+ };
+ };
+ }
+}
diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx
index 167dae5..98e1cae 100644
--- a/xsde/cxx/serializer/generator.cxx
+++ b/xsde/cxx/serializer/generator.cxx
@@ -16,8 +16,6 @@
#include <cutl/compiler/cxx-indenter.hxx>
#include <cutl/compiler/sloc-counter.hxx>
-#include <backend-elements/indentation/clip.hxx>
-
#include <xsd-frontend/semantic-graph.hxx>
#include <type-map/lexer.hxx>
@@ -42,7 +40,7 @@
#include <cxx/serializer/element-validation-source.hxx>
#include <cxx/serializer/attribute-validation-source.hxx>
-#include <usage.hxx>
+#include <cxx/serializer/options.hxx>
#include "../../../libxsde/xsde/cxx/version.hxx"
@@ -181,342 +179,8 @@ namespace CXX
Void Serializer::Generator::
usage ()
{
- std::wostream& o (wcout);
- ::CLI::Indent::Clip< ::CLI::OptionsUsage, WideChar> clip (o);
-
- o << "--type-map <mapfile>" << endl
- << " Read XML Schema to C++ type mapping information\n"
- << " from <mapfile>. Repeat this option to specify\n"
- << " several type maps. Type maps are considered in\n"
- << " order of appearance and the first match is used."
- << endl;
-
- o << "--char-encoding <enc>" << endl
- << " Specify the character encoding that is used in\n"
- << " the text data being serialized. Valid values are\n"
- << " 'utf8' (default) and 'iso8859-1'."
- << endl;
-
- o << "--no-stl" << endl
- << " Generate code that does not use STL."
- << endl;
-
- o << "--no-iostream" << endl
- << " Generate code that does not use the iostream\n"
- << " library."
- << endl;
-
- o << "--no-exceptions" << endl
- << " Generate code that does not use C++ exceptions."
- << endl;
-
- o << "--no-long-long" << endl
- << " Generate code that does not use the long long\n"
- << " and unsigned long long types."
- << endl;
-
- o << "--reuse-style-mixin" << endl
- << " Generate code that supports the mixin base\n"
- << " serializer implementation reuse style."
- << endl;
-
- o << "--reuse-style-none" << endl
- << " Do not generate any support for base serializer\n"
- << " implementation reuse."
- << endl;
-
- o << "--generate-inline" << endl
- << " Generate certain functions inline."
- << endl;
-
- o << "--suppress-validation" << endl
- << " Suppress the generation of validation code."
- << endl;
-
- o << "--generate-polymorphic" << endl
- << " Generate polymorphism-aware code. Specify this\n"
- << " option if you use substitution groups or xsi:type."
- << endl;
-
- o << "--runtime-polymorphic" << endl
- << " Generate non-polymorphic code that uses the\n"
- << " runtime library configured with polymorphism\n"
- << " support."
- << endl;
-
- o << "--suppress-reset" << endl
- << " Suppress the generation of serializer reset code."
- << endl;
-
- o << "--custom-allocator" << endl
- << " Generate code that uses custom allocator functions\n"
- << " instead of operator new/delete."
- << endl;
-
- o << "--generate-empty-impl" << endl
- << " Generate a sample serializer implementation with\n"
- << " empty function bodies."
- << endl;
-
- o << "--generate-test-driver" << endl
- << " Generate a test driver for the sample serializer\n"
- << " implementation."
- << endl;
-
- o << "--force-overwrite" << endl
- << " Force overwriting of the existing implementation\n"
- << " and test driver files."
- << endl;
-
- o << "--root-element-first" << endl
- << " Indicate that the first global element is the\n"
- << " document root."
- << endl;
-
- o << "--root-element-last" << endl
- << " Indicate that the last global element is the\n"
- << " document root."
- << endl;
-
- o << "--root-element <element>" << endl
- << " Indicate that <element> is the document root."
- << endl;
-
- o << "--generate-xml-schema" << endl
- << " Generate a C++ header file as if the schema being\n"
- << " compiled defines the XML Schema namespace."
- << endl;
-
- o << "--extern-xml-schema <file>" << endl
- << " Generate code as if the XML Schema namespace was\n"
- << " defined in <file> and xsd:included in the schema\n"
- << " being compiled."
- << endl;
-
- o << "--output-dir <dir>" << endl
- << " Write generated files to <dir> instead of the\n"
- << " current directory."
- << endl;
-
- o << "--skel-type-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '_sskel' to\n"
- << " construct the names of generated serializer\n"
- << " skeletons."
- << endl;
-
- o << "--skel-file-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '-sskel' to\n"
- << " construct the names of generated serializer\n"
- << " skeleton files."
- << endl;
-
- o << "--impl-type-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '_simpl' to\n"
- << " construct the names of serializer implementations\n"
- << " for the built-in XML Schema types and sample\n"
- << " serializer implementations."
- << endl;
-
- o << "--impl-file-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '-simpl' to\n"
- << " construct the names of generated sample\n"
- << " serializer implementation files."
- << endl;
-
- o << "--namespace-map <xns>=<cns>" << endl
- << " Map XML Schema namespace <xns> to C++ namespace\n"
- << " <cns>. Repeat this option to specify mapping for\n"
- << " more than one XML Schema namespace."
- << endl;
-
- o << "--namespace-regex <regex>" << endl
- << " Add <regex> to the list of regular expressions\n"
- << " used to translate XML Schema namespace names to\n"
- << " C++ namespace names."
- << endl;
-
- o << "--namespace-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --namespace-regex option."
- << endl;
-
- o << "--reserved-name <name>" << endl
- << " Add <name> to the list of names that should not\n"
- << " be used as identifiers. The name can optionally\n"
- << " be followed by '=' and the replacement name that\n"
- << " should be used instead."
- << endl;
-
- o << "--include-with-brackets" << endl
- << " Use angle brackets (<>) instead of quotes (\"\") in\n"
- << " generated #include directives."
- << endl;
-
- o << "--include-prefix <prefix>" << endl
- << " Add <prefix> to generated #include directive\n"
- << " paths."
- << endl;
-
- o << "--include-regex <regex>" << endl
- << " Add <regex> to the list of regular expressions\n"
- << " used to transform #include directive paths."
- << endl;
-
- o << "--include-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --include-regex option."
- << endl;
-
- o << "--guard-prefix <prefix>" << endl
- << " Add <prefix> to generated header inclusion guards."
- << endl;
-
- o << "--hxx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.hxx' to\n"
- << " construct the name of the header file."
- << endl;
-
- o << "--ixx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.ixx' to\n"
- << " construct the name of the inline file."
- << endl;
-
- o << "--cxx-suffix <suffix>" << endl
- << " Use <suffix> instead of the default '.cxx' to\n"
- << " construct the name of the source file."
- << endl;
-
- o << "--hxx-regex <regex>" << endl
- << " Use <regex> to construct the name of the header\n"
- << " file."
- << endl;
-
- o << "--ixx-regex <regex>" << endl
- << " Use <regex> to construct the name of the inline\n"
- << " file."
- << endl;
-
- o << "--cxx-regex <regex>" << endl
- << " Use <regex> to construct the name of the source\n"
- << " file."
- << endl;
-
-
- // Prologues.
- //
- o << "--hxx-prologue <text>" << endl
- << " Insert <text> at the beginning of the header file."
- << endl;
-
- o << "--ixx-prologue <text>" << endl
- << " Insert <text> at the beginning of the inline file."
- << endl;
-
- o << "--cxx-prologue <text>" << endl
- << " Insert <text> at the beginning of the source file."
- << endl;
-
- o << "--prologue <text>" << endl
- << " Insert <text> at the beginning of each generated\n"
- << " file for which there is no file-specific prologue."
- << endl;
-
-
- // Epilogues.
- //
- o << "--hxx-epilogue <text>" << endl
- << " Insert <text> at the end of the header file."
- << endl;
-
- o << "--ixx-epilogue <text>" << endl
- << " Insert <text> at the end of the inline file."
- << endl;
-
- o << "--cxx-epilogue <text>" << endl
- << " Insert <text> at the end of the source file."
- << endl;
-
- o << "--epilogue <text>" << endl
- << " Insert <text> at the end of each generated file\n"
- << " for which there is no file-specific epilogue."
- << endl;
-
-
- // Prologue files.
- //
- o << "--hxx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the header file."
- << endl;
-
- o << "--ixx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the inline file."
- << endl;
-
- o << "--cxx-prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of the source file."
- << endl;
-
- o << "--prologue-file <file>" << endl
- << " Insert the content of the <file> at the beginning\n"
- << " of each generated file for which there is no file-\n"
- << " specific prologue file."
- << endl;
-
-
- // Epilogue files.
- //
- o << "--hxx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the header file."
- << endl;
-
- o << "--ixx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the inline file."
- << endl;
-
- o << "--cxx-epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " the source file."
- << endl;
-
- o << "--epilogue-file <file>" << endl
- << " Insert the content of the <file> at the end of\n"
- << " each generated file for which there is no file-\n"
- << " specific epilogue file."
- << endl;
-
-
- // Misc.
- //
- o << "--show-anonymous" << endl
- << " Show elements and attributes that are of anonymous\n"
- << " types."
- << endl;
-
- o << "--show-sloc" << endl
- << " Show the number of generated physical source lines\n"
- << " of code (SLOC)."
- << endl;
-
- o << "--sloc-limit <num>" << endl
- << " Check that the number of generated physical source\n"
- << " lines of code (SLOC) does not exceed <num>."
- << endl;
-
- o << "--options-file <file>" << endl
- << " Read additional options from <file>. Each option\n"
- << " should appear on a separate line optionally\n"
- << " followed by space and an argument."
- << endl;
-
- o << "--proprietary-license" << endl
- << " Indicate that the generated code is licensed under\n"
- << " a proprietary license instead of the GPL."
- << endl;
+ CXX::Serializer::options::print_usage (wcout);
+ CXX::options::print_usage (wcout);
}
Serializer::CLI::OptionsSpec Serializer::Generator::
@@ -624,7 +288,6 @@ namespace CXX
AutoUnlinks& unlinks)
{
using std::ios_base;
- namespace Indentation = BackendElements::Indentation;
typedef cutl::re::regexsub Regex;
diff --git a/xsde/cxx/serializer/options.cli b/xsde/cxx/serializer/options.cli
new file mode 100644
index 0000000..ddb6c60
--- /dev/null
+++ b/xsde/cxx/serializer/options.cli
@@ -0,0 +1,148 @@
+// file : xsde/cxx/serializer/options.cli
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include <vector>;
+include <string>;
+include <cstddef>; // std::size_t
+
+include <cult/types.hxx>; // NarrowString
+
+include <cxx/options.cli>;
+
+namespace CXX
+{
+ namespace Serializer
+ {
+ class options: CXX::options
+ {
+ std::vector<Cult::Types::NarrowString> --type-map
+ {
+ "<mapfile>",
+ "Read XML Schema to C++ type mapping information from <mapfile>.
+ Repeat this option to specify several type maps. Type maps are
+ considered in order of appearance and the first match is used.
+ By default all user-defined types are mapped to \cb{void}. See
+ the TYPE MAP section below for more information."
+ };
+
+ bool --suppress-validation
+ {
+ "Suppress the generation of validation code."
+ };
+
+ // Reuse style.
+ //
+ bool --reuse-style-mixin
+ {
+ "Generate code that supports the mixin base serializer implementation
+ reuse style. Note that this reuse style relies on virtual inheritance
+ and may result in a substantial object code size increase for large
+ vocabularies. By default support for the tiein style is generated."
+ };
+
+ bool --reuse-style-none
+ {
+ "Do not generate any support for base serializer implementation
+ reuse. By default support for the tiein style is generated."
+ };
+
+ // Polymorphism.
+ //
+ bool --generate-polymorphic
+ {
+ "Generate polymorphism-aware code. Specify this option if you use
+ substitution groups or \cb{xsi:type}."
+ };
+
+ bool --runtime-polymorphic
+ {
+ "Generate non-polymorphic code that uses the runtime library
+ configured with polymorphism support."
+ };
+
+ // Implementation/driver.
+ //
+ bool --generate-empty-impl
+ {
+ "Generate a sample serializer implementation with empty function
+ bodies which can then be filled with the application-specific code.
+ For an input file in the form \cb{name.xsd} this option triggers
+ the generation of the two additional C++ files in the form:
+ \cb{name-simpl.hxx} (serializer implementation header file) and
+ \cb{name-simpl.cxx} (serializer implementation source file)."
+ };
+
+ bool --generate-test-driver
+ {
+ "Generate a test driver for the sample serializer implementation.
+ For an input file in the form \cb{name.xsd} this option triggers
+ the generation of an additional C++ file in the form
+ \cb{name-sdriver.cxx}."
+ };
+
+ bool --force-overwrite
+ {
+ "Force overwriting of the existing implementation and test driver
+ files. Use this option only if you do not mind loosing the changes
+ you have made in the sample implementation or test driver files."
+ };
+
+ // Root element.
+ //
+ bool --root-element-first
+ {
+ "Indicate that the first global element is the document root. This
+ information is used to generate the test driver for the sample
+ implementation."
+ };
+
+ bool --root-element-last
+ {
+ "Indicate that the last global element is the document root. This
+ information is used to generate the test driver for the sample
+ implementation."
+ };
+
+ Cult::Types::NarrowString --root-element
+ {
+ "<element>",
+ "Indicate that <element> is the document root. This information is
+ used to generate the test driver for the sample implementation."
+ };
+
+ // Suffixes.
+ //
+ Cult::Types::NarrowString --skel-type-suffix = "_sskel"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{_sskel} to
+ construct the names of generated serializer skeletons."
+ };
+
+ Cult::Types::NarrowString --skel-file-suffix = "-sskel"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{-sskel} to
+ construct the names of generated serializer skeleton files."
+ };
+
+ Cult::Types::NarrowString --impl-type-suffix = "_simpl"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{_simpl} to
+ construct the names of serializer implementations for the built-in
+ XML Schema types and sample serializer implementations."
+ };
+
+ Cult::Types::NarrowString --impl-file-suffix = "-simpl"
+ {
+ "<suffix>",
+ "Use the provided <suffix> instead of the default \cb{-simpl} to
+ construct the names of generated sample serializer implementation
+ files."
+ };
+ };
+ }
+}
diff --git a/xsde/makefile b/xsde/makefile
index e4ab12b..9df2438 100644
--- a/xsde/makefile
+++ b/xsde/makefile
@@ -7,12 +7,11 @@ include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
cxx_tun := xsde.cxx
-
-# C++
+# C++.
#
cxx_tun += cxx/elements.cxx
-# C++/Parser
+# C++/Parser.
#
cxx_tun += cxx/parser/elements.cxx \
cxx/parser/validator.cxx \
@@ -31,7 +30,7 @@ cxx_tun += cxx/parser/elements.cxx \
cxx/parser/attribute-validation-source.cxx \
cxx/parser/characters-validation-source.cxx
-# C++/Serializer
+# C++/Serializer.
#
cxx_tun += cxx/serializer/elements.cxx \
cxx/serializer/validator.cxx \
@@ -48,7 +47,7 @@ cxx_tun += cxx/serializer/elements.cxx \
cxx/serializer/element-validation-source.cxx \
cxx/serializer/attribute-validation-source.cxx
-# C++/Hybrid
+# C++/Hybrid.
#
cxx_tun += cxx/hybrid/elements.cxx \
cxx/hybrid/validator.cxx \
@@ -76,19 +75,26 @@ cxx_tun += cxx/hybrid/elements.cxx \
cxx/hybrid/serializer-aggregate-header.cxx \
cxx/hybrid/serializer-aggregate-source.cxx
-# Type map
+# Type map.
#
cxx_tun += type-map/lexer.cxx \
type-map/parser.cxx
-# Processing
+# Processing.
#
cxx_tun += processing/inheritance/processor.cxx
+# Options file.
+#
+cli_tun := options.cli \
+ cxx/options.cli \
+ cxx/hybrid/options.cli \
+ cxx/parser/options.cli \
+ cxx/serializer/options.cli
#
#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
+cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
cxx_od := $(cxx_obj:.o=.o.d)
xsde := $(out_base)/xsde
@@ -100,6 +106,10 @@ install := $(out_base)/.install
# Import.
#
$(call import,\
+ $(scf_root)/import/cli/stub.make,\
+ cli: cli,cli-rules: cli_rules)
+
+$(call import,\
$(scf_root)/import/libcutl/stub.make,\
l: cutl.l,cpp-options: cutl.l.cpp-options)
@@ -108,10 +118,6 @@ $(call import,\
l: cult.l,cpp-options: cult.l.cpp-options)
$(call import,\
- $(scf_root)/import/libbackend-elements/stub.make,\
- l: be.l,cpp-options: be.l.cpp-options)
-
-$(call import,\
$(scf_root)/import/libboost/filesystem/stub.make,\
l: fs.l,cpp-options: fs.l.cpp-options)
@@ -121,17 +127,52 @@ $(call import,\
# Build.
#
-$(xsde): $(cxx_obj) $(xsd_fe.l) $(be.l) $(cult.l) $(cutl.l) $(fs.l)
+$(xsde): $(cxx_obj) $(xsd_fe.l) $(cult.l) $(cutl.l) $(fs.l)
$(cxx_obj) $(cxx_od): cpp_options := -I$(src_base)
$(cxx_obj) $(cxx_od): \
$(xsd_fe.l.cpp-options) \
- $(be.l.cpp-options) \
$(cult.l.cpp-options) \
$(cutl.l.cpp-options) \
$(fs.l.cpp-options)
-$(call include-dep,$(cxx_od))
+genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
+gen := $(addprefix $(out_base)/,$(genf))
+
+$(gen): $(cli)
+$(gen): cli := $(cli)
+$(gen): cli_options += \
+-I $(src_base) \
+--ostream-type ::std::wostream \
+--exclude-base \
+--suppress-undocumented \
+--generate-file-scanner \
+--include-with-brackets \
+--option-length 28
+
+#--include-prefix xsde
+#--guard-prefix XSDE
+
+$(addprefix $(out_base)/cxx/options,.hxx .ixx .cxx): $(src_base)/options.cli
+$(addprefix $(out_base)/cxx/options,.hxx .ixx .cxx): cli_options += \
+--include-prefix cxx --guard-prefix CXX
+
+$(addprefix $(out_base)/cxx/hybrid/options,.hxx .ixx .cxx): \
+$(src_base)/options.cli $(src_base)/cxx/options.cli
+$(addprefix $(out_base)/cxx/hybrid/options,.hxx .ixx .cxx): cli_options += \
+--include-prefix cxx/hybrid --guard-prefix CXX_HYBRID
+
+$(addprefix $(out_base)/cxx/parser/options,.hxx .ixx .cxx): \
+$(src_base)/options.cli $(src_base)/cxx/options.cli
+$(addprefix $(out_base)/cxx/parser/options,.hxx .ixx .cxx): cli_options += \
+--include-prefix cxx/parser --guard-prefix CXX_PARSER
+
+$(addprefix $(out_base)/cxx/serializer/options,.hxx .ixx .cxx): \
+$(src_base)/options.cli $(src_base)/cxx/options.cli
+$(addprefix $(out_base)/cxx/serializer/options,.hxx .ixx .cxx): cli_options += \
+--include-prefix cxx/serializer --guard-prefix CXX_SERIALIZER
+
+$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
# Alias for default target.
#
@@ -155,7 +196,8 @@ $(install): $(xsde)
$(clean): \
$(xsde).o.clean \
$(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od))
+ $(addsuffix .cxx.clean,$(cxx_od)) \
+ $(addprefix $(out_base)/,$(cli_tun:.cli=.cxx.cli.clean))
# Generated .gitignore.
@@ -163,15 +205,15 @@ $(clean): \
ifeq ($(out_base),$(src_base))
$(xsde): | $(out_base)/.gitignore
-$(out_base)/.gitignore: files := xsde
+$(out_base)/.gitignore: files := xsde $(genf)
$(clean): $(out_base)/.gitignore.clean
$(call include,$(bld_root)/git/gitignore.make)
endif
-
-# how to
+# How to.
#
+$(call include,$(cli_rules))
$(call include,$(bld_root)/cxx/o-e.make)
$(call include,$(bld_root)/cxx/cxx-o.make)
$(call include,$(bld_root)/cxx/cxx-d.make)
diff --git a/xsde/options.cli b/xsde/options.cli
new file mode 100644
index 0000000..976ddee
--- /dev/null
+++ b/xsde/options.cli
@@ -0,0 +1,302 @@
+// file : xsde/options.cli
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+include <vector>;
+include <string>;
+include <cstddef>; // std::size_t
+
+include <cult/types.hxx>; // NarrowString
+
+class help_options
+{
+ // These are all documented elsewhere.
+ //
+ bool --help;
+ bool --version;
+ bool --proprietary-license;
+};
+
+class options = 0
+{
+ std::vector<Cult::Types::NarrowString> --disable-warning
+ {
+ "<warn>",
+ "Disable printing warning with id <warn>. If \cb{all} is specified for
+ the warning id then all warnings are disabled."
+ };
+
+ // The following option is "fake" in that it is actually handled by
+ // argv_file_scanner. We have it here to get the documentation.
+ //
+ std::string --options-file
+ {
+ "<file>",
+ "Read additional options from <file>. Each option should appearing on a
+ separate line optionally followed by space and an option value. Empty
+ lines and lines starting with \cb{#} are ignored. Option values can
+ be enclosed in double (\cb{\"}) or single (\cb{'}) quotes to preserve
+ leading and trailing whitespaces as well as to specify empty values.
+ If the value itself contains trailing or leading quotes, enclose it
+ with an extra pair of quotes, for example \cb{'\"x\"'}. Non-leading
+ and non-trailing quotes are interpreted as being part of the option
+ value.
+
+ The semantics of providing options in a file is equivalent to providing
+ the same set of options in the same order on the command line at the
+ point where the \cb{--options-file} option is specified except that
+ the shell escaping and quoting is not required. You can repeat this
+ option to specify more than one options file."
+ };
+
+ // SLOC/license options.
+ //
+ bool --show-sloc
+ {
+ "Show the number of generated physical source lines of code (SLOC)."
+ };
+
+ std::size_t --sloc-limit
+ {
+ "<num>",
+ "Check that the number of generated physical source lines of code (SLOC)
+ does not exceed <num>."
+ };
+
+ bool --proprietary-license
+ {
+ "Indicate that the generated code is licensed under a proprietary
+ license instead of the GPL."
+ };
+
+ // Anonymous type morphing.
+ //
+ bool --preserve-anonymous
+ {
+ "Preserve anonymous types. By default anonymous types are automatically
+ named with names derived from the enclosing elements/attributes. Because
+ mappings implemented by this compiler require all types to be named,
+ this option is only useful if you want to make sure your schemas don't
+ have anonymous types."
+ };
+
+ bool --show-anonymous
+ {
+ "Show elements and attributes that are of anonymous types. This option
+ only makes sense together with the \cb{--preserve-anonymous} option."
+ };
+
+ std::vector<Cult::Types::NarrowString> --anonymous-regex
+ {
+ "<regex>",
+ "Add <regex> to the list of regular expressions used to derive names for
+ anonymous types from the enclosing attributes/elements. <regex> is a
+ Perl-like regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}.
+ Any character can be used as a delimiter instead of \cb{/}. Escaping of
+ the delimiter character in \ci{pattern} or \ci{replacement} is not
+ supported.
+
+ All the regular expressions are pushed into a stack with the last
+ specified expression considered first. The first match that succeeds is
+ used. Regular expressions are applied to a string in the form
+
+ \c{\i{filename} \i{namespace} \i{xpath}}
+
+ For instance:
+
+ \cb{hello.xsd http://example.com/hello element}
+
+ \cb{hello.xsd http://example.com/hello type/element}
+
+ As an example, the following expression makes all the derived names
+ start with capital letters. This could be useful when your naming
+ convention requires type names to start with capital letters:
+
+ \cb{%.* .* (.+/)*(.+)%\\u$2%}
+
+ See also the REGEX AND SHELL QUOTING section below."
+ };
+
+ bool --anonymous-regex-trace
+ {
+ "Trace the process of applying regular expressions specified with the
+ \cb{--anonymous-regex} option. Use this option to find out why your
+ regular expressions don't do what you expected them to do."
+ };
+
+ bool --morph-anonymous; // Deprecated and therefore undocumented.
+
+ // Location options.
+ //
+ std::vector<Cult::Types::NarrowString> --location-map
+ {
+ "<ol>=<nl>",
+ "Map the original schema location <ol> that is specified in the XML
+ Schema include or import elements to new schema location <nl>. Repeat
+ this option to map more than one schema location. For example, the
+ following option maps the \cb{http://example.com/foo.xsd} URL to the
+ \cb{foo.xsd} local file.
+
+ \cb{--location-map http://example.com/foo.xsd=foo.xsd}"
+ };
+
+ std::vector<Cult::Types::NarrowString> --location-regex
+ {
+ "<regex>",
+ "Add <regex> to the list of regular expressions used to map schema
+ locations that are specified in the XML Schema include or import
+ elements. <regex> is a Perl-like regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}. Any character can
+ be used as a delimiter instead of \cb{/}. Escaping of the delimiter
+ character in \ci{pattern} or \ci{replacement} is not supported. All
+ the regular expressions are pushed into a stack with the last specified
+ expression considered first. The first match that succeeds is used.
+
+ For example, the following expression maps URL locations in the form
+ \cb{http://example.com/foo/bar.xsd} to local files in the form
+ \cb{bar.xsd}:
+
+ \cb{%http://.+/(.+)%$1%}
+
+ See also the REGEX AND SHELL QUOTING section below."
+ };
+
+ bool --location-regex-trace
+ {
+ "Trace the process of applying regular expressions specified with the
+ \cb{--location-regex} option. Use this option to find out why your
+ regular expressions don't do what you expected them to do."
+ };
+
+ // File-per-type option.
+ //
+ bool --file-per-type
+ {
+ "Generate a separate set of C++ files for each type defined in XML
+ Schema. Note that in this mode you only need to compile the root
+ schema(s) and the code will be generated for all included and
+ imported schemas. This compilation mode is primarily useful when
+ some of your schemas cannot be compiled separately or have cyclic
+ dependencies which involve type inheritance. Other options related
+ to this mode are: \cb{--type-file-regex}, \cb{--schema-file-regex},
+ \cb{--fat-type-file}, and \cb{--file-list}."
+ };
+
+ std::vector<Cult::Types::NarrowString> --type-file-regex
+ {
+ "<regex>",
+ "Add <regex> to the list of regular expressions used to translate type
+ names to file names when the \cb{--file-per-type} option is specified.
+ <regex> is a Perl-like regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}. Any character can be
+ used as a delimiter instead of \cb{/}. Escaping of the delimiter
+ character in \ci{pattern} or \ci{replacement} is not supported. All
+ the regular expressions are pushed into a stack with the last specified
+ expression considered first. The first match that succeeds is used.
+ Regular expressions are applied to a string in the form
+
+ \c{\i{namespace} \i{type-name}}
+
+ For example, the following expression maps type \cb{foo} that is
+ defined in the \cb{http://example.com/bar} namespace to file name
+ \cb{bar-foo}:
+
+ \cb{%http://example.com/(.+) (.+)%$1-$2%}
+
+ See also the REGEX AND SHELL QUOTING section below."
+ };
+
+ bool --type-file-regex-trace
+ {
+ "Trace the process of applying regular expressions specified with the
+ \cb{--type-file-regex} option. Use this option to find out why your
+ regular expressions don't do what you expected them to do."
+ };
+ std::vector<Cult::Types::NarrowString> --schema-file-regex
+ {
+ "<regex>",
+ "Add <regex> to the list of regular expressions used to translate schema
+ file names when the \cb{--file-per-type} option is specified. <regex> is
+ a Perl-like regular expression in the form
+ \c{\b{/}\i{pattern}\b{/}\i{replacement}\b{/}}. Any character can be used
+ as a delimiter instead of \cb{/}. Escaping of the delimiter character in
+ \ci{pattern} or \ci{replacement} is not supported. All the regular
+ expressions are pushed into a stack with the last specified expression
+ considered first. The first match that succeeds is used. Regular
+ Expressions are applied to the absolute filesystem path of a schema file
+ and the result, including the directory part, if any, is used to derive
+ the \cb{#include} directive paths as well as the generated C++ file
+ paths. This option, along with \cb{--type-file-regex} are primarily
+ useful to place the generated files into subdirectories or to resolve
+ file name conflicts.
+
+ For example, the following expression maps schema files in the
+ \cb{foo/1.0.0/} subdirectory to the files in the \cb{foo/} subdirectory.
+ As a result, the \cb{#include} directive paths for such schemas will be
+ in the \cb{foo/schema.hxx} form and the generated C++ files will be
+ placed into the \cb{foo/} subdirectory:
+
+ \cb{%.*/foo/1.0.0/(.+)%foo/$1%}
+
+ See also the REGEX AND SHELL QUOTING section below."
+ };
+
+ bool --schema-file-regex-trace
+ {
+ "Trace the process of applying regular expressions specified with the
+ \cb{--schema-file-regex} option. Use this option to find out why your
+ regular expressions don't do what you expected them to do."
+ };
+
+ bool --fat-type-file
+ {
+ "Generate code corresponding to global elements into type files instead
+ of schema files when the \cb{--type-file-regex} option is specified.
+ This option is primarily useful when trying to minimize the amount of
+ object code that is linked to an executable by packaging compiled
+ generated code into a static (archive) library."
+ };
+
+ // File list options.
+ //
+ Cult::Types::NarrowString --file-list
+ {
+ "<file>",
+ "Write a list of generated C++ files to <file>. This option is primarily
+ useful in the file-per-type compilation mode (\cb{--file-per-type}) to
+ create a list of generated C++ files, for example, as a makefile
+ fragment."
+ };
+
+ Cult::Types::NarrowString --file-list-prologue
+ {
+ "<text>",
+ "Insert <text> at the beginning of the file list. As a convenience, all
+ occurrences of the \cb{\\n} character sequence in <text> are replaced
+ with new lines. This option can, for example, be used to assign the
+ generated file list to a makefile variable."
+ };
+
+ Cult::Types::NarrowString --file-list-epilogue
+ {
+ "<text>",
+ "Insert <text> at the end of the file list. As a convenience, all
+ occurrences of the \cb{\\n} character sequence in <text> are replaced
+ with new lines."
+ };
+
+ Cult::Types::NarrowString --file-list-delim = "\n"
+ {
+ "<text>",
+ "Delimit file names written to the file list with <text> instead of new
+ lines. As a convenience, all occurrences of the \cb{\\n} character
+ sequence in <text> are replaced with new lines."
+ };
+
+ // Undocumented.
+ //
+ bool --disable-multi-import;
+ bool --disable-full-check;
+};
diff --git a/xsde/xsde.cxx b/xsde/xsde.cxx
index a14eb94..eb3f9f3 100644
--- a/xsde/xsde.cxx
+++ b/xsde/xsde.cxx
@@ -31,11 +31,10 @@
#include <xsd-frontend/transformations/schema-per-type.hxx>
#include <xsd-frontend/transformations/simplifier.hxx>
-#include <xsde.hxx>
-#include <usage.hxx>
#include <type-map/type-map.hxx>
-#include <backend-elements/indentation/clip.hxx>
+#include <xsde.hxx>
+#include <options.hxx>
#include <cxx/parser/generator.hxx>
#include <cxx/serializer/generator.hxx>
@@ -311,117 +310,9 @@ main (Int argc, Char* argv[])
return 1;
}
- ::CLI::Indent::Clip< ::CLI::OptionsUsage, WideChar> clip (o);
-
- // Disable warning option.
- //
- 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."
- << endl;
-
- // Anonymous morphing options.
- //
- 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;
-
- 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;
-
- o << "--anonymous-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --anonymous-regex option."
- << endl;
-
- // Location mapping options.
- //
- 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;
-
- 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;
-
- 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.
+ // Add frontend options at the end.
//
- o << "--file-per-type" << endl
- << " Generate a separate set of C++ files for each\n"
- << " type defined in XML Schema."
- << 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;
-
- o << "--type-file-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --type-file-regex option."
- << 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;
-
- o << "--schema-file-regex-trace" << endl
- << " Trace the process of applying regular expressions\n"
- << " specified with the --schema-file-regex option."
- << 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."
- << endl;
-
- // File list options.
- //
- o << "--file-list <file>" << endl
- << " Write a list of generated C++ files to <file>."
- << 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;
-
- 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;
-
- 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"
- << " new lines."
- << endl;
+ options::print_usage (o);
}
else
{