- Timestamp:
- Nov 5, 2013, 3:40:52 PM (11 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r651 r652 1 2013-11-05 <rybkin@lal.in2p3.fr> 511 2 3 * source/cmt_project.h: In class Project, change fill_selection function 4 signature to return projects (pointers), introduce function fill_exclusion 5 * source/cmt_project.cxx: In class ProjectFactory create_project function, 6 use change_path function on project use object, in class Project implement 7 fill_selection function for enhanced handling of special CMTHOME, 8 CMTUSERCONTEXT projects (selected if current project only) and special 9 depth values (0: CMTUSERCONTEXT project only, -1: CMTHOME project only), 10 implement fill_exclusion function to exclude special CMTHOME, 11 CMTUSERCONTEXT projects unless current project, in find_in_cmt_paths 12 function fix search condition and comment out never used code, in 13 container_action function issue warning or set error if container package 14 cannot be located 15 * source/cmt_use.h: In class Use, add member to hold project (pointer) 16 package found in, add optional argument project (pointer) to change_path, 17 select_alternate functions, add set_project function, inline located 18 function, make m_located member private 19 * source/cmt_use.cxx: In class Use, assign use project in function 20 change_path, in class UseProjectAction run and class Use select_alternate 21 functions, in particular, in functions get_cmtpath_and_offset, 22 fill_standard_macros, get_project make use of added class member (project) 23 for optimisation 24 * source/cmt_generators.h: In class PackagesMakefileGenerator, add member 25 m_ISINCLUDED 26 * source/cmt_generators.cxx: In class PackagesMakefileGenerator 27 constructor, reset function handle added member m_ISINCLUDED, in build 28 function make use of class Project fill_exclusion function and added 29 member to ensure packages from special CMTHOME, CMTUSERCONTEXT projects 30 are only visited, if in current project 31 * source/cmt_syntax.cxx: In class KwdBuildStrategy, KwdSetupStrategy, 32 KwdStructureStrategy action functions use class Use get_project function 33 for optimisation 34 * source/cmt_commands.cxx: In class ArgParser option_disable_warnings, 35 option_quiet, option_warnings functions, do not set CmtMessage level, add 36 option value to CMTFLAGS, in option_use, option_pack, option_version, 37 option_path functions only record option value, in option_tag, 38 option_tag_add, option_tag_remove functions, only record option values, in 39 option_with_version_directory, option_without_version_directory functions 40 do not change strategy, add option value to CMTFLAGS, in class CommandHelp 41 show_all function, add message for -home, -user_context options 42 * source/cmt_pattern.cxx: In class Pattern expand function, use class Use 43 get_project function for optimisation 44 * source/cmt_parser.cxx: In class CmtContext constructor, process 45 CMTEXTRATAGS environment variable value, in clear function, reset all 46 members, in class Cmt configure function, attempt to locate current use 47 or package if at least name is available from command line options before 48 configure_current_package for optimisation, in configure_current_cmtpath 49 function make use of class Use get_cmtpath_and_offset function, 50 return from configure_current_package if current use is located, in 51 configure_current_structuring_style function, do not parse command line 52 arguments, make use of value from command line or parse CMTFLAGS to set 53 strategy accordingly, in configure_home, configure_user_context functions, 54 use value from command line if any, in restore_all_tags function, add tags 55 from CmtContext m_extra_tags, m_tags, m_tags_add vectors, in 56 configure_cmt_message function do not parse command line arguments, parse 57 CMTFLAGS, in do_broadcast function, set error if depth option value cannot 58 be parsed or is out of range (< -1), make use of class Project 59 fill_selection, fill_exclusion functions to implement enhanced handling of 60 special CMTHOME, CMTUSERCONTEXT projects packages (visited if in current 61 project only) and and special depth values (0: CMTUSERCONTEXT project 62 packages only, -1: CMTHOME project packages only), in 63 do_check_configuration function, check tags from CmtContext m_extra_tags, 64 m_tags, m_tags_add vectors, in do_show_clients function do not re-run 65 configure, in guess_current_project function, do not use CmtSystem cd or 66 pwd functions for optimisation, in parse_arguments function do not call 67 restore_all_tags function, in parser function call parse_arguments first 68 and then configure, restore_all_tags to make configuration process cleaner, 69 do not call configure for action_build_temporary_name, in print function do 70 not check tags or change m_extra_tags since that change affects nothing, in 71 use_current_package, use_extra_file functions do not attempt to locate 72 current package if current use located already, factor out 73 Pattern::apply_all_globalsize and Tag::restore_tree calls into separate 74 apply_globals function called after all requirements are read, in 75 use_special_requirements function set special use style, structuring_style, 76 project members if located, otherwise discard, in particular, that means 77 that requirements file in special CMTHOME, CMTUSERCONTEXT projects is not 78 mandatory 79 * source/cmt_symbol.cxx: In class Symbol action function, make 80 constituentsclean symbol private (like constituents) 81 * source/cmt.h: In class CmtContext, add string vector members 82 m_extra_tags, m_tags, m_tags_add, m_tags_remove instead of string 83 m_extra_tags, in class Cmt, function reach_current_package renamed 84 use_current_package, introduce apply_globals function 85 * mgr/fragments/nmake/package: Ensure that not included packages are 86 not visited 87 * mgr/fragments/package: idem 88 * src/Makefile.header: Update help messages for BCAST mode in presence of 89 special CMTHOME, CMTUSERCONTEXT packages/projects 90 1 91 2013-10-04 <rybkin@lal.in2p3.fr> 510 2 92 -
CMT/HEAD/mgr/fragments/nmake/package
r600 r652 1 1 2 cmt_${PACKAGE}_${ISINCLUDED} = 1 2 3 cmt_${PACKAGE}_${ISLOCAL} = 1 3 4 … … 6 7 7 8 !if "$(LOG_LOCATION)" != "" 9 !if "$(cmt_${PACKAGE}_is_included)" != "" 8 10 !if "$(cmt_${PACKAGE}_is_local)" != "" 9 11 ${PACKAGE}OutErr = >>$(LOG_LOCATION)\$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 … … 11 13 !if "$(BCAST_GLOBAL)" != "" 12 14 ${PACKAGE}OutErr = >>$(LOG_LOCATION)\$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 15 !endif 13 16 !endif 14 17 !endif … … 20 23 ${PACKAGE} : $(${PACKAGE}MgrPath)\NMake 21 24 !endif 25 !if "$(cmt_${PACKAGE}_is_included)" != "" 22 26 !if "$(cmt_${PACKAGE}_is_local)" != "" 23 27 @echo "#--------------------------------------------------------------" \ … … 73 77 !endif 74 78 !endif 79 !else 80 81 !endif 75 82 76 83 $(${PACKAGE}MgrPath)\NMake : 84 !if "$(cmt_${PACKAGE}_is_included)" != "" 77 85 !if "$(cmt_${PACKAGE}_is_local)" != "" 78 86 $(echo) configuring ${PACKAGE} … … 85 93 86 94 !endif 95 !endif 96 !else 97 87 98 !endif 88 99 … … 96 107 97 108 ${PACKAGE}clean : $(${PACKAGE}MgrPath)\NMake 109 !if "$(cmt_${PACKAGE}_is_included)" != "" 98 110 !if "$(cmt_${PACKAGE}_is_local)" != "" 99 111 @echo "#--------------------------------------------------------------" \ … … 125 137 !endif 126 138 !endif 139 !else 140 141 !endif 127 142 128 143 ${PACKAGE}binclean : $(${PACKAGE}MgrPath)\NMake 144 !if "$(cmt_${PACKAGE}_is_included)" != "" 129 145 !if "$(cmt_${PACKAGE}_is_local)" != "" 130 146 @echo "#--------------------------------------------------------------" \ … … 156 172 !endif 157 173 !endif 174 !else 175 176 !endif 158 177 159 178 ${PACKAGE}uninstall : $(${PACKAGE}MgrPath)\NMake 179 !if "$(cmt_${PACKAGE}_is_included)" != "" 160 180 !if "$(cmt_${PACKAGE}_is_local)" != "" 161 181 @echo "#--------------------------------------------------------------" \ … … 187 207 !endif 188 208 !endif 209 !else 210 211 !endif 189 212 190 213 ${PACKAGE}check : $(${PACKAGE}MgrPath)\NMake 214 !if "$(cmt_${PACKAGE}_is_included)" != "" 191 215 !if "$(cmt_${PACKAGE}_is_local)" != "" 192 216 @echo "#--------------------------------------------------------------" \ … … 218 242 !endif 219 243 !endif 244 !else 245 246 !endif 220 247 221 248 ${PACKAGE} ${PACKAGE}clean ${PACKAGE}binclean ${PACKAGE}uninstall ${PACKAGE}check : FORCE -
CMT/HEAD/mgr/fragments/package
r600 r652 1 1 2 cmt_${PACKAGE}_${ISINCLUDED} = 1 2 3 cmt_${PACKAGE}_${ISLOCAL} = 1 3 4 … … 6 7 7 8 ifdef LOG_LOCATION 9 ifdef cmt_${PACKAGE}_is_included 8 10 ifdef cmt_${PACKAGE}_is_local 9 11 ${PACKAGE}OutErr = >>$(LOG_LOCATION)/$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 … … 11 13 ifdef BCAST_GLOBAL 12 14 ${PACKAGE}OutErr = >>$(LOG_LOCATION)/$(${PACKAGE}FullName)$(LOG_SUFFIX) 2>&1 15 endif 13 16 endif 14 17 endif … … 20 23 ${PACKAGE} : $(${PACKAGE}MgrPath)/Makefile 21 24 endif 25 ifdef cmt_${PACKAGE}_is_included 22 26 ifdef cmt_${PACKAGE}_is_local 23 27 @echo "#--------------------------------------------------------------" \ … … 67 71 endif 68 72 endif 73 else 74 75 endif 69 76 70 77 $(${PACKAGE}MgrPath)/Makefile : 78 ifdef cmt_${PACKAGE}_is_included 71 79 ifdef cmt_${PACKAGE}_is_local 72 80 $(echo) configuring ${PACKAGE} … … 80 88 endif 81 89 endif 90 else 91 92 endif 82 93 83 94 ifndef BCAST_ONLY … … 90 101 91 102 ${PACKAGE}clean ${PACKAGE}binclean ${PACKAGE}uninstall ${PACKAGE}check : $(${PACKAGE}MgrPath)/Makefile 103 ifdef cmt_${PACKAGE}_is_included 92 104 ifdef cmt_${PACKAGE}_is_local 93 105 @echo "#--------------------------------------------------------------" \ … … 119 131 endif 120 132 endif 133 else 134 135 endif 121 136 122 137 ${PACKAGE} ${PACKAGE}clean ${PACKAGE}binclean ${PACKAGE}uninstall ${PACKAGE}check : FORCE -
CMT/HEAD/source/cmt.h
r612 r652 52 52 cmt_string m_current_version; 53 53 54 cmt_string m_extra_tags; 54 // cmt_string m_extra_tags; 55 CmtSystem::cmt_string_vector m_extra_tags; 56 CmtSystem::cmt_string_vector m_tags; 57 CmtSystem::cmt_string_vector m_tags_add; 58 CmtSystem::cmt_string_vector m_tags_remove; 59 55 60 cmt_string m_configure_error; 56 61 … … 268 273 static void print_tabs (int tabs); 269 274 static void print_xml_prolog (const cmt_string& root = "cmt", ostream& out = cout); 270 static int reach_current_package (); 275 // static int reach_current_package (); 276 static int use_current_package (); 271 277 static int use_extra_file (const cmt_string& file); 278 static int apply_globals (); 272 279 static void restore_all_tags (Use* use); 273 280 static void set_current_access (AccessMode mode); -
CMT/HEAD/source/cmt_commands.cxx
r649 r652 1903 1903 { 1904 1904 cmt.m_disable_warnings = true; 1905 if (CmtMessage::level () <= Warning) 1906 CmtMessage::set_level (Error); 1905 // if (CmtMessage::level () <= Warning) 1906 // CmtMessage::set_level (Error); 1907 if (!Cmt::add_cmt_flag ("-disable_warnings")) 1908 CmtError::set (CmtError::system_error, "Cannot add flag `-disable_warnings'"); 1907 1909 } 1908 1910 … … 1910 1912 { 1911 1913 cmt.m_quiet = true; 1912 if (CmtMessage::level () <= Error) 1913 CmtMessage::set_level (Fatal); 1914 // if (CmtMessage::level () <= Error) 1915 // CmtMessage::set_level (Fatal); 1916 if (!Cmt::add_cmt_flag ("-quiet")) 1917 CmtError::set (CmtError::system_error, "Cannot add flag `-quiet'"); 1914 1918 } 1915 1919 … … 1918 1922 { 1919 1923 cmt.m_warnings = true; 1920 if (CmtMessage::level () != Warning) 1921 CmtMessage::set_level (Warning); 1924 // if (CmtMessage::level () != Warning) 1925 // CmtMessage::set_level (Warning); 1926 if (!Cmt::add_cmt_flag ("-warnings")) 1927 CmtError::set (CmtError::system_error, "Cannot add flag `-warnings'"); 1922 1928 } 1923 1929 … … 1963 1969 if (words.size () > 1) cmt.m_current_version = words[1]; 1964 1970 if (words.size () > 2) cmt.m_current_path = words[2]; 1965 (Use::current()).set (cmt.m_current_package,1966 cmt.m_current_version,1967 cmt.m_current_path);1968 1969 Use& use = Use::current();1970 if (use.get_package_name () == "cmt_standalone")1971 {1972 if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))1973 {1974 CmtError::set (CmtError::package_not_found, use.get_info ());1975 return;1976 }1977 use.style = none_style;1978 use.structuring_style = without_version_directory;1979 use.change_path (CmtSystem::pwd ());1980 }1981 else if (!use.move_to ())1982 {1983 CmtError::set (CmtError::package_not_found, use.get_info ());1984 return;1985 }1986 Project::order_all ();1987 Cmt::guess_current_project ();1988 1971 } 1989 1972 } … … 1998 1981 1999 1982 cmt.m_current_package = arg; 2000 cmt.m_current_version = ""; 2001 2002 /* 2003 cerr << "ArgParser::option_pack> " 2004 << " cp=" << cmt.m_current_package 2005 << " cv=" << cmt.m_current_version 2006 << " cp=" << cmt.m_current_path << endl; 2007 */ 2008 2009 (Use::current()).set (cmt.m_current_package, 2010 cmt.m_current_version, 2011 cmt.m_current_path); 1983 // cmt.m_current_version = ""; 1984 2012 1985 } 2013 1986 } … … 2019 1992 cmt.m_current_access = UserMode; 2020 1993 cmt.m_current_version = arg; 2021 2022 /*2023 cerr << "ArgParser::option_version> "2024 << " cp=" << cmt.m_current_package2025 << " cv=" << cmt.m_current_version2026 << " cp=" << cmt.m_current_path << endl;2027 */2028 2029 (Use::current()).set (cmt.m_current_package,2030 cmt.m_current_version,2031 cmt.m_current_path);2032 1994 } 2033 1995 } … … 2039 2001 cmt.m_current_access = UserMode; 2040 2002 cmt.m_current_path = arg; 2041 2042 /*2043 cerr << "ArgParser::option_path> "2044 << " cp=" << cmt.m_current_package2045 << " cv=" << cmt.m_current_version2046 << " cp=" << cmt.m_current_path << endl;2047 */2048 2049 (Use::current()).set (cmt.m_current_package,2050 cmt.m_current_version,2051 cmt.m_current_path);2052 2053 //IProjectFactory& factory = ProjectFactory::instance ();2054 //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory);2055 Use& use = Use::current();2056 if (use.get_package_name () == "cmt_standalone")2057 {2058 if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))2059 {2060 CmtError::set (CmtError::package_not_found, use.get_info ());2061 return;2062 }2063 use.style = none_style;2064 use.structuring_style = without_version_directory;2065 use.change_path (CmtSystem::pwd ());2066 }2067 else if (!use.move_to ())2068 {2069 CmtError::set (CmtError::package_not_found, use.get_info ());2070 return;2071 }2072 Project::order_all ();2073 Cmt::guess_current_project ();2074 2003 } 2075 2004 } … … 2082 2011 void ArgParser::option_e () 2083 2012 { 2084 //CmtMessage::warning ("extra statement = " + arg);2085 2013 extra_line = arg; 2086 2014 } … … 2101 2029 if (arg != "") 2102 2030 { 2031 cmt.m_tags.clear (); 2032 CmtSystem::cmt_string_vector words; 2033 CmtSystem::split (arg, " \t,", words); 2034 for (int i = 0; i < words.size (); i++) 2035 { 2036 bool has (false); 2037 for (int j = 0; j < cmt.m_tags.size (); j++) 2038 { 2039 if (cmt.m_tags[j] == words[i]) 2040 { 2041 has = true; 2042 break; 2043 } 2044 } 2045 if (!has) 2046 cmt.m_tags.push_back (words[i]); 2047 } 2048 2049 if (cmt.m_tags.size () != 0) 2050 { 2051 cmt.m_extra_tags.clear (); 2052 cmt.m_tags_add.clear (); 2053 cmt.m_tags_remove.clear (); 2054 } 2055 2056 /* 2103 2057 Tag* tag; 2104 2058 CmtSystem::cmt_string_vector words; … … 2154 2108 // To be sure that a tag 2155 2109 Cmt::guess_current_project (); 2110 */ 2156 2111 } 2157 2112 } … … 2159 2114 void ArgParser::option_tag_add () 2160 2115 { 2116 CmtSystem::cmt_string_vector words; 2117 CmtSystem::split (arg, " \t,", words); 2118 for (int i = 0; i < words.size (); i++) 2119 { 2120 bool has (false); 2121 for (int j = 0; j < cmt.m_tags_add.size (); j++) 2122 { 2123 if (cmt.m_tags_add[j] == words[i]) 2124 { 2125 has = true; 2126 break; 2127 } 2128 } 2129 if (!has) 2130 { 2131 cmt.m_tags_add.push_back (words[i]); 2132 } 2133 2134 for (int j = 0; j < cmt.m_tags_remove.size (); j++) 2135 { 2136 if (cmt.m_tags_remove[j] == words[i]) 2137 { 2138 cmt.m_tags_remove.erase(j); 2139 break; 2140 } 2141 } 2142 } 2143 /* 2161 2144 Tag* tag; 2162 2145 CmtSystem::cmt_string_vector words; … … 2191 2174 } 2192 2175 } 2176 */ 2193 2177 } 2194 2178 2195 2179 void ArgParser::option_tag_remove () 2196 2180 { 2181 CmtSystem::cmt_string_vector words; 2182 CmtSystem::split (arg, " \t,", words); 2183 for (int i = 0; i < words.size (); i++) 2184 { 2185 bool has (false); 2186 for (int j = 0; j < cmt.m_tags_remove.size (); j++) 2187 { 2188 if (cmt.m_tags_remove[j] == words[i]) 2189 { 2190 has = true; 2191 break; 2192 } 2193 } 2194 if (!has) 2195 { 2196 cmt.m_tags_remove.push_back (words[i]); 2197 } 2198 2199 for (int j = 0; j < cmt.m_extra_tags.size (); j++) 2200 { 2201 if (cmt.m_extra_tags[j] == words[i]) 2202 { 2203 cmt.m_extra_tags.erase(j); 2204 break; 2205 } 2206 } 2207 for (int j = 0; j < cmt.m_tags.size (); j++) 2208 { 2209 if (cmt.m_tags[j] == words[i]) 2210 { 2211 cmt.m_tags.erase(j); 2212 break; 2213 } 2214 } 2215 for (int j = 0; j < cmt.m_tags_add.size (); j++) 2216 { 2217 if (cmt.m_tags_add[j] == words[i]) 2218 { 2219 cmt.m_tags_add.erase(j); 2220 break; 2221 } 2222 } 2223 } 2224 /* 2197 2225 Tag::TagPtrVector tags = Tag::tags (); 2198 2226 int i; 2199 2227 Tag* tag; 2200 2201 /*2202 for (i = 0; i < tags.size (); i++)2203 {2204 tag = tags[i];2205 if ((tag != 0) &&2206 (tag->selected))2207 {2208 if (!cmt.m_quiet) cerr << " original tag_list=" << tag->name << tag->priority << endl;2209 }2210 }2211 */2212 2228 2213 2229 CmtSystem::cmt_string_vector words; … … 2262 2278 const cmt_string& a = words[i]; 2263 2279 2264 //fprintf (stderr, " a=[%s]\n", a.c_str ());2265 2266 2280 /// Then restore uname if the specified tag is CMTCONFIG 2267 2281 if (a == CmtSystem::get_cmt_config ()) … … 2286 2300 tag->mark ("arguments"); 2287 2301 } 2302 */ 2288 2303 } 2289 2304 … … 2314 2329 cmt.m_current_structuring_style = with_version_directory; 2315 2330 2316 StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); 2317 if (def != 0) 2318 { 2319 def->m_default_value = true; 2320 def->m_priority_value = false; 2321 } 2331 if (!Cmt::add_cmt_flag ("-with_version_directory")) 2332 CmtError::set (CmtError::system_error, "Cannot add flag `-with_version_directory'"); 2333 2322 2334 } 2323 2335 … … 2326 2338 cmt.m_current_structuring_style = without_version_directory; 2327 2339 2328 StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); 2329 if (def != 0) 2330 { 2331 def->m_default_value = false; 2332 def->m_priority_value = true; 2333 } 2340 if (!Cmt::add_cmt_flag ("-without_version_directory")) 2341 CmtError::set (CmtError::system_error, "Cannot add flag `-without_version_directory'"); 2342 2334 2343 } 2335 2344 … … 2401 2410 cout << "# -path=<path> : set root path" << endl; 2402 2411 cout << "# -f=<requirements-file> : set input file" << endl; 2403 cout << "# -e=<statement > : add a one line statement" << endl;2412 cout << "# -e=<statement(s)> : add (multiple) statement(s)" << endl; 2404 2413 cout << "# -tag=<tag-list> : select a new tag-set" << endl; 2405 2414 cout << "# -tag_add=<tag-list> : add specific comma-separated tag(s)" << endl; … … 2411 2420 cout << "# -no_cleanup : inhibit install area cleanup" << endl; 2412 2421 cout << "# -xml : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl; 2422 cout << "# -user_context=<path> : set user context package/project directory" << endl; 2423 cout << "# -home=<path> : set home package/project directory" << endl; 2413 2424 } 2414 2425 -
CMT/HEAD/source/cmt_generators.cxx
r628 r652 2841 2841 m_PACKAGEFULLNAME.set ("PACKAGEFULLNAME"); 2842 2842 m_ISLOCAL.set ("ISLOCAL"); 2843 m_ISINCLUDED.set ("ISINCLUDED"); 2843 2844 2844 2845 packages_header_fragment.set ("packages_header"); … … 2854 2855 m_PACKAGEFULLNAME = ""; 2855 2856 m_ISLOCAL = ""; 2857 m_ISINCLUDED = ""; 2856 2858 2857 2859 packages_header_fragment.reset (); … … 2899 2901 if (!packages_header_fragment.copy (m_output_file, 1, &m_PACKAGE)) return; 2900 2902 2901 Project* cur = Project::get_current ();2903 const Project* p_cur (Project::get_current ()); 2902 2904 Use::UsePtrVector uses (Use::get_ordered_uses ()); 2903 2905 uses.push_back (&Use::current ()); 2906 2907 Project::ConstProjectPtrVector path_exclusions; 2908 Project::fill_exclusion (path_exclusions); 2909 2904 2910 cmt_string temp; 2905 2911 for (int i = uses.size () - 1; i >= 0; i--) 2906 2912 { 2907 2913 Use* use = uses[i]; 2914 2908 2915 if (use->discarded) continue; 2909 2916 if (use->m_hidden) continue; … … 2911 2918 if (use->get_package ()->is_cmt ()) continue; 2912 2919 2913 if (use->get_project () == cur) 2914 m_ISLOCAL = "is_local"; 2915 else 2916 m_ISLOCAL = "is_not_local"; 2920 const Project* up = use->get_project (); 2921 2922 m_ISLOCAL = "is_not_local"; 2923 if (p_cur) 2924 { 2925 if (up) 2926 { 2927 if (up == p_cur) 2928 { 2929 m_ISLOCAL = "is_local"; 2930 } 2931 } 2932 else 2933 { 2934 if (use->get_realpath ().find (p_cur->get_cmtpath_real ()) == 0) 2935 { 2936 m_ISLOCAL = "is_local"; 2937 } 2938 } 2939 } 2940 else if (use == &Use::current ()) 2941 { 2942 m_ISLOCAL = "is_local"; 2943 } 2944 2945 m_ISINCLUDED = "is_included"; 2946 for (int j = 0; j < path_exclusions.size (); j++) 2947 { 2948 const Project* sp = path_exclusions[j]; 2949 if (up) 2950 { 2951 if (up == sp) 2952 { 2953 m_ISINCLUDED = "is_not_included"; 2954 } 2955 } 2956 else 2957 { 2958 if (use->get_realpath ().find (sp->get_cmtpath_real ()) == 0) 2959 { 2960 m_ISINCLUDED = "is_not_included"; 2961 } 2962 } 2963 } 2917 2964 2918 2965 temp = use->get_full_path (); … … 2927 2974 temp += "mgr"; 2928 2975 break; 2976 default: 2977 break; 2929 2978 } 2930 2979 #ifdef WIN32 … … 2932 2981 #endif 2933 2982 m_PACKAGEMGRPATH = temp; 2934 // fprintf (m_output_file, "%s\n", temp.c_str());2935 2983 2936 2984 temp = ""; … … 2956 3004 #endif 2957 3005 m_PACKAGEFULLNAME = temp; 2958 // fprintf (m_output_file, "%s\n", temp.c_str());2959 3006 2960 3007 m_PACKAGE = use->get_package_name (); … … 2991 3038 } 2992 3039 2993 if (!package_fragment.copy (m_output_file, 6,3040 if (!package_fragment.copy (m_output_file, 7, 2994 3041 &m_PACKAGE, &m_PACKAGEPREFIX, 2995 3042 &m_DEPENDENCIES, 2996 3043 &m_PACKAGEMGRPATH, &m_PACKAGEFULLNAME, 2997 &m_ISLOCAL )) return;3044 &m_ISLOCAL, &m_ISINCLUDED)) return; 2998 3045 } 2999 3046 … … 3016 3063 3017 3064 CmtSystem::close_ostream (m_output_file, new_file_name); 3018 // fclose (m_output_file);3019 3065 3020 3066 commit (new_file_name); -
CMT/HEAD/source/cmt_generators.h
r628 r652 239 239 Variable m_PACKAGEFULLNAME; 240 240 Variable m_ISLOCAL; 241 Variable m_ISINCLUDED; 241 242 242 243 FragmentHandle packages_header_fragment; -
CMT/HEAD/source/cmt_parser.cxx
r649 r652 10 10 #include <string.h> 11 11 #include <ctype.h> 12 #include <errno.h> 12 13 13 14 //---------------------------------------------------------- … … 48 49 { 49 50 clear (); 51 52 cmt_string tags = CmtSystem::getenv ("CMTEXTRATAGS"); 53 CmtSystem::cmt_string_vector words; 54 CmtSystem::split (tags, " \t,", words); 55 for (int i = 0; i < words.size (); i++) 56 { 57 bool has (false); 58 for (int j = 0; j < m_extra_tags.size (); j++) 59 { 60 if (m_extra_tags[j] == words[i]) 61 { 62 has = true; 63 break; 64 } 65 } 66 if (!has) 67 m_extra_tags.push_back (words[i]); 68 } 50 69 } 51 70 … … 59 78 m_build_nmake = false; 60 79 m_cmt_config = ""; 61 //m_cmt_path.clear ();62 //m_cmt_path_pwds.clear ();63 //m_cmt_path_sources.clear ();64 80 m_cmt_root = ""; 81 m_cmt_home = ""; 82 m_cmt_user_context = ""; 83 m_cmt_site = ""; 65 84 m_cmt_version = ""; 66 85 m_use_cmt = true; 86 67 87 m_current_dir = ""; 68 88 m_current_file_path = ""; … … 74 94 m_current_offset = ""; 75 95 76 m_current_access = DeveloperMode; 96 m_current_access = UserMode; 97 m_current_style = cmt_style; 98 m_current_structuring_style = default_structuring_style; 77 99 78 100 m_current_tag = ""; 79 101 m_current_target = ""; 80 102 m_current_version = ""; 103 104 // m_extra_tags = ""; 105 m_extra_tags.clear (); 106 m_tags.clear (); 107 m_tags_add.clear (); 108 m_tags_remove.clear (); 109 110 m_configure_error = ""; 111 112 m_debug = (::getenv ("CMTDEBUG") != 0) ? true : false; 113 81 114 m_default_path = ""; 82 83 //m_quiet = false; 84 115 m_quiet = false; 85 116 m_disable_warnings = false; 86 117 m_warnings = false; … … 91 122 92 123 m_standard_macros_done = false; 93 m_current_access = UserMode;94 m_current_style = cmt_style;95 m_current_structuring_style = default_structuring_style;96 124 m_all_sets_done = false; 125 97 126 m_autoconfigure_cmtpath = false; 98 m_debug = false;99 if (getenv ("CMTDEBUG") != 0) m_debug = true;100 127 } 101 128 … … 497 524 void Cmt::clear () 498 525 { 499 Me.m_quiet = false;500 526 Me.clear (); 527 //Me.m_quiet = false; 501 528 502 529 Database::clear (); … … 515 542 if (configured) return; 516 543 517 Me.clear ();544 // Me.clear (); 518 545 519 546 log << "configure_cmt_message" << log_endl; … … 533 560 log << "configure_site_tag" << log_endl; 534 561 configure_site_tag (0); 562 563 if (Me.m_current_package.size () != 0 && 564 Me.m_current_package != "cmt_standalone") 565 { // we have a package name (not "cmt_standalone") 566 Use& use = Use::current(); 567 use.set (Me.m_current_package, 568 Me.m_current_version, 569 Me.m_current_path); 570 if (CmtSystem::absolute_path (Me.m_current_path)) 571 { 572 if (!use.move_to ()) 573 { 574 CmtError::set (CmtError::package_not_found, use.get_info ()); 575 return; 576 } 577 } 578 else 579 { 580 if (!use.move_to ("", true)) 581 { 582 // will try again later from CMTPATH entries 583 } 584 } 585 } 586 else 587 { 588 if (Me.m_current_path.size () != 0 && 589 !CmtSystem::cd (Me.m_current_path)) 590 { 591 CmtError::set (CmtError::path_not_found, Me.m_current_path); 592 return; 593 } 594 } 595 535 596 log << "configure_current_dir" << log_endl; 536 597 configure_current_dir (); … … 540 601 // log << "configure_current_dir" << log_endl; 541 602 542 543 603 bool save_quiet = Me.m_quiet; 544 604 Me.m_quiet = true; … … 554 614 guess_current_project (); 555 615 616 if (Me.m_current_package.size () != 0 && 617 Me.m_current_package != "cmt_standalone") 618 { 619 Use& use = Use::current(); 620 if (!use.located ()) 621 { 622 if (!use.move_to ()) 623 { 624 CmtError::set (CmtError::package_not_found, use.get_info ()); 625 return; 626 } 627 else 628 { 629 use.get_full_path (Me.m_current_dir); 630 switch (use.style) 631 { 632 case cmt_style: 633 Me.m_current_dir += CmtSystem::file_separator (); 634 Me.m_current_dir += "cmt"; 635 break; 636 case mgr_style: 637 Me.m_current_dir += CmtSystem::file_separator (); 638 Me.m_current_dir += "mgr"; 639 break; 640 default: 641 break; 642 } 643 Me.m_current_file_path = Me.m_current_dir; 644 645 Project::order_all (); 646 Cmt::guess_current_project (); 647 } 648 } 649 } 650 556 651 log << "configure_current_structuring_style" << log_endl; 557 652 // configure_current_structuring_style (); … … 562 657 563 658 Use& use = Use::current(); 564 565 use.set (Me.m_current_package, 566 Me.m_current_version, 567 Me.m_current_path, 568 "", 569 ""); 570 571 use.style = Me.m_current_style; 572 use.structuring_style = Me.m_current_structuring_style; 573 574 use.change_path (Me.m_current_path); 659 if (!use.located ()) 660 { 661 use.set (Me.m_current_package, 662 Me.m_current_version, 663 Me.m_current_path); 664 use.style = Me.m_current_style; 665 666 if (use.style != none_style) 667 { 668 use.structuring_style = Me.m_current_structuring_style; 669 use.change_path (Me.m_current_path, Project::get_current ()); 670 } 671 else 672 { 673 use.real_path = Me.m_current_path; 674 } 675 } 676 else if (const Project * p = Project::get_current ()) 677 { 678 use.set_project (p); 679 } 575 680 576 681 if (CmtError::has_pending_error ()) … … 621 726 { 622 727 Use& current_use = Use::current (); 623 728 current_use.get_cmtpath_and_offset (Me.m_current_cmtpath, Me.m_current_offset); 729 /* 624 730 Me.m_current_cmtpath = ""; 625 731 Me.m_current_offset = ""; … … 633 739 634 740 Me.m_current_offset = current_use.path; 635 741 */ 636 742 /** 637 743 try to remove this current CMTPATH entry from path. This … … 639 745 absolute path. 640 746 */ 641 747 /* 642 748 Me.m_current_offset.replace (Me.m_current_cmtpath, empty_string); 643 749 if (Me.m_current_offset[0] == CmtSystem::file_separator ()) … … 648 754 } 649 755 } 756 */ 650 757 } 651 758 … … 788 895 Me.m_current_file_path = mount_filter.get_current_dir (); 789 896 790 cmt_string t = Me.m_current_file_path;897 // cmt_string t = Me.m_current_file_path; 791 898 } 792 899 … … 800 907 standard directory tree (i.e. <package>/<version>/cmt or mgr) 801 908 */ 909 Use& use = Use::current(); 910 if (use.located ()) 911 { 912 Me.m_current_style = use.style; 913 build_prefix (Me.m_current_package, Me.m_current_prefix); 914 build_config (Me.m_current_prefix, Me.m_current_config); 915 return; 916 } 802 917 803 918 cmt_string req = ".."; … … 1062 1177 // Do NOT (re)set m_current_structuring_style yet 1063 1178 // (as requirements may NOT exist, so this is not a package) 1064 // rather do it in reach_current_package (if/when requirements is read)1179 // rather do it in use_current_package (if/when requirements is read) 1065 1180 //Me.m_current_structuring_style = without_version_directory; 1066 1181 build_prefix (Me.m_current_package, Me.m_current_prefix); … … 1074 1189 { 1075 1190 cmt_string s; 1076 s = CmtSystem::getenv ("CMTSTRUCTURINGSTYLE"); 1077 if (s == "without_version_directory") 1078 { 1079 Me.m_current_structuring_style = without_version_directory; 1080 } 1081 else if (s == "with_version_directory") 1082 { 1083 Me.m_current_structuring_style = with_version_directory; 1084 } 1085 1086 CmtSystem::cmt_string_vector flags; 1087 Cmt::get_cmt_flags (flags); 1088 for (int i = 0; i < flags.size (); i++) 1089 { 1090 const cmt_string& flag = flags[i]; 1091 if (flag == "-without_version_directory") 1191 if (Me.m_current_structuring_style == default_structuring_style) 1192 { 1193 s = CmtSystem::getenv ("CMTSTRUCTURINGSTYLE"); 1194 if (s == "without_version_directory") 1092 1195 { 1093 1196 Me.m_current_structuring_style = without_version_directory; 1094 1197 } 1095 else if ( flag == "-with_version_directory")1198 else if (s == "with_version_directory") 1096 1199 { 1097 1200 Me.m_current_structuring_style = with_version_directory; 1098 } 1099 } 1100 1101 for (int i = 1; i < ap.argc; i++) 1102 { 1103 const cmt_string& arg = ap.argv[i]; 1104 if (arg[0] != '-') break; 1105 if (arg == "-without_v" || 1106 arg == "-without_ve" || 1107 arg == "-without_ver" || 1108 arg == "-without_vers" || 1109 arg == "-without_versi" || 1110 arg == "-without_versio" || 1111 arg == "-without_version" || 1112 arg == "-without_version_" || 1113 arg == "-without_version_d" || 1114 arg == "-without_version_di" || 1115 arg == "-without_version_dir" || 1116 arg == "-without_version_dire" || 1117 arg == "-without_version_direc" || 1118 arg == "-without_version_direct" || 1119 arg == "-without_version_directo" || 1120 arg == "-without_version_director" || 1121 arg == "-without_version_directory") 1122 { 1123 Me.m_current_structuring_style = without_version_directory; 1124 // if (!CmtSystem::putenv ("CMTSTRUCTURINGSTYLE", "without_version_directory")) 1125 // CmtMessage::error ("Cannot set `CMTSTRUCTURINGSTYLE' to" 1126 // " `without_version_directory' in the environment"); 1127 if (!Cmt::add_cmt_flag ("-without_version_directory")) 1128 CmtMessage::error ("Cannot add flag `-without_version_directory'"); 1129 } 1130 else if (arg == "-with_v" || 1131 arg == "-with_ve" || 1132 arg == "-with_ver" || 1133 arg == "-with_vers" || 1134 arg == "-with_versi" || 1135 arg == "-with_versio" || 1136 arg == "-with_version" || 1137 arg == "-with_version_" || 1138 arg == "-with_version_d" || 1139 arg == "-with_version_di" || 1140 arg == "-with_version_dir" || 1141 arg == "-with_version_dire" || 1142 arg == "-with_version_direc" || 1143 arg == "-with_version_direct" || 1144 arg == "-with_version_directo" || 1145 arg == "-with_version_director" || 1146 arg == "-with_version_directory") 1147 { 1148 Me.m_current_structuring_style = with_version_directory; 1149 // if (!CmtSystem::putenv ("CMTSTRUCTURINGSTYLE", "with_version_directory")) 1150 // CmtMessage::error ("Cannot set `CMTSTRUCTURINGSTYLE' to" 1151 // " `with_version_directory' in the environment"); 1152 if (!Cmt::add_cmt_flag ("-with_version_directory")) 1153 CmtMessage::error ("Cannot add flag `-with_version_directory'"); 1201 } 1202 1203 CmtSystem::cmt_string_vector flags; 1204 Cmt::get_cmt_flags (flags); 1205 for (int i = 0; i < flags.size (); i++) 1206 { 1207 const cmt_string& flag = flags[i]; 1208 if (flag == "-without_version_directory") 1209 { 1210 Me.m_current_structuring_style = without_version_directory; 1211 } 1212 else if (flag == "-with_version_directory") 1213 { 1214 Me.m_current_structuring_style = with_version_directory; 1215 } 1216 } 1217 } 1218 1219 if (Me.m_current_structuring_style != default_structuring_style) 1220 { 1221 StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); 1222 if (def != 0) 1223 { 1224 def->m_default_value = 1225 Me.m_current_structuring_style == with_version_directory; 1226 def->m_priority_value = 1227 Me.m_current_structuring_style == without_version_directory; 1154 1228 } 1155 1229 } … … 1171 1245 void Cmt::configure_home (Use* use) 1172 1246 { 1173 Me.m_cmt_home = ""; 1174 1175 Symbol* symbol = Symbol::find ("CMTHOME"); 1176 if (symbol != 0) 1177 { 1178 Me.m_cmt_home = symbol->build_macro_value (); 1179 Symbol::expand (Me.m_cmt_home); 1180 } 1181 else if (CmtSystem::testenv ("CMTHOME")) 1182 { 1183 Me.m_cmt_home = CmtSystem::getenv ("CMTHOME"); 1247 if (Me.m_cmt_home.size () == 0) 1248 { 1249 // if not passed on the command line 1250 if (const Symbol* symbol = Symbol::find ("CMTHOME")) 1251 { 1252 Me.m_cmt_home = symbol->build_macro_value (); 1253 Symbol::expand (Me.m_cmt_home); 1254 } 1255 else if (CmtSystem::testenv ("CMTHOME")) 1256 { 1257 Me.m_cmt_home = CmtSystem::getenv ("CMTHOME"); 1258 } 1184 1259 } 1185 1260 … … 1195 1270 void Cmt::configure_user_context (Use* use) 1196 1271 { 1197 Me.m_cmt_user_context = ""; 1198 1199 Symbol* symbol = Symbol::find ("CMTUSERCONTEXT"); 1200 if (symbol != 0) 1201 { 1202 Me.m_cmt_user_context = symbol->build_macro_value (); 1203 Symbol::expand (Me.m_cmt_user_context); 1204 } 1205 else if (CmtSystem::testenv ("CMTUSERCONTEXT")) 1206 { 1207 Me.m_cmt_user_context = CmtSystem::getenv ("CMTUSERCONTEXT"); 1272 if (Me.m_cmt_user_context.size () == 0) 1273 { 1274 // if not passed on the command line 1275 if (const Symbol* symbol = Symbol::find ("CMTUSERCONTEXT")) 1276 { 1277 Me.m_cmt_user_context = symbol->build_macro_value (); 1278 Symbol::expand (Me.m_cmt_user_context); 1279 } 1280 else if (CmtSystem::testenv ("CMTUSERCONTEXT")) 1281 { 1282 Me.m_cmt_user_context = CmtSystem::getenv ("CMTUSERCONTEXT"); 1283 } 1208 1284 } 1209 1285 … … 1272 1348 1273 1349 Cmt::configure_tags (use); 1350 1351 cmt_string s, t; 1352 if (0 < Me.m_extra_tags.size ()) 1353 { 1354 s = "CMTEXTRATAGS"; 1355 t = use != 0 ? use->get_package_name () : s; 1356 } 1357 for (int i = 0; i < Me.m_extra_tags.size (); i++) 1358 { 1359 Tag* tag = Tag::add (Me.m_extra_tags[i], PriorityUserTag, s, use); 1360 tag->mark (t); 1361 } 1362 1363 for (int i = 0; i < Me.m_tags.size (); i++) 1364 { 1365 const cmt_string& a = Me.m_tags[i]; 1366 if (i == 0) 1367 { 1368 Me.m_current_tag = a; 1369 } 1370 // // Then restore uname if the specified tag is CMTCONFIG 1371 // if (a == CmtSystem::get_cmt_config ()) 1372 // { 1373 // Cmt::configure_uname_tag (); 1374 // } 1375 Tag* tag = Tag::add (a, PriorityArgument, "arguments", 0); 1376 tag->mark ("arguments"); 1377 } 1378 1379 for (int i = 0; i < Me.m_tags_add.size (); i++) 1380 { 1381 const cmt_string& a = Me.m_tags_add[i]; 1382 // // Then restore uname if the specified tag is CMTCONFIG 1383 // if (a == CmtSystem::get_cmt_config ()) 1384 // { 1385 // Cmt::configure_uname_tag (); 1386 // } 1387 Tag* tag = Tag::add (a, PriorityUserTag, "arguments", 0); 1388 tag->mark ("arguments"); 1389 } 1274 1390 1275 1391 /* … … 1277 1393 */ 1278 1394 1395 /* 1279 1396 if (CmtSystem::testenv ("CMTEXTRATAGS")) 1280 1397 { … … 1309 1426 } 1310 1427 } 1428 */ 1311 1429 } 1312 1430 … … 1319 1437 1320 1438 log << "current_tag=" << Me.m_current_tag << log_endl; 1439 1440 cmt_string s = "CMTCONFIG"; 1321 1441 1322 1442 Symbol* symbol = Symbol::find ("CMTCONFIG"); … … 1347 1467 { 1348 1468 config_tag = CmtSystem::getenv ("CMTBIN"); 1469 s = "CMTBIN"; 1349 1470 } 1350 1471 … … 1352 1473 { 1353 1474 CmtSystem::get_uname (config_tag); 1475 s = "uname"; 1354 1476 } 1355 1477 1356 1478 log << "current_tag=" << Me.m_current_tag << log_endl; 1357 1479 1358 cmt_string s = "CMTCONFIG";1480 // cmt_string s = "CMTCONFIG"; 1359 1481 cmt_string t = s; 1360 1482 … … 1552 1674 if (CmtMessage::level () != Warning) 1553 1675 CmtMessage::set_level (Warning); 1554 // if (CmtMessage::level () > Warning)1555 }1556 }1557 1558 for (int i = 1; i < ap.argc; i++)1559 {1560 const cmt_string& arg = ap.argv[i];1561 if (arg[0] != '-') break;1562 if (arg == "-d" ||1563 arg == "-di" ||1564 arg == "-dis" ||1565 arg == "-disa" ||1566 arg == "-disab" ||1567 arg == "-disabl" ||1568 arg == "-disable" ||1569 arg == "-disable_" ||1570 arg == "-disable_w" ||1571 arg == "-disable_wa" ||1572 arg == "-disable_war" ||1573 arg == "-disable_warn" ||1574 arg == "-disable_warni" ||1575 arg == "-disable_warnin" ||1576 arg == "-disable_warning" ||1577 arg == "-disable_warnings")1578 {1579 Me.m_disable_warnings = true;1580 if (CmtMessage::level () <= Warning)1581 {1582 CmtMessage::set_level (Error);1583 // if (!CmtSystem::putenv ("CMTERROR", "1"))1584 // CmtMessage::error ("Cannot set `CMTERROR' in the environment");1585 }1586 if (!Cmt::add_cmt_flag ("-disable_warnings"))1587 CmtMessage::error ("Cannot add flag `-disable_warnings'");1588 }1589 else if (arg == "-q" ||1590 arg == "-qu" ||1591 arg == "-qui" ||1592 arg == "-quie" ||1593 arg == "-quiet")1594 {1595 Me.m_quiet = true;1596 if (CmtMessage::level () <= Error)1597 {1598 CmtMessage::set_level (Fatal);1599 // if (!CmtSystem::putenv ("CMTFATAL", "1"))1600 // CmtMessage::error ("Cannot set `CMTFATAL' in the environment");1601 }1602 if (!Cmt::add_cmt_flag ("-quiet"))1603 CmtMessage::error ("Cannot add flag `-quiet'");1604 }1605 else if (arg == "-warn" ||1606 arg == "-warni" ||1607 arg == "-warnin" ||1608 arg == "-warning" ||1609 arg == "-warnings")1610 {1611 Me.m_warnings = true;1612 // if (CmtMessage::level () > Warning)1613 if (CmtMessage::level () != Warning)1614 {1615 CmtMessage::set_level (Warning);1616 // if (!CmtSystem::putenv ("CMTWARNING", "1"))1617 // CmtMessage::error ("Cannot set `CMTWARNING' in the environment");1618 }1619 if (!Cmt::add_cmt_flag ("-warnings"))1620 CmtMessage::error ("Cannot add flag `-warnings'");1621 1676 } 1622 1677 } … … 1668 1723 1669 1724 CmtSystem::cmt_string_vector uses; 1725 cmt_vector<int> use_indexes; 1670 1726 CmtSystem::cmt_string_vector packages; 1671 1727 CmtSystem::cmt_string_vector versions; 1672 CmtSystem::cmt_string_vector path_selections; 1728 Project::ConstProjectPtrVector path_selections; 1729 // CmtSystem::cmt_string_vector path_selections; 1730 Project::ConstProjectPtrVector path_exclusions; 1673 1731 CmtSystem::cmt_string_vector selections; 1674 1732 CmtSystem::cmt_string_vector exclusions; … … 1677 1735 bool is_cmt = false; 1678 1736 int first = 0; 1679 int i;1680 1737 bool ignore_errors = false; 1681 1738 bool all_packages = false; 1682 1739 int depth (1); 1683 1740 bool local = true; 1684 1685 for (i = 0; i < ap.arguments.size (); i++) 1741 bool global (false); 1742 1743 for (int i = 0; i < ap.arguments.size (); i++) 1686 1744 { 1687 1745 const cmt_string& w = ap.arguments[i]; … … 1699 1757 { 1700 1758 local = false; 1759 global = false; 1701 1760 1702 1761 cmt_string depth_str; 1703 int depth_value = 0;1762 int depth_value; 1704 1763 1705 1764 w.substr (7, depth_str); 1706 if ((sscanf (depth_str.c_str (), "%d", &depth_value) < 1) || 1707 (depth_value < 1)) 1708 { 1765 int n = sscanf (depth_str.c_str (), "%d", &depth_value); 1766 cmt_string msg; 1767 switch (n) 1768 { 1769 case EOF: 1770 msg = "Cannot read `depth' value `"; 1771 msg += depth_str; 1772 msg += cmt_string ("'"); 1773 if (errno) 1774 msg += cmt_string (strerror (errno)); 1775 CmtError::set (CmtError::system_error, msg); 1776 return; 1777 break; 1778 case 0: 1779 msg = "Invalid `depth' value `"; 1780 msg += depth_str; 1781 msg += cmt_string ("'"); 1782 CmtError::set (CmtError::syntax_error, msg); 1783 return; 1784 break; 1785 case 1: 1786 if (depth_value < -1) 1787 { 1788 char num[32]; sprintf (num, "%lu", -depth_value); 1789 msg = "Invalid `depth' value `-"; 1790 msg += num; 1791 msg += cmt_string ("'"); 1792 CmtError::set (CmtError::syntax_error, msg); 1793 return; 1794 } 1795 depth = depth_value; 1796 //cerr << "depth: " << depth << endl; 1797 break; 1798 default: 1799 break; 1800 } 1801 // if ((sscanf (depth_str.c_str (), "%d", &depth_value) < 1) || 1802 // (depth_value < 1)) 1803 // { 1709 1804 // Syntax error 1710 1805 // We shall restrict to packages found within … … 1712 1807 // If CMTPATH is empty, nothing is selected. 1713 1808 // depth=1 is equivalent to local 1714 }1715 1716 Project::fill_selection (depth_value, path_selections);1809 // } 1810 1811 // Project::fill_selection (depth_value, path_selections); 1717 1812 } 1718 1813 else if (w.substr (0, 9) == "-exclude=") … … 1738 1833 else if (w.substr (0, 7) == "-global") 1739 1834 { 1740 path_selections.clear ();1741 1835 //path_selections.clear (); 1836 global = true; 1742 1837 local = false; 1743 1838 } … … 1745 1840 { 1746 1841 local = true; 1842 global = false; 1747 1843 } 1748 1844 else if (w.substr (0, 8) == "-select=") … … 1787 1883 } 1788 1884 1789 if (local) 1790 { 1791 Project::fill_selection (1, path_selections); 1885 const Project* p_cur (Project::get_current ()); 1886 if (global) 1887 { 1888 Project::fill_exclusion (path_exclusions); 1889 } 1890 else if (local) 1891 { 1892 if (p_cur) 1893 Project::fill_selection (1, path_selections); 1894 else 1895 path_selections.push_back (0); // means that we want Use::current () 1896 // path_selections.push_back ((Use::current ()).get_realpath ()); 1897 } 1898 else 1899 { 1900 if (!p_cur 1901 && depth != 0 1902 && depth != -1) 1903 path_selections.push_back (0); // means that we want Use::current () 1904 // path_selections.push_back ((Use::current ()).get_realpath ()); 1905 Project::fill_selection (depth, path_selections); 1906 /* 1907 cerr << "depth: " << depth << endl; 1908 for (int j = 0; j < path_selections.size (); j++) 1909 { 1910 const Project* sp = path_selections[j]; 1911 cerr << "path_selections: " << (sp ? sp->get_cmtpath () : "current use") << endl; 1912 } 1913 */ 1792 1914 } 1793 1915 … … 1800 1922 //if (command.substr (0, 3) == "cmt") is_cmt = true; 1801 1923 1802 cmt_string curuse = CmtSystem::pwd ();1924 //cmt_string curuse = CmtSystem::pwd (); 1803 1925 if (all_packages) 1804 1926 { … … 1806 1928 PathScanner scanner; 1807 1929 Project::scan_paths (scanner, selector); 1930 return; 1808 1931 } 1809 1932 else 1810 1933 { 1811 for (i = Uses.size () - 1; i >= 0; i--)1934 for (int i = Uses.size () - 1; i >= 0; i--) 1812 1935 { 1813 1936 Use* use = Uses[i]; … … 1815 1938 if (use->discarded) continue; 1816 1939 if (use->m_hidden) continue; 1817 1818 1940 if (!use->located ()) 1819 1941 { 1820 CmtMessage::warning ("package " + use->get_package_name () 1821 + " " + use->version + " " + use->path 1822 + " not found"); 1823 /* 1824 if (!Me.m_quiet) 1825 { 1826 cerr << "#CMT> package " << use->get_package_name () << 1827 " " << use->version << " " << use->path << 1828 " not found" << 1829 endl; 1830 } 1831 */ 1942 CmtMessage::warning 1943 (CmtError::get_error_name (CmtError::package_not_found) 1944 + ": " + use->get_info ()); 1945 continue; 1832 1946 } 1833 else 1834 { 1835 if (use->get_package_name () != "CMT") 1836 { 1837 cmt_string& s = uses.add (); 1838 1839 use->get_full_path (s); 1840 1841 s += CmtSystem::file_separator (); 1842 if (use->style == mgr_style) s += "mgr"; 1843 else s += "cmt"; 1844 1845 cmt_string& v = versions.add (); 1846 v = use->version; 1847 1848 cmt_string& p = packages.add (); 1849 p = use->get_package_name (); 1850 } 1851 } 1852 } 1947 if (use->get_package_name () == "CMT") continue; 1948 1949 cmt_string& s = uses.add (); 1950 use->get_full_path (s); 1951 switch (use->style) 1952 { 1953 case cmt_style: 1954 s += CmtSystem::file_separator (); 1955 s += "cmt"; 1956 break; 1957 case mgr_style: 1958 s += CmtSystem::file_separator (); 1959 s += "mgr"; 1960 break; 1961 default: 1962 break; 1963 } 1964 // if (use->style == mgr_style) s += "mgr"; 1965 // else s += "cmt"; 1966 1967 cmt_string& v = versions.add (); 1968 v = use->version; 1969 1970 cmt_string& p = packages.add (); 1971 p = use->get_package_name (); 1972 1973 int& use_index = use_indexes.add (); 1974 use_index = i; 1975 } 1853 1976 1854 1977 { 1978 Use* use = &(Use::current ()); 1979 1855 1980 cmt_string& s = uses.add (); 1981 use->get_full_path (s); 1982 switch (use->style) 1983 { 1984 case cmt_style: 1985 s += CmtSystem::file_separator (); 1986 s += "cmt"; 1987 break; 1988 case mgr_style: 1989 s += CmtSystem::file_separator (); 1990 s += "mgr"; 1991 break; 1992 default: 1993 break; 1994 } 1995 // if (use->get_package_name ().find ("cmt_standalone") != cmt_string::npos) 1996 // { 1997 // s = CmtSystem::pwd (); 1998 // } 1999 // else 2000 // { 2001 // use->get_full_path (s); 2002 2003 // s += CmtSystem::file_separator (); 1856 2004 1857 Use* use = &(Use::current ()); 1858 1859 if (use->get_package_name ().find ("cmt_standalone") != cmt_string::npos) 1860 { 1861 s = CmtSystem::pwd (); 1862 } 1863 else 1864 { 1865 use->get_full_path (s); 1866 1867 s += CmtSystem::file_separator (); 1868 1869 if (use->style == mgr_style) s += "mgr"; 1870 else s += "cmt"; 1871 } 1872 1873 curuse = s; 2005 // if (use->style == mgr_style) s += "mgr"; 2006 // else s += "cmt"; 2007 // } 2008 //curuse = s; 1874 2009 1875 2010 cmt_string& v = versions.add (); … … 1878 2013 cmt_string& p = packages.add (); 1879 2014 p = use->get_package_name (); 2015 2016 int& use_index = use_indexes.add (); 2017 use_index = -1; 1880 2018 } 1881 2019 } … … 1891 2029 CmtSystem::putenv ("CMTBCAST", ""); 1892 2030 1893 for (i = 0; i < uses.size (); i++)2031 for (int i = 0; i < uses.size (); i++) 1894 2032 { 1895 2033 const cmt_string& s = uses[i]; 1896 2034 const cmt_string& v = versions[i]; 1897 2035 const cmt_string& p = packages[i]; 2036 const int use_index = use_indexes[i]; 2037 2038 const Use* use = use_index >= 0 ? Uses[use_index] : &(Use::current ()); 2039 const Project* up = use->get_project (); 2040 1898 2041 cmt_string cmtpath; 1899 2042 1900 2043 bool ok = true; 1901 bool selected = true;2044 bool selected = global ? true : false; 1902 2045 bool excluded = false; 1903 2046 1904 /** 1905 Ensure that the current package is not skipped 1906 due to symlinks in the paths 1907 */ 1908 // if (path_selections.size () > 0) 1909 if (path_selections.size () > 0 && s != curuse) 2047 ok = selected; 2048 if (path_selections.size () > 0) 1910 2049 { 1911 2050 selected = false; 1912 1913 2051 for (int j = 0; j < path_selections.size (); j++) 1914 2052 { 1915 const cmt_string& sel = path_selections[j]; 1916 1917 if (s.find (sel) != cmt_string::npos) 1918 { 1919 cmtpath = sel; 1920 selected = true; 1921 break; 1922 } 1923 } 1924 2053 const Project* sp = path_selections[j]; 2054 if (sp) 2055 { 2056 if (up) 2057 { 2058 if (up == sp) 2059 { 2060 cmtpath = sp->get_cmtpath (); 2061 selected = true; 2062 break; 2063 } 2064 } 2065 else 2066 { 2067 if (use->get_realpath ().find (sp->get_cmtpath_real ()) == 0) 2068 { 2069 cmtpath = sp->get_cmtpath (); 2070 selected = true; 2071 break; 2072 } 2073 } 2074 } 2075 else if (use == &(Use::current ())) 2076 { 2077 // means that we want Use::current () 2078 // cmtpath = sp->get_cmtpath (); 2079 if (up) 2080 cmtpath = up->get_cmtpath (); 2081 else 2082 cmtpath = ""; 2083 selected = true; 2084 break; 2085 } 2086 // const cmt_string& sel = path_selections[j]; 2087 // if (s.find (sel) != cmt_string::npos) 2088 // { 2089 // cmtpath = sel; 2090 // selected = true; 2091 // break; 2092 // } 2093 } 1925 2094 ok = selected; 1926 2095 } … … 1960 2129 } 1961 2130 1962 1963 2131 if (ok) 1964 2132 { … … 1974 2142 break; 1975 2143 } 2144 } 2145 2146 if (excluded) ok = false; 2147 } 2148 2149 if (ok) 2150 { 2151 excluded = false; 2152 for (int j = 0; j < path_exclusions.size (); j++) 2153 { 2154 const Project* sp = path_exclusions[j]; 2155 if (up) 2156 { 2157 if (up == sp) 2158 { 2159 excluded = true; 2160 break; 2161 } 2162 } 2163 else 2164 { 2165 if (use->get_realpath ().find (sp->get_cmtpath_real ()) == 0) 2166 { 2167 excluded = true; 2168 break; 2169 } 2170 } 1976 2171 } 1977 2172 … … 2021 2216 } 2022 2217 2218 /* 2023 2219 if (cmtpath == "") 2024 2220 { … … 2026 2222 cmtpath = Project::find_in_cmt_paths (sel); 2027 2223 } 2224 */ 2028 2225 2029 2226 cmt_string cmd = command; … … 2041 2238 static const cmt_string empty_string; 2042 2239 static const cmt_string fs = CmtSystem::file_separator (); 2043 cmt_string offset = s; 2044 offset.replace (cmtpath, empty_string); 2045 if (offset[0] == CmtSystem::file_separator ()) 2046 { 2047 offset.replace (fs, empty_string); 2048 } 2049 CmtSystem::dirname (offset, offset); 2050 2051 cmt_string n; 2052 CmtSystem::basename (offset, n); 2053 if (n == p) 2054 { 2240 cmt_string offset; 2241 if (cmtpath.size ()) 2242 { 2243 offset = s; 2244 offset.replace (cmtpath, empty_string); 2245 if (offset[0] == CmtSystem::file_separator ()) 2246 { 2247 offset.replace (fs, empty_string); 2248 } 2055 2249 CmtSystem::dirname (offset, offset); 2250 2251 cmt_string n; 2252 CmtSystem::basename (offset, n); 2253 if (n == p) 2254 { 2255 CmtSystem::dirname (offset, offset); 2256 } 2257 else 2258 { 2259 CmtSystem::dirname (offset, offset); 2260 CmtSystem::dirname (offset, offset); 2261 } 2056 2262 } 2057 2263 else 2058 2264 { 2059 CmtSystem::dirname (offset, offset); 2060 CmtSystem::dirname (offset, offset); 2061 } 2062 2265 offset = use->real_path; 2266 } 2063 2267 cmd.replace_all (offset_template, offset); 2064 2268 … … 2904 3108 } 2905 3109 2906 static CmtSystem::cmt_string_vector tags;3110 // static CmtSystem::cmt_string_vector tags; 2907 3111 2908 3112 if (action_build_constituents_config != get_action ()) 2909 CmtSystem::split (Me.m_extra_tags, " \t,", tags); 2910 2911 for (int i = 0; i < tags.size (); i++) 2912 { 2913 const cmt_string& t = tags[i]; 2914 2915 tag = Tag::find (t); 2916 if (tag == 0) continue; 2917 2918 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 2919 { 2920 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 2921 // cerr << "#CMT> The tag " << t << " is not used in any tag expression. Please check spelling" << endl; 3113 { 3114 // CmtSystem::split (Me.m_extra_tags, " \t,", tags); 3115 3116 // for (int i = 0; i < tags.size (); i++) 3117 // { 3118 // const cmt_string& t = tags[i]; 3119 for (int i = 0; i < Me.m_extra_tags.size (); i++) 3120 { 3121 const cmt_string& t = Me.m_extra_tags[i]; 3122 tag = Tag::find (t); 3123 if (tag == 0) continue; 3124 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 3125 { 3126 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 3127 } 3128 } 3129 for (int i = 0; i < Me.m_tags.size (); i++) 3130 { 3131 const cmt_string& t = Me.m_tags[i]; 3132 tag = Tag::find (t); 3133 if (tag == 0) continue; 3134 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 3135 { 3136 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 3137 } 3138 } 3139 for (int i = 0; i < Me.m_tags_add.size (); i++) 3140 { 3141 const cmt_string& t = Me.m_tags_add[i]; 3142 tag = Tag::find (t); 3143 if (tag == 0) continue; 3144 if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 3145 { 3146 CmtMessage::warning ("The tag " + t + " is not used in any tag expression. Please check spelling"); 3147 } 2922 3148 } 2923 3149 } … … 2940 3166 { 2941 3167 CmtMessage::warning ("The CMTSITE value " + env + " is not used in any tag expression. Please check spelling"); 2942 // cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl;2943 3168 } 2944 3169 … … 4476 4701 4477 4702 Use& use = Use::current(); 4703 /* 4478 4704 use.get_cmtpath_and_offset (cmtpath, offset); 4479 4705 4480 4706 Project* p = Project::find_by_cmtpath (cmtpath); 4481 4482 cout << p->get_author () << endl; 4707 */ 4708 if (const Project* p = use.get_project ()) 4709 cout << p->get_author () << endl; 4483 4710 } 4484 4711 … … 4503 4730 ClientCollector collector (package, version); 4504 4731 4732 /* 4505 4733 clear (); 4506 4734 // configure (); 4507 4735 configure (ap); 4736 */ 4508 4737 4509 4738 cout << "# ----------- Clients of " << package … … 5425 5654 log << "guess_current_project" << log_endl; 5426 5655 5427 cmt_string here = CmtSystem::pwd ();5656 // cmt_string here = CmtSystem::pwd (); 5428 5657 5429 5658 Use& use = Use::current(); … … 5438 5667 // if (Project::find_in_cmt_paths (Me.m_current_dir) == "") 5439 5668 { 5669 /* 5440 5670 if (!CmtSystem::cd (current_path)) 5441 5671 { … … 5444 5674 return; 5445 5675 } 5676 */ 5446 5677 cmt_string project_file = "cmt"; 5447 5678 project_file += CmtSystem::file_separator (); 5448 5679 project_file += Project::get_project_file_name (); 5449 5680 5450 cmt_string pwd; 5681 /* 5682 cmt_string pwd (CmtSystem::pwd ()); 5683 cmt_string pwd_prev; 5684 */ 5685 cmt_string dir_cur (current_path); 5686 cmt_string dir_par; 5687 5688 cmt_string proj_file_cur; 5451 5689 5452 5690 for (;;) 5453 5691 { 5454 pwd = CmtSystem::pwd (); 5692 /* 5693 // pwd = CmtSystem::pwd (); 5455 5694 if (CmtSystem::test_file (project_file)) 5456 5695 { … … 5462 5701 break; 5463 5702 } 5464 5465 log << "pwd=" << CmtSystem::pwd () << log_endl; 5703 */ 5704 proj_file_cur = dir_cur; 5705 proj_file_cur += CmtSystem::file_separator (); 5706 proj_file_cur += project_file; 5707 if (CmtSystem::test_file (proj_file_cur)) 5708 { 5709 //this directory should become the first entry of the CMTPATH 5710 5711 IProjectFactory& factory = ProjectFactory::instance (); 5712 factory.create_project ("", dir_cur, "CurrentProject", 0); 5713 5714 break; 5715 } 5716 5717 /* 5718 log << "pwd=" << pwd << log_endl; 5466 5719 5467 5720 if (!CmtSystem::cd ("..")) … … 5471 5724 } 5472 5725 5473 if (CmtSystem::pwd () == pwd) 5726 pwd_prev = pwd; 5727 pwd = CmtSystem::pwd (); 5728 if (pwd == pwd_prev) 5729 // if (CmtSystem::pwd () == pwd) 5474 5730 { 5475 5731 log << "Looks the same pwd..." << log_endl; 5476 5732 break; 5477 5733 } 5478 } 5479 5480 CmtSystem::cd (Me.m_current_dir); 5481 } 5734 */ 5735 log << "dir_cur=`" << dir_cur << "'" << log_endl; 5736 CmtSystem::dirname (dir_cur, dir_par); 5737 if (dir_par == dir_cur) 5738 { 5739 log << "Looks the same dir_cur..." << log_endl; 5740 break; 5741 } 5742 dir_cur = dir_par; 5743 } 5744 5745 // CmtSystem::cd (Me.m_current_dir); 5746 } // if (Project::find_in_cmt_paths (current_path) == "") 5482 5747 5483 5748 //cmt_string buffer = "path CMTPATH \n"; … … 5496 5761 Me.m_autoconfigure_cmtpath = true; 5497 5762 5498 CmtSystem::cd (here); 5763 // CmtSystem::cd (Me.m_current_dir); 5764 //CmtSystem::cd (here); 5499 5765 } 5500 5766 … … 6409 6675 6410 6676 /** 6411 * See reach_current_packagefor an explanation of this call6677 * See apply_globals for an explanation of this call 6412 6678 */ 6413 6679 Pattern::apply_all_globals (); … … 6444 6710 Me.m_action = action_none; 6445 6711 6446 restore_all_tags (0);6712 // restore_all_tags (0); 6447 6713 6448 6714 #ifdef WIN32 … … 6498 6764 clear (); 6499 6765 6766 // Me.clear (); 6767 6768 parse_arguments (ap); 6769 6500 6770 // configure (); 6501 configure (ap); 6502 6503 CmtError::clear (); 6771 switch (Me.m_action) 6772 { 6773 case action_none : 6774 case action_build_temporary_name : 6775 case action_help : 6776 break; 6777 default: 6778 configure (ap); 6779 restore_all_tags (0); 6780 break; 6781 } 6782 6783 // CmtError::clear (); 6504 6784 6505 6785 /* 6506 Set private if positioned inside the package6786 Set DeveloperMode if positioned inside the package 6507 6787 (which is detected since we were able to retreive the 6508 6788 Version, Package and Path) 6509 6789 */ 6510 6790 6791 if (!Use::current().located ()) 6792 /* 6511 6793 if ((Me.m_current_path.size () == 0) || 6512 6794 (Me.m_current_package.size () == 0) || 6513 6795 (Me.m_current_version.size () == 0)) 6796 */ 6514 6797 { 6515 6798 Me.m_current_access = UserMode; … … 6520 6803 } 6521 6804 6522 parse_arguments (ap);6805 // parse_arguments (ap); 6523 6806 6524 6807 if (ap.help_action == action_help) … … 6929 7212 Me.m_warnings = false; 6930 7213 if (strlen (ap.extra_file.c_str ()) == 0) 6931 reach_current_package (); 7214 use_current_package (); 7215 // reach_current_package (); 6932 7216 else 6933 7217 use_extra_file (ap.extra_file); … … 6935 7219 if (strlen (ap.extra_line.c_str ()) > 0) 6936 7220 SyntaxParser::parse_requirements_text (ap.extra_line, "extra statement(s)", (Use*) 0); 7221 apply_globals (); 6937 7222 Me.m_warnings = w; 6938 //if (strlen (ap.extra_line.c_str ()) > 0) SyntaxParser::parse_requirements_line (ap.extra_line, &(Use::current ()));6939 7223 } 6940 7224 break; … … 6952 7236 if (use != 0 && !use->discarded && !use->m_hidden && use->located ()) 6953 7237 uses.push_back (use); 6954 uses.push_back (&(Use::current())); 7238 use = &(Use::current()); 7239 if (use != 0 && !use->discarded && !use->m_hidden && use->located ()) 7240 uses.push_back (use); 7241 // uses.push_back (&(Use::current())); 6955 7242 use = Use::find (CmtSystem::get_user_context_package ()); 6956 7243 if (use != 0 && !use->discarded && !use->m_hidden && use->located ()) … … 7452 7739 // 7453 7740 7741 /* 7454 7742 { 7455 7743 CmtSystem::cmt_string_vector words; … … 7477 7765 } 7478 7766 } 7479 7767 */ 7480 7768 if (mode == Requirements) 7481 7769 { … … 7939 8227 7940 8228 //---------------------------------------------------------- 7941 int Cmt:: reach_current_package ()8229 int Cmt::use_current_package () 7942 8230 { 7943 8231 Use& use = Use::current (); … … 7946 8234 if (Me.m_debug) 7947 8235 { 7948 cout << "Cmt:: reach_current_package> pwd = "8236 cout << "Cmt::use_current_package> pwd = " 7949 8237 << CmtSystem::pwd () 7950 8238 << " path=" << Me.m_current_path … … 7959 8247 if (Me.m_current_package == "cmt_standalone") 7960 8248 { 7961 if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 8249 if ((Me.m_current_path != "") && (Me.m_current_path != Me.m_current_dir)) 8250 // if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 7962 8251 { 7963 8252 if (!CmtSystem::cd (Me.m_current_path)) 7964 8253 { 7965 8254 CmtError::set (CmtError::package_not_found, 7966 "ReachCurrentPackage> Cannot reach the path directory"); 8255 "Cannot reach the path directory: " 8256 + Me.m_current_path); 7967 8257 return (0); 7968 8258 } … … 7975 8265 7976 8266 Me.m_current_structuring_style = without_version_directory; 8267 use.structuring_style = Me.m_current_structuring_style; 8268 use.change_path (Me.m_current_path, Project::get_current ()); 8269 Me.m_current_access = DeveloperMode; 7977 8270 } 7978 8271 else if (Me.m_current_package != "") 7979 8272 { 7980 if (!use.move_to () && !use.move_to ("", true)) 7981 // if (!use.move_to ()) 7982 { 7983 CmtError::set (CmtError::package_not_found, use.get_info ()); 7984 // CmtError::set (CmtError::package_not_found, 7985 // "ReachCurrentPackage> Cannot reach the path directory"); 7986 return (0); 7987 } 7988 7989 Me.m_current_path = use.real_path; 8273 if (!use.located ()) 8274 { 8275 // if (!use.move_to () && !use.move_to ("", true)) 8276 // if (!use.move_to ()) 8277 if (!use.move_to ()) 8278 { 8279 if (!CmtSystem::cd (Cmt::get_current_dir ())) 8280 { 8281 CmtError::set (CmtError::file_access_error, 8282 Cmt::get_current_dir () 8283 + " (use_current_package)"); 8284 return 0; 8285 } 8286 if (!use.move_to ("", true)) 8287 { 8288 CmtError::set (CmtError::package_not_found, use.get_info ()); 8289 return 0; 8290 } 8291 } 8292 8293 Me.m_current_path = use.real_path; 8294 Me.m_current_access = DeveloperMode; 8295 } 7990 8296 } 7991 8297 else … … 8025 8331 8026 8332 CmtError::set (CmtError::package_not_found, 8027 "ReachCurrentPackage> Cannot reach the mgr/cmt directory"); 8333 "Cannot reach the mgr/cmt directory: " 8334 + use.get_info ()); 8028 8335 return (0); 8029 8336 } … … 8031 8338 else 8032 8339 Me.m_current_style = none_style; 8340 8341 Me.m_current_access = DeveloperMode; 8033 8342 8034 8343 dir = CmtSystem::pwd (); … … 8058 8367 use.style = Me.m_current_style; 8059 8368 use.structuring_style = Me.m_current_structuring_style; 8060 } 8061 8369 8370 configure_current_dir (); 8371 build_prefix (Me.m_current_package, Me.m_current_prefix); 8372 build_config (Me.m_current_prefix, Me.m_current_config); 8373 } 8374 8375 /* 8062 8376 configure_current_dir (); 8063 8377 build_prefix (Me.m_current_package, Me.m_current_prefix); 8064 8378 build_config (Me.m_current_prefix, Me.m_current_config); 8379 */ 8065 8380 8066 8381 /* … … 8068 8383 */ 8069 8384 8070 if (Me.m_debug) cout << " reach_current_package0> current_tag=" << Me.m_current_tag << endl;8385 if (Me.m_debug) cout << "use_current_package0> current_tag=" << Me.m_current_tag << endl; 8071 8386 8072 8387 if (Me.m_current_tag == "") … … 8079 8394 Tag* tag; 8080 8395 8081 tag = Tag::add (env, PriorityConfig, " reachcurrent package", 0);8396 tag = Tag::add (env, PriorityConfig, "current package", 0); 8082 8397 tag->mark (use.get_package_name ()); 8083 8398 //Me.m_current_tag = env; 8084 8399 8085 //if (!Me.m_quiet) cerr << " reach_current_package1> current_tag=" << Me.m_current_tag << endl;8400 //if (!Me.m_quiet) cerr << "use_current_package1> current_tag=" << Me.m_current_tag << endl; 8086 8401 8087 8402 } … … 8101 8416 SyntaxParser::parse_requirements (dir, &use); 8102 8417 8103 if (Me.m_debug) cout << "reach_current_package2> current_tag=" << Me.m_current_tag << endl; 8418 if (CmtError::has_pending_error ()) return 0; 8419 8420 if (Me.m_debug) cout << "use_current_package2> current_tag=" << Me.m_current_tag << endl; 8421 8422 return 1; 8423 } 8424 8425 //---------------------------------------------------------- 8426 int Cmt::use_extra_file (const cmt_string& file) 8427 { 8428 if (!CmtSystem::test_file (file)) 8429 { 8430 CmtError::set (CmtError::path_not_found, file); 8431 return 0; 8432 } 8433 8434 // (almost) Cmt::use_current_package () 8435 Use& use = Use::current (); 8436 /* 8437 Try to access the package. 8438 */ 8439 8440 if (Me.m_current_package == "cmt_standalone") 8441 { 8442 if ((Me.m_current_path != "") && (Me.m_current_path != Me.m_current_dir)) 8443 // if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 8444 { 8445 if (!CmtSystem::cd (Me.m_current_path)) 8446 { 8447 CmtError::set (CmtError::package_not_found, 8448 "Cannot reach the path directory: " 8449 + Me.m_current_path); 8450 return (0); 8451 } 8452 } 8453 /* 8454 if (!CmtSystem::test_file ("requirements")) 8455 { 8456 return (0); 8457 } 8458 */ 8459 Me.m_current_structuring_style = without_version_directory; 8460 use.structuring_style = Me.m_current_structuring_style; 8461 use.change_path (Me.m_current_path, Project::get_current ()); 8462 Me.m_current_access = DeveloperMode; 8463 } 8464 else if (Me.m_current_package != "") 8465 { 8466 if (!use.located ()) 8467 { 8468 // if (!use.move_to () && !use.move_to ("", true)) 8469 // if (!use.move_to ()) 8470 if (!use.move_to ()) 8471 { 8472 if (!CmtSystem::cd (Cmt::get_current_dir ())) 8473 { 8474 CmtError::set (CmtError::file_access_error, 8475 Cmt::get_current_dir () 8476 + " (use_extra_file)"); 8477 return 0; 8478 } 8479 if (!use.move_to ("", true)) 8480 { 8481 CmtError::set (CmtError::package_not_found, use.get_info ()); 8482 return 0; 8483 } 8484 } 8485 8486 Me.m_current_path = use.real_path; 8487 Me.m_current_access = DeveloperMode; 8488 } 8489 } 8490 else 8491 { 8492 // 8493 // The cmt command has been given without explicit search for 8494 // a package. Thus it is expected that we are in the context of a 8495 // true package. 8496 // 8497 // This means that there should be a requirements file visible. 8498 // 8499 // If this is not true, we'll make a try into ../cmt and then 8500 // a last try into ../mgr 8501 // 8502 8503 Me.m_current_access = DeveloperMode; 8504 //... 8505 configure_current_dir (); 8506 build_prefix (Me.m_current_package, Me.m_current_prefix); 8507 build_config (Me.m_current_prefix, Me.m_current_config); 8508 } 8509 8510 /* 8511 configure_current_dir (); 8512 build_prefix (Me.m_current_package, Me.m_current_prefix); 8513 build_config (Me.m_current_prefix, Me.m_current_config); 8514 */ 8515 8516 /* 8517 Check Tag is always set up 8518 */ 8519 8520 if (Me.m_debug) cout << "use_extra_file0> current_tag=" << Me.m_current_tag << endl; 8521 8522 if (Me.m_current_tag == "") 8523 { 8524 cmt_string env; 8525 8526 env = CmtSystem::getenv (Me.m_current_config); 8527 if (env != "") 8528 { 8529 Tag* tag; 8530 8531 tag = Tag::add (env, PriorityConfig, "current package", 0); 8532 tag->mark (use.get_package_name ()); 8533 //Me.m_current_tag = env; 8534 8535 //if (!Me.m_quiet) cerr << "use_extra_file1> current_tag=" << Me.m_current_tag << endl; 8536 8537 } 8538 } 8539 8540 if (Me.m_debug) 8541 { 8542 cout << "pwd = " << CmtSystem::pwd () << endl; 8543 } 8544 8545 /* 8546 Work on the requirements file. 8547 */ 8548 8549 SyntaxParser::parse_requirements (file, &use); 8550 8551 if (CmtError::has_pending_error ()) return 0; 8552 8553 if (Me.m_debug) cout << "use_extra_file2> current_tag=" << Me.m_current_tag << endl; 8554 return 1; 8555 } 8556 8557 //---------------------------------------------------------- 8558 int Cmt::apply_globals () 8559 { 8104 8560 8105 8561 /** … … 8132 8588 Tag::restore_tree (); 8133 8589 8134 return (1); 8135 } 8136 8137 //---------------------------------------------------------- 8138 int Cmt::use_extra_file (const cmt_string& file) 8139 { 8140 if (!CmtSystem::test_file (file)) 8141 { 8142 CmtError::set (CmtError::path_not_found, file); 8143 return 0; 8144 } 8145 8146 // (almost) Cmt::reach_current_package () 8147 Use& use = Use::current (); 8148 /* 8149 Try to access the package. 8150 */ 8151 8152 if (Me.m_current_package == "cmt_standalone") 8153 { 8154 if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ())) 8155 { 8156 if (!CmtSystem::cd (Me.m_current_path)) 8157 { 8158 CmtError::set (CmtError::package_not_found, 8159 "ReachCurrentPackage> Cannot reach the path directory"); 8160 return (0); 8161 } 8162 } 8163 /* 8164 if (!CmtSystem::test_file ("requirements")) 8165 { 8166 return (0); 8167 } 8168 */ 8169 Me.m_current_structuring_style = without_version_directory; 8170 } 8171 else if (Me.m_current_package != "") 8172 { 8173 if (!use.move_to () && !use.move_to ("", true)) 8174 // if (!use.move_to ()) 8175 { 8176 CmtError::set (CmtError::package_not_found, use.get_info ()); 8177 // CmtError::set (CmtError::package_not_found, 8178 // "ReachCurrentPackage> Cannot reach the path directory"); 8179 // return -1; 8180 return (0); 8181 } 8182 8183 Me.m_current_path = use.real_path; 8184 } 8185 else 8186 { 8187 // 8188 // The cmt command has been given without explicit search for 8189 // a package. Thus it is expected that we are in the context of a 8190 // true package. 8191 // 8192 // This means that there should be a requirements file visible. 8193 // 8194 // If this is not true, we'll make a try into ../cmt and then 8195 // a last try into ../mgr 8196 // 8197 8198 //... 8199 } 8200 8201 configure_current_dir (); 8202 build_prefix (Me.m_current_package, Me.m_current_prefix); 8203 build_config (Me.m_current_prefix, Me.m_current_config); 8204 8205 /* 8206 Check Tag is always set up 8207 */ 8208 8209 if (Me.m_debug) cout << "use_extra_file0> current_tag=" << Me.m_current_tag << endl; 8210 8211 if (Me.m_current_tag == "") 8212 { 8213 cmt_string env; 8214 8215 env = CmtSystem::getenv (Me.m_current_config); 8216 if (env != "") 8217 { 8218 Tag* tag; 8219 8220 tag = Tag::add (env, PriorityConfig, "reach current package", 0); 8221 tag->mark (use.get_package_name ()); 8222 //Me.m_current_tag = env; 8223 8224 //if (!Me.m_quiet) cerr << "use_extra_file1> current_tag=" << Me.m_current_tag << endl; 8225 8226 } 8227 } 8228 8229 if (Me.m_debug) 8230 { 8231 cout << "pwd = " << CmtSystem::pwd () << endl; 8232 } 8233 8234 /* 8235 Work on the requirements file. 8236 */ 8237 8238 SyntaxParser::parse_requirements (file, &use); 8239 8240 if (Me.m_debug) cout << "use_extra_file2> current_tag=" << Me.m_current_tag << endl; 8241 8242 /** 8243 * It would be useful to change this mechanism. Instead of 8244 * applying all global patterns at once to all use contexts, it 8245 * would be much better to apply it at the end of each 8246 * requirements file parsing, and only in the context the 8247 * appropriate Use. 8248 * 8249 * This would avoid the current flaw which is that when a global 8250 * pattern specifies a "private" definition, it is actually 8251 * applied in the scope context of the Current Use and not in 8252 * each individual Use. Therefore the private is lost. 8253 * 8254 * However, this induces problems since some pattern definitions 8255 * are done AFTER the use statements, which will NOT receive the 8256 * pattern aplications. 8257 * 8258 * Therefore it is decided to leave this "bad" mechanism until 8259 * everybody is aware of this constraint. 8260 * 8261 * 8262 */ 8263 Pattern::apply_all_globals (); 8264 8265 /* 8266 Select all possible tags 8267 */ 8268 8269 Tag::restore_tree (); 8270 8271 return (1); 8590 if (CmtError::has_pending_error ()) return 0; 8591 8592 return 1; 8272 8593 } 8273 8594 … … 9972 10293 if (CmtSystem::test_file (f)) 9973 10294 { 9974 use->m_located = true; 9975 } 9976 SyntaxParser::parse_requirements (f, use); 10295 use->style = none_style; 10296 use->structuring_style = without_version_directory; 10297 10298 if (name == CmtSystem::get_home_package () || 10299 name == CmtSystem::get_user_context_package ()) 10300 { 10301 const Project::ProjectPtrVector& Ordered = Project::ordered_projects (); 10302 if (0 == Ordered.size ()) 10303 { 10304 CmtError::set(CmtError::configuration_error, 10305 "No ordered project: " + use->get_info ()); 10306 return; 10307 } 10308 if (name == CmtSystem::get_home_package ()) 10309 use->change_path (path, Ordered[Ordered.size () - 1]); 10310 else if (name == CmtSystem::get_user_context_package ()) 10311 use->change_path (path, Ordered[0]); 10312 } 10313 else 10314 { 10315 CmtMessage::verbose 10316 (CmtError::get_error_name (CmtError::configuration_error) 10317 + ": Unknown special use: " + use->get_info ()); 10318 use->change_path (path); 10319 } 10320 // use->m_located = true; 10321 SyntaxParser::parse_requirements (f, use); 10322 } 10323 else 10324 { 10325 use->discard (); 10326 } 9977 10327 9978 10328 Me.m_recursive = recursive_copy; -
CMT/HEAD/source/cmt_pattern.cxx
r607 r652 771 771 replacement.replace_all ("<version>", context_use->version.c_str ()); 772 772 replacement.replace_all ("<path>", context_use->real_path.c_str ()); 773 773 /* 774 774 cmt_string cmtpath = ""; 775 775 cmt_string offset = ""; … … 779 779 Project* p = Project::find_by_cmtpath (cmtpath); 780 780 if (p != 0) 781 */ 782 if (const Project* p = context_use->get_project ()) 781 783 { 782 const cmt_string& n = p->get_name ();783 replacement.replace_all ("<project>", n.c_str ());784 // const cmt_string& n = p->get_name (); 785 replacement.replace_all ("<project>", p->get_name ().c_str ()); 784 786 } 785 787 -
CMT/HEAD/source/cmt_project.cxx
r629 r652 646 646 project_use->m_hidden = true; 647 647 project_use->selected = true; 648 project_use->m_located = true; 648 project_use->change_path (project->get_cmtpath(), project); 649 // project_use->m_located = true; 649 650 cmt_map <Use*, bool> visited; 650 651 project_use->set_auto_imports(Unspecified, Off, visited); … … 864 865 static ProjectVector& Projects = projects (); 865 866 866 Project* result = 0;867 868 867 for (int i = (Projects.size () - 1); i >= 0; i--) 869 868 { … … 879 878 // if (here_real.find (p.m_cmtpath_real) == 0) 880 879 { 881 re sult =&p;882 } 883 } 884 885 return (result);880 return &p; 881 } 882 } 883 884 return 0; 886 885 } 887 886 … … 1523 1522 1524 1523 //---------------------------------------------------------- 1525 void Project::fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections) 1524 /** 1525 * Fill with projects (pointers) for CMTPATH entries >=1 and <= depth 1526 * except for CMTUSERCONTEXT project or CMTHOME project 1527 * unless either is current project. 1528 * Special values of depth: 1529 * 0: CMTUSERCONTEXT project only 1530 * -1: CMTHOME project only 1531 * 1532 * @param depth in CMTPATH up to which fill 1533 * @param path_selections vector to fill 1534 */ 1535 void Project::fill_selection (int depth, ConstProjectPtrVector& path_selections) 1536 { 1537 static ProjectPtrVector& Ordered = Project::ordered_projects (); 1538 int curdepth = depth; 1539 for (int i = 0; i < Ordered.size (); i++) 1540 { 1541 const Project* project = Ordered[i]; 1542 const cmt_string& src = project->get_cmtpath_source (); 1543 1544 if (src == "default path") continue; 1545 1546 if (depth > 0) 1547 { 1548 // project for CMTPATH entries >=1 and <= depth 1549 // except for CMTUSERCONTEXT path or CMTHOME path 1550 // OR 1551 // CMTUSERCONTEXT path if it's current project 1552 // CMTHOME path if it's current project 1553 if (i == 0 1554 && !project->is_current () 1555 && src == "CMTUSERCONTEXT") continue; 1556 // this is CMTUSERCONTEXT 1557 if (i == Ordered.size () - 1 1558 && !project->is_current () 1559 && src == "CMTHOME") continue; 1560 // this is CMTHOME 1561 path_selections.push_back (project); 1562 //cerr << "fill: " << i << ": " << project->get_cmtpath () << ": " << curdepth << endl; 1563 if (--curdepth == 0) break; 1564 } 1565 else if (depth == 0) 1566 { 1567 // CMTUSERCONTEXT path only 1568 if (i == 0 1569 && src == "CMTUSERCONTEXT") 1570 { 1571 path_selections.push_back (project); 1572 break; 1573 } 1574 } 1575 else if (depth == -1) 1576 { 1577 // CMTHOME path only 1578 if (i == Ordered.size () - 1 1579 && src == "CMTHOME") 1580 { 1581 path_selections.push_back (project); 1582 break; 1583 } 1584 } 1585 } 1586 } 1587 1588 //---------------------------------------------------------- 1589 // void Project::fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections) 1590 // { 1591 // static ProjectPtrVector& Ordered = Project::ordered_projects (); 1592 // int curdepth = depth; 1593 // for (int i = 0; i < Ordered.size (); i++) 1594 // { 1595 // const Project* project = Ordered[i]; 1596 1597 // const cmt_string& p = project->get_cmtpath (); 1598 // const cmt_string& pwd = project->get_cmtpath_pwd (); 1599 // const cmt_string& p_real = project->get_cmtpath_real (); 1600 // const cmt_string& src = project->get_cmtpath_source (); 1601 1602 // if (src == "default path") continue; 1603 1604 // if (depth > 0) 1605 // { 1606 // // packages from CMTPATH entries >=1 and <= depth 1607 // // except for CMTUSERCONTEXT path or CMTHOME path 1608 // // OR 1609 // // CMTUSERCONTEXT path if it's current project 1610 // // CMTHOME path if it's current project 1611 // if (i == 0 1612 // && !project->is_current () 1613 // && src == "CMTUSERCONTEXT") continue; 1614 // // this is CMTUSERCONTEXT 1615 // if (i = Ordered.size () - 1 1616 // && !project->is_current () 1617 // && src == "CMTHOME") continue; 1618 // // this is CMTHOME 1619 // cmt_string& s1 = path_selections.add (); 1620 // s1 = p; 1621 // if (pwd != p) 1622 // { 1623 // cmt_string& s2 = path_selections.add (); 1624 // s2 = pwd; 1625 // } 1626 // if (p_real != p && p_real != pwd) 1627 // { 1628 // cmt_string& s3 = path_selections.add (); 1629 // s3 = p_real; 1630 // } 1631 // if (--curdepth == 0) break; 1632 // } 1633 // else if (depth == 0) 1634 // { 1635 // // CMTUSERCONTEXT path only 1636 // if (i == 0 1637 // && src == "CMTUSERCONTEXT") 1638 // { 1639 // cmt_string& s1 = path_selections.add (); 1640 // s1 = p; 1641 // if (pwd != p) 1642 // { 1643 // cmt_string& s2 = path_selections.add (); 1644 // s2 = pwd; 1645 // } 1646 // if (p_real != p && p_real != pwd) 1647 // { 1648 // cmt_string& s3 = path_selections.add (); 1649 // s3 = p_real; 1650 // } 1651 // break; 1652 // } 1653 // } 1654 // else if (depth == -1) 1655 // { 1656 // // CMTHOME path only 1657 // if (i = Ordered.size () - 1 1658 // && src == "CMTHOME") 1659 // { 1660 // cmt_string& s1 = path_selections.add (); 1661 // s1 = p; 1662 // if (pwd != p) 1663 // { 1664 // cmt_string& s2 = path_selections.add (); 1665 // s2 = pwd; 1666 // } 1667 // if (p_real != p && p_real != pwd) 1668 // { 1669 // cmt_string& s3 = path_selections.add (); 1670 // s3 = p_real; 1671 // } 1672 // break; 1673 // } 1674 // } 1675 // // if (depth > 0) 1676 // // { 1677 // // cmt_string& s1 = path_selections.add (); 1678 // // s1 = p; 1679 // // if (pwd != p) 1680 // // { 1681 // // cmt_string& s2 = path_selections.add (); 1682 // // s2 = pwd; 1683 // // } 1684 // // if (p_real != p && p_real != pwd) 1685 // // { 1686 // // cmt_string& s3 = path_selections.add (); 1687 // // s3 = p_real; 1688 // // } 1689 // // if (src != "CMTHOME" && src != "CMTUSERCONTEXT") 1690 // // depth--; 1691 1692 // // if (depth == 0) break; 1693 // // } 1694 1695 // } 1696 // } 1697 1698 //---------------------------------------------------------- 1699 /** 1700 * Fill with projects (pointers) for CMTUSERCONTEXT and CMTHOME projects 1701 * (if any exists) 1702 * unless either is current project. 1703 * 1704 * @param path_exclusions vector to fill 1705 */ 1706 void Project::fill_exclusion (ConstProjectPtrVector& path_exclusions) 1526 1707 { 1527 1708 static ProjectPtrVector& Ordered = Project::ordered_projects (); … … 1529 1710 { 1530 1711 const Project* project = Ordered[i]; 1531 1532 const cmt_string& p = project->get_cmtpath ();1533 const cmt_string& pwd = project->get_cmtpath_pwd ();1534 const cmt_string& p_real = project->get_cmtpath_real ();1535 1712 const cmt_string& src = project->get_cmtpath_source (); 1536 /* 1537 static ProjectVector& Projects = projects (); 1538 1539 for (int i = 0; i < Projects.size (); i++) 1540 { 1541 Project& project = Projects[i]; 1542 1543 const cmt_string& p = project.get_cmtpath (); 1544 const cmt_string& pwd = project.get_cmtpath_pwd (); 1545 const cmt_string& p_real = project.get_cmtpath_real (); 1546 const cmt_string& src = project.get_cmtpath_source (); 1547 */ 1548 if (src != "default path") 1549 { 1550 if (depth > 0) 1551 { 1552 cmt_string& s1 = path_selections.add (); 1553 s1 = p; 1554 if (pwd != p) 1555 { 1556 cmt_string& s2 = path_selections.add (); 1557 s2 = pwd; 1558 } 1559 if (p_real != p && p_real != pwd) 1560 { 1561 cmt_string& s3 = path_selections.add (); 1562 s3 = p_real; 1563 } 1564 if (src != "CMTHOME" && src != "CMTUSERCONTEXT") 1565 depth--; 1566 1567 if (depth == 0) break; 1568 } 1569 } 1713 1714 if (!project->is_current () 1715 && (src == "CMTUSERCONTEXT" || src == "CMTHOME")) 1716 path_exclusions.push_back (project); 1570 1717 } 1571 1718 } … … 1694 1841 // } 1695 1842 1696 if (path_real.find (p_real) != cmt_string::npos)1843 if (path_real.find (p_real) == 0) //!= cmt_string::npos) 1697 1844 { 1698 1845 return (p); … … 1700 1847 1701 1848 // To become the current area, a path must correspond to the current package 1702 if (path.find (w) != cmt_string::npos)1849 if (path.find (w) == 0)// != cmt_string::npos) 1703 1850 { 1704 1851 return (p); … … 1706 1853 } 1707 1854 1855 /* This code is never used since p is returned above 1708 1856 if (p == w) continue; 1709 1857 … … 1711 1859 // if (CmtSystem::test_directory (w)) 1712 1860 { 1713 if (path.find (w) != cmt_string::npos)1861 if (path.find (w) == 0)// != cmt_string::npos) 1714 1862 { 1715 1863 return (w); 1716 1864 } 1717 1865 } 1866 */ 1718 1867 } 1719 1868 … … 2362 2511 use->get_package ()->remove_use (use); 2363 2512 CmtSystem::cd (m_cmtpath_pwd); 2364 if (use->move_to ("", true) && 2365 !CmtSystem::absolute_path (use->real_path)) 2366 { 2367 use->change_path (m_cmtpath_pwd); 2368 } 2513 if (use->move_to ("", true)) 2514 { 2515 if (use->get_realpath ().find (this->get_cmtpath_real ()) == 0) 2516 use->set_project (this); 2517 } 2518 else 2519 if (0 == CmtSystem::getenv ("CMTPEDANTIC").size () && 2520 0 == CmtSystem::getenv ("PEDANTIC").size ()) 2521 CmtMessage::warning 2522 (CmtError::get_error_name (CmtError::configuration_error) 2523 + ": Cannot locate container: " + use->get_info ()); 2524 else 2525 CmtError::set(CmtError::configuration_error, 2526 "Cannot locate container: " + use->get_info ()); 2527 2369 2528 CmtSystem::cd (m_cmtpath_pwd + CmtSystem::file_separator () + "cmt"); 2529 2530 if (CmtError::get_last_error_code () == CmtError::configuration_error) 2531 return; 2370 2532 2371 2533 set_container_name (name); -
CMT/HEAD/source/cmt_project.h
r608 r652 97 97 typedef cmt_vector<Project> ProjectVector; 98 98 typedef cmt_vector<Project*> ProjectPtrVector; 99 typedef cmt_vector<const Project*> ConstProjectPtrVector; 99 100 100 101 static bool create (const cmt_string& name, … … 120 121 static const cmt_string& get_project_file_name (); 121 122 122 static void fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections); 123 static void fill_selection (int depth, ConstProjectPtrVector& path_selections); 124 // static void fill_selection (int depth, CmtSystem::cmt_string_vector& path_selections); 125 static void fill_exclusion (ConstProjectPtrVector& path_exclusions); 123 126 124 127 static void broadcast (IProjectAction& action); -
CMT/HEAD/source/cmt_symbol.cxx
r625 r652 1084 1084 */ 1085 1085 if (name == "constituents") return; 1086 if (name == "constituentsc clean") return;1086 if (name == "constituentsclean") return; 1087 1087 1088 1088 if (use->get_current_scope () == ScopePrivate) return; -
CMT/HEAD/source/cmt_syntax.cxx
r607 r652 212 212 int line_number) 213 213 { 214 214 /* 215 215 cmt_string cmtpath; 216 216 cmt_string offset; … … 219 219 220 220 Project* p = Project::find_by_cmtpath (cmtpath); 221 */ 222 Project* p = const_cast<Project*>(use->get_project ()); 223 // const Project* p = use->get_project (); 221 224 222 225 for (int i = 1; i < words.size (); i++) … … 1060 1063 int line_number) 1061 1064 { 1065 /* 1062 1066 cmt_string cmtpath; 1063 1067 cmt_string offset; … … 1066 1070 1067 1071 Project* p = Project::find_by_cmtpath (cmtpath); 1072 */ 1073 Project* p = const_cast<Project*>(use->get_project ()); 1074 // const Project* p = use->get_project (); 1068 1075 1069 1076 for (int i = 1; i < words.size (); i++) … … 1164 1171 int line_number) 1165 1172 { 1173 /* 1166 1174 cmt_string cmtpath; 1167 1175 cmt_string offset; … … 1170 1178 1171 1179 Project* p = Project::find_by_cmtpath (cmtpath); 1180 */ 1181 Project* p = const_cast<Project*>(use->get_project ()); 1182 // const Project* p = use->get_project (); 1172 1183 1173 1184 for (int i = 1; i < words.size (); i++) … … 1403 1414 // 1404 1415 1405 Project* p = use->get_project ();1416 const Project* p = use->get_project (); 1406 1417 if (p != 0) 1407 1418 { -
CMT/HEAD/source/cmt_use.cxx
r610 r652 1826 1826 m_located = false; 1827 1827 m_package = 0; 1828 m_project = 0; 1828 1829 m_index = -1; 1829 1830 … … 1848 1849 m_package = 0; 1849 1850 } 1851 m_project = 0; 1850 1852 1851 1853 version = ""; … … 1923 1925 1924 1926 //---------------------------------------------------------- 1925 void Use::change_path (const cmt_string& new_path )1927 void Use::change_path (const cmt_string& new_path, const Project* project) 1926 1928 { 1927 1929 // … … 1929 1931 // where this package/version has been found. 1930 1932 // 1933 if (Cmt::get_debug ()) 1934 { 1935 cout << "|Use::change_path> path: " << new_path 1936 << ": project: " << (project ? project->get_cmtpath () : "0") 1937 << ": " << get_info () << endl; 1938 } 1931 1939 1932 1940 real_path = ""; 1933 1941 m_realpath = ""; 1934 1942 1935 if (new_path != "") 1943 m_project = 0; 1944 1945 if (new_path.size () != 0) 1946 // if (new_path != "") 1936 1947 { 1937 1948 if ((path.size () > 0) && … … 1951 1962 if (!CmtSystem::realpath_ (real_path, m_realpath)) 1952 1963 { 1953 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + 1954 real_path + "'"); 1964 CmtError::set (CmtError::file_access_error, 1965 "Cannot compute real path `" + real_path + "': " + 1966 get_info ()); 1955 1967 CmtError::print (); 1956 1968 return; … … 1958 1970 } 1959 1971 1972 if (project) 1973 m_project = project; 1974 1960 1975 m_located = true; 1976 1977 if (Cmt::get_debug ()) 1978 { 1979 cout << "<Use::change_path| real_path: " << real_path 1980 << ": m_project: " << (m_project ? m_project->get_cmtpath () : "0") 1981 << ": " << get_info () << endl; 1982 } 1961 1983 } 1962 1984 … … 2347 2369 } 2348 2370 2349 m_use->change_path (path );2371 m_use->change_path (path, &project); 2350 2372 2351 2373 m_found = true; … … 2355 2377 else if (m_use->alternate_versions.size () > 0) 2356 2378 { 2357 if (m_use->select_alternate ( ))2379 if (m_use->select_alternate (&project)) 2358 2380 { 2359 2381 if (Cmt::get_debug ()) … … 2448 2470 cout << "move_to2> " << expanded_path << endl; 2449 2471 } 2450 2451 2472 change_path (here); 2452 2453 2473 return (true); 2454 2474 } … … 2461 2481 cout << "move_to5> " << real_path << endl; 2462 2482 } 2463 2464 2483 return (true); 2465 2484 } 2466 2485 } 2486 2487 if (!CmtSystem::cd (here)) 2488 { 2489 CmtError::set (CmtError::file_access_error, here); 2490 } 2467 2491 return (false); 2468 2492 // } … … 2482 2506 2483 2507 //---------------------------------------------------------- 2484 bool Use::select_alternate ( )2508 bool Use::select_alternate (const Project* project) 2485 2509 { 2486 2510 int i; … … 2567 2591 } 2568 2592 2569 change_path (alternate_paths[selected_index] );2593 change_path (alternate_paths[selected_index], project); 2570 2594 return (true); 2571 2595 } … … 3568 3592 offset = ""; 3569 3593 3570 cmtpath = m_realpath.size () 3571 ? Project::find_in_cmt_paths (m_realpath, true) 3572 : Project::find_in_cmt_paths (real_path) 3573 ; 3574 const Project* p = Project::find_by_cmtpath (cmtpath); 3575 3594 const Project* p (0); 3595 if (m_project) 3596 { 3597 p = m_project; 3598 cmtpath = p->get_cmtpath (); 3599 } 3600 else 3601 { 3602 cmtpath = m_realpath.size () 3603 ? Project::find_in_cmt_paths (m_realpath, true) 3604 : Project::find_in_cmt_paths (real_path) 3605 ; 3606 p = Project::find_by_cmtpath (cmtpath); 3607 // const Project* p = Project::find_by_cmtpath (cmtpath); 3608 } 3576 3609 // if (cmtpath != "") 3577 3610 if (p != 0) … … 3590 3623 else if (!CmtSystem::realpath_ (real_path, offset)) 3591 3624 { 3592 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + 3593 real_path + "'"); 3625 CmtError::set (CmtError::file_access_error, 3626 "Cannot compute real path `" + real_path + "': " + 3627 get_info ()); 3594 3628 CmtError::print (); 3595 3629 return; … … 3705 3739 buffer += "\n"; 3706 3740 3707 if (located ()) 3741 if (m_located) 3742 // if (located ()) 3708 3743 { 3709 3744 buffer += "macro "; … … 3725 3760 buffer += package_name; 3726 3761 } 3727 // if (style != no_version_style)3728 3762 if (structuring_style == with_version_directory) 3729 3763 { … … 3764 3798 buffer += "\n"; 3765 3799 3766 Project* p = Project::find_by_cmtpath (cmtpath); 3800 const Project* p (m_project); 3801 if (!p) 3802 p = Project::find_by_cmtpath (cmtpath); 3767 3803 3768 3804 buffer += "macro "; … … 4829 4865 4830 4866 return (is_in_path); 4831 }4832 4833 //----------------------------------------------------------4834 bool Use::located () const4835 {4836 return (m_located);4837 4867 } 4838 4868 … … 5736 5766 5737 5767 //---------------------------------------------------------- 5738 Project* Use::get_project () 5768 const Project* Use::get_project () const 5739 5769 { 5770 if (m_project) 5771 return m_project; 5772 5773 cmt_string cmtpath = m_realpath.size () 5774 ? Project::find_in_cmt_paths (m_realpath, true) 5775 : Project::find_in_cmt_paths (real_path) 5776 ; 5777 return Project::find_by_cmtpath (cmtpath); 5778 /* 5740 5779 Project* p; 5741 5780 cmt_string cmtpath = ""; … … 5744 5783 p = Project::find_by_cmtpath (cmtpath); 5745 5784 return p; 5785 */ 5746 5786 } 5747 5787 -
CMT/HEAD/source/cmt_use.h
r608 r652 128 128 bool get_paths (Use* to, UsePtrVector& list); 129 129 130 bool located () const;131 132 void change_path (const cmt_string& path );130 inline bool located () const { return m_located; } 131 132 void change_path (const cmt_string& path, const Project* project = 0); 133 133 void set_auto_imports (State context_state, State specified_state, 134 134 cmt_map <Use*, bool>& visited); … … 153 153 ScopeType get_current_scope () const; 154 154 155 Project* get_project (); 155 const Project* get_project () const; 156 inline void set_project (const Project* project) { m_project = project; } 156 157 cmt_string get_info () const; 157 158 bool is_head_version (const cmt_string& version); … … 182 183 bool discarded; /* discarded by version strategy */ 183 184 bool selected; /* used for recursive access */ 184 bool m_located;185 // bool m_located; 185 186 bool m_hidden; 186 187 ScopeType initial_scope; … … 213 214 bool skip_discarded = false, ostream& out = cout); 214 215 // void show_sub_uses (const cmt_string& request, bool skip_discarded = false); 215 bool select_alternate ( );216 bool select_alternate (const Project* project = 0); 216 217 Use* get_selected_version (); 217 218 Use* set_selected_version (Use* selected_use); … … 235 236 //cmt_string m_package_name; /* directly read from requirements */ 236 237 238 // Project* m_project; /* the project the use is found in */ 239 const Project* m_project; /* the project the use is found in */ 240 241 bool m_located; 242 237 243 bool m_has_native_version; 238 244 -
CMT/HEAD/src/Makefile.header
r616 r652 198 198 @echo 199 199 ifndef BCAST_GLOBAL 200 @uses=`$(cmtexe) -private show macros '_project$$|package$$ ' -tag=$(tags)| \201 awk -F = '{if ($$1 ~ /_project$$/) { uses[substr($$1,1,length($$1)-8)]=$$2}else if ($$1 == "package") {cur = $$2;gsub("'\''","",cur)}}END{for (u in uses){if (uses[u]==uses[cur]) print u}}'`; \200 @uses=`$(cmtexe) -private show macros '_project$$|package$$|_offset$$' -tag=$(tags)| \ 201 awk -F = '{if ($$1 ~ /_project$$/) {p = $$2;gsub("'\''","",p);uses[substr($$1,1,length($$1)-8)]=p} else if ($$1 == "package") {cur = $$2;gsub("'\''","",cur)}else if ($$1 ~ /_offset$$/) {u = substr($$1,1,length($$1)-7);if (!(u in uses))uses[u]=""}}END{for (u in uses){if ((uses[cur] != "" && uses[u] == uses[cur] || u == cur) && u != "CMT" && u != "CMTHOME" && u != "CMTUSERCONTEXT") print u}}'`; \ 202 202 for u in $${uses}; do \ 203 203 echo "$${u} : (re)build package $${u} ($(_groups))"; \ … … 208 208 done 209 209 else 210 @uses=`$(cmtexe) -private show macros '_ root$$' -tag=$(tags)| \211 awk -F = '{ u=substr($$1,1,length($$1)-5);if (u != "CMT" && u != "CMTHOME" && u != "CMTUSERCONTEXT") print u}'`; \210 @uses=`$(cmtexe) -private show macros '_project$$|package$$|_offset$$' -tag=$(tags)| \ 211 awk -F = '{if ($$1 ~ /_project$$/) {p = $$2;gsub("'\''","",p);uses[substr($$1,1,length($$1)-8)]=p} else if ($$1 == "package") {cur = $$2;gsub("'\''","",cur)}else if ($$1 ~ /_offset$$/) {u = substr($$1,1,length($$1)-7);if (!(u in uses))uses[u]=""}}END{for (u in uses){if (uses[u] != uses[cur] && (uses[u] == "CMTHOME" || uses[u] == "CMTUSERCONTEXT")) {continue} else if (u != "CMT" && u != "CMTHOME" && u != "CMTUSERCONTEXT") print u}}'`; \ 212 212 for u in $${uses}; do \ 213 213 echo "$${u} : (re)build package $${u} ($(_groups))"; \
Note: See TracChangeset
for help on using the changeset viewer.