Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

constituents_action_iterator Class Reference

Collaboration diagram for constituents_action_iterator:

Collaboration graph
[legend]
List of all members.

Public Types

enum  states { ready, need_include }

Public Member Functions

 constituents_action_iterator (Constituent &c)
void set (const cmt_string &w)

Public Attributes

Constituentm_constituent
cmt_string m_subdir
states m_state

Member Enumeration Documentation

enum constituents_action_iterator::states
 

Enumeration values:
ready 
need_include 

Definition at line 121 of file cmt_constituent.cxx.

00122   {
00123     ready,
00124     need_include
00125   } states;


Constructor & Destructor Documentation

constituents_action_iterator::constituents_action_iterator Constituent c  )  [inline]
 

Definition at line 127 of file cmt_constituent.cxx.

References m_constituent, m_state, and ready.

00127                                                 : m_constituent (c)
00128   {
00129     m_state = ready;
00130   }


Member Function Documentation

void constituents_action_iterator::set const cmt_string w  )  [inline]
 

Definition at line 132 of file cmt_constituent.cxx.

References CmtSystem::absolute_path(), Group::add(), cmt_vector< cmt_regexp >::add(), cmt_vector< T >::add(), CmtSystem::basename(), Constituent::build_triggers, CmtSystem::dirname(), cmt_string::erase(), Constituent::exclude_exprs, Constituent::excludes, CmtSystem::file_separator(), Variable::find(), cmt_string::find(), Cmt::get_quiet(), Constituent::group, Constituent::has_target_tag, Constituent::imports, Constituent::includes, Library, m_constituent, m_state, m_subdir, Constituent::modules, Constituent::name, Constituent::need_check, need_include, Constituent::need_OS9, Constituent::need_prototypes, Constituent::no_share, Constituent::no_static, ready, Constituent::select_exprs, Constituent::selects, Variable::set(), cmt_regexp::set(), cmt_string::substr(), Constituent::suffix, Constituent::type, Constituent::variables, and Constituent::windows.

Referenced by Constituent::parse().

00133   {
00134     int equal;
00135 
00136     if (w == "") return;
00137 
00138     if (m_state == need_include)
00139       {
00140         m_state = ready;
00141 
00142         cmt_string& include = m_constituent.includes.add ();
00143         include = w;
00144       }
00145 
00146     if (w == "-OS9")
00147       {
00148         m_constituent.need_OS9 = true;
00149       }
00150     else if ((w == "-Windows") ||
00151              (w == "-windows"))
00152       {
00153         m_constituent.windows = true;
00154       }
00155     else if (w == "-no_share")
00156       {
00157         m_constituent.no_share = true;
00158       }
00159     else if (w == "-no_static")
00160       {
00161         m_constituent.no_static = true;
00162       }
00163     else if (w == "-prototypes")
00164       {
00165         m_constituent.need_prototypes = true;
00166       }
00167     else if (w == "-no_prototypes")
00168       {
00169         m_constituent.need_prototypes = false;
00170       }
00171     else if (w == "-check")
00172       {
00173         m_constituent.need_check = true;
00174       }
00175     else if (w == "-triggers")
00176       {
00177         if (m_constituent.type == Library)
00178           {
00179               //m_constituent.build_triggers = true;
00180           }
00181       }
00182     else if (w == "-no_triggers")
00183       {
00184         if (m_constituent.type == Library)
00185           {
00186             m_constituent.build_triggers = false;
00187           }
00188       }
00189     else if (w == "-I")
00190       {
00191         m_state = need_include;
00192       }
00193     else if (w.substr (0, 3) == "-s=")
00194       {
00195         w.substr (3, m_subdir);
00196       }
00197     else if (w.substr (0, 3) == "-x=")
00198       {
00199         cmt_string& exclude = m_constituent.excludes.add ();
00200         w.substr (3, exclude);
00201         cmt_regexp& exp = m_constituent.exclude_exprs.add ();
00202         exp.set (exclude);
00203       }
00204     else if (w.substr (0, 3) == "-k=")
00205       {
00206         cmt_string& select = m_constituent.selects.add ();
00207         w.substr (3, select);
00208         cmt_regexp& exp = m_constituent.select_exprs.add ();
00209         exp.set (select);
00210       }
00211     else if (w.substr (0, 8) == "-import=")
00212       {
00213         cmt_string& import = m_constituent.imports.add ();
00214         w.substr (8, import);
00215       }
00216     else if (w.substr (0, 7) == "-group=")
00217       {
00218         cmt_string group_name = "";
00219 
00220         w.substr (7, group_name);
00221         
00222         if (group_name != "")
00223           {
00224             m_constituent.group = Group::add (group_name);
00225           }
00226       }
00227     else if (w.substr (0, 8) == "-suffix=")
00228       {
00229         w.substr (8, m_constituent.suffix);
00230       }
00231     else if (w == "-target_tag")
00232       {
00233         m_constituent.has_target_tag = true;
00234       }
00235     else if (w.substr (0, 1) == "-")
00236       {
00237         if (!Cmt::get_quiet ())
00238           {
00239             cerr << "#CMT> Warning: bad option " 
00240                  << w << " in constituent " << m_constituent.name << endl;
00241             //CmtError::set (CmtError::execution_error, cmd);
00242           }
00243       }
00244     else if ((equal = w.find ("=")) != cmt_string::npos)
00245       {
00246         cmt_string variable_name;
00247         cmt_string variable_value;
00248         
00249         w.substr (0, equal, variable_name);
00250         w.substr (equal + 1, variable_value);
00251         
00252         Variable* v = Variable::find (m_constituent.variables, variable_name);
00253         if (v == 0)
00254           {
00255             v = &(m_constituent.variables.add ());
00256             v->set (variable_name);
00257           }
00258 
00259         (*v) = variable_value;
00260       }
00261     else
00262       {
00263         // We have a normal source module
00264  
00265         cmt_string& module = m_constituent.modules.add ();
00266         
00267         module.erase (0);
00268           
00269         //
00270         // The prefix explicitly provided in (w) has priority
00271         // over the currently specified (m_subdir) when it is an
00272         // absolute path
00273         //
00274         if (CmtSystem::absolute_path (w))
00275           {
00276             module += w;
00277           }
00278         else
00279           {
00280             cmt_string prefix;
00281             cmt_string name = w;
00282 
00283             CmtSystem::dirname (name, prefix);
00284             if (prefix == "../src") CmtSystem::basename (name, name);
00285 
00286             module += m_subdir;
00287 
00288             if (module != "")
00289               {
00290                 module += CmtSystem::file_separator ();
00291               }
00292 
00293             module += name;
00294           }
00295       }
00296   }


Member Data Documentation

Constituent& constituents_action_iterator::m_constituent
 

Definition at line 298 of file cmt_constituent.cxx.

Referenced by constituents_action_iterator(), and set().

states constituents_action_iterator::m_state
 

Definition at line 300 of file cmt_constituent.cxx.

Referenced by constituents_action_iterator(), and set().

cmt_string constituents_action_iterator::m_subdir
 

Definition at line 299 of file cmt_constituent.cxx.

Referenced by set().


The documentation for this class was generated from the following file:
Generated on Mon May 2 10:25:35 2005 for CMT by doxygen 1.3.5