diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-01-12 15:16:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-01-12 15:16:19 +0200 |
commit | 4326461b99a97153dd20a24570712adb04df89a9 (patch) | |
tree | 475544d981c5baf196c380d2597b4772c75b33d9 | |
parent | 8bf1bbd61d7d9aa50752b647f24f139512628b0e (diff) |
Include file component in regex strings for schema being compiled
24 files changed, 104 insertions, 129 deletions
@@ -18,6 +18,10 @@ Version 3.2.0 XSD/e runtime library accordingly and pass the --char-encoding option to the XSD/e compiler when translating your schemas. + * Strings used to match regular expression supplied with the + --namespace-regex and --anonymous-regex options now include the file + component for the schema being compiled. + C++/Hybrid * String-based types that use XML Schema restriction by enumeration are diff --git a/documentation/xsde.1 b/documentation/xsde.1 index afafa8c..2562446 100644 --- a/documentation/xsde.1 +++ b/documentation/xsde.1 @@ -255,23 +255,19 @@ expressions are applied to a string in the form .I filename namespace -For example, - -.B XMLSchema.xsd http://www.w3.org/2001/XMLSchema - -The -.I filename -for the current translation unit is empty. For example, if you have file +For example, if you have file .B hello.xsd with namespace .B http://example.com/hello and you run -.B xsde -on this file, then the string in question would be: +.B xsd +on this file, then the string in question will be: + +.B hello.xsd. http://example.com/hello -.B \ http://example.com/hello +For the built-in XML Schema namespace the string is: -Note the leading space. +.B XMLSchema.xsd http://www.w3.org/2001/XMLSchema The following three steps are performed for each regular expression until the match is found: @@ -763,26 +759,12 @@ in the form .I filename namespace xpath -For example, +For instance: .B hello.xsd http://example.com/hello element .B hello.xsd http://example.com/hello type/element -The -.I filename -for the current translation unit is empty. For example, if you have file -.B hello.xsd -with namespace -.B http://example.com/hello -and you run -.B xsde -on this file, then the string in question would be: - -.B \ http://example.com/hello element - -Note the leading space. - 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 diff --git a/documentation/xsde.xhtml b/documentation/xsde.xhtml index 31c2f03..f734f5d 100644 --- a/documentation/xsde.xhtml +++ b/documentation/xsde.xhtml @@ -227,19 +227,16 @@ <p><code><i>filename</i> <i>namespace</i></code></p> - <p>For example,</p> - - <p><code><b>XMLSchema.xsd http://www.w3.org/2001/XMLSchema</b></code></p> - - <p>The <code><i>filename</i></code> for the current translation unit - is empty. For example, if you have file <code><b>hello.xsd</b></code> + <p>For example, if you have file <code><b>hello.xsd</b></code> with namespace <code><b>http://example.com/hello</b></code> and you run - <code><b>xsde</b></code> on this file, then the string in question - would be:</p> + <code><b>xsd</b></code> on this file, then the string in question + will be:</p> - <p><code> <b>http://example.com/hello</b></code></p> + <p><code><b>hello.xsd. http://example.com/hello</b></code></p> - <p>Note the leading space.</p> + <p>For the built-in XML Schema namespace the string is:</p> + + <p><code><b>XMLSchema.xsd http://www.w3.org/2001/XMLSchema</b></code></p> <p>The following three steps are performed for each regular expression until the match is found:</p> @@ -656,21 +653,11 @@ <p><code><i>filename</i> <i>namespace</i> <i>xpath</i></code></p> - <p>For example,</p> + <p>For instance:</p> <p><code><b>hello.xsd http://example.com/hello element</b></code></p> <p><code><b>hello.xsd http://example.com/hello type/element</b></code></p> - <p>The <code><i>filename</i></code> for the current translation unit - is empty. For example, if you have file <code><b>hello.xsd</b></code> - with namespace <code><b>http://example.com/hello</b></code> and you run - <code><b>xsde</b></code> on this file, then the string in question - would be:</p> - - <p><code> <b>http://example.com/hello element</b></code></p> - - <p>Note the leading space.</p> - <p>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 diff --git a/xsde/cxx/elements.cxx b/xsde/cxx/elements.cxx index f8d7132..86d29e1 100644 --- a/xsde/cxx/elements.cxx +++ b/xsde/cxx/elements.cxx @@ -112,6 +112,7 @@ namespace CXX Context:: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, Char const* name_key, NarrowString const& char_type__, NarrowString const& char_encoding__, @@ -127,6 +128,7 @@ namespace CXX Containers::Vector<NarrowString> const& reserved_name) : os (o), schema_root (root), + schema_path (schema_path_), ename_key (ename_key_), char_type (char_type_), char_encoding (char_encoding_), @@ -138,6 +140,7 @@ namespace CXX inst_exp (inst_exp_), inl (inl_), ns_mapping_cache (ns_mapping_cache_), + schema_path_ (path), xs_ns_ (0), ename_key_ (name_key), char_type_ (char_type__), @@ -297,6 +300,8 @@ namespace CXX if (s.names_begin () != s.names_end ()) path = u.path (); } + else + path = schema_path; String pair; diff --git a/xsde/cxx/elements.hxx b/xsde/cxx/elements.hxx index 67b51db..abd7206 100644 --- a/xsde/cxx/elements.hxx +++ b/xsde/cxx/elements.hxx @@ -146,6 +146,7 @@ namespace CXX public: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, Char const* name_key, NarrowString const& char_type__, NarrowString const& char_encoding__, @@ -164,6 +165,7 @@ namespace CXX Context (Context& c) : os (c.os), schema_root (c.schema_root), + schema_path (c.schema_path), ename_key (c.ename_key), char_type (c.char_type), char_encoding (c.char_encoding), @@ -191,6 +193,7 @@ namespace CXX Context (Context& c, std::wostream& o) : os (o), schema_root (c.schema_root), + schema_path (c.schema_path), ename_key (c.ename_key), char_type (c.char_type), char_encoding (c.char_encoding), @@ -319,6 +322,7 @@ namespace CXX public: std::wostream& os; SemanticGraph::Schema& schema_root; + SemanticGraph::Path const& schema_path; NarrowString const& ename_key; @@ -338,6 +342,8 @@ namespace CXX MappingCache& ns_mapping_cache; private: + SemanticGraph::Path const schema_path_; + SemanticGraph::Namespace* xs_ns_; NarrowString const ename_key_; diff --git a/xsde/cxx/hybrid/elements.cxx b/xsde/cxx/hybrid/elements.cxx index 27e983a..e3bd02b 100644 --- a/xsde/cxx/hybrid/elements.cxx +++ b/xsde/cxx/hybrid/elements.cxx @@ -12,12 +12,14 @@ namespace CXX Context:: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& ops, Regex const* fe, Regex const* he, Regex const* ie) : CXX::Context (o, root, + path, "name", "char", ops.value<CLI::char_encoding> (), diff --git a/xsde/cxx/hybrid/elements.hxx b/xsde/cxx/hybrid/elements.hxx index 5a2e12e..01030d5 100644 --- a/xsde/cxx/hybrid/elements.hxx +++ b/xsde/cxx/hybrid/elements.hxx @@ -30,6 +30,7 @@ namespace CXX public: Context (std::wostream&, SemanticGraph::Schema&, + SemanticGraph::Path const&, CLI::Options const&, Regex const* fwd_expr, Regex const* hxx_expr, diff --git a/xsde/cxx/hybrid/generator.cxx b/xsde/cxx/hybrid/generator.cxx index 14cba6a..c39b062 100644 --- a/xsde/cxx/hybrid/generator.cxx +++ b/xsde/cxx/hybrid/generator.cxx @@ -1409,7 +1409,8 @@ namespace CXX // if (forward) { - Context ctx (fwd, schema, ops, &fwd_expr, &hxx_expr, &ixx_expr); + Context ctx ( + fwd, schema, file_path, ops, &fwd_expr, &hxx_expr, &ixx_expr); Indentation::Clip<Indentation::SLOC, WideChar> fwd_sloc (fwd); @@ -1493,7 +1494,8 @@ namespace CXX // HXX // { - Context ctx (hxx, schema, ops, &fwd_expr, &hxx_expr, &ixx_expr); + Context ctx ( + hxx, schema, file_path, ops, &fwd_expr, &hxx_expr, &ixx_expr); Indentation::Clip<Indentation::SLOC, WideChar> hxx_sloc (hxx); @@ -1690,7 +1692,8 @@ namespace CXX // if (inline_) { - Context ctx (ixx, schema, ops, &fwd_expr, &hxx_expr, &ixx_expr); + Context ctx ( + ixx, schema, file_path, ops, &fwd_expr, &hxx_expr, &ixx_expr); Indentation::Clip<Indentation::SLOC, WideChar> ixx_sloc (ixx); // Guard @@ -1763,7 +1766,8 @@ namespace CXX // if (source) { - Context ctx (cxx, schema, ops, &fwd_expr, &hxx_expr, &ixx_expr); + Context ctx ( + cxx, schema, file_path, ops, &fwd_expr, &hxx_expr, &ixx_expr); Indentation::Clip<Indentation::SLOC, WideChar> cxx_sloc (cxx); @@ -1842,8 +1846,8 @@ namespace CXX if (ops.value<CLI::generate_parser> () || ops.value<CLI::generate_serializer> ()) { - generate_tree_type_map ( - ops, schema, hxx_name, parser_type_map, serializer_type_map); + generate_tree_type_map (ops, schema, file_path, hxx_name, + parser_type_map, serializer_type_map); } return sloc; @@ -2086,7 +2090,7 @@ namespace CXX // HXX // { - Context ctx (hxx, schema, ops, 0, &hxx_expr, 0); + Context ctx (hxx, schema, file_path, ops, 0, &hxx_expr, 0); Indentation::Clip<Indentation::SLOC, WideChar> hxx_sloc (hxx); @@ -2189,7 +2193,7 @@ namespace CXX // CXX // { - Context ctx (cxx, schema, ops, 0, &hxx_obj_expr, 0); + Context ctx (cxx, schema, file_path, ops, 0, &hxx_obj_expr, 0); Indentation::Clip<Indentation::SLOC, WideChar> cxx_sloc (cxx); @@ -2477,7 +2481,7 @@ namespace CXX // HXX // { - Context ctx (hxx, schema, ops, 0, &hxx_expr, 0); + Context ctx (hxx, schema, file_path, ops, 0, &hxx_expr, 0); Indentation::Clip<Indentation::SLOC, WideChar> hxx_sloc (hxx); @@ -2580,7 +2584,7 @@ namespace CXX // CXX // { - Context ctx (cxx, schema, ops, 0, &hxx_expr, 0); + Context ctx (cxx, schema, file_path, ops, 0, &hxx_expr, 0); Indentation::Clip<Indentation::SLOC, WideChar> cxx_sloc (cxx); diff --git a/xsde/cxx/hybrid/parser-name-processor.cxx b/xsde/cxx/hybrid/parser-name-processor.cxx index afb0df4..15b0459 100644 --- a/xsde/cxx/hybrid/parser-name-processor.cxx +++ b/xsde/cxx/hybrid/parser-name-processor.cxx @@ -31,9 +31,10 @@ namespace CXX public: Context (CLI::Options const& ops, SemanticGraph::Schema& root, - SemanticGraph::Path const& file) + SemanticGraph::Path const& path) : CXX::Context (std::wcerr, root, + path, "name", "char", ops.value<CLI::char_encoding> (), @@ -47,12 +48,9 @@ namespace CXX ops.value<CLI::include_regex_trace> (), ops.value<CLI::generate_inline> (), ops.value<CLI::reserved_name> ()), - schema_path_ (file), impl_suffix_ (ops.value<CLI::pimpl_type_suffix> ()), aggr_suffix_ (ops.value<CLI::paggr_type_suffix> ()), options (ops), - schema (root), - schema_path (schema_path_), aggregate (ops.value<CLI::generate_aggregate> ()), impl_suffix (impl_suffix_), aggr_suffix (aggr_suffix_), @@ -111,8 +109,6 @@ namespace CXX Context (Context& c) : CXX::Context (c), options (c.options), - schema (c.schema), - schema_path (c.schema_path), aggregate (c.aggregate), impl_suffix (c.impl_suffix), aggr_suffix (c.aggr_suffix), @@ -232,7 +228,6 @@ namespace CXX CustomParserMap; private: - SemanticGraph::Path const schema_path_; String const impl_suffix_; String const aggr_suffix_; CustomParserMap custom_parser_map_; @@ -241,8 +236,6 @@ namespace CXX public: CLI::Options const& options; - SemanticGraph::Schema& schema; - SemanticGraph::Path const& schema_path; Boolean aggregate; String const& impl_suffix; String const& aggr_suffix; diff --git a/xsde/cxx/hybrid/serializer-name-processor.cxx b/xsde/cxx/hybrid/serializer-name-processor.cxx index 5da88b9..17522cf 100644 --- a/xsde/cxx/hybrid/serializer-name-processor.cxx +++ b/xsde/cxx/hybrid/serializer-name-processor.cxx @@ -30,9 +30,10 @@ namespace CXX public: Context (CLI::Options const& ops, SemanticGraph::Schema& root, - SemanticGraph::Path const& file) + SemanticGraph::Path const& path) : CXX::Context (std::wcerr, root, + path, "name", "char", ops.value<CLI::char_encoding> (), @@ -46,12 +47,9 @@ namespace CXX ops.value<CLI::include_regex_trace> (), ops.value<CLI::generate_inline> (), ops.value<CLI::reserved_name> ()), - schema_path_ (file), impl_suffix_ (ops.value<CLI::simpl_type_suffix> ()), aggr_suffix_ (ops.value<CLI::saggr_type_suffix> ()), options (ops), - schema (root), - schema_path (schema_path_), aggregate (ops.value<CLI::generate_aggregate> ()), impl_suffix (impl_suffix_), aggr_suffix (aggr_suffix_), @@ -110,8 +108,6 @@ namespace CXX Context (Context& c) : CXX::Context (c), options (c.options), - schema (c.schema), - schema_path (c.schema_path), aggregate (c.aggregate), impl_suffix (c.impl_suffix), aggr_suffix (c.aggr_suffix), @@ -225,7 +221,6 @@ namespace CXX CustomSerializerMap; private: - SemanticGraph::Path const schema_path_; String const impl_suffix_; String const aggr_suffix_; CustomSerializerMap custom_serializer_map_; @@ -234,8 +229,6 @@ namespace CXX public: CLI::Options const& options; - SemanticGraph::Schema& schema; - SemanticGraph::Path const& schema_path; Boolean aggregate; String const& impl_suffix; String const& aggr_suffix; diff --git a/xsde/cxx/hybrid/tree-name-processor.cxx b/xsde/cxx/hybrid/tree-name-processor.cxx index b2a2c69..10a9280 100644 --- a/xsde/cxx/hybrid/tree-name-processor.cxx +++ b/xsde/cxx/hybrid/tree-name-processor.cxx @@ -33,9 +33,10 @@ namespace CXX public: Context (CLI::Options const& ops, SemanticGraph::Schema& root, - SemanticGraph::Path const& file) + SemanticGraph::Path const& path) : CXX::Context (std::wcerr, root, + path, "name", "char", ops.value<CLI::char_encoding> (), @@ -49,9 +50,6 @@ namespace CXX ops.value<CLI::include_regex_trace> (), ops.value<CLI::generate_inline> (), ops.value<CLI::reserved_name> ()), - schema_path_ (file), - schema (root), - schema_path (schema_path_), stl (!ops.value<CLI::no_stl> ()), detach (ops.value<CLI::generate_detach> ()), enum_ (!ops.value<CLI::suppress_enum> ()), @@ -179,8 +177,6 @@ namespace CXX protected: Context (Context& c) : CXX::Context (c), - schema (c.schema), - schema_path (c.schema_path), stl (c.stl), detach (c.detach), enum_ (c.enum_), @@ -271,17 +267,12 @@ namespace CXX CustomTypeMap; private: - SemanticGraph::Path const schema_path_; - CustomDataMap custom_data_map_; CustomTypeMap custom_type_map_; Cult::Containers::Map<String, NameSet*> global_type_names_; public: - SemanticGraph::Schema& schema; - SemanticGraph::Path const& schema_path; - Boolean stl; Boolean detach; Boolean enum_; diff --git a/xsde/cxx/hybrid/tree-type-map.cxx b/xsde/cxx/hybrid/tree-type-map.cxx index 1b22ff9..12b83de 100644 --- a/xsde/cxx/hybrid/tree-type-map.cxx +++ b/xsde/cxx/hybrid/tree-type-map.cxx @@ -22,9 +22,12 @@ namespace CXX class Context: public CXX::Context { public: - Context (CLI::Options const& ops, SemanticGraph::Schema& root) + Context (CLI::Options const& ops, + SemanticGraph::Schema& root, + SemanticGraph::Path const& path) : CXX::Context (std::wcerr, root, + path, "name", "char", ops.value<CLI::char_encoding> (), @@ -202,6 +205,7 @@ namespace CXX Void generate_tree_type_map (CLI::Options const& ops, XSDFrontend::SemanticGraph::Schema& tu, + XSDFrontend::SemanticGraph::Path const& path, String const& hxx_name, TypeMap::Namespaces& parser_map, TypeMap::Namespaces& serializer_map) @@ -209,7 +213,7 @@ namespace CXX if (tu.names_begin ()->named ().name () != L"http://www.w3.org/2001/XMLSchema") { - Context ctx (ops, tu); + Context ctx (ops, tu, path); // We don't want include in the included/imported/sources // schema so split the traversal into two part. diff --git a/xsde/cxx/hybrid/tree-type-map.hxx b/xsde/cxx/hybrid/tree-type-map.hxx index 6f5f946..ec05558 100644 --- a/xsde/cxx/hybrid/tree-type-map.hxx +++ b/xsde/cxx/hybrid/tree-type-map.hxx @@ -23,6 +23,7 @@ namespace CXX Void generate_tree_type_map (CLI::Options const& options, XSDFrontend::SemanticGraph::Schema&, + XSDFrontend::SemanticGraph::Path const&, String const& hxx_name, TypeMap::Namespaces& parser_type_map, TypeMap::Namespaces& serializer_type_map); diff --git a/xsde/cxx/hybrid/validator.cxx b/xsde/cxx/hybrid/validator.cxx index 716f072..7641025 100644 --- a/xsde/cxx/hybrid/validator.cxx +++ b/xsde/cxx/hybrid/validator.cxx @@ -27,10 +27,11 @@ namespace CXX { public: ValidationContext (SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& options, const WarningSet& disabled_warnings, Boolean& valid_) - : Context (std::wcerr, root, options, 0, 0, 0), + : Context (std::wcerr, root, path, options, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), valid (valid_), @@ -483,11 +484,11 @@ namespace CXX Boolean Validator:: validate (CLI::Options const& options, SemanticGraph::Schema& root, - SemanticGraph::Path const&, + SemanticGraph::Path const& path, const WarningSet& disabled_warnings) { Boolean valid (true); - ValidationContext ctx (root, options, disabled_warnings, valid); + ValidationContext ctx (root, path, options, disabled_warnings, valid); // // diff --git a/xsde/cxx/parser/elements.cxx b/xsde/cxx/parser/elements.cxx index 3c62b5b..2261abd 100644 --- a/xsde/cxx/parser/elements.cxx +++ b/xsde/cxx/parser/elements.cxx @@ -12,12 +12,14 @@ namespace CXX Context:: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& ops, Regex const* he, Regex const* ie, Regex const* hie) : CXX::Context (o, root, + path, "p:name", "char", ops.value<CLI::char_encoding> (), diff --git a/xsde/cxx/parser/elements.hxx b/xsde/cxx/parser/elements.hxx index 6599b3c..954b13b 100644 --- a/xsde/cxx/parser/elements.hxx +++ b/xsde/cxx/parser/elements.hxx @@ -38,6 +38,7 @@ namespace CXX public: Context (std::wostream&, SemanticGraph::Schema&, + SemanticGraph::Path const&, CLI::Options const&, Regex const* hxx_expr, Regex const* ixx_expr, diff --git a/xsde/cxx/parser/generator.cxx b/xsde/cxx/parser/generator.cxx index 1936286..1645525 100644 --- a/xsde/cxx/parser/generator.cxx +++ b/xsde/cxx/parser/generator.cxx @@ -700,7 +700,7 @@ namespace CXX // String xns; { - Context ctx (std::wcerr, schema, ops, 0, 0, 0); + Context ctx (std::wcerr, schema, file_path, ops, 0, 0, 0); xns = ctx.xs_ns_name (); } @@ -1175,7 +1175,8 @@ namespace CXX // HXX // { - Context ctx (hxx, schema, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); + Context ctx ( + hxx, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); Indentation::Clip<Indentation::SLOC, WideChar> hxx_sloc (hxx); @@ -1432,7 +1433,8 @@ namespace CXX // if (inline_) { - Context ctx (ixx, schema, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); + Context ctx ( + ixx, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); Indentation::Clip<Indentation::SLOC, WideChar> ixx_sloc (ixx); @@ -1488,7 +1490,8 @@ namespace CXX // if (source) { - Context ctx (cxx, schema, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); + Context ctx ( + cxx, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); Indentation::Clip<Indentation::SLOC, WideChar> cxx_sloc (cxx); @@ -1552,7 +1555,7 @@ namespace CXX // if (impl) { - Context ctx (hxx_impl, schema, ops, + Context ctx (hxx_impl, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); String guard (guard_expr.merge (guard_prefix + hxx_impl_name)); @@ -1581,7 +1584,7 @@ namespace CXX // if (impl) { - Context ctx (cxx_impl, schema, ops, + Context ctx (cxx_impl, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); // Set auto-indentation. @@ -1598,7 +1601,7 @@ namespace CXX // if (driver) { - Context ctx (cxx_driver, schema, ops, + Context ctx (cxx_driver, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); // Set auto-indentation. diff --git a/xsde/cxx/parser/name-processor.cxx b/xsde/cxx/parser/name-processor.cxx index a168c28..2cd1020 100644 --- a/xsde/cxx/parser/name-processor.cxx +++ b/xsde/cxx/parser/name-processor.cxx @@ -29,9 +29,10 @@ namespace CXX public: Context (CLI::Options const& ops, SemanticGraph::Schema& root, - SemanticGraph::Path const& file) + SemanticGraph::Path const& path) : CXX::Context (std::wcerr, root, + path, "p:name", "char", ops.value<CLI::char_encoding> (), @@ -45,11 +46,8 @@ namespace CXX ops.value<CLI::include_regex_trace> (), ops.value<CLI::generate_inline> (), ops.value<CLI::reserved_name> ()), - schema_path_ (file), skel_suffix_ (ops.value<CLI::skel_type_suffix> ()), impl_suffix_ (ops.value<CLI::impl_type_suffix> ()), - schema (root), - schema_path (schema_path_), impl (ops.value<CLI::generate_noop_impl> () || ops.value<CLI::generate_print_impl> () || ops.value<CLI::generate_test_driver> ()), @@ -66,8 +64,6 @@ namespace CXX protected: Context (Context& c) : CXX::Context (c), - schema (c.schema), - schema_path (c.schema_path), impl (c.impl), tiein (c.tiein), skel_suffix (c.skel_suffix), @@ -102,15 +98,12 @@ namespace CXX } private: - SemanticGraph::Path const schema_path_; String const skel_suffix_; String const impl_suffix_; Cult::Containers::Map<String, NameSet*> global_type_names_; public: - SemanticGraph::Schema& schema; - SemanticGraph::Path const& schema_path; Boolean const impl; Boolean const tiein; String const& skel_suffix; diff --git a/xsde/cxx/parser/validator.cxx b/xsde/cxx/parser/validator.cxx index 33fe2e2..520ede6 100644 --- a/xsde/cxx/parser/validator.cxx +++ b/xsde/cxx/parser/validator.cxx @@ -24,10 +24,11 @@ namespace CXX { public: ValidationContext (SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& options, const WarningSet& disabled_warnings, Boolean& valid_) - : Context (std::wcerr, root, options, 0, 0, 0), + : Context (std::wcerr, root, path, options, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), valid (valid_), @@ -592,12 +593,12 @@ namespace CXX Boolean Validator:: validate (CLI::Options const& options, SemanticGraph::Schema& root, - SemanticGraph::Path const&, + SemanticGraph::Path const& path, Boolean gen_driver, const WarningSet& disabled_warnings) { Boolean valid (true); - ValidationContext ctx (root, options, disabled_warnings, valid); + ValidationContext ctx (root, path, options, disabled_warnings, valid); // // diff --git a/xsde/cxx/serializer/elements.cxx b/xsde/cxx/serializer/elements.cxx index f59a102..0192faf 100644 --- a/xsde/cxx/serializer/elements.cxx +++ b/xsde/cxx/serializer/elements.cxx @@ -12,12 +12,14 @@ namespace CXX Context:: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& ops, Regex const* he, Regex const* ie, Regex const* hie) : CXX::Context (o, root, + path, "s:name", "char", ops.value<CLI::char_encoding> (), diff --git a/xsde/cxx/serializer/elements.hxx b/xsde/cxx/serializer/elements.hxx index 7c16416..50a54eb 100644 --- a/xsde/cxx/serializer/elements.hxx +++ b/xsde/cxx/serializer/elements.hxx @@ -38,6 +38,7 @@ namespace CXX public: Context (std::wostream&, SemanticGraph::Schema&, + SemanticGraph::Path const&, CLI::Options const&, Regex const* hxx_expr, Regex const* ixx_expr, diff --git a/xsde/cxx/serializer/generator.cxx b/xsde/cxx/serializer/generator.cxx index cf6091d..9d519b9 100644 --- a/xsde/cxx/serializer/generator.cxx +++ b/xsde/cxx/serializer/generator.cxx @@ -685,7 +685,7 @@ namespace CXX // String xns; { - Context ctx (std::wcerr, schema, ops, 0, 0, 0); + Context ctx (std::wcerr, schema, file_path, ops, 0, 0, 0); xns = ctx.xs_ns_name (); } @@ -1161,7 +1161,8 @@ namespace CXX // HXX // { - Context ctx (hxx, schema, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); + Context ctx ( + hxx, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); Indentation::Clip<Indentation::SLOC, WideChar> hxx_sloc (hxx); @@ -1419,7 +1420,8 @@ namespace CXX // if (inline_) { - Context ctx (ixx, schema, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); + Context ctx ( + ixx, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); Indentation::Clip<Indentation::SLOC, WideChar> ixx_sloc (ixx); @@ -1475,7 +1477,8 @@ namespace CXX // if (source) { - Context ctx (cxx, schema, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); + Context ctx ( + cxx, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); Indentation::Clip<Indentation::SLOC, WideChar> cxx_sloc (cxx); @@ -1538,7 +1541,8 @@ namespace CXX // if (impl) { - Context ctx (hxx_impl, schema, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); + Context ctx (hxx_impl, schema, file_path, ops, + &hxx_expr, &ixx_expr, &hxx_impl_expr); String guard (guard_expr.merge (guard_prefix + hxx_impl_name)); guard = ctx.escape (guard); // Make it a C++ id. @@ -1566,7 +1570,7 @@ namespace CXX // if (impl) { - Context ctx (cxx_impl, schema, ops, + Context ctx (cxx_impl, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); // Set auto-indentation. @@ -1583,7 +1587,7 @@ namespace CXX // if (driver) { - Context ctx (cxx_driver, schema, ops, + Context ctx (cxx_driver, schema, file_path, ops, &hxx_expr, &ixx_expr, &hxx_impl_expr); // Set auto-indentation. diff --git a/xsde/cxx/serializer/name-processor.cxx b/xsde/cxx/serializer/name-processor.cxx index ddc9c4e..bc7ac8a 100644 --- a/xsde/cxx/serializer/name-processor.cxx +++ b/xsde/cxx/serializer/name-processor.cxx @@ -29,9 +29,10 @@ namespace CXX public: Context (CLI::Options const& ops, SemanticGraph::Schema& root, - SemanticGraph::Path const& file) + SemanticGraph::Path const& path) : CXX::Context (std::wcerr, root, + path, "s:name", "char", ops.value<CLI::char_encoding> (), @@ -45,11 +46,8 @@ namespace CXX ops.value<CLI::include_regex_trace> (), ops.value<CLI::generate_inline> (), ops.value<CLI::reserved_name> ()), - schema_path_ (file), skel_suffix_ (ops.value<CLI::skel_type_suffix> ()), impl_suffix_ (ops.value<CLI::impl_type_suffix> ()), - schema (root), - schema_path (schema_path_), impl (ops.value<CLI::generate_empty_impl> () || ops.value<CLI::generate_test_driver> ()), tiein (!ops.value<CLI::reuse_style_mixin> () && @@ -65,8 +63,6 @@ namespace CXX protected: Context (Context& c) : CXX::Context (c), - schema (c.schema), - schema_path (c.schema_path), impl (c.impl), tiein (c.tiein), skel_suffix (c.skel_suffix), @@ -101,15 +97,12 @@ namespace CXX } private: - SemanticGraph::Path const schema_path_; String const skel_suffix_; String const impl_suffix_; Cult::Containers::Map<String, NameSet*> global_type_names_; public: - SemanticGraph::Schema& schema; - SemanticGraph::Path const& schema_path; Boolean const impl; Boolean const tiein; String const& skel_suffix; diff --git a/xsde/cxx/serializer/validator.cxx b/xsde/cxx/serializer/validator.cxx index c163459..f5125e0 100644 --- a/xsde/cxx/serializer/validator.cxx +++ b/xsde/cxx/serializer/validator.cxx @@ -24,10 +24,11 @@ namespace CXX { public: ValidationContext (SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& options, const WarningSet& disabled_warnings, Boolean& valid_) - : Context (std::wcerr, root, options, 0, 0, 0), + : Context (std::wcerr, root, path, options, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), valid (valid_), @@ -401,12 +402,12 @@ namespace CXX Boolean Validator:: validate (CLI::Options const& options, SemanticGraph::Schema& root, - SemanticGraph::Path const&, + SemanticGraph::Path const& path, Boolean gen_driver, const WarningSet& disabled_warnings) { Boolean valid (true); - ValidationContext ctx (root, options, disabled_warnings, valid); + ValidationContext ctx (root, path, options, disabled_warnings, valid); // // |