Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / TAO_IDL / include / ast_generator.h
blobea310c22b79debecd34483330da8ab26f53fe8f5
1 /*
3 COPYRIGHT
5 Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United
6 States of America. All Rights Reserved.
8 This product is protected by copyright and distributed under the following
9 license restricting its use.
11 The Interface Definition Language Compiler Front End (CFE) is made
12 available for your use provided that you include this license and copyright
13 notice on all media and documentation and the software program in which
14 this product is incorporated in whole or part. You may copy and extend
15 functionality (but may not remove functionality) of the Interface
16 Definition Language CFE without charge, but you are not authorized to
17 license or distribute it to anyone else except as part of a product or
18 program developed by you or with the express written consent of Sun
19 Microsystems, Inc. ("Sun").
21 The names of Sun Microsystems, Inc. and any of its subsidiaries or
22 affiliates may not be used in advertising or publicity pertaining to
23 distribution of Interface Definition Language CFE as permitted herein.
25 This license is effective until terminated by Sun for failure to comply
26 with this license. Upon termination, you shall destroy or return all code
27 and documentation for the Interface Definition Language CFE.
29 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF
30 ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF
32 DEALING, USAGE OR TRADE PRACTICE.
34 INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT
35 ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES
36 TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
38 SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH
39 RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY
40 INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF.
42 IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR
43 ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
44 DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
46 Use, duplication, or disclosure by the government is subject to
47 restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
48 Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
49 52.227-19.
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
54 SunSoft, Inc.
55 2550 Garcia Avenue
56 Mountain View, California 94043
58 NOTE:
60 SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
61 trademarks or registered trademarks of Sun Microsystems, Inc.
65 #ifndef _AST_GENERATOR_AST_GENERATOR_HH
66 #define _AST_GENERATOR_AST_GENERATOR_HH
68 #include "ast_operation.h"
69 #include "ast_argument.h"
70 #include "ast_predefined_type.h"
71 #include "ast_union_label.h"
72 #include "ast_porttype.h"
74 #include "fe_utils.h"
76 class UTL_LabelList;
77 class UTL_ExprList;
78 class AST_Root;
79 class AST_EventType;
80 class AST_EventTypeFwd;
81 class AST_Extended_Port;
82 class AST_Mirror_Port;
83 class AST_Connector;
84 class AST_Provides;
85 class AST_Uses;
86 class AST_Publishes;
87 class AST_Emits;
88 class AST_Consumes;
89 class AST_Template_Module;
90 class AST_Map;
91 class AST_Template_Module_Inst;
92 class AST_Template_Module_Ref;
93 class AST_Param_Holder;
94 class AST_Finder;
95 class AST_Fixed;
97 #include "ast_annotation_appl.h"
99 class AST_Annotation_Member;
101 // Defines base class for node generators.
103 class TAO_IDL_FE_Export AST_Generator
105 public:
106 AST_Generator () {}
108 virtual ~AST_Generator () {}
110 // Operations.
112 // Create a node representing a predefined type.
113 virtual AST_PredefinedType *create_predefined_type (
114 AST_PredefinedType::PredefinedType t,
115 UTL_ScopedName *n);
117 // Create a node representing a module.
118 virtual AST_Module *create_module (UTL_Scope *s,
119 UTL_ScopedName *n);
121 // Create a node representing a module which is the root of an AST.
122 virtual AST_Root *create_root (UTL_ScopedName *n);
124 // Create a node representing an interface.
125 virtual AST_Interface *create_interface (
126 UTL_ScopedName *n,
127 AST_Type **inherits,
128 long n_inherits,
129 AST_Interface **inherits_flat,
130 long n_inherits_flat,
131 bool is_local,
132 bool is_abstract);
134 // Create a node representing a forward declaration of an interface.
135 virtual AST_InterfaceFwd *create_interface_fwd (
136 UTL_ScopedName *n,
137 bool is_local,
138 bool is_abstract);
140 // Create a node representing a valuetype.
141 virtual AST_ValueType *create_valuetype (
142 UTL_ScopedName *n,
143 AST_Type **inherits,
144 long n_inherits,
145 AST_Type *inherits_concrete,
146 AST_Interface **inherits_flat,
147 long n_inherits_flat,
148 AST_Type **supports_list,
149 long n_supports,
150 AST_Type *supports_concrete,
151 bool is_abstract,
152 bool is_truncatable,
153 bool is_custom);
155 // Create a node representing a forward declaration of a valuetype.
156 virtual AST_ValueTypeFwd *create_valuetype_fwd (
157 UTL_ScopedName *n,
158 bool is_abstract);
160 // Create a node representing an eventtype.
161 virtual AST_EventType *create_eventtype (
162 UTL_ScopedName *n,
163 AST_Type **inherits,
164 long n_inherits,
165 AST_Type *inherits_concrete,
166 AST_Interface **inherits_flat,
167 long n_inherits_flat,
168 AST_Type **supports_list,
169 long n_supports,
170 AST_Type *supports_concrete,
171 bool is_abstract,
172 bool is_truncatable,
173 bool is_custom);
175 // Create a node representing a forward declaration of an eventtype.
176 virtual AST_EventTypeFwd *create_eventtype_fwd (
177 UTL_ScopedName *n,
178 bool is_abstract);
180 // Create a node representing a component.
181 virtual AST_Component *create_component (
182 UTL_ScopedName *n,
183 AST_Component *base_component,
184 AST_Type **supports_list,
185 long n_supports,
186 AST_Interface **supports_flat,
187 long n_supports_flat);
189 // Create a node representing a forward declaration of a component.
190 virtual AST_ComponentFwd *create_component_fwd (
191 UTL_ScopedName *n);
193 // Create a node representing a component home.
194 virtual AST_Home *create_home (
195 UTL_ScopedName *n,
196 AST_Home *base_home,
197 AST_Component *managed_component,
198 AST_Type *primary_key,
199 AST_Type **support_lists,
200 long n_supports,
201 AST_Interface **supports_flat,
202 long n_supports_flat);
204 // Create a node representing an exception.
205 virtual AST_Exception *create_exception (
206 UTL_ScopedName *n,
207 bool is_local,
208 bool is_abstract);
210 // Create a node representing a structure.
211 virtual AST_Structure *create_structure (
212 UTL_ScopedName *n,
213 bool is_local,
214 bool is_abstract);
216 // Create a node representing a forward declaration of a structure.
217 virtual AST_StructureFwd *create_structure_fwd (UTL_ScopedName *n);
219 // Create a node representing an enum.
220 virtual AST_Enum *create_enum (UTL_ScopedName *n,
221 bool is_local,
222 bool is_abstract);
224 // Create a node representing an operation on an interface.
225 virtual AST_Operation *create_operation (
226 AST_Type *rt,
227 AST_Operation::Flags fl,
228 UTL_ScopedName *n,
229 bool is_local,
230 bool is_abstract);
232 // Create a node representing a field in a structure, exception or
233 // union.
234 virtual AST_Field *create_field (AST_Type *ft,
235 UTL_ScopedName *n,
236 AST_Field::Visibility vis =
237 AST_Field::vis_NA);
239 // Create a node representing an argument to an operation.
240 virtual AST_Argument *create_argument (
241 AST_Argument::Direction d,
242 AST_Type *ft,
243 UTL_ScopedName *n);
245 // Create a node representing an attribute.
246 virtual AST_Attribute *create_attribute (
247 bool ro,
248 AST_Type *ft,
249 UTL_ScopedName *n,
250 bool is_local,
251 bool is_abstract);
253 // Create a node representing a union.
254 virtual AST_Union *create_union (AST_ConcreteType *dt,
255 UTL_ScopedName *n,
256 bool is_local,
257 bool is_abstract);
259 // Create a node representing a forward declaration of a union.
260 virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n);
262 // Create a node representing one branch in a union.
263 virtual AST_UnionBranch *create_union_branch (
264 UTL_LabelList *ll,
265 AST_Type *ft,
266 UTL_ScopedName *n);
268 // Create a node representing a label on a union branch.
269 virtual AST_UnionLabel *create_union_label (AST_UnionLabel::UnionLabel ul,
270 AST_Expression *lv);
272 // Create a node representing a constant
273 virtual AST_Constant *create_constant (
274 AST_Expression::ExprType et,
275 AST_Expression *ev,
276 UTL_ScopedName *n);
278 // Create various kinds of nodes representing expressions.
280 virtual AST_Expression *create_expr (UTL_ScopedName *n);
282 virtual AST_Expression *create_expr (AST_Expression *v,
283 AST_Expression::ExprType t);
285 virtual AST_Expression *create_expr (AST_Expression::ExprComb c,
286 AST_Expression *v1,
287 AST_Expression *v2);
289 virtual AST_Expression *create_expr (ACE_CDR::Long v);
291 virtual AST_Expression *create_expr (ACE_CDR::LongLong v);
293 virtual AST_Expression *create_expr (ACE_CDR::Boolean b);
295 virtual AST_Expression *create_expr (ACE_CDR::ULong v);
297 virtual AST_Expression *create_expr (ACE_CDR::ULongLong v);
299 virtual AST_Expression *create_expr (ACE_CDR::ULong v,
300 AST_Expression::ExprType t);
302 virtual AST_Expression *create_expr (UTL_String *s);
304 virtual AST_Expression *create_expr (char *s);
306 virtual AST_Expression *create_expr (ACE_CDR::Char c);
308 virtual AST_Expression *create_expr (ACE_OutputCDR::from_wchar wc);
310 virtual AST_Expression *create_expr (ACE_CDR::Double d);
312 virtual AST_Expression *create_expr (const ACE_CDR::Fixed &f);
314 // Create a node representing an enumerator.
315 virtual AST_EnumVal *create_enum_val (ACE_CDR::ULong v,
316 UTL_ScopedName *n);
318 // Create a node representing an array type.
319 virtual AST_Array *create_array (UTL_ScopedName *n,
320 ACE_CDR::ULong ndims,
321 UTL_ExprList *dims,
322 bool is_local,
323 bool is_abstract);
325 // Create a node representing a sequence type.
326 virtual AST_Sequence *create_sequence (AST_Expression *v,
327 AST_Type *bt,
328 UTL_ScopedName *n,
329 bool is_local,
330 bool is_abstract);
332 // Create a node representing a map type.
333 virtual AST_Map *create_map (AST_Expression *v,
334 AST_Type *key_bt,
335 AST_Type *val_bt,
336 UTL_ScopedName *n,
337 bool is_local,
338 bool is_abstract);
340 // Create a node representing a string type.
341 virtual AST_String *create_string (AST_Expression *v);
343 // Create a node representing a wide string type.
344 virtual AST_String *create_wstring (AST_Expression *v);
346 virtual AST_Fixed *create_fixed (AST_Expression *digits,
347 AST_Expression *scale);
349 // Create a node representing a type renaming (typedef).
350 virtual AST_Typedef *create_typedef (AST_Type *bt,
351 UTL_ScopedName *n,
352 bool is_local,
353 bool is_abstract);
355 // Create a node representing a native.
356 virtual AST_Native *create_native (UTL_ScopedName *n);
358 // Create a node representing an OBV or home factory construct.
359 virtual AST_Factory *create_factory (UTL_ScopedName *n);
361 // Create a node representing an home finder construct.
362 virtual AST_Finder *create_finder (UTL_ScopedName *n);
364 // Create a node representing a valuebox.
365 virtual AST_ValueBox *create_valuebox (UTL_ScopedName *n,
366 AST_Type *boxed_type);
368 virtual
369 AST_PortType *create_porttype (UTL_ScopedName *n);
371 virtual
372 AST_Provides *create_provides (UTL_ScopedName *n,
373 AST_Type *provides_type);
375 virtual
376 AST_Uses *create_uses (UTL_ScopedName *n,
377 AST_Type *uses_type,
378 bool is_multiple);
380 virtual
381 AST_Publishes *create_publishes (UTL_ScopedName *n,
382 AST_Type *publishes_type);
384 virtual
385 AST_Emits *create_emits (UTL_ScopedName *n,
386 AST_Type *emits_type);
388 virtual
389 AST_Consumes *create_consumes (UTL_ScopedName *n,
390 AST_Type *consumes_type);
392 virtual
393 AST_Extended_Port *create_extended_port (
394 UTL_ScopedName *n,
395 AST_PortType *porttype_ref);
397 virtual
398 AST_Mirror_Port *create_mirror_port (
399 UTL_ScopedName *n,
400 AST_PortType *porttype_ref);
402 virtual
403 AST_Connector *create_connector (
404 UTL_ScopedName *n,
405 AST_Connector *base_connector);
407 virtual
408 AST_Template_Module *create_template_module (
409 UTL_ScopedName *n,
410 FE_Utils::T_PARAMLIST_INFO *template_params);
412 virtual
413 AST_Template_Module_Inst *create_template_module_inst (
414 UTL_ScopedName *n,
415 AST_Template_Module *ref,
416 FE_Utils::T_ARGLIST *template_args);
418 virtual
419 AST_Template_Module_Ref *create_template_module_ref (
420 UTL_ScopedName *n,
421 AST_Template_Module *ref,
422 UTL_StrList *param_refs);
424 virtual
425 AST_Param_Holder *create_param_holder (
426 UTL_ScopedName *parameter_name,
427 FE_Utils::T_Param_Info *info);
429 virtual AST_Annotation_Decl * create_annotation_decl (
430 UTL_ScopedName *name);
432 virtual AST_Annotation_Member * create_annotation_member (
433 AST_Expression::ExprType expr_type,
434 AST_Type *type,
435 UTL_ScopedName *name);
437 virtual AST_Annotation_Appl * create_annotation_appl (
438 UTL_ScopedName *name,
439 AST_Annotation_Appl::Params *params);
442 #endif // _AST_GENERATOR_AST_GENERATOR_HH