r2corba 1.5.4 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -2
  3. data/ext/libr2tao/any.cpp +11 -10
  4. data/ext/libr2tao/exception.cpp +6 -8
  5. data/ext/libr2tao/exception.h +1 -1
  6. data/ext/libr2tao/longdouble.cpp +5 -9
  7. data/ext/libr2tao/object.cpp +37 -53
  8. data/ext/libr2tao/orb.cpp +46 -73
  9. data/ext/libr2tao/r2tao_ext.h +8 -19
  10. data/ext/libr2tao/required.cpp +3 -8
  11. data/ext/libr2tao/required.h +18 -34
  12. data/ext/libr2tao/values.cpp +97 -98
  13. data/ext/libr2tao/values.h +35 -37
  14. data/ext/librpoa/iortable.cpp +6 -7
  15. data/ext/librpoa/poa.cpp +29 -32
  16. data/ext/librpoa/servant.cpp +39 -113
  17. data/ext/librpoa/servant.h +18 -40
  18. data/lib/corba/cbase/ORB.rb +26 -23
  19. data/lib/corba/cbase/Request.rb +3 -3
  20. data/lib/corba/cbase/Streams.rb +2 -2
  21. data/lib/corba/cbase/Typecode.rb +6 -6
  22. data/lib/corba/cbase/Values.rb +4 -2
  23. data/lib/corba/cbase/exception.rb +6 -4
  24. data/lib/corba/cbase/poa.rb +1 -1
  25. data/lib/corba/cbase/policies.rb +2 -2
  26. data/lib/corba/cbase/require.rb +8 -1
  27. data/lib/corba/cmds/base.rb +1 -1
  28. data/lib/corba/common/Any.rb +3 -2
  29. data/lib/corba/common/IDL.rb +1 -1
  30. data/lib/corba/common/ORB.rb +22 -22
  31. data/lib/corba/common/Object.rb +14 -14
  32. data/lib/corba/common/Servant.rb +4 -4
  33. data/lib/corba/common/Stub.rb +6 -6
  34. data/lib/corba/common/Typecode.rb +69 -42
  35. data/lib/corba/common/Union.rb +5 -0
  36. data/lib/corba/common/Values.rb +1 -0
  37. data/lib/corba/common/const.rb +2 -2
  38. data/lib/corba/common/exception.rb +2 -1
  39. data/lib/corba/common/version.rb +2 -2
  40. data/lib/corba/idl/IDL.rb +1 -1
  41. data/lib/corba/jbase/Any.rb +28 -26
  42. data/lib/corba/jbase/ORB.rb +5 -5
  43. data/lib/corba/jbase/Object.rb +13 -13
  44. data/lib/corba/jbase/Request.rb +8 -8
  45. data/lib/corba/jbase/Servant.rb +10 -10
  46. data/lib/corba/jbase/ServerRequest.rb +7 -7
  47. data/lib/corba/jbase/Streams.rb +67 -3
  48. data/lib/corba/jbase/Typecode.rb +17 -16
  49. data/lib/corba/jbase/Values.rb +2 -0
  50. data/lib/corba/jbase/exception.rb +2 -1
  51. data/lib/corba/jbase/poa.rb +20 -20
  52. data/lib/corba/jbase/policies.rb +32 -32
  53. data/lib/corba/jbase/require.rb +4 -0
  54. data/lib/corba/poa.rb +1 -1
  55. data/lib/corba/policies.rb +1 -1
  56. data/lib/corba/require.rb +2 -2
  57. data/lib/corba/svcs/ins/cos_naming.rb +37 -28
  58. data/lib/corba/svcs/ins/ins.rb +51 -51
  59. data/lib/corba/svcs/ins/naming_service.rb +8 -8
  60. data/lib/corba.rb +1 -1
  61. data/lib/ridlbe/ruby/config.rb +37 -30
  62. data/lib/ridlbe/ruby/walker.rb +295 -272
  63. data/mkrf_conf_srcgem.rb +6 -6
  64. data/rakelib/bin.rake +1 -1
  65. data/rakelib/bin.rb +3 -3
  66. data/rakelib/build.rake +16 -16
  67. data/rakelib/config.rake +1 -1
  68. data/rakelib/config.rb +22 -22
  69. data/rakelib/ext.rake +7 -68
  70. data/rakelib/ext.rb +15 -15
  71. data/rakelib/ext_r2tao.rb +12 -55
  72. data/rakelib/gem.rake +25 -25
  73. data/rakelib/gem.rb +6 -6
  74. data/rakelib/package.rake +1 -1
  75. data/test/BiDirectional/client.rb +17 -17
  76. data/test/BiDirectional/run_test.rb +11 -11
  77. data/test/BiDirectional/server.rb +24 -25
  78. data/test/CORBA_Services/Naming/BindingIterator/client.rb +17 -17
  79. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +13 -13
  80. data/test/CORBA_Services/Naming/BindingIterator/server.rb +19 -19
  81. data/test/CORBA_Services/Naming/Corbaname/client.rb +15 -15
  82. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +13 -13
  83. data/test/CORBA_Services/Naming/Corbaname/server.rb +30 -30
  84. data/test/CORBA_Services/Naming/Simple/client.rb +16 -16
  85. data/test/CORBA_Services/Naming/Simple/run_test.rb +13 -13
  86. data/test/CORBA_Services/Naming/Simple/server.rb +19 -19
  87. data/test/Collocation/run_test.rb +10 -10
  88. data/test/Collocation/test.rb +27 -20
  89. data/test/Connect_Timeout/client.rb +16 -17
  90. data/test/Connect_Timeout/run_test.rb +10 -10
  91. data/test/DII/client.rb +30 -30
  92. data/test/DII/run_test.rb +11 -11
  93. data/test/DII/server.rb +16 -16
  94. data/test/DSI/client.rb +16 -16
  95. data/test/DSI/run_test.rb +11 -11
  96. data/test/DSI/server.rb +17 -17
  97. data/test/Exceptions/client.rb +21 -21
  98. data/test/Exceptions/run_test.rb +11 -11
  99. data/test/Exceptions/server.rb +16 -16
  100. data/test/Hello/client.rb +16 -16
  101. data/test/Hello/run_test.rb +11 -11
  102. data/test/Hello/server.rb +17 -17
  103. data/test/IDL_Test/client.rb +21 -21
  104. data/test/IDL_Test/run_test.rb +11 -11
  105. data/test/IDL_Test/server.rb +19 -19
  106. data/test/IORMap/client.rb +14 -14
  107. data/test/IORMap/run_test.rb +11 -11
  108. data/test/IORMap/server.rb +26 -26
  109. data/test/IORTable/client.rb +14 -14
  110. data/test/IORTable/run_test.rb +11 -11
  111. data/test/IORTable/server.rb +26 -26
  112. data/test/Implicit_Conversion/client.rb +20 -17
  113. data/test/Implicit_Conversion/run_test.rb +11 -11
  114. data/test/Implicit_Conversion/server.rb +16 -16
  115. data/test/Multi_Threading/Multiple_ORB/client.rb +14 -14
  116. data/test/Multi_Threading/Multiple_ORB/run_test.rb +12 -12
  117. data/test/Multi_Threading/Multiple_ORB/server.rb +17 -17
  118. data/test/Multi_Threading/Simple/client.rb +17 -17
  119. data/test/Multi_Threading/Simple/run_test.rb +11 -11
  120. data/test/Multi_Threading/Simple/server.rb +16 -16
  121. data/test/Multi_Threading/Threads/client.rb +16 -16
  122. data/test/Multi_Threading/Threads/run_test.rb +11 -11
  123. data/test/Multi_Threading/Threads/server.rb +22 -22
  124. data/test/Multi_Threading/Threads/watchdog.rb +16 -16
  125. data/test/Multiple_Servant_Interfaces/client.rb +14 -14
  126. data/test/Multiple_Servant_Interfaces/run_test.rb +11 -11
  127. data/test/Multiple_Servant_Interfaces/server.rb +18 -18
  128. data/test/Nil/run_test.rb +10 -10
  129. data/test/Nil/test.rb +14 -15
  130. data/test/OBV/AbstractInterface/client.rb +14 -14
  131. data/test/OBV/AbstractInterface/run_test.rb +11 -11
  132. data/test/OBV/AbstractInterface/server.rb +20 -19
  133. data/test/OBV/Custom/OBV_impl.rb +2 -0
  134. data/test/OBV/Custom/client.rb +14 -14
  135. data/test/OBV/Custom/run_test.rb +11 -11
  136. data/test/OBV/Custom/server.rb +16 -16
  137. data/test/OBV/Simple/OBV_impl.rb +1 -0
  138. data/test/OBV/Simple/client.rb +14 -14
  139. data/test/OBV/Simple/run_test.rb +11 -11
  140. data/test/OBV/Simple/server.rb +16 -16
  141. data/test/OBV/Simple_Event/Event_impl.rb +1 -0
  142. data/test/OBV/Simple_Event/client.rb +14 -14
  143. data/test/OBV/Simple_Event/run_test.rb +11 -11
  144. data/test/OBV/Simple_Event/server.rb +16 -16
  145. data/test/OBV/Supports/client.rb +19 -19
  146. data/test/OBV/Supports/run_test.rb +11 -11
  147. data/test/OBV/Supports/server.rb +15 -15
  148. data/test/OBV/Supports/supports_impl.rb +3 -0
  149. data/test/OBV/Tree/client.rb +14 -14
  150. data/test/OBV/Tree/run_test.rb +11 -11
  151. data/test/OBV/Tree/server.rb +19 -19
  152. data/test/OBV/Truncatable/Truncatable_impl.rb +1 -1
  153. data/test/OBV/Truncatable/client.rb +57 -57
  154. data/test/OBV/Truncatable/run_test.rb +11 -11
  155. data/test/OBV/Truncatable/server.rb +15 -15
  156. data/test/OBV/ValueBox/client.rb +154 -153
  157. data/test/OBV/ValueBox/run_test.rb +11 -11
  158. data/test/OBV/ValueBox/server.rb +42 -42
  159. data/test/Object/client.rb +15 -15
  160. data/test/Object/run_test.rb +11 -11
  161. data/test/Object/server.rb +19 -19
  162. data/test/POA/run_test.rb +10 -10
  163. data/test/POA/test.rb +16 -16
  164. data/test/Param_Test/client.rb +51 -51
  165. data/test/Param_Test/run_test.rb +11 -11
  166. data/test/Param_Test/server.rb +59 -59
  167. data/test/Performance/Simple/client.rb +16 -16
  168. data/test/Performance/Simple/run_test.rb +11 -11
  169. data/test/Performance/Simple/server.rb +16 -16
  170. data/test/Policies/run_test.rb +10 -10
  171. data/test/Policies/test.rb +23 -24
  172. data/test/Timeout/client.rb +21 -21
  173. data/test/Timeout/run_test.rb +11 -11
  174. data/test/Timeout/server.rb +22 -22
  175. data/test/lib/assert.rb +0 -1
  176. data/test/lib/test.rb +28 -23
  177. data/test/test_runner.rb +21 -22
  178. metadata +6 -9
  179. data/ext/extload/extload.c +0 -60
  180. data/ext/librpoa/srvreq_fix.cpp +0 -282
  181. data/ext/librpoa/srvreq_fix.h +0 -148
