From 900cdb2da86c6a9c523bac093aef482a1f1033e3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 May 2012 09:35:54 +0200 Subject: Get rid of dependency on libfrontend-elements Use libcutl facilities instead. --- xsd-frontend/semantic-graph/annotation.cxx | 22 ++- xsd-frontend/semantic-graph/any-attribute.cxx | 36 +++-- xsd-frontend/semantic-graph/any.cxx | 38 +++-- xsd-frontend/semantic-graph/attribute-group.cxx | 28 ++-- xsd-frontend/semantic-graph/attribute.cxx | 36 +++-- xsd-frontend/semantic-graph/complex.cxx | 38 +++-- xsd-frontend/semantic-graph/compositors.cxx | 117 +++++++--------- xsd-frontend/semantic-graph/element-group.cxx | 27 ++-- xsd-frontend/semantic-graph/element.cxx | 57 ++++---- xsd-frontend/semantic-graph/elements.cxx | 178 +++++++++--------------- xsd-frontend/semantic-graph/elements.hxx | 8 +- xsd-frontend/semantic-graph/enumeration.cxx | 55 ++++---- xsd-frontend/semantic-graph/fundamental.cxx.m4 | 37 +++-- xsd-frontend/semantic-graph/list.cxx | 26 ++-- xsd-frontend/semantic-graph/namespace.cxx | 26 ++-- xsd-frontend/semantic-graph/particle.cxx | 52 +++---- xsd-frontend/semantic-graph/schema.cxx | 118 ++++++++-------- xsd-frontend/semantic-graph/union.cxx | 26 ++-- 18 files changed, 399 insertions(+), 526 deletions(-) (limited to 'xsd-frontend/semantic-graph') diff --git a/xsd-frontend/semantic-graph/annotation.cxx b/xsd-frontend/semantic-graph/annotation.cxx index db30fc7..f1bb9b6 100644 --- a/xsd-frontend/semantic-graph/annotation.cxx +++ b/xsd-frontend/semantic-graph/annotation.cxx @@ -3,17 +3,15 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + using compiler::type_info; // Annotates // @@ -23,11 +21,10 @@ namespace XSDFrontend { AnnotatesInit () { - TypeInfo ti (typeid (Annotates)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Annotates)); + ti.add_base (typeid (Edge)); + insert (ti); } - } annotates_init_; } @@ -39,11 +36,10 @@ namespace XSDFrontend { AnnotationInit () { - TypeInfo ti (typeid (Annotation)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Annotation)); + ti.add_base (typeid (Node)); + insert (ti); } - } annotation_init_; } } diff --git a/xsd-frontend/semantic-graph/any-attribute.cxx b/xsd-frontend/semantic-graph/any-attribute.cxx index 799cee4..3177f80 100644 --- a/xsd-frontend/semantic-graph/any-attribute.cxx +++ b/xsd-frontend/semantic-graph/any-attribute.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include @@ -10,25 +12,6 @@ namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct AnyAttributeInit - { - AnyAttributeInit () - { - TypeInfo ti (typeid (AnyAttribute)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); - } - - } any_attribute_init_; - } - AnyAttribute:: AnyAttribute (Path const& file, UnsignedLong line, @@ -110,5 +93,20 @@ namespace XSDFrontend return namespace_ (scope ()); } + + namespace + { + using compiler::type_info; + + struct AnyAttributeInit + { + AnyAttributeInit () + { + type_info ti (typeid (AnyAttribute)); + ti.add_base (typeid (Nameable)); + insert (ti); + } + } any_attribute_init_; + } } } diff --git a/xsd-frontend/semantic-graph/any.cxx b/xsd-frontend/semantic-graph/any.cxx index bfa3055..02f4199 100644 --- a/xsd-frontend/semantic-graph/any.cxx +++ b/xsd-frontend/semantic-graph/any.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include #include @@ -10,26 +12,6 @@ namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct AnyInit - { - AnyInit () - { - TypeInfo ti (typeid (Any)); - ti.add_base (Access::public_, true, typeid (Nameable)); - ti.add_base (Access::public_, true, typeid (Particle)); - RTTI::insert (ti); - } - - } any_init_; - } - Any:: Any (Path const& file, UnsignedLong line, @@ -121,5 +103,21 @@ namespace XSDFrontend return namespace_ (scope); } + + namespace + { + using compiler::type_info; + + struct AnyInit + { + AnyInit () + { + type_info ti (typeid (Any)); + ti.add_base (typeid (Nameable)); + ti.add_base (typeid (Particle)); + insert (ti); + } + } any_init_; + } } } diff --git a/xsd-frontend/semantic-graph/attribute-group.cxx b/xsd-frontend/semantic-graph/attribute-group.cxx index 6a45bbd..d966cea 100644 --- a/xsd-frontend/semantic-graph/attribute-group.cxx +++ b/xsd-frontend/semantic-graph/attribute-group.cxx @@ -3,37 +3,33 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + AttributeGroup:: + AttributeGroup (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct AttributeGroupInit { AttributeGroupInit () { - TypeInfo ti (typeid (AttributeGroup)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (AttributeGroup)); + ti.add_base (typeid (Scope)); + insert (ti); } - } attribute_group_init_; } - - AttributeGroup:: - AttributeGroup (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - } } diff --git a/xsd-frontend/semantic-graph/attribute.cxx b/xsd-frontend/semantic-graph/attribute.cxx index f5f7522..794832c 100644 --- a/xsd-frontend/semantic-graph/attribute.cxx +++ b/xsd-frontend/semantic-graph/attribute.cxx @@ -3,31 +3,14 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct AttributeInit - { - AttributeInit () - { - TypeInfo ti (typeid (Attribute)); - ti.add_base (Access::public_, true, typeid (Member)); - RTTI::insert (ti); - } - - } attribute_init_; - } - Attribute:: Attribute (Path const& file, UnsignedLong line, @@ -40,5 +23,20 @@ namespace XSDFrontend optional_ (optional) { } + + namespace + { + using compiler::type_info; + + struct AttributeInit + { + AttributeInit () + { + type_info ti (typeid (Attribute)); + ti.add_base (typeid (Member)); + insert (ti); + } + } attribute_init_; + } } } diff --git a/xsd-frontend/semantic-graph/complex.cxx b/xsd-frontend/semantic-graph/complex.cxx index 6806c47..f17f12c 100644 --- a/xsd-frontend/semantic-graph/complex.cxx +++ b/xsd-frontend/semantic-graph/complex.cxx @@ -3,32 +3,14 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - namespace - { - struct ComplexInit - { - ComplexInit () - { - TypeInfo ti (typeid (Complex)); - ti.add_base (Access::public_, true, typeid (Type)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); - } - - } complex_init_; - } - Complex:: Complex () : mixed_ (false), contains_compositor_ (0) @@ -41,5 +23,21 @@ namespace XSDFrontend mixed_ (false), contains_compositor_ (0) { } + + namespace + { + using compiler::type_info; + + struct ComplexInit + { + ComplexInit () + { + type_info ti (typeid (Complex)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Scope)); + insert (ti); + } + } complex_init_; + } } } diff --git a/xsd-frontend/semantic-graph/compositors.cxx b/xsd-frontend/semantic-graph/compositors.cxx index 395f923..8eaa5cf 100644 --- a/xsd-frontend/semantic-graph/compositors.cxx +++ b/xsd-frontend/semantic-graph/compositors.cxx @@ -3,122 +3,99 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // ContainsCompositor + // + ContainsCompositor:: + ContainsCompositor (UnsignedLong min, UnsignedLong max) + : compositor_ (0), container_ (0), min_ (min), max_ (max) + { + } - using RTTI::Access; - using RTTI::TypeInfo; + // All + // + All:: + All (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } + // Choice + // + Choice:: + Choice (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } - // ContainsCompositor + // Sequence // + Sequence:: + Sequence (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } + namespace { + using compiler::type_info; + struct ContainsCompositorInit { ContainsCompositorInit () { - TypeInfo ti (typeid (ContainsCompositor)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (ContainsCompositor)); + ti.add_base (typeid (Edge)); + insert (ti); } - } contains_compositor_init_; - } - - ContainsCompositor:: - ContainsCompositor (UnsignedLong min, UnsignedLong max) - : compositor_ (0), container_ (0), min_ (min), max_ (max) - { - } - // Compositor - // - namespace - { struct CompositorInit { CompositorInit () { - TypeInfo ti (typeid (Compositor)); - ti.add_base (Access::public_, true, typeid (Particle)); - RTTI::insert (ti); + type_info ti (typeid (Compositor)); + ti.add_base (typeid (Particle)); + insert (ti); } - } compositor_init_; - } - - // All - // - namespace - { struct AllInit { AllInit () { - TypeInfo ti (typeid (All)); - ti.add_base (Access::public_, true, typeid (Compositor)); - RTTI::insert (ti); + type_info ti (typeid (All)); + ti.add_base (typeid (Compositor)); + insert (ti); } - } all_init_; - } - All:: - All (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - - - // Choice - // - namespace - { struct ChoiceInit { ChoiceInit () { - TypeInfo ti (typeid (Choice)); - ti.add_base (Access::public_, true, typeid (Compositor)); - RTTI::insert (ti); + type_info ti (typeid (Choice)); + ti.add_base (typeid (Compositor)); + insert (ti); } - } choice_init_; - } - - Choice:: - Choice (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - // Sequence - // - namespace - { struct SequenceInit { SequenceInit () { - TypeInfo ti (typeid (Sequence)); - ti.add_base (Access::public_, true, typeid (Compositor)); - RTTI::insert (ti); + type_info ti (typeid (Sequence)); + ti.add_base (typeid (Compositor)); + insert (ti); } - } sequence_init_; } - - Sequence:: - Sequence (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/xsd-frontend/semantic-graph/element-group.cxx b/xsd-frontend/semantic-graph/element-group.cxx index 17bb5f6..2e42757 100644 --- a/xsd-frontend/semantic-graph/element-group.cxx +++ b/xsd-frontend/semantic-graph/element-group.cxx @@ -3,36 +3,33 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + ElementGroup:: + ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column), contains_compositor_ (0) + { + } namespace { + using compiler::type_info; + struct ElementGroupInit { ElementGroupInit () { - TypeInfo ti (typeid (ElementGroup)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (ElementGroup)); + ti.add_base (typeid (Scope)); + insert (ti); } - } element_group_init_; } - - ElementGroup:: - ElementGroup (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column), contains_compositor_ (0) - { - } } } diff --git a/xsd-frontend/semantic-graph/element.cxx b/xsd-frontend/semantic-graph/element.cxx index dc3ad9f..607fd2c 100644 --- a/xsd-frontend/semantic-graph/element.cxx +++ b/xsd-frontend/semantic-graph/element.cxx @@ -3,61 +3,52 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - - - // Substitutes + // Element // + Element:: + Element (Path const& file, + UnsignedLong line, + UnsignedLong column, + Boolean global, + Boolean qualified) + : Node (file, line, column), + Member (global, qualified), + substitutes_ (0) + { + } + namespace { + using compiler::type_info; + struct SubstitutesInit { SubstitutesInit () { - TypeInfo ti (typeid (Substitutes)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Substitutes)); + ti.add_base (typeid (Edge)); + insert (ti); } - } substitutes_init_; - } - // Element - // - namespace - { struct ElementInit { ElementInit () { - TypeInfo ti (typeid (Element)); - ti.add_base (Access::public_, true, typeid (Member)); - ti.add_base (Access::public_, true, typeid (Particle)); - RTTI::insert (ti); + type_info ti (typeid (Element)); + ti.add_base (typeid (Member)); + ti.add_base (typeid (Particle)); + insert (ti); } - } element_init_; } - - Element:: - Element (Path const& file, - UnsignedLong line, - UnsignedLong column, - Boolean global, - Boolean qualified) - : Node (file, line, column), - Member (global, qualified), - substitutes_ (0) - { - } } } diff --git a/xsd-frontend/semantic-graph/elements.cxx b/xsd-frontend/semantic-graph/elements.cxx index 25b4c83..36fb9a3 100644 --- a/xsd-frontend/semantic-graph/elements.cxx +++ b/xsd-frontend/semantic-graph/elements.cxx @@ -5,6 +5,8 @@ #include +#include + #include #include @@ -46,10 +48,7 @@ namespace XSDFrontend argumented_.erase (i); } - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + using compiler::type_info; namespace { @@ -59,209 +58,178 @@ namespace XSDFrontend { EdgeInit () { - TypeInfo ti (typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Edge)); + insert (ti); } - } edge_init_; - // Node // struct NodeInit { NodeInit () { - TypeInfo ti (typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Node)); + insert (ti); } - } node_init_; - // Names // struct NamesInit { NamesInit () { - TypeInfo ti (typeid (Names)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Names)); + ti.add_base (typeid (Edge)); + insert (ti); } - } names_init_; - // Nameable // struct NameableInit { NameableInit () { - TypeInfo ti (typeid (Nameable)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Nameable)); + ti.add_base (typeid (Node)); + insert (ti); } - } nameable_init_; - // Scope // struct ScopeInit { ScopeInit () { - TypeInfo ti (typeid (Scope)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); + type_info ti (typeid (Scope)); + ti.add_base (typeid (Nameable)); + insert (ti); } - } scope_init_; - // Type // struct TypeInit { TypeInit () { - TypeInfo ti (typeid (Type)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); + type_info ti (typeid (Type)); + ti.add_base (typeid (Nameable)); + insert (ti); } - } type_init_; - // Instance // struct InstanceInit { InstanceInit () { - TypeInfo ti (typeid (Instance)); - ti.add_base (Access::public_, true, typeid (Nameable)); - RTTI::insert (ti); + type_info ti (typeid (Instance)); + ti.add_base (typeid (Nameable)); + insert (ti); } - } instance_init_; - // Belongs // struct BelongsInit { BelongsInit () { - TypeInfo ti (typeid (Belongs)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Belongs)); + ti.add_base (typeid (Edge)); + insert (ti); } - } belongs_init_; - - // Inherits // struct InheritsInit { InheritsInit () { - TypeInfo ti (typeid (Inherits)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Inherits)); + ti.add_base (typeid (Edge)); + insert (ti); } - } inherits_init_; - // Extends // struct ExtendsInit { ExtendsInit () { - TypeInfo ti (typeid (Extends)); - ti.add_base (Access::public_, true, typeid (Inherits)); - RTTI::insert (ti); + type_info ti (typeid (Extends)); + ti.add_base (typeid (Inherits)); + insert (ti); } - } extends_init_; - // Restricts // struct RestrictsInit { RestrictsInit () { - TypeInfo ti (typeid (Restricts)); - ti.add_base (Access::public_, true, typeid (Inherits)); - RTTI::insert (ti); + type_info ti (typeid (Restricts)); + ti.add_base (typeid (Inherits)); + insert (ti); } - } restricts_init_; - // BelongsToNamespace // struct BelongsToNamespaceInit { BelongsToNamespaceInit () { - TypeInfo ti (typeid (BelongsToNamespace)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (BelongsToNamespace)); + ti.add_base (typeid (Edge)); + insert (ti); } - } belongs_to_namespace_init_; - // Member // struct MemberInit { MemberInit () { - TypeInfo ti (typeid (Member)); - ti.add_base (Access::public_, true, typeid (Instance)); - RTTI::insert (ti); + type_info ti (typeid (Member)); + ti.add_base (typeid (Instance)); + insert (ti); } - } member_init_; - // Specialization // struct SpecializationInit { SpecializationInit () { - TypeInfo ti (typeid (Specialization)); - ti.add_base (Access::public_, true, typeid (Type)); - RTTI::insert (ti); + type_info ti (typeid (Specialization)); + ti.add_base (typeid (Type)); + insert (ti); } - } specialization_init_; - // Arguments // struct ArgumentsInit { ArgumentsInit () { - TypeInfo ti (typeid (Arguments)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Arguments)); + ti.add_base (typeid (Edge)); + insert (ti); } - } arguments_init_; - /* // Contains // @@ -269,64 +237,50 @@ namespace XSDFrontend { ContainsInit () { - TypeInfo ti (typeid (Contains)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Contains)); + ti.add_base (typeid (Edge)); + insert (ti); } - } contains_init_; - // Container // struct ContainerInit { ContainerInit () { - TypeInfo ti (typeid (Container)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Container)); + ti.add_base (typeid (Node)); + insert (ti); } - } container_init_; */ - // AnyType // - namespace + struct AnyTypeInit { - struct AnyTypeInit + AnyTypeInit () { - AnyTypeInit () - { - TypeInfo ti (typeid (AnyType)); - ti.add_base (Access::public_, true, typeid (SemanticGraph::Type)); - RTTI::insert (ti); - } - - } any_type_init_; - } - + type_info ti (typeid (AnyType)); + ti.add_base (typeid (SemanticGraph::Type)); + insert (ti); + } + } any_type_init_; // AnySimpleType // - namespace + struct AnySimpleTypeInit { - struct AnySimpleTypeInit + AnySimpleTypeInit () { - AnySimpleTypeInit () - { - TypeInfo ti (typeid (AnySimpleType)); - ti.add_base (Access::public_, true, typeid (Type)); - RTTI::insert (ti); - } - - } any_simple_type_init_; - } + type_info ti (typeid (AnySimpleType)); + ti.add_base (typeid (Type)); + insert (ti); + } + } any_simple_type_init_; } - // Instance // Type& Instance:: diff --git a/xsd-frontend/semantic-graph/elements.hxx b/xsd-frontend/semantic-graph/elements.hxx index 9bf0462..180a3b4 100644 --- a/xsd-frontend/semantic-graph/elements.hxx +++ b/xsd-frontend/semantic-graph/elements.hxx @@ -14,8 +14,6 @@ #include -#include - #include #include #include @@ -23,12 +21,14 @@ #include #include -#include +#include namespace XSDFrontend { namespace SemanticGraph { + using namespace cutl; + using namespace Cult::Types; namespace Bits @@ -164,7 +164,7 @@ namespace XSDFrontend Paths; typedef - FrontendElements::Context + compiler::context Context; // diff --git a/xsd-frontend/semantic-graph/enumeration.cxx b/xsd-frontend/semantic-graph/enumeration.cxx index b4c97fb..adb9704 100644 --- a/xsd-frontend/semantic-graph/enumeration.cxx +++ b/xsd-frontend/semantic-graph/enumeration.cxx @@ -3,30 +3,44 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // Enumeration + // + Enumeration:: + Enumeration (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } - using RTTI::Access; - using RTTI::TypeInfo; + // Enumerator + // + Enumerator:: + Enumerator (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + // Enumeration // struct EnumerationInit { EnumerationInit () { - TypeInfo ti (typeid (Enumeration)); - ti.add_base (Access::public_, true, typeid (Complex)); - RTTI::insert (ti); + type_info ti (typeid (Enumeration)); + ti.add_base (typeid (Complex)); + insert (ti); } - } enumeration_init_; @@ -36,32 +50,11 @@ namespace XSDFrontend { EnumeratorInit () { - TypeInfo ti (typeid (Enumerator)); - ti.add_base (Access::public_, true, typeid (Instance)); - RTTI::insert (ti); + type_info ti (typeid (Enumerator)); + ti.add_base (typeid (Instance)); + insert (ti); } - } enumerator_init_; } - - - // Enumeration - // - - Enumeration:: - Enumeration (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } - - - // Enumerator - // - - Enumerator:: - Enumerator (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/xsd-frontend/semantic-graph/fundamental.cxx.m4 b/xsd-frontend/semantic-graph/fundamental.cxx.m4 index 19e4e89..cf6c17f 100644 --- a/xsd-frontend/semantic-graph/fundamental.cxx.m4 +++ b/xsd-frontend/semantic-graph/fundamental.cxx.m4 @@ -21,9 +21,9 @@ define(`fundamental_type_impl', ` { $1Init () { - TypeInfo ti (typeid ($1)); - ti.add_base (Access::public_, true, typeid (Type)); - RTTI::insert (ti); + type_info ti (typeid ($1)); + ti.add_base (typeid (Type)); + insert (ti); } } $2_init_; @@ -49,6 +49,8 @@ dnl // Note, that this file is automatically generated! // +#include + #include namespace XSDFrontend @@ -57,11 +59,7 @@ namespace XSDFrontend { namespace Fundamental { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - + using compiler::type_info; // Type // @@ -71,11 +69,10 @@ namespace XSDFrontend { TypeInit () { - TypeInfo ti (typeid (Type)); - ti.add_base (Access::public_, true, typeid (SemanticGraph::Type)); - RTTI::insert (ti); + type_info ti (typeid (Type)); + ti.add_base (typeid (SemanticGraph::Type)); + insert (ti); } - } any_type_init_; } @@ -138,10 +135,10 @@ fundamental_type(`id') { IdRefInit () { - TypeInfo ti (typeid (IdRef)); - ti.add_base (Access::public_, true, typeid (Type)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (IdRef)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Specialization)); + insert (ti); } } id_ref_init_; @@ -164,10 +161,10 @@ fundamental_type(`id') { IdRefsInit () { - TypeInfo ti (typeid (IdRefs)); - ti.add_base (Access::public_, true, typeid (Type)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (IdRefs)); + ti.add_base (typeid (Type)); + ti.add_base (typeid (Specialization)); + insert (ti); } } id_refs_init_; diff --git a/xsd-frontend/semantic-graph/list.cxx b/xsd-frontend/semantic-graph/list.cxx index 36ce3f4..9911b81 100644 --- a/xsd-frontend/semantic-graph/list.cxx +++ b/xsd-frontend/semantic-graph/list.cxx @@ -3,35 +3,33 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + List:: + List (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct ListInit { ListInit () { - TypeInfo ti (typeid (List)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (List)); + ti.add_base (typeid (Specialization)); + insert (ti); } - } list_init_; } - - List:: - List (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/xsd-frontend/semantic-graph/namespace.cxx b/xsd-frontend/semantic-graph/namespace.cxx index 8794f8f..a82d1e1 100644 --- a/xsd-frontend/semantic-graph/namespace.cxx +++ b/xsd-frontend/semantic-graph/namespace.cxx @@ -3,35 +3,33 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + Namespace:: + Namespace (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct NamespaceInit { NamespaceInit () { - TypeInfo ti (typeid (Namespace)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (Namespace)); + ti.add_base (typeid (Scope)); + insert (ti); } - } namespace_init_; } - - Namespace:: - Namespace (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } diff --git a/xsd-frontend/semantic-graph/particle.cxx b/xsd-frontend/semantic-graph/particle.cxx index eb08a23..b966086 100644 --- a/xsd-frontend/semantic-graph/particle.cxx +++ b/xsd-frontend/semantic-graph/particle.cxx @@ -3,33 +3,16 @@ // copyright : Copyright (c) 2006-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; - // ContainsParticle // - namespace - { - struct ContainsParticleInit - { - ContainsParticleInit () - { - TypeInfo ti (typeid (ContainsParticle)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); - } - - } contains_particle_init_; - } - ContainsParticle:: ContainsParticle (UnsignedLong min, UnsignedLong max) : particle_ (0), compositor_ (0), min_ (min), max_ (max) @@ -38,24 +21,35 @@ namespace XSDFrontend // Particle // + Particle:: + Particle () + : contained_particle_ (0) + { + } + namespace { + using compiler::type_info; + + struct ContainsParticleInit + { + ContainsParticleInit () + { + type_info ti (typeid (ContainsParticle)); + ti.add_base (typeid (Edge)); + insert (ti); + } + } contains_particle_init_; + struct ParticleInit { ParticleInit () { - TypeInfo ti (typeid (Particle)); - ti.add_base (Access::public_, true, typeid (Node)); - RTTI::insert (ti); + type_info ti (typeid (Particle)); + ti.add_base (typeid (Node)); + insert (ti); } - } particle_init_; } - - Particle:: - Particle () - : contained_particle_ (0) - { - } } } diff --git a/xsd-frontend/semantic-graph/schema.cxx b/xsd-frontend/semantic-graph/schema.cxx index 0bb072f..3ff8c6d 100644 --- a/xsd-frontend/semantic-graph/schema.cxx +++ b/xsd-frontend/semantic-graph/schema.cxx @@ -3,30 +3,63 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; + // Schema + // + Schema::NamesIteratorPair Schema:: + find (Name const& name) const + { + // Here we are going to create an illusion that the namespace + // hierarchy is flat. + names_.clear (); + schemas_.clear (); - using RTTI::Access; - using RTTI::TypeInfo; + find_ (name, names_, schemas_); + + return NamesIteratorPair (NamesConstIterator (names_.begin ()), + NamesConstIterator (names_.end ())); + } + + Void Schema:: + find_ (Name const& name, NamesList& names, SchemaSet& set) const + { + set.insert (this); + + // Check our own namespace first so it will end up first in the list. + // + NamesIteratorPair pair (Scope::find (name)); + names.insert (names.end (), pair.first.base (), pair.second.base ()); + + for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i) + { + Schema& s (i->schema ()); + + if (set.find (&s) == set.end ()) + s.find_ (name, names, set); + } + } namespace { + using compiler::type_info; + // Uses // struct UsesInit { UsesInit () { - TypeInfo ti (typeid (Uses)); - ti.add_base (Access::public_, true, typeid (Edge)); - RTTI::insert (ti); + type_info ti (typeid (Uses)); + ti.add_base (typeid (Edge)); + insert (ti); } - } uses_init_; @@ -36,11 +69,10 @@ namespace XSDFrontend { ImpliesInit () { - TypeInfo ti (typeid (Implies)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Implies)); + ti.add_base (typeid (Uses)); + insert (ti); } - } implies_init_; @@ -50,11 +82,10 @@ namespace XSDFrontend { SourcesInit () { - TypeInfo ti (typeid (Sources)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Sources)); + ti.add_base (typeid (Uses)); + insert (ti); } - } sources_init_; @@ -64,11 +95,10 @@ namespace XSDFrontend { IncludesInit () { - TypeInfo ti (typeid (Includes)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Includes)); + ti.add_base (typeid (Uses)); + insert (ti); } - } includes_init_; @@ -78,11 +108,10 @@ namespace XSDFrontend { ImportsInit () { - TypeInfo ti (typeid (Imports)); - ti.add_base (Access::public_, true, typeid (Uses)); - RTTI::insert (ti); + type_info ti (typeid (Imports)); + ti.add_base (typeid (Uses)); + insert (ti); } - } imports_init_; @@ -92,48 +121,11 @@ namespace XSDFrontend { SchemaInit () { - TypeInfo ti (typeid (Schema)); - ti.add_base (Access::public_, true, typeid (Scope)); - RTTI::insert (ti); + type_info ti (typeid (Schema)); + ti.add_base (typeid (Scope)); + insert (ti); } - } schema_init_; } - - - // Schema - // - Schema::NamesIteratorPair Schema:: - find (Name const& name) const - { - // Here we are going to create an illusion that the namespace - // hierarchy is flat. - names_.clear (); - schemas_.clear (); - - find_ (name, names_, schemas_); - - return NamesIteratorPair (NamesConstIterator (names_.begin ()), - NamesConstIterator (names_.end ())); - } - - Void Schema:: - find_ (Name const& name, NamesList& names, SchemaSet& set) const - { - set.insert (this); - - // Check our own namespace first so it will end up first in the list. - // - NamesIteratorPair pair (Scope::find (name)); - names.insert (names.end (), pair.first.base (), pair.second.base ()); - - for (UsesIterator i (uses_begin ()), end (uses_end ()); i != end; ++i) - { - Schema& s (i->schema ()); - - if (set.find (&s) == set.end ()) - s.find_ (name, names, set); - } - } } } diff --git a/xsd-frontend/semantic-graph/union.cxx b/xsd-frontend/semantic-graph/union.cxx index 76e8382..111dd13 100644 --- a/xsd-frontend/semantic-graph/union.cxx +++ b/xsd-frontend/semantic-graph/union.cxx @@ -3,35 +3,33 @@ // copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file +#include + #include namespace XSDFrontend { namespace SemanticGraph { - namespace RTTI = Cult::RTTI; - - using RTTI::Access; - using RTTI::TypeInfo; + Union:: + Union (Path const& file, UnsignedLong line, UnsignedLong column) + : Node (file, line, column) + { + } namespace { + using compiler::type_info; + struct UnionInit { UnionInit () { - TypeInfo ti (typeid (Union)); - ti.add_base (Access::public_, true, typeid (Specialization)); - RTTI::insert (ti); + type_info ti (typeid (Union)); + ti.add_base (typeid (Specialization)); + insert (ti); } - } union_init_; } - - Union:: - Union (Path const& file, UnsignedLong line, UnsignedLong column) - : Node (file, line, column) - { - } } } -- cgit v1.1