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 // BE_produce.cc - Produce the work of the BE - does nothing in the
68 #include "orbsvcs/Log_Macros.h"
69 #include "global_extern.h"
70 #include "TAO_IFR_BE_Export.h"
71 #include "be_extern.h"
72 #include "fe_extern.h"
74 #include "ifr_visitor_macro.h"
75 #include "ifr_removing_visitor.h"
76 #include "ifr_adding_visitor.h"
78 // Clean up before exit, whether successful or not.
79 TAO_IFR_BE_Export
void
82 idl_global
->destroy ();
85 // Abort this run of the BE.
86 TAO_IFR_BE_Export
void
89 ORBSVCS_ERROR ((LM_ERROR
,
90 ACE_TEXT ("Fatal Error - Aborting\n")));
92 // BE_cleanup will be called after the exception is caught.
97 BE_ifr_repo_init (void)
101 CORBA::Object_var object
=
102 be_global
->orb ()->resolve_initial_references ("InterfaceRepository");
104 if (CORBA::is_nil (object
.in ()))
106 ORBSVCS_ERROR_RETURN ((
108 ACE_TEXT ("Null objref from resolve_initial_references\n")
114 CORBA::Repository_var repo
=
115 CORBA::Repository::_narrow (object
.in ());
117 if (CORBA::is_nil (repo
.in ()))
119 ORBSVCS_ERROR_RETURN ((
121 ACE_TEXT ("CORBA::Repository::_narrow failed\n")
127 be_global
->repository (repo
._retn ());
129 catch (const CORBA::ORB::InvalidName
&)
131 ORBSVCS_ERROR ((LM_ERROR
,
132 ACE_TEXT ("resolution of Interface Repository failed\n")));
139 // Do the work of this BE. This is the starting point for code generation.
140 TAO_IFR_BE_Export
void
145 int status
= BE_ifr_repo_init ();
152 // Get the root node.
153 AST_Decl
*d
= idl_global
->root ();
154 AST_Root
*root
= dynamic_cast<AST_Root
*> (d
);
158 ORBSVCS_ERROR ((LM_ERROR
,
159 ACE_TEXT ("(%N:%l) BE_produce - ")
160 ACE_TEXT ("No Root\n")));
165 if (be_global
->removing ())
167 ifr_removing_visitor visitor
;
169 TAO_IFR_VISITOR_WRITE_GUARD
;
171 // If the visitor is dispatched this way, we need to override
172 // only visit_scope() for the removing visitor.
173 if (visitor
.visit_scope (root
) == -1)
177 ACE_TEXT ("(%N:%l) BE_produce -")
178 ACE_TEXT (" failed to accept removing visitor\n")));
185 ifr_adding_visitor
visitor (d
, 0, be_global
->allow_duplicate_typedefs ());
187 TAO_IFR_VISITOR_WRITE_GUARD
;
189 if (root
->ast_accept (&visitor
) == -1)
193 ACE_TEXT ("(%N:%l) BE_produce -")
194 ACE_TEXT (" failed to accept adding visitor\n")));
200 catch (const CORBA::Exception
& ex
)
202 ex
._tao_print_exception (ACE_TEXT ("BE_produce"));