Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / IDL_Test / reopened_modules.idl
blob06167f34bb0020546ca1815dd8e651ba160d3e2a
2 //=============================================================================
3 /**
4 * @file reopened_modules.idl
6 * This file contains examples of IDL code that has
7 * caused problems in the past for the TAO IDL
8 * compiler. This test is to make sure the problems
9 * stay fixed.
12 * @author Jeff Parsons <parsons@cs.wustl.edu> and TAO users.
14 //=============================================================================
17 // These examples test the lookup abilities of the
18 // TAO IDL compiler, with reopened modules.
20 // Tests lookup function when modules are reopened by
21 // a chain of inclusions.
22 #include "reopen_include2.idl"
24 module AA
26 module BB
28 interface x1 {};
32 module AA
34 module BB
36 module CC
38 interface x2
40 // 'AA::BB::' should be implicit
41 void op1 (in x1 obj);
42 // 'AA::' should be implicit
43 void op2 (in BB::x1 obj);
44 // Just for reference
45 void op3 (in AA::BB::x1 obj);
51 // Each occurrence of Party and Person should be
52 // recognized as being in the same scope as the
53 // previous occurrence(s).
55 module dot
57 interface Party;
59 interface Person
61 attribute Party someParty;
65 module dot
67 interface Party
69 attribute Person somePerson;
73 // Should be no problem in lookup of all the
74 // arguments in Operation.
76 module Outside
78 module Reopened
80 typedef short Tricky;
83 typedef long Tricky;
85 module Reopened
87 typedef float Newdef;
91 interface OpHolder
93 void Operation (in ::Outside::Tricky p1,
94 out ::Outside::Reopened::Tricky p2,
95 inout ::Outside::Reopened::Newdef p3);
98 // This particular combination used to cause IDL compiler
99 // to go into an infinite loop looking for return type to
100 // getInfo(). Partial solution got rid of infinite loop,
101 // but erroneously returned ::com from lookup.
103 module com
105 module mr
107 typedef short info;
111 module com
113 interface IFace
115 com::mr::info getInfo ();
119 // Modules X and Y are also included from reopene_include2.idl.
120 // There were problems with the lookup of Y::Z and X::Ex.
122 module Y
124 interface Z {};
127 module X
129 exception Ex {};
131 interface BI : Y::Z
133 void method () raises (X::Ex);
137 // Reopened from reopen_include2.idl inclusion. There
138 // was a problem with the inheritance lookup.
140 module XX
142 interface blah_intfc;
144 interface blah_intfc
146 void op1 ();
149 interface blah0 : blah_intfc
151 void op0 ();
155 // Had lookup problems with the operation args and
156 // return type.
158 module frag
160 interface frag_iface {};
163 module frag
165 typedef long ret_long;
168 interface gather
170 frag::ret_long op (in frag::dub_seq inarg,
171 inout frag::pug inoutarg,
172 out frag::frag_iface outarg);
175 // Had problems with second opening of module using
176 // types declared between the openings.
178 module foo
180 typedef long longdef;
183 typedef long longdef2;
185 struct bar {short s;};
187 module foo
189 struct foo_struct
191 longdef longval;
192 longdef2 longval2;
195 interface obj
197 void op (in bar inarg);
201 module A
203 module B
205 typedef sequence<X2> X2Seq;
207 interface X3 : X1, X2
209 X2Seq getSeqOfX2 ();
210 string getX3 ();
215 // Interface B was not getting redefined, so
216 // definition of C would cause an error.
218 module mB
220 interface B;
223 module mA
225 interface A
227 attribute ::mB::B theB;
231 module mB
233 interface B : ::mA::A
235 attribute ::mA::A theA;
239 module mC
241 interface C : ::mB::B
246 // The example below uncovered errors in the logic of
247 // AST_Module::fe_add_interface_fwd() and
248 // AST_Module::add_to_previous() that were causing
249 // AST_Module::look_in_previous() (and thus lookup_by_name)
250 // to fail on the last line.
251 module Schmoik
253 interface foo
255 typedef string foo_type;
259 module Schmoik
261 interface foo;
264 module Schmoik
266 struct bar
268 foo::foo_type member;
272 // Tests forward declared interface as element type.
273 // Had to override visit_interface_fwd()
274 // for the be_visitor_sequence_base_template_args
275 // visitor to fix this. Also had to separate calls
276 // to nested_type_name() into individual insertions
277 // into the code generating stream, because of side
278 // effects.
279 module Thwoik
281 interface TestType;
284 module Thwoik
286 typedef sequence<TestType> ub_TestTypeSeq;
287 typedef sequence<TestType, 3> bd_TestTypeSeq;
290 module Thwoik
292 interface TestType {};
295 // We had a problem with the inheritance list
296 // in the declaration of A_mod::B_mod::Foo, in
297 // both stub and skeleton files.
298 module A_mod
300 interface Foo {};
302 module B_mod
304 interface Foo : A_mod::Foo {};
308 /// Similar to example at the top of this file,
309 /// but with more openings and deeper nesting.
310 module m1
312 module m2
314 module m3a
316 module m4a
318 const unsigned short FRED = 123;
324 module m1
326 module m2
328 module m3a
330 module m4b
332 const unsigned short JIM = 240;
338 module m1
340 module m2
342 module m3b
344 typedef string < ::m1::m2::m3a::m4b::JIM> StringJIM;
345 typedef string <m1::m2::m3a::m4b::JIM> StringJIM_0;
346 typedef string <m2::m3a::m4b::JIM> StringJIM_1;
347 typedef string <m3a::m4b::JIM> StringJIM_2;