ridl 2.8.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be5b79c10b3a4bb8e2f0404004ec5201332bef859fc69c636c4750e8eb6f6b13
4
- data.tar.gz: 0a23918976bfb9b7db6595409d974fc80be2b5a686f8b40220fa689edd9cc791
3
+ metadata.gz: d24bac3b0aa52e6c84a1ef61d0939d84b3277b139a69db8cfc1f7f95130bf6a2
4
+ data.tar.gz: 3f773ed9d639811aaba53a68e0ace506b5e6b11591875326665d102faeff5a8f
5
5
  SHA512:
6
- metadata.gz: a187e41cc1d3c1d77f79f2ed9e43dccc4b83bc89b98ed4e2771627b2b1b771ba26390624f9abf779e1e2c5c89d7776698045408ca3ceb8ca9f10ecf87c6d0db6
7
- data.tar.gz: b90d9a055d29d2de3dcee867df3ca57a26c8ddefd5b77fc3ff1a8a3ab7f645b395d8359c93b8a8a65122b006a76cd9f89815141239cd8e335cf21a78916b89b7
6
+ metadata.gz: 1aa10dbfdb821544c474bc3f41bf48c156a42bf51d909ed631c6030ebd546145f9f9e70945bf4aa54a68e74cfe4a4d27b38dfab937e1576338febc67ea18dc8c
7
+ data.tar.gz: b96af7bb90418102bfb030dbd798bd15384232ab2547887fd68d4a3e1dc4142c0d997ab15f4de93daf06f39e764d8d8d04720774e81031b537b343daf6570862
data/lib/ridl/backend.rb CHANGED
@@ -50,7 +50,7 @@ module IDL
50
50
  rescue LoadError => ex
51
51
  IDL.error "ERROR: Cannot load RIDL backend [:#{be_name}]"
52
52
  IDL.error ex.inspect
53
- IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level>0
53
+ IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level > 0
54
54
  exit 1
55
55
  end
56
56
  end
data/lib/ridl/delegate.rb CHANGED
@@ -213,7 +213,7 @@ class Delegator
213
213
  params = { :filename => s, :fullpath => fullpath }
214
214
  params[:defined] = true
215
215
  params[:preprocessed] = @preprocess
216
- @cur = @cur.define(IDL::AST::Include, "$INC:"+s, params)
216
+ @cur = @cur.define(IDL::AST::Include, "$INC:" + s, params)
217
217
  @includes[s] = @cur
218
218
  set_last
219
219
  @cur
@@ -228,7 +228,7 @@ class Delegator
228
228
  params = { :filename => s, :fullpath => @includes[s].fullpath }
229
229
  params[:defined] = false
230
230
  params[:preprocessed] = @includes[s].is_preprocessed?
231
- @cur.define(IDL::AST::Include, "$INC:"+s, params)
231
+ @cur.define(IDL::AST::Include, "$INC:" + s, params)
232
232
  end
233
233
 
234
234
  def pragma_prefix(s)
@@ -258,7 +258,7 @@ class Delegator
258
258
  end
259
259
 
260
260
  def handle_pragma(pragma_string)
261
- unless @@pragma_handlers.values.any? {|h| h.call(self, @cur, pragma_string)}
261
+ unless @@pragma_handlers.values.reduce(false) {|rc, h| h.call(self, @cur, pragma_string) || rc }
262
262
  IDL.log(1, "RIDL - unrecognized pragma encountered: #{pragma_string}.")
263
263
  end
264
264
  end
@@ -299,8 +299,8 @@ class Delegator
299
299
  end
300
300
 
301
301
  def define_template_module(global, names)
302
- if global || names.size>1
303
- raise "no scoped identifier allowed for template module: #{(global ? '::' : '')+names.join('::')}"
302
+ if global || names.size > 1
303
+ raise "no scoped identifier allowed for template module: #{(global ? '::' : '') + names.join('::')}"
304
304
  end
305
305
  @cur = @cur.define(IDL::AST::TemplateModule, names[0])
306
306
  @cur.annotations.concat(@annotation_stack)
@@ -562,7 +562,7 @@ class Delegator
562
562
  root.introduce(first)
563
563
  case node
564
564
  when IDL::AST::Module, IDL::AST::TemplateModule,
