r2corba 1.5.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libr2tao/any.cpp +11 -10
  3. data/ext/libr2tao/exception.cpp +6 -8
  4. data/ext/libr2tao/exception.h +1 -1
  5. data/ext/libr2tao/longdouble.cpp +5 -9
  6. data/ext/libr2tao/object.cpp +33 -49
  7. data/ext/libr2tao/orb.cpp +38 -65
  8. data/ext/libr2tao/r2tao_ext.h +8 -7
  9. data/ext/libr2tao/required.cpp +1 -6
  10. data/ext/libr2tao/required.h +9 -23
  11. data/ext/libr2tao/values.cpp +92 -93
  12. data/ext/libr2tao/values.h +28 -30
  13. data/ext/librpoa/iortable.cpp +3 -4
  14. data/ext/librpoa/poa.cpp +22 -25
  15. data/ext/librpoa/servant.cpp +24 -23
  16. data/ext/librpoa/servant.h +10 -10
  17. data/lib/corba.rb +1 -1
  18. data/lib/corba/cbase/ORB.rb +19 -16
  19. data/lib/corba/cbase/Request.rb +3 -3
  20. data/lib/corba/cbase/Values.rb +4 -2
  21. data/lib/corba/cbase/exception.rb +4 -2
  22. data/lib/corba/cbase/poa.rb +1 -1
  23. data/lib/corba/cbase/policies.rb +1 -1
  24. data/lib/corba/cbase/require.rb +8 -1
  25. data/lib/corba/common/Any.rb +2 -1
  26. data/lib/corba/common/IDL.rb +1 -1
  27. data/lib/corba/common/ORB.rb +21 -21
  28. data/lib/corba/common/Object.rb +14 -13
  29. data/lib/corba/common/Servant.rb +4 -4
  30. data/lib/corba/common/Stub.rb +6 -6
  31. data/lib/corba/common/Typecode.rb +35 -8
  32. data/lib/corba/common/Union.rb +5 -0
  33. data/lib/corba/common/Values.rb +1 -0
  34. data/lib/corba/common/const.rb +1 -1
  35. data/lib/corba/common/exception.rb +2 -1
  36. data/lib/corba/common/version.rb +2 -2
  37. data/lib/corba/idl/IDL.rb +1 -1
  38. data/lib/corba/jbase/Any.rb +6 -4
  39. data/lib/corba/jbase/ORB.rb +2 -2
  40. data/lib/corba/jbase/Object.rb +13 -13
  41. data/lib/corba/jbase/Request.rb +3 -3
  42. data/lib/corba/jbase/Streams.rb +64 -0
  43. data/lib/corba/jbase/Typecode.rb +3 -2
  44. data/lib/corba/jbase/Values.rb +2 -0
  45. data/lib/corba/jbase/exception.rb +1 -0
  46. data/lib/corba/jbase/poa.rb +18 -18
  47. data/lib/corba/jbase/policies.rb +29 -29
  48. data/lib/corba/jbase/require.rb +4 -0
  49. data/lib/corba/svcs/ins/cos_naming.rb +10 -1
  50. data/lib/corba/svcs/ins/ins.rb +45 -45
  51. data/lib/corba/svcs/ins/naming_service.rb +6 -6
  52. data/lib/ridlbe/ruby/config.rb +27 -20
  53. data/lib/ridlbe/ruby/walker.rb +276 -253
  54. data/mkrf_conf_srcgem.rb +2 -2
  55. data/rakelib/build.rake +1 -1
  56. data/rakelib/config.rake +1 -1
  57. data/rakelib/config.rb +9 -9
  58. data/rakelib/ext.rake +6 -65
  59. data/rakelib/ext_r2tao.rb +2 -39
  60. data/rakelib/gem.rake +20 -20
  61. data/rakelib/gem.rb +1 -1
  62. data/rakelib/package.rake +1 -1
  63. data/test/BiDirectional/client.rb +16 -16
  64. data/test/BiDirectional/run_test.rb +10 -10
  65. data/test/BiDirectional/server.rb +20 -20
  66. data/test/CORBA_Services/Naming/BindingIterator/client.rb +14 -14
  67. data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +12 -12
  68. data/test/CORBA_Services/Naming/BindingIterator/server.rb +17 -17
  69. data/test/CORBA_Services/Naming/Corbaname/client.rb +14 -14
  70. data/test/CORBA_Services/Naming/Corbaname/run_test.rb +12 -12
  71. data/test/CORBA_Services/Naming/Corbaname/server.rb +20 -20
  72. data/test/CORBA_Services/Naming/Simple/client.rb +14 -14
  73. data/test/CORBA_Services/Naming/Simple/run_test.rb +12 -12
  74. data/test/CORBA_Services/Naming/Simple/server.rb +17 -17
  75. data/test/Collocation/run_test.rb +10 -10
  76. data/test/Collocation/test.rb +26 -19
  77. data/test/Connect_Timeout/client.rb +15 -15
  78. data/test/Connect_Timeout/run_test.rb +10 -10
  79. data/test/DII/client.rb +27 -27
  80. data/test/DII/run_test.rb +10 -10
  81. data/test/DII/server.rb +15 -15
  82. data/test/DSI/client.rb +15 -15
  83. data/test/DSI/run_test.rb +10 -10
  84. data/test/DSI/server.rb +16 -16
  85. data/test/Exceptions/client.rb +19 -19
  86. data/test/Exceptions/run_test.rb +10 -10
  87. data/test/Exceptions/server.rb +15 -15
  88. data/test/Hello/client.rb +15 -15
  89. data/test/Hello/run_test.rb +10 -10
  90. data/test/Hello/server.rb +16 -16
  91. data/test/IDL_Test/client.rb +20 -20
  92. data/test/IDL_Test/run_test.rb +10 -10
  93. data/test/IDL_Test/server.rb +18 -18
  94. data/test/IORMap/client.rb +14 -14
  95. data/test/IORMap/run_test.rb +10 -10
  96. data/test/IORMap/server.rb +22 -22
  97. data/test/IORTable/client.rb +14 -14
  98. data/test/IORTable/run_test.rb +10 -10
  99. data/test/IORTable/server.rb +22 -22
  100. data/test/Implicit_Conversion/client.rb +19 -16
  101. data/test/Implicit_Conversion/run_test.rb +10 -10
  102. data/test/Implicit_Conversion/server.rb +15 -15
  103. data/test/Multi_Threading/Multiple_ORB/client.rb +13 -13
  104. data/test/Multi_Threading/Multiple_ORB/run_test.rb +10 -10
  105. data/test/Multi_Threading/Multiple_ORB/server.rb +16 -16
  106. data/test/Multi_Threading/Simple/client.rb +15 -15
  107. data/test/Multi_Threading/Simple/run_test.rb +10 -10
  108. data/test/Multi_Threading/Simple/server.rb +15 -15
  109. data/test/Multi_Threading/Threads/client.rb +15 -15
  110. data/test/Multi_Threading/Threads/run_test.rb +10 -10
  111. data/test/Multi_Threading/Threads/server.rb +17 -17
  112. data/test/Multi_Threading/Threads/watchdog.rb +15 -15
  113. data/test/Multiple_Servant_Interfaces/client.rb +13 -13
  114. data/test/Multiple_Servant_Interfaces/run_test.rb +10 -10
  115. data/test/Multiple_Servant_Interfaces/server.rb +17 -17
  116. data/test/Nil/run_test.rb +10 -10
  117. data/test/Nil/test.rb +13 -13
  118. data/test/OBV/AbstractInterface/client.rb +13 -13
  119. data/test/OBV/AbstractInterface/run_test.rb +10 -10
  120. data/test/OBV/AbstractInterface/server.rb +19 -18
  121. data/test/OBV/Custom/OBV_impl.rb +2 -0
  122. data/test/OBV/Custom/client.rb +13 -13
  123. data/test/OBV/Custom/run_test.rb +10 -10
  124. data/test/OBV/Custom/server.rb +15 -15
  125. data/test/OBV/Simple/OBV_impl.rb +1 -0
  126. data/test/OBV/Simple/client.rb +13 -13
  127. data/test/OBV/Simple/run_test.rb +10 -10
  128. data/test/OBV/Simple/server.rb +15 -15
  129. data/test/OBV/Simple_Event/Event_impl.rb +1 -0
  130. data/test/OBV/Simple_Event/client.rb +13 -13
  131. data/test/OBV/Simple_Event/run_test.rb +10 -10
  132. data/test/OBV/Simple_Event/server.rb +15 -15
  133. data/test/OBV/Supports/client.rb +18 -18
  134. data/test/OBV/Supports/run_test.rb +10 -10
  135. data/test/OBV/Supports/server.rb +14 -14
  136. data/test/OBV/Supports/supports_impl.rb +3 -0
  137. data/test/OBV/Tree/client.rb +13 -13
  138. data/test/OBV/Tree/run_test.rb +10 -10
  139. data/test/OBV/Tree/server.rb +18 -18
  140. data/test/OBV/Truncatable/client.rb +56 -56
  141. data/test/OBV/Truncatable/run_test.rb +10 -10
  142. data/test/OBV/Truncatable/server.rb +14 -14
  143. data/test/OBV/ValueBox/client.rb +148 -147
  144. data/test/OBV/ValueBox/run_test.rb +10 -10
  145. data/test/OBV/ValueBox/server.rb +15 -15
  146. data/test/Object/client.rb +13 -13
  147. data/test/Object/run_test.rb +10 -10
  148. data/test/Object/server.rb +18 -18
  149. data/test/POA/run_test.rb +10 -10
  150. data/test/POA/test.rb +15 -15
  151. data/test/Param_Test/client.rb +47 -47
  152. data/test/Param_Test/run_test.rb +10 -10
  153. data/test/Param_Test/server.rb +55 -55
  154. data/test/Performance/Simple/client.rb +15 -15
  155. data/test/Performance/Simple/run_test.rb +10 -10
  156. data/test/Performance/Simple/server.rb +15 -15
  157. data/test/Policies/run_test.rb +10 -10
  158. data/test/Policies/test.rb +23 -23
  159. data/test/Timeout/client.rb +17 -17
  160. data/test/Timeout/run_test.rb +10 -10
  161. data/test/Timeout/server.rb +18 -18
  162. data/test/lib/test.rb +13 -7
  163. data/test/test_runner.rb +19 -19
  164. metadata +4 -5
  165. data/ext/extload/extload.c +0 -59
