- Timestamp:
- Mar 2, 2005, 5:39:59 PM (19 years ago)
- Location:
- CMT/v1r19
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/v1r19/ChangeLog
r1 r3 1 2005-03-02 Christian Arnault <arnault@lal.in2p3.fr> 251 2 3 * source/cmt_symbol.h (class Symbol): Add an optional argument to build_macro_value to switch display mode 4 5 * source/cmt_symbol.cxx (show_macro): Improve the display mode so as to display only once the macro construction steps 6 7 * source/cmt_parser.cxx (guess_current_project): Regenerate CMTPATH from the effective set of subprojects. 8 9 * source/cmt_commands.cxx (parse): Handle unexpected arguments 10 11 * source/cmt_error.cxx (class Error): Added unknown_command error 12 * source/cmt_error.h (class CmtError): Added unknown_command error 13 14 * source/cmt_commands.cxx (do_filter): Missing implementation for the filter command 15 16 2005-03-01 Christian Arnault <arnault@lal.in2p3.fr> 251 17 18 * source/cmt_tag.cxx (use_operand): Add way of checking internal structure of a tag 19 * source/cmt_tag.cxx (use_ref): Add way of checking internal structure of a tag 20 21 * source/cmt_tag.h (class Tag): Add way of checking internal structure of a tag 22 23 * source/cmt_symbol.h (class Symbol): Add way of checking if a tag is used by symbols. 24 25 * source/cmt_symbol.cxx (print): Suppress the "export" action after defining an alias in Sh mode 26 27 * source/cmt_project.cxx: Introduce use_action 28 29 * source/cmt_syntax.cxx (SyntaxParser): Add support to use statements in project files 30 31 * source/cmt_project.cxx (create_project): Add comments 32 1 33 2004-12-14 <arnault@lal.in2p3.fr> 250 2 34 -
CMT/v1r19/source/cmt_commands.cxx
r2 r3 422 422 shift (); 423 423 424 cmt.m_action = action_none; 425 424 426 while (argc > 0) 425 427 { … … 457 459 if (parsers.has (reduced_arg)) 458 460 { 461 // This argument corresponds to a known command 462 459 463 int i = (*parsers.find (reduced_arg)); 460 464 … … 462 466 (me.*p) (); 463 467 } 468 else if (cmt.m_action != action_none) 469 { 470 // We have unexpected arguments (not handled by the command handler). This may sign 471 // an unprotected handler implementation. 472 if (!cmt.m_quiet) cerr << "#CMT> warning : unexpected parameter " << reduced_arg << endl; 473 } 464 474 else 465 475 { 476 // This argument does not correspond to a known command. We expect then an action 477 // to be executed with that name 478 466 479 unshift (); 467 480 do_do (); … … 913 926 void ArgParser::do_filter () 914 927 { 915 cmt.m_action = action_filter; 928 if (argc > 0) 929 { 930 fill_arguments (); 931 cmt.m_action = action_filter; 932 } 933 else 934 { 935 if (!cmt.m_quiet) cerr << "#CMT> syntax error : file to filter not specified" << endl; 936 help_action = action_help; 937 cmt.m_action = action_filter; 938 } 916 939 } 917 940 … … 1690 1713 Tag* tag; 1691 1714 CmtSystem::cmt_string_vector words; 1692 1715 1693 1716 // First reset selection of all existing tags 1694 1717 //Tag::clear_all (); -
CMT/v1r19/source/cmt_error.cxx
r2 r3 33 33 error_names.add() = "cannot_remove_lock"; 34 34 error_names.add() = "conflicting_lock"; 35 error_names.add() = "unknown_command"; 35 36 } 36 37 -
CMT/v1r19/source/cmt_error.h
r2 r3 34 34 cannot_run_unlock_command, 35 35 cannot_remove_lock, 36 conflicting_lock 36 conflicting_lock, 37 unknown_command 37 38 } code; 38 39 -
CMT/v1r19/source/cmt_parser.cxx
r2 r3 1961 1961 void Cmt::do_check_configuration (const ArgParser& ap) 1962 1962 { 1963 cmt_string env; 1964 Tag* tag; 1965 1966 static CmtSystem::cmt_string_vector tags; 1967 1968 CmtSystem::split (Me.m_extra_tags, " \t,", tags); 1969 1970 for (int i = 0; i < tags.size (); i++) 1971 { 1972 const cmt_string& t = tags[i]; 1973 1974 tag = Tag::find (t); 1975 if (tag == 0) continue; 1976 1977 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 1978 { 1979 cerr << "#CMT> The tag " << t << " is not used in any tag expression. Please check spelling" << endl; 1980 } 1981 } 1982 1983 env = CmtSystem::getenv ("CMTSITE"); 1984 if (env == "") 1985 { 1986 return; 1987 } 1988 1989 tag = Tag::find (env); 1990 if (tag == 0) 1991 { 1992 return; 1993 } 1994 1995 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 1996 { 1997 cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl; 1998 } 1999 2000 env = CmtSystem::getenv ("CMTCONFIG"); 2001 if (env == "") 2002 { 2003 return; 2004 } 2005 2006 tag = Tag::find (env); 2007 if (tag == 0) 2008 { 2009 return; 2010 } 2011 2012 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 2013 { 2014 cerr << "#CMT> The CMTCONFIG value " << env << " is not used in any tag expression. Please check spelling" << endl; 2015 } 1963 2016 } 1964 2017 … … 2454 2507 { 2455 2508 Me.m_action = action_show_action_names; 2509 /* 2456 2510 if (!Me.m_quiet) 2457 2511 { … … 2459 2513 print_symbol_names (ap.mode); 2460 2514 } 2461 CmtError::set (CmtError::symbol_not_found, ap.arguments[0]); 2515 */ 2516 CmtError::set (CmtError::unknown_command, ap.arguments[0]); 2462 2517 return; 2463 2518 } … … 2986 3041 void Cmt::do_setup (const ArgParser& ap) 2987 3042 { 3043 3044 do_check_configuration (ap); 3045 2988 3046 print (ap.mode); 2989 3047 … … 3866 3924 { 3867 3925 //this directory should become the first entry of the CMTPATH 3926 3927 IProjectFactory& factory = ProjectFactory::instance (); 3928 factory.create_project (pwd, "CurrentProject"); 3929 3930 /* 3868 3931 cmt_string temp = "path_prepend CMTPATH \""; 3869 3932 temp += pwd; … … 3873 3936 3874 3937 SyntaxParser::parse_requirements_line (temp, &use); 3875 3938 */ 3939 3876 3940 break; 3877 3941 } … … 3890 3954 CmtSystem::cd (Me.m_current_dir); 3891 3955 } 3956 3957 cmt_string buffer = "path CMTPATH \n"; 3958 Project::set_cmtpaths (buffer); 3959 //cerr << "buffer = " << buffer << endl; 3960 Use& use = Use::current(); 3961 SyntaxParser::parse_requirements_text (buffer, "", &use); 3892 3962 } 3893 3963 -
CMT/v1r19/source/cmt_project.cxx
r2 r3 97 97 } 98 98 99 /* 100 Every new CMTPATH entry becomes associated with a dedicated PROJECT 101 This function will understand this new entry to CMTPATH and understand it: 102 - it can correspond to an existing project (ie already declared) 103 - it's a new project 104 - then it tries to read and parse its project file 105 */ 99 106 void ProjectFactory::create_project (const cmt_string& path, 100 107 const cmt_string& source) … … 121 128 if (!CmtSystem::cd (compressed_path)) return; 122 129 130 // 131 // Figure out if this is the current project 132 // 123 133 cmt_string pwd = CmtSystem::pwd (); 124 134 if (here.find (pwd) == 0) is_current = true; … … 126 136 cmt_string text; 127 137 138 /* 139 Now Figure out the project name from the project file 140 Or construct an automatic project name when project file does no exist 141 or does not specify the project name 142 */ 128 143 if (CmtSystem::cd ("cmt") && CmtSystem::test_file (Project::get_project_file_name ())) 129 144 { … … 180 195 if (is_current) 181 196 { 197 // 198 // The current project defines a tag with its name 199 // 200 182 201 Tag* tag; 183 202 … … 191 210 if (text != "") 192 211 { 212 // Last step is to parse the project file 213 193 214 SyntaxParser::parse_project_file_text (text, 194 215 Project::get_project_file_name (), … … 547 568 548 569 return (""); 570 } 571 572 //---------------------------------------------------------- 573 void Project::set_cmtpaths (cmt_string& buffer) 574 { 575 /* 576 Try to re-create all CMTPATH items from project definitions. 577 The goal is to generate CMTPATH even if this EV was not pre-set 578 which is the case when CMTPROJECTPATH is only used 579 */ 580 581 static ProjectVector& Projects = projects (); 582 583 for (int i = 0; i < Projects.size (); i++) 584 { 585 const Project& project = Projects[i]; 586 587 const cmt_string& p = project.m_cmtpath; 588 const cmt_string& w = project.m_cmtpath_pwd; 589 const cmt_string& s = project.m_cmtpath_source; 590 591 if (s == "default path") continue; 592 593 if (CmtSystem::test_directory (w)) 594 { 595 buffer += "path_append CMTPATH \""; 596 buffer += w; 597 buffer += "\" \n"; 598 } 599 } 549 600 } 550 601 … … 748 799 } 749 800 } 801 802 //---------------------------------------------------------- 803 void Project::use_action (const cmt_string& name, const cmt_string& release) 804 { 805 //cerr << "Use action " << name << " " << release << endl; 806 807 // A project with its release is specified 808 // 809 // Is this project already visible? 810 // If not: look for it 811 // + get CMTPROJECTPATH 812 // + search from all entries of CMTPROJECTPATH : pi/<name>/<release> 813 // + when found, this should become a new CMTPATH entry 814 // + the new project is then parsed ... etc... 815 816 // Question : do we consider by default pwd/../.. ??? 817 818 cmt_string cmtprojectpath = CmtSystem::getenv ("CMTPROJECTPATH"); 819 cmt_string sep; 820 sep += CmtSystem::path_separator (); 821 822 //cerr << "cmtprojectpath = " << cmtprojectpath << endl; 823 CmtSystem::cmt_string_vector items; 824 CmtSystem::split (cmtprojectpath, sep, items); 825 for (int i = 0; i < items.size (); i++) 826 { 827 const cmt_string& item = items[i]; 828 cmt_string p = item; 829 p += CmtSystem::file_separator (); 830 p += name; 831 p += CmtSystem::file_separator (); 832 p += release; 833 834 if (CmtSystem::test_directory (p)) 835 { 836 //cerr << "Project directry " << p << " exists " << endl; 837 838 IProjectFactory& factory = ProjectFactory::instance (); 839 840 factory.create_project (p, "ProjectPath"); 841 842 break; 843 } 844 } 845 } 846 750 847 751 848 //---------------------------------------------------------- -
CMT/v1r19/source/cmt_project.h
r2 r3 64 64 static cmt_string find_in_cmt_paths (const cmt_string& path); 65 65 66 static void set_cmtpaths (cmt_string& buffer); 67 66 68 public: 67 69 … … 80 82 void clear (); 81 83 void configure (); 84 85 void use_action (const cmt_string& name, const cmt_string& release); 82 86 83 87 Project& operator = (const Project& other); -
CMT/v1r19/source/cmt_symbol.cxx
r2 r3 1541 1541 case Sh : 1542 1542 cout << "alias " << name << 1543 "=\"" << temp << 1544 "\"; export " << name; 1543 "=\"" << temp << "\""; 1545 1544 result = 1; 1546 1545 break; … … 1590 1589 1591 1590 //------------------------------------------------------------- 1592 cmt_string Symbol::build_macro_value ( ) const1591 cmt_string Symbol::build_macro_value (bool display_it) const 1593 1592 { 1594 1593 cmt_string temp; 1595 1594 1596 temp = builder->build (*this); 1595 if (display_it) 1596 { 1597 temp = builder->build_and_display (*this); 1598 } 1599 else 1600 { 1601 temp = builder->build (*this); 1602 } 1597 1603 1598 1604 return (temp); … … 1652 1658 ActionType action = Cmt::get_action (); 1653 1659 1654 cmt_string value = build_macro_value ( );1660 cmt_string value = build_macro_value (true); 1655 1661 1656 1662 if ((!Cmt::get_quiet ()) && … … 1754 1760 1755 1761 //------------------------------------------------------------- 1762 ValueBuilder::ValueBuilder () 1763 { 1764 m_display_it = false; 1765 } 1766 1767 //------------------------------------------------------------- 1768 const cmt_string ValueBuilder::build_and_display (const Symbol& symbol) 1769 { 1770 cmt_string temp; 1771 1772 m_display_it = true; 1773 temp = build (symbol); 1774 m_display_it = false; 1775 1776 return (temp); 1777 } 1778 1779 //------------------------------------------------------------- 1756 1780 const cmt_string SetBuilder::build (const Symbol& symbol, 1757 1781 const cmt_string& /*tag_name*/) … … 1760 1784 static int level = 0; 1761 1785 1762 int show_it = 0;1786 bool show_it = false; 1763 1787 1764 1788 cmt_string temp; … … 1774 1798 { 1775 1799 // Should not display on recursive calls 1776 if (level == 0) show_it = 1;1800 if (level == 0) show_it = m_display_it; 1777 1801 } 1778 1802 } … … 1941 1965 static int level = 0; 1942 1966 1943 int show_it = 0;1967 bool show_it = false; 1944 1968 1945 1969 cmt_string temp; … … 1957 1981 { 1958 1982 // Should not display on recursive calls 1959 if (level == 0) show_it = 1;1983 if (level == 0) show_it = m_display_it; 1960 1984 } 1961 1985 } … … 2276 2300 cmt_string previous_temp; 2277 2301 static const cmt_string empty; 2278 int show_it = 0;2302 bool show_it = false; 2279 2303 2280 2304 ActionType action = Cmt::get_action (); … … 2285 2309 { 2286 2310 // Should not display on recursive calls 2287 if (level == 0) show_it = 1;2311 if (level == 0) show_it = m_display_it; 2288 2312 } 2289 2313 } … … 2522 2546 cmt_string previous_temp; 2523 2547 static const cmt_string empty; 2524 int show_it = 0;2548 bool show_it = false; 2525 2549 2526 2550 ActionType action = Cmt::get_action (); … … 2531 2555 { 2532 2556 // Should not display on recursive calls 2533 if (level == 0) show_it = 1;2557 if (level == 0) show_it = m_display_it; 2534 2558 } 2535 2559 } … … 2789 2813 } 2790 2814 2815 //------------------------------------------------------------- 2816 bool Symbol::check_tag_used (Tag* tag) 2817 { 2818 if (tag == 0) return (false); 2819 2820 static SymbolVector& Symbols = symbols (); 2821 2822 if (Symbols.size () == 0) 2823 { 2824 return (false); 2825 } 2826 2827 for (int number = 0; number < Symbol::symbol_number (); number++) 2828 { 2829 Symbol& symbol = Symbol::symbol (number); 2830 2831 for (int i = 0; i < symbol.value_lists.size (); i++) 2832 { 2833 const SymbolValueList& value_list = symbol.value_lists[i]; 2834 2835 for (int j = 0; j < value_list.values.size (); j++) 2836 { 2837 const SymbolValue& value = value_list.values[j]; 2838 Tag* t = value.tag; 2839 2840 if (t != 0) 2841 { 2842 if (t->use_operand (tag)) return (true); 2843 } 2844 } 2845 } 2846 } 2847 2848 return (false); 2849 } 2850 -
CMT/v1r19/source/cmt_symbol.h
r2 r3 47 47 { 48 48 public: 49 ValueBuilder (); 50 const cmt_string build_and_display (const Symbol& symbol); 51 49 52 virtual const cmt_string build (const Symbol& symbol, 50 53 const cmt_string& tag_name = "") = 0; 51 54 virtual const cmt_string clean (const Symbol& symbol, 52 55 const cmt_string& tag_name = "") = 0; 56 protected: 57 bool m_display_it; 53 58 }; 54 59 … … 92 97 static void expand (cmt_string& text); 93 98 99 static bool check_tag_used (Tag* tag); 100 94 101 public: 95 102 Symbol (); … … 103 110 int print_clean (PrintMode mode); 104 111 int print (PrintMode mode); 105 cmt_string build_macro_value ( ) const;112 cmt_string build_macro_value (bool display_it = false) const; 106 113 cmt_string clean_macro_value () const; 107 114 cmt_string resolve_macro_value (const cmt_string& tag_name = ""); -
CMT/v1r19/source/cmt_syntax.cxx
r2 r3 898 898 { 899 899 Use::action (words, use); 900 } 901 902 void action (const CmtSystem::cmt_string_vector& words, 903 Project* project, 904 const cmt_string& file_name, 905 int line_number) 906 { 907 project->use_action (words[1], words[2]); 900 908 } 901 909 }; … … 1119 1127 m_project_keywords.add ("project", new KwdProject ()); 1120 1128 m_project_keywords.add ("setup_strategy", new KwdSetupStrategy ()); 1129 m_project_keywords.add ("use", new KwdUse ()); 1121 1130 } 1122 1131 -
CMT/v1r19/source/cmt_tag.cxx
r2 r3 572 572 573 573 return (&(default_tag)); 574 } 575 576 /*----------------------------------------------------------*/ 577 bool Tag::check_tag_used (const Tag* tag) 578 { 579 if (tag == 0) return (false); 580 581 if (tag->m_tag_refs.size () > 0) return (true); 582 if (tag->m_tag_excludes.size () > 0) return (true); 583 584 return (false); 574 585 } 575 586 … … 852 863 } 853 864 854 865 /* 866 Check if a tag is part of the operands of a tag 867 */ 868 bool Tag::use_operand (const Tag* other) const 869 { 870 if (other == this) return (true); 871 if (m_and_operands.size () == 0) return (false); 872 873 for (int i = 0; i < m_and_operands.size (); i++) 874 { 875 Tag* t = m_and_operands[i]; 876 877 if (t != 0) 878 { 879 if (t->use_operand (other)) return (true); 880 } 881 } 882 883 return (false); 884 } 885 886 /* 887 Check if a tag is part of the refs of a tag 888 */ 889 bool Tag::use_ref (const Tag* other) const 890 { 891 if (other == this) return (false); 892 if (m_tag_refs.size () == 0) return (false); 893 894 for (int i = 0; i < m_tag_refs.size (); i++) 895 { 896 Tag* t = m_tag_refs[i]; 897 898 if (t == other) return (true); 899 } 900 901 return (false); 902 } 903 904 -
CMT/v1r19/source/cmt_tag.h
r2 r3 39 39 static Tag* get_default (); 40 40 41 static bool check_tag_used (const Tag* tag); 42 41 43 public: 42 44 Tag (); … … 56 58 int get_priority () const; 57 59 void install (TagMap& instances); 60 bool use_operand (const Tag* other) const; 61 bool use_ref (const Tag* other) const; 58 62 59 63 private: -
CMT/v1r19/source/cmt_version.h
r2 r3 8 8 #define __cmt_version_h__ 9 9 10 #define CMTVERSION "v1r18p200 41201"10 #define CMTVERSION "v1r18p2005" 11 11 12 12 #endif
Note: See TracChangeset
for help on using the changeset viewer.