Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 #include "global_extern.h"
00071 #include "TAO_IFR_BE_Export.h"
00072 #include "be_extern.h"
00073 #include "fe_extern.h"
00074 #include "ast_root.h"
00075 #include "ifr_visitor_macro.h"
00076 #include "ifr_removing_visitor.h"
00077 #include "ifr_adding_visitor.h"
00078
00079 ACE_RCSID (be,
00080 be_produce,
00081 "$Id: be_produce.cpp 83643 2008-11-10 20:03:04Z parsons $")
00082
00083
00084 TAO_IFR_BE_Export void
00085 BE_cleanup (void)
00086 {
00087 idl_global->destroy ();
00088 }
00089
00090
00091 TAO_IFR_BE_Export void
00092 BE_abort (void)
00093 {
00094 ACE_ERROR ((LM_ERROR,
00095 ACE_TEXT ("Fatal Error - Aborting\n")));
00096
00097
00098 throw Bailout ();
00099 }
00100
00101 int
00102 BE_ifr_repo_init (void)
00103 {
00104 try
00105 {
00106 CORBA::Object_var object =
00107 be_global->orb ()->resolve_initial_references ("InterfaceRepository");
00108
00109 if (CORBA::is_nil (object.in ()))
00110 {
00111 ACE_ERROR_RETURN ((
00112 LM_ERROR,
00113 ACE_TEXT ("Null objref from resolve_initial_references\n")
00114 ),
00115 -1
00116 );
00117 }
00118
00119 CORBA::Repository_var repo =
00120 CORBA::Repository::_narrow (object.in ());
00121
00122 if (CORBA::is_nil (repo.in ()))
00123 {
00124 ACE_ERROR_RETURN ((
00125 LM_ERROR,
00126 ACE_TEXT ("CORBA::Repository::_narrow failed\n")
00127 ),
00128 -1
00129 );
00130 }
00131
00132 be_global->repository (repo._retn ());
00133 }
00134 catch (CORBA::ORB::InvalidName &)
00135 {
00136 ACE_ERROR ((LM_ERROR,
00137 ACE_TEXT ("resolution of Interface Repository failed\n")));
00138 throw Bailout ();
00139 }
00140
00141 return 0;
00142 }
00143
00144
00145 TAO_IFR_BE_Export void
00146 BE_produce (void)
00147 {
00148 try
00149 {
00150 int status = BE_ifr_repo_init ();
00151
00152 if (status != 0)
00153 {
00154 return;
00155 }
00156
00157
00158 AST_Decl *d = idl_global->root ();
00159 AST_Root *root = AST_Root::narrow_from_decl (d);
00160
00161 if (root == 0)
00162 {
00163 ACE_ERROR ((LM_ERROR,
00164 ACE_TEXT ("(%N:%l) BE_produce - ")
00165 ACE_TEXT ("No Root\n")));
00166
00167 BE_abort ();
00168 }
00169
00170 if (be_global->removing ())
00171 {
00172 ifr_removing_visitor visitor;
00173
00174 TAO_IFR_VISITOR_WRITE_GUARD;
00175
00176
00177
00178 if (visitor.visit_scope (root) == -1)
00179 {
00180 ACE_ERROR ((
00181 LM_ERROR,
00182 ACE_TEXT ("(%N:%l) BE_produce -")
00183 ACE_TEXT (" failed to accept removing visitor\n")
00184 ));
00185
00186 BE_abort ();
00187 }
00188 }
00189 else
00190 {
00191 ifr_adding_visitor visitor (d, 0, be_global->allow_duplicate_typedefs ());
00192
00193 TAO_IFR_VISITOR_WRITE_GUARD;
00194
00195 if (root->ast_accept (&visitor) == -1)
00196 {
00197 ACE_ERROR ((
00198 LM_ERROR,
00199 ACE_TEXT ("(%N:%l) BE_produce -")
00200 ACE_TEXT (" failed to accept adding visitor\n")
00201 ));
00202
00203 BE_abort ();
00204 }
00205 }
00206 }
00207 catch (const CORBA::Exception& ex)
00208 {
00209 ex._tao_print_exception (ACE_TEXT ("BE_produce"));
00210
00211 }
00212
00213
00214 BE_cleanup ();
00215 }