@@ -11,7 +11,7 @@
11
11
  #--------------------------------------------------------------------
12
12
  module IDL
13
13
  class RubyWriterBase
14
- def initialize(output = STDOUT, params = {}, indent = " ")
14
+ def initialize(output = STDOUT, params = {}, indent = ' ')
15
15
  @output = output
16
16
  @params = params
17
17
  @indent = indent
@@ -19,12 +19,17 @@ module IDL
19
19
  end
20
20
 
21
21
  def print(str); @output << str; end
22
- def println(str=""); @output << str << "\n"; end
23
- def printi(str=""); @output << indent() << str; end
24
- def printiln(str=""); @output << indent() << str << "\n"; end
22
+
23
+ def println(str = ''); @output << str << "\n"; end
24
+
25
+ def printi(str = ''); @output << indent() << str; end
26
+
27
+ def printiln(str = ''); @output << indent() << str << "\n"; end
28
+
25
29
  def indent()
26
30
  @indent * @nest
27
31
  end
32
+
28
33
  def nest(in_ = 1)
29
34
  @nest += in_
30
35
  begin
@@ -44,7 +49,7 @@ module IDL
44
49
  end
45
50
 
46
51
  class RubyStubWriter < RubyWriterBase
47
- def initialize(output = STDOUT, params = {}, indent = " ")
52
+ def initialize(output = STDOUT, params = {}, indent = ' ')
48
53
  super
49
54
  end
50
55
 
@@ -75,16 +80,16 @@ module IDL
75
80
  printiln("} ## end of '#{@params[:idlfile]}'")
76
81
  end
77
82
  leave_module(parser.root_namespace) unless parser.root_namespace.nil?
78
- println("# -*- END -*-")
83
+ println('# -*- END -*-')
79
84
  end
80
85
 
81
86
  def visit_include(node)
82
- printiln(format("require '%s'", node.filename.sub(/\.[^\.]*$/,@params[:stub_pfx])))
87
+ printiln(format("require '%s'", node.filename.sub(/\.[^\.]*$/, @params[:stub_pfx])))
83
88
  println()
84
89
  end
85
90
 
86
91
  def enter_include(node)
87
- printiln("## include")
92
+ printiln('## include')
88
93
  printiln("CORBA.implement('#{node.filename}', {}, CORBA::IDL::CLIENT_STUB) {")
89
94
  println()
90
95
  end
@@ -96,10 +101,11 @@ module IDL
96
101
  end
97
102
 
98
103
  def enter_module(node)
99
- printiln("module " + node.rubyname)
104
+ printiln('module ' + node.rubyname)
100
105
  println()
101
106
  @nest += 1
102
107
  end
108
+
103
109
  def leave_module(node)
104
110
  @nest -= 1
105
111
  printiln("end #of module #{node.rubyname}")
@@ -114,6 +120,7 @@ module IDL
114
120
  printiln("module #{name}; end ## interface forward")
115
121
  end
116
122
  end
123
+
117
124
  def enter_interface(node)
118
125
  println
119
126
  name = node.rubyname
@@ -133,7 +140,7 @@ module IDL
133
140
  println()
134
141
  @nest += 1
135
142
 
136
- if node.bases.size>0
143
+ if node.bases.size > 0
137
144
  node.bases.each do |n|
138
145
  printiln("include #{n.scoped_rubyname}")
139
146
  end
@@ -141,18 +148,18 @@ module IDL
141
148
  end
142
149
 
143
150
  printiln(format("Id = '%s'.freeze", node.repository_id))
144
- printi("Ids = [ Id")
151
+ printi('Ids = [ Id')
145
152
  if node.is_abstract?
146
- println(",")
153
+ println(',')
147
154
  printi(" 'IDL:omg.org/CORBA/AbstractBase:1.0'")
148
155
  end
149
- if node.bases.size>0
156
+ if node.bases.size > 0
150
157
  node.bases.each do |n|
151
- println(",")
158
+ println(',')
152
159
  printi(" #{n.scoped_rubyname}::Id")
153
160
  end
154
161
  end
155
- println(" ].freeze")
162
+ println(' ].freeze')
156
163
 
157
164
  println
158
165
  unless node.is_abstract?
@@ -162,39 +169,40 @@ module IDL
162
169
  printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::AbstractInterface.new(Id, '%s', self); end",
163
170
  node.rubyname, node.rubyname, node.rubyname))
164
171
  end
165
- printiln("self._tc # register typecode");
172
+ printiln('self._tc # register typecode');
166
173
 
167
174
  println
168
175
  printiln("def #{name}._narrow(obj)")
169
176
  nest {
170
177
  printiln('return nil if CORBA.is_nil(obj)')
171
178
  if node.is_local?
172
- printiln("return CORBA::Stub.create_stub(obj)._unchecked_narrow!(self)")
179
+ printiln('return CORBA::Stub.create_stub(obj)._unchecked_narrow!(self)')
173
180
  else
174
- printiln("return CORBA::Stub.create_stub(obj)._narrow!(self)")
181
+ printiln('return CORBA::Stub.create_stub(obj)._narrow!(self)')
175
182
  end
176
183
  }
177
- printiln("end")
184
+ printiln('end')
178
185
  println
179
186
  printiln("def #{name}._duplicate(obj)")
180
187
  nest {
181
188
  if node.is_local?
182
- printiln("obj");
189
+ printiln('obj');
183
190
  else
184
191
  printiln('return nil if CORBA.is_nil(obj)')
185
- printiln("return CORBA::Stub.create_stub(super(obj))._narrow!(self)")
192
+ printiln('return CORBA::Stub.create_stub(super(obj))._narrow!(self)')
186
193
  end
187
194
  }
188
- printiln("end")
195
+ printiln('end')
189
196
  println
190
- printiln("def _interface_repository_id")
197
+ printiln('def _interface_repository_id')
191
198
  nest {
192
199
  printiln("#{node.scoped_rubyname}::Id")
193
200
  }
194
- printiln("end")
201
+ printiln('end')
195
202
  end
196
203
  println
197
204
  end
205
+
198
206
  def leave_interface(node)
199
207
  name = node.rubyname
200
208
  @nest -= 1
@@ -218,11 +226,11 @@ module IDL
218
226
  end
219
227
  state_members_ = node.state_members
220
228
  unless state_members_.empty?
221
- pfx = "["
229
+ pfx = '['
222
230
  state_members_.each do |m|
223
- println(",")
231
+ println(',')
224
232
  printi(pfx)
225
- pfx = ""
233
+ pfx = ''
226
234
  if m.has_incomplete_type?
227
235
  print("['#{m.rubyname}', ")
228
236
  print_valuetype_typecode(m.idltype.resolved_type.node)
