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

LibraryGenerator Class Reference

#include <cmt_generators.h>

Inheritance diagram for LibraryGenerator:

Inheritance graph
[legend]
Collaboration diagram for LibraryGenerator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LibraryGenerator ()
void build (const cmt_string &package, const Constituent &constituent)

Protected Member Functions

void reset ()
bool analyze_file (const Constituent &constituent, const cmt_string &file)
void java_file_action (SourceFile &file, const Constituent &constituent)
void proto_file_action (const cmt_string &file, const Constituent &constituent)
void prepare_proto_file (const cmt_string &file)
void module_file_action (SourceFile &file, const Constituent &constituent)

Protected Attributes

FragmentHandle library_header_fragment
FragmentHandle application_header_fragment
FragmentHandle java_header_fragment
FragmentHandle jar_header_fragment
FragmentHandle library_fragment
FragmentHandle library_no_share_fragment
FragmentHandle application_fragment
FragmentHandle jar_fragment
FragmentHandle java_fragment
FragmentHandle java_copy_fragment
FragmentHandle cleanup_library_fragment
FragmentHandle cleanup_application_fragment
FragmentHandle cleanup_java_fragment
FragmentHandle cleanup_objects_fragment
FragmentHandle buildproto_fragment
FragmentHandle check_application_fragment
FragmentHandle check_java_fragment
FragmentHandle protos_header_fragment

Constructor & Destructor Documentation

LibraryGenerator::LibraryGenerator  ) 
 

Definition at line 38 of file cmt_generators.cxx.

References application_fragment, application_header_fragment, buildproto_fragment, check_application_fragment, check_java_fragment, cleanup_application_fragment, cleanup_java_fragment, cleanup_library_fragment, cleanup_objects_fragment, jar_fragment, jar_header_fragment, java_copy_fragment, java_fragment, java_header_fragment, library_fragment, library_header_fragment, library_no_share_fragment, protos_header_fragment, and FragmentHandle::set().

00039 {
00040   library_header_fragment.set ("library_header");
00041   application_header_fragment.set ("application_header");
00042   java_header_fragment.set ("java_header");
00043   jar_header_fragment.set ("jar_header");
00044   protos_header_fragment.set ("protos_header");
00045   library_fragment.set ("library");
00046   library_no_share_fragment.set ("library_no_share");
00047   application_fragment.set ("application");
00048   jar_fragment.set ("jar");
00049   java_fragment.set ("java");
00050   java_copy_fragment.set ("java_copy");
00051   cleanup_library_fragment.set ("cleanup_library");
00052   cleanup_application_fragment.set ("cleanup_application");
00053   cleanup_java_fragment.set ("cleanup_java");
00054   cleanup_objects_fragment.set ("cleanup_objects");
00055   buildproto_fragment.set ("buildproto");
00056   check_application_fragment.set ("check_application");
00057   check_java_fragment.set ("check_java");
00058 }


Member Function Documentation

bool LibraryGenerator::analyze_file const Constituent constituent,
const cmt_string file
[protected]
 

Definition at line 85 of file cmt_generators.cxx.

References cmt_vector< SourceFile >::add(), CmtSystem::basename(), Cmt::build_nmake(), Language::extra_output_suffixes, CmtSystem::file_separator(), Language::find_with_suffix(), Cmt::get_debug(), CmtSystem::get_suffix(), Language::linker, Constituent::name, Language::null(), Language::output_suffix, Packager::package_name(), cmt_string::replace(), FAwk::run(), SourceFile::set(), cmt_vector< T >::size(), Constituent::suffix, CmtSystem::test_directory(), and CmtSystem::test_file().

Referenced by build().

