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

MSDEVGenerator Class Reference

#include <cmt_generators.h>

Inheritance diagram for MSDEVGenerator:

Inheritance graph
[legend]
Collaboration diagram for MSDEVGenerator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MSDEVGenerator ()
int build_workspace (const Constituent::ConstituentVector &constituents)
int build_project (const Constituent &constituent)

Private Member Functions

void reset ()

Private Attributes

cmt_string msdevdir
FragmentHandle dsw_header_fragment
FragmentHandle dsw_project_fragment
FragmentHandle dsw_all_project_header_fragment
FragmentHandle dsw_all_project_dependency_fragment
FragmentHandle dsw_all_project_trailer_fragment
FragmentHandle dsw_trailer_fragment
FragmentHandle dsp_all_fragment
FragmentHandle dsp_library_header_fragment
FragmentHandle dsp_application_header_fragment
FragmentHandle dsp_windows_header_fragment
FragmentHandle dsp_contents_fragment
FragmentHandle dsp_trailer_fragment

Constructor & Destructor Documentation

MSDEVGenerator::MSDEVGenerator  ) 
 

Definition at line 1533 of file cmt_generators.cxx.

References dsp_all_fragment, dsp_application_header_fragment, dsp_contents_fragment, dsp_library_header_fragment, dsp_trailer_fragment, dsp_windows_header_fragment, dsw_all_project_dependency_fragment, dsw_all_project_header_fragment, dsw_all_project_trailer_fragment, dsw_header_fragment, dsw_project_fragment, dsw_trailer_fragment, and FragmentHandle::set().

01534 {
01535   dsw_header_fragment.set ("dsw_header");
01536   dsw_project_fragment.set ("dsw_project");
01537   dsw_all_project_header_fragment.set ("dsw_all_project_header");
01538   dsw_all_project_dependency_fragment.set ("dsw_all_project_dependency");
01539   dsw_all_project_trailer_fragment.set ("dsw_all_project_trailer");
01540   dsw_trailer_fragment.set ("dsw_trailer");
01541 
01542   dsp_all_fragment.set ("dsp_all");
01543   dsp_library_header_fragment.set ("dsp_library_header");
01544   dsp_application_header_fragment.set ("dsp_application_header");
01545   dsp_windows_header_fragment.set ("dsp_windows_header");
01546   dsp_contents_fragment.set ("dsp_contents");
01547   dsp_trailer_fragment.set ("dsp_trailer");
01548 }


Member Function Documentation

int MSDEVGenerator::build_project const Constituent constituent  ) 
 

Definition at line 1688 of file cmt_generators.cxx.

References Application, CmtSystem::cmt_string_vector, Document, Constituent::exclude_exprs, Constituent::generator, CmtGenerator::get_all_files(), Constituent::includes, Library, Constituent::modules, Constituent::name, Constituent::need_OS9, Constituent::no_share, reset(), Constituent::select_exprs, CmtGenerator::set_full_name(), cmt_vector< T >::size(), Constituent::suffix, CmtGenerator::terminate(), Constituent::type, Constituent::variables, and Constituent::windows.

Referenced by Generator::build_msdev().

