Changeset 662 for CMT/HEAD/source
- Timestamp:
- Jan 6, 2014, 3:40:25 PM (11 years ago)
- Location:
- CMT/HEAD/source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt.h
r659 r662 106 106 static void configure_current_cmtpath (); 107 107 static void configure_current_dir (); 108 static void configure_current_package (); 108 static cmt_string configure_current_package (); 109 // static void configure_current_package (); 109 110 // static void configure_current_structuring_style (); 110 111 static void configure_current_structuring_style (const ArgParser& ap); -
CMT/HEAD/source/cmt_map.h
r11 r662 276 276 * Return 0 if not found 277 277 */ 278 const T* find (const K& key) const 278 T* find (const K& key) 279 // const T* find (const K& key) const 279 280 { 280 281 if (key < m_key) … … 504 505 * Returns 0 if not found 505 506 */ 506 const T* find (const K& key) const 507 T* find (const K& key) const 508 // const T* find (const K& key) const 507 509 { 508 510 if (m_top != 0) -
CMT/HEAD/source/cmt_parser.cxx
r660 r662 557 557 558 558 //---------------------------------------------------------- 559 namespace { 560 561 bool parse_cmt_flags (const cmt_string& file_name, CmtContext& cmt) 562 { 563 cmt_string Flags (Cmt::get_cmt_flags (file_name)); 564 if (CmtError::get_last_error_code () == CmtError::file_access_error) 565 return false; 566 if (Flags.size () == 0) 567 return true; 568 569 cmt_string CmtFlags (Cmt::get_cmt_flags ()); 570 if (CmtFlags.size () != 0) 571 Flags += " " + CmtFlags; 572 573 CmtSystem::cmt_string_vector flags; 574 CmtSystem::split (Flags, " \t", flags); 575 for (int i = 0; i < flags.size (); i++) 576 { 577 if (flags[i] == "-without_cmt" && 578 cmt.m_use_cmt) 579 cmt.m_use_cmt = false; 580 else if (flags[i] == "-with_cmt" && 581 !cmt.m_use_cmt) 582 cmt.m_use_cmt = true; 583 else if (flags[i] == "-without_projects" && 584 cmt.m_use_projects) 585 cmt.m_use_projects = false; 586 else if (flags[i] == "-with_projects" && 587 !cmt.m_use_projects) 588 cmt.m_use_projects = true; 589 else if (flags[i] == "-no_strip_path" && 590 cmt.m_strip_path) 591 { 592 cmt.m_strip_path = false; 593 Symbol::set_strip_path (false); 594 } 595 else if (flags[i] == "-strip_path" && 596 !cmt.m_strip_path) 597 { 598 cmt.m_strip_path = true; 599 Symbol::set_strip_path (true); 600 } 601 } 602 603 return true; 604 } 605 606 } 607 608 //---------------------------------------------------------- 559 609 //void Cmt::configure () 560 610 void Cmt::configure (const ArgParser& ap) … … 587 637 configure_site_tag (0); 588 638 639 cmt_string requirements; 640 589 641 if (Me.m_current_package.size () != 0 && 590 642 Me.m_current_package != "cmt_standalone") 591 { // we have a package name (not "cmt_standalone") 643 { 644 // we have a package name (not "cmt_standalone") 592 645 Use& use = Use::current(); 593 646 use.set (Me.m_current_package, … … 609 662 } 610 663 } 664 665 if (use.located ()) 666 { 667 // parse additional options 668 parse_cmt_flags ("requirements", m_cmt_context); 669 } 611 670 } 612 671 else … … 617 676 CmtError::set (CmtError::path_not_found, Me.m_current_path); 618 677 return; 678 } 679 680 configure_current_dir (); 681 configure_current_structuring_style (ap); 682 cmt_string current_package_saved (Me.m_current_package); 683 requirements = configure_current_package (); 684 Me.m_current_package = current_package_saved; 685 if (requirements.size () != 0) 686 { 687 // parse additional options 688 parse_cmt_flags (requirements, m_cmt_context); 619 689 } 620 690 } … … 679 749 configure_current_structuring_style (ap); 680 750 751 // if (requirements.size () == 0) 752 // { 681 753 log << "configure_current_package" << log_endl; 682 754 configure_current_package (); 755 // } 683 756 684 757 Use& use = Use::current(); … … 866 939 void Cmt::configure_current_dir () 867 940 { 941 if (Me.m_current_dir.size () != 0) return; 942 868 943 cmt_string file_name; 869 944 … … 927 1002 928 1003 //---------------------------------------------------------- 929 void Cmt::configure_current_package () 1004 cmt_string Cmt::configure_current_package () 1005 //void Cmt::configure_current_package () 930 1006 { 931 1007 /* … … 941 1017 build_prefix (Me.m_current_package, Me.m_current_prefix); 942 1018 build_config (Me.m_current_prefix, Me.m_current_config); 943 return; 1019 1020 cmt_string req; 1021 use.get_full_path (req); 1022 switch (use.style) 1023 { 1024 case cmt_style: 1025 req += CmtSystem::file_separator (); 1026 req += "cmt"; 1027 break; 1028 case mgr_style: 1029 req += CmtSystem::file_separator (); 1030 req += "mgr"; 1031 break; 1032 default: 1033 break; 1034 } 1035 req += CmtSystem::file_separator (); 1036 req += "requirements"; 1037 return req; 944 1038 } 945 1039 … … 956 1050 else 957 1051 { 958 cmt_string req = ".."; 1052 req = ".."; 1053 // cmt_string req = ".."; 959 1054 req += CmtSystem::file_separator (); 960 1055 req += "mgr"; … … 970 1065 // This package is probably a standalone one 971 1066 Me.m_current_style = none_style; 1067 req = "requirements"; 1068 if (!CmtSystem::test_file (req)) 1069 { 1070 req = ""; 1071 } 972 1072 } 973 1073 } … … 1210 1310 build_config (Me.m_current_prefix, Me.m_current_config); 1211 1311 } 1312 1313 return req; 1212 1314 } 1213 1315 … … 6943 7045 default: 6944 7046 configure (ap); 6945 //restore_all_tags (0);6946 7047 break; 6947 7048 } … … 7275 7376 switch (Me.m_action) 7276 7377 { 7277 case action_none :7378 //case action_none : 7278 7379 case action_awk : 7279 7380 case action_broadcast : -
CMT/HEAD/source/cmt_symbol.cxx
r660 r662 53 53 inline void set_strip_path (const bool& strip_path); 54 54 55 static PathBuilder* get_path_builder (); 56 57 private: 55 58 PathBuilder (); 56 59 PathBuilder (bool strip_path); 57 58 private: 60 PathBuilder (const PathBuilder& other); 61 PathBuilder& operator = (const PathBuilder& other); 62 59 63 bool m_strip_path; 60 64 }; … … 754 758 { 755 759 static SetBuilder Set; 756 static PathBuilder Path (Cmt::get_strip_path ()); 760 static PathBuilder* PathPtr (PathBuilder::get_path_builder ()); 761 //static PathBuilder Path (Cmt::get_strip_path ()); 757 762 //static PathBuilder Path; 758 763 static MacroBuilder Macro; … … 915 920 break; 916 921 case SymbolPath: 917 symbol.builder = &Path; 922 symbol.builder = PathPtr; 923 //symbol.builder = &Path; 918 924 break; 919 925 case SymbolAlias: … … 1261 1267 bool Symbol::set_strip_path (const bool& strip_path) 1262 1268 { 1269 PathBuilder::get_path_builder ()->set_strip_path (strip_path); 1270 return true; 1271 /* 1263 1272 // searching for a path symbol 1264 1273 for (int number = 0; number < Symbol::symbol_number (); number++) … … 1274 1283 1275 1284 return false; 1285 */ 1276 1286 } 1277 1287 … … 2595 2605 } 2596 2606 */ 2607 //------------------------------------------------------------- 2608 PathBuilder* PathBuilder::get_path_builder () 2609 { 2610 static PathBuilder Path (Cmt::get_strip_path ()); 2611 return &Path; 2612 } 2613 2597 2614 //------------------------------------------------------------- 2598 2615 PathBuilder::PathBuilder () -
CMT/HEAD/source/cmt_tag.cxx
r653 r662 235 235 236 236 tag->mark (use ? use->get_package_name () : ""); 237 238 Use::UsePtrVector * puses; 239 if (!(puses = apply_tag ().find (tag))) 240 { 241 Use::UsePtrVector uses; 242 uses.push_back (use); 243 apply_tag ().add (tag, uses); 244 } 245 else 246 { 247 bool have (false); 248 for (int i = 0; i < puses->size (); i++) 249 { 250 if ((*puses)[i] == use) 251 { 252 have = true; 253 break; 254 } 255 } 256 if (!have) 257 puses->push_back (use); 258 } 259 237 260 } 238 261 } … … 607 630 if (tag->m_tag_refs.size () > 0) return (true); 608 631 if (tag->m_tag_excludes.size () > 0) return (true); 632 if (apply_tag ().has (tag)) return (true); 609 633 610 634 return (false); 635 } 636 637 /*----------------------------------------------------------*/ 638 Tag::TagUses& Tag::apply_tag () 639 { 640 static TagUses tag_uses; 641 return tag_uses; 611 642 } 612 643 … … 827 858 out << "]"; 828 859 } 860 861 if (Use::UsePtrVector * puses = apply_tag ().find (this)) 862 { 863 out << " applied ["; 864 for (int i = 0; i < puses->size (); i++) 865 { 866 if (i > 0) out << " "; 867 Use * use = (*puses)[i]; 868 if (use) 869 { 870 out << use->get_package_name (); 871 } 872 else 873 { 874 out << "current"; 875 } 876 } 877 out << "]"; 878 } 879 829 880 if (m_act_context.size () != 0 && 830 881 (m_def_use != 0 && -
CMT/HEAD/source/cmt_tag.h
r568 r662 20 20 typedef cmt_vector<Tag*> TagPtrVector; 21 21 22 typedef cmt_vmap<const Tag*, Use::UsePtrVector> TagUses; 23 22 24 static void action (const CmtSystem::cmt_string_vector& words, Use* use); 23 25 static void action_apply (const CmtSystem::cmt_string_vector& words, Use* use); … … 40 42 41 43 static bool check_tag_used (const Tag* tag); 44 45 static TagUses& apply_tag (); 42 46 43 47 public:
Note: See TracChangeset
for help on using the changeset viewer.