@@ -235,9 +243,9 @@ module IDL
235
243
  print(format("['%s', %s, :%s]", m.rubyname, get_typecode(m.idltype), m.visibility))
236
244
  end
237
245
  end
238
- print("], self)")
246
+ print('], self)')
239
247
  else
240
- print(", self)")
248
+ print(', self)')
241
249
  end
242
250
  }
243
251
  end
@@ -246,6 +254,7 @@ module IDL
246
254
 
247
255
  def declare_valuetype(node)
248
256
  end
257
+
249
258
  def enter_valuetype(node)
250
259
  println()
251
260
  name = node.rubyname
@@ -258,12 +267,12 @@ module IDL
258
267
 
259
268
  unless node.is_abstract?
260
269
  if node.is_custom?
261
- printiln("include CORBA::Portable::CustomValueBase")
270
+ printiln('include CORBA::Portable::CustomValueBase')
262
271
  else
263
- printiln("include CORBA::ValueBase")
272
+ printiln('include CORBA::ValueBase')
264
273
  end
265
274
  else
266
- printiln("include CORBA::AbstractValueBase")
275
+ printiln('include CORBA::AbstractValueBase')
267
276
  end
268
277
 
269
278
  unless node.is_abstract?
@@ -274,28 +283,28 @@ module IDL
274
283
  unless trunc_ids.empty?
275
284
  nest {
276
285
  trunc_ids.each do |trunc_id|
277
- println(",")
286
+ println(',')
278
287
  printi("'#{trunc_id}'")
279
288
  end
280
289
  }
281
290
  end
282
- println(" ].freeze")
291
+ println(' ].freeze')
283
292
  end
284
293
 
285
294
  println()
286
- printiln(format("def %s._tc", node.rubyname))
295
+ printiln(format('def %s._tc', node.rubyname))
287
296
  nest {
288
297
  printi("@@tc_#{node.rubyname} ||= ")
289
298
  print_valuetype_typecode(node)
290
299
  println()
291
300
  }
292
- printiln("end")
293
- printiln("self._tc # register typecode")
301
+ printiln('end')
302
+ printiln('self._tc # register typecode')
294
303
  end
295
304
 
296
305
  def leave_valuetype(node)
297
306
  println()
298
- printiln("module Intf")
307
+ printiln('module Intf')
299
308
  nest {
300
309
  intfs_ = node.interfaces
301
310
  unless intfs_.empty?
@@ -303,7 +312,7 @@ module IDL
303
312
  intfs_.each do |intf|
304
313
  printiln("include #{intf.scoped_rubyname}")
305
314
  end
306
- printiln("undef :_interface_repository_id")
315
+ printiln('undef :_interface_repository_id')
307
316
  end
308
317
 
309
318
  bases_ = Array.new(node.bases)
@@ -347,7 +356,7 @@ module IDL
347
356
  state_members_.each do |m|
348
357
  if m.visibility == :public
349
358
  printiln('## public value state') unless has_type
350
- printiln(format("attr_accessor :%s", m.rubyname))
359
+ printiln(format('attr_accessor :%s', m.rubyname))
351
360
  has_type = true
352
361
  end
353
362
  end
@@ -359,7 +368,7 @@ module IDL
359
368
  printiln('## private value state')
360
369
  printiln('protected')
361
370
  end
362
- printiln(format("attr_accessor :%s", m.rubyname))
371
+ printiln(format('attr_accessor :%s', m.rubyname))
363
372
  has_type = true
364
373
  end
365
374
  end
@@ -440,11 +449,11 @@ module IDL
440
449
  if initializers.empty?
441
450
  unless node.has_operations_or_attributes?(false)
442
451
  # valuetype has only state, create the default factory
443
- printiln("def _create_default")
452
+ printiln('def _create_default')
444
453
  nest {
445
454
  printiln("#{node.scoped_rubyname}.new")
446
455
  }
447
- printiln("end")
456
+ printiln('end')
448
457
  end
449
458
  else
450
459
  println()
@@ -453,7 +462,7 @@ module IDL
453
462
  nest {
454
463
  printiln("raise RuntimeError, 'unimplemented local operation called'")
455
464
  }
456
- printiln("end")
465
+ printiln('end')
457
466
  end
458
467
  end
459
468
  }
@@ -470,28 +479,28 @@ module IDL
470
479
  println()
471
480
  printiln("TRUNCATABLE_IDS = [ '#{node.repository_id}' ].freeze")
472
481
  println()
473
- printiln(format("def %s._tc", node.rubyname))
482
+ printiln(format('def %s._tc', node.rubyname))
474
483
  nest {
475
484
  printiln(format("@@tc_%s ||= CORBA::TypeCode::Valuebox.new('%s'.freeze, '%s',",
476
485
  node.rubyname, node.repository_id, node.rubyname))
477
486
  printiln(" #{get_typecode(node.boxed_type)}, self)")
478
487
  }
479
- printiln("end")
480
- printiln("self._tc # register typecode");
481
- printiln("attr_accessor :value")
482
- printiln("def initialize(val = nil); @value = val; end")
488
+ printiln('end')
489
+ printiln('self._tc # register typecode');
490
+ printiln('attr_accessor :value')
491
+ printiln('def initialize(val = nil); @value = val; end')
483
492
  }
484
493
  printiln("end #of valuebox #{name}")
485
494
  println
486
495
  end
487
496
 
488
497
  def visit_const(node)
489
- #v = Expression::Value.new(node.idltype, node.value)
490
- s = node.rubyname + " = " + expression_to_s(node.expression)
498
+ # v = Expression::Value.new(node.idltype, node.value)
499
+ s = node.rubyname + ' = ' + expression_to_s(node.expression)
491
500
  printiln(s)
492
501
  end
493
502
 
494
- def visit_operation(node, from_valuetype=false)
503
+ def visit_operation(node, from_valuetype = false)
495
504
  _parm = node.params
496
505
  _in = node.in_params
497
506
  _out = node.out_params
@@ -499,27 +508,27 @@ module IDL
499
508
 
500
509
  println()
501
510
  printi("def #{node.rubyname}(")
502
- print( _in.collect{ |p| p.rubyname }.join(", ") )
511
+ print(_in.collect{ |p| p.rubyname }.join(', '))
503
512
  if node.oneway
504
- println(") # oneway")
513
+ println(') # oneway')
505
514
  else
506
- println(")")
515
+ println(')')
507
516
  end
508
517
 
509
518
  nest do
510
519
  if _intf.is_a?(IDL::AST::Valuetype) or from_valuetype
511
520
  printiln("raise RuntimeError, 'unimplemented local operation called'")
512
521
  elsif _intf.is_local?
513
- printiln("raise ::CORBA::NO_IMPLEMENT.new(")
522
+ printiln('raise ::CORBA::NO_IMPLEMENT.new(')
514
523
  printiln(" 'unimplemented operation on local interface',")
515
- printiln(" 1, ::CORBA::COMPLETED_NO)")
524
+ printiln(' 1, ::CORBA::COMPLETED_NO)')
516
525
  else
517
526
  ## check if this is a proper object reference
518
527
  printiln('raise ::CORBA::NO_IMPLEMENT unless self.respond_to?(:_invoke, true)')
519
528
 
520
529
  ## validate data for IN/INOUT args
521
530
  ##
522
- if _parm.size>0
531
+ if _parm.size > 0
523
532
  _parm.each do |p|
524
533
  if p.attribute != IDL::AST::Parameter::OUT
525
534
  printiln("#{p.rubyname} = #{get_typecode(p.idltype)}.validate(#{p.rubyname})")
@@ -535,13 +544,13 @@ module IDL
535
544
  printi("self._invoke('#{node.name}', {")
536
545
  end
537
546
 
538
- newln = ""
539
- if _parm.size>0
547
+ newln = ''
548
+ if _parm.size > 0
540
549
  println(newln)
541
550
  nest do
542
- printi(":arg_list => [")
551
+ printi(':arg_list => [')
543
552
  nest {
544
- pfx = ""
553
+ pfx = ''
545
554
  _parm.each do |p|
546
555
  println(pfx)
547
556
  printi("['#{p.rubyname}', #{get_arg_type(p.attribute)}, ");
@@ -549,39 +558,39 @@ module IDL
549
558
  if p.attribute != IDL::AST::Parameter::OUT
550
559
  print(", #{p.rubyname}]")
551
560
  else
552
- print("]")
561
+ print(']')
553
562
  end
554
- pfx = ","
563
+ pfx = ','
555
564
  end
556
- print("]")
565
+ print(']')
557
566
  }
558
567
  end
559
- newln = ","
568
+ newln = ','
560
569
  end
561
570
 
562
571
  if not node.oneway
563
572
  println(newln)
564
573
  nest { printi(":result_type => #{get_typecode(node.idltype)}") }
565
- newln = ","
574
+ newln = ','
566
575
  end
567
576
 
568
- if node.raises.size>0
577
+ if node.raises.size > 0
569
578
  println(newln)
