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

Constituent Class Reference

#include <cmt_constituent.h>

Collaboration diagram for Constituent:

Collaboration graph
[legend]
List of all members.

Public Types

typedef cmt_vector< ConstituentConstituentVector

Public Member Functions

 Constituent ()
 ~Constituent ()
void parse ()
virtual void clear ()
virtual void build_makefile (bool simulation) const
virtual void build_msdev_file (bool simulation) const
virtual void build_vsnet_file (bool simulation) const
virtual void show () const

Static Public Member Functions

void action (ConstituentType type, const CmtSystem::cmt_string_vector &words)
Constituentfind (const cmt_string &name)
Constituentadd (ConstituentType type, const cmt_string &name, const cmt_string &generator)
Constituentadd_for_action (const cmt_string &name)
void show (const cmt_string &name)
void parse_all ()
void show_all ()
void show_names ()
void build_all_makefiles (bool simulation)
void build_all_msdev_files (bool simulation)
void build_all_vsnet_files (bool simulation)
void clear_all ()
ConstituentVectorconstituents ()

Public Attributes

cmt_string name
cmt_string generator
ConstituentType type
Groupgroup
cmt_string suffix
CmtSystem::cmt_string_vector modules
bool need_OS9
bool windows
bool no_static
bool no_share
bool need_prototypes
bool need_check
bool build_triggers
bool has_target_tag
CmtSystem::cmt_string_vector excludes
cmt_vector< cmt_regexpexclude_exprs
CmtSystem::cmt_string_vector selects
cmt_vector< cmt_regexpselect_exprs
CmtSystem::cmt_string_vector includes
CmtSystem::cmt_string_vector imports
Variable::VariableVector variables

Private Attributes

CmtSystem::cmt_string_vector parameters

Member Typedef Documentation

typedef cmt_vector<Constituent> Constituent::ConstituentVector
 

Definition at line 18 of file cmt_constituent.h.

Referenced by add(), ConstituentsMakefileGenerator::build(), MakeSetupGenerator::build(), build_all_makefiles(), build_all_msdev_files(), build_all_vsnet_files(), Generator::build_msdev_workspace(), Generator::build_vsnet_workspace(), VSNETGenerator::build_workspace(), MSDEVGenerator::build_workspace(), clear_all(), Database::constituents(), constituents(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_constituent_macros(), find(), parse_all(), show_all(), and show_names().


Constructor & Destructor Documentation

Constituent::Constituent  ) 
 

Definition at line 446 of file cmt_constituent.cxx.

References clear().

00447 {
00448   clear ();
00449 }

Constituent::~Constituent  ) 
 

Definition at line 452 of file cmt_constituent.cxx.

00453 {
00454 }


Member Function Documentation

void Constituent::action ConstituentType  type,
const CmtSystem::cmt_string_vector words
[static]
 

Definition at line 304 of file cmt_constituent.cxx.

References cmt_vector< T >::add(), add(), CmtSystem::cmt_string_vector, Document, generator, name, and parameters.

Referenced by KwdLibrary::action(), KwdDocument::action(), and KwdApplication::action().

00306 {
00307   cmt_string generator;
00308   cmt_string name;
00309   Constituent* constituent;
00310 
00311   int i = 1;
00312 
00313   if (type == Document)
00314     {
00315       generator = words[i];
00316       if (generator == "") return;
00317       i++;
00318     }
00319 
00320   name = words[i];
00321   if (name == "") return;
00322   i++;
00323 
00324   constituent = add (type, name, generator);
00325 
00326   for (;i < words.size (); i++)
00327     {
00328       const cmt_string& w = words[i];
00329       cmt_string& parameter = constituent->parameters.add ();
00330       parameter = w;
00331     }
00332 }

Constituent * Constituent::add ConstituentType  type,
const cmt_string name,
const cmt_string generator
[static]
 

Definition at line 378 of file cmt_constituent.cxx.