565
- IDL::AST::Interface,IDL::AST::Home, IDL::AST::Component,
565
+ IDL::AST::Interface, IDL::AST::Home, IDL::AST::Component,
566
566
  IDL::AST::Porttype, IDL::AST::Connector,
567
567
  IDL::AST::Struct, IDL::AST::Union, IDL::AST::Typedef,
568
568
  IDL::AST::Exception, IDL::AST::Enum,
@@ -86,7 +86,7 @@ module IDL
86
86
 
87
87
  if _operands.size != n
88
88
  raise format("%s must receive %d operand%s.",
89
- self.typename, n, if (n>1) then "s" else "" end)
89
+ self.typename, n, if (n > 1) then "s" else "" end)
90
90
  end
91
91
 
92
92
  unless _operands.any? { |o| o.is_template? }
@@ -184,7 +184,7 @@ module IDL
184
184
  superclass.checktype(*types)
185
185
 
186
186
  # it's expected that Double, LongDouble is a Float.
187
- s1,s2 = IDL::Type::Float, IDL::Type::Fixed
187
+ s1, s2 = IDL::Type::Float, IDL::Type::Fixed
188
188
  if (t1 === s1 && t2 === s2) or (t1 === s2 && t2 === s1)
189
189
  raise "#{self.name} about #{t1.typename} and #{t2.typename} is illegal."
190
190
  end
@@ -210,7 +210,7 @@ module IDL
210
210
  Applicable = Integer2::Applicable
211
211
  def calculate(op)
212
212
  if @idltype.is_unsigned?()
213
- (2**@idltype.bits-1)-op
213
+ (2**@idltype.bits - 1) - op
214
214
  else
215
215
  ~op
216
216
  end
@@ -218,13 +218,13 @@ module IDL
218
218
  end
219
219
 
220
220
  class Or < Boolean2
221
- def calculate(lop,rop); lop | rop; end
221
+ def calculate(lop, rop); lop | rop; end
222
222
  end
223
223
  class And < Boolean2
224
- def calculate(lop,rop); lop & rop; end
224
+ def calculate(lop, rop); lop & rop; end
225
225
  end
226
226
  class Xor < Boolean2
227
- def calculate(lop,rop); lop ^ rop; end
227
+ def calculate(lop, rop); lop ^ rop; end
228
228
  end
229
229
 
230
230
  class Shift < Integer2
@@ -236,32 +236,32 @@ module IDL
236
236
  end
237
237
  end
238
238
  class LShift < Shift
239
- def calculate(lop,rop)
239
+ def calculate(lop, rop)
240
240
  check_rop(rop)
241
241
  lop << rop
242
242
  end
243
243
  end
244
244
  class RShift < Shift
245
- def calculate(lop,rop)
245
+ def calculate(lop, rop)
246
246
  check_rop(rop)
247
247
  lop >> rop
248
248
  end
249
249
  end
250
250
 
251
251
  class Add < Float2
252
- def calculate(lop,rop); lop + rop; end
252
+ def calculate(lop, rop); lop + rop; end
253
253
  end
254
254
  class Minus < Float2
255
- def calculate(lop,rop); lop - rop; end
255
+ def calculate(lop, rop); lop - rop; end
256
256
  end
257
257
  class Mult < Float2
258
- def calculate(lop,rop); lop * rop; end
258
+ def calculate(lop, rop); lop * rop; end
259
259
  end
260
260
  class Div < Float2
261
- def calculate(lop,rop); lop / rop; end
261
+ def calculate(lop, rop); lop / rop; end
262
262
  end
263
263
  class Mod < Integer2
264
- def calculate(lop,rop); lop % rop; end
264
+ def calculate(lop, rop); lop % rop; end
265
265
  end
266
266
  end #of class Operation
267
267
  end #of class Expression
data/lib/ridl/genfile.rb CHANGED
@@ -67,7 +67,7 @@ module IDL
67
67
  class Content
68
68
  def initialize(sections = {})
69
69
  # copy content map transforming all keys to symbols
70
- @sections = sections.inject({}) {|m,(k,v)| m[k.to_sym] = v; m }
70
+ @sections = sections.inject({}) {|m, (k, v)| m[k.to_sym] = v; m }
71
71
  end
72
72
 
