be_global.cpp

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

Generated on Thu Nov 9 14:11:49 2006 for TAO_IFR by doxygen 1.3.6