#include <cmt_generator.h>
Inheritance diagram for CmtGenerator:
The Generator command driver will operate on specialized classes of CmtGenerator
Definition at line 44 of file cmt_generator.h.
|
Definition at line 47 of file cmt_generator.cxx. References m_ADDINCLUDE, m_ALLOS9SOURCES, m_CLASSES, m_CONSTITUENT, m_CONSTITUENTSUFFIX, m_DATE, m_DEBUGUSELINKOPTS, m_DIRNAME, m_DOCPATH, m_FILENAME, m_FILEPATH, m_FILESUFFIX, m_FULLNAME, m_GROUP, m_HASTARGETTAG, m_LIBRARYSUFFIX, m_LINE, m_LINKMACRO, m_MGRSTYLE, m_NAME, m_NODEBUGUSELINKOPTS, m_OBJS, m_OUTPUTNAME, m_PACKAGE, m_PACKAGEPATH, m_PACKAGEPREFIX, m_PROTOSTAMPS, m_PROTOTARGET, m_SUFFIX, m_TITLE, m_USEINCLUDES, m_USER, m_VERSION, and Variable::set().
00048 { 00049 m_CONSTITUENT.set ("CONSTITUENT"); 00050 m_LINKMACRO.set ("LINKMACRO"); 00051 m_DOCPATH.set ("DOCPATH"); 00052 m_PACKAGEPATH.set ("PACKAGEPATH"); 00053 m_PACKAGEPREFIX.set ("PACKAGEPREFIX"); 00054 m_PACKAGE.set ("PACKAGE"); 00055 m_VERSION.set ("VERSION"); 00056 m_MGRSTYLE.set ("MGRSTYLE"); 00057 m_TITLE.set ("TITLE"); 00058 m_GROUP.set ("GROUP"); 00059 m_CONSTITUENT.set ("CONSTITUENT"); 00060 m_CONSTITUENTSUFFIX.set ("CONSTITUENTSUFFIX"); 00061 m_LIBRARYSUFFIX.set ("LIBRARYSUFFIX"); 00062 m_USER.set ("USER"); 00063 m_DATE.set ("DATE"); 00064 m_PROTOTARGET.set ("PROTOTARGET"); 00065 m_OBJS.set ("OBJS"); 00066 m_CLASSES.set ("CLASSES"); 00067 m_PROTOSTAMPS.set ("PROTOSTAMPS"); 00068 m_NAME.set ("NAME"); 00069 m_FILEPATH.set ("FILEPATH"); 00070 m_FILESUFFIX.set ("FILESUFFIX"); 00071 m_SUFFIX.set ("SUFFIX"); 00072 m_FILENAME.set ("FILENAME"); 00073 m_LINKMACRO.set ("LINKMACRO"); 00074 m_LINE.set ("LINE"); 00075 m_ADDINCLUDE.set ("ADDINCLUDE"); 00076 m_FULLNAME.set ("FULLNAME"); 00077 m_DIRNAME.set ("DIRNAME"); 00078 m_OUTPUTNAME.set ("OUTPUTNAME"); 00079 m_ALLOS9SOURCES.set ("ALLOS9SOURCES"); 00080 m_NODEBUGUSELINKOPTS.set ("NODEBUGUSELINKOPTS"); 00081 m_DEBUGUSELINKOPTS.set ("DEBUGUSELINKOPTS"); 00082 m_USEINCLUDES.set ("USEINCLUDES"); 00083 m_HASTARGETTAG.set ("HASTARGETTAG"); 00084 } |
|
Definition at line 255 of file cmt_generator.cxx. References cmt_string::c_str(), CmtSystem::compare_files(), cmt_string::erase(), and cmt_string::find_last_of(). Referenced by Prototyper::end().
00256 { 00257 static cmt_string old; 00258 static cmt_string backup; 00259 00260 old = name; 00261 00262 int pos = old.find_last_of ("new"); 00263 old.erase (pos); 00264 00265 if (!CmtSystem::compare_files (old, name)) 00266 { 00267 backup = old; 00268 backup += "sav"; 00269 00270 unlink (backup.c_str ()); 00271 rename (old.c_str (), backup.c_str ()); 00272 rename (name.c_str (), old.c_str ()); 00273 } 00274 else 00275 { 00276 unlink (name); 00277 } 00278 } |
|
Definition at line 281 of file cmt_generator.cxx. References cmt_string::c_str(), cmt_string::erase(), cmt_string::find_last_of(), and CmtSystem::test_file(). Referenced by ConstituentsMakefileGenerator::build(), MakeSetupGenerator::build(), and terminate().
00282 { 00283 static cmt_string old; 00284 static cmt_string backup; 00285 00286 old = name; 00287 00288 int pos = old.find_last_of ("new"); 00289 old.erase (pos); 00290 00291 if (CmtSystem::test_file (old)) 00292 { 00293 backup = old; 00294 backup += "sav"; 00295 00296 unlink (backup.c_str ()); 00297 rename (old.c_str (), backup.c_str ()); 00298 } 00299 00300 rename (name.c_str (), old.c_str ()); 00301 } |
|
Definition at line 314 of file cmt_generator.cxx. References Cmt::get_debug(), m_OBJS, m_source_files, SourceFile::output(), and cmt_vector< SourceFile >::size(). Referenced by DocumentGenerator::build(), and LibraryGenerator::build().
00315 { 00316 bool first = true; 00317 00318 m_OBJS = ""; 00319 00320 for (int i = 0; i < m_source_files.size (); i++) 00321 { 00322 const SourceFile& file = m_source_files[i]; 00323 const cmt_string output = file.output (); 00324 00325 if (output != "") 00326 { 00327 if (first) 00328 { 00329 first = false; 00330 } 00331 else 00332 { 00333 m_OBJS += " "; 00334 } 00335 00336 m_OBJS += output; 00337 } 00338 00339 if (Cmt::get_debug ()) 00340 { 00341 cout << "CmtGenerator::fill_outputs> output=" << output << " OBJS=" << m_OBJS << endl; 00342 } 00343 00344 } 00345 00346 if (Cmt::get_debug ()) 00347 { 00348 cout << "CmtGenerator::fill_outputs> OBJS=" << m_OBJS << endl; 00349 } 00350 00351 } |
|
Definition at line 432 of file cmt_generator.cxx. References CmtSystem::compress_path(), and cmt_string::replace_all(). Referenced by DocumentGenerator::analyze_file(), DependencyGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), LibraryGenerator::module_file_action(), and LibraryGenerator::proto_file_action().
00433 { 00434 CmtSystem::compress_path (text); 00435 00436 text.replace_all ("./../src/../", "../"); 00437 text.replace_all ("./../src/", "$(src)"); 00438 00439 text.replace_all (".\\..\\src\\..\\", "..\\"); 00440 text.replace_all (".\\..\\src\\", "$(src)"); 00441 00442 text.replace_all ("../src/../", "../"); 00443 text.replace_all ("../src/", "$(src)"); 00444 00445 text.replace_all ("..\\src\\..\\", "..\\"); 00446 text.replace_all ("..\\src\\", "$(src)"); 00447 00448 text.replace_all ("../doc/../", "../"); 00449 text.replace_all ("../doc/", "$(doc)"); 00450 00451 text.replace_all ("..\\doc\\..\\", "..\\"); 00452 text.replace_all ("..\\doc\\", "$(doc)"); 00453 00454 text.replace_all ("$(src)$(src)", "$(src)"); 00455 } |
|
Scan a complete file spec (with possibly wild cards and directory) given in full_name ad fill in a vector of found file names. Result of the scan is filtered against matching suffixes Returns the count of non empty file names really found. We have to treat patterns of the form *.xxx (ie with a suffix) thus we filter out everything that could have been collected with a different suffix because the CmtSystem::scan_dir function only handles patterns of the form xxx* (ie with trailing *) [If the original suffix was empty (ie files specified using xx*) this means getting files without any dot-suffix. This may be incorrect??] Definition at line 466 of file cmt_generator.cxx. References cmt_vector< T >::add(), cmt_vector< T >::clear(), CmtSystem::cmt_string_vector, cmt_string::find(), Cmt::get_debug(), CmtSystem::get_dot_suffix(), cmt_regexp::match(), CmtSystem::pwd(), CmtSystem::scan_dir(), and cmt_vector< T >::size(). Referenced by DependencyGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), and MSDEVGenerator::build_project().
00470 { 00471 static cmt_string suffix; 00472 static cmt_string name; 00473 00474 bool has_excludes = false; 00475 bool has_selects = false; 00476 00477 suffix = ""; 00478 name = ""; 00479 00480 files.clear (); 00481 00482 has_excludes = (exclude_exprs.size () > 0); 00483 has_selects = (select_exprs.size () > 0); 00484 00485 CmtSystem::get_dot_suffix (full_name, suffix); 00486 00487 bool wilcarded_suffix = false; 00488 00489 if (suffix == ".*") wilcarded_suffix = true; 00490 00491 int count = 0; 00492 00493 if (full_name.find ('*') != cmt_string::npos) 00494 { 00495 CmtSystem::scan_dir (full_name, files); 00496 00497 if (Cmt::get_debug ()) 00498 { 00499 cout << "CMT::get_all_files> full_name=" << full_name << 00500 " pwd=" << CmtSystem::pwd () << endl; 00501 cout << "CMT::get_all_files> files.size=" << files.size () << endl; 00502 } 00503 00518 for (int j = 0; j < files.size (); j++) 00519 { 00520 cmt_string& n = files[j]; 00521 00522 bool rejected = false; 00523 00524 if (n == "") 00525 { 00526 rejected = true; 00527 } 00528 00529 if (!rejected && has_selects) 00530 { 00531 rejected = true; 00532 00533 for (int k = 0; k < select_exprs.size (); k++) 00534 { 00535 const cmt_regexp& exp = select_exprs[k]; 00536 if (exp.match (n)) 00537 { 00538 rejected = false; 00539 break; 00540 } 00541 } 00542 } 00543 00544 if (!rejected && has_excludes) 00545 { 00546 for (int k = 0; k < exclude_exprs.size (); k++) 00547 { 00548 const cmt_regexp& exp = exclude_exprs[k]; 00549 if (exp.match (n)) 00550 { 00551 rejected = true; 00552 break; 00553 } 00554 } 00555 } 00556 00557 if (!rejected) 00558 { 00559 static cmt_string s; 00560 00561 CmtSystem::get_dot_suffix (n, s); 00562 if (!wilcarded_suffix && (s != suffix)) 00563 { 00564 rejected = true; 00565 } 00566 else 00567 { 00568 count++; 00569 } 00570 } 00571 00572 if (Cmt::get_debug ()) 00573 { 00574 if (rejected) 00575 { 00576 cout << "CMT::get_all_files> reject " << n << endl; 00577 } 00578 else 00579 { 00580 cout << "CMT::get_all_files> keep " << n << endl; 00581 } 00582 } 00583 00584 if (rejected) 00585 { 00586 n = ""; 00587 } 00588 } 00589 } 00590 else 00591 { 00592 if (full_name != "") 00593 { 00594 bool rejected = false; 00595 00596 if (has_excludes) 00597 { 00598 for (int k = 0; k < exclude_exprs.size (); k++) 00599 { 00600 const cmt_regexp& exp = exclude_exprs[k]; 00601 if (exp.match (full_name)) 00602 { 00603 rejected = true; 00604 break; 00605 } 00606 } 00607 } 00608 00609 if (!rejected) 00610 { 00611 cmt_string& n = files.add (); 00612 00613 n = full_name; 00614 00615 count++; 00616 } 00617 } 00618 } 00619 00620 return (count); 00621 } |
|
Definition at line 220 of file cmt_generator.cxx. References Cmt::build_nmake(), cmt_string::c_str(), cmtdir, m_CONSTITUENT, m_CONSTITUENTSUFFIX, m_output_file, m_output_file_name, m_PACKAGE, m_PACKOS9, Constituent::name, Constituent::need_OS9, and Constituent::suffix. Referenced by DocumentGenerator::build(), and LibraryGenerator::build().
00222 { 00223 m_PACKAGE = package; 00224 m_CONSTITUENT = constituent.name; 00225 m_CONSTITUENTSUFFIX = constituent.suffix; 00226 00227 m_PACKOS9 = constituent.need_OS9; 00228 00229 m_output_file_name = cmtdir + m_CONSTITUENT + "."; 00230 00231 if (Cmt::build_nmake ()) 00232 { 00233 m_output_file_name += "nmake"; 00234 } 00235 else 00236 { 00237 m_output_file_name += "make"; 00238 } 00239 00240 m_output_file_name += "new"; 00241 00242 00243 m_output_file = fopen (m_output_file_name.c_str (), "wb"); 00244 if (m_output_file != NULL) 00245 { 00246 return (true); 00247 } 00248 else 00249 { 00250 return (false); 00251 } 00252 } |
|
Definition at line 354 of file cmt_generator.cxx. References DepsBuilder::add(), DepsBuilder::add_includes(), DepsBuilder::clear(), Use::current(), Use::discarded, Symbol::expand(), CmtSystem::file_separator(), Use::get_full_path(), Use::get_ordered_uses(), incdir, Use::include_path, m_deps_builder, Use::prefix, Use::real_path, CmtSystem::reduce_file_separators(), cmt_vector< T >::size(), and Use::UsePtrVector. Referenced by DependencyGenerator::build(), DocumentGenerator::build(), and LibraryGenerator::build().
00355 { 00356 cmt_string path; 00357 cmt_string substitution; 00358 00359 Use* use = &Use::current (); 00360 00361 m_deps_builder.clear (); 00362 00363 if (use->include_path != "none") 00364 { 00365 if (use->include_path == "") 00366 { 00367 m_deps_builder.add (incdir, "$(src)"); 00368 } 00369 else 00370 { 00371 substitution = use->include_path; 00372 00373 path = substitution; 00374 Symbol::expand (path); 00375 00376 CmtSystem::reduce_file_separators (path); 00377 00378 m_deps_builder.add (path, substitution); 00379 } 00380 } 00381 00382 m_deps_builder.add_includes (*use); 00383 00384 Use::UsePtrVector& uses = Use::get_ordered_uses (); 00385 00386 if (uses.size () > 0) 00387 { 00388 int number; 00389 00390 for (number = 0; number < uses.size (); number++) 00391 { 00392 use = uses[number]; 00393 if (use->discarded) continue; 00394 00395 if (use->real_path != "") 00396 { 00397 if (use->include_path != "none") 00398 { 00399 if (use->include_path == "") 00400 { 00401 use->get_full_path (path); 00402 path += CmtSystem::file_separator (); 00403 path += "src"; 00404 00405 substitution = "$("; 00406 substitution += use->prefix; 00407 substitution += "ROOT)"; 00408 substitution += CmtSystem::file_separator (); 00409 substitution += "src"; 00410 substitution += CmtSystem::file_separator (); 00411 } 00412 else 00413 { 00414 substitution = use->include_path; 00415 00416 path = substitution; 00417 Symbol::expand (path); 00418 00419 CmtSystem::reduce_file_separators (path); 00420 } 00421 00422 m_deps_builder.add (path, substitution); 00423 } 00424 00425 m_deps_builder.add_includes (*use); 00426 } 00427 } 00428 } 00429 } |
|
|
Definition at line 624 of file cmt_generator.cxx. References CmtSystem::absolute_path(), Symbol::expand(), CmtSystem::file_separator(), CmtSystem::reduce_file_separators(), and srcdir. Referenced by DependencyGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), and MSDEVGenerator::build_project().
00625 { 00626 full_name = ""; 00627 00628 Symbol::expand (file); 00629 00630 if (file == "") return; 00631 00632 if (!CmtSystem::absolute_path (file)) 00633 { 00634 full_name = srcdir; 00635 if (full_name != "") full_name += CmtSystem::file_separator (); 00636 } 00637 00638 full_name += file; 00639 00640 CmtSystem::reduce_file_separators (full_name); 00641 } |
|
Definition at line 304 of file cmt_generator.cxx. References commit(), m_output_file, and m_output_file_name. Referenced by ReadmeGenerator::build(), DocumentGenerator::build(), LibraryGenerator::build(), VSNETGenerator::build_project(), MSDEVGenerator::build_project(), VSNETGenerator::build_workspace(), and MSDEVGenerator::build_workspace().
00305 { 00306 fclose (m_output_file); 00307 00308 //--- Complete the operation -------------- 00309 00310 commit (m_output_file_name); 00311 } |
|
Definition at line 86 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 80 of file cmt_generator.h. Referenced by prepare_output(), and reset(). |
|
Definition at line 83 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 79 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 84 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 81 of file cmt_generator.h. Referenced by prepare_use_context(), and reset(). |
|
Definition at line 76 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 75 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 125 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 129 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 93 of file cmt_generator.h. |
|
Definition at line 117 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 101 of file cmt_generator.h. Referenced by CmtGenerator(), prepare_output(), and reset(). |
|
Definition at line 99 of file cmt_generator.h. |
|
Definition at line 111 of file cmt_generator.h. Referenced by CmtGenerator(), prepare_output(), and reset(). |
|
Definition at line 114 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 131 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 97 of file cmt_generator.h. Referenced by prepare_use_context(). |
|
Definition at line 127 of file cmt_generator.h. Referenced by CmtGenerator(). |
|
Definition at line 103 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 123 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 120 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 121 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 126 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 73 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 110 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 133 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 112 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 124 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 102 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 108 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 119 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 130 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 116 of file cmt_generator.h. Referenced by CmtGenerator(), fill_outputs(), and reset(). |
|
Definition at line 95 of file cmt_generator.h. Referenced by prepare_output(), and terminate(). |
|
Definition at line 94 of file cmt_generator.h. Referenced by prepare_output(), and terminate(). |
|
Definition at line 128 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 106 of file cmt_generator.h. Referenced by CmtGenerator(), prepare_output(), and reset(). |
|
Definition at line 104 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 105 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 70 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 71 of file cmt_generator.h. Referenced by prepare_output(), and reset(). |
|
Definition at line 118 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 115 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 91 of file cmt_generator.h. Referenced by fill_outputs(), and reset(). |
|
Definition at line 122 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Reimplemented in AnyDocumentGenerator. Definition at line 109 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 132 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 113 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 107 of file cmt_generator.h. Referenced by CmtGenerator(), and reset(). |
|
Definition at line 85 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 89 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 88 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 87 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 82 of file cmt_generator.h. Referenced by reset(). |
|
Definition at line 78 of file cmt_generator.h. Referenced by reset(), and set_full_name(). |