00087 {
00088   static cmt_string suffix;
00089   static cmt_string name;
00090   static cmt_string obj;
00091 
00092   bool file_not_found = false;
00093   bool can_build = true;
00094 
00095   obj = file;
00096 
00097   if (Cmt::get_debug ())
00098     {
00099       cout << "CmtGenerator::analyze_file> constituent=" << 
00100           constituent.name <<
00101           " file=" << file << endl;
00102     }
00103 
00104   if (!CmtSystem::test_file (file) && !CmtSystem::test_directory (file))
00105     {
00106       file_not_found = true;
00107       cerr << "#CMT> Warning: Source file " << file << " not found" << endl;
00108     }
00109 
00110   CmtSystem::get_suffix (file, suffix);
00111   CmtSystem::basename (file, suffix, name);
00112 
00113   Language& language = Language::find_with_suffix (suffix);
00114 
00115   if (m_LINKMACRO == "")
00116     {
00117       m_LINKMACRO = language.linker;
00118     }
00119 
00120   if (language == "java")
00121     {
00122       static Packager packager;
00123       
00124       obj  = "$(javabin)";
00125       obj +=  m_CONSTITUENT;
00126       obj +=  CmtSystem::file_separator ();
00127 
00128       cmt_regexp exp ("^package[ \t][ \t]*[a-zA-Z0-9_.][a-zA-Z0-9_.][ \t]*;");
00129       
00130       packager.run (file, exp);
00131       if (packager.package_name () != "")
00132         {
00133           obj += packager.package_name ();
00134           obj += CmtSystem::file_separator ();
00135         }
00136       
00137       obj += name;
00138       obj += ".class";
00139     }
00140   else if (language != Language::null ())
00141     {
00142       obj  = "$(bin)";
00143       if (Cmt::build_nmake ()) obj +=  m_CONSTITUENT;
00144       if (Cmt::build_nmake ()) obj +=  CmtSystem::file_separator ();
00145       obj += name;
00146       obj += language.output_suffix;
00147       obj += constituent.suffix;
00148       if (Cmt::build_nmake ()) obj += ".obj";
00149       else obj += ".o";
00150  
00151       for (int i = 0; i < language.extra_output_suffixes.size (); i++)
00152         {
00153           cmt_string& extra_suffix = language.extra_output_suffixes[i];
00154 
00155           obj += " $(bin)";
00156           obj += name;
00157           obj += extra_suffix;
00158           obj += language.output_suffix;
00159           obj += constituent.suffix;
00160           if (Cmt::build_nmake ()) obj += ".obj";
00161           else obj += ".o";
00162         }
00163     }
00164   else
00165     {
00166         //cout << "#CMT> analyze_file file=" << file << " no language" << endl;
00167 
00168       if (m_LINKMACRO == "java")
00169         {
00170           obj  = "$(javabin)";
00171           obj +=  m_CONSTITUENT;
00172           obj +=  CmtSystem::file_separator ();
00173           obj += file;
00174           
00175           obj.replace ("../src/", "");
00176           obj.replace ("..\\src\\", "");
00177         }
00178       else if (file_not_found)
00179         {
00180           can_build = false;
00181           obj  = "";
00182           cerr << "#CMT> Warning: Source file " << name << " cannot be rebuilt" << endl;
00183         }
00184       else
00185         {
00186           obj  = "";
00187         }
00188     }
00189 
00190   if (Cmt::get_debug ())
00191     {
00192       cout << "CmtGenerator::analyze_file> constituent=" << 
00193           constituent.name <<
00194           " obj=" << obj << endl;
00195     }
00196 
00197   if (can_build)
00198     {
00199       SourceFile& source = m_source_files.add ();
00200       source.set (file, language, obj);
00201       return (true);
00202     }
00203   else
00204     {
00205       return (false);
00206     }
00207 }

void LibraryGenerator::build const cmt_string package,
const Constituent constituent
 

Definition at line 392 of file cmt_generators.cxx.