References cmt_vector< T >::add(), clear(), constituents(), ConstituentVector, find(), generator, name, Cmt::need_prototypes(), need_prototypes, and type.

Referenced by action(), and add_for_action().

00381 {
00382   static ConstituentVector& Constituents = constituents ();
00383 
00384   {
00385     Constituent* constituent;
00386 
00387     if (name == "") return (0);
00388 
00389     constituent = find (name);
00390     if (constituent != 0) return (constituent);
00391   }
00392 
00393   Constituent& constituent = Constituents.add ();
00394   constituent.clear ();
00395 
00396   constituent.name      = name;
00397   constituent.generator = generator;
00398   constituent.type      = type;
00399   constituent.need_prototypes = Cmt::need_prototypes ();
00400 
00401   return (&constituent);
00402 }

Constituent * Constituent::add_for_action const cmt_string name  )  [static]
 

Definition at line 405 of file cmt_constituent.cxx.

References cmt_vector< T >::add(), Group::add(), add(), Document, group, has_target_tag, and parameters.

Referenced by parse_all().

00406 {
00407   Constituent* constituent;
00408 
00409   constituent = add (Document, name, "cmt_action_runner");
00410 
00411   constituent->group = Group::add ("cmt_actions");
00412   constituent->has_target_tag = true;
00413 
00414   cmt_string& p1 = constituent->parameters.add ();
00415   p1 = "action_value=";
00416   p1 += "$(";
00417   p1 += name;
00418   p1 += ")";
00419 
00420   return (constituent);
00421 }

void Constituent::build_all_makefiles bool  simulation  )  [static]
 

Definition at line 483 of file cmt_constituent.cxx.

References build_makefile(), constituents(), ConstituentVector, and cmt_vector< T >::size().

Referenced by Cmt::build_makefile().

00484 {
00485   static ConstituentVector& Constituents = constituents ();
00486 
00487   int i;
00488 
00489   for (i = 0; i < Constituents.size (); i++)
00490     {
00491       Constituent& constituent = Constituents[i];
00492 
00493       constituent.build_makefile (simulation);
00494     }
00495 }

void Constituent::build_all_msdev_files bool  simulation  )  [static]
 

Definition at line 498 of file cmt_constituent.cxx.

References build_msdev_file(), Generator::build_msdev_workspace(), constituents(), ConstituentVector, and cmt_vector< T >::size().

Referenced by Cmt::build_msdev_file().

00499 {
00500   static ConstituentVector& Constituents = constituents ();
00501 
00502   int i;
00503 
00504   Generator::build_msdev_workspace (Constituents);
00505 
00506   for (i = 0; i < Constituents.size (); i++)
00507     {
00508       Constituent& constituent = Constituents[i];
00509 
00510       constituent.build_msdev_file (simulation);
00511     }
00512 }

void Constituent::build_all_vsnet_files bool  simulation  )  [static]
 

Definition at line 516 of file cmt_constituent.cxx.

References build_vsnet_file(), Generator::build_vsnet_workspace(), constituents(), ConstituentVector, and cmt_vector< T >::size().

Referenced by Cmt::build_vsnet_file().

00517 {                                                                
00518   static ConstituentVector& Constituents = constituents ();      
00519                                                                  
00520   int i;                                                         
00521                                                                  
00522   Generator::build_vsnet_workspace (Constituents);               
00523                                                                  
00524   for (i = 0; i < Constituents.size (); i++)                     
00525     {                                                            
00526       Constituent& constituent = Constituents[i];                
00527                                                                  
00528       constituent.build_vsnet_file (simulation);                 
00529     }                                                            
00530 }                                                                

void Constituent::build_makefile bool  simulation  )  const [virtual]
 

Definition at line 533 of file cmt_constituent.cxx.

References Generator::build_constituent_makefile().

Referenced by build_all_makefiles(), and Cmt::build_makefile().

00534 {
00535   if (!simulation)
00536     {
00537       Generator::build_constituent_makefile (*this);
00538     }
00539 }

