#include <cmt_deps_builder.h>
Collaboration diagram for DepsBuilder:
Public Methods |
|
void? | clear () |
void? | add (const cmt_string &path, const cmt_string &substitution) |
void? | add_includes (const Use &use) |
CmtSystem::cmt_string_vector &? | run (const cmt_string &file_name) |
Private Attributes |
|
CmtSystem::cmt_string_vector? | m_include_paths |
CmtSystem::cmt_string_vector? | m_substitutions |
CmtSystem::cmt_string_vector? | m_deps |
CmtSystem::cmt_string_vector? | m_all_deps |
|
? |
Definition at line 617 of file cmt_deps_builder.cxx. References cmt_string::erase(), CmtSystem::file_separator(), m_include_paths, m_substitutions, cmt_vector< cmt_string >::push_back(), and cmt_string::size(). Referenced by add_includes(), and CmtGenerator::prepare_use_context(). 00618 { 00619 if (path[path.size () - 1] == CmtSystem::file_separator ()) 00620 { 00621 cmt_string p = path; 00622 p.erase (path.size () - 1); 00623 m_include_paths.push_back (p); 00624 } 00625 else 00626 { 00627 m_include_paths.push_back (path); 00628 } 00629 00630 m_substitutions.push_back (substitution); 00631 } |
|
? |
Definition at line 634 of file cmt_deps_builder.cxx. References add(), CmtSystem::file_separator(), Symbol::find(), cmt_string::find(), CmtSystem::getenv(), Use::includes, Include::name, cmt_string::npos, cmt_string::replace_all(), Symbol::resolve_macro_value(), cmt_vector< Include >::size(), and cmt_string::substr(). Referenced by CmtGenerator::prepare_use_context(). 00635 { 00636 const Include::IncludeVector& includes = use.includes; 00637 int include_number; 00638 00639 for (include_number = 0; 00640 include_number < includes.size (); 00641 include_number++) 00642 { 00643 const Include& include = includes[include_number]; 00644 00645 cmt_string temp = include.name; 00646 cmt_string pattern; 00647 cmt_string name; 00648 char end_pattern; 00649 00650 int start = 0; 00651 00652 for (;;) 00653 { 00654 int begin; 00655 00656 begin = temp.find (start, "${"); 00657 if (begin != cmt_string::npos) 00658 { 00659 end_pattern = '}'; 00660 } 00661 else 00662 { 00663 begin = temp.find (start, "$("); 00664 if (begin != cmt_string::npos) 00665 { 00666 end_pattern = ')'; 00667 } 00668 else 00669 { 00670 break; 00671 } 00672 } 00673 00674 start = begin + 2; 00675 00676 int end; 00677 end = temp.find (start, end_pattern); 00678 if (end == cmt_string::npos) break; 00679 if (end < begin) break; 00680 start = end + 1; 00681 00682 temp.substr (begin, end - begin + 1, pattern); 00683 temp.substr (begin + 2, end - begin - 2, name); 00684 00685 Symbol* macro = Symbol::find (name); 00686 if (macro != 0) 00687 { 00688 cmt_string value = macro->resolve_macro_value (); 00689 value += CmtSystem::file_separator (); 00690 temp.replace_all (pattern, value); 00691 } 00692 else 00693 { 00694 cmt_string value = CmtSystem::getenv (name); 00695 value += CmtSystem::file_separator (); 00696 temp.replace_all (pattern, value); 00697 } 00698 } 00699 add (temp, include.name); 00700 } 00701 } |
|
? |
Definition at line 610 of file cmt_deps_builder.cxx. References cmt_vector< cmt_string >::clear(), m_include_paths, and m_substitutions. Referenced by CmtGenerator::prepare_use_context(). 00611 { 00612 m_include_paths.clear (); 00613 m_substitutions.clear (); 00614 } |
|
? |
Definition at line 704 of file cmt_deps_builder.cxx. References CmtSystem::basename(), build_deps(), cmt_vector< cmt_string >::clear(), CmtSystem::dirname(), CmtSystem::execute(), Symbol::find(), m_all_deps, m_deps, m_include_paths, m_substitutions, cmt_vector< cmt_string >::push_back(), cmt_string::replace_all(), Symbol::resolve_macro_value(), cmt_vector< cmt_string >::size(), and CmtSystem::split(). Referenced by DependencyGenerator::build(). 00705 { 00706 m_deps.clear (); 00707 m_all_deps.clear (); 00708 00709 cmt_string preprocessor; 00710 Symbol* macro = Symbol::find ("preprocessor_command"); 00711 if (macro != 0) 00712 { 00713 preprocessor = macro->resolve_macro_value (); 00714 } 00715 00716 if (preprocessor == "") 00717 { 00718 // 00719 // Since no preprocessor command is defined, 00720 // we use the internal mechanism provided here. 00721 // 00722 cmt_string new_dir; 00723 00724 CmtSystem::dirname (file_name, new_dir); 00725 00726 build_deps (file_name, 00727 new_dir, 00728 0, 00729 m_include_paths, 00730 m_substitutions, 00731 m_all_deps, 00732 m_deps); 00733 } 00734 else 00735 { 00736 // 00737 // An external preprocessor command is defined. We expect it 00738 // to follow a "standard" syntax for its output, ie: 00739 // o It starts with: 00740 // |
|
? |
Definition at line 28 of file cmt_deps_builder.h. Referenced by run(). |
|
? |
Definition at line 27 of file cmt_deps_builder.h. Referenced by run(). |
|
? |
Definition at line 24 of file cmt_deps_builder.h. |
|
? |
Definition at line 25 of file cmt_deps_builder.h. |