@@ -302,7 +302,7 @@ module R2CORBA
302
302
  report 'INS - stopped'
303
303
  end
304
304
  else
305
- STDERR.puts "INS - restart command is only functional in daemon mode"
305
+ STDERR.puts 'INS - restart command is only functional in daemon mode'
306
306
  exit 1
307
307
  end
308
308
  end
@@ -385,7 +385,7 @@ module R2CORBA
385
385
  def INS.parse_arg
386
386
  script_name = File.basename($0, '.bat')
387
387
  if not script_name =~ /rins/
388
- script_name = "ruby " + $0
388
+ script_name = 'ruby ' + $0
389
389
  end
390
390
 
391
391
  @@command = ARGV.shift.to_sym unless ARGV.empty?
@@ -425,51 +425,51 @@ module R2CORBA
425
425
  ARGV.options do |opts|
426
426
  opts.banner = "Usage: #{script_name} start [options]"
427
427
 
428
- opts.separator ""
428
+ opts.separator ''
429
429
 
430
- opts.on("-i FILE", "--ior=FILE", String,
431
- "Specifies filename (incl. path) to write IOR to.",
432
- "Default: ./ins.ior") { |v| OPTIONS[:iorfile] = v }
430
+ opts.on('-i FILE', '--ior=FILE', String,
431
+ 'Specifies filename (incl. path) to write IOR to.',
432
+ 'Default: ./ins.ior') { |v| OPTIONS[:iorfile] = v }
433
433
  unless IS_WIN32