void Constituent::build_msdev_file bool  simulation  )  const [virtual]
 

Definition at line 542 of file cmt_constituent.cxx.

References Generator::build_msdev().

Referenced by build_all_msdev_files(), and Cmt::build_msdev_file().

00543 {
00544   if (!simulation)
00545     {
00546       Generator::build_msdev (*this);
00547     }
00548 }

void Constituent::build_vsnet_file bool  simulation  )  const [virtual]
 

Definition at line 552 of file cmt_constituent.cxx.

References Generator::build_vsnet().

Referenced by build_all_vsnet_files(), and Cmt::build_vsnet_file().

00553 {                                                             
00554   if (!simulation)                                            
00555     {                                                         
00556       Generator::build_vsnet (*this);                         
00557     }
00558 }

void Constituent::clear  )  [virtual]
 

Definition at line 457 of file cmt_constituent.cxx.

References build_triggers, cmt_vector< cmt_regexp >::clear(), cmt_vector< T >::clear(), Document, exclude_exprs, excludes, generator, group, has_target_tag, imports, includes, modules, name, need_check, need_OS9, need_prototypes, no_share, no_static, parameters, select_exprs, selects, type, variables, and windows.

Referenced by add(), clear_all(), and Constituent().

00458 {
00459   name      = "";
00460   generator = "";
00461   type = Document;
00462   group     = 0;
00463   modules.clear ();
00464   parameters.clear ();
00465   need_OS9        = false;
00466   windows         = false;
00467   no_static       = false;
00468   no_share        = false;
00469   need_prototypes = false;
00470   need_check      = false;
00471   build_triggers  = false;
00472   has_target_tag  = false;
00473   excludes.clear ();
00474   exclude_exprs.clear ();
00475   selects.clear ();
00476   select_exprs.clear ();
00477   includes.clear ();
00478   imports.clear ();
00479   variables.clear ();
00480 }

void Constituent::clear_all  )  [static]
 

Definition at line 424 of file cmt_constituent.cxx.

References cmt_vector< T >::clear(), clear(), constituents(), ConstituentVector, and cmt_vector< T >::size().

Referenced by Database::clear().

00425 {
00426   static ConstituentVector& Constituents = constituents ();
00427 
00428   for (int i = 0; i < Constituents.size (); i++)
00429     {
00430       Constituent& c = Constituents[i];
00431       c.clear ();
00432     }
00433   Constituents.clear ();
00434 }

Constituent::ConstituentVector & Constituent::constituents  )  [static]
 

Definition at line 437 of file cmt_constituent.cxx.

References Database::constituents(), ConstituentVector, and Database::instance().

Referenced by add(), ConstituentsMakefileGenerator::build(), MakeSetupGenerator::build(), build_all_makefiles(), build_all_msdev_files(), build_all_vsnet_files(), clear_all(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_constituent_macros(), find(), parse_all(), show_all(), and show_names().

00438 {
00439   static Database& db = Database::instance ();
00440   static ConstituentVector& Constituents = db.constituents ();
00441 
00442   return (Constituents);
00443 }

Constituent * Constituent::find const cmt_string name  )  [static]
 

Definition at line 95 of file cmt_constituent.cxx.

References constituents(), ConstituentVector, name, and cmt_vector< T >::size().

Referenced by add(), DependencyGenerator::build(), Generator::build_constituent_makefile(), Cmt::build_makefile(), Cmt::build_msdev_file(), Cmt::build_vsnet_file(), Cmt::do_show_constituent(), TriggerGenerator::run(), and show().

00096 {
00097   static ConstituentVector& Constituents = constituents ();
00098 
00099   int constituent_index;
00100 
00101   if (Constituents.size () == 0) return (0);
00102 
00103   for (constituent_index = 0;
00104        constituent_index < Constituents.size ();
00105        constituent_index++)
00106     {
00107       Constituent& constituent = Constituents[constituent_index];
00108 
00109       if (constituent.name == name)
00110         {
00111           return (&constituent);
00112         }
00113     }
00114 
00115   return (0);
00116 }