570
579
  nest {
571
- printi(":exc_list => [")
572
- pfx = ""
580
+ printi(':exc_list => [')
581
+ pfx = ''
573
582
  nest {
574
583
  node.raises.each { |ex|
575
584
  println(pfx)
576
- pfx = ","
585
+ pfx = ','
577
586
  printi(get_typecode(ex))
578
587
  }
579
- print("]")
588
+ print(']')
580
589
  }
581
590
  }
582
591
  end
583
592
 
584
- println("})")
593
+ println('})')
585
594
 
586
595
  if not node.oneway
587
596
  returns_void = (node.idltype.is_a? Type::Void)
@@ -595,7 +604,7 @@ module IDL
595
604
  printiln("end #of operation #{node.rubyname}")
596
605
  end
597
606
 
598
- def visit_attribute(node, from_valuetype=false)
607
+ def visit_attribute(node, from_valuetype = false)
599
608
  _intf = node.enclosure
600
609
  println()
601
610
  printiln("def #{node.rubyname}()")
@@ -603,31 +612,31 @@ module IDL
603
612
  if _intf.is_a?(IDL::AST::Valuetype) or from_valuetype
604
613
  printiln("@#{node.name}")
605
614
  elsif _intf.is_local?
606
- printiln("raise ::CORBA::NO_IMPLEMENT.new(")
615
+ printiln('raise ::CORBA::NO_IMPLEMENT.new(')
607
616
  printiln(" 'unimplemented attribute on local interface',")
608
- printiln(" 1, ::CORBA::COMPLETED_NO)")
617
+ printiln(' 1, ::CORBA::COMPLETED_NO)')
609
618
  else
610
619
  ## check if this is a proper object reference
611
620
  printiln('raise ::CORBA::NO_IMPLEMENT unless self.respond_to?(:_invoke, true)')
612
621
 
613
622
  printiln("_ret = self._invoke('_get_#{node.name}', {")
614
623
  nest { printi(":result_type => #{get_typecode(node.idltype)}") }
615
- if node.get_raises.size>0
624
+ if node.get_raises.size > 0
616
625
  println(',')
617
626
  nest {
618
- printi(":exc_list => [")
619
- pfx = ""
627
+ printi(':exc_list => [')
628
+ pfx = ''
620
629
  nest {
621
630
  node.get_raises.each { |ex|
622
631
  println(pfx)
623
- pfx = ","
632
+ pfx = ','
624
633
  printi(get_typecode(ex))
625
634
  }
626
- print("]")
635
+ print(']')
627
636
  }
628
637
  }
629
638
  end
630
- println("})")
639
+ println('})')
631
640
 
632
641
  printiln('_ret')
633
642
  end
@@ -639,9 +648,9 @@ module IDL
639
648
  if _intf.is_a?(IDL::AST::Valuetype) or from_valuetype
640
649
  printiln("@#{node.name} = val")
641
650
  elsif _intf.is_local?
642
- printiln("raise ::CORBA::NO_IMPLEMENT.new(")
651
+ printiln('raise ::CORBA::NO_IMPLEMENT.new(')
643
652
  printiln(" 'unimplemented attribute on local interface',")
644
- printiln(" 1, ::CORBA::COMPLETED_NO)")
653
+ printiln(' 1, ::CORBA::COMPLETED_NO)')
645
654
  else
646
655
  ## check if this is a proper object reference
647
656
  printiln('raise ::CORBA::NO_IMPLEMENT unless self.respond_to?(:_invoke, true)')
@@ -651,25 +660,25 @@ module IDL
651
660
  ## invoke operation
652
661
  printiln("self._invoke('_set_#{node.name}', {")
653
662
  nest {
654
- printiln(":arg_list => [")
663
+ printiln(':arg_list => [')
655
664
  nest {
656
665
  printiln("['val', CORBA::ARG_IN, #{get_typecode(node.idltype)}, val]],");
657
666
  }
658
- printi(":result_type => CORBA._tc_void")
659
- if node.set_raises.size>0
667
+ printi(':result_type => CORBA._tc_void')
668
+ if node.set_raises.size > 0
660
669
  println(',')
661
- printi(":exc_list => [")
662
- pfx = ""
670
+ printi(':exc_list => [')
671
+ pfx = ''
663
672
  nest {
664
673
  node.set_raises.each { |ex|
665
674
  println(pfx)
666
- pfx = ","
675
+ pfx = ','
667
676
  printi(get_typecode(ex))
668
677
  }
669
- print("]")
678
+ print(']')
670
679
  }
671
680
  end
672
- println("})")
681
+ println('})')
673
682
  }
674
683
  end
675
684
  end
@@ -686,55 +695,55 @@ module IDL
686
695
  Type::Boolean, Type::Char, Type::WChar,
687
696
  Type::Float, Type::Double, Type::LongDouble,
688
697
  Type::Void, Type::Any
689
- s = _type.class.name.split("::") # IDL::Type::Octet -> [IDL, Type, Octet]
698
+ s = _type.class.name.split('::') # IDL::Type::Octet -> [IDL, Type, Octet]
690
699
  s = s[s.length - 1]
691
700
  s.downcase!
692
- format("CORBA._tc_%s",s)
701
+ format('CORBA._tc_%s', s)
693
702
 
694
703
  when Type::Object
695
- "CORBA._tc_Object"
704
+ 'CORBA._tc_Object'
696
705
 
697
706
  when Type::String
698
707
  if not _type.length.nil?
699
- format("CORBA::TypeCode::String.new(%d)", _type.length)
708
+ format('CORBA::TypeCode::String.new(%d)', _type.length)
700
709
  else
701
- "CORBA._tc_string"
710
+ 'CORBA._tc_string'
702
711
  end
703
712
 
704
713
  when Type::WString
705
714
  if not _type.length.nil?
706
- format("CORBA::TypeCode::WString.new(%d)", _type.length)
715
+ format('CORBA::TypeCode::WString.new(%d)', _type.length)
707
716
  else
708
- "CORBA._tc_wstring"
717
+ 'CORBA._tc_wstring'
709
718
  end
710
719
 
711
720
  when Type::ScopedName
712
721
  scoped_type = _type.node.idltype
713
722
  if scoped_type.is_a?(IDL::Type::Interface) && scoped_type.node.is_forward?()
714
723
  node = scoped_type.node
715
- "(CORBA::TypeCode.typecode_for_id('#{node.repository_id}') || "+
724
+ "(CORBA::TypeCode.typecode_for_id('#{node.repository_id}') || " +
716
725
  "CORBA::TypeCode::ObjectRef.new('#{node.repository_id}', '#{node.rubyname}', #{node.scoped_rubyname}))"
717
726
  else
718
727
  _type.node.scoped_rubyname + '._tc'
719
728
  end
720
729
 
721
730
  when Type::Array
722
- sep = ""
723
- tc = "CORBA::TypeCode::Array.new(" +
724
- get_typecode(_type.basetype) + ", "
731
+ sep = ''
732
+ tc = 'CORBA::TypeCode::Array.new(' +
733
+ get_typecode(_type.basetype) + ', '
725
734
  _type.sizes.each do |sz|
726
735
  tc += "#{sep}#{sz.to_s}"
727
- sep = ", "
736
+ sep = ', '
728
737
  end
729
- tc + ")"
738
+ tc + ')'
730
739
 
731
740
  when Type::Sequence
732
741
  if _type.is_recursive?
733
742
  "CORBA::TypeCode::Sequence.new(CORBA::TypeCode::Recursive.new('#{_type.basetype.resolved_type.node.repository_id}'))"
734
743
  else
735
- "CORBA::TypeCode::Sequence.new(" +
744
+ 'CORBA::TypeCode::Sequence.new(' +
736
745
  get_typecode(_type.basetype) +
737
- if not _type.length.nil? then format(", %d)", _type.length) else ")" end
746
+ if not _type.length.nil? then format(', %d)', _type.length) else ')' end
738
747
  end
739
748
 
740
749
  else
@@ -745,11 +754,11 @@ module IDL
745
754
  def get_arg_type(_idl_argtype)
746
755
  case _idl_argtype
747
756
  when IDL::AST::Parameter::IN
748
- "CORBA::ARG_IN"
757
+ 'CORBA::ARG_IN'
749
758
  when IDL::AST::Parameter::OUT
750
- "CORBA::ARG_OUT"
759
+ 'CORBA::ARG_OUT'
751
760
  else
752
- "CORBA::ARG_INOUT"
761
+ 'CORBA::ARG_INOUT'
753
762
  end
754
763
  end
755
764
 
@@ -771,7 +780,7 @@ module IDL
771
780
  v = exp.value
772
781
  case exp.idltype
773
782
  when Type::Void
774
- s = "nil"
783
+ s = 'nil'
775
784
  when Type::Char
776
785
  s = "'#{v.chr}'"
777
786
  when Type::Integer,
@@ -813,9 +822,9 @@ module IDL
813
822
  end
814
823
  end).compact
815
824
  s = "[#{v.join(',')}]"