434
- opts.on("-p DIR", "--pid=DIR", String,
435
- "Specifies path to write pidfile to.",
436
- "Default: ./") { |v| OPTIONS[:piddir] = v }
434
+ opts.on('-p DIR', '--pid=DIR', String,
435
+ 'Specifies path to write pidfile to.',
436
+ 'Default: ./') { |v| OPTIONS[:piddir] = v }
437
437
  unless IS_JRUBY
438
- opts.on("-o DIR", "--output=DIR", String,
439
- "Specifies filename to write logfile to.",
440
- "Default: <piddir>") { |v| OPTIONS[:logdir] = v }
438
+ opts.on('-o DIR', '--output=DIR', String,
439
+ 'Specifies filename to write logfile to.',
440
+ 'Default: <piddir>') { |v| OPTIONS[:logdir] = v }
441
441
  end
442
442
  else
443
- opts.on("-o DIR", "--output=DIR", String,
444
- "Specifies path to write logfile to.",
445
- "Default: ./") { |v| OPTIONS[:logdir] = v }
443
+ opts.on('-o DIR', '--output=DIR', String,
444
+ 'Specifies path to write logfile to.',
445
+ 'Default: ./') { |v| OPTIONS[:logdir] = v }
446
446
  end
447
- opts.on("-l PORTNUM", "--listen=PORTNUM", Integer,
448
- "Specifies port number for service endpoint.",
449
- "Default: none") { |v| OPTIONS[:port] = v }
447
+ opts.on('-l PORTNUM', '--listen=PORTNUM', Integer,
448
+ 'Specifies port number for service endpoint.',
449
+ 'Default: none') { |v| OPTIONS[:port] = v }
450
450
  if IS_JRUBY or R2CORBA::TAO::RUBY_THREAD_SUPPORT