01689 {
01690   reset ();
01691 
01692   const cmt_string& package = Cmt::get_current_package ();
01693   static cmt_string file;
01694   static cmt_string full_name;
01695   static cmt_string suffix;
01696 
01697   int i;
01698 
01699   m_CONSTITUENT = constituent.name;
01700   m_CONSTITUENTSUFFIX = constituent.suffix;
01701 
01702   for (i = 0; i < constituent.includes.size (); i++)
01703     {
01704       const cmt_string& include = constituent.includes[i];
01705       m_PACKINCLUDES += " -I" + include;
01706     }
01707 
01708   switch (constituent.type)
01709     {
01710     case Application:
01711       is_application = true;
01712       m_TITLE = "Application";
01713       break;
01714     case Library:
01715       is_library = true;
01716       m_TITLE = "Library";
01717       break;
01718     case Document:
01719       m_GENERATOR = constituent.generator;
01720       m_TITLE = "Document";
01721       break;
01722     }
01723 
01724   m_PACKOS9 = constituent.need_OS9;
01725 
01726   const CmtSystem::cmt_string_vector& sources = constituent.modules;
01727   const cmt_vector<cmt_regexp>& excludes = constituent.exclude_exprs;
01728   const cmt_vector<cmt_regexp>& selects = constituent.select_exprs;
01729 
01730   //--- Build the constituents fragment -----
01731 
01732   m_output_file_name = msdevdir + m_CONSTITUENT + ".dspnew";
01733   m_output_file = fopen (m_output_file_name.c_str (), "wb");
01734 
01735   if (m_output_file == NULL) return (0);
01736 
01737   m_PACKAGE = package;
01738 
01739   if (is_library)
01740     {
01741       if (constituent.no_share)
01742         {
01743           m_LIBRARYSUFFIX = "lib";
01744         }
01745       else
01746         {
01747           m_LIBRARYSUFFIX = "arc";
01748         }
01749 
01750       dsp_library_header_fragment.wincopy (m_output_file, constituent.variables, 4,
01751                                            &m_PACKAGE,
01752                                            &m_CONSTITUENT, 
01753                                            &m_CONSTITUENTSUFFIX, 
01754                                            &m_LIBRARYSUFFIX);
01755     }
01756   else
01757     {
01758       if (constituent.windows)
01759         {
01760           dsp_windows_header_fragment.wincopy (m_output_file, constituent.variables, 3,
01761                                                &m_PACKAGE,
01762                                                &m_CONSTITUENT, 
01763                                                &m_CONSTITUENTSUFFIX);
01764         }
01765       else
01766         {
01767           dsp_application_header_fragment.wincopy (m_output_file, constituent.variables, 3,
01768                                                    &m_PACKAGE,
01769                                                    &m_CONSTITUENT, 
01770                                                    &m_CONSTITUENTSUFFIX);
01771         }
01772     }
01773 
01774   for (i = 0; i < sources.size (); i++)
01775     {
01776       file = sources[i];
01777 
01778       set_full_name (full_name, file);
01779       if (full_name == "") continue;
01780 
01781       static CmtSystem::cmt_string_vector files;
01782 
01783       get_all_files (full_name, excludes, selects, files);
01784 
01785       for (int j = 0; j < files.size (); j++)
01786         {
01787           const cmt_string& name = files[j];
01788 
01789           if (name != "") 
01790             {
01791               m_FULLNAME = name;
01792 
01793               if (m_output_file != NULL)
01794                 {
01795                   dsp_contents_fragment.wincopy (m_output_file, constituent.variables, 2, 
01796                                                  &m_PACKAGE, 
01797                                                  &m_FULLNAME);
01798                 }
01799             }
01800         }
01801     }
01802 
01803   if (m_output_file != NULL)
01804     {
01805       dsp_trailer_fragment.wincopy (m_output_file, constituent.variables, 3,
01806                                     &m_PACKAGE,
01807                                     &m_CONSTITUENT, 
01808                                     &m_CONSTITUENTSUFFIX);
01809 
01810       terminate ();
01811     }
01812 
01813   return (0);
01814 }

int MSDEVGenerator::build_workspace const Constituent::ConstituentVector constituents  ) 
 

Definition at line 1597 of file cmt_generators.cxx.

References Constituent::ConstituentVector, Library, Constituent::name, reset(), cmt_vector< T >::size(), Constituent::suffix, CmtGenerator::terminate(), Constituent::type, and Constituent::variables.

Referenced by Generator::build_msdev_workspace().

01598 {
01599   reset ();
01600 
01601   const cmt_string& package = Cmt::get_current_package ();
01602 
01603   m_output_file_name = msdevdir + package + ".dswnew";
01604 
01605   m_output_file = fopen (m_output_file_name.c_str (), "wb");
01606   if (m_output_file != NULL)
01607     {
01608       m_PACKAGE = package;
01609       dsw_header_fragment.wincopy (m_output_file, 1,
01610                                    &m_PACKAGE);
01611 
01612       int i;
01613 
01614       dsw_all_project_header_fragment.wincopy (m_output_file, 1, 
01615                                                &m_PACKAGE);
01616 
01617       for (i = 0; i < constituents.size (); i++)
01618         {
01619           const Constituent& constituent = constituents[i];
01620 
01621           if (constituent.type == Library)
01622             {
01623               m_CONSTITUENT = constituent.name;
01624               m_CONSTITUENTSUFFIX = constituent.suffix;
01625               dsw_all_project_dependency_fragment.wincopy (m_output_file, constituent.variables, 3,
01626                                                            &m_PACKAGE,
01627                                                            &m_CONSTITUENT, 
01628                                                            &m_CONSTITUENTSUFFIX);
01629             }
01630           else
01631             {
01632               m_CONSTITUENT = constituent.name;
01633               m_CONSTITUENTSUFFIX = constituent.suffix;
01634               dsw_all_project_dependency_fragment.wincopy (m_output_file, constituent.variables, 3,
01635                                                            &m_PACKAGE,
01636                                                            &m_CONSTITUENT, 
01637                                                            &m_CONSTITUENTSUFFIX);
01638             }
01639 
01640         }
01641 
01642       dsw_all_project_trailer_fragment.wincopy (m_output_file,
01643                                                 1, &m_PACKAGE);
01644 
01645       for (i = 0; i < constituents.size (); i++)
01646         {
01647           const Constituent& constituent = constituents[i];
01648 
01649           if (constituent.type == Library)
01650             {
01651               m_CONSTITUENT = constituent.name;
01652               m_CONSTITUENTSUFFIX = constituent.suffix;
01653               dsw_project_fragment.wincopy (m_output_file,
01654                                             constituent.variables, 3,
01655                                             &m_PACKAGE,
01656                                             &m_CONSTITUENT, 
01657                                             &m_CONSTITUENTSUFFIX);
01658             }
01659           else
01660             {
01661               m_CONSTITUENT = constituent.name;
01662               m_CONSTITUENTSUFFIX = constituent.suffix;
01663               dsw_project_fragment.wincopy (m_output_file, constituent.variables, 3, 
01664                                             &m_PACKAGE,
01665                                             &m_CONSTITUENT, 
01666                                             &m_CONSTITUENTSUFFIX);
01667             }
01668         }
01669 
01670       dsw_trailer_fragment.wincopy (m_output_file, 1, &m_PACKAGE);
01671 
01672       terminate ();
01673     }
01674 
01675   m_output_file_name = msdevdir + "all.dspnew";
01676 
01677   m_output_file = fopen (m_output_file_name.c_str (), "wb");
01678   if (m_output_file != NULL)
01679     {
01680       dsp_all_fragment.wincopy (m_output_file, 1, &m_PACKAGE);
01681       terminate ();
01682     }
01683 
01684   return (0);
01685 }

