Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / orbsvcs / IFR_Service / be_global.cpp
blob89a0ed5262c48c5fc5a74725eaef4f7a5575f510
2 //=============================================================================
3 /**
4 * @file be_global.cpp
6 * Stores global data specific to the compiler back end.
8 * @author Jeff Parsons <parsons@cs.wustl.edu>
9 */
10 //=============================================================================
13 #include "orbsvcs/Log_Macros.h"
14 #include "be_global.h"
15 #include "ast_generator.h"
16 #include "global_extern.h"
17 #include "idl_defines.h"
19 TAO_IFR_BE_Export BE_GlobalData *be_global = 0;
21 BE_GlobalData::BE_GlobalData ()
22 : removing_ (false),
23 filename_ (0),
24 enable_locking_ (false),
25 do_included_files_ (true),
26 allow_duplicate_typedefs_ (false)
28 // At this point, the FE has been initialized. We can
29 // now instruct it that we want to preserve c++ keywords.
30 idl_global->preserve_cpp_keywords (true);
33 BE_GlobalData::~BE_GlobalData ()
37 bool
38 BE_GlobalData::removing () const
40 return this->removing_;
43 void
44 BE_GlobalData::removing (bool value)
46 this->removing_ = value;
49 CORBA::ORB_ptr
50 BE_GlobalData::orb () const
52 return this->orb_.in ();
55 void
56 BE_GlobalData::orb (CORBA::ORB_ptr orb)
58 this->orb_ = orb;
61 CORBA::Repository_ptr
62 BE_GlobalData::repository () const
64 return this->repository_.in ();
67 void
68 BE_GlobalData::repository (CORBA::Repository_ptr repo)
70 this->repository_ = repo;
73 ACE_Unbounded_Stack<CORBA::Container_ptr> &
74 BE_GlobalData::ifr_scopes ()
76 return this->ifr_scopes_;
79 void
80 BE_GlobalData::destroy ()
84 const char *
85 BE_GlobalData::filename () const
87 return this->filename_;
90 void
91 BE_GlobalData::filename (char *fname)
93 this->filename_ = fname;
96 bool
97 BE_GlobalData::enable_locking () const
99 return this->enable_locking_;
102 void
103 BE_GlobalData::enable_locking (bool value)
105 this->enable_locking_ = value;
108 bool
109 BE_GlobalData::do_included_files () const
111 return this->do_included_files_;
114 void
115 BE_GlobalData::do_included_files (bool val)
117 this->do_included_files_ = val;
120 bool
121 BE_GlobalData::allow_duplicate_typedefs () const
123 return this->allow_duplicate_typedefs_;
126 void
127 BE_GlobalData::allow_duplicate_typedefs (bool val)
129 this->allow_duplicate_typedefs_ = val;
132 ACE_CString
133 BE_GlobalData::orb_args () const
135 return this->orb_args_;
138 void
139 BE_GlobalData::orb_args (const ACE_CString& args)
141 this->orb_args_ = args;
144 ACE_CString
145 BE_GlobalData::spawn_options ()
147 return this->orb_args_ + idl_global->idl_flags ();
150 #define UNKNOWN_OPTION \
151 ORBSVCS_ERROR (( \
152 LM_ERROR, \
153 ACE_TEXT ("IDL: I don't understand the '%s' option\n"), \
154 av[i])); \
155 idl_global->parse_args_exit (1);
157 void
158 BE_GlobalData::parse_args (long &i, char **av)
160 switch (av[i][1])
162 case 'L':
163 if (av[i][2] == '\0')
165 be_global->enable_locking (true);
167 else
169 UNKNOWN_OPTION;
171 break;
173 case 'r':
174 if (av[i][2] == '\0')
176 be_global->removing (true);
178 else
180 UNKNOWN_OPTION;
182 break;
184 case 'S':
185 // Suppress ...
186 if (av[i][2] == 'i' && av[i][3] == '\0')
188 // ... processing of included IDL files.
189 be_global->do_included_files (0);
191 else
193 UNKNOWN_OPTION;
195 break;
197 case 'T':
198 if (av[i][2] == '\0')
200 be_global->allow_duplicate_typedefs (true);
202 else
204 UNKNOWN_OPTION;
206 break;
208 default:
209 UNKNOWN_OPTION;