73
73
  def sections
@@ -96,7 +96,7 @@ module IDL
96
96
  @path = path
97
97
  @fullpath = File.expand_path(path)
98
98
  @name = File.basename(path)
99
- @ext = File.extname(path).sub(/^\./,'')
99
+ @ext = File.extname(path).sub(/^\./, '')
100
100
  else
101
101
  @path = @fullpath = @name = @ext = ''
102
102
  end
data/lib/ridl/node.rb CHANGED
@@ -19,7 +19,7 @@ module IDL::AST
19
19
  @id = id.to_sym
20
20
  # copy field map transforming all keys to symbols and
21
21
  # detecting nested annotation objects
22
- @fields = fields.inject({}) do |m,(k,v)|
22
+ @fields = fields.inject({}) do |m, (k, v)|
23
23
  m[k.to_sym] = case v
24
24
  when Array
25
25
  v.collect { |ve| Hash === ve ? Annotation.new(*ve.to_a.first) : ve }
@@ -159,8 +159,8 @@ module IDL::AST
159
159
  if id_arr.first == 'IDL'
160
160
  id_arr.shift
161
161
  id_str = id_arr.shift.to_s
162
- raise 'ID identifiers should not start or end with \'/\'' if id_str[0,1]=='/' or id_str[-1, 1]=='/'
163
- raise "ID identifiers should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(id_str[0,1])
162
+ raise 'ID identifiers should not start or end with \'/\'' if id_str[0, 1] == '/' or id_str[-1, 1] == '/'
163
+ raise "ID identifiers should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(id_str[0, 1])
164
164
  raise 'Invalid ID! Only a..z, A..Z, 0..9, \'.\', \'-\', \'_\' or \'\/\' allowed for identifiers' unless REPO_ID_RE =~ id_str
165
165
  end
166
166
  @repo_id = id
@@ -184,8 +184,8 @@ module IDL::AST
184
184
 
185
185
  def prefix=(pfx)
186
186
  unless pfx.to_s.empty?
187
- raise 'ID prefix should not start or end with \'/\'' if pfx[0,1]=='/' or pfx[-1, 1]=='/'
188
- raise "ID prefix should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(pfx[0,1])
187
+ raise 'ID prefix should not start or end with \'/\'' if pfx[0, 1] == '/' or pfx[-1, 1] == '/'
188
+ raise "ID prefix should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(pfx[0, 1])
189
189
  raise 'Invalid ID prefix! Only a..z, A..Z, 0..9, \'.\', \'-\', \'_\' or \'\/\' allowed' unless REPO_ID_RE =~ pfx
190
190
  end
191
191
  self.set_prefix(pfx)
@@ -199,7 +199,7 @@ module IDL::AST
199
199
  if @repo_id.nil?
200
200
  @repo_ver = "1.0" unless @repo_ver
201
201
  format("IDL:%s%s:%s",
202
- if @prefix.empty? then "" else @prefix+"/" end,
202
+ if @prefix.empty? then "" else @prefix + "/" end,
203
203
  self.scopes.collect{|s| s.name}.join("/"),
204
204
  @repo_ver)
205
205
  else
@@ -912,7 +912,7 @@ module IDL::AST
912
912
  # check if the matched name resulted in multiple different nodes or all the same
913
913
  r_one = results.shift
914
914
  unless results.all? {|r| r_one == r || (r_one.class == r.class && r_one.scoped_name == r.scoped_name) }
915
- s = results.inject([r_one]) {|l,r| l << r unless l.include?(r); l }.collect{ |n| n.scoped_name }.join(", ")
915
+ s = results.inject([r_one]) {|l, r| l << r unless l.include?(r); l }.collect{ |n| n.scoped_name }.join(", ")
916
916
  raise "\"#{_name}\" is ambiguous. " + s
917
917
  end
918
918
  end
@@ -1048,13 +1048,13 @@ module IDL::AST
1048
1048
  @resolved_bases
1049
1049
  end
1050
1050
 
1051
- def operations(include_bases=false,traversed=nil)
1051
+ def operations(include_bases=false, traversed=nil)
1052
1052
  ops = @children.find_all { |c| c.is_a?(IDL::AST::Operation) }
1053
1053
  ops.concat(base_operations(traversed || [])) if include_bases