References analyze_file(), Application, application_fragment, application_header_fragment, Constituent::build_triggers, cmt_string::c_str(), check_application_fragment, check_java_fragment, cleanup_application_fragment, cleanup_java_fragment, cleanup_library_fragment, cleanup_objects_fragment, cmt_vector< SourceFile >::clear(), CmtSystem::cmt_string_vector, CmtSystem::compress_path(), FragmentHandle::copy(), Constituent::exclude_exprs, CmtGenerator::fill_outputs(), CmtGenerator::filter_path(), CmtGenerator::get_all_files(), Constituent::has_target_tag, Constituent::includes, jar_fragment, jar_header_fragment, java_file_action(), java_header_fragment, SourceFile::language(), Library, library_fragment, library_header_fragment, library_no_share_fragment, module_file_action(), Constituent::modules, SourceFile::name(), Constituent::need_check, Constituent::need_prototypes, Constituent::no_share, CmtSystem::now(), CmtGenerator::prepare_output(), prepare_proto_file(), CmtGenerator::prepare_use_context(), proto_file_action(), protos_header_fragment, Language::prototypes, cmt_string::replace_all(), reset(), Constituent::select_exprs, CmtGenerator::set_full_name(), cmt_vector< SourceFile >::size(), cmt_vector< T >::size(), CmtGenerator::terminate(), Constituent::type, CmtSystem::user(), Variable::value, and Constituent::variables.

Referenced by Generator::build_constituent_makefile().