816
- #when Type::Fixed
817
- #when Type::Any
818
- #when Type::Object
825
+ # when Type::Fixed
826
+ # when Type::Any
827
+ # when Type::Object
819
828
  when Type::ScopedName
820
829
  s = value_to_s(Expression::Value.new(exp.idltype.node.idltype, v))
821
830
  else
@@ -831,69 +840,71 @@ module IDL
831
840
  when Expression::Operation::UnaryPlus
832
841
  s = expression_to_s(op[0])
833
842
  when Expression::Operation::UnaryMinus
834
- s = "-" + expression_to_s(op[0])
843
+ s = '-' + expression_to_s(op[0])
835
844
  when Expression::Operation::UnaryNot
836
- s = "~" + expression_to_s(op[0])
845
+ s = '~' + expression_to_s(op[0])
837
846
  when Expression::Operation::Or
838
- s = expression_to_s(op[0]) + " | " + expression_to_s(op[1])
847
+ s = expression_to_s(op[0]) + ' | ' + expression_to_s(op[1])
839
848
  when Expression::Operation::And
840
- s = expression_to_s(op[0]) + " & " + expression_to_s(op[1])
849
+ s = expression_to_s(op[0]) + ' & ' + expression_to_s(op[1])
841
850
  when Expression::Operation::LShift
842
- s = expression_to_s(op[0]) + " << " + expression_to_s(op[1])
851
+ s = expression_to_s(op[0]) + ' << ' + expression_to_s(op[1])
843
852
  when Expression::Operation::RShift
844
- s = expression_to_s(op[0]) + " >> " + expression_to_s(op[1])
853
+ s = expression_to_s(op[0]) + ' >> ' + expression_to_s(op[1])
845
854
  when Expression::Operation::Add
846
- s = expression_to_s(op[0]) + " + " + expression_to_s(op[1])
855
+ s = expression_to_s(op[0]) + ' + ' + expression_to_s(op[1])
847
856
  when Expression::Operation::Minus
848
- s = expression_to_s(op[0]) + " - " + expression_to_s(op[1])
857
+ s = expression_to_s(op[0]) + ' - ' + expression_to_s(op[1])
849
858
  when Expression::Operation::Mult
850
- s = expression_to_s(op[0]) + " * " + expression_to_s(op[1])
859
+ s = expression_to_s(op[0]) + ' * ' + expression_to_s(op[1])
851
860
  when Expression::Operation::Div
852
- s = expression_to_s(op[0]) + " / " + expression_to_s(op[1])
861
+ s = expression_to_s(op[0]) + ' / ' + expression_to_s(op[1])
853
862
  when Expression::Operation::Mod
854
- s = expression_to_s(op[0]) + " % " + expression_to_s(op[1])
863
+ s = expression_to_s(op[0]) + ' % ' + expression_to_s(op[1])
855
864
  else
856
865
  raise "unknown operation: #{exp.type.name}"
857
866
  end
858
- "(" + s + ")"
867
+ '(' + s + ')'
859
868
  end
860
869
 
861
870
  def declare_struct(node)
862
871
  end
872
+
863
873
  def enter_struct(node)
864
874
  println()
865
875
  name = node.rubyname
866
876
  printiln("class #{name} < CORBA::Portable::Struct")
867
877
  @nest += 1
868
878
  end
879
+
869
880
  def leave_struct(node)
870
- tc_ = if node.is_a? IDL::AST::Exception then "Except" else "Struct" end
881
+ tc_ = if node.is_a? IDL::AST::Exception then 'Except' else 'Struct' end
871
882
  println()
872
- printiln(format("def %s._tc", node.rubyname))
883
+ printiln(format('def %s._tc', node.rubyname))
873
884
  struct_members_ = node.members
874
885
  nest {
875
886
  printi(format("@@tc_%s ||= CORBA::TypeCode::%s.new('%s'.freeze, '%s'",
876
887
  node.rubyname, tc_, node.repository_id, node.rubyname))
877
888
  unless struct_members_.empty?
878
- pfx = " ["
889
+ pfx = ' ['
879
890
  struct_members_.each do |m|
880
- println(",")
891
+ println(',')
881
892
  printi(pfx)
882
- pfx = " "
893
+ pfx = ' '
883
894
  print(format("['%s', %s]", m.rubyname, get_typecode(m.idltype)))
884
895
  end
885
- println("], self)")
896
+ println('], self)')
886
897
  else
887
- println(", self)")
898
+ println(', self)')
888
899
  end
889
900
  }
890
- printiln("end")
891
- printiln("self._tc # register typecode");
901
+ printiln('end')
902
+ printiln('self._tc # register typecode');
892
903
  struct_members_.each do |m|
893
- printiln(format("attr_accessor :%s", m.rubyname))
904
+ printiln(format('attr_accessor :%s', m.rubyname))
894
905
  end
895
906
 
896
- if struct_members_.size>0
907
+ if struct_members_.size > 0
897
908
  printiln('def initialize(*param_)')
898
909
  nest {
899
910
  struct_members_.each do |m|
@@ -915,39 +926,42 @@ module IDL
915
926
  printiln("class #{name} < CORBA::UserException")
916
927
  @nest += 1
917
928
  end
929
+
918
930
  def leave_exception(node)
919
931
  leave_struct(node)
920
932
  end
921
933
 
922
934
  def declare_union(node)
923
935
  end
936
+
924
937
  def enter_union(node)
925
938
  println()
926
939
  name = node.rubyname
927
940
  printiln("class #{name} < CORBA::Portable::Union")
928
941
  @nest += 1
929
942
  end
943
+
930
944
  def leave_union(node)
931
945
  println()
932
- printiln(format("def %s._tc", node.rubyname))
946
+ printiln(format('def %s._tc', node.rubyname))
933
947
  nest {
934
948
  printiln(format("@@tc_%s ||= CORBA::TypeCode::Union.new('%s'.freeze, '%s',",
935
949
  node.rubyname, node.repository_id, node.rubyname))
936
950
  printi(" #{get_typecode(node.switchtype)}")
937
- if node.members.size>0
938
- pfx = " ["
951
+ if node.members.size > 0
952
+ pfx = ' ['
939
953
  node.members.each do |m|
940
954
  m.labels.each do |lbl|
941
- println(",")
955
+ println(',')
942
956
  printi(pfx)
943
- pfx = " "
957
+ pfx = ' '
944
958
  labeltxt = if lbl == :default then ':default'; else expression_to_s(lbl); end
945
959
  print(format("[%s, '%s', %s]", labeltxt, m.rubyname, get_typecode(m.idltype)))
946
960
  end
947
961
  end
948
- print("], self")
962
+ print('], self')
949
963
  else
950
- print(", self")
964
+ print(', self')
951
965
  end
952
966
  if (!node.has_default?) && node.default_label # has implicit default?
953
967
  println(", #{expression_to_s(node.default_label)})")
@@ -955,13 +969,13 @@ module IDL
955
969
  println(')')
956
970
  end
957
971
  }
958
- printiln("end")
959
- printiln("self._tc # register typecode");
972
+ printiln('end')
973
+ printiln('self._tc # register typecode');
960
974
  ix = 0
961
- if node.members.size>0
975
+ if node.members.size > 0
962
976
  node.members.each do |m|
963
- printiln(format("def %s; @value; end", m.rubyname))
964
- printiln(format("def %s=(val); _set_value(%d, val); end", m.rubyname, ix))
977
+ printiln(format('def %s; @value; end', m.rubyname))
978
+ printiln(format('def %s=(val); _set_value(%d, val); end', m.rubyname, ix))
965
979
  ix += m.labels.size
966
980
  end
967
981
  end
@@ -977,47 +991,47 @@ module IDL
977
991
  end
978
992
 
979
993
  def visit_enum(node)
980
- printiln(format("class %s < ::R2CORBA::FIXNUM_KLASS", node.rubyname))
994
+ printiln(format('class %s < ::R2CORBA::FIXNUM_KLASS', node.rubyname))
981
995
  nest {
982
- printiln(format("def %s._tc", node.rubyname))
996
+ printiln(format('def %s._tc', node.rubyname))
983
997
  nest {
984
998
  printi(format("@@tc_%s ||= CORBA::TypeCode::Enum.new('%s'.freeze, '%s', [",
985
999
  node.rubyname, node.repository_id, node.rubyname))
986
- pfx = ""
1000
+ pfx = ''
987
1001
  node.enumerators.each { |e|
988
1002
  println(pfx)
989
- pfx = ","
1003
+ pfx = ','
990
1004
  printi(" '#{e.rubyname}'")
991
1005
  }
992
- println("])")
1006
+ println('])')
993
1007
  }
994
- printiln("end")
995
- printiln("self._tc # register typecode");
1008
+ printiln('end')
1009
+ printiln('self._tc # register typecode');
996
1010
  }
997
- printiln(format("end # enum %s", node.rubyname))
1011
+ printiln(format('end # enum %s', node.rubyname))
998
1012
  end
999
1013
 
1000
1014
  def visit_enumerator(node)
1001
1015
  v = Expression::Value.new(node.idltype, node.value)
1002
- s = node.rubyname + " = " + expression_to_s(v)
1016
+ s = node.rubyname + ' = ' + expression_to_s(v)
1003
1017
  printiln(s)
1004
1018
  end
1005
1019
 
1006
1020
  def visit_typedef(node)
1007
- #tc_ = node.enclosure.rubyname + '._tc_' + node.rubyname
1008
- #typ_ = node.enclosure.rubyname + '.' + node.rubyname
1021
+ # tc_ = node.enclosure.rubyname + '._tc_' + node.rubyname
1022
+ # typ_ = node.enclosure.rubyname + '.' + node.rubyname
1009
1023
  case t = node.idltype
1010
1024
  when Type::ScopedName
1011
1025
  if Type::Interface === t.resolved_type
1012
- printiln(format("%s = %s # typedef %s", node.rubyname, t.node.scoped_rubyname, node.rubyname))
1026
+ printiln(format('%s = %s # typedef %s', node.rubyname, t.node.scoped_rubyname, node.rubyname))
1013
1027
  else
1014
- printiln(format("class %s < %s", node.rubyname, t.node.scoped_rubyname))
1028
+ printiln(format('class %s < %s', node.rubyname, t.node.scoped_rubyname))
1015
1029
  nest {
1016
- printi(format("def %s._tc; ", node.rubyname))
1030
+ printi(format('def %s._tc; ', node.rubyname))
1017
1031
  print(format("@@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s',", node.rubyname, node.repository_id, node.rubyname))
1018
- println(format("%s, self); end", get_typecode(t)))
1032
+ println(format('%s, self); end', get_typecode(t)))
1019
1033
  }
1020
- printiln(format("end # typedef %s", node.rubyname))
1034
+ printiln(format('end # typedef %s', node.rubyname))
1021
1035
  end
1022
1036
 
1023
1037
  when IDL::Type::Native
@@ -1029,18 +1043,18 @@ module IDL
1029
1043
  Type::ULongLong, Type::LongLong,
1030
1044
  Type::Boolean, Type::Char, Type::WChar,
1031
1045
  Type::Float, Type::Double, Type::LongDouble
1032
- s = t.class.name.split("::") # IDL::Type::Octet -> [IDL, Type, Octet]
1046
+ s = t.class.name.split('::') # IDL::Type::Octet -> [IDL, Type, Octet]
1033
1047
  s = s[s.length - 1]
1034
1048
  s.downcase!
1035
- printiln(format("class %s < CORBA::_tc_%s.get_type", node.rubyname, s))
1049
+ printiln(format('class %s < CORBA::_tc_%s.get_type', node.rubyname, s))
1036
1050
  nest {
1037
1051
  printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s', CORBA::_tc_%s, self); end",
1038
1052
  node.rubyname, node.rubyname, node.repository_id, node.rubyname, s))