451
- opts.on("-t THREADNUM", "--threads=THREADNUM", Integer,
452
- "Specifies (minimum) number of threads for service.",
453
- "Default: 5") { |v| OPTIONS[:threads] = v }
451
+ opts.on('-t THREADNUM', '--threads=THREADNUM', Integer,
452
+ 'Specifies (minimum) number of threads for service.',
453
+ 'Default: 5') { |v| OPTIONS[:threads] = v }
454
454
  end
455
455
 
456
456
  unless IS_JRUBY || !INS.daemons_installed
457
- opts.on("-d", "--daemon",
458
- "Run as daemon.",
459
- "Default: off") { |v| OPTIONS[:daemon] = v }
457
+ opts.on('-d', '--daemon',
458
+ 'Run as daemon.',
459
+ 'Default: off') { |v| OPTIONS[:daemon] = v }
460
460
  end
461
- opts.on("-v", "--verbose",
462
- "Run verbose.",
463
- "Default: off") { |v| OPTIONS[:verbose] = v }
461
+ opts.on('-v', '--verbose',
462
+ 'Run verbose.',
463
+ 'Default: off') { |v| OPTIONS[:verbose] = v }
464
464
 
465
- opts.on("--debug=LVL", Integer,
466
- "Specifies debug level.",
467
- "Default: 0") { |v| OPTIONS[:debug] = v }
465
+ opts.on('--debug=LVL', Integer,
466
+ 'Specifies debug level.',
467
+ 'Default: 0') { |v| OPTIONS[:debug] = v }
468
468
 
469
- opts.separator ""
469
+ opts.separator ''
470
470
 
471
- opts.on("-h", "--help",
472
- "Show this help message.") { puts opts; puts; exit }
471
+ opts.on('-h', '--help',
472
+ 'Show this help message.') { puts opts; puts; exit }
473
473
 
474
474
  opts.parse!
475
475
  end
@@ -478,28 +478,28 @@ module R2CORBA
478
478
  ARGV.options do |opts|
479
479
  opts.banner = "Usage: #{script_name} stop [options]"
480
480
 
481
- opts.separator ""
481
+ opts.separator ''
482
482
 
483
483
  unless IS_WIN32
484
- opts.on("-p DIR", "--pid=DIR", String,
485
- "Specifies path where pidfile is stored.",
486
- "Default: ./") { |v| OPTIONS[:piddir] = v }
484
+ opts.on('-p DIR', '--pid=DIR', String,
485
+ 'Specifies path where pidfile is stored.',
486
+ 'Default: ./') { |v| OPTIONS[:piddir] = v }
487
487
  end
488
488
 
489
489
  unless @@command == 'status'
490
490
  OPTIONS[:daemon] = true unless IS_JRUBY || !INS.daemons_installed
