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 #include "ast_module.h"
67 #include "ast_valuetype.h"
68 #include "ast_eventtype.h"
69 #include "ast_component.h"
70 #include "ast_porttype.h"
71 #include "ast_connector.h"
73 #include "ast_operation.h"
74 #include "ast_factory.h"
75 #include "ast_finder.h"
76 #include "ast_exception.h"
77 #include "ast_union.h"
79 #include "ast_interface_fwd.h"
80 #include "utl_scope.h"
81 #include "ast_annotation_decl.h"
82 #include "ast_annotation_appl.h"
84 // Narrowing functions for AST
86 TAO_IDL_FE_Export AST_Decl
*
87 ScopeAsDecl (UTL_Scope
*s
)
94 switch (s
->scope_node_type ())
96 case AST_Decl::NT_module
:
97 return dynamic_cast<AST_Module
*> (s
);
98 case AST_Decl::NT_root
:
99 return dynamic_cast<AST_Root
*> (s
);
100 case AST_Decl::NT_interface
:
101 return dynamic_cast<AST_Interface
*> (s
);
102 case AST_Decl::NT_valuetype
:
103 return dynamic_cast<AST_ValueType
*> (s
);
104 case AST_Decl::NT_eventtype
:
105 return dynamic_cast<AST_EventType
*> (s
);
106 case AST_Decl::NT_component
:
107 return dynamic_cast<AST_Component
*> (s
);
108 case AST_Decl::NT_porttype
:
109 return dynamic_cast<AST_PortType
*> (s
);
110 case AST_Decl::NT_connector
:
111 return dynamic_cast<AST_Connector
*> (s
);
112 case AST_Decl::NT_home
:
113 return dynamic_cast<AST_Home
*> (s
);
114 case AST_Decl::NT_op
:
115 return dynamic_cast<AST_Operation
*> (s
);
116 case AST_Decl::NT_factory
:
117 return dynamic_cast<AST_Factory
*> (s
);
118 case AST_Decl::NT_finder
:
119 return dynamic_cast<AST_Finder
*> (s
);
120 case AST_Decl::NT_except
:
121 return dynamic_cast<AST_Exception
*> (s
);
122 case AST_Decl::NT_union
:
123 return dynamic_cast<AST_Union
*> (s
);
124 case AST_Decl::NT_struct
:
125 return dynamic_cast<AST_Structure
*> (s
);
126 case AST_Decl::NT_enum
:
127 return dynamic_cast<AST_Enum
*> (s
);
128 case AST_Decl::NT_annotation_decl
:
129 return dynamic_cast<AST_Annotation_Decl
*> (s
);
130 case AST_Decl::NT_annotation_appl
:
131 return dynamic_cast<AST_Annotation_Appl
*> (s
);
138 * Convert an AST_Decl to a UTL_Scope if possible
140 TAO_IDL_FE_Export UTL_Scope
*
141 DeclAsScope (AST_Decl
*d
)
148 switch (d
->node_type ())
150 case AST_Decl::NT_interface_fwd
:
152 * Resolve forward declared interface by looking at full_definition()
153 * field and iterating
155 d
= (dynamic_cast<AST_InterfaceFwd
*> (d
))->full_definition ();
157 case AST_Decl::NT_interface
:
158 return dynamic_cast<AST_Interface
*> (d
);
159 case AST_Decl::NT_valuetype
:
160 return dynamic_cast<AST_ValueType
*> (d
);
161 case AST_Decl::NT_eventtype
:
162 return dynamic_cast<AST_EventType
*> (d
);
163 case AST_Decl::NT_component
:
164 return dynamic_cast<AST_Component
*> (d
);
165 case AST_Decl::NT_porttype
:
166 return dynamic_cast<AST_PortType
*> (d
);
167 case AST_Decl::NT_connector
:
168 return dynamic_cast<AST_Connector
*> (d
);
169 case AST_Decl::NT_home
:
170 return dynamic_cast<AST_Home
*> (d
);
171 case AST_Decl::NT_module
:
172 return dynamic_cast<AST_Module
*> (d
);
173 case AST_Decl::NT_root
:
174 return dynamic_cast<AST_Root
*> (d
);
175 case AST_Decl::NT_except
:
176 return dynamic_cast<AST_Exception
*> (d
);
177 case AST_Decl::NT_union
:
178 return dynamic_cast<AST_Union
*> (d
);
179 case AST_Decl::NT_struct
:
180 return dynamic_cast<AST_Structure
*> (d
);
181 case AST_Decl::NT_enum
:
182 return dynamic_cast<AST_Enum
*> (d
);
183 case AST_Decl::NT_op
:
184 return dynamic_cast<AST_Operation
*> (d
);
185 case AST_Decl::NT_factory
:
186 return dynamic_cast<AST_Factory
*> (d
);
187 case AST_Decl::NT_finder
:
188 return dynamic_cast<AST_Finder
*> (d
);