From 592587e0073cb6722f1fc9c0833d441ad5636358 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Jun 2012 19:01:54 +0200 Subject: Initial work on CLI port Add options files with all the documentation. Move documentation and usage to use the new approach. Finally get rid of dependency on libbackend-elements. --- xsd/options.cli | 315 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 xsd/options.cli (limited to 'xsd/options.cli') diff --git a/xsd/options.cli b/xsd/options.cli new file mode 100644 index 0000000..44223b9 --- /dev/null +++ b/xsd/options.cli @@ -0,0 +1,315 @@ +// file : xsd/options.cli +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include ; +include ; +include ; // std::size_t + +include ; // NarrowString + +class help_options +{ + // These are all documented elsewhere. + // + bool --help; + bool --version; + bool --proprietary-license; +}; + +class options = 0 +{ + std::vector --disable-warning + { + "", + "Disable printing warning with id . 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 + { + "", + "Read additional options from . 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 + { + "", + "Check that the number of generated physical source lines of code (SLOC) + does not exceed ." + }; + + bool --proprietary-license + { + "Indicate that the generated code is licensed under a proprietary + license instead of the GPL." + }; + + std::vector --custom-literals + { + "", + "Load custom XML string to C++ literal mappings from . This + mechanism can be useful if you are using a custom character encoding + and some of the strings in your schemas, for example element/attribute + names or enumeration values, contain non-ASCII characters. In this + case you will need to provide a custom mapping to C++ literals for + such strings. The format of this file is specified in the + \cb{custom-literals.xsd} XML Schema file that can be found in the + documentation directory." + }; + + // 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 --anonymous-regex + { + "", + "Add to the list of regular expressions used to derive names for + anonymous types from the enclosing attributes/elements. 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 --location-map + { + "
    =", + "Map the original schema location
      that is specified in the XML + Schema include or import elements to new schema location . 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 --location-regex + { + "", + "Add to the list of regular expressions used to map schema + locations that are specified in the XML Schema include or import + elements. 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 --type-file-regex + { + "", + "Add to the list of regular expressions used to translate type + names to file names when the \cb{--file-per-type} option is specified. + 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 --schema-file-regex + { + "", + "Add to the list of regular expressions used to translate schema + file names when the \cb{--file-per-type} option is specified. 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 + { + "", + "Write a list of generated C++ files to . 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 + { + "", + "Insert at the beginning of the file list. As a convenience, all + occurrences of the \cb{\\n} character sequence in 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 + { + "", + "Insert at the end of the file list. As a convenience, all + occurrences of the \cb{\\n} character sequence in are replaced + with new lines." + }; + + Cult::Types::NarrowString --file-list-delim = "\n" + { + "", + "Delimit file names written to the file list with instead of new + lines. As a convenience, all occurrences of the \cb{\\n} character + sequence in are replaced with new lines." + }; + + // Undocumented. + // + bool --disable-multi-import; + bool --disable-full-check; +}; -- cgit v1.1