491
- opts.on("--[no-]daemon",
492
- "Do not run in daemon mode.",
491
+ opts.on('--[no-]daemon',
492
+ 'Do not run in daemon mode.',
493
493
  "Default: #{OPTIONS[:daemon] ? 'on' : 'off'}") { |v| OPTIONS[:daemon] = v }
494
494
  end
495
- opts.on("-v", "--verbose",
496
- "Run verbose.",
497
- "Default: off") { |v| OPTIONS[:verbose] = v }
495
+ opts.on('-v', '--verbose',
496
+ 'Run verbose.',
497
+ 'Default: off') { |v| OPTIONS[:verbose] = v }
498
498
 
499
- opts.separator ""
499
+ opts.separator ''
500
500
 
501
- opts.on("-h", "--help",
502
- "Show this help message.") { puts opts; puts; exit }
501
+ opts.on('-h', '--help',
502
+ 'Show this help message.') { puts opts; puts; exit }
503
503
 
504
504
  opts.parse!
505
505
  end
@@ -92,9 +92,9 @@ module R2CORBA
92
92
  end
93
93
 
94
94
  def run
95
- STDERR.puts "INS - starting service run" if @options[:verbose]
95
+ STDERR.puts 'INS - starting service run' if @options[:verbose]
96
96
  if defined?(JRUBY_VERSION) or !R2CORBA::TAO::RUBY_THREAD_SUPPORT
97
- STDERR.puts "INS - running ORB" if @options[:verbose]
97
+ STDERR.puts 'INS - running ORB' if @options[:verbose]
98
98
  @orb.run
99
99
  else
100
100
  STDERR.puts "INS - starting #{@options[:threads]} ORB threads" if @options[:verbose]
@@ -102,16 +102,16 @@ module R2CORBA
102
102
  @options[:threads].times do
103
103
  @threads << Thread.new(@orb) { |orb| orb.run }
104
104
  end
105
- STDERR.puts "INS - joining ORB threads" if @options[:verbose]
105
+ STDERR.puts 'INS - joining ORB threads' if @options[:verbose]
106
106
  @threads.each { |t| t.join }
107
107
  end
108
- STDERR.puts "INS - service run ended" if @options[:verbose]
108
+ STDERR.puts 'INS - service run ended' if @options[:verbose]
109
109
  end
110
110
 
111
111
  def shutdown
112
- STDERR.puts "INS - shutting down ORB" if @options[:verbose]
112
+ STDERR.puts 'INS - shutting down ORB' if @options[:verbose]
113
113
  @orb.shutdown if @orb
114
- STDERR.puts "INS - shutdown finished" if @options[:verbose]
114
+ STDERR.puts 'INS - shutdown finished' if @options[:verbose]
115
115
  end
116
116
  end
117
117
  end
@@ -14,14 +14,17 @@ module IDL
14
14
 
15
15
  class StrOStream
16
16
  def initialize()
17
- @str = ""
17
+ @str = ''
18
18
  end
19
+
19
20
  def clear
20
- @str = ""
21
+ @str = ''
21
22
  end
23
+
22
24
  def to_s
23
25
  @str
24
26
  end
27
+
25
28
  def <<(s)
26
29
  @str << s
27
30
  end
@@ -43,6 +46,7 @@ module IDL
43
46
  end
44
47
  opts
45
48
  end
49
+
46
50
  def RIDL.parse0(src, params)
47
51
  params = merge_params(params)
48
52
  IDL.verbose_level = params[:verbose]
@@ -53,12 +57,13 @@ module IDL
53
57
  IDL::Ruby.process_input(parser, params, s)
54
58
  s
55
59
  end
60
+
56
61
  def RIDL.parse(src, params)
57
62
  s = parse0(src, params)
58
63
  s.to_s
59
64
  end
60
65
  public
61
- def RIDL.eval(src, params={})
66
+ def RIDL.eval(src, params = {})
62
67
  params[:idl_eval] = true
63
68
  params[:expand_includes] = true
64
69
  params[:client_stubs] = true if params[:client_stubs].nil?
@@ -67,16 +72,18 @@ module IDL
67
72
  Kernel.eval(s.to_s, ::TOPLEVEL_BINDING)
68
73
  s = nil
69
74
  end
75
+
70
76
  def RIDL.fparse(fname, params = {})
71
77
  params[:client_stubs] = true if params[:client_stubs].nil?
72
78
  params[:stubs_only] ||= false
73
- f = File.open(fname, "r")
79
+ f = File.open(fname, 'r')
74
80
  self.parse(f, params)
75
81
  ensure
76
82
  f.close
77
83
  end
84
+
78
85
  def RIDL.feval(fname, params = {})
79
- File.open(fname, "r") { |io| self.eval(io, params) }
86
+ File.open(fname, 'r') { |io| self.eval(io, params) }
80
87
  end
81
88
  end # module RIDL
82
89
 
@@ -108,7 +115,7 @@ module IDL
108
115
  # ruby specific option switches
109
116
 
110
117
  unless ridl_params[:preprocess] # same switch defined for IDL preprocessing mode
111
- optlist.for_switch "--output=FILE", :type => String,
118
+ optlist.for_switch '--output=FILE', :type => String,
112
119
  :description => ['Specifies filename to generate output in.',
113
120
  'Default: File.basename(idlfile, \'.idl\')+<postfix>+<ext>'] do |swcfg|
114
121
  swcfg.on_exec do |arg, params|
@@ -119,23 +126,23 @@ module IDL
119
126
  end
120
127
 
121
128
  optlist.for_switch '-o PATH', :type => String,
122
- :description => ["Specifies output directory.",
123
- "Default: ./"] do |swcfg|
129
+ :description => ['Specifies output directory.',
130
+ 'Default: ./'] do |swcfg|
124
131
  swcfg.on_exec do |arg, params|
125
132
  params[:outputdir] = arg
126
133
  end
127
134
  end
128
135
  optlist.for_switch '--stubs-only',
129
- :description => ["Only generate client stubs, no servant code.",
130
- "Default: off"] do |swcfg|
136
+ :description => ['Only generate client stubs, no servant code.',
137
+ 'Default: off'] do |swcfg|
131
138
  swcfg.on_exec do |arg, params|
132
139
  params[:client_stubs] = true
133
140
  params[:stubs_only] = true
134
141
  end
135
142
  end
136
143
  optlist.for_switch '--no-stubs',
137
- :description => ["Do not generate client stubs, only servant code.",
138
- "Default: off"] do |swcfg|
144
+ :description => ['Do not generate client stubs, only servant code.',
145
+ 'Default: off'] do |swcfg|
139
146
  swcfg.on_exec do |arg, params|
140
147
  params[:client_stubs] = false
141
148
  params[:stubs_only] = false
@@ -159,29 +166,29 @@ module IDL
159
166
  end
160
167
 
161
168
  optlist.for_switch '--skel-directory=PATH', :type => String,
162
- :description => ["Specifies output directory for servant files.",
163
- "Default: outputdir or ./"] do |swcfg|
169
+ :description => ['Specifies output directory for servant files.',
170
+ 'Default: outputdir or ./'] do |swcfg|
164
171
  swcfg.on_exec do |arg, params|
165
172
  params[:skel_outputdir] = arg
166
173
  end
167
174
  end
168
175
  optlist.for_switch '--expand-includes',
169
- :description => ["Generate code for included IDL inline.",
170
- "Default: off"] do |swcfg|
176
+ :description => ['Generate code for included IDL inline.',
177
+ 'Default: off'] do |swcfg|
171
178
  swcfg.on_exec do |arg, params|
172
179
  params[:expand_includes] = true
173
180
  end
174
181
  end
175
182
  optlist.for_switch '--no-libinit',
176
- :description => ["Do not generate library initialization code as preamble.",
177
- "Default: on"] do |swcfg|
183
+ :description => ['Do not generate library initialization code as preamble.',
184
+ 'Default: on'] do |swcfg|
178
185
  swcfg.on_exec do |arg, params|
179
186
  params[:libinit] = false
180
187
  end
181
188
  end
182
189
  optlist.for_switch '--interface-as-class=INTF', :type => String,
183
- :description => ["Generate a Ruby class for interface INTF instead of a module in client stubs.",
184
- "Default: module"] do |swcfg|
190
+ :description => ['Generate a Ruby class for interface INTF instead of a module in client stubs.',
191
+ 'Default: module'] do |swcfg|
185
192
  swcfg.on_exec do |arg, params|
186
193
  params[:class_interfaces] << arg
187
194
  end
@@ -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,7 +80,7 @@ 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)
@@ -84,7 +89,7 @@ module IDL
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
@@ -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
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,20 +508,20 @@ 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)')
@@ -535,13 +544,13 @@ module IDL
535
544
  printi("self._invoke('#{node.name}', {")