1039
1053
  }
1040
- printiln(format("end # typedef %s", node.rubyname))
1054
+ printiln(format('end # typedef %s', node.rubyname))
1041
1055
 
1042
1056
  when Type::String
1043
- printiln(format("class %s < String", node.rubyname))
1057
+ printiln(format('class %s < String', node.rubyname))
1044
1058
  nest {
1045
1059
  if not t.length.nil?
1046
1060
  printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s', CORBA::TypeCode::String.new(%d), self); end",
@@ -1050,10 +1064,10 @@ module IDL
1050
1064
  node.rubyname, node.rubyname, node.repository_id, node.rubyname))
1051
1065
  end
1052
1066
  }
1053
- printiln(format("end # typedef %s", node.rubyname))
1067
+ printiln(format('end # typedef %s', node.rubyname))
1054
1068
 
1055
1069
  when Type::WString
1056
- printiln(format("class %s < Array", node.rubyname))
1070
+ printiln(format('class %s < Array', node.rubyname))
1057
1071
  nest {
1058
1072
  if not t.length.nil?
1059
1073
  printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s', CORBA::TypeCode::WString.new(%d), self); end",
@@ -1063,36 +1077,36 @@ module IDL
1063
1077
  node.rubyname, node.rubyname, node.repository_id, node.rubyname))
1064
1078
  end
1065
1079
  }
1066
- printiln(format("end # typedef %s", node.rubyname))
1080
+ printiln(format('end # typedef %s', node.rubyname))
1067
1081
 
1068
1082
  when IDL::Type::Array
1069
- printiln(format("class %s < Array", node.rubyname))
1083
+ printiln(format('class %s < Array', node.rubyname))
1070
1084
  nest {
1071
- printiln(format("def %s._tc", node.rubyname))
1085
+ printiln(format('def %s._tc', node.rubyname))
1072
1086
  nest {
1073
1087
  printiln(format("@@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s',", node.rubyname, node.repository_id, node.rubyname))
1074
- nest { printiln(format("%s, self)", get_typecode(t))) }
1088
+ nest { printiln(format('%s, self)', get_typecode(t))) }
1075
1089
  }
1076
- printiln("end")
1090
+ printiln('end')
1077
1091
  }
1078
- printiln(format("end # typedef %s", node.rubyname))
1092
+ printiln(format('end # typedef %s', node.rubyname))
1079
1093
 
1080
1094
  when IDL::Type::Sequence
1081
1095
  case t.basetype.resolved_type
1082
1096
  when IDL::Type::Char, IDL::Type::Octet
1083
- printiln(format("class %s < String", node.rubyname))
1097
+ printiln(format('class %s < String', node.rubyname))
1084
1098
  else
1085
- printiln(format("class %s < Array", node.rubyname))
1099
+ printiln(format('class %s < Array', node.rubyname))
1086
1100
  end
1087
1101
  nest {
1088
- printiln(format("def %s._tc", node.rubyname))
1102
+ printiln(format('def %s._tc', node.rubyname))
1089
1103
  nest {
1090
1104
  printiln(format("@@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s',", node.rubyname, node.repository_id, node.rubyname))
1091
- nest { printiln(format("%s, self)", get_typecode(t))) }
1105
+ nest { printiln(format('%s, self)', get_typecode(t))) }
1092
1106
  }
1093
- printiln("end")
1107
+ printiln('end')
1094
1108
  }
1095
- printiln(format("end # typedef %s", node.rubyname))
1109
+ printiln(format('end # typedef %s', node.rubyname))
1096
1110
 
1097
1111
  when IDL::Type::Object
1098
1112
  printiln(format("%s = CORBA::Object # typedef %s\n", node.rubyname, node.rubyname))
@@ -1104,7 +1118,7 @@ module IDL
1104
1118
  end ## RubyStubWriter
1105
1119
 
1106
1120
  class RubyServantWriter < RubyWriterBase
1107
- def initialize(output = STDOUT, params = {}, indent = " ")
1121
+ def initialize(output = STDOUT, params = {}, indent = ' ')
1108
1122
  super
1109
1123
  @stub_root = '::'
1110
1124
  end
@@ -1123,10 +1137,10 @@ module IDL
1123
1137
  idleval = @params[:idl_eval] || false
1124
1138
  println("require 'corba/poa.rb'") if @params[:libinit]
1125
1139
  if !@params[:expand_includes]
1126
- println("require '"+@params[:idlfile].sub(/\.[^\.]*$/,@params[:stub_pfx])+"'")
1140
+ println("require '" + @params[:idlfile].sub(/\.[^\.]*$/, @params[:stub_pfx]) + "'")
1127
1141
  end
1128
1142
  println()
1129
- printiln("module POA")
1143
+ printiln('module POA')
1130
1144
  @nest += 1
1131
1145
  if !idleval
1132
1146
  printiln("CORBA.implement('#{@params[:idlfile]}', {}, CORBA::IDL::SERVANT_INTF) {")
@@ -1142,17 +1156,17 @@ module IDL
1142
1156
  printiln("} ## end of '#{@params[:idlfile]}'")
1143
1157
  end
1144
1158
  @nest -= 1
1145
- printiln("end #of module POA")
1146
- println("# -*- END -*-")
1159
+ printiln('end #of module POA')
1160
+ println('# -*- END -*-')
1147
1161
  end
1148
1162
 
1149
1163
  def visit_include(node)
1150
- printiln(format("require '%s'", node.filename.sub(/\.[^\.]*$/,@params[:srv_pfx])))
1164
+ printiln(format("require '%s'", node.filename.sub(/\.[^\.]*$/, @params[:srv_pfx])))
1151
1165
  println()
1152
1166
  end
1153
1167
 
1154
1168
  def enter_include(node)
1155
- printiln("## include")
1169
+ printiln('## include')
1156
1170
  printiln("CORBA.implement('#{node.filename}', {}, CORBA::IDL::SERVANT_INTF) {")
1157
1171
  println()
1158
1172
  end
@@ -1164,10 +1178,11 @@ module IDL
1164
1178
  end
1165
1179
 
1166
1180
  def enter_module(node)