void Constituent::parse  ) 
 

Definition at line 335 of file cmt_constituent.cxx.

References cmt_vector< T >::clear(), CmtSystem::cmt_string_vector, Symbol::expand(), modules, parameters, constituents_action_iterator::set(), cmt_vector< T >::size(), CmtSystem::split(), and cmt_string::substr().

Referenced by parse_all().

00336 {
00337   if (parameters.size () == 0) return;
00338 
00339   Constituent& me = *this;
00340 
00341   modules.clear ();
00342 
00343   constituents_action_iterator it (me);
00344 
00345   for (int i = 0; i < parameters.size (); i++)
00346     {
00347       const cmt_string& w = parameters[i];
00348       cmt_string ew = w;
00349 
00350       Symbol::expand (ew);
00351 
00352       CmtSystem::cmt_string_vector ws;
00353 
00354       //cerr << "Constituent " << name << " Analyzing module " << ew << endl;
00355 
00356       if (ew.substr (0, 13) == "action_value=")
00357         {
00358           it.set (ew);
00359         }
00360       else
00361         {
00362           CmtSystem::split (ew, " \t", ws);
00363 
00364           for (int j = 0; j < ws.size (); ++j)
00365             {
00366               const cmt_string& w = ws[j];
00367           
00368               //cerr << "Constituent " << name << " Setting module " << w << endl;
00369               it.set (w);
00370             }
00371         }
00372     }
00373 
00374   parameters.clear ();
00375 }

void Constituent::parse_all  )  [static]
 

Definition at line 35 of file cmt_constituent.cxx.

References add_for_action(), Symbol::build_macro_value(), constituents(), ConstituentVector, Symbol::name, parse(), cmt_vector< T >::size(), Symbol::symbol(), Symbol::symbol_number(), Symbol::type, and Symbol::value_lists.

Referenced by StandardMacroBuilder::fill_for_all_constituents().

00036 {
00037   static ConstituentVector& Constituents = constituents ();
00038 
00039   int number;
00040 
00041   for (number = 0; number < Symbol::symbol_number (); number++)
00042     {
00043       Symbol& symbol = Symbol::symbol (number);
00044 
00045       if (symbol.type != Symbol::SymbolAction) continue;
00046 
00047       if (symbol.value_lists.size () < 1) continue;
00048 
00049       cmt_string value = symbol.build_macro_value ();
00050 
00051       if (value != "")
00052         {
00053           add_for_action (symbol.name);
00054         }
00055     }
00056 
00057   for (number = 0; number < Constituents.size (); number++)
00058     {
00059       Constituent& constituent = Constituents[number];
00060 
00061       constituent.parse ();
00062     }
00063 }

void Constituent::show  )  const [virtual]
 

Definition at line 561 of file cmt_constituent.cxx.

References Application, build_triggers, Document, excludes, generator, group, has_target_tag, imports, Library, modules, Variable::name, Group::name(), name, need_check, no_share, no_static, selects, cmt_vector< T >::size(), suffix, type, Variable::value, and variables.