00394 {
00395   static cmt_string lib;
00396   static cmt_string allsources;
00397   static cmt_string file;
00398   static cmt_string full_name;
00399   static cmt_string compressed_name;
00400   static cmt_string suffix;
00401   int i;
00402   bool need_prototypes;
00403 
00404   reset ();
00405 
00406   if (!prepare_output (package, constituent)) return;
00407 
00408   switch (constituent.type)
00409     {
00410     case Application:
00411       is_library = false;
00412       is_application = true;
00413       m_TITLE = "Application";
00414       break;
00415     case Library:
00416       is_library = true;
00417       is_application = false;
00418       m_TITLE = "Library";
00419       break;
00420     }
00421 
00422   m_source_files.clear ();
00423 
00424   need_prototypes = constituent.need_prototypes;
00425 
00426   cout << m_TITLE << " " << m_CONSTITUENT << endl;
00427 
00428   lib  = "$(";
00429   lib += m_CONSTITUENT;
00430   lib += "lib)";
00431 
00432   //
00433   // Prepare the include paths
00434   //
00435 
00436   const CmtSystem::cmt_string_vector& includes = constituent.includes;
00437 
00438   for (i = 0; i < includes.size (); i++)
00439     {
00440       const cmt_string& subdir = includes[i];
00441 
00442       m_PACKINCLUDES += " -I";
00443       m_PACKINCLUDES += subdir;
00444     }
00445 
00446   //
00447   // Scan the sources.
00448   //
00449 
00450   const CmtSystem::cmt_string_vector& sources = constituent.modules;
00451   const cmt_vector<cmt_regexp>& excludes = constituent.exclude_exprs;
00452   const cmt_vector<cmt_regexp>& selects = constituent.select_exprs;
00453 
00454   m_LINE = "";
00455 
00456   for (i = 0; i < sources.size (); i++)
00457     {
00458       file = sources[i];
00459 
00460       set_full_name (full_name, file);
00461       if (full_name == "") continue;
00462 
00463       CmtSystem::compress_path (full_name, compressed_name);
00464       full_name = compressed_name;
00465 
00466       static CmtSystem::cmt_string_vector files;
00467 
00468       int count = get_all_files (full_name, excludes, selects, files);
00469 
00470       filter_path (full_name);
00471 
00472       for (int j = 0; j < files.size (); j++)
00473         {
00474           const cmt_string& name = files[j];
00475 
00476           if (name != "") 
00477             {
00478               if (!analyze_file (constituent, name)) 
00479                 {
00480                   count = 0;
00481                   break;
00482                 }
00483             }
00484         }
00485 
00486       if (count > 0)
00487         {
00488           m_LINE += full_name;
00489           m_LINE += " ";
00490         }
00491     }
00492 
00493   fill_outputs ();
00494 
00495   prepare_use_context ();
00496 
00497   m_DATE = CmtSystem::now ();
00498   m_USER = CmtSystem::user ();
00499   m_PACKAGE = package;
00500 
00501   if (constituent.has_target_tag)
00502     {
00503       m_HASTARGETTAG = "has_target_tag";
00504     }
00505   else
00506     {
00507       m_HASTARGETTAG = "has_no_target_tag";
00508     }
00509 
00510   make_header_fragment.copy (m_output_file, constituent.variables, 7, 
00511                              &m_TITLE,
00512                              &m_CONSTITUENT,
00513                              &m_CONSTITUENTSUFFIX,
00514                              &m_USER,
00515                              &m_DATE,
00516                              &m_PACKAGE,
00517                              &m_HASTARGETTAG);
00518 
00519   if (need_prototypes)
00520     {
00521       need_prototypes = false;
00522 
00523       for (i = 0; i < m_source_files.size (); i++)
00524         {
00525           const SourceFile& file = m_source_files[i];
00526           Language& language = file.language ();
00527           if (language.prototypes)
00528             {
00529               need_prototypes = true;
00530               break;
00531             }
00532         }
00533     }
00534 
00535   //-------------------------------------------
00536   //
00537   // Specific targets (application, library or java)
00538   // Prepare in case prototype files are needed
00539   //
00540   //-------------------------------------------
00541 
00542   m_PROTOTARGET = "";
00543 
00544   //if ((Cmt::current_build_strategy & PrototypesMask) == Prototypes)
00545   if (need_prototypes)
00546     {
00547       m_PROTOTARGET = m_CONSTITUENT;
00548       m_PROTOTARGET += "PROTOS";
00549     }
00550 
00551   if (m_LINKMACRO == "java")
00552     {
00553       if (is_library)
00554         {
00555           jar_header_fragment.copy (m_output_file, constituent.variables, 3, 
00556                                     &m_CONSTITUENT, 
00557                                     &m_CONSTITUENTSUFFIX,
00558                                     &m_OBJS);
00559         }
00560       else
00561         {
00562           java_header_fragment.copy (m_output_file, constituent.variables, 3, 
00563                                      &m_CONSTITUENT,
00564                                      &m_CONSTITUENTSUFFIX,
00565                                      &m_OBJS);
00566         }
00567     }
00568   else
00569     {
00570       if (is_library)
00571         {
00572           library_header_fragment.copy (m_output_file, constituent.variables, 3,
00573                                         &m_CONSTITUENT,
00574                                         &m_CONSTITUENTSUFFIX,
00575                                         &m_PROTOTARGET);
00576         }
00577       else
00578         {
00579           application_header_fragment.copy (m_output_file, constituent.variables, 3,
00580                                             &m_CONSTITUENT, 
00581                                             &m_CONSTITUENTSUFFIX, 
00582                                             &m_PROTOTARGET);
00583         }
00584     }
00585 
00586 
00587   //----------------------------------------------------
00588   //
00589   // Preparing prototype files.
00590   //
00591   //----------------------------------------------------
00592 
00593   //if ((Cmt::current_build_strategy & PrototypesMask) == Prototypes)
00594   if (need_prototypes)
00595     {
00596       for (i = 0; i < m_source_files.size (); i++)
00597         {
00598           const SourceFile& file = m_source_files[i];
00599           Language& language = file.language ();
00600           if (language.prototypes)
00601             {
00602               prepare_proto_file (file.name ());
00603             }
00604         }
00605 
00606       if (m_PROTOSTAMPS != "")
00607         {
00608           protos_header_fragment.copy (m_output_file, constituent.variables, 3, 
00609                                        &m_CONSTITUENT,
00610                                        &m_CONSTITUENTSUFFIX,
00611                                        &m_PROTOSTAMPS);
00612         }
00613 
00614       if (protonames != "")
00615         {
00616           for (i = 0; i < m_source_files.size (); i++)
00617             {
00618               const SourceFile& file = m_source_files[i];
00619               Language& language = file.language ();
00620               if (language.prototypes)
00621                 {
00622                   proto_file_action (file.name (), constituent);
00623                 }
00624             }
00625         }
00626     }
00627 
00628   //----------------------------------------------------
00629   //
00630   // Preparing the library.
00631   //
00632   //----------------------------------------------------
00633 
00634   if (m_OBJS != "")
00635     {
00636       if (m_LINKMACRO == "java")
00637         {
00638           if (is_library)
00639             {
00640               cmt_string classes = m_OBJS.value;
00641 
00642               classes.replace_all ("$(javabin)", "");
00643               classes.replace_all (srcdir.c_str (), "");
00644 
00645               m_CLASSES = classes;
00646 
00647               jar_fragment.copy (m_output_file, constituent.variables, 4, 
00648                                  &m_CONSTITUENT,
00649                                  &m_CONSTITUENTSUFFIX,
00650                                  &m_OBJS,
00651                                  &m_CLASSES);
00652             }
00653         }
00654       else
00655         {
00656           if (is_library)
00657             {
00658               if (constituent.no_share)
00659                 {
00660                   library_no_share_fragment.copy (m_output_file, constituent.variables, 3, 
00661                                                   &m_CONSTITUENT,
00662                                                   &m_CONSTITUENTSUFFIX,
00663                                                   &m_OBJS);
00664                 }
00665               else
00666                 {
00667                   library_fragment.copy (m_output_file, constituent.variables, 3, 
00668                                          &m_CONSTITUENT,
00669                                          &m_CONSTITUENTSUFFIX,
00670                                          &m_OBJS);
00671                 }
00672             }
00673           else
00674             {
00675               application_fragment.copy (m_output_file, constituent.variables, 4,
00676                                          &m_CONSTITUENT,
00677                                          &m_CONSTITUENTSUFFIX, 
00678                                          &m_OBJS,
00679                                          &m_LINKMACRO);
00680             }
00681         }
00682     }
00683 
00684   if (constituent.build_triggers)
00685     {
00686       dependencies_and_triggers_fragment.copy (m_output_file, 
00687                                                constituent.variables, 3,
00688                                                &m_CONSTITUENT, 
00689                                                &m_CONSTITUENTSUFFIX, 
00690                                                &m_LINE);
00691     }
00692   else
00693     {
00694       dependencies_fragment.copy (m_output_file, 
00695                                   constituent.variables, 3,
00696                                   &m_CONSTITUENT, 
00697                                   &m_CONSTITUENTSUFFIX, 
00698                                   &m_LINE);
00699     }
00700 
00701   //----------------------------------------------------
00702   //
00703   // Building actual individual targets.
00704   //
00705   //----------------------------------------------------
00706 
00707   for (i = 0; i < m_source_files.size (); i++)
00708     {
00709       SourceFile& file = m_source_files[i];
00710       Language& language = file.language ();
00711 
00712       if (language == "java")
00713         {
00714           java_file_action (file, constituent);
00715         }
00716       else
00717         {
00718           module_file_action (file, constituent);
00719         }
00720     }
00721 
00722   if (m_PACKOS9)
00723     {
00724       if (os9sources != "")
00725         {
00726           //
00727           // Generate transfers to the OS9 area.
00728           //
00729 
00730           m_ALLOS9SOURCES = "";
00731           allsources = "";
00732         }
00733     }
00734 
00735   /*
00736     for file in `cmt_sort_line.csh ${os9sources}` ; do
00737     if test `echo ${file} | grep '$(src)'` ; then
00738     name=`echo ${file} | sed 's#$(src)##'`
00739     ALLOS9SOURCES="${ALLOS9SOURCES} ../OS9/${name}"
00740     allsources="${allsources} ${file}"
00741     elif test `echo ${file} | grep '$(inc)'` ; then
00742     name=`echo ${file} | sed 's#$(inc)##'`
00743     ALLOS9SOURCES="${ALLOS9SOURCES} ../OS9/${name}"
00744     allsources="${allsources} ${file}"
00745     fi
00746     done
00747 
00748     if test ! "${ALLOS9SOURCES}" = "" ; then
00749 
00750     sed -e "`subs_vars ALLOS9SOURCES`" \
00751     ${os9_header_fragment} \
00752     >>${output}
00753 
00754     for FULLNAME in ${allsources} ; do
00755 
00756     NAME=`echo ${FULLNAME} | sed -e 's#$(src)##' -e 's#$(inc)##'`
00757 
00758     sed -e "`subs_vars NAME FULLNAME`" \
00759     ${os9_fragment} \
00760     >>${output}
00761 
00762     done
00763     fi
00764     fi
00765     fi
00766   */
00767 
00768   //
00769   //  Generate package cleanup operations.
00770   //
00771 
00772   cleanup_header_fragment.copy (m_output_file, constituent.variables, 2, 
00773                                 &m_CONSTITUENT,
00774                                 &m_CONSTITUENTSUFFIX);
00775 
00776   //if ((Cmt::current_build_strategy & PrototypesMask) == Prototypes)
00777   if (need_prototypes)
00778     {
00779       if (protos != "")
00780         {
00781           m_FULLNAME = protos;
00782           cleanup_fragment.copy (m_output_file, constituent.variables, 1, &m_FULLNAME);
00783           m_FULLNAME = m_PROTOSTAMPS;
00784           cleanup_fragment.copy (m_output_file, constituent.variables, 1, &m_FULLNAME);
00785         }
00786     }
00787 
00788   if (m_LINKMACRO == "java")
00789     {
00790       cleanup_java_fragment.copy (m_output_file, constituent.variables, 1, &m_OBJS);
00791 
00792       if (!is_library)
00793         {
00794           if (constituent.need_check)
00795             {
00796               check_java_fragment.copy (m_output_file, constituent.variables, 2, 
00797                                         &m_CONSTITUENT,
00798                                         &m_CONSTITUENTSUFFIX);
00799             }
00800         }
00801     }
00802   else
00803     {
00804       if (is_library)
00805         {
00806           cleanup_library_fragment.copy (m_output_file, constituent.variables, 2, 
00807                                          &m_CONSTITUENT,
00808                                          &m_CONSTITUENTSUFFIX);
00809         }
00810       else
00811         {
00812           cleanup_application_fragment.copy (m_output_file, constituent.variables, 2, 
00813                                              &m_CONSTITUENT,
00814                                              &m_CONSTITUENTSUFFIX);
00815           if (m_OBJS != "")
00816             {
00817               cleanup_objects_fragment.copy (m_output_file, constituent.variables, 3, 
00818                                              &m_OBJS,
00819                                              &m_CONSTITUENT,
00820                                              &m_CONSTITUENTSUFFIX);
00821             }
00822 
00823           if (constituent.need_check)
00824             {
00825               check_application_fragment.copy (m_output_file, constituent.variables, 2, 
00826                                                &m_CONSTITUENT,
00827                                                &m_CONSTITUENTSUFFIX);
00828             }
00829         }
00830     }
00831 
00832   terminate ();
00833 }

