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 "be_visitor_root.h"
66 #include "be_visitor_ami_pre_proc.h"
67 #include "be_visitor_amh_pre_proc.h"
68 #include "be_visitor_ccm_pre_proc.h"
69 #include "be_visitor_dds_ts_idl.h"
70 #include "be_visitor_context.h"
72 #include "be_extern.h"
73 #include "fe_extern.h"
74 #include "global_extern.h"
77 // Clean up before exit, whether successful or not.
78 TAO_IDL_BE_Export
void
81 idl_global
->destroy ();
84 // Abort this run of the BE.
85 TAO_IDL_BE_Export
void
89 "Fatal Error - Aborting\n"));
91 // BE_cleanup will be called after the exception is caught.
96 BE_visit_root (be_visitor_decl
&root_visitor
,
97 const char *which_pass
)
99 static be_root
*root
=
100 dynamic_cast<be_root
*> (idl_global
->root ());
102 if (-1 == root
->accept (&root_visitor
))
104 ACE_ERROR ((LM_ERROR
,
105 "BE_visit_root - %C for Root failed\n",
110 root_visitor
.ctx ()->reset ();
113 // Do the work of this BE. This is the starting point for code generation.
114 TAO_IDL_BE_Export
void
117 be_visitor_context ctx
;
119 // Only generate the TypeSupport and directly bail out
120 if (be_global
->gen_dds_typesupport_idl ())
122 be_visitor_dds_ts_idl
root_dds_idl_visitor (&ctx
);
123 BE_visit_root (root_dds_idl_visitor
, "DDS type support IDL");
127 if (!idl_global
->ignore_idl3 ())
129 be_visitor_ccm_pre_proc
ccm_preproc_visitor (&ctx
);
130 BE_visit_root (ccm_preproc_visitor
, "CCM preprocessing");
133 if (be_global
->ami_call_back ())
135 be_visitor_ami_pre_proc
ami_preproc_visitor (&ctx
);
136 BE_visit_root (ami_preproc_visitor
, "AMI preprocessing");
139 if (be_global
->gen_amh_classes ())
141 be_visitor_amh_pre_proc
amh_pre_proc_visitor (&ctx
);
142 BE_visit_root (amh_pre_proc_visitor
, "AMH preprocessing");
145 const char *fname
= be_global
->be_get_anyop_header_fname ();
147 // No-op if the -GA wasn't on the command line.
148 if (-1 == tao_cg
->start_anyop_header (fname
))
153 if (be_global
->gen_client_header ())
155 ctx
.state (TAO_CodeGen::TAO_ROOT_CH
);
156 be_visitor_root_ch
root_ch_visitor (&ctx
);
157 BE_visit_root (root_ch_visitor
, "client header");
160 // Initialize the anyop source stream, if the option is set.
161 // It has to be done after the stub header file generation,
162 // where checks for recursive types are done,
163 // and before stub source file generation, since
164 // generation of Any-related #includes may be redirected.
165 fname
= be_global
->be_get_anyop_source_fname ();
167 if (-1 == tao_cg
->start_anyop_source (fname
))
172 if (be_global
->gen_client_inline ())
174 ctx
.state (TAO_CodeGen::TAO_ROOT_CI
);
175 be_visitor_root_ci
root_ci_visitor (&ctx
);
176 BE_visit_root (root_ci_visitor
, "client inline");
179 if (be_global
->gen_client_stub ())
181 ctx
.state (TAO_CodeGen::TAO_ROOT_CS
);
182 be_visitor_root_cs
root_cs_visitor (&ctx
);
183 BE_visit_root (root_cs_visitor
, "client stub");
186 if (be_global
->gen_server_header ())
188 ctx
.state (TAO_CodeGen::TAO_ROOT_SH
);
189 be_visitor_root_sh
root_sh_visitor (&ctx
);
190 BE_visit_root (root_sh_visitor
, "server header");
193 if (be_global
->gen_server_skeleton ())
195 ctx
.state (TAO_CodeGen::TAO_ROOT_SS
);
196 be_visitor_root_ss
root_ss_visitor (&ctx
);
197 BE_visit_root (root_ss_visitor
, "server skeleton");
200 // Inline and source files for tie classes are generated
201 // by the corresponding skeleton visitors.
202 if (be_global
->gen_tie_classes ())
204 ctx
.state (TAO_CodeGen::TAO_ROOT_TIE_SH
);
205 be_visitor_root_sth
sth_visitor (&ctx
);
206 BE_visit_root (sth_visitor
, "server template header");
209 if (be_global
->gen_impl_files ())
211 ctx
.state (TAO_CodeGen::TAO_ROOT_IH
);
212 be_visitor_root_ih
root_ih_visitor (&ctx
);
213 BE_visit_root (root_ih_visitor
, "implementation header");
215 ctx
.state (TAO_CodeGen::TAO_ROOT_IS
);
216 be_visitor_root_is
root_is_visitor (&ctx
);
217 BE_visit_root (root_is_visitor
, "implementation skeleton");
220 if (be_global
->gen_ciao_svnt ())
222 ctx
.state (TAO_CodeGen::TAO_ROOT_SVH
);
223 be_visitor_root_svh
root_svh_visitor (&ctx
);
224 BE_visit_root (root_svh_visitor
, "CIAO servant header");
226 if (be_global
->gen_svnt_cpp_files ())
228 ctx
.state (TAO_CodeGen::TAO_ROOT_SVS
);
229 be_visitor_root_svs
root_svs_visitor (&ctx
);
230 BE_visit_root (root_svs_visitor
, "CIAO servant source");
233 if (be_global
->gen_svnt_t_files ())
235 ctx
.state (TAO_CodeGen::TAO_ROOT_SVTH
);
236 be_visitor_root_svth
root_svth_visitor (&ctx
);
237 BE_visit_root (root_svth_visitor
, "CIAO template servant header");
239 ctx
.state (TAO_CodeGen::TAO_ROOT_SVTS
);
240 be_visitor_root_svts
root_svts_visitor (&ctx
);
241 BE_visit_root (root_svts_visitor
, "CIAO template servant source");
245 if (be_global
->gen_ciao_exec_idl ())
247 ctx
.state (TAO_CodeGen::TAO_ROOT_EX_IDL
);
248 be_visitor_root_ex_idl
root_ex_idl_visitor (&ctx
);
249 BE_visit_root (root_ex_idl_visitor
, "CIAO executor IDL");
252 if (be_global
->gen_ciao_exec_impl ())
254 bool generate
= be_util::overwrite_ciao_exec_files ();
257 ctx
.state (TAO_CodeGen::TAO_ROOT_EXH
);
258 be_visitor_root_exh
root_exh_visitor (&ctx
);
259 BE_visit_root (root_exh_visitor
, "CIAO exec impl header");
261 ctx
.state (TAO_CodeGen::TAO_ROOT_EXS
);
262 be_visitor_root_exs
root_exs_visitor (&ctx
);
263 BE_visit_root (root_exs_visitor
, "CIAO exec impl source");
267 if (be_global
->gen_ciao_conn_impl ())
269 ctx
.state (TAO_CodeGen::TAO_ROOT_CNH
);
270 be_visitor_root_cnh
root_cnh_visitor (&ctx
);
271 BE_visit_root (root_cnh_visitor
, "CIAO conn impl header");
273 ctx
.state (TAO_CodeGen::TAO_ROOT_CNS
);
274 be_visitor_root_cns
root_cns_visitor (&ctx
);
275 BE_visit_root (root_cns_visitor
, "CIAO conn impl source");
278 tao_cg
->gen_export_files ();
280 // Done with this IDL file.