You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2008/02/28 15:48:01 UTC
svn commit: r631987 - in /incubator/qpid/trunk/qpid/cpp/rubygen:
0-10/specification.rb amqpgen.rb generate
Author: aconway
Date: Thu Feb 28 06:47:59 2008
New Revision: 631987
URL: http://svn.apache.org/viewvc?rev=631987&view=rev
Log:
Fixed merging of multiple XML files for the same version.
Modified:
incubator/qpid/trunk/qpid/cpp/rubygen/0-10/specification.rb
incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb
incubator/qpid/trunk/qpid/cpp/rubygen/generate
Modified: incubator/qpid/trunk/qpid/cpp/rubygen/0-10/specification.rb
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/0-10/specification.rb?rev=631987&r1=631986&r2=631987&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/0-10/specification.rb (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/0-10/specification.rb Thu Feb 28 06:47:59 2008
@@ -112,8 +112,6 @@
# 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|
Modified: incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb?rev=631987&r1=631986&r2=631987&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/amqpgen.rb Thu Feb 28 06:47:59 2008
@@ -356,13 +356,19 @@
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
Modified: incubator/qpid/trunk/qpid/cpp/rubygen/generate
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/rubygen/generate?rev=631987&r1=631986&r2=631987&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/rubygen/generate (original)
+++ incubator/qpid/trunk/qpid/cpp/rubygen/generate Thu Feb 28 06:47:59 2008
@@ -20,18 +20,15 @@
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