void LibraryGenerator::java_file_action SourceFile file,
const Constituent constituent
[protected]
 

Definition at line 210 of file cmt_generators.cxx.

References CmtSystem::basename(), FragmentHandle::copy(), CmtSystem::get_dot_suffix(), java_fragment, SourceFile::name(), SourceFile::output(), CmtSystem::test_file(), Variable::value, and Constituent::variables.

Referenced by build().

00211 {
00212   static cmt_string suffix;
00213 
00214   m_FULLNAME = file.name ();
00215   m_OUTPUTNAME = file.output ();
00216 
00217   CmtSystem::get_dot_suffix (m_FULLNAME, suffix);
00218   
00219   CmtSystem::basename (m_FULLNAME, suffix, m_NAME.value);
00220   CmtSystem::basename (m_FULLNAME, m_FILENAME.value);
00221   
00222   if (CmtSystem::test_file (m_FULLNAME))
00223     {
00224       java_fragment.copy (m_output_file, constituent.variables, 5,
00225                           &m_NAME,
00226                           &m_FULLNAME,
00227                           &m_OUTPUTNAME,
00228                           &m_CONSTITUENT, 
00229                           &m_CONSTITUENTSUFFIX);
00230     }
00231   else
00232     {
00233       cerr << "#CMT> Warning: file " << m_FULLNAME << " not found" << endl;
00234     }
00235 }

