Changeset 290
- Timestamp:
- Oct 25, 2006, 6:37:07 PM (19 years ago)
- Location:
- CMT/HEAD/source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_parser.cxx
r283 r290 1947 1947 if (tag == 0) continue; 1948 1948 1949 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag) && !Cmt::get_ disable_warnings ())1949 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag) && !Cmt::get_warnings ()) 1950 1950 { 1951 1951 cerr << "#CMT> The tag " << t << " is not used in any tag expression. Please check spelling" << endl; … … 1967 1967 } 1968 1968 1969 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag) && !Cmt::get_ disable_warnings ())1969 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag) && !Cmt::get_warnings ()) 1970 1970 { 1971 1971 cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl; -
CMT/HEAD/source/cmt_symbol.cxx
r257 r290 988 988 if (words.size () < 2) return; 989 989 const cmt_string& default_value = words[2]; 990 990 991 991 Cmt::reset_all_sets_done (); 992 992 … … 1033 1033 cmt_string tag_name = words[number]; 1034 1034 const cmt_string& value = words[number + 1]; 1035 1035 1036 1036 expand (tag_name); 1037 1037 -
CMT/HEAD/source/cmt_use.cxx
r280 r290 35 35 36 36 static bool add_request (const cmt_string& path, 37 const cmt_string& package_name, 38 const cmt_string& version) 37 const cmt_string& package_name, 38 const cmt_string& version, 39 const cmt_string& native_version) 39 40 { 40 41 static cmt_map <cmt_string, bool> requests; … … 44 45 request += version; 45 46 request += " "; 47 request += native_version; 48 request += " "; 46 49 request += path; 47 50 static bool b = true; … … 108 111 { 109 112 public: 110 Use* operate (Use* ref_use, Use* new_use );113 Use* operate (Use* ref_use, Use* new_use, const cmt_string& native_version); 111 114 }; 112 115 … … 134 137 static CompareStatus compare_versions (const cmt_string& ref_version, const cmt_string& new_version) 135 138 { 139 136 140 CompareStatus result = IdenticalIds; 137 141 … … 147 151 148 152 CmtSystem::is_version_directory (new_version, new_v, new_r, new_p); 153 cout << "#1 Required version " << new_version << 154 " incompatible with selected version " << ref_version << 155 endl; 156 149 157 150 158 if ((new_v != -1) && (old_v != -1) && (new_v != old_v)) … … 746 754 { 747 755 cout << "about to add " << package << endl; 748 show_packages ();749 }756 show_packages (); 757 } 750 758 751 759 /// Now do create or retreive the Use object. … … 1424 1432 1425 1433 //---------------------------------------------------------- 1426 int Use::reach_package (const cmt_string& from_path )1427 { 1428 if (Cmt::get_debug ())1434 int Use::reach_package (const cmt_string& from_path, const cmt_string& n_version) 1435 { 1436 if (Cmt::get_debug ()) 1429 1437 { 1430 1438 cout << "Use::reach_package> (" << get_package_name () << " " … … 1583 1591 // There are alternate possibilities when it contains wild cards 1584 1592 // 1585 if ((version == "") || 1586 (version.find ("*") != cmt_string::npos)) 1593 if ((version == "") || (version.find ("*") != cmt_string::npos)) 1587 1594 { 1588 1595 static CmtSystem::cmt_string_vector versions; … … 1594 1601 else name += version; 1595 1602 1596 CmtSystem::scan_dir (name, versions); 1603 CmtSystem::scan_dir (name, versions); 1604 if (n_version != "") 1605 { 1606 static CmtSystem::cmt_string_vector native_versions; 1607 for (int i = 0; i < versions.size (); i++) 1608 { 1609 cmt_string path; 1610 if (CmtSystem::test_directory (versions[i])) 1611 { 1612 path = versions[i]; 1613 path += CmtSystem::file_separator (); 1614 path += "cmt"; 1615 } 1616 else 1617 { 1618 path = "cmt"; 1619 } 1620 path += CmtSystem::file_separator (); 1621 path += "native_version.cmt"; 1622 1623 if (CmtSystem::test_file (path)) 1624 { 1625 cmt_string nv; 1626 nv.read (path); 1627 int pos; 1628 pos = nv.find ('\n'); 1629 if (pos != cmt_string::npos) nv.erase (pos); 1630 pos = nv.find ('\r'); 1631 if (pos != cmt_string::npos) nv.erase (pos); 1632 1633 if (nv == n_version) 1634 { 1635 cmt_string& name_entry = native_versions.add (); 1636 name_entry += versions[i]; 1637 } 1638 } 1639 } 1640 versions = native_versions; 1641 } 1597 1642 1598 1643 int i; … … 1616 1661 if (CmtSystem::is_version_directory (name, v, r, p)) 1617 1662 { 1663 1618 1664 /* 1619 1665 This check is not sufficient !! We need to check in addition … … 1623 1669 1624 1670 cmt_string req; 1625 1626 1671 req = name; 1627 1672 req += CmtSystem::file_separator (); … … 1711 1756 { 1712 1757 public: 1713 UseProjectAction (Use* use ) : m_use (use), m_found (false)1758 UseProjectAction (Use* use, const cmt_string& n_version="") : m_use (use), m_found (false) 1714 1759 { 1760 m_n_version = n_version; 1715 1761 } 1716 1762 … … 1727 1773 m_use->alternate_paths.clear (); 1728 1774 1729 if (m_use->reach_package (path ))1775 if (m_use->reach_package (path, m_n_version)) 1730 1776 { 1731 1777 if (Cmt::get_debug ()) … … 1760 1806 private: 1761 1807 Use* m_use; 1808 cmt_string m_n_version; 1762 1809 bool m_found; 1763 1810 }; 1764 1811 1765 1812 //---------------------------------------------------------- 1766 bool Use::move_to ( )1813 bool Use::move_to (const cmt_string& native_version) 1767 1814 { 1768 1815 if (m_located) … … 1778 1825 } 1779 1826 1780 reach_package (real_path );1827 reach_package (real_path, native_version); 1781 1828 1782 1829 return (true); … … 1790 1837 if (expanded_path == "") 1791 1838 { 1792 if (reach_package ("" ))1839 if (reach_package ("", native_version)) 1793 1840 { 1794 1841 if (Cmt::get_debug ()) … … 1821 1868 if (CmtSystem::absolute_path (expanded_path)) 1822 1869 { 1823 if (reach_package (expanded_path ))1870 if (reach_package (expanded_path, native_version)) 1824 1871 { 1825 1872 if (Cmt::get_debug ()) … … 1849 1896 // Second try is among the CMTPATHs 1850 1897 // 1851 1852 UseProjectAction pa (this); 1898 UseProjectAction pa (this, native_version); 1853 1899 1854 1900 Project::broadcast (pa); … … 1929 1975 { 1930 1976 version = alternate_versions[selected_index]; 1931 if (reach_package (alternate_paths[selected_index] ))1977 if (reach_package (alternate_paths[selected_index], native_version)) 1932 1978 { 1933 1979 /* … … 1958 2004 const cmt_string& package, 1959 2005 const cmt_string& version, 2006 const cmt_string& native_version, 1960 2007 Use** old_use, 1961 1962 { 1963 bool new_request = add_request (path, package, version );2008 Use* context_use) 2009 { 2010 bool new_request = add_request (path, package, version, native_version); 1964 2011 1965 2012 Use& current_use = Use::current (); … … 1976 2023 } 1977 2024 1978 Package* p = Package::add (package); 1979 2025 Package* p = Package::add (package); 1980 2026 UsePtrVector& uses = p->get_uses (); 1981 2027 1982 2028 bool do_need_new = true; 1983 Use* found = 0;1984 Use* registered = 0;2029 Use* found = 0; 2030 Use* registered = 0; 1985 2031 1986 2032 int req_v = -1; … … 2061 2107 << endl; 2062 2108 } 2063 2064 2109 // The registered use loses against the request 2065 2110 } … … 2100 2145 } 2101 2146 } 2147 2148 2102 2149 2103 2150 if (Cmt::get_debug ()) … … 2156 2203 cout << " ... requested wildcarded loses against existing explicit" << endl; 2157 2204 } 2158 2159 do_need_new = false; // We don't need a new one 2205 do_need_new = false; // We don't need a new one 2160 2206 } 2161 2207 else … … 2163 2209 // here either !has_wild_card or use_has_wild_card 2164 2210 2165 if ((version == use.specified_version) && 2166 (path == use.specified_path)) 2211 if ((version == use.specified_version) && (path == use.specified_path)) 2167 2212 { 2168 2213 if (Cmt::get_debug ()) … … 2320 2365 Use* use = 0; 2321 2366 2322 do_need_new = need_new (path, package_name, version, &old_use, context_use);2323 // cout <<"native_version: "<<native_version<<" "<<version<<endl;2367 do_need_new = need_new (path, package_name, version, native_version, &old_use, context_use); 2368 //cout <<"native_version: "<<native_version<<" "<<version<<" "<<do_need_new<<endl; 2324 2369 2325 2370 … … 2338 2383 { 2339 2384 use = create (path, package_name, version, version_alias, path_alias); 2385 //cout <<"need_new native_version: "<<native_version<<" "<<version<<" "<<do_need_new<<endl; 2340 2386 } 2341 2387 else … … 2412 2458 * we have created a new Use (which has to be validated) 2413 2459 */ 2414 bool found = use->move_to (); 2460 bool found = use->move_to (native_version); 2461 2415 2462 2416 2463 if (Cmt::get_debug ()) … … 2480 2527 if (use != 0) use->discard (); 2481 2528 use = old_use; 2482 found = use->move_to ( );2529 found = use->move_to (native_version); 2483 2530 } 2484 2531 else … … 2488 2535 // thus we have to choose 2489 2536 // 2490 static BestFitSelector selector;2491 Use* selected_use = selector.operate (old_use, use );2537 static BestFitSelector selector; 2538 Use* selected_use = selector.operate (old_use, use, native_version); 2492 2539 2493 2540 if (Cmt::get_debug ()) … … 2505 2552 if (use != selected_use) 2506 2553 { 2507 use = use->set_selected_version (selected_use);2554 use = use->set_selected_version (selected_use); 2508 2555 } 2509 2556 … … 2511 2558 /* 2512 2559 * current directory is moved to the selected one 2513 */ 2514 found = use->move_to (); 2560 */ 2561 found = use->move_to (native_version); 2562 2515 2563 } 2516 2564 } … … 3868 3916 // 3869 3917 //---------------------------------------------------------- 3870 Use* BestFitSelector::operate (Use* ref_use, Use* new_use) 3871 { 3918 Use* BestFitSelector::operate (Use* ref_use, Use* new_use, const cmt_string& native_version) 3919 { 3920 3872 3921 Use* selected = ref_use; 3873 3922 -
CMT/HEAD/source/cmt_use.h
r283 r290 82 82 void author_action (const CmtSystem::cmt_string_vector& words); 83 83 void manager_action (const CmtSystem::cmt_string_vector& words); 84 bool move_to ( );84 bool move_to (const cmt_string& native_version=""); 85 85 void discard (); 86 86 void undiscard (); … … 159 159 private: 160 160 void clear (); 161 int reach_package (const cmt_string& current_path );161 int reach_package (const cmt_string& current_path, const cmt_string& n_version=""); 162 162 void select (); 163 163 void unselect (); … … 173 173 const cmt_string& package, 174 174 const cmt_string& version, 175 const cmt_string& native_version, 175 176 Use** old_use, 176 177 Use* context_use);
Note:
See TracChangeset
for help on using the changeset viewer.