1054
1054
  ops
1055
1055
  end
1056
1056
 
1057
- def attributes(include_bases=false,traversed=nil)
1057
+ def attributes(include_bases=false, traversed=nil)
1058
1058
  atts = @children.find_all { |c| c.is_a?(IDL::AST::Attribute) }
1059
1059
  atts.concat(base_attributes(traversed || [])) if include_bases
1060
1060
  atts
@@ -1338,13 +1338,13 @@ module IDL::AST
1338
1338
  @primarykey = key.node if key
1339
1339
  end
1340
1340
 
1341
- def operations(include_bases=false,traversed=nil)
1341
+ def operations(include_bases=false, traversed=nil)
1342
1342
  ops = @children.find_all { |c| c.is_a?(IDL::AST::Operation) }
1343
1343
  ops.concat(base_operations(traversed || [])) if include_bases
1344
1344
  ops
1345
1345
  end
1346
1346
 
1347
- def attributes(include_bases=false,traversed=nil)
1347
+ def attributes(include_bases=false, traversed=nil)
1348
1348
  atts = @children.find_all { |c| c.is_a?(IDL::AST::Attribute) }
1349
1349
  atts.concat(base_attributes(traversed || [])) if include_bases
1350
1350
  atts
@@ -1393,7 +1393,7 @@ module IDL::AST
1393
1393
  @base = parent.node
1394
1394
  end
1395
1395
 
1396
- def ports(include_bases=false,traversed=nil)
1396
+ def ports(include_bases=false, traversed=nil)
1397
1397
  ports = @children.inject([]) do |lst, c|
1398
1398
  lst.concat(c.ports) if IDL::AST::Port === c
1399
1399
  lst
@@ -1402,7 +1402,7 @@ module IDL::AST
1402
1402
  ports
1403
1403
  end
1404
1404
 
1405
- def attributes(include_bases=false,traversed=nil)
1405
+ def attributes(include_bases=false, traversed=nil)
1406
1406
  atts = @children.inject([]) do |lst, c|
1407
1407
  if IDL::AST::Port === c
1408
1408
  lst.concat(c.attributes)
@@ -1472,7 +1472,7 @@ module IDL::AST
1472
1472
  @base = parent.node
1473
1473
  end
1474
1474
 
1475
- def ports(include_bases=false,traversed=nil)
1475
+ def ports(include_bases=false, traversed=nil)
1476
1476
  ports = @children.inject([]) do |lst, c|
1477
1477
  lst.concat(c.ports) if IDL::AST::Port === c
1478
1478
  lst
@@ -1481,11 +1481,11 @@ module IDL::AST
1481
1481
  ports
1482
1482
  end
1483
1483
 
1484
- def operations(include_bases=false,traversed=nil)
1484
+ def operations(include_bases=false, traversed=nil)
1485
1485
  include_bases ? base_operations(traversed || []) : []
1486
1486
  end
1487
1487
 
1488
- def attributes(include_bases=false,traversed=nil)
1488
+ def attributes(include_bases=false, traversed=nil)
1489
1489
  atts = @children.inject([]) do |lst, c|
1490
1490
  if IDL::AST::Port === c
1491
1491
  lst.concat(c.attributes)
@@ -1556,7 +1556,7 @@ module IDL::AST
1556
1556
  raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
1557
1557
  end
1558
1558
  else
1559
- unless @idltype.is_a?(IDL::Type::NodeType) && (@idltype.is_node?(IDL::AST::Eventtype) || @idltype.is_node?(IDL::AST::TemplateParam))
1559
+ unless @idltype.is_a?(IDL::Type::NodeType) && (@idltype.is_node?(IDL::AST::Eventtype) || @idltype.is_node?(IDL::AST::TemplateParam))
1560
1560
  raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
1561
1561
  end
1562
1562
  end
@@ -1794,7 +1794,7 @@ module IDL::AST
1794
1794
  raise "#{typename} #{scoped_lm_name} cannot inherit from #{tc.node.typename} #{tc.node.scoped_lm_name} multiple times"
1795
1795
  end
1796
1796
  if (not rtc.node.is_abstract?) and @bases.size > 0