void LibraryGenerator::module_file_action SourceFile file,
const Constituent constituent
[protected]
 

Definition at line 294 of file cmt_generators.cxx.

References Language::application, CmtSystem::basename(), FragmentHandle::copy(), CmtSystem::dirname(), CmtSystem::file_separator(), CmtGenerator::filter_path(), CmtSystem::get_dot_suffix(), CmtSystem::get_suffix(), java_copy_fragment, SourceFile::language(), Language::library, SourceFile::name(), Language::null(), SourceFile::output(), Language::preprocessor_command, Variable::value, and Constituent::variables.

Referenced by build().

00295 {
00296   cmt_string name = file.name ();
00297   Language& language = file.language ();
00298 
00299   static cmt_string suffix;
00300   static cmt_string prefix;
00301   static cmt_string preproc;
00302 
00303   m_FULLNAME = name;
00304 
00305   CmtSystem::get_dot_suffix (name, suffix);
00306 
00307   CmtSystem::basename (name, suffix, m_NAME.value);
00308 
00309   CmtSystem::dirname (name, prefix);
00310   CmtSystem::basename (name, m_FILENAME.value);
00311 
00312   FragmentHandle* fragment;
00313 
00314   if (language != Language::null ())
00315     {
00316       preproc = language.preprocessor_command;
00317       fragment = (is_library) ? &(language.library) : &(language.application);
00318     }
00319   else
00320     {
00321       //
00322       // What happens when the language is not known???
00323       // 
00324       //
00325       preproc = "-I";
00326       fragment = 0;
00327     }
00328 
00329   if ((prefix == "../src") || (prefix == "..\\src"))
00330     {
00331       m_ADDINCLUDE = "";
00332     }
00333   else if (prefix != "")
00334     {
00335       m_ADDINCLUDE  = preproc;
00336       m_ADDINCLUDE += prefix;
00337     }
00338 
00339   m_FILEPATH = prefix;
00340   if (m_FILEPATH.value != "") m_FILEPATH.value += CmtSystem::file_separator ();
00341   filter_path (m_FILEPATH.value);
00342 
00343   m_LINE = m_FULLNAME.value;
00344   m_LINE += " ";
00345 
00346   filter_path (m_FULLNAME.value);
00347   filter_path (m_LINE.value);
00348 
00349   CmtSystem::get_suffix (name, m_FILESUFFIX.value);
00350 
00351   if (fragment != 0)
00352     {
00353       fragment->copy (m_output_file, constituent.variables, 10,
00354                       &m_CONSTITUENT, 
00355                       &m_CONSTITUENTSUFFIX, 
00356                       &m_FILENAME, 
00357                       &m_NAME, 
00358                       &m_LINE,
00359                       &m_ADDINCLUDE, 
00360                       &m_FULLNAME, 
00361                       &m_FILEPATH, 
00362                       &m_FILESUFFIX, 
00363                       &m_PACKAGE);
00364     }
00365   else if (file.output () != "")
00366     {
00367       m_OUTPUTNAME = file.output ();
00368       CmtSystem::dirname (m_OUTPUTNAME.value, m_FILEPATH.value);
00369 
00370       java_copy_fragment.copy (m_output_file, constituent.variables, 11,
00371                                &m_CONSTITUENT, 
00372                                &m_CONSTITUENTSUFFIX, 
00373                                &m_FILENAME, 
00374                                &m_NAME, 
00375                                &m_LINE,
00376                                &m_ADDINCLUDE, 
00377                                &m_FULLNAME, 
00378                                &m_FILEPATH, 
00379                                &m_FILESUFFIX, 
00380                                &m_PACKAGE, 
00381                                &m_OUTPUTNAME);
00382     }
00383 
00384   if (m_PACKOS9)
00385     {
00386       os9sources += m_LINE;
00387       os9sources += " ";
00388     }
00389 }

