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
51 Sun, Sun Microsystems and the Sun logo are trademarks or registered
52 trademarks of Sun Microsystems, Inc.
56 Mountain View, California 94043
60 SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are
61 trademarks or registered trademarks of Sun Microsystems, Inc.
65 #ifndef _AST_MODULE_AST_MODULE_HH
66 #define _AST_MODULE_AST_MODULE_HH
69 #include "utl_scope.h"
70 #include "ace/Unbounded_Set.h"
72 // NOTE: add(AST_EnumValue *) is defined here because enums can
73 // be defined manifest locally; the constants defined in these
74 // enums are inserted in the enclosing scope.
76 class AST_Template_Module_Inst
;
77 class AST_Template_Module_Ref
;
79 class TAO_IDL_FE_Export AST_Module
: public virtual AST_Decl
,
80 public virtual UTL_Scope
83 static AST_Decl::NodeType
const NT
;
86 AST_Module (UTL_ScopedName
*n
, AST_Module
*prev
= 0);
89 virtual ~AST_Module ();
92 virtual void destroy ();
95 virtual void dump (ACE_OSTREAM_TYPE
&o
);
97 // Involved in OBV_ namespace generation.
98 void set_has_nested_valuetype ();
99 bool has_nested_valuetype ();
101 // Allows adding an interface at a later point.
102 // The interface i is inserted after interface ix, if
104 int be_add_interface (AST_Interface
*i
,
105 AST_Interface
*ix
= 0);
107 // Allows adding a valuetype at a later point.
108 int be_add_valuetype (AST_ValueType
*v
);
110 // Has this node been referenced here already?
111 // Override of method in UTL_Scope.
112 virtual bool referenced (AST_Decl
*e
,
115 // Accessor to this module's previous opening.
116 AST_Module
*previous_opening ();
118 // Called to look up some declaration
119 // in a previous opening of this module.
120 AST_Decl
*look_in_prev_mods_local (Identifier
*e
,
121 bool ignore_fwd
= false);
123 // Called to look up some declaration
124 // in a previous opening of this module.
125 AST_Decl
*look_in_prev_mods (UTL_ScopedName
*e
,
127 AST_Decl
*&final_parent_decl
);
130 virtual int ast_accept (ast_visitor
*visitor
);
132 // Accessors for the member.
133 AST_Template_Module_Inst
*from_inst () const;
134 void from_inst (AST_Template_Module_Inst
*node
);
136 // Accessors for the member.
137 AST_Template_Module_Ref
*from_ref () const;
138 void from_ref (AST_Template_Module_Ref
*node
);
140 // Override that looks in previous openings.
141 virtual AST_Decl
*special_lookup (UTL_ScopedName
*e
,
143 AST_Decl
*&final_parent_decl
);
145 // We actually want to match the LAST module found in
146 // the scope being searched not the FIRST one in the
148 virtual AST_Decl
*adjust_found (bool ignore_fwd
, bool full_def_only
);
150 // Scope Management Protocol
153 AST_PredefinedType
*fe_add_predefined_type (AST_PredefinedType
*t
);
156 AST_Module
*fe_add_module (AST_Module
*m
);
159 AST_Template_Module_Inst
*fe_add_template_module_inst (
160 AST_Template_Module_Inst
*m
);
163 AST_Interface
*fe_add_interface (AST_Interface
*i
);
166 AST_InterfaceFwd
*fe_add_interface_fwd (AST_InterfaceFwd
*i
);
169 AST_ValueType
*fe_add_valuetype (AST_ValueType
*i
);
172 AST_ValueTypeFwd
*fe_add_valuetype_fwd (AST_ValueTypeFwd
*i
);
175 AST_EventType
*fe_add_eventtype (AST_EventType
*i
);
178 AST_EventTypeFwd
*fe_add_eventtype_fwd (AST_EventTypeFwd
*i
);
181 AST_Component
*fe_add_component (AST_Component
*i
);
184 AST_ComponentFwd
*fe_add_component_fwd (AST_ComponentFwd
*i
);
187 AST_Connector
*fe_add_connector (AST_Connector
*i
);
190 AST_Home
*fe_add_home (AST_Home
*i
);
193 AST_Constant
*fe_add_constant (AST_Constant
*c
);
196 AST_Exception
*fe_add_exception (AST_Exception
*e
);
199 AST_Union
*fe_add_union (AST_Union
*u
);
202 AST_UnionFwd
*fe_add_union_fwd (AST_UnionFwd
*u
);
205 AST_Structure
*fe_add_structure (AST_Structure
*s
);
208 AST_StructureFwd
*fe_add_structure_fwd (AST_StructureFwd
*s
);
211 AST_Enum
*fe_add_enum (AST_Enum
*e
);
214 AST_EnumVal
*fe_add_enum_val (AST_EnumVal
*v
);
217 AST_Typedef
*fe_add_typedef (AST_Typedef
*t
);
220 AST_Native
*fe_add_native (AST_Native
*n
);
223 AST_ValueBox
*fe_add_valuebox (AST_ValueBox
*vb
);
226 AST_PortType
*fe_add_porttype (AST_PortType
*pt
);
229 AST_Annotation_Decl
*fe_add_annotation_decl (
230 AST_Annotation_Decl
*annotation_decl
);
232 // Reset the last_in_same_parent_scope_ member to ourself
233 // (called by AST_Root::destroy on the CORBA module containing
234 // the basic types, since it isn't destroyed between processing
235 // multiple IDL files.
236 void reset_last_in_same_parent_scope ();
238 virtual bool annotatable () const { return true; }
241 bool pd_has_nested_valuetype_
;
243 AST_Module
*previous_opening_
;
244 /// The immediatly previous opening of this module.
246 AST_Module
*last_in_same_parent_scope_
;
247 /// Pointer to the last opening of this module in the same parent
249 AST_Template_Module_Inst
*from_inst_
;
250 /// Reference to the instantiation that created us, if any.
252 AST_Template_Module_Ref
*from_ref_
;
253 /// Reference to the 'alias' type that created us, if any.
256 #endif // _AST_MODULE_AST_MODULE_HH