be_global.cpp

Go to the documentation of this file.
00001 // $Id: be_global.cpp 80536 2008-01-31 19:38:14Z cleeland $
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 ACE_RCSID (IFR_Service,
00026            be_global,
00027            "$Id: be_global.cpp 80536 2008-01-31 19:38:14Z cleeland $")
00028 
00029 TAO_IFR_BE_Export BE_GlobalData *be_global = 0;
00030 
00031 BE_GlobalData::BE_GlobalData (void)
00032   : removing_ (false),
00033     holding_scope_name_ (CORBA::string_dup ("TAO_IFR_holding_scope_module")),
00034     filename_ (0),
00035     enable_locking_ (false),
00036     do_included_files_ (true),
00037     allow_duplicate_typedefs_ (false)
00038 {
00039   // At this point, the FE has been initialized.  We can
00040   // now instruct it that we want to preserve c++ keywords.
00041   idl_global->preserve_cpp_keywords (true);
00042 }
00043 
00044 BE_GlobalData::~BE_GlobalData (void)
00045 {
00046 }
00047 
00048 bool
00049 BE_GlobalData::removing (void) const
00050 {
00051   return this->removing_;
00052 }
00053 
00054 void
00055 BE_GlobalData::removing (bool value)
00056 {
00057   this->removing_ = value;
00058 }
00059 
00060 CORBA::ORB_ptr
00061 BE_GlobalData::orb (void) const
00062 {
00063   return this->orb_.in ();
00064 }
00065 
00066 void
00067 BE_GlobalData::orb (CORBA::ORB_ptr orb)
00068 {
00069   this->orb_ = orb;
00070 }
00071 
00072 CORBA::Repository_ptr
00073 BE_GlobalData::repository (void) const
00074 {
00075   return this->repository_.in ();
00076 }
00077 
00078 void
00079 BE_GlobalData::repository (CORBA::Repository_ptr repo)
00080 {
00081   this->repository_ = repo;
00082 }
00083 
00084 CORBA::ModuleDef_ptr
00085 BE_GlobalData::holding_scope (void) const
00086 {
00087   return this->holding_scope_.in ();
00088 }
00089 
00090 void
00091 BE_GlobalData::holding_scope (CORBA::ModuleDef_ptr scope)
00092 {
00093   this->holding_scope_ = scope;
00094 }
00095 
00096 const char *
00097 BE_GlobalData::holding_scope_name (void) const
00098 {
00099   return this->holding_scope_name_.in ();
00100 }
00101 
00102 ACE_Unbounded_Stack<CORBA::Container_ptr> &
00103 BE_GlobalData::ifr_scopes (void)
00104 {
00105   return this->ifr_scopes_;
00106 }
00107 
00108 void
00109 BE_GlobalData::destroy (void)
00110 {
00111 }
00112 
00113 const char *
00114 BE_GlobalData::filename (void) const
00115 {
00116   return this->filename_;
00117 }
00118 
00119 void
00120 BE_GlobalData::filename (char *fname)
00121 {
00122   this->filename_ = fname;
00123 }
00124 
00125 bool
00126 BE_GlobalData::enable_locking (void) const
00127 {
00128   return this->enable_locking_;
00129 }
00130 
00131 void
00132 BE_GlobalData::enable_locking (bool value)
00133 {
00134   this->enable_locking_ = value;
00135 }
00136 
00137 bool
00138 BE_GlobalData::do_included_files (void) const
00139 {
00140   return this->do_included_files_;
00141 }
00142 
00143 void
00144 BE_GlobalData::do_included_files (bool val)
00145 {
00146   this->do_included_files_ = val;
00147 }
00148 
00149 bool
00150 BE_GlobalData::allow_duplicate_typedefs () const
00151 {
00152   return this->allow_duplicate_typedefs_;
00153 }
00154 
00155 void
00156 BE_GlobalData::allow_duplicate_typedefs (bool val)
00157 {
00158   this->allow_duplicate_typedefs_ = val;
00159 }
00160 
00161 ACE_CString
00162 BE_GlobalData::orb_args (void) const
00163 {
00164   return this->orb_args_;
00165 }
00166 
00167 void
00168 BE_GlobalData::orb_args (const ACE_CString& args)
00169 {
00170   this->orb_args_ = args;
00171 }
00172 
00173 ACE_CString
00174 BE_GlobalData::spawn_options (void)
00175 {
00176   return this->orb_args_ + idl_global->idl_flags ();
00177 }
00178 
00179 void
00180 BE_GlobalData::parse_args (long &i, char **av)
00181 {
00182   switch (av[i][1])
00183     {
00184       case 'L':
00185         be_global->enable_locking (true);
00186         break;
00187       case 'r':
00188         be_global->removing (true);
00189         break;
00190       case 'S':
00191         // Suppress ...
00192         if (av[i][2] == 'i')
00193           {
00194             // ... processing of included IDL files.
00195             be_global->do_included_files (0);
00196           }
00197         else
00198           {
00199             ACE_ERROR ((
00200                 LM_ERROR,
00201                 ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
00202                 av[i]
00203               ));
00204 
00205             ACE_OS::exit (99);
00206           }
00207         break;
00208       case 'T':
00209         be_global->allow_duplicate_typedefs (true);
00210         break;
00211       default:
00212         ACE_ERROR ((
00213             LM_ERROR,
00214             ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
00215             av[i]
00216           ));
00217 
00218         idl_global->set_compile_flags (idl_global->compile_flags ()
00219                                        | IDL_CF_ONLY_USAGE);
00220         break;
00221     }
00222 }
00223 
00224 // Does nothing in this backend.
00225 void
00226 BE_GlobalData::prep_be_arg (char *)
00227 {
00228 }
00229 
00230 // Does nothing in this backend.
00231 void
00232 BE_GlobalData::arg_post_proc (void)
00233 {
00234 }
00235 
00236 void
00237 BE_GlobalData::usage (void) const
00238 {
00239   ACE_DEBUG ((
00240       LM_DEBUG,
00241       ACE_TEXT (" -L\t\t\tEnable locking at the IDL file level\n")
00242     ));
00243   ACE_DEBUG ((
00244       LM_DEBUG,
00245       ACE_TEXT (" -r\t\t\tRemove contents of IDL file(s) from repository\n")
00246     ));
00247   ACE_DEBUG ((
00248       LM_DEBUG,
00249       ACE_TEXT (" -Si\t\t\tSuppress processing of included IDL files\n")
00250     ));
00251   ACE_DEBUG ((
00252       LM_DEBUG,
00253       ACE_TEXT (" -T\t\t\tAllow duplicate typedefs in IDL files\n")
00254     ));
00255 }
00256 
00257 AST_Generator *
00258 BE_GlobalData::generator_init (void)
00259 {
00260   AST_Generator *gen = 0;
00261   ACE_NEW_RETURN (gen,
00262                   AST_Generator,
00263                   0);
00264   return gen;
00265 }

Generated on Tue Feb 2 17:50:49 2010 for TAO_IFR by  doxygen 1.4.7