summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-02-28 14:47:59 +0000
committerAlan Conway <aconway@apache.org>2008-02-28 14:47:59 +0000
commit34b478058f1eecea5bde4577aa76e1c6c2b16149 (patch)
treeaee6f3b7a1982542f7402172aea132f0763dace0 /qpid/cpp
parent7808370057cf31cf392a7cbc9cf41b78c3593855 (diff)
downloadqpid-python-34b478058f1eecea5bde4577aa76e1c6c2b16149.tar.gz
Fixed merging of multiple XML files for the same version.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@631987 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rwxr-xr-xqpid/cpp/rubygen/0-10/specification.rb2
-rwxr-xr-xqpid/cpp/rubygen/amqpgen.rb12
-rwxr-xr-xqpid/cpp/rubygen/generate19
3 files changed, 17 insertions, 16 deletions
diff --git a/qpid/cpp/rubygen/0-10/specification.rb b/qpid/cpp/rubygen/0-10/specification.rb
index 026b49e1a9..d88b03c3c6 100755
--- a/qpid/cpp/rubygen/0-10/specification.rb
+++ b/qpid/cpp/rubygen/0-10/specification.rb
@@ -112,8 +112,6 @@ class Specification < CppGen
# segment-type and track are are built in
domain_h d unless ["track","segment-type"].include?(d.name)
}
- puts @amqp.used_by.inspect
-
# Domains and structs that must be generated early because
# they are used by other definitions:
each_class_ns { |c|
diff --git a/qpid/cpp/rubygen/amqpgen.rb b/qpid/cpp/rubygen/amqpgen.rb
index b1e635a27b..b95a507b5e 100755
--- a/qpid/cpp/rubygen/amqpgen.rb
+++ b/qpid/cpp/rubygen/amqpgen.rb
@@ -356,13 +356,19 @@ class AmqpRoot < AmqpElement
amqp_attr_reader :major, :minor, :port, :comment
amqp_child_reader :doc, :type, :struct, :domain, :constant, :class
- def parse(filename) Document.new(File.new(filename)).root; end
+ def get_root(x)
+ case x
+ when Element then x
+ when Document then x.root
+ else Document.new(x).root
+ end
+ end
# Initialize with output directory and spec files from ARGV.
def initialize(*specs)
raise "No XML spec files." if specs.empty?
- xml=parse(specs.shift)
- specs.each { |s| xml_merge(xml, parse(s)) }
+ xml=get_root(specs.shift)
+ specs.each { |s| xml_merge(xml, get_root(s)) }
@used_by=Hash.new{ |h,k| h[k]=[] }
super(xml, nil)
end
diff --git a/qpid/cpp/rubygen/generate b/qpid/cpp/rubygen/generate
index d094be4f41..c370d92897 100755
--- a/qpid/cpp/rubygen/generate
+++ b/qpid/cpp/rubygen/generate
@@ -20,18 +20,15 @@ EOS
end
# Create array of specs by version
-def parse_specs(specs)
- roots={ }
- specs.each { |spec|
- root=AmqpRoot.new(spec)
- ver=root.version
- if (roots[ver])
- roots[ver].merge(root)
- else
- roots[ver]=root
- end
+def parse_specs(files)
+ specs=Hash.new { |h,k| h[k]=[] }
+ files.each { |f|
+ spec=AmqpRoot.new(File.new(f))
+ specs[spec.version] << spec
+ }
+ specs.each_pair { |k,v|
+ specs[k] = v.size==1 ? v.first : AmqpRoot.new(*v.map { |s| s.xml})
}
- roots
end
# Run selected templates