Main Page ? Class Hierarchy ? Compound List ? File List ? Compound Members ? File Members ?

ConstituentsMakefileGenerator Class Reference

#include <cmt_generators.h>

Inheritance diagram for ConstituentsMakefileGenerator:

[legend]
Collaboration diagram for ConstituentsMakefileGenerator:

[legend]
List of all members.

Public Methods

? ConstituentsMakefileGenerator ()
void? build (const cmt_string &package, const CmtSystem::cmt_string_vector &arguments)

Private Methods

void? reset ()

Private Attributes

FragmentHandle? constituents_header_fragment
FragmentHandle? constituents_trailer_fragment
FragmentHandle? group_fragment
FragmentHandle? constituent_fragment
FragmentHandle? check_application_header_fragment

Constructor & Destructor Documentation

ConstituentsMakefileGenerator::ConstituentsMakefileGenerator (? ? )?
?

Definition at line 2354 of file cmt_generators.cxx.

References check_application_header_fragment, constituent_fragment, constituents_header_fragment, constituents_trailer_fragment, group_fragment, and FragmentHandle::set().

02355 {
02356   constituents_header_fragment.set ("constituents_header");
02357   constituents_trailer_fragment.set ("constituents_trailer");
02358   group_fragment.set ("group");
02359   constituent_fragment.set ("constituent");
02360   check_application_header_fragment.set ("check_application_header");
02361 }

Member Function Documentation

void ConstituentsMakefileGenerator::build (? const cmt_string &? ? package,
const CmtSystem::cmt_string_vector &? ? arguments
)?
?

Definition at line 2374 of file cmt_generators.cxx.

References Cmt::build_nmake(), check_application_header_fragment, CmtGenerator::commit(), constituent_fragment, Constituent::constituents(), constituents_header_fragment, constituents_trailer_fragment, FragmentHandle::copy(), cmt_string::erase(), group_fragment, Group::groups(), Constituent::has_target_tag, CmtGenerator::m_CONSTITUENT, CmtGenerator::m_CONSTITUENTSUFFIX, CmtGenerator::m_GROUP, CmtGenerator::m_HASTARGETTAG, CmtGenerator::m_LINE, CmtGenerator::m_output_file, CmtGenerator::m_PACKAGE, Constituent::name, Group::name(), Constituent::need_check, reset(), cmt_vector< Constituent >::size(), cmt_vector< Group >::size(), cmt_vector< cmt_string >::size(), cmt_string::substr(), Constituent::suffix, CmtSystem::test_file(), and Constituent::variables.

Referenced by Generator::build_constituents_makefile().

02376 {
02377   reset ();
02378 
02379   cmt_string file_name;
02380 
02381   if (arguments.size () > 0)
02382     {
02383       cmt_string arg = arguments[0];
02384       if (arg.substr (0, 5) == "-out=")
02385         {
02386           arg.erase (0, 5);
02387           file_name = arg;
02388         }
02389     }
02390 
02391   if (file_name == "")
02392     {
02393       file_name = "constituents.";
02394 
02395       //--- Build the constituents fragment -----
02396 
02397       if (Cmt::build_nmake ())
02398         {
02399           file_name += "nmake";
02400         }
02401       else
02402         {
02403           file_name += "make";
02404         }
02405     }
02406 
02407   cmt_string save_file_name = file_name;
02408   save_file_name += "sav";
02409 
02410   if (CmtSystem::test_file (file_name))
02411     {
02412       rename (file_name, save_file_name);
02413     }
02414 
02415   cmt_string new_file_name = file_name;
02416   new_file_name += "new";
02417 
02418   m_output_file = fopen (new_file_name, "wb");
02419   if (m_output_file != NULL)
02420     {
02421       int number;
02422       const Constituent::ConstituentVector&
02423         constituents = Constituent::constituents ();
02424 
02425       m_PACKAGE = package;
02426 
02427       constituents_header_fragment.copy (m_output_file, 1, &m_PACKAGE);
02428 
02429       m_GROUP = "all";
02430       group_fragment.copy (m_output_file, 1, &m_GROUP);
02431 
02432       const Group::GroupVector& groups = Group::groups ();
02433 
02434       for (number = 0; number < groups.size (); number++)
02435         {
02436           const Group& group = groups[number];
02437 
02438           m_GROUP = group.name ();
02439 
02440           group_fragment.copy (m_output_file, 1, &m_GROUP);
02441         }
02442       
02443       for (number = 0; number < constituents.size (); number++)
02444         {
02445           const Constituent& constituent = constituents[number];
02446 
02447           m_CONSTITUENT = constituent.name;
02448           m_CONSTITUENTSUFFIX = constituent.suffix;
02449 
02450           m_LINE = "";
02451 
02452           if (constituent.has_target_tag)
02453             {
02454               m_HASTARGETTAG = "has_target_tag";
02455             }
02456           else
02457             {
02458               m_HASTARGETTAG = "has_no_target_tag";
02459             }
02460 
02461           constituent_fragment.copy (m_output_file, constituent.variables, 5, 
02462                                      &m_PACKAGE,
02463                                      &m_CONSTITUENT, 
02464                                      &m_CONSTITUENTSUFFIX,
02465                                      &m_LINE,
02466                                      &m_HASTARGETTAG);
02467 
02468           if (constituent.need_check)
02469             {
02470               check_application_header_fragment.copy (m_output_file, 
02471                                                       constituent.variables, 3,
02472                                                       &m_PACKAGE,
02473                                                       &m_CONSTITUENT,
02474                                                       &m_CONSTITUENTSUFFIX);
02475             }
02476         }
02477 
02478       constituents_trailer_fragment.copy (m_output_file, 0);
02479 
02480       fclose (m_output_file);
02481 
02482       commit (new_file_name);
02483     }
02484 }

void ConstituentsMakefileGenerator::reset (? ? )? [private]
?

Reimplemented from CmtGenerator.

Definition at line 2363 of file cmt_generators.cxx.

References check_application_header_fragment, constituent_fragment, constituents_header_fragment, constituents_trailer_fragment, group_fragment, FragmentHandle::reset(), and CmtGenerator::reset().

Referenced by build().


Member Data Documentation

FragmentHandle ConstituentsMakefileGenerator::check_application_header_fragment [private]
?

Definition at line 201 of file cmt_generators.h.

Referenced by build(), ConstituentsMakefileGenerator(), and reset().

FragmentHandle ConstituentsMakefileGenerator::constituent_fragment [private]
?

Definition at line 200 of file cmt_generators.h.

Referenced by build(), ConstituentsMakefileGenerator(), and reset().

FragmentHandle ConstituentsMakefileGenerator::constituents_header_fragment [private]
?

Definition at line 197 of file cmt_generators.h.

Referenced by build(), ConstituentsMakefileGenerator(), and reset().

FragmentHandle ConstituentsMakefileGenerator::constituents_trailer_fragment [private]
?

Definition at line 198 of file cmt_generators.h.

Referenced by build(), ConstituentsMakefileGenerator(), and reset().

FragmentHandle ConstituentsMakefileGenerator::group_fragment [private]
?

Definition at line 199 of file cmt_generators.h.

Referenced by build(), ConstituentsMakefileGenerator(), and reset().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 15:26:47 2004 for CMT by 1.2.18