Main Page   Class Hierarchy   Compound List   File List   Compound 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 Methods

 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 99 of file cmt_constituent.cxx.

00100   {
00101     ready,
00102     need_include
00103   }


Constructor & Destructor Documentation

constituents_action_iterator::constituents_action_iterator ( Constituent & c ) [inline]
 

Definition at line 105 of file cmt_constituent.cxx.

00105                                                 : m_constituent (c)
00106   {
00107     m_state = ready;
00108   }


Member Function Documentation

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

Definition at line 110 of file cmt_constituent.cxx.

Referenced by Constituent::parse().

00111   {
00112     int equal;
00113 
00114     if (w == "") return;
00115 
00116     if (m_state == need_include)
00117       {
00118         m_state = ready;
00119 
00120         cmt_string& include = m_constituent.includes.add ();
00121         include = w;
00122       }
00123 
00124     if (w == "-OS9")
00125       {
00126         m_constituent.need_OS9 = true;
00127       }
00128     else if ((w == "-Windows") ||
00129              (w == "-windows"))
00130       {
00131         m_constituent.windows = true;
00132       }
00133     else if (w == "-no_share")
00134       {
00135         m_constituent.no_share = true;
00136       }
00137     else if (w == "-no_static")
00138       {
00139         m_constituent.no_static = true;
00140       }
00141     else if (w == "-prototypes")
00142       {
00143         m_constituent.need_prototypes = true;
00144       }
00145     else if (w == "-no_prototypes")
00146       {
00147         m_constituent.need_prototypes = false;
00148       }
00149     else if (w == "-check")
00150       {
00151         m_constituent.need_check = true;
00152       }
00153     else if (w == "-triggers")
00154       {
00155         if (m_constituent.type == Library)
00156           {
00157               //m_constituent.build_triggers = true;
00158           }
00159       }
00160     else if (w == "-no_triggers")
00161       {
00162         if (m_constituent.type == Library)
00163           {
00164             m_constituent.build_triggers = false;
00165           }
00166       }
00167     else if (w == "-I")
00168       {
00169         m_state = need_include;
00170       }
00171     else if (w.substr (0, 3) == "-s=")
00172       {
00173         w.substr (3, m_subdir);
00174       }
00175     else if (w.substr (0, 8) == "-import=")
00176       {
00177         cmt_string& import = m_constituent.imports.add ();
00178         w.substr (8, import);
00179       }
00180     else if (w.substr (0, 7) == "-group=")
00181       {
00182         cmt_string group_name = "";
00183 
00184         w.substr (7, group_name);
00185         
00186         m_constituent.group = Group::add (group_name);
00187       }
00188     else if (w.substr (0, 8) == "-suffix=")
00189       {
00190         w.substr (8, m_constituent.suffix);
00191       }
00192     else if ((equal = w.find ("=")) != cmt_string::npos)
00193       {
00194         cmt_string variable_name;
00195         cmt_string variable_value;
00196         
00197         w.substr (0, equal, variable_name);
00198         w.substr (equal + 1, variable_value);
00199         
00200         Variable* v = Variable::find (m_constituent.variables, variable_name);
00201         if (v == 0)
00202           {
00203             v = &(m_constituent.variables.add ());
00204             v->set (variable_name);
00205           }
00206 
00207         (*v) = variable_value;
00208       }
00209     else
00210       {
00211         // We have a normal source module
00212  
00213         cmt_string& module = m_constituent.modules.add ();
00214         
00215         module.erase (0);
00216           
00217         //
00218         // The prefix explicitly provided in (w) has priority
00219         // over the currently specified (m_subdir) when it is an
00220         // absolute path
00221         //
00222         if (CmtSystem::absolute_path (w))
00223           {
00224             module += w;
00225           }
00226         else
00227           {
00228             cmt_string prefix;
00229             cmt_string name = w;
00230 
00231             CmtSystem::dirname (name, prefix);
00232             if (prefix == "../src") CmtSystem::basename (name, name);
00233 
00234             module += m_subdir;
00235 
00236             if (module != "")
00237               {
00238                 module += CmtSystem::file_separator ();
00239               }
00240 
00241             module += name;
00242           }
00243       }
00244   }


Member Data Documentation

Constituent & constituents_action_iterator::m_constituent
 

Definition at line 246 of file cmt_constituent.cxx.

states constituents_action_iterator::m_state
 

Definition at line 248 of file cmt_constituent.cxx.

cmt_string constituents_action_iterator::m_subdir
 

Definition at line 247 of file cmt_constituent.cxx.


The documentation for this class was generated from the following file:
Generated at Thu Apr 11 16:50:39 2002 for CMT by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000