Skip to content

Commit

Permalink
Merge pull request #425 from jwillemsen/jwi-ddsx11simplify
Browse files Browse the repository at this point in the history
Enhance implied annotation generation
  • Loading branch information
jwillemsen authored Jan 27, 2024
2 parents cd41419 + 9894481 commit fd42d41
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ridlbe/ccmx11/facets/dds/templates/idl/dds/bitmask.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// generated from <%= ridl_template_path %>
/// @copydoc <%= doc_scoped_name %>
% annotations.each do |_a|
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.values.each do |f| %><%= f %><% end %>)<% end %>
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.each_with_index do |f, index| %><%= _a.fields.keys[index] %>=<%= _a.fields.values[index] %><% if index < _a.fields.size - 1%>,<% end %><% end %>)<% end %>
% end
bitmask <%= unescaped_name %> {
<%= bitvalues.collect {|e| "/// @copydoc #{e.doc_scoped_name}\n #{e.name}" }.join(",\n ") %>
Expand Down
4 changes: 2 additions & 2 deletions ridlbe/ccmx11/facets/dds/templates/idl/dds/enum.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// generated from <%= ridl_template_path %>
/// @copydoc <%= doc_scoped_name %>
% annotations.each do |_a|
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.values.each do |f| %><%= f %><% end %>)<% end %>
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.each_with_index do |f, index| %><%= _a.fields.keys[index] %>=<%= _a.fields.values[index] %><% if index < _a.fields.size - 1%>,<% end %><% end %>)<% end %>
% end
enum <%= unescaped_name %> {
% enumerators.each do |e|
/// @copydoc <%= e.doc_scoped_name %>
% e.annotations.each do |_a|
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.values.each do |f| %><%= f %><% end %>)<% end %>
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.each_with_index do |f, index| %><%= _a.fields.keys[index] %>=<%= _a.fields.values[index] %><% if index < _a.fields.size - 1%>,<% end %><% end %>)<% end %>
% end
<%= e.name %><% unless e.equal?(enumerators.last)%>,<% end %>
% end
Expand Down
4 changes: 2 additions & 2 deletions ridlbe/ccmx11/facets/dds/templates/idl/dds/struct.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// generated from <%= ridl_template_path %>
/// @copydoc <%= doc_scoped_name %>
% annotations.each do |_a|
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.values.each do |f| %><%= f %><% end %>)<% end %>
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.each_with_index do |f, index| %><%= _a.fields.keys[index] %>=<%= _a.fields.values[index] %><% if index < _a.fields.size - 1%>,<% end %><% end %>)<% end %>
% end
struct <%= unescaped_name %><% unless base.nil? %> : <%= base.unescaped_name %><% end %> {
% members.each do |_m|
/// @copydoc <%= _m.doc_scoped_name %>
% _m.annotations.each do |_a|
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.values.each do |f| %><%= f %><% end %>)<% end %>
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.each_with_index do |f, index| %><%= _a.fields.keys[index] %>=<%= _a.fields.values[index] %><% if index < _a.fields.size - 1%>,<% end %><% end %>)<% end %>
% end
<%= strip_global_scope(_m.idltype_unescaped_name) %> <%= _m.unescaped_name %>;
% end
Expand Down
4 changes: 2 additions & 2 deletions ridlbe/ccmx11/facets/dds/templates/idl/dds/union.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// generated from <%= ridl_template_path %>
/// @copydoc <%= doc_scoped_name %>
% annotations.each do |_a|
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.values.each do |f| %><%= f %><% end %>)<% end %>
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.each_with_index do |f, index| %><%= _a.fields.keys[index] %>=<%= _a.fields.values[index] %><% if index < _a.fields.size - 1%>,<% end %><% end %>)<% end %>
% end
union <%= unescaped_name %> switch (<%= strip_global_scope(switchtype.idltype_unescaped_name) %>) {
% members.each do |_m|
Expand All @@ -15,7 +15,7 @@ union <%= unescaped_name %> switch (<%= strip_global_scope(switchtype.idltype_un
% end
/// @copydoc <%= _m.doc_scoped_name %>
% _m.annotations.each do |_a|
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.values.each do |f| %><%= f %><% end %>)<% end %>
@<%= _a.id %><% unless _a.fields.empty? %>(<% _a.fields.each_with_index do |f, index| %><%= _a.fields.keys[index] %>=<%= _a.fields.values[index] %><% if index < _a.fields.size - 1%>,<% end %><% end %>)<% end %>
% end
<%= strip_global_scope(_m.idltype_unescaped_name) %> <%= _m.unescaped_name %>;
% end
Expand Down
2 changes: 1 addition & 1 deletion ridlbe/ccmx11/facets/dds/visitors/struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def annotations
# Determine correct value for DDS nested annotation
nested = 'TRUE'
nested = 'FALSE' if has_toplevel_annotation?
ann << IDL::AST::Annotation.new('nested', {v: nested})
ann << IDL::AST::Annotation.new('nested', {value: nested})
end
end # StructVisitor
end # CCMX11
Expand Down
2 changes: 1 addition & 1 deletion ridlbe/ccmx11/facets/dds/visitors/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def annotations
# Determine correct value for DDS nested annotation
nested = 'TRUE'
nested = 'FALSE' if has_toplevel_annotation?
ann << IDL::AST::Annotation.new('nested', {v: nested})
ann << IDL::AST::Annotation.new('nested', {value: nested})
end
end
end # CCMX11
Expand Down

0 comments on commit fd42d41

Please sign in to comment.