1797
- raise "concrete basevalue #{tc.node.typename} #{tc.node.scoped_lm_name} MUST "+
1797
+ raise "concrete basevalue #{tc.node.typename} #{tc.node.scoped_lm_name} MUST " +
1798
1798
  "be first and only non-abstract in inheritance list for #{typename} #{scoped_lm_name}"
1799
1799
  end
1800
1800
  @resolved_bases << rtc.node
@@ -1946,7 +1946,7 @@ module IDL::AST
1946
1946
  @is_recursive = false
1947
1947
  @has_incomplete_type = false
1948
1948
  super(_name, _enclosure)
1949
- @idltype = params[:type]
1949
+ @idltype = params[:type]
1950
1950
  @visibility = (params[:visibility] == :public ? :public : :private)
1951
1951
  unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
1952
1952
  raise "Anonymous type definitions are not allowed!" if params[:type].is_anonymous?
@@ -2112,7 +2112,7 @@ module IDL::AST
2112
2112
  attr_reader :idltype, :expression, :value
2113
2113
  def initialize(_name, _enclosure, params)
2114
2114
  super(_name, _enclosure)
2115
- @idltype = params[:type]
2115
+ @idltype = params[:type]
2116
2116
  @expression = params[:expression]
2117
2117
  @value = nil
2118
2118
  unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
@@ -2158,7 +2158,7 @@ module IDL::AST
2158
2158
  attr_reader :idltype
2159
2159
  def initialize(_name, _enclosure, params)
2160
2160
  super(_name, _enclosure)
2161
- @idltype = params[:type]
2161
+ @idltype = params[:type]
2162
2162
  @attribute = params[:attribute]
2163
2163
  unless ATTRIBUTE_MAP.has_key?(@attribute)
2164
2164
  raise "invalid attribute for parameter: #{params[:attribute]}"
@@ -2210,7 +2210,7 @@ module IDL::AST
2210
2210
 
2211
2211
  def initialize(_name, _enclosure, params)
2212
2212
  super(_name, _enclosure)
2213
- @idltype = params[:type]
2213
+ @idltype = params[:type]
2214
2214
  @oneway = (params[:oneway] == true)
2215
2215
  @in = []
2216
2216
  @out = []
@@ -2322,7 +2322,7 @@ module IDL::AST
2322
2322
  attr_reader :get_raises, :set_raises
2323
2323
  def initialize(_name, _enclosure, params)
2324
2324
  super(_name, _enclosure)
2325
- @idltype = params[:type]
2325
+ @idltype = params[:type]
2326
2326
  @get_raises = []
2327
2327
  @set_raises = []
2328
2328
  unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
@@ -2726,7 +2726,7 @@ module IDL::AST
2726
2726
  attr_reader :idltype, :enum, :value
2727
2727
  def initialize(_name, _enclosure, params)
2728
2728
  super(_name, _enclosure)
2729
- @idltype = IDL::Type::ULong.new
2729
+ @idltype = IDL::Type::ULong.new
2730
2730
  @enum = params[:enum]
2731
2731
  @value = params[:value]
2732
2732
  @enum.add_enumerator(self)
data/lib/ridl/options.rb CHANGED
@@ -124,7 +124,7 @@ module IDL
124
124
  when Array
125
125
  v.collect {|e| _dup_elem(e) }
126
126
  when Hash
127
- v.inject({}) {|h, (k,e)| h[k] = _dup_elem(e); h }
127
+ v.inject({}) {|h, (k, e)| h[k] = _dup_elem(e); h }
128
128
  when OpenStruct
129
129
  v.class.new(_dup_elem(v.__send__(:table)))
130
130
  else
@@ -134,7 +134,7 @@ module IDL
134
134
  key = to_key(spec)
135
135
  @params[key] = { :option_name => key }
136
136
  when Hash
