r2corba 1.5.1-x64-mingw32 → 1.6.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +5 -5
- data/README.rdoc +62 -0
- data/THANKS +4 -4
- data/lib/corba/cbase/IORMap.rb +0 -1
- data/lib/corba/cbase/ORB.rb +26 -24
- data/lib/corba/cbase/Request.rb +4 -5
- data/lib/corba/cbase/Streams.rb +2 -3
- data/lib/corba/cbase/Stub.rb +0 -1
- data/lib/corba/cbase/Typecode.rb +6 -7
- data/lib/corba/cbase/Values.rb +4 -3
- data/lib/corba/cbase/exception.rb +6 -5
- data/lib/corba/cbase/poa.rb +1 -2
- data/lib/corba/cbase/policies.rb +3 -4
- data/lib/corba/cbase/post_require.rb +1 -2
- data/lib/corba/cbase/require.rb +10 -2
- data/lib/corba/cmds/base.rb +1 -2
- data/lib/corba/cmds/test.rb +0 -1
- data/lib/corba/common/Any.rb +3 -3
- data/lib/corba/common/IDL.rb +6 -10
- data/lib/corba/common/ORB.rb +22 -23
- data/lib/corba/common/Object.rb +18 -15
- data/lib/corba/common/Request.rb +1 -2
- data/lib/corba/common/Servant.rb +4 -5
- data/lib/corba/common/Struct.rb +1 -2
- data/lib/corba/common/Stub.rb +6 -7
- data/lib/corba/common/Typecode.rb +91 -65
- data/lib/corba/common/Union.rb +6 -2
- data/lib/corba/common/Values.rb +2 -2
- data/lib/corba/common/const.rb +2 -3
- data/lib/corba/common/exception.rb +2 -2
- data/lib/corba/common/require.rb +8 -1
- data/lib/corba/common/version.rb +3 -4
- data/lib/corba/idl/BiDirPolicyC.rb +2 -3
- data/lib/corba/idl/CosNamingC.rb +4 -5
- data/lib/corba/idl/CosNamingS.rb +2 -3
- data/lib/corba/idl/IDL.rb +1 -2
- data/lib/corba/idl/IORTable.pidl +0 -1
- data/lib/corba/idl/IORTableC.rb +2 -3
- data/lib/corba/idl/MessagingC.rb +2 -3
- data/lib/corba/idl/POAC.rb +10 -11
- data/lib/corba/idl/TAO_Ext.pidl +0 -1
- data/lib/corba/idl/TAO_ExtC.rb +2 -3
- data/lib/corba/idl/r2c_orb.rb +5 -6
- data/lib/corba/idl/require.rb +0 -1
- data/lib/corba/jbase/Any.rb +29 -28
- data/lib/corba/jbase/IORMap.rb +1 -2
- data/lib/corba/jbase/ORB.rb +5 -6
- data/lib/corba/jbase/Object.rb +13 -14
- data/lib/corba/jbase/Request.rb +9 -10
- data/lib/corba/jbase/Servant.rb +11 -12
- data/lib/corba/jbase/ServerRequest.rb +8 -9
- data/lib/corba/jbase/Streams.rb +68 -5
- data/lib/corba/jbase/Stub.rb +0 -1
- data/lib/corba/jbase/Typecode.rb +17 -17
- data/lib/corba/jbase/Values.rb +2 -1
- data/lib/corba/jbase/exception.rb +2 -2
- data/lib/corba/jbase/poa.rb +21 -22
- data/lib/corba/jbase/policies.rb +33 -34
- data/lib/corba/jbase/post_require.rb +0 -1
- data/lib/corba/jbase/require.rb +5 -2
- data/lib/corba/naming.rb +0 -1
- data/lib/corba/naming_service.rb +0 -1
- data/lib/corba/poa.rb +1 -2
- data/lib/corba/policies.rb +1 -2
- data/lib/corba/require.rb +2 -3
- data/lib/corba/svcs/ins/cos_naming.rb +74 -68
- data/lib/corba/svcs/ins/ins.rb +58 -59
- data/lib/corba/svcs/ins/naming_service.rb +9 -10
- data/lib/corba.rb +1 -2
- data/lib/ridlbe/ruby/config.rb +78 -74
- data/lib/ridlbe/ruby/require.rb +0 -1
- data/lib/ridlbe/ruby/walker.rb +311 -288
- data/mkrf_conf_bingem.rb +4 -6
- data/rakelib/bin.rake +2 -3
- data/rakelib/bin.rb +4 -5
- data/rakelib/build.rake +22 -22
- data/rakelib/config.rake +2 -3
- data/rakelib/config.rb +32 -34
- data/rakelib/ext.rake +18 -77
- data/rakelib/ext.rb +19 -58
- data/rakelib/ext_r2tao.rb +33 -60
- data/rakelib/gem.rake +53 -38
- data/rakelib/gem.rb +9 -10
- data/rakelib/package.rake +2 -3
- data/rakelib/test.rake +0 -1
- data/test/BiDirectional/Test.idl +0 -1
- data/test/BiDirectional/client.rb +18 -19
- data/test/BiDirectional/run_test.rb +11 -12
- data/test/BiDirectional/server.rb +21 -23
- data/test/CORBA_Services/Naming/BindingIterator/Test.idl +0 -1
- data/test/CORBA_Services/Naming/BindingIterator/client.rb +17 -18
- data/test/CORBA_Services/Naming/BindingIterator/run_test.rb +13 -14
- data/test/CORBA_Services/Naming/BindingIterator/server.rb +19 -20
- data/test/CORBA_Services/Naming/Corbaname/Test.idl +0 -1
- data/test/CORBA_Services/Naming/Corbaname/client.rb +15 -16
- data/test/CORBA_Services/Naming/Corbaname/run_test.rb +13 -14
- data/test/CORBA_Services/Naming/Corbaname/server.rb +27 -28
- data/test/CORBA_Services/Naming/Simple/Test.idl +0 -1
- data/test/CORBA_Services/Naming/Simple/client.rb +16 -17
- data/test/CORBA_Services/Naming/Simple/run_test.rb +13 -14
- data/test/CORBA_Services/Naming/Simple/server.rb +19 -20
- data/test/Collocation/Diamond.idl +0 -1
- data/test/Collocation/run_test.rb +10 -11
- data/test/Collocation/test.rb +27 -21
- data/test/Connect_Timeout/Test.idl +0 -1
- data/test/Connect_Timeout/client.rb +16 -18
- data/test/Connect_Timeout/run_test.rb +10 -11
- data/test/DII/Test.idl +0 -1
- data/test/DII/client.rb +30 -31
- data/test/DII/run_test.rb +11 -12
- data/test/DII/server.rb +16 -17
- data/test/DSI/Test.idl +0 -1
- data/test/DSI/client.rb +16 -17
- data/test/DSI/run_test.rb +11 -12
- data/test/DSI/server.rb +17 -18
- data/test/Exceptions/Test.idl +0 -1
- data/test/Exceptions/client.rb +22 -23
- data/test/Exceptions/run_test.rb +11 -12
- data/test/Exceptions/server.rb +16 -17
- data/test/Hello/Test.idl +0 -1
- data/test/Hello/client.rb +16 -17
- data/test/Hello/run_test.rb +11 -12
- data/test/Hello/server.rb +17 -18
- data/test/IDL_Test/Test.idl +4 -1
- data/test/IDL_Test/client.rb +24 -23
- data/test/IDL_Test/run_test.rb +11 -12
- data/test/IDL_Test/server.rb +23 -19
- data/test/IORMap/Test.idl +0 -1
- data/test/IORMap/client.rb +14 -15
- data/test/IORMap/run_test.rb +11 -12
- data/test/IORMap/server.rb +23 -24
- data/test/IORTable/Test.idl +0 -1
- data/test/IORTable/client.rb +14 -15
- data/test/IORTable/run_test.rb +11 -12
- data/test/IORTable/server.rb +23 -24
- data/test/Implicit_Conversion/Test.idl +0 -1
- data/test/Implicit_Conversion/client.rb +20 -18
- data/test/Implicit_Conversion/run_test.rb +11 -12
- data/test/Implicit_Conversion/server.rb +16 -17
- data/test/Multi_Threading/Multiple_ORB/Test.idl +0 -1
- data/test/Multi_Threading/Multiple_ORB/client.rb +14 -15
- data/test/Multi_Threading/Multiple_ORB/run_test.rb +12 -13
- data/test/Multi_Threading/Multiple_ORB/server.rb +17 -18
- data/test/Multi_Threading/Simple/Test.idl +0 -1
- data/test/Multi_Threading/Simple/client.rb +17 -18
- data/test/Multi_Threading/Simple/run_test.rb +11 -12
- data/test/Multi_Threading/Simple/server.rb +17 -18
- data/test/Multi_Threading/Threads/Test.idl +0 -4
- data/test/Multi_Threading/Threads/client.rb +23 -26
- data/test/Multi_Threading/Threads/run_test.rb +11 -12
- data/test/Multi_Threading/Threads/server.rb +19 -22
- data/test/Multi_Threading/Threads/watchdog.rb +16 -16
- data/test/Multiple_Servant_Interfaces/Test.idl +0 -1
- data/test/Multiple_Servant_Interfaces/client.rb +14 -15
- data/test/Multiple_Servant_Interfaces/run_test.rb +11 -12
- data/test/Multiple_Servant_Interfaces/server.rb +18 -19
- data/test/Nil/Test.idl +0 -1
- data/test/Nil/run_test.rb +10 -11
- data/test/Nil/test.rb +22 -20
- data/test/OBV/AbstractInterface/client.rb +14 -15
- data/test/OBV/AbstractInterface/run_test.rb +11 -12
- data/test/OBV/AbstractInterface/server.rb +20 -20
- data/test/OBV/AbstractInterface/test.idl +0 -1
- data/test/OBV/Custom/OBV_impl.rb +2 -1
- data/test/OBV/Custom/client.rb +14 -15
- data/test/OBV/Custom/run_test.rb +11 -12
- data/test/OBV/Custom/server.rb +16 -17
- data/test/OBV/Simple/OBV_impl.rb +1 -1
- data/test/OBV/Simple/client.rb +14 -15
- data/test/OBV/Simple/run_test.rb +11 -12
- data/test/OBV/Simple/server.rb +16 -17
- data/test/OBV/Simple_Event/Event_impl.rb +1 -1
- data/test/OBV/Simple_Event/client.rb +14 -15
- data/test/OBV/Simple_Event/run_test.rb +11 -12
- data/test/OBV/Simple_Event/server.rb +16 -17
- data/test/OBV/Supports/client.rb +19 -20
- data/test/OBV/Supports/run_test.rb +11 -12
- data/test/OBV/Supports/server.rb +15 -16
- data/test/OBV/Supports/supports.idl +0 -1
- data/test/OBV/Supports/supports_impl.rb +3 -1
- data/test/OBV/Tree/client.rb +14 -15
- data/test/OBV/Tree/run_test.rb +11 -12
- data/test/OBV/Tree/server.rb +19 -20
- data/test/OBV/Tree/test.idl +0 -1
- data/test/OBV/Truncatable/Extra.idl +0 -1
- data/test/OBV/Truncatable/Truncatable_impl.rb +1 -2
- data/test/OBV/Truncatable/client.rb +57 -58
- data/test/OBV/Truncatable/run_test.rb +11 -12
- data/test/OBV/Truncatable/server.rb +15 -16
- data/test/OBV/ValueBox/client.rb +154 -154
- data/test/OBV/ValueBox/run_test.rb +11 -12
- data/test/OBV/ValueBox/server.rb +42 -42
- data/test/Object/Test.idl +0 -1
- data/test/Object/client.rb +15 -16
- data/test/Object/run_test.rb +11 -12
- data/test/Object/server.rb +19 -20
- data/test/POA/run_test.rb +10 -11
- data/test/POA/test.rb +17 -18
- data/test/Param_Test/client.rb +53 -54
- data/test/Param_Test/run_test.rb +11 -12
- data/test/Param_Test/server.rb +60 -61
- data/test/Performance/Simple/Test.idl +0 -1
- data/test/Performance/Simple/client.rb +16 -17
- data/test/Performance/Simple/run_test.rb +11 -12
- data/test/Performance/Simple/server.rb +16 -17
- data/test/Policies/Test.idl +0 -1
- data/test/Policies/run_test.rb +10 -11
- data/test/Policies/test.rb +23 -25
- data/test/Timeout/client.rb +21 -22
- data/test/Timeout/run_test.rb +11 -12
- data/test/Timeout/server.rb +19 -20
- data/test/Timeout/test.idl +0 -1
- data/test/lib/assert.rb +0 -2
- data/test/lib/test.rb +29 -25
- data/test/test_runner.rb +22 -24
- metadata +24 -52
- data/README +0 -62
- data/test/BiDirectional/server.ior +0 -1
- data/test/CORBA_Services/Naming/BindingIterator/ins.ior +0 -1
- data/test/CORBA_Services/Naming/Corbaname/corbaname.ior +0 -1
- data/test/CORBA_Services/Naming/Corbaname/ins.ior +0 -1
- data/test/CORBA_Services/Naming/Simple/ins.ior +0 -1
- data/test/DII/server.ior +0 -1
- data/test/DSI/server.ior +0 -1
- data/test/Exceptions/server.ior +0 -1
- data/test/IDL_Test/server.ior +0 -1
- data/test/IORMap/server.ior +0 -1
- data/test/IORTable/server.ior +0 -1
- data/test/Implicit_Conversion/server.ior +0 -1
- data/test/Multi_Threading/Multiple_ORB/server0.ior +0 -1
- data/test/Multi_Threading/Multiple_ORB/server1.ior +0 -1
- data/test/Multi_Threading/Simple/server.ior +0 -1
- data/test/Multi_Threading/Threads/server.ior +0 -1
- data/test/Multi_Threading/Threads/watchdog.ior +0 -1
- data/test/Multiple_Servant_Interfaces/server.ior +0 -1
- data/test/OBV/AbstractInterface/server.ior +0 -1
- data/test/OBV/Custom/server.ior +0 -1
- data/test/OBV/Simple/server.ior +0 -1
- data/test/OBV/Simple_Event/server.ior +0 -1
- data/test/OBV/Supports/server.ior +0 -1
- data/test/OBV/Tree/server.ior +0 -1
- data/test/OBV/Truncatable/server.ior +0 -1
- data/test/OBV/ValueBox/server.ior +0 -1
- data/test/Object/server.ior +0 -1
- data/test/Param_Test/server.ior +0 -1
- data/test/Performance/Simple/server.ior +0 -1
- data/test/Timeout/server.ior +0 -1
data/lib/ridlbe/ruby/walker.rb
CHANGED
@@ -8,11 +8,10 @@
|
|
8
8
|
# included with this program.
|
9
9
|
#
|
10
10
|
# Copyright (c) Remedy IT Expertise BV
|
11
|
-
# Chamber of commerce Rotterdam nr.276339, The Netherlands
|
12
11
|
#--------------------------------------------------------------------
|
13
12
|
module IDL
|
14
13
|
class RubyWriterBase
|
15
|
-
def initialize(output = STDOUT, params = {}, indent =
|
14
|
+
def initialize(output = STDOUT, params = {}, indent = ' ')
|
16
15
|
@output = output
|
17
16
|
@params = params
|
18
17
|
@indent = indent
|
@@ -20,12 +19,17 @@ module IDL
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def print(str); @output << str; end
|
23
|
-
|
24
|
-
def
|
25
|
-
|
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
|
+
|
26
29
|
def indent()
|
27
30
|
@indent * @nest
|
28
31
|
end
|
32
|
+
|
29
33
|
def nest(in_ = 1)
|
30
34
|
@nest += in_
|
31
35
|
begin
|
@@ -45,7 +49,7 @@ module IDL
|
|
45
49
|
end
|
46
50
|
|
47
51
|
class RubyStubWriter < RubyWriterBase
|
48
|
-
def initialize(output = STDOUT, params = {}, indent =
|
52
|
+
def initialize(output = STDOUT, params = {}, indent = ' ')
|
49
53
|
super
|
50
54
|
end
|
51
55
|
|
@@ -55,10 +59,9 @@ module IDL
|
|
55
59
|
#
|
56
60
|
# **** Code generated by the R2CORBA IDL Compiler ****
|
57
61
|
# R2CORBA has been developed by:
|
58
|
-
# Remedy IT
|
59
|
-
# Nijkerk, GLD
|
62
|
+
# Remedy IT Expertise BV
|
60
63
|
# The Netherlands
|
61
|
-
#
|
64
|
+
# https://www.remedy.nl
|
62
65
|
#
|
63
66
|
})
|
64
67
|
println("require 'corba'") if @params[:libinit]
|
@@ -77,16 +80,16 @@ module IDL
|
|
77
80
|
printiln("} ## end of '#{@params[:idlfile]}'")
|
78
81
|
end
|
79
82
|
leave_module(parser.root_namespace) unless parser.root_namespace.nil?
|
80
|
-
println(
|
83
|
+
println('# -*- END -*-')
|
81
84
|
end
|
82
85
|
|
83
86
|
def visit_include(node)
|
84
|
-
printiln(format("require '%s'", node.filename.sub(/\.[^\.]
|
87
|
+
printiln(format("require '%s'", node.filename.sub(/\.[^\.]*$/, @params[:stub_pfx])))
|
85
88
|
println()
|
86
89
|
end
|
87
90
|
|
88
91
|
def enter_include(node)
|
89
|
-
printiln(
|
92
|
+
printiln('## include')
|
90
93
|
printiln("CORBA.implement('#{node.filename}', {}, CORBA::IDL::CLIENT_STUB) {")
|
91
94
|
println()
|
92
95
|
end
|
@@ -98,10 +101,11 @@ module IDL
|
|
98
101
|
end
|
99
102
|
|
100
103
|
def enter_module(node)
|
101
|
-
printiln(
|
104
|
+
printiln('module ' + node.rubyname)
|
102
105
|
println()
|
103
106
|
@nest += 1
|
104
107
|
end
|
108
|
+
|
105
109
|
def leave_module(node)
|
106
110
|
@nest -= 1
|
107
111
|
printiln("end #of module #{node.rubyname}")
|
@@ -116,6 +120,7 @@ module IDL
|
|
116
120
|
printiln("module #{name}; end ## interface forward")
|
117
121
|
end
|
118
122
|
end
|
123
|
+
|
119
124
|
def enter_interface(node)
|
120
125
|
println
|
121
126
|
name = node.rubyname
|
@@ -135,7 +140,7 @@ module IDL
|
|
135
140
|
println()
|
136
141
|
@nest += 1
|
137
142
|
|
138
|
-
if node.bases.size>0
|
143
|
+
if node.bases.size > 0
|
139
144
|
node.bases.each do |n|
|
140
145
|
printiln("include #{n.scoped_rubyname}")
|
141
146
|
end
|
@@ -143,18 +148,18 @@ module IDL
|
|
143
148
|
end
|
144
149
|
|
145
150
|
printiln(format("Id = '%s'.freeze", node.repository_id))
|
146
|
-
printi(
|
151
|
+
printi('Ids = [ Id')
|
147
152
|
if node.is_abstract?
|
148
|
-
println(
|
153
|
+
println(',')
|
149
154
|
printi(" 'IDL:omg.org/CORBA/AbstractBase:1.0'")
|
150
155
|
end
|
151
|
-
if node.bases.size>0
|
156
|
+
if node.bases.size > 0
|
152
157
|
node.bases.each do |n|
|
153
|
-
println(
|
158
|
+
println(',')
|
154
159
|
printi(" #{n.scoped_rubyname}::Id")
|
155
160
|
end
|
156
161
|
end
|
157
|
-
println(
|
162
|
+
println(' ].freeze')
|
158
163
|
|
159
164
|
println
|
160
165
|
unless node.is_abstract?
|
@@ -164,39 +169,40 @@ module IDL
|
|
164
169
|
printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::AbstractInterface.new(Id, '%s', self); end",
|
165
170
|
node.rubyname, node.rubyname, node.rubyname))
|
166
171
|
end
|
167
|
-
printiln(
|
172
|
+
printiln('self._tc # register typecode');
|
168
173
|
|
169
174
|
println
|
170
175
|
printiln("def #{name}._narrow(obj)")
|
171
176
|
nest {
|
172
177
|
printiln('return nil if CORBA.is_nil(obj)')
|
173
178
|
if node.is_local?
|
174
|
-
printiln(
|
179
|
+
printiln('return CORBA::Stub.create_stub(obj)._unchecked_narrow!(self)')
|
175
180
|
else
|
176
|
-
printiln(
|
181
|
+
printiln('return CORBA::Stub.create_stub(obj)._narrow!(self)')
|
177
182
|
end
|
178
183
|
}
|
179
|
-
printiln(
|
184
|
+
printiln('end')
|
180
185
|
println
|
181
186
|
printiln("def #{name}._duplicate(obj)")
|
182
187
|
nest {
|
183
188
|
if node.is_local?
|
184
|
-
printiln(
|
189
|
+
printiln('obj');
|
185
190
|
else
|
186
191
|
printiln('return nil if CORBA.is_nil(obj)')
|
187
|
-
printiln(
|
192
|
+
printiln('return CORBA::Stub.create_stub(super(obj))._narrow!(self)')
|
188
193
|
end
|
189
194
|
}
|
190
|
-
printiln(
|
195
|
+
printiln('end')
|
191
196
|
println
|
192
|
-
printiln(
|
197
|
+
printiln('def _interface_repository_id')
|
193
198
|
nest {
|
194
199
|
printiln("#{node.scoped_rubyname}::Id")
|
195
200
|
}
|
196
|
-
printiln(
|
201
|
+
printiln('end')
|
197
202
|
end
|
198
203
|
println
|
199
204
|
end
|
205
|
+
|
200
206
|
def leave_interface(node)
|
201
207
|
name = node.rubyname
|
202
208
|
@nest -= 1
|
@@ -220,11 +226,11 @@ module IDL
|
|
220
226
|
end
|
221
227
|
state_members_ = node.state_members
|
222
228
|
unless state_members_.empty?
|
223
|
-
pfx =
|
229
|
+
pfx = '['
|
224
230
|
state_members_.each do |m|
|
225
|
-
println(
|
231
|
+
println(',')
|
226
232
|
printi(pfx)
|
227
|
-
pfx =
|
233
|
+
pfx = ''
|
228
234
|
if m.has_incomplete_type?
|
229
235
|
print("['#{m.rubyname}', ")
|
230
236
|
print_valuetype_typecode(m.idltype.resolved_type.node)
|
@@ -237,9 +243,9 @@ module IDL
|
|
237
243
|
print(format("['%s', %s, :%s]", m.rubyname, get_typecode(m.idltype), m.visibility))
|
238
244
|
end
|
239
245
|
end
|
240
|
-
print(
|
246
|
+
print('], self)')
|
241
247
|
else
|
242
|
-
print(
|
248
|
+
print(', self)')
|
243
249
|
end
|
244
250
|
}
|
245
251
|
end
|
@@ -248,6 +254,7 @@ module IDL
|
|
248
254
|
|
249
255
|
def declare_valuetype(node)
|
250
256
|
end
|
257
|
+
|
251
258
|
def enter_valuetype(node)
|
252
259
|
println()
|
253
260
|
name = node.rubyname
|
@@ -260,12 +267,12 @@ module IDL
|
|
260
267
|
|
261
268
|
unless node.is_abstract?
|
262
269
|
if node.is_custom?
|
263
|
-
printiln(
|
270
|
+
printiln('include CORBA::Portable::CustomValueBase')
|
264
271
|
else
|
265
|
-
printiln(
|
272
|
+
printiln('include CORBA::ValueBase')
|
266
273
|
end
|
267
274
|
else
|
268
|
-
printiln(
|
275
|
+
printiln('include CORBA::AbstractValueBase')
|
269
276
|
end
|
270
277
|
|
271
278
|
unless node.is_abstract?
|
@@ -276,28 +283,28 @@ module IDL
|
|
276
283
|
unless trunc_ids.empty?
|
277
284
|
nest {
|
278
285
|
trunc_ids.each do |trunc_id|
|
279
|
-
println(
|
286
|
+
println(',')
|
280
287
|
printi("'#{trunc_id}'")
|
281
288
|
end
|
282
289
|
}
|
283
290
|
end
|
284
|
-
println(
|
291
|
+
println(' ].freeze')
|
285
292
|
end
|
286
293
|
|
287
294
|
println()
|
288
|
-
printiln(format(
|
295
|
+
printiln(format('def %s._tc', node.rubyname))
|
289
296
|
nest {
|
290
297
|
printi("@@tc_#{node.rubyname} ||= ")
|
291
298
|
print_valuetype_typecode(node)
|
292
299
|
println()
|
293
300
|
}
|
294
|
-
printiln(
|
295
|
-
printiln(
|
301
|
+
printiln('end')
|
302
|
+
printiln('self._tc # register typecode')
|
296
303
|
end
|
297
304
|
|
298
305
|
def leave_valuetype(node)
|
299
306
|
println()
|
300
|
-
printiln(
|
307
|
+
printiln('module Intf')
|
301
308
|
nest {
|
302
309
|
intfs_ = node.interfaces
|
303
310
|
unless intfs_.empty?
|
@@ -305,7 +312,7 @@ module IDL
|
|
305
312
|
intfs_.each do |intf|
|
306
313
|
printiln("include #{intf.scoped_rubyname}")
|
307
314
|
end
|
308
|
-
printiln(
|
315
|
+
printiln('undef :_interface_repository_id')
|
309
316
|
end
|
310
317
|
|
311
318
|
bases_ = Array.new(node.bases)
|
@@ -349,7 +356,7 @@ module IDL
|
|
349
356
|
state_members_.each do |m|
|
350
357
|
if m.visibility == :public
|
351
358
|
printiln('## public value state') unless has_type
|
352
|
-
printiln(format(
|
359
|
+
printiln(format('attr_accessor :%s', m.rubyname))
|
353
360
|
has_type = true
|
354
361
|
end
|
355
362
|
end
|
@@ -361,7 +368,7 @@ module IDL
|
|
361
368
|
printiln('## private value state')
|
362
369
|
printiln('protected')
|
363
370
|
end
|
364
|
-
printiln(format(
|
371
|
+
printiln(format('attr_accessor :%s', m.rubyname))
|
365
372
|
has_type = true
|
366
373
|
end
|
367
374
|
end
|
@@ -442,11 +449,11 @@ module IDL
|
|
442
449
|
if initializers.empty?
|
443
450
|
unless node.has_operations_or_attributes?(false)
|
444
451
|
# valuetype has only state, create the default factory
|
445
|
-
printiln(
|
452
|
+
printiln('def _create_default')
|
446
453
|
nest {
|
447
454
|
printiln("#{node.scoped_rubyname}.new")
|
448
455
|
}
|
449
|
-
printiln(
|
456
|
+
printiln('end')
|
450
457
|
end
|
451
458
|
else
|
452
459
|
println()
|
@@ -455,7 +462,7 @@ module IDL
|
|
455
462
|
nest {
|
456
463
|
printiln("raise RuntimeError, 'unimplemented local operation called'")
|
457
464
|
}
|
458
|
-
printiln(
|
465
|
+
printiln('end')
|
459
466
|
end
|
460
467
|
end
|
461
468
|
}
|
@@ -472,28 +479,28 @@ module IDL
|
|
472
479
|
println()
|
473
480
|
printiln("TRUNCATABLE_IDS = [ '#{node.repository_id}' ].freeze")
|
474
481
|
println()
|
475
|
-
printiln(format(
|
482
|
+
printiln(format('def %s._tc', node.rubyname))
|
476
483
|
nest {
|
477
484
|
printiln(format("@@tc_%s ||= CORBA::TypeCode::Valuebox.new('%s'.freeze, '%s',",
|
478
485
|
node.rubyname, node.repository_id, node.rubyname))
|
479
486
|
printiln(" #{get_typecode(node.boxed_type)}, self)")
|
480
487
|
}
|
481
|
-
printiln(
|
482
|
-
printiln(
|
483
|
-
printiln(
|
484
|
-
printiln(
|
488
|
+
printiln('end')
|
489
|
+
printiln('self._tc # register typecode');
|
490
|
+
printiln('attr_accessor :value')
|
491
|
+
printiln('def initialize(val = nil); @value = val; end')
|
485
492
|
}
|
486
493
|
printiln("end #of valuebox #{name}")
|
487
494
|
println
|
488
495
|
end
|
489
496
|
|
490
497
|
def visit_const(node)
|
491
|
-
#v = Expression::Value.new(node.idltype, node.value)
|
492
|
-
s = node.rubyname +
|
498
|
+
# v = Expression::Value.new(node.idltype, node.value)
|
499
|
+
s = node.rubyname + ' = ' + expression_to_s(node.expression)
|
493
500
|
printiln(s)
|
494
501
|
end
|
495
502
|
|
496
|
-
def visit_operation(node, from_valuetype=false)
|
503
|
+
def visit_operation(node, from_valuetype = false)
|
497
504
|
_parm = node.params
|
498
505
|
_in = node.in_params
|
499
506
|
_out = node.out_params
|
@@ -501,27 +508,27 @@ module IDL
|
|
501
508
|
|
502
509
|
println()
|
503
510
|
printi("def #{node.rubyname}(")
|
504
|
-
print(
|
511
|
+
print(_in.collect{ |p| p.rubyname }.join(', '))
|
505
512
|
if node.oneway
|
506
|
-
println(
|
513
|
+
println(') # oneway')
|
507
514
|
else
|
508
|
-
println(
|
515
|
+
println(')')
|
509
516
|
end
|
510
517
|
|
511
518
|
nest do
|
512
519
|
if _intf.is_a?(IDL::AST::Valuetype) or from_valuetype
|
513
520
|
printiln("raise RuntimeError, 'unimplemented local operation called'")
|
514
521
|
elsif _intf.is_local?
|
515
|
-
printiln(
|
522
|
+
printiln('raise ::CORBA::NO_IMPLEMENT.new(')
|
516
523
|
printiln(" 'unimplemented operation on local interface',")
|
517
|
-
printiln(
|
524
|
+
printiln(' 1, ::CORBA::COMPLETED_NO)')
|
518
525
|
else
|
519
526
|
## check if this is a proper object reference
|
520
527
|
printiln('raise ::CORBA::NO_IMPLEMENT unless self.respond_to?(:_invoke, true)')
|
521
528
|
|
522
529
|
## validate data for IN/INOUT args
|
523
530
|
##
|
524
|
-
if _parm.size>0
|
531
|
+
if _parm.size > 0
|
525
532
|
_parm.each do |p|
|
526
533
|
if p.attribute != IDL::AST::Parameter::OUT
|
527
534
|
printiln("#{p.rubyname} = #{get_typecode(p.idltype)}.validate(#{p.rubyname})")
|
@@ -537,13 +544,13 @@ module IDL
|
|
537
544
|
printi("self._invoke('#{node.name}', {")
|
538
545
|
end
|
539
546
|
|
540
|
-
newln =
|
541
|
-
if _parm.size>0
|
547
|
+
newln = ''
|
548
|
+
if _parm.size > 0
|
542
549
|
println(newln)
|
543
550
|
nest do
|
544
|
-
printi(
|
551
|
+
printi(':arg_list => [')
|
545
552
|
nest {
|
546
|
-
pfx =
|
553
|
+
pfx = ''
|
547
554
|
_parm.each do |p|
|
548
555
|
println(pfx)
|
549
556
|
printi("['#{p.rubyname}', #{get_arg_type(p.attribute)}, ");
|
@@ -551,39 +558,39 @@ module IDL
|
|
551
558
|
if p.attribute != IDL::AST::Parameter::OUT
|
552
559
|
print(", #{p.rubyname}]")
|
553
560
|
else
|
554
|
-
print(
|
561
|
+
print(']')
|
555
562
|
end
|
556
|
-
pfx =
|
563
|
+
pfx = ','
|
557
564
|
end
|
558
|
-
print(
|
565
|
+
print(']')
|
559
566
|
}
|
560
567
|
end
|
561
|
-
newln =
|
568
|
+
newln = ','
|
562
569
|
end
|
563
570
|
|
564
571
|
if not node.oneway
|
565
572
|
println(newln)
|
566
573
|
nest { printi(":result_type => #{get_typecode(node.idltype)}") }
|
567
|
-
newln =
|
574
|
+
newln = ','
|
568
575
|
end
|
569
576
|
|
570
|
-
if node.raises.size>0
|
577
|
+
if node.raises.size > 0
|
571
578
|
println(newln)
|
572
579
|
nest {
|
573
|
-
printi(
|
574
|
-
pfx =
|
580
|
+
printi(':exc_list => [')
|
581
|
+
pfx = ''
|
575
582
|
nest {
|
576
583
|
node.raises.each { |ex|
|
577
584
|
println(pfx)
|
578
|
-
pfx =
|
585
|
+
pfx = ','
|
579
586
|
printi(get_typecode(ex))
|
580
587
|
}
|
581
|
-
print(
|
588
|
+
print(']')
|
582
589
|
}
|
583
590
|
}
|
584
591
|
end
|
585
592
|
|
586
|
-
println(
|
593
|
+
println('})')
|
587
594
|
|
588
595
|
if not node.oneway
|
589
596
|
returns_void = (node.idltype.is_a? Type::Void)
|
@@ -597,7 +604,7 @@ module IDL
|
|
597
604
|
printiln("end #of operation #{node.rubyname}")
|
598
605
|
end
|
599
606
|
|
600
|
-
def visit_attribute(node, from_valuetype=false)
|
607
|
+
def visit_attribute(node, from_valuetype = false)
|
601
608
|
_intf = node.enclosure
|
602
609
|
println()
|
603
610
|
printiln("def #{node.rubyname}()")
|
@@ -605,31 +612,31 @@ module IDL
|
|
605
612
|
if _intf.is_a?(IDL::AST::Valuetype) or from_valuetype
|
606
613
|
printiln("@#{node.name}")
|
607
614
|
elsif _intf.is_local?
|
608
|
-
printiln(
|
615
|
+
printiln('raise ::CORBA::NO_IMPLEMENT.new(')
|
609
616
|
printiln(" 'unimplemented attribute on local interface',")
|
610
|
-
printiln(
|
617
|
+
printiln(' 1, ::CORBA::COMPLETED_NO)')
|
611
618
|
else
|
612
619
|
## check if this is a proper object reference
|
613
620
|
printiln('raise ::CORBA::NO_IMPLEMENT unless self.respond_to?(:_invoke, true)')
|
614
621
|
|
615
622
|
printiln("_ret = self._invoke('_get_#{node.name}', {")
|
616
623
|
nest { printi(":result_type => #{get_typecode(node.idltype)}") }
|
617
|
-
if node.get_raises.size>0
|
624
|
+
if node.get_raises.size > 0
|
618
625
|
println(',')
|
619
626
|
nest {
|
620
|
-
printi(
|
621
|
-
pfx =
|
627
|
+
printi(':exc_list => [')
|
628
|
+
pfx = ''
|
622
629
|
nest {
|
623
630
|
node.get_raises.each { |ex|
|
624
631
|
println(pfx)
|
625
|
-
pfx =
|
632
|
+
pfx = ','
|
626
633
|
printi(get_typecode(ex))
|
627
634
|
}
|
628
|
-
print(
|
635
|
+
print(']')
|
629
636
|
}
|
630
637
|
}
|
631
638
|
end
|
632
|
-
println(
|
639
|
+
println('})')
|
633
640
|
|
634
641
|
printiln('_ret')
|
635
642
|
end
|
@@ -641,9 +648,9 @@ module IDL
|
|
641
648
|
if _intf.is_a?(IDL::AST::Valuetype) or from_valuetype
|
642
649
|
printiln("@#{node.name} = val")
|
643
650
|
elsif _intf.is_local?
|
644
|
-
printiln(
|
651
|
+
printiln('raise ::CORBA::NO_IMPLEMENT.new(')
|
645
652
|
printiln(" 'unimplemented attribute on local interface',")
|
646
|
-
printiln(
|
653
|
+
printiln(' 1, ::CORBA::COMPLETED_NO)')
|
647
654
|
else
|
648
655
|
## check if this is a proper object reference
|
649
656
|
printiln('raise ::CORBA::NO_IMPLEMENT unless self.respond_to?(:_invoke, true)')
|
@@ -653,25 +660,25 @@ module IDL
|
|
653
660
|
## invoke operation
|
654
661
|
printiln("self._invoke('_set_#{node.name}', {")
|
655
662
|
nest {
|
656
|
-
printiln(
|
663
|
+
printiln(':arg_list => [')
|
657
664
|
nest {
|
658
665
|
printiln("['val', CORBA::ARG_IN, #{get_typecode(node.idltype)}, val]],");
|
659
666
|
}
|
660
|
-
printi(
|
661
|
-
if node.set_raises.size>0
|
667
|
+
printi(':result_type => CORBA._tc_void')
|
668
|
+
if node.set_raises.size > 0
|
662
669
|
println(',')
|
663
|
-
printi(
|
664
|
-
pfx =
|
670
|
+
printi(':exc_list => [')
|
671
|
+
pfx = ''
|
665
672
|
nest {
|
666
673
|
node.set_raises.each { |ex|
|
667
674
|
println(pfx)
|
668
|
-
pfx =
|
675
|
+
pfx = ','
|
669
676
|
printi(get_typecode(ex))
|
670
677
|
}
|
671
|
-
print(
|
678
|
+
print(']')
|
672
679
|
}
|
673
680
|
end
|
674
|
-
println(
|
681
|
+
println('})')
|
675
682
|
}
|
676
683
|
end
|
677
684
|
end
|
@@ -688,70 +695,70 @@ module IDL
|
|
688
695
|
Type::Boolean, Type::Char, Type::WChar,
|
689
696
|
Type::Float, Type::Double, Type::LongDouble,
|
690
697
|
Type::Void, Type::Any
|
691
|
-
s = _type.class.name.split(
|
698
|
+
s = _type.class.name.split('::') # IDL::Type::Octet -> [IDL, Type, Octet]
|
692
699
|
s = s[s.length - 1]
|
693
700
|
s.downcase!
|
694
|
-
format(
|
701
|
+
format('CORBA._tc_%s', s)
|
695
702
|
|
696
703
|
when Type::Object
|
697
|
-
|
704
|
+
'CORBA._tc_Object'
|
698
705
|
|
699
706
|
when Type::String
|
700
707
|
if not _type.length.nil?
|
701
|
-
format(
|
708
|
+
format('CORBA::TypeCode::String.new(%d)', _type.length)
|
702
709
|
else
|
703
|
-
|
710
|
+
'CORBA._tc_string'
|
704
711
|
end
|
705
712
|
|
706
713
|
when Type::WString
|
707
714
|
if not _type.length.nil?
|
708
|
-
format(
|
715
|
+
format('CORBA::TypeCode::WString.new(%d)', _type.length)
|
709
716
|
else
|
710
|
-
|
717
|
+
'CORBA._tc_wstring'
|
711
718
|
end
|
712
719
|
|
713
720
|
when Type::ScopedName
|
714
721
|
scoped_type = _type.node.idltype
|
715
722
|
if scoped_type.is_a?(IDL::Type::Interface) && scoped_type.node.is_forward?()
|
716
723
|
node = scoped_type.node
|
717
|
-
"(CORBA::TypeCode.typecode_for_id('#{node.repository_id}') || "+
|
724
|
+
"(CORBA::TypeCode.typecode_for_id('#{node.repository_id}') || " +
|
718
725
|
"CORBA::TypeCode::ObjectRef.new('#{node.repository_id}', '#{node.rubyname}', #{node.scoped_rubyname}))"
|
719
726
|
else
|
720
727
|
_type.node.scoped_rubyname + '._tc'
|
721
728
|
end
|
722
729
|
|
723
730
|
when Type::Array
|
724
|
-
sep =
|
725
|
-
tc =
|
726
|
-
get_typecode(_type.basetype) +
|
731
|
+
sep = ''
|
732
|
+
tc = 'CORBA::TypeCode::Array.new(' +
|
733
|
+
get_typecode(_type.basetype) + ', '
|
727
734
|
_type.sizes.each do |sz|
|
728
735
|
tc += "#{sep}#{sz.to_s}"
|
729
|
-
sep =
|
736
|
+
sep = ', '
|
730
737
|
end
|
731
|
-
tc +
|
738
|
+
tc + ')'
|
732
739
|
|
733
740
|
when Type::Sequence
|
734
741
|
if _type.is_recursive?
|
735
742
|
"CORBA::TypeCode::Sequence.new(CORBA::TypeCode::Recursive.new('#{_type.basetype.resolved_type.node.repository_id}'))"
|
736
743
|
else
|
737
|
-
|
744
|
+
'CORBA::TypeCode::Sequence.new(' +
|
738
745
|
get_typecode(_type.basetype) +
|
739
|
-
if not _type.length.nil? then format(
|
746
|
+
if not _type.length.nil? then format(', %d)', _type.length) else ')' end
|
740
747
|
end
|
741
748
|
|
742
749
|
else
|
743
|
-
raise
|
750
|
+
raise "invalid type for (un)marshalling: #{_type.typename}"
|
744
751
|
end
|
745
752
|
end
|
746
753
|
|
747
754
|
def get_arg_type(_idl_argtype)
|
748
755
|
case _idl_argtype
|
749
756
|
when IDL::AST::Parameter::IN
|
750
|
-
|
757
|
+
'CORBA::ARG_IN'
|
751
758
|
when IDL::AST::Parameter::OUT
|
752
|
-
|
759
|
+
'CORBA::ARG_OUT'
|
753
760
|
else
|
754
|
-
|
761
|
+
'CORBA::ARG_INOUT'
|
755
762
|
end
|
756
763
|
end
|
757
764
|
|
@@ -764,7 +771,7 @@ module IDL
|
|
764
771
|
when Expression::ScopedName, Expression::Enumerator
|
765
772
|
exp.node.scoped_rubyname
|
766
773
|
else
|
767
|
-
raise
|
774
|
+
raise "unknown expression type: #{exp.class.name}"
|
768
775
|
end
|
769
776
|
end
|
770
777
|
|
@@ -773,7 +780,7 @@ module IDL
|
|
773
780
|
v = exp.value
|
774
781
|
case exp.idltype
|
775
782
|
when Type::Void
|
776
|
-
s =
|
783
|
+
s = 'nil'
|
777
784
|
when Type::Char
|
778
785
|
s = "'#{v.chr}'"
|
779
786
|
when Type::Integer,
|
@@ -815,13 +822,13 @@ module IDL
|
|
815
822
|
end
|
816
823
|
end).compact
|
817
824
|
s = "[#{v.join(',')}]"
|
818
|
-
#when Type::Fixed
|
819
|
-
#when Type::Any
|
820
|
-
#when Type::Object
|
825
|
+
# when Type::Fixed
|
826
|
+
# when Type::Any
|
827
|
+
# when Type::Object
|
821
828
|
when Type::ScopedName
|
822
829
|
s = value_to_s(Expression::Value.new(exp.idltype.node.idltype, v))
|
823
830
|
else
|
824
|
-
raise
|
831
|
+
raise "#{exp.typename}'s not been supported yet."
|
825
832
|
end
|
826
833
|
s
|
827
834
|
end
|
@@ -833,69 +840,71 @@ module IDL
|
|
833
840
|
when Expression::Operation::UnaryPlus
|
834
841
|
s = expression_to_s(op[0])
|
835
842
|
when Expression::Operation::UnaryMinus
|
836
|
-
s =
|
843
|
+
s = '-' + expression_to_s(op[0])
|
837
844
|
when Expression::Operation::UnaryNot
|
838
|
-
s =
|
845
|
+
s = '~' + expression_to_s(op[0])
|
839
846
|
when Expression::Operation::Or
|
840
|
-
s = expression_to_s(op[0]) +
|
847
|
+
s = expression_to_s(op[0]) + ' | ' + expression_to_s(op[1])
|
841
848
|
when Expression::Operation::And
|
842
|
-
s = expression_to_s(op[0]) +
|
849
|
+
s = expression_to_s(op[0]) + ' & ' + expression_to_s(op[1])
|
843
850
|
when Expression::Operation::LShift
|
844
|
-
s = expression_to_s(op[0]) +
|
851
|
+
s = expression_to_s(op[0]) + ' << ' + expression_to_s(op[1])
|
845
852
|
when Expression::Operation::RShift
|
846
|
-
s = expression_to_s(op[0]) +
|
853
|
+
s = expression_to_s(op[0]) + ' >> ' + expression_to_s(op[1])
|
847
854
|
when Expression::Operation::Add
|
848
|
-
s = expression_to_s(op[0]) +
|
855
|
+
s = expression_to_s(op[0]) + ' + ' + expression_to_s(op[1])
|
849
856
|
when Expression::Operation::Minus
|
850
|
-
s = expression_to_s(op[0]) +
|
857
|
+
s = expression_to_s(op[0]) + ' - ' + expression_to_s(op[1])
|
851
858
|
when Expression::Operation::Mult
|
852
|
-
s = expression_to_s(op[0]) +
|
859
|
+
s = expression_to_s(op[0]) + ' * ' + expression_to_s(op[1])
|
853
860
|
when Expression::Operation::Div
|
854
|
-
s = expression_to_s(op[0]) +
|
861
|
+
s = expression_to_s(op[0]) + ' / ' + expression_to_s(op[1])
|
855
862
|
when Expression::Operation::Mod
|
856
|
-
s = expression_to_s(op[0]) +
|
863
|
+
s = expression_to_s(op[0]) + ' % ' + expression_to_s(op[1])
|
857
864
|
else
|
858
|
-
raise
|
865
|
+
raise "unknown operation: #{exp.type.name}"
|
859
866
|
end
|
860
|
-
|
867
|
+
'(' + s + ')'
|
861
868
|
end
|
862
869
|
|
863
870
|
def declare_struct(node)
|
864
871
|
end
|
872
|
+
|
865
873
|
def enter_struct(node)
|
866
874
|
println()
|
867
875
|
name = node.rubyname
|
868
876
|
printiln("class #{name} < CORBA::Portable::Struct")
|
869
877
|
@nest += 1
|
870
878
|
end
|
879
|
+
|
871
880
|
def leave_struct(node)
|
872
|
-
tc_ = if node.is_a? IDL::AST::Exception then
|
881
|
+
tc_ = if node.is_a? IDL::AST::Exception then 'Except' else 'Struct' end
|
873
882
|
println()
|
874
|
-
printiln(format(
|
883
|
+
printiln(format('def %s._tc', node.rubyname))
|
875
884
|
struct_members_ = node.members
|
876
885
|
nest {
|
877
886
|
printi(format("@@tc_%s ||= CORBA::TypeCode::%s.new('%s'.freeze, '%s'",
|
878
887
|
node.rubyname, tc_, node.repository_id, node.rubyname))
|
879
888
|
unless struct_members_.empty?
|
880
|
-
pfx =
|
889
|
+
pfx = ' ['
|
881
890
|
struct_members_.each do |m|
|
882
|
-
println(
|
891
|
+
println(',')
|
883
892
|
printi(pfx)
|
884
|
-
pfx =
|
893
|
+
pfx = ' '
|
885
894
|
print(format("['%s', %s]", m.rubyname, get_typecode(m.idltype)))
|
886
895
|
end
|
887
|
-
println(
|
896
|
+
println('], self)')
|
888
897
|
else
|
889
|
-
println(
|
898
|
+
println(', self)')
|
890
899
|
end
|
891
900
|
}
|
892
|
-
printiln(
|
893
|
-
printiln(
|
901
|
+
printiln('end')
|
902
|
+
printiln('self._tc # register typecode');
|
894
903
|
struct_members_.each do |m|
|
895
|
-
printiln(format(
|
904
|
+
printiln(format('attr_accessor :%s', m.rubyname))
|
896
905
|
end
|
897
906
|
|
898
|
-
if struct_members_.size>0
|
907
|
+
if struct_members_.size > 0
|
899
908
|
printiln('def initialize(*param_)')
|
900
909
|
nest {
|
901
910
|
struct_members_.each do |m|
|
@@ -917,39 +926,42 @@ module IDL
|
|
917
926
|
printiln("class #{name} < CORBA::UserException")
|
918
927
|
@nest += 1
|
919
928
|
end
|
929
|
+
|
920
930
|
def leave_exception(node)
|
921
931
|
leave_struct(node)
|
922
932
|
end
|
923
933
|
|
924
934
|
def declare_union(node)
|
925
935
|
end
|
936
|
+
|
926
937
|
def enter_union(node)
|
927
938
|
println()
|
928
939
|
name = node.rubyname
|
929
940
|
printiln("class #{name} < CORBA::Portable::Union")
|
930
941
|
@nest += 1
|
931
942
|
end
|
943
|
+
|
932
944
|
def leave_union(node)
|
933
945
|
println()
|
934
|
-
printiln(format(
|
946
|
+
printiln(format('def %s._tc', node.rubyname))
|
935
947
|
nest {
|
936
948
|
printiln(format("@@tc_%s ||= CORBA::TypeCode::Union.new('%s'.freeze, '%s',",
|
937
949
|
node.rubyname, node.repository_id, node.rubyname))
|
938
950
|
printi(" #{get_typecode(node.switchtype)}")
|
939
|
-
if node.members.size>0
|
940
|
-
pfx =
|
951
|
+
if node.members.size > 0
|
952
|
+
pfx = ' ['
|
941
953
|
node.members.each do |m|
|
942
954
|
m.labels.each do |lbl|
|
943
|
-
println(
|
955
|
+
println(',')
|
944
956
|
printi(pfx)
|
945
|
-
pfx =
|
957
|
+
pfx = ' '
|
946
958
|
labeltxt = if lbl == :default then ':default'; else expression_to_s(lbl); end
|
947
959
|
print(format("[%s, '%s', %s]", labeltxt, m.rubyname, get_typecode(m.idltype)))
|
948
960
|
end
|
949
961
|
end
|
950
|
-
print(
|
962
|
+
print('], self')
|
951
963
|
else
|
952
|
-
print(
|
964
|
+
print(', self')
|
953
965
|
end
|
954
966
|
if (!node.has_default?) && node.default_label # has implicit default?
|
955
967
|
println(", #{expression_to_s(node.default_label)})")
|
@@ -957,13 +969,13 @@ module IDL
|
|
957
969
|
println(')')
|
958
970
|
end
|
959
971
|
}
|
960
|
-
printiln(
|
961
|
-
printiln(
|
972
|
+
printiln('end')
|
973
|
+
printiln('self._tc # register typecode');
|
962
974
|
ix = 0
|
963
|
-
if node.members.size>0
|
975
|
+
if node.members.size > 0
|
964
976
|
node.members.each do |m|
|
965
|
-
printiln(format(
|
966
|
-
printiln(format(
|
977
|
+
printiln(format('def %s; @value; end', m.rubyname))
|
978
|
+
printiln(format('def %s=(val); _set_value(%d, val); end', m.rubyname, ix))
|
967
979
|
ix += m.labels.size
|
968
980
|
end
|
969
981
|
end
|
@@ -979,47 +991,47 @@ module IDL
|
|
979
991
|
end
|
980
992
|
|
981
993
|
def visit_enum(node)
|
982
|
-
printiln(format(
|
994
|
+
printiln(format('class %s < ::R2CORBA::FIXNUM_KLASS', node.rubyname))
|
983
995
|
nest {
|
984
|
-
printiln(format(
|
996
|
+
printiln(format('def %s._tc', node.rubyname))
|
985
997
|
nest {
|
986
998
|
printi(format("@@tc_%s ||= CORBA::TypeCode::Enum.new('%s'.freeze, '%s', [",
|
987
999
|
node.rubyname, node.repository_id, node.rubyname))
|
988
|
-
pfx =
|
1000
|
+
pfx = ''
|
989
1001
|
node.enumerators.each { |e|
|
990
1002
|
println(pfx)
|
991
|
-
pfx =
|
1003
|
+
pfx = ','
|
992
1004
|
printi(" '#{e.rubyname}'")
|
993
1005
|
}
|
994
|
-
println(
|
1006
|
+
println('])')
|
995
1007
|
}
|
996
|
-
printiln(
|
997
|
-
printiln(
|
1008
|
+
printiln('end')
|
1009
|
+
printiln('self._tc # register typecode');
|
998
1010
|
}
|
999
|
-
printiln(format(
|
1011
|
+
printiln(format('end # enum %s', node.rubyname))
|
1000
1012
|
end
|
1001
1013
|
|
1002
1014
|
def visit_enumerator(node)
|
1003
1015
|
v = Expression::Value.new(node.idltype, node.value)
|
1004
|
-
s = node.rubyname +
|
1016
|
+
s = node.rubyname + ' = ' + expression_to_s(v)
|
1005
1017
|
printiln(s)
|
1006
1018
|
end
|
1007
1019
|
|
1008
1020
|
def visit_typedef(node)
|
1009
|
-
#tc_ = node.enclosure.rubyname + '._tc_' + node.rubyname
|
1010
|
-
#typ_ = node.enclosure.rubyname + '.' + node.rubyname
|
1021
|
+
# tc_ = node.enclosure.rubyname + '._tc_' + node.rubyname
|
1022
|
+
# typ_ = node.enclosure.rubyname + '.' + node.rubyname
|
1011
1023
|
case t = node.idltype
|
1012
1024
|
when Type::ScopedName
|
1013
1025
|
if Type::Interface === t.resolved_type
|
1014
|
-
printiln(format(
|
1026
|
+
printiln(format('%s = %s # typedef %s', node.rubyname, t.node.scoped_rubyname, node.rubyname))
|
1015
1027
|
else
|
1016
|
-
printiln(format(
|
1028
|
+
printiln(format('class %s < %s', node.rubyname, t.node.scoped_rubyname))
|
1017
1029
|
nest {
|
1018
|
-
printi(format(
|
1030
|
+
printi(format('def %s._tc; ', node.rubyname))
|
1019
1031
|
print(format("@@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s',", node.rubyname, node.repository_id, node.rubyname))
|
1020
|
-
println(format(
|
1032
|
+
println(format('%s, self); end', get_typecode(t)))
|
1021
1033
|
}
|
1022
|
-
printiln(format(
|
1034
|
+
printiln(format('end # typedef %s', node.rubyname))
|
1023
1035
|
end
|
1024
1036
|
|
1025
1037
|
when IDL::Type::Native
|
@@ -1031,18 +1043,18 @@ module IDL
|
|
1031
1043
|
Type::ULongLong, Type::LongLong,
|
1032
1044
|
Type::Boolean, Type::Char, Type::WChar,
|
1033
1045
|
Type::Float, Type::Double, Type::LongDouble
|
1034
|
-
s = t.class.name.split(
|
1046
|
+
s = t.class.name.split('::') # IDL::Type::Octet -> [IDL, Type, Octet]
|
1035
1047
|
s = s[s.length - 1]
|
1036
1048
|
s.downcase!
|
1037
|
-
printiln(format(
|
1049
|
+
printiln(format('class %s < CORBA::_tc_%s.get_type', node.rubyname, s))
|
1038
1050
|
nest {
|
1039
1051
|
printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s', CORBA::_tc_%s, self); end",
|
1040
1052
|
node.rubyname, node.rubyname, node.repository_id, node.rubyname, s))
|
1041
1053
|
}
|
1042
|
-
printiln(format(
|
1054
|
+
printiln(format('end # typedef %s', node.rubyname))
|
1043
1055
|
|
1044
1056
|
when Type::String
|
1045
|
-
printiln(format(
|
1057
|
+
printiln(format('class %s < String', node.rubyname))
|
1046
1058
|
nest {
|
1047
1059
|
if not t.length.nil?
|
1048
1060
|
printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s', CORBA::TypeCode::String.new(%d), self); end",
|
@@ -1052,10 +1064,10 @@ module IDL
|
|
1052
1064
|
node.rubyname, node.rubyname, node.repository_id, node.rubyname))
|
1053
1065
|
end
|
1054
1066
|
}
|
1055
|
-
printiln(format(
|
1067
|
+
printiln(format('end # typedef %s', node.rubyname))
|
1056
1068
|
|
1057
1069
|
when Type::WString
|
1058
|
-
printiln(format(
|
1070
|
+
printiln(format('class %s < Array', node.rubyname))
|
1059
1071
|
nest {
|
1060
1072
|
if not t.length.nil?
|
1061
1073
|
printiln(format("def %s._tc; @@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s', CORBA::TypeCode::WString.new(%d), self); end",
|
@@ -1065,45 +1077,48 @@ module IDL
|
|
1065
1077
|
node.rubyname, node.rubyname, node.repository_id, node.rubyname))
|
1066
1078
|
end
|
1067
1079
|
}
|
1068
|
-
printiln(format(
|
1080
|
+
printiln(format('end # typedef %s', node.rubyname))
|
1069
1081
|
|
1070
1082
|
when IDL::Type::Array
|
1071
|
-
printiln(format(
|
1083
|
+
printiln(format('class %s < Array', node.rubyname))
|
1072
1084
|
nest {
|
1073
|
-
printiln(format(
|
1085
|
+
printiln(format('def %s._tc', node.rubyname))
|
1074
1086
|
nest {
|
1075
1087
|
printiln(format("@@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s',", node.rubyname, node.repository_id, node.rubyname))
|
1076
|
-
nest { printiln(format(
|
1088
|
+
nest { printiln(format('%s, self)', get_typecode(t))) }
|
1077
1089
|
}
|
1078
|
-
printiln(
|
1090
|
+
printiln('end')
|
1079
1091
|
}
|
1080
|
-
printiln(format(
|
1092
|
+
printiln(format('end # typedef %s', node.rubyname))
|
1081
1093
|
|
1082
1094
|
when IDL::Type::Sequence
|
1083
1095
|
case t.basetype.resolved_type
|
1084
1096
|
when IDL::Type::Char, IDL::Type::Octet
|
1085
|
-
printiln(format(
|
1097
|
+
printiln(format('class %s < String', node.rubyname))
|
1086
1098
|
else
|
1087
|
-
printiln(format(
|
1099
|
+
printiln(format('class %s < Array', node.rubyname))
|
1088
1100
|
end
|
1089
1101
|
nest {
|
1090
|
-
printiln(format(
|
1102
|
+
printiln(format('def %s._tc', node.rubyname))
|
1091
1103
|
nest {
|
1092
1104
|
printiln(format("@@tc_%s ||= CORBA::TypeCode::Alias.new('%s', '%s',", node.rubyname, node.repository_id, node.rubyname))
|
1093
|
-
nest { printiln(format(
|
1105
|
+
nest { printiln(format('%s, self)', get_typecode(t))) }
|
1094
1106
|
}
|
1095
|
-
printiln(
|
1107
|
+
printiln('end')
|
1096
1108
|
}
|
1097
|
-
printiln(format(
|
1109
|
+
printiln(format('end # typedef %s', node.rubyname))
|
1110
|
+
|
1111
|
+
when IDL::Type::Object
|
1112
|
+
printiln(format("%s = CORBA::Object # typedef %s\n", node.rubyname, node.rubyname))
|
1098
1113
|
|
1099
1114
|
else
|
1100
|
-
raise
|
1115
|
+
raise "unsupported typedef for #{t.class.name}."
|
1101
1116
|
end
|
1102
1117
|
end
|
1103
1118
|
end ## RubyStubWriter
|
1104
1119
|
|
1105
1120
|
class RubyServantWriter < RubyWriterBase
|
1106
|
-
def initialize(output = STDOUT, params = {}, indent =
|
1121
|
+
def initialize(output = STDOUT, params = {}, indent = ' ')
|
1107
1122
|
super
|
1108
1123
|
@stub_root = '::'
|
1109
1124
|
end
|
@@ -1114,19 +1129,18 @@ module IDL
|
|
1114
1129
|
#
|
1115
1130
|
# **** Code generated by the R2CORBA IDL Compiler ****
|
1116
1131
|
# R2CORBA has been developed by:
|
1117
|
-
# Remedy IT
|
1118
|
-
# Nijkerk, GLD
|
1132
|
+
# Remedy IT Expertise BV
|
1119
1133
|
# The Netherlands
|
1120
|
-
#
|
1134
|
+
# https://www.remedy.nl
|
1121
1135
|
#
|
1122
1136
|
})
|
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 '"
|
1140
|
+
println("require '" + @params[:idlfile].sub(/\.[^\.]*$/, @params[:stub_pfx]) + "'")
|
1127
1141
|
end
|
1128
1142
|
println()
|
1129
|
-
printiln(
|
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(
|
1146
|
-
println(
|
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(/\.[^\.]
|
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(
|
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(
|
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(
|
1203
|
+
printiln('module Intf')
|
1188
1204
|
@nest += 1
|
1189
1205
|
printiln(format("Id = '%s'.freeze", node.repository_id))
|
1190
|
-
printi(
|
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(
|
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(
|
1221
|
+
printiln('end #of Intf')
|
1205
1222
|
|
1206
1223
|
println()
|
1207
|
-
printiln(
|
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(
|
1232
|
+
printiln('include_interface(PortableServer::Servant::Intf)')
|
1216
1233
|
end
|
1217
1234
|
println()
|
1218
1235
|
|
1219
|
-
printiln(
|
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(
|
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(
|
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(
|
1335
|
+
print(_in.collect{ |p| p.rubyname }.join(', '))
|
1318
1336
|
if node.oneway
|
1319
|
-
println(
|
1337
|
+
println(') # oneway')
|
1320
1338
|
else
|
1321
|
-
println(
|
1339
|
+
println(')')
|
1322
1340
|
end
|
1323
1341
|
nest {
|
1324
|
-
printiln(
|
1342
|
+
printiln('raise ::CORBA::NO_IMPLEMENT.new(')
|
1325
1343
|
printiln(" 'unimplemented servant operation',")
|
1326
|
-
printiln(
|
1344
|
+
printiln(' 1, ::CORBA::COMPLETED_NO)')
|
1327
1345
|
}
|
1328
|
-
printiln(
|
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(
|
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(
|
1379
|
+
printiln('raise ::CORBA::NO_IMPLEMENT.new(')
|
1362
1380
|
printiln(" 'unimplemented servant attribute get',")
|
1363
|
-
printiln(
|
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(
|
1390
|
+
printiln(':arg_list => [')
|
1373
1391
|
nest {
|
1374
1392
|
printiln("['val', CORBA::ARG_IN, #{get_typecode(node.idltype)}]],");
|
1375
1393
|
}
|
1376
|
-
printiln(
|
1377
|
-
if node.set_raises.size>0
|
1378
|
-
printi(
|
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(
|
1414
|
+
printiln('raise ::CORBA::NO_IMPLEMENT.new(')
|
1397
1415
|
printiln(" 'unimplemented servant attribute set',")
|
1398
|
-
printiln(
|
1416
|
+
printiln(' 1, ::CORBA::COMPLETED_NO)')
|
1399
1417
|
}
|
1400
1418
|
printiln("end #of attribute set_#{node.name}")
|
1401
1419
|
println()
|
@@ -1411,64 +1429,64 @@ 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(
|
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(
|
1435
|
+
format('CORBA._tc_%s', s)
|
1418
1436
|
|
1419
1437
|
when Type::Object
|
1420
|
-
|
1438
|
+
'CORBA._tc_Object'
|
1421
1439
|
|
1422
1440
|
when Type::String
|
1423
1441
|
if not _type.length.nil?
|
1424
|
-
format(
|
1442
|
+
format('CORBA::TypeCode::String.new(%d)', _type.length)
|
1425
1443
|
else
|
1426
|
-
|
1444
|
+
'CORBA._tc_string'
|
1427
1445
|
end
|
1428
1446
|
|
1429
1447
|
when Type::WString
|
1430
1448
|
if not _type.length.nil?
|
1431
|
-
format(
|
1449
|
+
format('CORBA::TypeCode::WString.new(%d)', _type.length)
|
1432
1450
|
else
|
1433
|
-
|
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 =
|
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
|
-
|
1471
|
+
'CORBA::TypeCode::Sequence.new(' +
|
1454
1472
|
get_typecode(_type.basetype) +
|
1455
|
-
if not _type.length.nil? then format(
|
1456
|
-
|
1473
|
+
if not _type.length.nil? then format(', %d)', _type.length) else ')' end +
|
1474
|
+
'.freeze'
|
1457
1475
|
end
|
1458
1476
|
|
1459
1477
|
else
|
1460
|
-
raise
|
1478
|
+
raise "invalid type for (un)marshalling: #{_type.typename}"
|
1461
1479
|
end
|
1462
1480
|
end
|
1463
1481
|
|
1464
1482
|
def get_arg_type(_idl_argtype)
|
1465
1483
|
case _idl_argtype
|
1466
1484
|
when IDL::AST::Parameter::IN
|
1467
|
-
|
1485
|
+
'CORBA::ARG_IN'
|
1468
1486
|
when IDL::AST::Parameter::OUT
|
1469
|
-
|
1487
|
+
'CORBA::ARG_OUT'
|
1470
1488
|
else
|
1471
|
-
|
1489
|
+
'CORBA::ARG_INOUT'
|
1472
1490
|
end
|
1473
1491
|
end
|
1474
1492
|
|
@@ -1481,7 +1499,7 @@ module IDL
|
|
1481
1499
|
when Expression::ScopedName
|
1482
1500
|
@stub_root + exp.node.scoped_rubyname
|
1483
1501
|
else
|
1484
|
-
raise
|
1502
|
+
raise "unknown expression type: #{exp.class.name}"
|
1485
1503
|
end
|
1486
1504
|
end
|
1487
1505
|
|
@@ -1490,7 +1508,7 @@ module IDL
|
|
1490
1508
|
v = exp.value
|
1491
1509
|
case exp.idltype
|
1492
1510
|
when Type::Void
|
1493
|
-
s =
|
1511
|
+
s = 'nil'
|
1494
1512
|
when Type::Char
|
1495
1513
|
s = "'#{v.chr}'"
|
1496
1514
|
when Type::Integer,
|
@@ -1505,13 +1523,13 @@ 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
|
1514
|
-
raise
|
1532
|
+
raise "#{exp.typename}'s not been supported yet."
|
1515
1533
|
end
|
1516
1534
|
s
|
1517
1535
|
end
|
@@ -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 =
|
1544
|
+
s = '-' + expression_to_s(op[0])
|
1527
1545
|
when Expression::UnaryNot
|
1528
|
-
s =
|
1546
|
+
s = '~' + expression_to_s(op[0])
|
1529
1547
|
when Expression::Or
|
1530
|
-
s = expression_to_s(op[0]) +
|
1548
|
+
s = expression_to_s(op[0]) + ' | ' + expression_to_s(op[1])
|
1531
1549
|
when Expression::And
|
1532
|
-
s = expression_to_s(op[0]) +
|
1550
|
+
s = expression_to_s(op[0]) + ' & ' + expression_to_s(op[1])
|
1533
1551
|
when Expression::LShift
|
1534
|
-
s = expression_to_s(op[0]) +
|
1552
|
+
s = expression_to_s(op[0]) + ' << ' + expression_to_s(op[1])
|
1535
1553
|
when Expression::RShift
|
1536
|
-
s = expression_to_s(op[0]) +
|
1554
|
+
s = expression_to_s(op[0]) + ' >> ' + expression_to_s(op[1])
|
1537
1555
|
when Expression::Add
|
1538
|
-
s = expression_to_s(op[0]) +
|
1556
|
+
s = expression_to_s(op[0]) + ' + ' + expression_to_s(op[1])
|
1539
1557
|
when Expression::Minus
|
1540
|
-
s = expression_to_s(op[0]) +
|
1558
|
+
s = expression_to_s(op[0]) + ' - ' + expression_to_s(op[1])
|
1541
1559
|
when Expression::Mult
|
1542
|
-
s = expression_to_s(op[0]) +
|
1560
|
+
s = expression_to_s(op[0]) + ' * ' + expression_to_s(op[1])
|
1543
1561
|
when Expression::Div
|
1544
|
-
s = expression_to_s(op[0]) +
|
1562
|
+
s = expression_to_s(op[0]) + ' / ' + expression_to_s(op[1])
|
1545
1563
|
when Expression::Mod
|
1546
|
-
s = expression_to_s(op[0]) +
|
1564
|
+
s = expression_to_s(op[0]) + ' % ' + expression_to_s(op[1])
|
1547
1565
|
else
|
1548
|
-
raise
|
1566
|
+
raise "unknown operation: #{exp.type.name}"
|
1549
1567
|
end
|
1550
|
-
|
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
|
|