00562 {
00563   int i;
00564 
00565   switch (type)
00566     {
00567       case Library:
00568         cout << "library";
00569         break;
00570       case Application:
00571         cout << "application";
00572         break;
00573       case Document:
00574         cout << "document " << generator;
00575         break;
00576     }
00577   
00578   cout << " " << name;
00579   
00580   if (group != 0)
00581     {
00582       cout << " -group=" << group->name ();
00583     }
00584   
00585   if (suffix != 0)
00586     {
00587       cout << " -suffix=" << suffix;
00588     }
00589   
00590   if ((type == Application) && need_check)
00591     {
00592       cout << " -check";
00593     }
00594   
00595   if ((type == Library) && no_share)
00596     {
00597       cout << " -no_share";
00598     }
00599   
00600   if ((type == Library) && no_static)
00601     {
00602       cout << " -no_static";
00603     }
00604   
00605   if ((type == Library) && build_triggers)
00606     {
00607       cout << " -triggers";
00608     }
00609   
00610   if (has_target_tag)
00611     {
00612       cout << " -target_tag";
00613     }
00614   
00615   for (i = 0; i < (imports.size ()); i++)
00616     {
00617       const cmt_string& import_name = imports[i];
00618       
00619       cout << " -import=" << import_name;
00620     }
00621   
00622   for (i = 0; i < (excludes.size ()); i++)
00623     {
00624       const cmt_string& exclude = excludes[i];
00625       
00626       cout << " -x=" << exclude;
00627     }
00628   
00629   for (i = 0; i < (selects.size ()); i++)
00630     {
00631       const cmt_string& select = selects[i];
00632       
00633       cout << " -k=" << select;
00634     }
00635   
00636   for (i = 0; i < (modules.size ()); i++)
00637     {
00638       const cmt_string& module_name = modules[i];
00639       
00640       cout << " " << module_name;
00641     }
00642   
00643   for (i = 0; i < (variables.size ()); i++)
00644     {
00645       const Variable& v = variables[i];
00646       
00647       cout << " " << v.name << "=" << v.value;
00648     }
00649   
00650   cout << endl;
00651 }

void Constituent::show const cmt_string name  )  [static]
 

Definition at line 24 of file cmt_constituent.cxx.

References find().

Referenced by Cmt::do_show_constituent(), and show_all().

00025 {
00026   Constituent* cptr = find (name);
00027   if (cptr == 0) return;
00028 
00029   const Constituent& constituent = *cptr;
00030 
00031   constituent.show ();
00032 }

void Constituent::show_all  )  [static]
 

Definition at line 66 of file cmt_constituent.cxx.

References constituents(), ConstituentVector, show(), and cmt_vector< T >::size().

Referenced by Cmt::do_show_constituents().

00067 {
00068   static ConstituentVector& Constituents = constituents ();
00069 
00070   int number;
00071 
00072   for (number = 0; number < Constituents.size (); number++)
00073     {
00074       const Constituent& constituent = Constituents[number];
00075 
00076       constituent.show ();
00077     }
00078 }

void Constituent::show_names  )  [static]
 

Definition at line 81 of file cmt_constituent.cxx.

References constituents(), ConstituentVector, name, and cmt_vector< T >::size().

Referenced by Cmt::do_show_constituent_names().

00082 {
00083   static ConstituentVector& Constituents = constituents ();
00084 
00085   int number;
00086 
00087   for (number = 0; number < Constituents.size (); number++)
00088     {
00089       Constituent& constituent = Constituents[number];
00090       cout << constituent.name << endl;
00091     }
00092 }


Member Data Documentation

bool Constituent::build_triggers
 

Definition at line 59 of file cmt_constituent.h.

Referenced by LibraryGenerator::build(), clear(), constituents_action_iterator::set(), and show().

cmt_vector<cmt_regexp> Constituent::exclude_exprs
 

Definition at line 62 of file cmt_constituent.h.

Referenced by DependencyGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), and constituents_action_iterator::set().

CmtSystem::cmt_string_vector Constituent::excludes
 

Definition at line 61 of file cmt_constituent.h.

Referenced by clear(), constituents_action_iterator::set(), and show().

cmt_string Constituent::generator
 

Definition at line 48 of file cmt_constituent.h.

Referenced by action(), add(), DocumentGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), and show().

Group* Constituent::group
 

Definition at line 50 of file cmt_constituent.h.

Referenced by add_for_action(), clear(), StandardMacroBuilder::fill_for_constituent_macros(), constituents_action_iterator::set(), and show().

bool Constituent::has_target_tag
 

Definition at line 60 of file cmt_constituent.h.

Referenced by add_for_action(), ConstituentsMakefileGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), clear(), constituents_action_iterator::set(), and show().

CmtSystem::cmt_string_vector Constituent::imports
 