137
- spec.each do |k,v|
137
+ spec.each do |k, v|
138
138
  @params[to_key(k)] = (if Hash === v
139
139
  {
140
140
  :option_name => to_key(v[:option_name] || k),
data/lib/ridl/runner.rb CHANGED
@@ -185,7 +185,7 @@ module IDL
185
185
  @optparser.parse!(argv)
186
186
  rescue ArgumentError => ex
187
187
  IDL.error(ex.inspect)
188
- IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level>0
188
+ IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level > 0
189
189
  return false
190
190
  end
191
191
 
@@ -201,7 +201,7 @@ module IDL
201
201
 
202
202
  input_base = File.basename(argv.first)
203
203
  if input_base != argv.first
204
- options[:xincludepaths] << (File.dirname(argv.first)+'/')
204
+ options[:xincludepaths] << (File.dirname(argv.first) + '/')
205
205
  end
206
206
 
207
207
  return !parse("#include \"#{input_base}\"", options).nil?
@@ -222,7 +222,7 @@ module IDL
222
222
  raise 'cannot read from STDOUT' if $stdout == _fio
223
223
 
224
224
  # parse IDL source
225
- IDL.log(1, "RIDL - parsing #{IO === _idlfile ? 'from STDIN': (StringIO === _idlfile ? 'from string' : _idlfile)}")
225
+ IDL.log(1, "RIDL - parsing #{IO === _idlfile ? 'from STDIN' : (StringIO === _idlfile ? 'from string' : _idlfile)}")
226
226
 
227
227
  unless _parser = parse(_fio, _opts)
228
228
  return false
@@ -248,7 +248,7 @@ module IDL
248
248
  end
249
249
 
250
250
  rescue Backend::ProcessStop
251
- IDL.log(2, "RIDL - processing #{IO === _idlfile ? 'from STDIN': (StringIO === _idlfile ? 'from string' : _idlfile)} stopped with \"#{$!.message}\"")
251
+ IDL.log(2, "RIDL - processing #{IO === _idlfile ? 'from STDIN' : (StringIO === _idlfile ? 'from string' : _idlfile)} stopped with \"#{$!.message}\"")
252
252
 
253
253
  rescue => ex
254
254
  IDL.error(ex)
@@ -310,7 +310,7 @@ module IDL
310
310
  end
311
311
  _arg = _fpath unless _fpath.nil?
312
312
  end
313
- _opts[:xincludepaths] << (File.dirname(_arg)+'/')
313
+ _opts[:xincludepaths] << (File.dirname(_arg) + '/')
314
314
  end
315
315
 
316
316
  _opts[:outputdir] ||= '.'
@@ -329,20 +329,20 @@ module IDL
329
329
  def init_optparser
330
330
  script_name = File.basename($0, '.*')
331
331
  if not script_name =~ /ridlc/
332
- script_name = 'ruby '+$0
332
+ script_name = 'ruby ' + $0
333
333
  end
334
334
 
335
335
  # set up option parser with common options
336
336
  opts = OptionParser.new
337
337
  opts.banner = "Usage: #{script_name} [:backend] [options] [<idlfile> [<idlfile> ...]]\n\n" +
338
- " backend\t\tSpecifies the IDL language mapping backend to use.\n"+
339
- " \t\tDefault = :null\n\n"+
338
+ " backend\t\tSpecifies the IDL language mapping backend to use.\n" +
339
+ " \t\tDefault = :null\n\n" +
340
340
  " Active language mapping = :#{backend.name}"
341
341
  opts.separator ''
342
342
  opts.on('-I PATH', '--include=PATH', String,
343
343
  'Adds include searchpath.',
344
344
  'Default: none') { |v|
345
- self.options[:includepaths] << (v.end_with?('\\','/') ? v : v+'/')
345
+ self.options[:includepaths] << (v.end_with?('\\', '/') ? v : v + '/')
346
346
  }
347
347
  opts.on('-Dmacro=[value]', String, 'defines preprocessor macro') { |v|
348
348
  name, value = v.split('=')
data/lib/ridl/scanner.rb CHANGED
@@ -73,14 +73,14 @@ module IDL
73
73
  @pos.line += 1
74
74
  @pos.column = 1
75
75
  end
76
- else
76
+ else
77
77
  @pos.column += 1
78
78
  end
79
79
 
80
80
  if false
81
81
  if not @bwd.nil? or cur.nil? or @fwd.nil?
82
82
  printf("%c(%02x), %c(%02x), %c(%02x) @(l:%d,c:%d)\n",
83
- @bwd,@bwd,cur,cur,@fwd,@fwd, @pos.line, @pos.column)
83
+ @bwd, @bwd, cur, cur, @fwd, @fwd, @pos.line, @pos.column)
84
84
  end
85
85
  end
86
86
  @bwd = cur
@@ -281,7 +281,7 @@ module IDL
281
281
  end
282
282
  @stack << [:include, @prefix, @ifdef, @in, @ifskip]
283
283
  # record file dir as new searchpath
284
- @xincludepaths << (File.dirname(fpath)+'/')
284
+ @xincludepaths << (File.dirname(fpath) + '/')
285
285
  @prefix = nil
286
286
  @ifdef = Array.new
287
287
  @in = In.new(File.open(fpath, 'r'), fpath)
@@ -299,7 +299,7 @@ module IDL
299
299
  @expansions.include?(define)
300
300
  end
301
301
  def more_source?
302
- @stack.size>0
302
+ @stack.size > 0
303
303
  end
304
304
  def in_expansion?
305
305
  more_source? and @stack.last[0] == :define
@@ -308,7 +308,7 @@ module IDL
308
308
  # make sure to close the input source
309
309
  @in.close
310
310
  # check if we have any previous source still stacked up
311
- if @stack.size>0
311
+ if @stack.size > 0
312
312
  if @stack.last[0] == :include
313
313
  @xincludepaths.pop # remove directory of finished include
314
314
  @directiver.leave_include
@@ -324,7 +324,7 @@ module IDL
324
324
  @ifdef.empty? || @ifdef.last
325
325
  end
326
326
  def positions
327
- @stack.reverse.inject(@in.nil? ? [] : [@in.position]) {|pos_arr,(_, _, _,in_, _)| pos_arr << in_.position }
327
+ @stack.reverse.inject(@in.nil? ? [] : [@in.position]) {|pos_arr, (_, _, _, in_, _)| pos_arr << in_.position }
328
328
  end
329
329
  def parse_error(msg, ex = nil)
330
330
  e = IDL::ParseError.new(msg, positions)
@@ -334,7 +334,7 @@ module IDL
334
334
 
335
335
  LFCR = [ (?\n), (?\r) ]
336
336
  SPACES = [ (?\ ), (?\t) ]
337
- WHITESPACE = SPACES+LFCR
337
+ WHITESPACE = SPACES + LFCR
338
338
 
339
339
  ANNOTATION = ?@
340
340
  ANNOTATION_STR = '@'
@@ -370,7 +370,7 @@ module IDL
370
370
  long manages mirrorport module multiple native Object octet oneway out port porttype primarykey private provides
371
371
  public publishes raises readonly setraises sequence short string struct supports switch TRUE truncatable typedef
372
372
  typeid typename typeprefix unsigned union uses ValueBase valuetype void wchar wstring
373
- ).inject(TokenRegistry.new) { |h,a| h[a.downcase.to_sym] = a; h }
373
+ ).inject(TokenRegistry.new) { |h, a| h[a.downcase.to_sym] = a; h }
374
374
 
