From f3e67f694188a16e426e92fda846998fd26db50d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 12 Jan 2010 15:14:06 +0200 Subject: Include file component in regex strings for schema being compiled --- xsd/cxx/elements.cxx | 5 +++++ xsd/cxx/elements.hxx | 6 ++++++ xsd/cxx/parser/elements.cxx | 2 ++ xsd/cxx/parser/elements.hxx | 1 + xsd/cxx/parser/generator.cxx | 8 +++++++- xsd/cxx/parser/name-processor.cxx | 11 ++--------- xsd/cxx/parser/validator.cxx | 7 ++++--- xsd/cxx/tree/counter.cxx | 6 ++++-- xsd/cxx/tree/counter.hxx | 4 +++- xsd/cxx/tree/elements.cxx | 2 ++ xsd/cxx/tree/elements.hxx | 1 + xsd/cxx/tree/generator.cxx | 6 +++++- xsd/cxx/tree/name-processor.cxx | 10 ++-------- xsd/cxx/tree/validator.cxx | 6 ++++-- 14 files changed, 48 insertions(+), 27 deletions(-) (limited to 'xsd') diff --git a/xsd/cxx/elements.cxx b/xsd/cxx/elements.cxx index 9b84e2c..29603ae 100644 --- a/xsd/cxx/elements.cxx +++ b/xsd/cxx/elements.cxx @@ -113,6 +113,7 @@ namespace CXX Context:: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, StringLiteralMap const* string_literal_map_, NarrowString const& char_type__, NarrowString const& char_encoding__, @@ -128,6 +129,7 @@ namespace CXX Containers::Vector const& reserved_name) : os (o), schema_root (root), + schema_path (schema_path_), char_type (char_type_), char_encoding (char_encoding_), L (L_), @@ -139,6 +141,7 @@ namespace CXX inst_exp (inst_exp_), inl (inl_), ns_mapping_cache (ns_mapping_cache_), + schema_path_ (path), xs_ns_ (0), char_type_ (char_type__), char_encoding_ (char_encoding__), @@ -307,6 +310,8 @@ namespace CXX if (s.names_begin () != s.names_end ()) path = u.path (); } + else + path = schema_path; String pair; diff --git a/xsd/cxx/elements.hxx b/xsd/cxx/elements.hxx index afc8229..59938c5 100644 --- a/xsd/cxx/elements.hxx +++ b/xsd/cxx/elements.hxx @@ -148,6 +148,7 @@ namespace CXX public: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, StringLiteralMap const* custom_literals_map, NarrowString const& char_type__, NarrowString const& char_encoding__, @@ -166,6 +167,7 @@ namespace CXX Context (Context& c) : os (c.os), schema_root (c.schema_root), + schema_path (c.schema_path), char_type (c.char_type), char_encoding (c.char_encoding), L (c.L), @@ -193,6 +195,7 @@ namespace CXX Context (Context& c, std::wostream& o) : os (o), schema_root (c.schema_root), + schema_path (c.schema_path), char_type (c.char_type), char_encoding (c.char_encoding), L (c.L), @@ -337,6 +340,7 @@ namespace CXX std::wostream& os; SemanticGraph::Schema& schema_root; + SemanticGraph::Path const& schema_path; String& char_type; String& char_encoding; @@ -355,6 +359,8 @@ namespace CXX MappingCache& ns_mapping_cache; private: + SemanticGraph::Path const schema_path_; + SemanticGraph::Namespace* xs_ns_; String char_type_; diff --git a/xsd/cxx/parser/elements.cxx b/xsd/cxx/parser/elements.cxx index 399553a..392bf16 100644 --- a/xsd/cxx/parser/elements.cxx +++ b/xsd/cxx/parser/elements.cxx @@ -41,6 +41,7 @@ namespace CXX Context:: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& ops, StringLiteralMap const* map, Regex const* he, @@ -48,6 +49,7 @@ namespace CXX Regex const* hie) : CXX::Context (o, root, + path, map, ops.value (), ops.value (), diff --git a/xsd/cxx/parser/elements.hxx b/xsd/cxx/parser/elements.hxx index 58e3c63..ca766f6 100644 --- a/xsd/cxx/parser/elements.hxx +++ b/xsd/cxx/parser/elements.hxx @@ -38,6 +38,7 @@ namespace CXX public: Context (std::wostream&, SemanticGraph::Schema&, + SemanticGraph::Path const& path, CLI::Options const&, StringLiteralMap const*, Regex const* hxx_expr, diff --git a/xsd/cxx/parser/generator.cxx b/xsd/cxx/parser/generator.cxx index b4cc0d1..60d2785 100644 --- a/xsd/cxx/parser/generator.cxx +++ b/xsd/cxx/parser/generator.cxx @@ -715,7 +715,7 @@ namespace CXX String xns; { - Context ctx (std::wcerr, schema, ops, 0, 0, 0, 0); + Context ctx (std::wcerr, schema, file_path, ops, 0, 0, 0, 0); xns = ctx.xs_ns_name (); } @@ -1160,6 +1160,7 @@ namespace CXX { Context ctx (hxx, schema, + file_path, ops, &string_literal_map, &hxx_expr, @@ -1253,6 +1254,7 @@ namespace CXX { Context ctx (ixx, schema, + file_path, ops, &string_literal_map, &hxx_expr, @@ -1315,6 +1317,7 @@ namespace CXX { Context ctx (cxx, schema, + file_path, ops, &string_literal_map, &hxx_expr, @@ -1385,6 +1388,7 @@ namespace CXX { Context ctx (hxx_impl, schema, + file_path, ops, &string_literal_map, &hxx_expr, @@ -1419,6 +1423,7 @@ namespace CXX { Context ctx (cxx_impl, schema, + file_path, ops, &string_literal_map, &hxx_expr, @@ -1441,6 +1446,7 @@ namespace CXX { Context ctx (cxx_driver, schema, + file_path, ops, &string_literal_map, &hxx_expr, diff --git a/xsd/cxx/parser/name-processor.cxx b/xsd/cxx/parser/name-processor.cxx index 9573ca8..3bc616e 100644 --- a/xsd/cxx/parser/name-processor.cxx +++ b/xsd/cxx/parser/name-processor.cxx @@ -34,10 +34,11 @@ namespace CXX public: Context (CLI::Options const& ops, SemanticGraph::Schema& root, - SemanticGraph::Path const& file, + SemanticGraph::Path const& path, StringLiteralMap const* map) : CXX::Context (std::wcerr, root, + path, map, ops.value (), ops.value (), @@ -51,11 +52,8 @@ namespace CXX ops.value (), ops.value (), ops.value ()), - schema_path_ (file), skel_suffix_ (ops.value ()), impl_suffix_ (ops.value ()), - schema (root), - schema_path (schema_path_), impl (ops.value () || ops.value () || ops.value ()), @@ -69,8 +67,6 @@ namespace CXX protected: Context (Context& c) : CXX::Context (c), - schema (c.schema), - schema_path (c.schema_path), impl (c.impl), skel_suffix (c.skel_suffix), impl_suffix (c.impl_suffix), @@ -98,15 +94,12 @@ namespace CXX } private: - SemanticGraph::Path const schema_path_; String const skel_suffix_; String const impl_suffix_; Cult::Containers::Map global_type_names_; public: - SemanticGraph::Schema& schema; - SemanticGraph::Path const& schema_path; Boolean const impl; String const& skel_suffix; String const& impl_suffix; diff --git a/xsd/cxx/parser/validator.cxx b/xsd/cxx/parser/validator.cxx index 2ca1d69..d70e333 100644 --- a/xsd/cxx/parser/validator.cxx +++ b/xsd/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, 0), + : Context (std::wcerr, root, path, options, 0, 0, 0, 0), disabled_warnings_ (disabled_warnings), disabled_warnings_all_ (false), valid (valid_), @@ -552,12 +553,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/xsd/cxx/tree/counter.cxx b/xsd/cxx/tree/counter.cxx index d2a5c10..9254226 100644 --- a/xsd/cxx/tree/counter.cxx +++ b/xsd/cxx/tree/counter.cxx @@ -236,10 +236,12 @@ namespace CXX } Counts Counter:: - count (CLI::Options const& options, SemanticGraph::Schema& tu) + count (CLI::Options const& options, + SemanticGraph::Schema& tu, + SemanticGraph::Path const& path) { Counts counts; - Context ctx (std::wcerr, tu, options, counts, false, 0, 0, 0, 0); + Context ctx (std::wcerr, tu, path, options, counts, false, 0, 0, 0, 0); Traversal::Schema schema; Traversal::Sources sources; diff --git a/xsd/cxx/tree/counter.hxx b/xsd/cxx/tree/counter.hxx index 85e9ec7..726de47 100644 --- a/xsd/cxx/tree/counter.hxx +++ b/xsd/cxx/tree/counter.hxx @@ -19,7 +19,9 @@ namespace CXX Counter (); // Dummy ctor, helps with long symbols on HP-UX. Counts - count (CLI::Options const& options, SemanticGraph::Schema&); + count (CLI::Options const&, + SemanticGraph::Schema&, + SemanticGraph::Path const&); }; } } diff --git a/xsd/cxx/tree/elements.cxx b/xsd/cxx/tree/elements.cxx index d9615ac..31e0c08 100644 --- a/xsd/cxx/tree/elements.cxx +++ b/xsd/cxx/tree/elements.cxx @@ -36,6 +36,7 @@ namespace CXX Context:: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& ops, Counts const& counts_, Boolean generate_xml_schema__, @@ -45,6 +46,7 @@ namespace CXX Regex const* ie) : CXX::Context (o, root, + path, map, ops.value (), ops.value (), diff --git a/xsd/cxx/tree/elements.hxx b/xsd/cxx/tree/elements.hxx index 0af42c9..1caf378 100644 --- a/xsd/cxx/tree/elements.hxx +++ b/xsd/cxx/tree/elements.hxx @@ -114,6 +114,7 @@ namespace CXX public: Context (std::wostream& o, SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& ops, Counts const& counts_, Boolean generate_xml_schema, diff --git a/xsd/cxx/tree/generator.cxx b/xsd/cxx/tree/generator.cxx index f81a8f4..012a1fd 100644 --- a/xsd/cxx/tree/generator.cxx +++ b/xsd/cxx/tree/generator.cxx @@ -847,7 +847,7 @@ namespace CXX Counts counts; { Counter counter; - counts = counter.count (ops, schema); + counts = counter.count (ops, schema, file_path); /* wcerr << "global type count: " << counts.global_types << endl; @@ -1195,6 +1195,7 @@ namespace CXX { Context ctx (fwd, schema, + file_path, ops, counts, generate_xml_schema, @@ -1310,6 +1311,7 @@ namespace CXX { Context ctx (hxx, schema, + file_path, ops, counts, generate_xml_schema, @@ -1464,6 +1466,7 @@ namespace CXX { Context ctx (ixx, schema, + file_path, ops, counts, generate_xml_schema, @@ -1597,6 +1600,7 @@ namespace CXX Context ctx (os, schema, + file_path, ops, counts, generate_xml_schema, diff --git a/xsd/cxx/tree/name-processor.cxx b/xsd/cxx/tree/name-processor.cxx index c90433f..1949c5d 100644 --- a/xsd/cxx/tree/name-processor.cxx +++ b/xsd/cxx/tree/name-processor.cxx @@ -43,10 +43,11 @@ namespace CXX Counts const& counts, Boolean generate_xml_schema, SemanticGraph::Schema& root, - SemanticGraph::Path const& file, + SemanticGraph::Path const& path, StringLiteralMap const& map) : Tree::Context (std::wcerr, root, + path, options, counts, generate_xml_schema, @@ -54,8 +55,6 @@ namespace CXX 0, 0, 0), - schema_path_ (file), - schema_path (schema_path_), global_type_names (global_type_names_), global_element_names (global_element_names_), type_regex (type_regex_), @@ -270,7 +269,6 @@ namespace CXX protected: Context (Context& c) : Tree::Context (c), - schema_path (c.schema_path), global_type_names (c.global_type_names), global_element_names (c.global_element_names), type_regex (c.type_regex), @@ -518,8 +516,6 @@ namespace CXX } private: - SemanticGraph::Path const schema_path_; - Cult::Containers::Map global_type_names_; Cult::Containers::Map global_element_names_; @@ -538,8 +534,6 @@ namespace CXX RegexVector element_type_regex_; public: - SemanticGraph::Path const& schema_path; - Cult::Containers::Map& global_type_names; Cult::Containers::Map& global_element_names; diff --git a/xsd/cxx/tree/validator.cxx b/xsd/cxx/tree/validator.cxx index 057e617..1f05e65 100644 --- a/xsd/cxx/tree/validator.cxx +++ b/xsd/cxx/tree/validator.cxx @@ -26,6 +26,7 @@ namespace CXX { public: ValidationContext (SemanticGraph::Schema& root, + SemanticGraph::Path const& path, CLI::Options const& options, const WarningSet& disabled_warnings, Counts const& counts, @@ -33,6 +34,7 @@ namespace CXX Boolean& valid_) : Context (std::wcerr, root, + path, options, counts, generate_xml_schema, @@ -528,13 +530,13 @@ namespace CXX Boolean Validator:: validate (CLI::Options const& options, SemanticGraph::Schema& schema, - SemanticGraph::Path const&, + SemanticGraph::Path const& path, const WarningSet& disabled_warnings, Counts const& counts) { Boolean valid (true); ValidationContext ctx ( - schema, options, disabled_warnings, counts, false, valid); + schema, path, options, disabled_warnings, counts, false, valid); // // -- cgit v1.1