00001 // $Id: be_global.cpp 91061 2010-07-12 08:32:16Z parsons $ 00002 00003 // ============================================================================ 00004 // 00005 // 00006 // = LIBRARY 00007 // TAO_IFR_BE_DLL 00008 // 00009 // = FILENAME 00010 // be_global.cpp 00011 // 00012 // = DESCRIPTION 00013 // Stores global data specific to the compiler back end. 00014 // 00015 // = AUTHOR 00016 // Jeff Parsons <parsons@cs.wustl.edu> 00017 // 00018 // ============================================================================ 00019 00020 #include "be_global.h" 00021 #include "ast_generator.h" 00022 #include "global_extern.h" 00023 #include "idl_defines.h" 00024 00025 TAO_IFR_BE_Export BE_GlobalData *be_global = 0; 00026 00027 BE_GlobalData::BE_GlobalData (void) 00028 : removing_ (false), 00029 filename_ (0), 00030 enable_locking_ (false), 00031 do_included_files_ (true), 00032 allow_duplicate_typedefs_ (false) 00033 { 00034 // At this point, the FE has been initialized. We can 00035 // now instruct it that we want to preserve c++ keywords. 00036 idl_global->preserve_cpp_keywords (true); 00037 } 00038 00039 BE_GlobalData::~BE_GlobalData (void) 00040 { 00041 } 00042 00043 bool 00044 BE_GlobalData::removing (void) const 00045 { 00046 return this->removing_; 00047 } 00048 00049 void 00050 BE_GlobalData::removing (bool value) 00051 { 00052 this->removing_ = value; 00053 } 00054 00055 CORBA::ORB_ptr 00056 BE_GlobalData::orb (void) const 00057 { 00058 return this->orb_.in (); 00059 } 00060 00061 void 00062 BE_GlobalData::orb (CORBA::ORB_ptr orb) 00063 { 00064 this->orb_ = orb; 00065 } 00066 00067 CORBA::Repository_ptr 00068 BE_GlobalData::repository (void) const 00069 { 00070 return this->repository_.in (); 00071 } 00072 00073 void 00074 BE_GlobalData::repository (CORBA::Repository_ptr repo) 00075 { 00076 this->repository_ = repo; 00077 } 00078 00079 ACE_Unbounded_Stack<CORBA::Container_ptr> & 00080 BE_GlobalData::ifr_scopes (void) 00081 { 00082 return this->ifr_scopes_; 00083 } 00084 00085 void 00086 BE_GlobalData::destroy (void) 00087 { 00088 } 00089 00090 const char * 00091 BE_GlobalData::filename (void) const 00092 { 00093 return this->filename_; 00094 } 00095 00096 void 00097 BE_GlobalData::filename (char *fname) 00098 { 00099 this->filename_ = fname; 00100 } 00101 00102 bool 00103 BE_GlobalData::enable_locking (void) const 00104 { 00105 return this->enable_locking_; 00106 } 00107 00108 void 00109 BE_GlobalData::enable_locking (bool value) 00110 { 00111 this->enable_locking_ = value; 00112 } 00113 00114 bool 00115 BE_GlobalData::do_included_files (void) const 00116 { 00117 return this->do_included_files_; 00118 } 00119 00120 void 00121 BE_GlobalData::do_included_files (bool val) 00122 { 00123 this->do_included_files_ = val; 00124 } 00125 00126 bool 00127 BE_GlobalData::allow_duplicate_typedefs () const 00128 { 00129 return this->allow_duplicate_typedefs_; 00130 } 00131 00132 void 00133 BE_GlobalData::allow_duplicate_typedefs (bool val) 00134 { 00135 this->allow_duplicate_typedefs_ = val; 00136 } 00137 00138 ACE_CString 00139 BE_GlobalData::orb_args (void) const 00140 { 00141 return this->orb_args_; 00142 } 00143 00144 void 00145 BE_GlobalData::orb_args (const ACE_CString& args) 00146 { 00147 this->orb_args_ = args; 00148 } 00149 00150 ACE_CString 00151 BE_GlobalData::spawn_options (void) 00152 { 00153 return this->orb_args_ + idl_global->idl_flags (); 00154 } 00155 00156 void 00157 BE_GlobalData::parse_args (long &i, char **av) 00158 { 00159 switch (av[i][1]) 00160 { 00161 case 'L': 00162 be_global->enable_locking (true); 00163 break; 00164 case 'r': 00165 be_global->removing (true); 00166 break; 00167 case 'S': 00168 // Suppress ... 00169 if (av[i][2] == 'i') 00170 { 00171 // ... processing of included IDL files. 00172 be_global->do_included_files (0); 00173 } 00174 else 00175 { 00176 ACE_ERROR (( 00177 LM_ERROR, 00178 ACE_TEXT ("IDL: I don't understand the '%s' option\n"), 00179 av[i] 00180 )); 00181 00182 ACE_OS::exit (99); 00183 } 00184 break; 00185 case 'T': 00186 be_global->allow_duplicate_typedefs (true); 00187 break; 00188 default: 00189 ACE_ERROR (( 00190 LM_ERROR, 00191 ACE_TEXT ("IDL: I don't understand the '%s' option\n"), 00192 av[i] 00193 )); 00194 00195 idl_global->set_compile_flags (idl_global->compile_flags () 00196 | IDL_CF_ONLY_USAGE); 00197 break; 00198 } 00199 } 00200