1167
- printiln("module " + node.rubyname)
1181
+ printiln('module ' + node.rubyname)
1168
1182
  println()
1169
1183
  @nest += 1
1170
1184
  end
1185
+
1171
1186
  def leave_module(node)
1172
1187
  @nest -= 1
1173
1188
  printiln("end #of module #{node.rubyname}")
@@ -1177,6 +1192,7 @@ module IDL
1177
1192
  def declare_interface(node)
1178
1193
  printiln("class #{node.rubyname} < PortableServer::Servant; end ## servant forward")
1179
1194
  end
1195
+
1180
1196
  def enter_interface(node)
1181
1197
  if !node.is_local?
1182
1198
  println
@@ -1184,39 +1200,40 @@ module IDL
1184
1200
  println()
1185
1201
  @nest += 1
1186
1202
 
1187
- printiln("module Intf")
1203
+ printiln('module Intf')
1188
1204
  @nest += 1
1189
1205
  printiln(format("Id = '%s'.freeze", node.repository_id))
1190
- printi("Ids = [ Id")
1206
+ printi('Ids = [ Id')
1191
1207
  if node.is_abstract?
1192
1208
  print(", 'IDL:omg.org/CORBA/AbstractBase:1.0'")
1193
1209
  end
1194
1210
  println(' ]')
1195
- printiln("Operations = {}")
1211
+ printiln('Operations = {}')
1196
1212
  println()
1197
1213
  end
1198
1214
  end
1215
+
1199
1216
  def leave_interface(node)
1200
1217
  if !node.is_local?
1201
1218
  name = node.rubyname
1202
1219
 
1203
1220
  @nest -= 1
1204
- printiln("end #of Intf")
1221
+ printiln('end #of Intf')
1205
1222
 
1206
1223
  println()
1207
- printiln("Id = Intf::Id")
1224
+ printiln('Id = Intf::Id')
1208
1225
  println()
1209
1226
 
1210
- if node.bases.size>0
1227
+ if node.bases.size > 0
1211
1228
  node.bases.each do |n|
1212
1229
  printiln("include_interface(#{n.scoped_rubyname}::Intf)")
1213
1230
  end
1214
1231
  else
1215
- printiln("include_interface(PortableServer::Servant::Intf)")
1232
+ printiln('include_interface(PortableServer::Servant::Intf)')
1216
1233
  end
1217
1234
  println()
1218
1235
 
1219
- printiln("include Intf")
1236
+ printiln('include Intf')
1220
1237
  println()
1221
1238
 
1222
1239
  printiln("def _this; #{@stub_root}#{node.scoped_rubyname}._narrow(super); end")
@@ -1228,6 +1245,7 @@ module IDL
1228
1245
 
1229
1246
  def declare_valuetype(node)
1230
1247
  end
1248
+
1231
1249
  def enter_valuetype(node)
1232
1250
  println
1233
1251
  printiln("class #{node.rubyname} < PortableServer::Servant ## servant")
@@ -1237,7 +1255,7 @@ module IDL
1237
1255
  println
1238
1256
  printiln('## object interfaces')
1239
1257
  node.interfaces.each do |intf|
1240
- #printiln("include #{@stub_root}#{intf.scoped_rubyname}")
1258
+ # printiln("include #{@stub_root}#{intf.scoped_rubyname}")
1241
1259
  printiln("include #{intf.scoped_rubyname}")
1242
1260
  end
1243
1261
  end
@@ -1263,69 +1281,69 @@ module IDL
1263
1281
  return nil if _intf.is_a?(IDL::AST::Valuetype) || _intf.is_local?
1264
1282
 
1265
1283
  printi("Operations.store(:#{node.name}, {")
1266
- newln = ""
1267
- if _parm.size>0
1284
+ newln = ''
1285
+ if _parm.size > 0
1268
1286
  println(newln)
1269
1287
  nest do
1270
- printi(":arg_list => [")
1288
+ printi(':arg_list => [')
1271
1289
  nest {
1272
- pfx = ""
1290
+ pfx = ''
1273
1291
  _parm.each do |p|
1274
1292
  println(pfx)
1275
1293
  printi("['#{p.rubyname}', #{get_arg_type(p.attribute)}, ");
1276
1294
  print(get_typecode(p.idltype))
1277
- print("]")
1278
- pfx = ","
1295
+ print(']')
1296
+ pfx = ','
1279
1297
  end
1280
- print("]")
1298
+ print(']')
1281
1299
  }
1282
1300
  end
1283
- newln = ","
1301
+ newln = ','
1284
1302
  end
1285
1303
 
1286
1304
  if not node.oneway
1287
1305
  println(newln)
1288
1306
  nest { printi(":result_type => #{get_typecode(node.idltype)}") }
1289
- newln = ","
1307
+ newln = ','
1290
1308
  end
1291
1309
 
1292
- if node.raises.size>0
1310
+ if node.raises.size > 0
1293
1311
  println(newln)
1294
1312
  nest {
1295
- printi(":exc_list => [")
1296
- pfx = ""
1313
+ printi(':exc_list => [')
1314
+ pfx = ''
1297
1315
  nest {
1298
1316
  node.raises.each { |ex|
1299
1317
  println(pfx)
1300
- pfx = ","
1318
+ pfx = ','
1301
1319
  printi(get_typecode(ex))
1302
1320
  }
1303
- print("]")
1321
+ print(']')
1304
1322
  }
1305
1323
  }
1306
- newln = ","
1324
+ newln = ','
1307
1325
  end
1308
1326
 
1309
1327
  if node.rubyname != node.name
1310
1328
  println(newln)
1311
1329
  nest { printi(":op_sym => :#{node.rubyname}") }
1312
1330
  end
1313
- println("})")
1331
+ println('})')
1314
1332
  println()
1315
1333
 
1316
1334
  printi("def #{node.rubyname}(")
1317
- print( _in.collect{ |p| p.rubyname }.join(", ") )
1335
+ print(_in.collect{ |p| p.rubyname }.join(', '))
1318
1336
  if node.oneway
1319
- println(") # oneway")
1337
+ println(') # oneway')
1320
1338
  else
1321
- println(")")
1339
+ println(')')
1322
1340
  end
1323
1341
  nest {
1324
- printiln("raise ::CORBA::NO_IMPLEMENT.new(")
1342
+ printiln('raise ::CORBA::NO_IMPLEMENT.new(')
1325
1343
  printiln(" 'unimplemented servant operation',")
1326
- printiln(" 1, ::CORBA::COMPLETED_NO)")
1344
+ printiln(' 1, ::CORBA::COMPLETED_NO)')
1327
1345
  }
1328
- printiln("end")
1346
+ printiln('end')
1329
1347
  println()
1330
1348
  end
1331
1349
 