void MSDEVGenerator::reset  )  [private]
 

Reimplemented from CmtGenerator.

Definition at line 1550 of file cmt_generators.cxx.

References CmtSystem::cd(), CmtSystem::current_branch(), dsp_all_fragment, dsp_application_header_fragment, dsp_contents_fragment, dsp_library_header_fragment, dsp_trailer_fragment, dsp_windows_header_fragment, dsw_all_project_dependency_fragment, dsw_all_project_header_fragment, dsw_all_project_trailer_fragment, dsw_header_fragment, dsw_project_fragment, dsw_trailer_fragment, CmtSystem::file_separator(), CmtSystem::mkdir(), msdevdir, FragmentHandle::reset(), CmtGenerator::reset(), and CmtSystem::test_directory().

Referenced by build_project(), and build_workspace().

01551 {
01552   CmtGenerator::reset ();
01553 
01554   dsw_header_fragment.reset ();
01555   dsw_project_fragment.reset ();
01556   dsw_all_project_header_fragment.reset ();
01557   dsw_all_project_dependency_fragment.reset ();
01558   dsw_all_project_trailer_fragment.reset ();
01559   dsw_trailer_fragment.reset ();
01560 
01561   dsp_all_fragment.reset ();
01562   dsp_library_header_fragment.reset ();
01563   dsp_application_header_fragment.reset ();
01564   dsp_windows_header_fragment.reset ();
01565   dsp_contents_fragment.reset ();
01566   dsp_trailer_fragment.reset ();
01567 
01568   CmtSystem::cd (Cmt::get_current_dir ());
01569 
01570   cmt_string branch = CmtSystem::current_branch ();
01571 
01572   if ((branch == "mgr") || (branch == "cmt"))
01573     {
01574 #ifdef WIN32
01575       msdevdir = "..";
01576       msdevdir += CmtSystem::file_separator ();
01577       msdevdir += "Visual";
01578       
01579       if (!CmtSystem::test_directory (msdevdir))
01580         {
01581           CmtSystem::mkdir (msdevdir);
01582         }
01583       
01584       msdevdir += CmtSystem::file_separator ();
01585 #endif
01586     }
01587   else
01588     {
01589 #ifdef WIN32
01590       msdevdir = ".";
01591       msdevdir += CmtSystem::file_separator ();
01592 #endif
01593     }
01594 
01595 }


Member Data Documentation

FragmentHandle MSDEVGenerator::dsp_all_fragment [private]
 

Definition at line 135 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsp_application_header_fragment [private]
 

Definition at line 137 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsp_contents_fragment [private]
 

Definition at line 139 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsp_library_header_fragment [private]
 

Definition at line 136 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsp_trailer_fragment [private]
 

Definition at line 140 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsp_windows_header_fragment [private]
 

Definition at line 138 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsw_all_project_dependency_fragment [private]
 

Definition at line 131 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsw_all_project_header_fragment [private]
 

Definition at line 130 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsw_all_project_trailer_fragment [private]
 

Definition at line 132 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsw_header_fragment [private]
 

Definition at line 128 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsw_project_fragment [private]
 

Definition at line 129 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

FragmentHandle MSDEVGenerator::dsw_trailer_fragment [private]
 

Definition at line 133 of file cmt_generators.h.

Referenced by MSDEVGenerator(), and reset().

cmt_string MSDEVGenerator::msdevdir [private]
 

Definition at line 126 of file cmt_generators.h.

Referenced by reset().


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