375
375
  LITERALS = [
376
376
  :integer_literal,
@@ -760,7 +760,7 @@ module IDL
760
760
 
761
761
  def resolve_define(id, stack = [])
762
762
  return id if %w(true false).include?(id)
763
- IDL.log(3,"*** RIDL - resolve_define(#{id})")
763
+ IDL.log(3, "*** RIDL - resolve_define(#{id})")
764
764
  if @defined.has_key?(id)
765
765
  define_ = @defined[id]
766
766
  stack << id
@@ -773,7 +773,7 @@ module IDL
773
773
  end
774
774
 
775
775
  def eval_directive(s)
776
- IDL.log(3,"** RIDL - eval_directive(#{s})")
776
+ IDL.log(3, "** RIDL - eval_directive(#{s})")
777
777
  rc = eval(s)
778
778
  case rc
779
779
  when FalseClass, TrueClass
@@ -789,7 +789,7 @@ module IDL
789
789
  @in.skipwhile {|c| SPACES.include?(c) }
790
790
  s = getline
791
791
  /^(\w*)\s*/ === s
792
- s1,s2 = $1, $' #'
792
+ s1, s2 = $1, $' #'
793
793
 
794
794
  if /(else|endif|elif)/ === s1
795
795
 
@@ -822,7 +822,7 @@ module IDL
822
822
  else
823
823
  while s2 =~ /(^|[\W])defined\s*\(\s*(\w+)\s*\)/
824
824
  def_id = $2
825
- s2.gsub!(/(^|[\W])(defined\s*\(\s*\w+\s*\))/, '\1'+"#{@defined.has_key?(def_id).to_s}")
825
+ s2.gsub!(/(^|[\W])(defined\s*\(\s*\w+\s*\))/, '\1' + "#{@defined.has_key?(def_id).to_s}")
826
826
  end
827
827
  s2.gsub!(/(^|[\W])([A-Za-z_][\w]*)/) do |_| "#{$1}#{resolve_define($2)}" end
828
828
  begin
@@ -854,10 +854,10 @@ module IDL
854
854
  if do_parse?
855
855
  # match 'defined(Foo)' or 'defined Foo'
856
856
  while s2 =~ /(^|[\W])defined(\s*\(\s*(\w+)\s*\)|\s+(\w+))/
857
- IDL.log(3,"** RIDL - parse_directive : resolving 'defined(#{$3 || $4})'")
857
+ IDL.log(3, "** RIDL - parse_directive : resolving 'defined(#{$3 || $4})'")
858
858
  def_id = $3 || $4
859
859
  # resolve 'defined' expression to 'true' or 'false' according to actual macro definition
860
- s2.gsub!(/(^|[\W])(defined\s*[\s\(]\s*#{def_id}(\s*\))?)/, '\1'+"#{@defined.has_key?(def_id).to_s}")
860
+ s2.gsub!(/(^|[\W])(defined\s*[\s\(]\s*#{def_id}(\s*\))?)/, '\1' + "#{@defined.has_key?(def_id).to_s}")
861
861
  end
862
862
  # match and resolve any macro variables listed in conditional expression
863
863
  s2.gsub!(/(^|[\W])([A-Za-z_][\w]*)/) do |_| "#{$1}#{resolve_define($2)}" end
@@ -897,11 +897,11 @@ module IDL
897
897
  @defined.delete(s2)
898
898
 
899
899
  when 'include'
900
- if s2[0,1] == '"' || s2[0,1] == '<'
901
- quoted_inc = (s2[0,1] == '"')
902
- if s2.size>2
900
+ if s2[0, 1] == '"' || s2[0, 1] == '<'
901
+ quoted_inc = (s2[0, 1] == '"')
902
+ if s2.size > 2
903
903
  s2.strip!
904
- s2 = s2.slice(1..(s2.size-2))
904
+ s2 = s2.slice(1..(s2.size - 2))
905
905
  else
906
906
  s2 = ''
907
907
  end
@@ -941,7 +941,7 @@ module IDL
941
941
  while true
942
942
  ch = @in.getc
943
943
  if ch.nil?
944
- if @ifdef.size>0 and !in_expansion?
944
+ if @ifdef.size > 0 and !in_expansion?
945
945
  parse_error 'mismatched #if/#endif'
946
946
  end
947
947
  if more_source?
data/lib/ridl/type.rb CHANGED
@@ -480,7 +480,7 @@ module IDL
480
480
  0
481
481
  end
482
482
  def max
483
- @node.enumerators.length-1
483
+ @node.enumerators.length - 1
484
484
  end
485
485
  def in_range?(val)
486
486
  val >= self.min && val <= self.max
data/lib/ridl/version.rb CHANGED
@@ -14,7 +14,7 @@ module IDL
14
14
 
15
15
  RIDL_VERSION_MAJOR = 2
16
16
  RIDL_VERSION_MINOR = 8
17
- RIDL_VERSION_RELEASE = 0
17
+ RIDL_VERSION_RELEASE = 1
18
18
  RIDL_VERSION = "#{RIDL_VERSION_MAJOR}.#{RIDL_VERSION_MINOR}.#{RIDL_VERSION_RELEASE}"
19
19
  RIDL_COPYRIGHT = "Copyright (c) 2007-#{Time.now.year} Remedy IT Expertise BV, The Netherlands".freeze
20
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-10-07 00:00:00.000000000 Z
12
+ date: 2021-08-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: OMG v3.3 compliant native Ruby IDL compiler frontend with support for
15
15
  pluggable (and stackable) backends.
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  requirements: []
66
- rubygems_version: 3.1.4
66
+ rubygems_version: 3.1.6
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: Ruby OMG IDL compiler