void LibraryGenerator::prepare_proto_file const cmt_string file  )  [protected]
 

Definition at line 259 of file cmt_generators.cxx.

References CmtSystem::name(), and CmtSystem::test_file().

Referenced by build().

00260 {
00261   static cmt_string name;
00262   static cmt_string pp;
00263 
00264   CmtSystem::name (file, name);
00265 
00266   if (CmtSystem::test_file (file))
00267     {
00268       pp  = incdir;
00269       pp += name;
00270       pp += ".pp";
00271 
00272       if (!CmtSystem::test_file (pp))
00273         {
00274           //Generator::build_prototype (file);
00275         }
00276     }
00277 
00278   protos += " ";
00279   protos += inc;
00280   protos += name;
00281   protos += ".ph";
00282 
00283   protonames += " ";
00284   protonames += name;
00285   protonames += ".ph";
00286 
00287   m_PROTOSTAMPS += " ";
00288   m_PROTOSTAMPS += inc;
00289   m_PROTOSTAMPS += name;
00290   m_PROTOSTAMPS += ".pp";
00291 }

void LibraryGenerator::proto_file_action const cmt_string file,
const Constituent constituent
[protected]
 

Definition at line 238 of file cmt_generators.cxx.

References CmtSystem::basename(), buildproto_fragment, FragmentHandle::copy(), CmtSystem::dirname(), CmtSystem::file_separator(), CmtGenerator::filter_path(), CmtSystem::get_dot_suffix(), Variable::value, and Constituent::variables.