536
545
  end
537
546
 
538
- newln = ""
547
+ newln = ''
539
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
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,9 +612,9 @@ 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)')
@@ -615,19 +624,19 @@ module IDL
615
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")
667
+ printi(':result_type => CORBA._tc_void')
659
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,26 +695,26 @@ 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
@@ -719,22 +728,22 @@ module IDL
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,66 +840,68 @@ 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
907
  if struct_members_.size > 0
@@ -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
951
  if node.members.size > 0
938
- pfx = " ["
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
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
@@ -1126,7 +1140,7 @@ module IDL
1126
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,8 +1156,8 @@ 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)
@@ -1152,7 +1166,7 @@ module IDL
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,27 +1200,28 @@ 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
1227
  if node.bases.size > 0
@@ -1212,11 +1229,11 @@ module IDL
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 = ""
1284
+ newln = ''
1267
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
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
 
@@ -1340,15 +1358,15 @@ module IDL
1340
1358
  nest {
1341
1359
  printiln(":result_type => #{get_typecode(node.idltype)},")
1342
1360
  if node.get_raises.size > 0
1343
- printi(":exc_list => [")
1344
- pfx = ""
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,")
1394
+ printiln(':result_type => CORBA._tc_void,')
1377
1395
  if node.set_raises.size > 0
1378
- printi(":exc_list => [")
1379
- pfx = ""
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