diff options
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/rubygen/amqpgen.rb | 21 | ||||
-rw-r--r-- | cpp/src/Makefile.am | 5 |
2 files changed, 20 insertions, 6 deletions
diff --git a/cpp/rubygen/amqpgen.rb b/cpp/rubygen/amqpgen.rb index 49f8c0061e..edfbce2576 100755 --- a/cpp/rubygen/amqpgen.rb +++ b/cpp/rubygen/amqpgen.rb @@ -115,22 +115,35 @@ class AmqpClass < AmqpElement # chassis should be "client" or "server" def amqp_methods_on(chassis) @cache_amqp_methods_on ||= { } - @cache_amqp_methods_on[chassis] ||= elements.collect("method/chassis[@name='#{chassis}']/..") { |m| + + els = elements.collect("method/chassis[@name='#{chassis}']/..") { |m| AmqpMethod.new(m,self) }.sort_by_name - end + @cache_amqp_methods_on[chassis] ||= els +end end # AMQP root element. class AmqpRoot < AmqpElement + # FIXME aconway - something namespace-related in ruby 1.8.6 + # breaks all the xpath expressions with [@attr] tests. + # Not clear if this is a ruby bug or error in my xpath, + # current workaround is to simply delete the namespace node. + def newDoc(xmlFile) + root=Document.new(File.new(xmlFile)).root + root.delete_namespace + throw "Internal error, FIXME comment in aqmpgen.rb." unless (root.namespaces.empty?) + root + end + # Initialize with output directory and spec files from ARGV. def initialize(*specs) specs.size or raise "No XML spec files." specs.each { |f| File.exists?(f) or raise "Invalid XML file: #{f}"} - super Document.new(File.new(specs.shift)).root, nil + super newDoc(specs.shift), nil specs.each { |s| # Merge in additional specs - root=Document.new(File.new(s)).root + root=newDoc s merge(self,root) } end diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am index b0663c595c..d59a3a11ea 100644 --- a/cpp/src/Makefile.am +++ b/cpp/src/Makefile.am @@ -56,8 +56,9 @@ rgen_generator=$(rgen_dir)/generate \ rubygen.mk $(rgen_srcs): rubygen.timestamp rubygen.timestamp: $(rgen_generator) $(specs) $(rgen_templates) - { echo -n "rgen_srcs= "; \ - for f in `$(rgen_cmd) . $(specs) $(rgen_templates) `; do echo "\\"; echo -n " $$f "; done; \ + srcs=`$(rgen_cmd) . $(specs) $(rgen_templates) ` && { \ + echo -n "rgen_srcs= "; \ + for f in $$srcs; do echo "\\"; echo -n " $$f "; done; \ echo; } > rubygen.mk touch $@ else # !GENERATE |