Definition at line 68 of file cmt_constituent.h.

Referenced by clear(), StandardMacroBuilder::fill_for_all_constituents(), constituents_action_iterator::set(), and show().

CmtSystem::cmt_string_vector Constituent::includes
 

Definition at line 67 of file cmt_constituent.h.

Referenced by DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), and constituents_action_iterator::set().

CmtSystem::cmt_string_vector Constituent::modules
 

Definition at line 52 of file cmt_constituent.h.

Referenced by DependencyGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), parse(), constituents_action_iterator::set(), and show().

cmt_string Constituent::name
 

Definition at line 47 of file cmt_constituent.h.

Referenced by action(), add(), LibraryGenerator::analyze_file(), DependencyGenerator::build(), ConstituentsMakefileGenerator::build(), DocumentGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), VSNETGenerator::build_workspace(), MSDEVGenerator::build_workspace(), clear(), ApplicationAnalyzer::end(), LibraryAnalyzer::end(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_constituent_macros(), find(), CmtGenerator::prepare_output(), constituents_action_iterator::set(), show(), and show_names().

bool Constituent::need_check
 

Definition at line 58 of file cmt_constituent.h.

Referenced by ConstituentsMakefileGenerator::build(), LibraryGenerator::build(), clear(), constituents_action_iterator::set(), and show().

bool Constituent::need_OS9
 

Definition at line 53 of file cmt_constituent.h.

Referenced by VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), CmtGenerator::prepare_output(), and constituents_action_iterator::set().

bool Constituent::need_prototypes
 

Definition at line 57 of file cmt_constituent.h.

Referenced by add(), LibraryGenerator::build(), clear(), and constituents_action_iterator::set().

bool Constituent::no_share
 

Definition at line 56 of file cmt_constituent.h.

Referenced by LibraryGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), constituents_action_iterator::set(), and show().

bool Constituent::no_static
 

Definition at line 55 of file cmt_constituent.h.

Referenced by clear(), constituents_action_iterator::set(), and show().

CmtSystem::cmt_string_vector Constituent::parameters [private]
 

Definition at line 72 of file cmt_constituent.h.

Referenced by action(), add_for_action(), clear(), and parse().

cmt_vector<cmt_regexp> Constituent::select_exprs
 

Definition at line 65 of file cmt_constituent.h.

Referenced by DependencyGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), and constituents_action_iterator::set().

CmtSystem::cmt_string_vector Constituent::selects
 

Definition at line 64 of file cmt_constituent.h.

Referenced by clear(), constituents_action_iterator::set(), and show().

cmt_string Constituent::suffix
 

Definition at line 51 of file cmt_constituent.h.

Referenced by LibraryGenerator::analyze_file(), ConstituentsMakefileGenerator::build(), MSDEVGenerator::build_project(), VSNETGenerator::build_workspace(), MSDEVGenerator::build_workspace(), CmtGenerator::prepare_output(), constituents_action_iterator::set(), and show().

ConstituentType Constituent::type
 

Definition at line 49 of file cmt_constituent.h.

Referenced by add(), LibraryGenerator::build(), Generator::build_constituent_makefile(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), VSNETGenerator::build_workspace(), MSDEVGenerator::build_workspace(), clear(), StandardMacroBuilder::fill_for_all_constituents(), TriggerGenerator::run(), constituents_action_iterator::set(), and show().

Variable::VariableVector Constituent::variables
 

Definition at line 69 of file cmt_constituent.h.

Referenced by ConstituentsMakefileGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), VSNETGenerator::build_workspace(), MSDEVGenerator::build_workspace(), clear(), LibraryGenerator::java_file_action(), LibraryGenerator::module_file_action(), LibraryGenerator::proto_file_action(), constituents_action_iterator::set(), and show().

bool Constituent::windows
 

Definition at line 54 of file cmt_constituent.h.

Referenced by VSNETGenerator::build_project(), MSDEVGenerator::build_project(), clear(), and constituents_action_iterator::set().


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