aboutsummaryrefslogtreecommitdiff
path: root/xsd-frontend
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-05-07 09:35:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-05-07 09:35:54 +0200
commit900cdb2da86c6a9c523bac093aef482a1f1033e3 (patch)
treee9f169568996c40924a779cdc8f0b3f8c07813e1 /xsd-frontend
parent25cc7b7193999f095707028c5a315bc6bc95c82a (diff)
Get rid of dependency on libfrontend-elements
Use libcutl facilities instead.
Diffstat (limited to 'xsd-frontend')
-rw-r--r--xsd-frontend/makefile14
-rw-r--r--xsd-frontend/parser.cxx23
-rw-r--r--xsd-frontend/semantic-graph/annotation.cxx22
-rw-r--r--xsd-frontend/semantic-graph/any-attribute.cxx36
-rw-r--r--xsd-frontend/semantic-graph/any.cxx38
-rw-r--r--xsd-frontend/semantic-graph/attribute-group.cxx28
-rw-r--r--xsd-frontend/semantic-graph/attribute.cxx36
-rw-r--r--xsd-frontend/semantic-graph/complex.cxx38
-rw-r--r--xsd-frontend/semantic-graph/compositors.cxx117
-rw-r--r--xsd-frontend/semantic-graph/element-group.cxx27
-rw-r--r--xsd-frontend/semantic-graph/element.cxx57
-rw-r--r--xsd-frontend/semantic-graph/elements.cxx178
-rw-r--r--xsd-frontend/semantic-graph/elements.hxx8
-rw-r--r--xsd-frontend/semantic-graph/enumeration.cxx55
-rw-r--r--xsd-frontend/semantic-graph/fundamental.cxx.m437
-rw-r--r--xsd-frontend/semantic-graph/list.cxx26
-rw-r--r--xsd-frontend/semantic-graph/namespace.cxx26
-rw-r--r--xsd-frontend/semantic-graph/particle.cxx52
-rw-r--r--xsd-frontend/semantic-graph/schema.cxx118
-rw-r--r--xsd-frontend/semantic-graph/union.cxx26
-rw-r--r--xsd-frontend/transformations/anonymous.cxx2
-rw-r--r--xsd-frontend/transformations/restriction.cxx14
-rw-r--r--xsd-frontend/traversal/attribute.cxx2
-rw-r--r--xsd-frontend/traversal/attribute.hxx2
-rw-r--r--xsd-frontend/traversal/complex.cxx4
-rw-r--r--xsd-frontend/traversal/complex.hxx4
-rw-r--r--xsd-frontend/traversal/compositors.cxx8
-rw-r--r--xsd-frontend/traversal/compositors.hxx8
-rw-r--r--xsd-frontend/traversal/element-group.cxx2
-rw-r--r--xsd-frontend/traversal/element-group.hxx2
-rw-r--r--xsd-frontend/traversal/element.cxx2
-rw-r--r--xsd-frontend/traversal/element.hxx2
-rw-r--r--xsd-frontend/traversal/elements.cxx4
-rw-r--r--xsd-frontend/traversal/elements.hxx150
-rw-r--r--xsd-frontend/traversal/enumeration.cxx4
-rw-r--r--xsd-frontend/traversal/enumeration.hxx4
-rw-r--r--xsd-frontend/traversal/list.cxx2
-rw-r--r--xsd-frontend/traversal/list.hxx2
-rw-r--r--xsd-frontend/traversal/union.cxx2
-rw-r--r--xsd-frontend/traversal/union.hxx2
40 files changed, 495 insertions, 689 deletions
diff --git a/xsd-frontend/makefile b/xsd-frontend/makefile
index 8a8a759..010ec7d 100644
--- a/xsd-frontend/makefile
+++ b/xsd-frontend/makefile
@@ -68,23 +68,23 @@ $(call import,\
l: xerces_c.l,cpp-options: xerces_c.l.cpp-options)
$(call import,\
- $(scf_root)/import/libcult/stub.make,\
- l: cult.l,cpp-options: cult.l.cpp-options)
+ $(scf_root)/import/libcutl/stub.make,\
+ l: cutl.l,cpp-options: cutl.l.cpp-options)
$(call import,\
- $(scf_root)/import/libfrontend-elements/stub.make,\
- l: fe.l,cpp-options: fe.l.cpp-options)
+ $(scf_root)/import/libcult/stub.make,\
+ l: cult.l,cpp-options: cult.l.cpp-options)
# what to build
#
-$(xsd_frontend.l): $(cxx_obj) $(fe.l) $(cult.l) $(xerces_c.l) $(fs.l)
+$(xsd_frontend.l): $(cxx_obj) $(cult.l) $(cutl.l) $(xerces_c.l) $(fs.l)
$(xsd_frontend.l.cpp-options): prefix := xsd-frontend/ $(out_root)/
$(xsd_frontend.l.cpp-options): value := -I$(src_root) -I$(out_root)
$(xsd_frontend.l.cpp-options): \
$(fs.l.cpp-options) \
- $(fe.l.cpp-options) \
- $(cult.l.cpp-options)
+ $(cult.l.cpp-options) \
+ $(cutl.l.cpp-options)
#@@ This can be further optimized since only parser depends on xerces.
#
diff --git a/xsd-frontend/parser.cxx b/xsd-frontend/parser.cxx
index 550f883..84da4d1 100644
--- a/xsd-frontend/parser.cxx
+++ b/xsd-frontend/parser.cxx
@@ -1089,7 +1089,7 @@ namespace XSDFrontend
// the name from the prototype.
UnsignedLong count;
- FrontendElements::Context& ctx (scope.context ());
+ SemanticGraph::Context& ctx (scope.context ());
if (!ctx.count ("any-name-count"))
{
@@ -1251,7 +1251,7 @@ namespace XSDFrontend
// reuse the name from the attribute group.
UnsignedLong count;
- FrontendElements::Context& ctx (s.context ());
+ SemanticGraph::Context& ctx (s.context ());
if (!ctx.count ("any-attribute-name-count"))
{
@@ -1990,7 +1990,7 @@ namespace XSDFrontend
Traversal::Element,
Traversal::Member
{
- AnonymousMember (Traversal::NodeDispatcherBase& d)
+ AnonymousMember (Traversal::NodeDispatcher& d)
{
belongs_.node_traverser (d);
}
@@ -2028,7 +2028,7 @@ namespace XSDFrontend
struct AnonymousBase: Traversal::Type
{
- AnonymousBase (Traversal::NodeDispatcherBase& d)
+ AnonymousBase (Traversal::NodeDispatcher& d)
: base_ (d)
{
}
@@ -2041,7 +2041,7 @@ namespace XSDFrontend
}
private:
- Traversal::NodeDispatcherBase& base_;
+ Traversal::NodeDispatcher& base_;
} anonymous_base (resolver);
ns_names >> resolver;
@@ -2237,7 +2237,7 @@ namespace XSDFrontend
Traversal::Element,
Traversal::Member
{
- AnonymousMember (Traversal::NodeDispatcherBase& d)
+ AnonymousMember (Traversal::NodeDispatcher& d)
{
belongs_.node_traverser (d);
}
@@ -2275,7 +2275,7 @@ namespace XSDFrontend
struct AnonymousBase: Traversal::Type
{
- AnonymousBase (Traversal::NodeDispatcherBase& d)
+ AnonymousBase (Traversal::NodeDispatcher& d)
: base_ (d)
{
}
@@ -2288,7 +2288,7 @@ namespace XSDFrontend
}
private:
- Traversal::NodeDispatcherBase& base_;
+ Traversal::NodeDispatcher& base_;
} anonymous_base (resolver);
ns_names >> resolver;
@@ -3523,7 +3523,6 @@ namespace XSDFrontend
simple_content_restriction (XML::Element const& r)
{
String base (trim (r["base"]));
- Type* base_type (0);
if (trace_ && base)
wcout << "restriction base: " << fq_name (r, base) << endl;
@@ -3543,7 +3542,7 @@ namespace XSDFrontend
if (trace_)
wcout << name << endl;
- if (name == L"simpleType") base_type = simple_type (e); else
+ if (name == L"simpleType") simple_type (e); else
{
wcerr << file () << ":" << e.line () << ":" << e.column () << ": "
<< "error: expected 'simpleType' instead of "
@@ -4584,7 +4583,7 @@ namespace XSDFrontend
// put it into the scope.
//
UnsignedLong count;
- FrontendElements::Context& ctx (scope ().context ());
+ SemanticGraph::Context& ctx (scope ().context ());
if (!ctx.count ("any-name-count"))
{
@@ -4630,7 +4629,7 @@ namespace XSDFrontend
//
UnsignedLong count;
- FrontendElements::Context& ctx (scope ().context ());
+ SemanticGraph::Context& ctx (scope ().context ());
if (!ctx.count ("any-attribute-name-count"))
{
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/annotation.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/any-attribute.hxx>
#include <xsd-frontend/semantic-graph/compositors.hxx>
@@ -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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/any.hxx>
#include <xsd-frontend/semantic-graph/compositors.hxx>
@@ -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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/attribute-group.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/attribute.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/complex.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/compositors.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/element-group.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/element.hxx>
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 <algorithm>
+#include <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/elements.hxx>
#include <xsd-frontend/semantic-graph/annotation.hxx>
@@ -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 <cult/types.hxx>
-#include <cult/rtti/type-info.hxx>
-
#include <cult/containers/set.hxx>
#include <cult/containers/map.hxx>
#include <cult/containers/list.hxx>
@@ -23,12 +21,14 @@
#include <cult/containers/graph.hxx>
#include <cult/containers/vector.hxx>
-#include <frontend-elements/context.hxx>
+#include <cutl/compiler/context.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/enumeration.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/fundamental.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/list.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/namespace.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/particle.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/schema.hxx>
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 <cutl/compiler/type-info.hxx>
+
#include <xsd-frontend/semantic-graph/union.hxx>
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)
- {
- }
}
}
diff --git a/xsd-frontend/transformations/anonymous.cxx b/xsd-frontend/transformations/anonymous.cxx
index bc21baa..9dcbf45 100644
--- a/xsd-frontend/transformations/anonymous.cxx
+++ b/xsd-frontend/transformations/anonymous.cxx
@@ -139,7 +139,7 @@ namespace XSDFrontend
virtual Void
- traverse (SemanticGraph::List& x)
+ traverse (SemanticGraph::List&)
{
using SemanticGraph::List;
diff --git a/xsd-frontend/transformations/restriction.cxx b/xsd-frontend/transformations/restriction.cxx
index 4b5d38b..77c947e 100644
--- a/xsd-frontend/transformations/restriction.cxx
+++ b/xsd-frontend/transformations/restriction.cxx
@@ -432,14 +432,14 @@ namespace XSDFrontend
struct Anonymous : Traversal::Element,
Traversal::Attribute
{
- Anonymous (Traversal::NodeDispatcherBase& d1)
+ Anonymous (Traversal::NodeDispatcher& d1)
: complex_ (&d1, 0)
{
*this >> belongs_ >> complex_;
}
- Anonymous (Traversal::NodeDispatcherBase& d1,
- Traversal::NodeDispatcherBase& d2)
+ Anonymous (Traversal::NodeDispatcher& d1,
+ Traversal::NodeDispatcher& d2)
: complex_ (&d1, &d2)
{
*this >> belongs_ >> complex_;
@@ -501,8 +501,8 @@ namespace XSDFrontend
private:
struct Complex : Traversal::Complex
{
- Complex (Traversal::NodeDispatcherBase* d1,
- Traversal::NodeDispatcherBase* d2)
+ Complex (Traversal::NodeDispatcher* d1,
+ Traversal::NodeDispatcher* d2)
: d1_ (d1), d2_ (d2)
{
}
@@ -518,8 +518,8 @@ namespace XSDFrontend
}
private:
- Traversal::NodeDispatcherBase* d1_;
- Traversal::NodeDispatcherBase* d2_;
+ Traversal::NodeDispatcher* d1_;
+ Traversal::NodeDispatcher* d2_;
} complex_;
diff --git a/xsd-frontend/traversal/attribute.cxx b/xsd-frontend/traversal/attribute.cxx
index 00344b6..f94aec4 100644
--- a/xsd-frontend/traversal/attribute.cxx
+++ b/xsd-frontend/traversal/attribute.cxx
@@ -24,7 +24,7 @@ namespace XSDFrontend
}
Void Attribute::
- belongs (Type& a, EdgeDispatcherBase& d)
+ belongs (Type& a, EdgeDispatcher& d)
{
d.dispatch (a.belongs ());
}
diff --git a/xsd-frontend/traversal/attribute.hxx b/xsd-frontend/traversal/attribute.hxx
index bc36a86..e04df75 100644
--- a/xsd-frontend/traversal/attribute.hxx
+++ b/xsd-frontend/traversal/attribute.hxx
@@ -24,7 +24,7 @@ namespace XSDFrontend
pre (Type&);
virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ belongs (Type&, EdgeDispatcher&);
virtual Void
belongs (Type&);
diff --git a/xsd-frontend/traversal/complex.cxx b/xsd-frontend/traversal/complex.cxx
index b014812..9a07382 100644
--- a/xsd-frontend/traversal/complex.cxx
+++ b/xsd-frontend/traversal/complex.cxx
@@ -37,7 +37,7 @@ namespace XSDFrontend
}
Void Complex::
- inherits (Type& c, EdgeDispatcherBase& d)
+ inherits (Type& c, EdgeDispatcher& d)
{
if (c.inherits_p ())
d.dispatch (c.inherits ());
@@ -50,7 +50,7 @@ namespace XSDFrontend
}
Void Complex::
- contains_compositor (Type& c, EdgeDispatcherBase& d)
+ contains_compositor (Type& c, EdgeDispatcher& d)
{
if (c.contains_compositor_p ())
d.dispatch (c.contains_compositor ());
diff --git a/xsd-frontend/traversal/complex.hxx b/xsd-frontend/traversal/complex.hxx
index 5f1e38f..21f42ef 100644
--- a/xsd-frontend/traversal/complex.hxx
+++ b/xsd-frontend/traversal/complex.hxx
@@ -28,13 +28,13 @@ namespace XSDFrontend
inherits (Type&);
Void
- inherits (Type&, EdgeDispatcherBase&);
+ inherits (Type&, EdgeDispatcher&);
virtual Void
contains_compositor (Type&);
Void
- contains_compositor (Type&, EdgeDispatcherBase&);
+ contains_compositor (Type&, EdgeDispatcher&);
virtual Void
post (Type&);
diff --git a/xsd-frontend/traversal/compositors.cxx b/xsd-frontend/traversal/compositors.cxx
index 0de3819..c68e7a7 100644
--- a/xsd-frontend/traversal/compositors.cxx
+++ b/xsd-frontend/traversal/compositors.cxx
@@ -50,7 +50,7 @@ namespace XSDFrontend
}
Void Compositor::
- contains (Type& c, EdgeDispatcherBase& d)
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
@@ -84,7 +84,7 @@ namespace XSDFrontend
}
Void All::
- contains (Type& c, EdgeDispatcherBase& d)
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
@@ -118,7 +118,7 @@ namespace XSDFrontend
}
Void Choice::
- contains (Type& c, EdgeDispatcherBase& d)
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
@@ -152,7 +152,7 @@ namespace XSDFrontend
}
Void Sequence::
- contains (Type& c, EdgeDispatcherBase& d)
+ contains (Type& c, EdgeDispatcher& d)
{
iterate_and_dispatch (c.contains_begin (), c.contains_end (), d);
}
diff --git a/xsd-frontend/traversal/compositors.hxx b/xsd-frontend/traversal/compositors.hxx
index a6c9cec..5e099e4 100644
--- a/xsd-frontend/traversal/compositors.hxx
+++ b/xsd-frontend/traversal/compositors.hxx
@@ -62,7 +62,7 @@ namespace XSDFrontend
contains (Type&);
virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ contains (Type&, EdgeDispatcher&);
virtual Void
post (Type&);
@@ -83,7 +83,7 @@ namespace XSDFrontend
contains (Type&);
virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ contains (Type&, EdgeDispatcher&);
virtual Void
post (Type&);
@@ -104,7 +104,7 @@ namespace XSDFrontend
contains (Type&);
virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ contains (Type&, EdgeDispatcher&);
virtual Void
post (Type&);
@@ -125,7 +125,7 @@ namespace XSDFrontend
contains (Type&);
virtual Void
- contains (Type&, EdgeDispatcherBase&);
+ contains (Type&, EdgeDispatcher&);
virtual Void
post (Type&);
diff --git a/xsd-frontend/traversal/element-group.cxx b/xsd-frontend/traversal/element-group.cxx
index 2129272..1658074 100644
--- a/xsd-frontend/traversal/element-group.cxx
+++ b/xsd-frontend/traversal/element-group.cxx
@@ -24,7 +24,7 @@ namespace XSDFrontend
}
Void ElementGroup::
- contains_compositor (Type& g, EdgeDispatcherBase& d)
+ contains_compositor (Type& g, EdgeDispatcher& d)
{
d.dispatch (g.contains_compositor ());
}
diff --git a/xsd-frontend/traversal/element-group.hxx b/xsd-frontend/traversal/element-group.hxx
index ef5bd84..56ddc0f 100644
--- a/xsd-frontend/traversal/element-group.hxx
+++ b/xsd-frontend/traversal/element-group.hxx
@@ -25,7 +25,7 @@ namespace XSDFrontend
contains_compositor (Type&);
virtual Void
- contains_compositor (Type&, EdgeDispatcherBase&);
+ contains_compositor (Type&, EdgeDispatcher&);
virtual Void
post (Type&);
diff --git a/xsd-frontend/traversal/element.cxx b/xsd-frontend/traversal/element.cxx
index 26ed784..62e5ee8 100644
--- a/xsd-frontend/traversal/element.cxx
+++ b/xsd-frontend/traversal/element.cxx
@@ -24,7 +24,7 @@ namespace XSDFrontend
}
Void Element::
- belongs (Type& m, EdgeDispatcherBase& d)
+ belongs (Type& m, EdgeDispatcher& d)
{
d.dispatch (m.belongs ());
}
diff --git a/xsd-frontend/traversal/element.hxx b/xsd-frontend/traversal/element.hxx
index c77dd1d..3e54950 100644
--- a/xsd-frontend/traversal/element.hxx
+++ b/xsd-frontend/traversal/element.hxx
@@ -22,7 +22,7 @@ namespace XSDFrontend
pre (Type&);
virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ belongs (Type&, EdgeDispatcher&);
virtual Void
belongs (Type&);
diff --git a/xsd-frontend/traversal/elements.cxx b/xsd-frontend/traversal/elements.cxx
index 84d076a..f8bc283 100644
--- a/xsd-frontend/traversal/elements.cxx
+++ b/xsd-frontend/traversal/elements.cxx
@@ -25,7 +25,7 @@ namespace XSDFrontend
}
Void Instance::
- belongs (Type& a, EdgeDispatcherBase& d)
+ belongs (Type& a, EdgeDispatcher& d)
{
d.dispatch (a.belongs ());
}
@@ -58,7 +58,7 @@ namespace XSDFrontend
}
Void Member::
- belongs (Type& a, EdgeDispatcherBase& d)
+ belongs (Type& a, EdgeDispatcher& d)
{
d.dispatch (a.belongs ());
}
diff --git a/xsd-frontend/traversal/elements.hxx b/xsd-frontend/traversal/elements.hxx
index 3acb0b5..35604e8 100644
--- a/xsd-frontend/traversal/elements.hxx
+++ b/xsd-frontend/traversal/elements.hxx
@@ -8,7 +8,7 @@
#include <cult/types.hxx>
-#include <frontend-elements/traversal.hxx>
+#include <cutl/compiler/traversal.hxx>
#include <xsd-frontend/semantic-graph/elements.hxx>
@@ -16,150 +16,85 @@ namespace XSDFrontend
{
namespace Traversal
{
+ using namespace cutl;
using namespace Cult::Types;
- namespace Bits
- {
- using FrontendElements::Traversal::TraverserBase;
- using FrontendElements::Traversal::Traverser;
-
- using FrontendElements::Traversal::DispatcherBase;
- using FrontendElements::Traversal::Dispatcher;
-
- }
-
- typedef Bits::DispatcherBase<SemanticGraph::Node> NodeDispatcherBase;
- typedef Bits::DispatcherBase<SemanticGraph::Edge> EdgeDispatcherBase;
-
+ typedef compiler::dispatcher<SemanticGraph::Node> NodeDispatcher;
+ typedef compiler::dispatcher<SemanticGraph::Edge> EdgeDispatcher;
//
//
- struct NodeBase : virtual Bits::Dispatcher<SemanticGraph::Node>,
- virtual Bits::Dispatcher<SemanticGraph::Edge>
+ struct NodeBase: NodeDispatcher, EdgeDispatcher
{
Void
- edge_traverser (EdgeDispatcherBase& d)
+ edge_traverser (EdgeDispatcher& d)
{
- Bits::Dispatcher<SemanticGraph::Edge>::traverser (d);
+ EdgeDispatcher::traverser (d);
}
- EdgeDispatcherBase&
+ EdgeDispatcher&
edge_traverser ()
{
return *this;
}
- public:
- using Bits::Dispatcher<SemanticGraph::Node>::dispatch;
- using Bits::Dispatcher<SemanticGraph::Edge>::dispatch;
-
- using Bits::Dispatcher<SemanticGraph::Node>::map;
-
- using Bits::Dispatcher<SemanticGraph::Edge>::iterate_and_dispatch;
- };
-
-
- //
- //
- template <typename T>
- struct Node : Bits::TraverserBase<SemanticGraph::Node>, virtual NodeBase
- {
- typedef
- T
- Type;
-
- Node ()
- {
- map (typeid (Type), *this);
- }
-
- virtual Void
- traverse (Type&) = 0;
-
- virtual Void
- trampoline (SemanticGraph::Node& i)
- {
- traverse (dynamic_cast<Type&> (i));
- }
+ using NodeDispatcher::dispatch;
+ using EdgeDispatcher::dispatch;
- virtual Void
- trampoline (SemanticGraph::Node const&)
- {
- abort ();
- }
+ using EdgeDispatcher::iterate_and_dispatch;
};
-
- //
- //
- struct EdgeBase : virtual Bits::Dispatcher<SemanticGraph::Edge>,
- virtual Bits::Dispatcher<SemanticGraph::Node>
+ struct EdgeBase: EdgeDispatcher, NodeDispatcher
{
Void
- node_traverser (NodeDispatcherBase& d)
+ node_traverser (NodeDispatcher& d)
{
- Bits::Dispatcher<SemanticGraph::Node>::traverser (d);
+ NodeDispatcher::traverser (d);
}
- NodeDispatcherBase&
+ NodeDispatcher&
node_traverser ()
{
return *this;
}
- public:
- using Bits::Dispatcher<SemanticGraph::Edge>::dispatch;
- using Bits::Dispatcher<SemanticGraph::Node>::dispatch;
-
- using Bits::Dispatcher<SemanticGraph::Edge>::map;
-
- using Bits::Dispatcher<SemanticGraph::Node>::iterate_and_dispatch;
- };
-
- template <typename T>
- struct Edge : Bits::TraverserBase<SemanticGraph::Edge>, virtual EdgeBase
- {
- typedef
- T
- Type;
-
- Edge ()
- {
- map (typeid (Type), *this);
- }
-
- virtual Void
- traverse (Type&) = 0;
-
- virtual Void
- trampoline (SemanticGraph::Edge& i)
- {
- traverse (dynamic_cast<Type&> (i));
- }
+ using EdgeDispatcher::dispatch;
+ using NodeDispatcher::dispatch;
- virtual Void
- trampoline (SemanticGraph::Edge const&)
- {
- abort ();
- }
+ using NodeDispatcher::iterate_and_dispatch;
};
- inline
- EdgeBase&
+ inline EdgeBase&
operator>> (NodeBase& n, EdgeBase& e)
{
n.edge_traverser (e);
return e;
}
- inline
- NodeBase&
+ inline NodeBase&
operator>> (EdgeBase& e, NodeBase& n)
{
e.node_traverser (n);
return n;
}
+ //
+ //
+ template <typename T>
+ struct Node: compiler::traverser_impl<T, SemanticGraph::Node>,
+ virtual NodeBase
+ {
+ typedef T Type;
+ };
+
+ template <typename T>
+ struct Edge: compiler::traverser_impl<T, SemanticGraph::Edge>,
+ virtual EdgeBase
+ {
+ typedef T Type;
+ };
+
+ //
// Edges
//
@@ -204,11 +139,10 @@ namespace XSDFrontend
}
};
-
+ //
// Nodes
//
-
//
//
struct Nameable : Node<SemanticGraph::Nameable>
@@ -231,7 +165,7 @@ namespace XSDFrontend
template<typename X>
Void
names (T& s,
- EdgeDispatcherBase& d,
+ EdgeDispatcher& d,
Void (X::*pre_) (T&) = (Void (ScopeTemplate<T>::*)(T&)) (0),
Void (X::*post_) (T&) = (Void (ScopeTemplate<T>::*)(T&)) (0),
Void (X::*none_) (T&) = (Void (ScopeTemplate<T>::*)(T&)) (0),
@@ -267,7 +201,7 @@ namespace XSDFrontend
}
virtual Void
- names (T& s, EdgeDispatcherBase& d)
+ names (T& s, EdgeDispatcher& d)
{
names<ScopeTemplate<T> > (s, d);
}
@@ -332,7 +266,7 @@ namespace XSDFrontend
pre (Type&);
virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ belongs (Type&, EdgeDispatcher&);
virtual Void
belongs (Type&);
@@ -353,7 +287,7 @@ namespace XSDFrontend
pre (Type&);
virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ belongs (Type&, EdgeDispatcher&);
virtual Void
belongs (Type&);
diff --git a/xsd-frontend/traversal/enumeration.cxx b/xsd-frontend/traversal/enumeration.cxx
index 4ba10eb..9dfae89 100644
--- a/xsd-frontend/traversal/enumeration.cxx
+++ b/xsd-frontend/traversal/enumeration.cxx
@@ -38,7 +38,7 @@ namespace XSDFrontend
}
Void Enumeration::
- inherits (Type& e, EdgeDispatcherBase& d)
+ inherits (Type& e, EdgeDispatcher& d)
{
if (e.inherits_p ())
d.dispatch (e.inherits ());
@@ -67,7 +67,7 @@ namespace XSDFrontend
}
Void Enumerator::
- belongs (Type& e, EdgeDispatcherBase& d)
+ belongs (Type& e, EdgeDispatcher& d)
{
d.dispatch (e.belongs ());
}
diff --git a/xsd-frontend/traversal/enumeration.hxx b/xsd-frontend/traversal/enumeration.hxx
index c1f2b08..f8aeaf7 100644
--- a/xsd-frontend/traversal/enumeration.hxx
+++ b/xsd-frontend/traversal/enumeration.hxx
@@ -28,7 +28,7 @@ namespace XSDFrontend
inherits (Type&);
Void
- inherits (Type&, EdgeDispatcherBase&);
+ inherits (Type&, EdgeDispatcher&);
virtual Void
post (Type&);
@@ -43,7 +43,7 @@ namespace XSDFrontend
pre (Type&);
virtual Void
- belongs (Type&, EdgeDispatcherBase&);
+ belongs (Type&, EdgeDispatcher&);
virtual Void
belongs (Type&);
diff --git a/xsd-frontend/traversal/list.cxx b/xsd-frontend/traversal/list.cxx
index 08186a8..523a43c 100644
--- a/xsd-frontend/traversal/list.cxx
+++ b/xsd-frontend/traversal/list.cxx
@@ -30,7 +30,7 @@ namespace XSDFrontend
}
Void List::
- argumented (Type& l, EdgeDispatcherBase& d)
+ argumented (Type& l, EdgeDispatcher& d)
{
d.dispatch (l.argumented ());
}
diff --git a/xsd-frontend/traversal/list.hxx b/xsd-frontend/traversal/list.hxx
index d750f17..6105de8 100644
--- a/xsd-frontend/traversal/list.hxx
+++ b/xsd-frontend/traversal/list.hxx
@@ -25,7 +25,7 @@ namespace XSDFrontend
argumented (Type&);
virtual Void
- argumented (Type&, EdgeDispatcherBase& d);
+ argumented (Type&, EdgeDispatcher& d);
virtual Void
name (Type&);
diff --git a/xsd-frontend/traversal/union.cxx b/xsd-frontend/traversal/union.cxx
index fbee353..26522ec 100644
--- a/xsd-frontend/traversal/union.cxx
+++ b/xsd-frontend/traversal/union.cxx
@@ -30,7 +30,7 @@ namespace XSDFrontend
}
Void Union::
- argumented (Type& u, EdgeDispatcherBase& d)
+ argumented (Type& u, EdgeDispatcher& d)
{
iterate_and_dispatch (u.argumented_begin (), u.argumented_end (), d);
}
diff --git a/xsd-frontend/traversal/union.hxx b/xsd-frontend/traversal/union.hxx
index dd2b195..fe79929 100644
--- a/xsd-frontend/traversal/union.hxx
+++ b/xsd-frontend/traversal/union.hxx
@@ -25,7 +25,7 @@ namespace XSDFrontend
argumented (Type&);
virtual Void
- argumented (Type&, EdgeDispatcherBase& d);
+ argumented (Type&, EdgeDispatcher& d);
virtual Void
name (Type&);