@@ -1339,16 +1357,16 @@ module IDL
1339
1357
  nest {
1340
1358
  nest {
1341
1359
  printiln(":result_type => #{get_typecode(node.idltype)},")
1342
- if node.get_raises.size>0
1343
- printi(":exc_list => [")
1344
- pfx = ""
1360
+ if node.get_raises.size > 0
1361
+ printi(':exc_list => [')
1362
+ pfx = ''
1345
1363
  nest {
1346
1364
  node.get_raises.each { |ex|
1347
1365
  println(pfx)
1348
- pfx = ","
1366
+ pfx = ','
1349
1367
  printi(get_typecode(ex))
1350
1368
  }
1351
- println("],")
1369
+ println('],')
1352
1370
  }
1353
1371
  end
1354
1372
  printiln(":op_sym => :#{node.rubyname} })")
@@ -1358,9 +1376,9 @@ module IDL
1358
1376
 
1359
1377
  printiln("def #{node.rubyname}()")
1360
1378
  nest {
1361
- printiln("raise ::CORBA::NO_IMPLEMENT.new(")
1379
+ printiln('raise ::CORBA::NO_IMPLEMENT.new(')
1362
1380
  printiln(" 'unimplemented servant attribute get',")
1363
- printiln(" 1, ::CORBA::COMPLETED_NO)")
1381
+ printiln(' 1, ::CORBA::COMPLETED_NO)')
1364
1382
  }
1365
1383
  printiln("end #of attribute get_#{node.name}")
1366
1384
  println()
@@ -1369,21 +1387,21 @@ module IDL
1369
1387
  printiln("Operations.store(:_set_#{node.name}, {")
1370
1388
  nest {
1371
1389
  nest {
1372
- printiln(":arg_list => [")
1390
+ printiln(':arg_list => [')
1373
1391
  nest {
1374
1392
  printiln("['val', CORBA::ARG_IN, #{get_typecode(node.idltype)}]],");
1375
1393
  }
1376
- printiln(":result_type => CORBA._tc_void,")
1377
- if node.set_raises.size>0
1378
- printi(":exc_list => [")
1379
- pfx = ""
1394
+ printiln(':result_type => CORBA._tc_void,')
1395
+ if node.set_raises.size > 0
1396
+ printi(':exc_list => [')
1397
+ pfx = ''
1380
1398
  nest {
1381
1399
  node.set_raises.each { |ex|
1382
1400
  println(pfx)
1383
- pfx = ","
1401
+ pfx = ','
1384
1402
  printi(get_typecode(ex))
1385
1403
  }
1386
- println("],")
1404
+ println('],')
1387
1405
  }
1388
1406
  end
1389
1407
  printiln(":op_sym => :#{node.rubyname}= })")
@@ -1393,9 +1411,9 @@ module IDL
1393
1411
 
1394
1412
  printiln("def #{node.rubyname}=(val)")
1395
1413
  nest {
1396
- printiln("raise ::CORBA::NO_IMPLEMENT.new(")
1414
+ printiln('raise ::CORBA::NO_IMPLEMENT.new(')
1397
1415
  printiln(" 'unimplemented servant attribute set',")
1398
- printiln(" 1, ::CORBA::COMPLETED_NO)")
1416
+ printiln(' 1, ::CORBA::COMPLETED_NO)')
1399
1417
  }
1400
1418
  printiln("end #of attribute set_#{node.name}")
1401
1419
  println()
@@ -1411,49 +1429,49 @@ module IDL
1411
1429
  Type::Boolean, Type::Char, Type::WChar,
1412
1430
  Type::Float, Type::Double, Type::LongDouble,
1413
1431
  Type::Void, Type::Any
1414
- s = _type.class.name.split("::") # IDL::Type::Octet -> [IDL, Type, Octet]
1432
+ s = _type.class.name.split('::') # IDL::Type::Octet -> [IDL, Type, Octet]
1415
1433
  s = s[s.length - 1]
1416
1434
  s.downcase!
1417
- format("CORBA._tc_%s",s)
1435
+ format('CORBA._tc_%s', s)
1418
1436
 
1419
1437
  when Type::Object
1420
- "CORBA._tc_Object"
1438
+ 'CORBA._tc_Object'
1421
1439
 
1422
1440
  when Type::String
1423
1441
  if not _type.length.nil?
1424
- format("CORBA::TypeCode::String.new(%d)", _type.length)
1442
+ format('CORBA::TypeCode::String.new(%d)', _type.length)
1425
1443
  else
1426
- "CORBA._tc_string"
1444
+ 'CORBA._tc_string'
1427
1445
  end
1428
1446
 
1429
1447
  when Type::WString
1430
1448
  if not _type.length.nil?
1431
- format("CORBA::TypeCode::WString.new(%d)", _type.length)
1449
+ format('CORBA::TypeCode::WString.new(%d)', _type.length)
1432
1450
  else
1433
- "CORBA._tc_wstring"
1451
+ 'CORBA._tc_wstring'
1434
1452
  end
1435
1453
 
1436
1454
  when Type::ScopedName
1437
1455
  @stub_root + _type.node.scoped_rubyname + '._tc'
1438
1456
 
1439
1457
  when Type::Array
1440
- sep = ""
1441
- tc = "CORBA::TypeCode::Array.new(" +
1442
- get_typecode(_type.basetype) + ", "
1458
+ sep = ''
1459
+ tc = 'CORBA::TypeCode::Array.new(' +
1460
+ get_typecode(_type.basetype) + ', '
1443
1461
  _type.sizes.each do |sz|
1444
1462
  tc += "#{sep}#{sz.to_s}"
1445
- sep = ", "
1463
+ sep = ', '
1446
1464
  end
1447
- tc + ")"
1465
+ tc + ')'
1448
1466
 
1449
1467
  when Type::Sequence
1450
1468
  if _type.is_recursive?
1451
1469
  "CORBA::TypeCode::Sequence.new(CORBA::TypeCode::Recursive.new('#{_type.basetype.resolved_type.node.repository_id}'))"
1452
1470
  else
1453
- "CORBA::TypeCode::Sequence.new(" +
1471
+ 'CORBA::TypeCode::Sequence.new(' +
1454
1472
  get_typecode(_type.basetype) +
1455
- if not _type.length.nil? then format(", %d)", _type.length) else ")" end +
1456
- ".freeze"
1473
+ if not _type.length.nil? then format(', %d)', _type.length) else ')' end +
1474
+ '.freeze'
1457
1475
  end
1458
1476
 
1459
1477
  else
@@ -1464,11 +1482,11 @@ module IDL
1464
1482
  def get_arg_type(_idl_argtype)
1465
1483
  case _idl_argtype
1466
1484
  when IDL::AST::Parameter::IN
1467
- "CORBA::ARG_IN"
1485
+ 'CORBA::ARG_IN'
1468
1486
  when IDL::AST::Parameter::OUT
1469
- "CORBA::ARG_OUT"
1487
+ 'CORBA::ARG_OUT'
1470
1488
  else
1471
- "CORBA::ARG_INOUT"
1489
+ 'CORBA::ARG_INOUT'
1472
1490
  end
1473
1491
  end
1474
1492
 
@@ -1490,7 +1508,7 @@ module IDL
1490
1508
  v = exp.value
1491
1509
  case exp.idltype
1492
1510
  when Type::Void
1493
- s = "nil"
1511
+ s = 'nil'
1494
1512
  when Type::Char
1495
1513
  s = "'#{v.chr}'"
1496
1514
  when Type::Integer,
@@ -1505,9 +1523,9 @@ module IDL
1505
1523
  s = "'#{v.to_s}'"
1506
1524
  when Type::WString
1507
1525
  s = "[#{v.join(',')}]"
1508
- #when Type::Fixed
1509
- #when Type::Any
1510
- #when Type::Object
1526
+ # when Type::Fixed
1527
+ # when Type::Any
1528
+ # when Type::Object
1511
1529
  when Type::ScopedName
1512
1530
  s = value_to_s(Expression::Value.new(exp.idltype.node.idltype, v))
1513
1531
  else
@@ -1523,49 +1541,54 @@ module IDL
1523
1541
  when Expression::UnaryPlus
1524
1542
  s = expression_to_s(op[0])
1525
1543
  when Expression::UnaryMinus
1526
- s = "-" + expression_to_s(op[0])
1544
+ s = '-' + expression_to_s(op[0])
1527
1545
  when Expression::UnaryNot
1528
- s = "~" + expression_to_s(op[0])
1546
+ s = '~' + expression_to_s(op[0])
1529
1547
  when Expression::Or
1530
- s = expression_to_s(op[0]) + " | " + expression_to_s(op[1])
1548
+ s = expression_to_s(op[0]) + ' | ' + expression_to_s(op[1])
1531
1549
  when Expression::And
1532
- s = expression_to_s(op[0]) + " & " + expression_to_s(op[1])
1550
+ s = expression_to_s(op[0]) + ' & ' + expression_to_s(op[1])
1533
1551
  when Expression::LShift
1534
- s = expression_to_s(op[0]) + " << " + expression_to_s(op[1])
1552
+ s = expression_to_s(op[0]) + ' << ' + expression_to_s(op[1])
1535
1553
  when Expression::RShift
1536
- s = expression_to_s(op[0]) + " >> " + expression_to_s(op[1])
1554
+ s = expression_to_s(op[0]) + ' >> ' + expression_to_s(op[1])
1537
1555
  when Expression::Add
1538
- s = expression_to_s(op[0]) + " + " + expression_to_s(op[1])
1556
+ s = expression_to_s(op[0]) + ' + ' + expression_to_s(op[1])
1539
1557
  when Expression::Minus
1540
- s = expression_to_s(op[0]) + " - " + expression_to_s(op[1])
1558
+ s = expression_to_s(op[0]) + ' - ' + expression_to_s(op[1])
1541
1559
  when Expression::Mult
1542
- s = expression_to_s(op[0]) + " * " + expression_to_s(op[1])
1560
+ s = expression_to_s(op[0]) + ' * ' + expression_to_s(op[1])
1543
1561
  when Expression::Div
1544
- s = expression_to_s(op[0]) + " / " + expression_to_s(op[1])
1562
+ s = expression_to_s(op[0]) + ' / ' + expression_to_s(op[1])
1545
1563
  when Expression::Mod
1546
- s = expression_to_s(op[0]) + " % " + expression_to_s(op[1])
1564
+ s = expression_to_s(op[0]) + ' % ' + expression_to_s(op[1])
1547
1565
  else
1548
1566
  raise "unknown operation: #{exp.type.name}"
1549
1567
  end
1550
- "(" + s + ")"
1568
+ '(' + s + ')'
1551
1569
  end
1552
1570
 
1553
1571
  def declare_struct(node)
1554
1572
  end
1573
+
1555
1574
  def enter_struct(node)
1556
1575
  end
1576
+
1557
1577
  def leave_struct(node)
1558
1578
  end
1559
1579
 
1560
1580
  def enter_exception(node)
1561
1581
  end
1582
+
1562
1583
  def leave_exception(node)
1563
1584
  end
1564
1585
 
1565
1586
  def declare_union(node)
1566
1587
  end
1588
+
1567
1589
  def enter_union(node)
1568
1590
  end
1591
+
1569
1592
  def leave_union(node)
1570
1593
  end
1571
1594