Referenced by build().

00239 {
00240   static cmt_string suffix;
00241 
00242   CmtSystem::dirname (file, m_FILEPATH.value);
00243   if (m_FILEPATH.value != "") m_FILEPATH.value += CmtSystem::file_separator ();
00244 
00245   filter_path (m_FILEPATH.value);
00246 
00247   CmtSystem::basename (file, m_FILENAME.value);
00248   CmtSystem::get_dot_suffix (m_FILENAME, suffix);
00249 
00250   CmtSystem::basename (m_FILENAME, suffix, m_NAME.value);
00251 
00252   buildproto_fragment.copy (m_output_file, constituent.variables, 3, 
00253                             &m_NAME, 
00254                             &m_FILEPATH, 
00255                             &m_FILENAME);
00256 }

void LibraryGenerator::reset  )  [protected]
 

Reimplemented from AnyDocumentGenerator.

Definition at line 61 of file cmt_generators.cxx.

References application_fragment, application_header_fragment, buildproto_fragment, check_application_fragment, check_java_fragment, cleanup_application_fragment, cleanup_java_fragment, cleanup_library_fragment, cleanup_objects_fragment, jar_fragment, jar_header_fragment, java_copy_fragment, java_fragment, java_header_fragment, library_fragment, library_header_fragment, library_no_share_fragment, protos_header_fragment, FragmentHandle::reset(), and AnyDocumentGenerator::reset().

Referenced by build().


Member Data Documentation

FragmentHandle LibraryGenerator::application_fragment [protected]
 

Definition at line 69 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::application_header_fragment [protected]
 

Definition at line 64 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::buildproto_fragment [protected]
 

Definition at line 77 of file cmt_generators.h.

Referenced by LibraryGenerator(), proto_file_action(), and reset().

FragmentHandle LibraryGenerator::check_application_fragment [protected]
 

Definition at line 78 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::check_java_fragment [protected]
 

Definition at line 79 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::cleanup_application_fragment [protected]
 

Definition at line 74 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::cleanup_java_fragment [protected]
 

Definition at line 75 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::cleanup_library_fragment [protected]
 

Definition at line 73 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::cleanup_objects_fragment [protected]
 

Definition at line 76 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::jar_fragment [protected]
 

Definition at line 70 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::jar_header_fragment [protected]
 

Definition at line 66 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::java_copy_fragment [protected]
 

Definition at line 72 of file cmt_generators.h.

Referenced by LibraryGenerator(), module_file_action(), and reset().

FragmentHandle LibraryGenerator::java_fragment [protected]
 

Definition at line 71 of file cmt_generators.h.

Referenced by java_file_action(), LibraryGenerator(), and reset().

FragmentHandle LibraryGenerator::java_header_fragment [protected]
 

Definition at line 65 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::library_fragment [protected]
 

Definition at line 67 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::library_header_fragment [protected]
 

Definition at line 63 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::library_no_share_fragment [protected]
 

Definition at line 68 of file cmt_generators.h.

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

FragmentHandle LibraryGenerator::protos_header_fragment [protected]
 

Definition at line 80 of file cmt_generators.h.

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


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