#include <cmt_use.h>
Collaboration diagram for Use:
Public Types | |
typedef cmt_vector< Use > | UseVector |
typedef cmt_vector< Use * > | UsePtrVector |
Public Member Functions | |
Use () | |
Use (const cmt_string &new_package, const cmt_string &new_version, const cmt_string &new_path) | |
~Use () | |
void | set (const cmt_string &new_package, const cmt_string &new_version, const cmt_string &new_path, const cmt_string &new_version_alias="", const cmt_string &new_path_alias="") |
void | author_action (const CmtSystem::cmt_string_vector &words) |
void | manager_action (const CmtSystem::cmt_string_vector &words) |
bool | move_to () |
void | discard () |
void | undiscard () |
void | apply_global_patterns () |
void | set_include_path (const cmt_string &new_path) |
void | get_full_path (cmt_string &s) const |
Compute the full real path of a found package. | |
cmt_string | get_full_path () const |
Compute the full real path of a found package. | |
void | reduce_path (cmt_string &s) const |
Considering a given path, try and reduce the part of it that corresponds to the full path of this package into its normal form ${ROOT} The argument is modified if the pattern is exactly found. | |
void | get_cmtpath_and_offset (cmt_string &cmtpath, cmt_string &offset) const |
void | fill_includes_macro (cmt_string &buffer) const |
void | fill_macro (cmt_string &buffer, const cmt_string &suffix) const |
void | fill_standard_macros (cmt_string &buffer) const |
void | build_library_links (const cmt_string &cmtinstallarea, const cmt_string &tag, const cmt_string &shlibsuffix, const cmt_string &symlinkcmd) const |
Centralize the construction of library links for this Use. | |
bool | get_all_clients (const cmt_string &to_name) |
bool | get_paths (Use *to, UsePtrVector &list) |
Let's consider two packages in the use graph "this" and "to" This function finds all packages that are reached in between following all possible paths between "this" and "to". | |
bool | located () const |
void | change_path (const cmt_string &path) |
void | set_auto_imports (State new_state) |
void | set_native_version (bool state) |
bool | has_native_version () const |
Package * | get_package () const |
const cmt_string & | get_package_name () const |
void | set_package_name (const cmt_string &name) |
int | get_index () const |
void | show_cycles () |
void | push_scope_section (ScopeType type) |
void | pop_scope_section () |
void | close_scope_sections () |
ScopeType | get_current_scope () const |
Static Public Member Functions | |
Use * | action (const CmtSystem::cmt_string_vector &words, Use *use) |
Use * | find (const cmt_string &package, const cmt_string &version="", const cmt_string &path="") |
int | find_index (const cmt_string &package, const cmt_string &version, const cmt_string &path) |
void | set_auto_imports_state (int use_index, cmt_vector< bool > &auto_imports_states) |
1) Given a Use object identified by its index in the ordered_uses() array, 2) Given a vector of states containing the auto_imports states of all uses, | |
Use * | add (const cmt_string &path, const cmt_string &package, const cmt_string &version, const cmt_string &version_alias, const cmt_string &path_alias, Use *context_use, State specified_auto_imports=Unspecified) |
void | move (Use *use1) |
void | reorder (Use *use1, Use *use2) |
Reorder provider versus client in the UsePtrVector list, so that the order reflects the fact that client makes use of provider. | |
void | select_clients (const cmt_string &package, const cmt_string &version) |
Mark all clients of the current package. | |
void | show_all (bool skip_discarded=false) |
void | show_all (const cmt_string &prefix, bool skip_discarded=false) |
Use & | current () |
const Use & | const_current () |
UseVector & | get_instances () |
UsePtrVector & | get_ordered_uses () |
void | clear_all () |
void | unselect_all () |
void | undiscard_all () |
void | fill_macro_all (cmt_string &buffer, const cmt_string &suffix) |
Public Attributes | |
cmt_string | specified_version |
cmt_string | specified_path |
cmt_string | version_alias |
cmt_string | path_alias |
cmt_string | author |
cmt_string | manager |
cmt_string | path |
cmt_string | version |
cmt_string | real_path |
CmtDirStyle | style |
cmt_string | prefix |
bool | done |
bool | discarded |
bool | selected |
State | auto_imports |
Include::IncludeVector | includes |
cmt_string | include_path |
Script::ScriptVector | scripts |
ApplyPattern::ApplyPatternVector | apply_patterns |
IgnorePattern::IgnorePatternVector | ignore_patterns |
Private Member Functions | |
void | clear () |
int | reach_package (const cmt_string ¤t_path) |
void | select () |
void | unselect () |
bool | is_selected () |
bool | is_client (const cmt_string &package, const cmt_string &version) |
Check if the package makes use of the specified package/version. | |
void | show_sub_uses (const cmt_string &request, bool skip_discarded=false) |
bool | select_alternate () |
Use * | get_selected_version () |
This function tries to get the replacement of a Use when it has been discarded by a better match to version constraints. | |
Use * | set_selected_version (Use *selected_use) |
Switching from one use to another one, (better wrt various criteria). | |
bool | get_all_clients (Use *to, const cmt_string &result, cmt_map< cmt_string, Use * > &all_clients, cmt_map< cmt_string, Use * > &all_clients_ok) |
Static Private Member Functions | |
Use * | create (const cmt_string &path, const cmt_string &package, const cmt_string &version, const cmt_string &version_alias, const cmt_string &path_alias) |
bool | need_new (const cmt_string &path, const cmt_string &package, const cmt_string &version, Use **old_use, Use *context_use) |
Private Attributes | |
Package * | m_package |
bool | m_located |
bool | m_has_native_version |
UsePtrVector | sub_uses |
cmt_vector< ScopeType > | sub_use_scopes |
cmt_vector< State > | sub_use_auto_imports |
ScopeType | initial_scope |
cmt_vector< ScopeSection > | scope_sections |
CmtSystem::cmt_string_vector | alternate_versions |
CmtSystem::cmt_string_vector | alternate_paths |
CmtSystem::cmt_string_vector | requests |
int | m_index |
Friends | |
class | UseProjectAction |
|
|
Definition at line 23 of file cmt_use.h. Referenced by Database::all_uses(), clear_all(), create(), current(), and get_instances(). |
|
Definition at line 1279 of file cmt_use.cxx. References clear(), discarded, done, m_index, m_package, and Unspecified.
01280 { 01281 done = false; 01282 discarded = false; 01283 auto_imports = Unspecified; 01284 m_package = 0; 01285 m_index = -1; 01286 01287 clear (); 01288 } |
|
Definition at line 1291 of file cmt_use.cxx. References m_index, m_located, m_package, set(), and Unspecified.
01294 { 01295 auto_imports = Unspecified; 01296 m_located = false; 01297 m_package = 0; 01298 m_index = -1; 01299 01300 set (new_package, new_version, new_path); 01301 } |
|
Definition at line 1304 of file cmt_use.cxx. References clear().
01305 { 01306 clear (); 01307 } |
|
Definition at line 846 of file cmt_use.cxx. References CmtSystem::cmt_string_vector, Symbol::expand(), use_action_iterator::get_use(), use_action_iterator::ok(), use_action_iterator::set(), cmt_vector< T >::size(), and CmtSystem::split(). Referenced by KwdUse::action().
00847 { 00848 Use* new_use; 00849 00850 // 00851 // complete syntax : "use <package> <version> <path>" 00852 // minimal syntax : "use <package>" 00853 // 00854 // o if <version> is omitted then take any version available 00855 // o <version> can be specified using "v*" or "v<n>r*" or "v<n>r<m>p*" 00856 // 00857 // o the notation "v*" is preferred to omission (particularly since 00858 // omission does not permit <path>) 00859 // 00860 if (words.size () < 2) return (0); 00861 00862 use_action_iterator it; 00863 00864 for (int i = 1; i < words.size (); i++) 00865 { 00866 const cmt_string& w = words[i]; 00867 cmt_string ew = w; 00868 00869 Symbol::expand (ew); 00870 if (ew != w) 00871 { 00872 CmtSystem::cmt_string_vector ws; 00873 00874 CmtSystem::split (ew, " ", ws); 00875 00876 for (int j = 0; j < ws.size (); ++j) 00877 { 00878 const cmt_string& ww = ws[j]; 00879 it.set (ww); 00880 } 00881 } 00882 else 00883 { 00884 it.set (ew); 00885 } 00886 } 00887 00888 if (!it.ok ()) return (0); 00889 00890 static int level = 0; 00891 00892 level++; 00893 new_use = it.get_use (parent); 00894 level--; 00895 00896 return (new_use); 00897 } |
|
Definition at line 2303 of file cmt_use.cxx. References cmt_vector< T >::add(), CmtSystem::cd(), create(), current(), discard(), discarded, done, get_current_scope(), Cmt::get_debug(), CmtSystem::get_home_package(), get_ordered_uses(), get_package_name(), CmtSystem::get_project_package(), Cmt::get_quiet(), Cmt::get_recursive(), CmtSystem::get_user_context_package(), m_index, move_to(), need_new(), BestFitSelector::operate(), SyntaxParser::parse_requirements(), path, cmt_vector< State >::push_back(), cmt_vector< ScopeType >::push_back(), cmt_vector< T >::push_back(), CmtSystem::pwd(), requests, selected, set_selected_version(), show_packages(), cmt_vector< T >::size(), sub_use_auto_imports, sub_use_scopes, sub_uses, UsePtrVector, and version. Referenced by use_action_iterator::get_use(), Cmt::use_cmt(), and Cmt::use_special_requirements().
02310 { 02311 bool do_need_new = false; 02312 02313 Use* old_use = 0; 02314 Use* use = 0; 02315 02316 do_need_new = need_new (path, package_name, version, &old_use, context_use); 02317 02318 if (Cmt::get_debug ()) 02319 { 02320 if (old_use != 0) 02321 { 02322 cout << "add> old_use " << old_use->get_package_name () << 02323 " " << old_use->version << 02324 " " << old_use->path << 02325 endl; 02326 } 02327 } 02328 02329 if (do_need_new) 02330 { 02331 use = create (path, package_name, version, version_alias, path_alias); 02332 } 02333 else 02334 { 02335 // Since we don't need a new Use, it means that old_use exists ! 02336 use = old_use; 02337 old_use = 0; 02338 } 02339 02340 if (package_name == CmtSystem::get_home_package ()) 02341 { 02342 return (use); 02343 } 02344 02345 if (package_name == CmtSystem::get_user_context_package ()) 02346 { 02347 return (use); 02348 } 02349 02350 if (package_name == CmtSystem::get_project_package ()) 02351 { 02352 return (use); 02353 } 02354 02355 cmt_string here = CmtSystem::pwd (); 02356 02357 // 02358 // Store the specified sub_uses. Some of them may become discarded 02359 // later on. 02360 // 02361 if (context_use != 0) 02362 { 02363 context_use->sub_uses.push_back (use); 02364 02365 context_use->sub_use_scopes.push_back (context_use->get_current_scope ()); 02366 02367 context_use->sub_use_auto_imports.push_back (specified_auto_imports); 02368 02369 cmt_string& request = context_use->requests.add (); 02370 02371 request = package_name; 02372 request += " "; 02373 request += version; 02374 request += " "; 02375 request += path; 02376 02377 02378 if (Cmt::get_debug ()) 02379 { 02380 cout << "Use::add context(" << context_use->get_package_name () << ") " 02381 << "[u:" << package_name 02382 << " s:" << context_use->get_current_scope () 02383 << " ai:" << specified_auto_imports 02384 << "]" << endl; 02385 } 02386 } 02387 02388 if (use == &(Use::current ())) 02389 { 02390 return (use); 02391 } 02392 02393 /* 02394 * Now we have a Use object. If it is a new one, we have to 02395 * 1) understand if it exists physically 02396 * 2) it is better than the old ones. 02397 * 02398 * Here, we may have : 02399 * 1) old_use = 0 02400 * there was no Use object before for this package 02401 * the existing one is fine 02402 * 02403 * 2) old_use != 0 02404 * we have created a new Use (which has to be validated) 02405 */ 02406 02407 bool found = use->move_to (); 02408 02409 if (Cmt::get_debug ()) 02410 { 02411 cout << "add> use [" << use << "] " << use->get_package_name () 02412 << " " << use->version 02413 << " " << use->path 02414 << " found=" << found 02415 << " done=" << use->done 02416 << endl; 02417 02418 show_packages (); 02419 } 02420 02421 if (!found) 02422 { 02423 if (!Cmt::get_quiet ()) 02424 { 02425 cerr << "#CMT> Warning: package " << use->get_package_name () << 02426 " " << use->version << " " << use->path << 02427 " not found"; 02428 02429 if (context_use != 0) 02430 { 02431 cerr << " (requested by " << context_use->get_package_name () << ")"; 02432 } 02433 02434 cerr << endl; 02435 } 02436 02437 //CmtError::set (CmtError::package_not_found, use->get_package_name ()); 02438 use = 0; 02439 } 02440 02441 if ((old_use != 0) && (use != old_use)) 02442 { 02443 if (Cmt::get_debug ()) 02444 { 02445 cout << "There was another version of this Use. \n" 02446 << "But a new one was created due to some criteria. \n" 02447 << "Now we are going to apply the version strategy to make the final selection" 02448 << endl; 02449 } 02450 02451 /* 02452 * There was another version of this Use. 02453 * But a new one was created due to some criteria. 02454 * Now we are going to apply the version strategy to make the final selection. 02455 */ 02456 02457 if (Cmt::get_debug ()) 02458 { 02459 cout << "select? [" << use << "] vs old_use[" << old_use << "] " 02460 << old_use->get_package_name () 02461 << " " << old_use->version 02462 << " " << old_use->path 02463 << endl; 02464 } 02465 02466 if (!found) 02467 { 02468 /* 02469 * This new Use does not correspond to any physical package. 02470 * let's simply discard it (and go back to old_use) 02471 */ 02472 02473 if (use != 0) use->discard (); 02474 use = old_use; 02475 found = use->move_to (); 02476 } 02477 else 02478 { 02479 // 02480 // This new version is different from the old one 02481 // thus we have to choose 02482 // 02483 static BestFitSelector selector; 02484 Use* selected_use = selector.operate (old_use, use); 02485 02486 if (Cmt::get_debug ()) 02487 { 02488 cout << "after operate old=" << old_use << "(" << old_use->m_index << ")" 02489 << " use=" << use << "(" << use->m_index << ")" 02490 << " => selected=" << selected_use 02491 << endl; 02492 } 02493 02494 // 02495 // Some situations managed by selector.operate happen 02496 // to fail discarding the rejected Use. 02497 // 02498 if (use != selected_use) 02499 { 02500 use = use->set_selected_version (selected_use); 02501 } 02502 02503 02504 /* 02505 * current directory is moved to the selected one 02506 */ 02507 found = use->move_to (); 02508 } 02509 } 02510 02511 // 02512 // The following statement is no longer considered as useful. 02513 // It is commented. But we should clarify why it was really needed! 02514 // 02515 //use->undiscard (); 02516 02517 if (found) 02518 { 02519 static UsePtrVector& uses = get_ordered_uses (); 02520 02521 bool registered = false; 02522 const Use& cu = Use::current (); 02523 02524 Package* package = Package::find (package_name); 02525 02526 // 02527 // A pointer to this new object is also added or replaced. 02528 // 02529 if ((use != &cu) && (package == cu.get_package ())) 02530 { 02531 // This is a recursive call to the current package!! 02532 registered = true; 02533 use->done = true; 02534 use->m_index = -1; 02535 } 02536 else 02537 { 02538 // 02539 // Now sort out the registration in ordered uses 02540 // 02541 // cases: 02542 // 02543 // use is not yet registered (m_index < 0) 02544 // o if another use of the same package is registered, 02545 // it must be substituted with the new one 02546 // o otherwise create a new entry at the end (it will be sorted 02547 // afterwards) 02548 // 02549 // use is already registered (m_index >= 0) 02550 // o if another use of the same package is registered, 02551 // it must be discarded, but this may mean that 02552 // two versions are simultaneously registered (bug?) 02553 // o otherwise we keep it in place 02554 // 02555 02556 UsePtrVector& puses = package->get_uses (); 02557 02558 if (use->m_index >= 0) registered = true; 02559 02560 /* 02561 We look for all existing uses in that package. 02562 */ 02563 for (int i = 0; i < puses.size(); i++) 02564 { 02565 Use* u = puses[i]; 02566 02567 if (Cmt::get_debug ()) 02568 { 02569 cout << "add> check registering between " << use 02570 << ":" << use->get_package_name () 02571 << "(" << use->m_index << ")" 02572 << " and " << u 02573 << ":" << u->get_package_name () 02574 << "(" << u->m_index << ")" 02575 << endl; 02576 } 02577 02578 if ((u != use) && (u->m_index >= 0)) 02579 { 02580 // Another use of that package is already registered 02581 02582 if (Cmt::get_debug ()) 02583 { 02584 cout << "add> Another use of that package is already registered " 02585 << " use(" << use->m_index << ")"; 02586 if (use->m_index >= 0) 02587 { 02588 cout << "[" << (uses[use->m_index])->get_package_name () << "]"; 02589 } 02590 cout << " u(" << u->m_index << ")"; 02591 if (u->m_index >= 0) 02592 { 02593 cout << "[" << (uses[u->m_index])->get_package_name () << "]"; 02594 } 02595 cout << endl; 02596 } 02597 02598 if (use->m_index < 0) 02599 { 02600 /* 02601 the newly selected use (use) should replace the one which was registered (u) 02602 */ 02603 02604 u->set_selected_version (use); 02605 02606 registered = true; 02607 } 02608 else 02609 { 02610 // bug?? 02611 if (Cmt::get_debug ()) 02612 { 02613 cout << "Duplicate entry in ordered uses" << endl; 02614 } 02615 } 02616 } 02617 } 02618 02619 if (Cmt::get_debug ()) 02620 { 02621 cout << "add> registering completed" << endl; 02622 show_packages (); 02623 } 02624 } 02625 02626 if (!registered) 02627 { 02628 if (Cmt::get_debug ()) 02629 { 02630 cout << "add> We install use at the end the ordered list of uses" << endl; 02631 } 02632 02633 uses.push_back (use); 02634 use->m_index = uses.size () - 1; 02635 } 02636 02637 if (Cmt::get_debug ()) 02638 { 02639 for (int use_index = 0; use_index < uses.size (); use_index++) 02640 { 02641 Use* u = (Use*) uses[use_index]; 02642 cout << " use[" << use_index << "] p=(" << u << ")" << u->get_package_name () 02643 << " v=" << u->version 02644 << " discarded=" << u->discarded 02645 << " selected=" << u->selected 02646 << " done=" << u->done 02647 << " index=" << u->m_index 02648 << endl; 02649 } 02650 02651 } 02652 02653 if (!use->done && Cmt::get_recursive ()) 02654 { 02655 use->done = true; 02656 02657 if (Cmt::get_debug ()) 02658 { 02659 cout << "Parsing requirements file at " << CmtSystem::pwd () << endl; 02660 } 02661 02662 SyntaxParser::parse_requirements ("requirements", use); 02663 } 02664 else 02665 { 02666 if (Cmt::get_debug ()) 02667 { 02668 cout << "Requirements file at " << CmtSystem::pwd () << " already parsed" << endl; 02669 } 02670 } 02671 } 02672 02673 CmtSystem::cd (here); 02674 02675 return (use); 02676 } |
|
Definition at line 2748 of file cmt_use.cxx. References Pattern::apply(), Pattern::global, Pattern::patterns(), Pattern::PatternVector, and cmt_vector< T >::size().
02749 { 02750 int i; 02751 02752 Pattern::PatternVector& vector = Pattern::patterns (); 02753 02754 for (i = 0; i < vector.size (); i++) 02755 { 02756 Pattern& p = vector[i]; 02757 02758 if (p.global) 02759 { 02760 p.apply (this); 02761 } 02762 } 02763 } |
|
Definition at line 900 of file cmt_use.cxx. References author, CmtSystem::cmt_string_vector, and cmt_vector< T >::size(). Referenced by KwdAuthor::action().
|
|
Centralize the construction of library links for this Use.
We assume here that "library" contains a complete path. (including the complete syntax libxxx.so) Here we expect that only the base name of the library is given : ie it should not contain the "lib" prefix, nor the suffix .so, nor any path prefix. This of course should generally correspond to a constituent name. Definition at line 3127 of file cmt_use.cxx. References CmtSystem::absolute_path(), CmtSystem::basename(), Symbol::build_macro_value(), CmtSystem::cmt_string_vector, Symbol::expand(), Symbol::find(), get_package_name(), Cmt::get_quiet(), install_library(), located(), prefix, cmt_vector< T >::size(), and CmtSystem::split(). Referenced by Cmt::do_build_library_links().
03131 { 03132 if (!located ()) 03133 { 03134 if (!Cmt::get_quiet ()) 03135 { 03136 cout << "# package " << get_package_name () << 03137 " " << version << " " << path << 03138 " not found" << 03139 endl; 03140 } 03141 return; 03142 } 03143 03144 cmt_string s; 03145 03146 s = get_package_name (); 03147 s += "_libraries"; 03148 03149 Symbol* libraries_macro = Symbol::find (s); 03150 03151 if (libraries_macro == 0) return; 03152 03153 cmt_string libraries = libraries_macro->build_macro_value (); 03154 Symbol::expand (libraries); 03155 static CmtSystem::cmt_string_vector values; 03156 03157 CmtSystem::split (libraries, " \t", values); 03158 03159 for (int j = 0; j < values.size (); j++) 03160 { 03161 const cmt_string& library = values[j]; 03162 03163 static cmt_string libname; 03164 static cmt_string name; 03165 03166 // Is it a simple name or a complete path? 03167 03168 libname = library; 03169 Symbol::expand (libname); 03170 03171 bool is_absolute = false; 03172 03173 is_absolute = CmtSystem::absolute_path (libname); 03174 03175 if (is_absolute) 03176 { 03182 cmt_string suffix; 03183 CmtSystem::basename (library, name); 03184 } 03185 else 03186 { 03194 libname = "${"; 03195 libname += prefix; 03196 libname += "ROOT}/${"; 03197 libname += get_package_name (); 03198 libname += "_tag}/"; 03199 libname += "$(library_prefix)"; 03200 libname += library; 03201 libname += "$(library_suffix)"; 03202 libname += "."; 03203 libname += shlibsuffix; 03204 03205 name = "$(library_prefix)"; 03206 name += library; 03207 name += "$(library_suffix)"; 03208 name += "."; 03209 name += shlibsuffix; 03210 } 03211 03212 if (!install_library (libname, name, cmtinstallarea, tag, symlinkcmd)) 03213 { 03214 continue; 03215 } 03216 03217 #ifdef __APPLE__ 03218 if (!is_absolute) 03219 { 03220 libname = "${"; 03221 libname += prefix; 03222 libname += "ROOT}/${"; 03223 libname += get_package_name (); 03224 libname += "_tag}/"; 03225 libname += library; 03226 libname += ".bundle"; 03227 03228 name = library; 03229 name += ".bundle"; 03230 03231 if (!install_library (libname, name, cmtinstallarea, tag, symlinkcmd)) 03232 { 03233 continue; 03234 } 03235 } 03236 #endif 03237 } 03238 } |
|
Definition at line 1390 of file cmt_use.cxx. References CmtSystem::absolute_path(), CmtSystem::compress_path(), CmtSystem::file_separator(), m_located, real_path, and cmt_string::size(). Referenced by Cmt::configure(), Cmt::do_config(), move_to(), UseProjectAction::run(), and select_alternate().
01391 { 01392 // 01393 // This methods changes real_path after an actual location 01394 // where this package/version has been found. 01395 // 01396 01397 real_path = ""; 01398 01399 if (new_path != "") 01400 { 01401 if ((path.size () > 0) && 01402 (!CmtSystem::absolute_path (path))) 01403 { 01404 real_path = new_path; 01405 real_path += CmtSystem::file_separator (); 01406 real_path += path; 01407 } 01408 else 01409 { 01410 real_path = new_path; 01411 } 01412 // real_path.replace_all ("\\", "/"); 01413 01414 CmtSystem::compress_path (real_path); 01415 } 01416 01417 m_located = true; 01418 } |
|
|
Definition at line 1193 of file cmt_use.cxx. References cmt_vector< T >::clear(), clear(), get_instances(), get_ordered_uses(), cmt_vector< T >::size(), UsePtrVector, and UseVector. Referenced by Database::clear().
01194 { 01195 static UsePtrVector& uses = get_ordered_uses (); 01196 static UseVector& instances = get_instances (); 01197 01198 int use_index; 01199 01200 for (use_index = 0; use_index < instances.size (); use_index++) 01201 { 01202 Use& use = instances[use_index]; 01203 use.clear (); 01204 } 01205 01206 uses.clear (); 01207 instances.clear (); 01208 } |
|
Definition at line 432 of file cmt_use.cxx. References cmt_vector< ScopeSection >::clear(), and scope_sections. Referenced by SyntaxParser::parse_requirements().
00433 { 00434 scope_sections.clear (); 00435 } |
|
Definition at line 3801 of file cmt_use.cxx. References current().
03802 { 03803 const Use& use = Use::current (); 03804 03805 return (use); 03806 } |
|
Definition at line 2264 of file cmt_use.cxx. References cmt_vector< T >::add(), Package::add(), get_instances(), Package::get_uses(), set(), cmt_vector< T >::size(), specified_path, specified_version, UsePtrVector, and UseVector. Referenced by add().
02269 { 02270 Package* p = 0; 02271 02272 p = Package::add (package); 02273 02274 UsePtrVector& vector = p->get_uses (); 02275 02276 // We first look in the database. 02277 for (int use_index = 0; use_index < vector.size (); use_index++) 02278 { 02279 Use* use = vector[use_index]; 02280 02281 if ((use->specified_version == version) && 02282 (use->specified_path == path)) return (use); 02283 } 02284 02285 // We now really create a new Use entry. 02286 02287 static UseVector& instances = get_instances (); 02288 02289 Use& use_object = instances.add (); 02290 02291 use_object.set (package, version, path, version_alias, path_alias); 02292 02293 return (&use_object); 02294 } |
|
|
Definition at line 2679 of file cmt_use.cxx. References discarded. Referenced by add(), BestFitSelector::operate(), select_clients(), and set_selected_version().
02680 { 02681 discarded = true; 02682 } |
|
Definition at line 2879 of file cmt_use.cxx. References CmtSystem::file_separator(), get_package_name(), include_path, includes, Include::name, and cmt_vector< T >::size(). Referenced by StandardMacroBuilder::fill_for_all_constituents(), and StandardMacroBuilder::fill_for_use_includes().
02880 { 02881 if (include_path == "") 02882 { 02883 buffer += "$(ppcmd)\"$("; 02884 buffer += get_package_name (); 02885 buffer += "_root)"; 02886 buffer += CmtSystem::file_separator (); 02887 buffer += "src\" "; 02888 } 02889 else if (include_path != "none") 02890 { 02891 buffer += "$(ppcmd)\""; 02892 buffer += include_path; 02893 buffer += "\" "; 02894 } 02895 02896 for (int i = 0; i < includes.size (); i++) 02897 { 02898 Include& incl = includes[i]; 02899 02900 buffer += "$(ppcmd)\""; 02901 buffer += incl.name; 02902 buffer += "\" "; 02903 } 02904 } |
|
Definition at line 2907 of file cmt_use.cxx. References get_package_name(). Referenced by StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_use_libraries(), StandardMacroBuilder::fill_for_use_stamps(), and fill_macro_all().
02908 { 02909 buffer += " $("; 02910 buffer += get_package_name (); 02911 buffer += "_"; 02912 buffer += suffix; 02913 buffer += ") "; 02914 } |
|
|
Definition at line 2917 of file cmt_use.cxx. References CmtSystem::file_separator(), Project::find_by_cmtpath(), get_cmtpath_and_offset(), get_full_path(), Project::get_name(), get_package_name(), Project::get_release(), located(), no_version_style, prefix, real_path, and style. Referenced by SyntaxParser::parse_requirements().
02918 { 02919 static cmt_string fs = CmtSystem::file_separator (); 02920 02921 buffer = ""; 02922 02923 cmt_string package_name = get_package_name (); 02924 02925 buffer += "macro "; 02926 buffer += package_name; 02927 buffer += "_tag"; 02928 buffer += " \"$(tag)\""; 02929 buffer += "\n"; 02930 02931 if (located ()) 02932 { 02933 buffer += "macro "; 02934 buffer += prefix; 02935 buffer += "ROOT"; 02936 buffer += " \""; 02937 buffer += get_full_path (); 02938 buffer += "\""; 02939 buffer += "\n"; 02940 02941 buffer += "macro "; 02942 buffer += package_name; 02943 buffer += "_root"; 02944 buffer += " \""; 02945 buffer += real_path; 02946 buffer += fs; 02947 buffer += package_name; 02948 if (style != no_version_style) 02949 { 02950 buffer += fs; 02951 buffer += version; 02952 } 02953 buffer += "\""; 02954 buffer += "\n"; 02955 } 02956 02957 buffer += "macro "; 02958 buffer += prefix; 02959 buffer += "VERSION"; 02960 buffer += " \""; 02961 buffer += version; 02962 buffer += "\""; 02963 buffer += "\n"; 02964 02965 cmt_string cmtpath = ""; 02966 cmt_string offset = ""; 02967 02968 get_cmtpath_and_offset (cmtpath, offset); 02969 02970 buffer += "macro "; 02971 buffer += package_name; 02972 buffer += "_cmtpath"; 02973 buffer += " \""; 02974 buffer += cmtpath; 02975 buffer += "\""; 02976 buffer += "\n"; 02977 02978 buffer += "macro "; 02979 buffer += package_name; 02980 buffer += "_offset"; 02981 buffer += " \""; 02982 buffer += offset; 02983 buffer += "\""; 02984 buffer += "\n"; 02985 02986 Project* p = Project::find_by_cmtpath (cmtpath); 02987 02988 buffer += "macro "; 02989 buffer += package_name; 02990 buffer += "_project"; 02991 buffer += " \""; 02992 if (p != 0) 02993 { 02994 buffer += p->get_name (); 02995 } 02996 buffer += "\""; 02997 02998 buffer += "macro "; 02999 buffer += package_name; 03000 buffer += "_project_release"; 03001 buffer += " \""; 03002 if (p != 0) 03003 { 03004 buffer += p->get_release (); 03005 } 03006 buffer += "\""; 03007 } |
|
Definition at line 926 of file cmt_use.cxx. References Package::find(), Package::get_uses(), cmt_vector< T >::size(), specified_version, and UsePtrVector. Referenced by get_all_clients(), Fragment::locate(), and show_all().
00929 { 00930 Package* p = Package::find (package); 00931 if (p == 0) return (0); 00932 00933 UsePtrVector& uses = p->get_uses (); 00934 00935 int use_index; 00936 int size = uses.size (); 00937 00938 for (use_index = 0; use_index < size; use_index++) 00939 { 00940 Use& use = (*uses[use_index]); 00941 00942 // If the version argument is omitted then 00943 // take the first registered version 00944 if (version == "") return (&use); 00945 00946 // Otherwise compare against specified_version and path 00947 //if ((use.specified_version == version) && 00948 // (use.specified_path == path)) return (&use); 00949 00950 // what about comparing wild cards? 00951 00952 if (use.specified_version == version) return (&use); 00953 } 00954 00955 return (0); 00956 } |
|
Definition at line 959 of file cmt_use.cxx. References Cmt::get_debug(), m_index, cmt_vector< T >::size(), specified_version, and UsePtrVector. Referenced by StandardMacroBuilder::fill_for_all_constituents().
00962 { 00963 Package* package = Package::find (package_name); 00964 if (package == 0) return (-1); 00965 00966 UsePtrVector& uses = package->get_uses (); 00967 00968 int use_index; 00969 int size = uses.size (); 00970 for (use_index = 0; use_index < size; use_index++) 00971 { 00972 Use* use = uses[use_index]; 00973 00974 if (Cmt::get_debug ()) 00975 { 00976 cout << "Use::find_index> " << package_name 00977 << " " << use 00978 << " " << use->m_index 00979 << endl; 00980 } 00981 00982 // If the version argument is omitted then 00983 // take the first registered version 00984 if (version == "") return (use->m_index); 00985 00986 // Otherwise compare against specified_version and path 00987 //if ((use.specified_version == version) && 00988 // (use.specified_path == path)) return (&use); 00989 00990 // what about comparing wild cards? 00991 00992 if (use->specified_version == version) return (use->m_index); 00993 } 00994 00995 return (-1); 00996 } |
|
Definition at line 3431 of file cmt_use.cxx. References cmt_map< K, T >::add(), auto_imports, discarded, get_all_clients(), get_ordered_uses(), get_package_name(), cmt_map< K, T >::has(), initial_scope, is_client(), located(), Off, ScopePublic, ScopeUnspecified, cmt_vector< T >::size(), UsePtrVector, and version.
03435 { 03436 if (this == to) 03437 { 03438 cout << result << endl; 03439 return (true); 03440 } 03441 03442 const cmt_string& to_name = to->get_package_name (); 03443 const cmt_string& to_version = to->version; 03444 03445 //cout << "gac> from " << get_package_name () << " to " << to_name << " -> " << result << endl; 03446 03447 if (all_clients.has (to_name)) 03448 { 03449 if (all_clients_ok.has (to_name)) 03450 { 03451 cout << " ..." << result << endl; 03452 return (true); 03453 } 03454 else 03455 { 03456 return (false); 03457 } 03458 } 03459 03460 all_clients.add (to_name, to); 03461 03462 bool status = false; 03463 03464 Use::UsePtrVector& uses = Use::get_ordered_uses (); 03465 Use* use = 0; 03466 03467 for (int n = 0; n < uses.size (); ++n) 03468 { 03469 use = uses[n]; 03470 03471 if (use->discarded) continue; 03472 03473 if (!use->located ()) continue; 03474 03475 if (use == to) continue; 03476 03477 if (use->is_client (to_name, to_version)) 03478 { 03479 const cmt_string& n = use->get_package_name (); 03480 03481 cmt_string r; 03482 03483 if ((use->initial_scope != ScopeUnspecified) && 03484 (use->initial_scope != ScopePublic)) 03485 { 03486 r += "(private)"; 03487 } 03488 03489 if (use->auto_imports == Off) r += "(no_auto_imports)"; 03490 03491 r += n; 03492 r += "."; 03493 r += result; 03494 03495 //cout << "gac> " << n << " is client of " << to_name << endl; 03496 03497 if (get_all_clients (use, r, all_clients, all_clients_ok)) 03498 { 03499 all_clients_ok.add (n, use); 03500 status = true; 03501 } 03502 } 03503 } 03504 03505 use = this; 03506 03507 if (use->is_client (to_name, to_version)) 03508 { 03509 const cmt_string& n = use->get_package_name (); 03510 03511 cmt_string r; 03512 03513 if ((use->initial_scope != ScopeUnspecified) && 03514 (use->initial_scope != ScopePublic)) 03515 { 03516 r += "(private)"; 03517 } 03518 03519 if (use->auto_imports == Off) r += "(no_auto_imports)"; 03520 03521 r += n; 03522 r += "."; 03523 r += result; 03524 03525 //cout << "gac> " << n << " is client of " << to_name << endl; 03526 03527 if (get_all_clients (use, r, all_clients, all_clients_ok)) 03528 { 03529 all_clients_ok.add (n, use); 03530 status = true; 03531 } 03532 } 03533 03534 return (status); 03535 } |
|
Definition at line 3403 of file cmt_use.cxx. References cmt_map< K, T >::add(), find(), get_ordered_uses(), get_package_name(), and UsePtrVector. Referenced by Cmt::do_show_use_paths(), and get_all_clients().
03404 { 03405 Use::UsePtrVector& uses = Use::get_ordered_uses (); 03406 03407 Use* use = Use::find (to_name); 03408 03409 if (use == 0) 03410 { 03411 cerr << "#CMT> No access to " << to_name << endl; 03412 return (false); 03413 } 03414 03415 cmt_map <cmt_string, Use*> all_clients; 03416 cmt_map <cmt_string, Use*> all_clients_ok; 03417 03418 const cmt_string& name = get_package_name (); 03419 03420 Use* me = this; 03421 03422 all_clients.add (name, me); 03423 all_clients_ok.add (name, me); 03424 03425 bool status = get_all_clients (use, to_name, all_clients, all_clients_ok); 03426 03427 return (status); 03428 } |
|
Definition at line 2827 of file cmt_use.cxx. References CmtSystem::compress_path(), CmtSystem::dirname(), CmtSystem::file_separator(), Project::find_in_cmt_paths(), CmtSystem::get_home_package(), get_package_name(), CmtSystem::get_project_package(), CmtSystem::get_user_context_package(), real_path, and cmt_string::replace(). Referenced by KwdSetupStrategy::action(), KwdBuildStrategy::action(), and fill_standard_macros().
02828 { 02829 if (get_package_name () == CmtSystem::get_project_package ()) 02830 { 02831 offset = ""; 02832 CmtSystem::dirname (path, cmtpath); 02833 return; 02834 } 02835 else if (get_package_name () == CmtSystem::get_home_package ()) 02836 { 02837 offset = ""; 02838 cmtpath = path; 02839 return; 02840 } 02841 else if (get_package_name () == CmtSystem::get_user_context_package ()) 02842 { 02843 offset = ""; 02844 cmtpath = path; 02845 return; 02846 } 02847 02848 cmtpath = ""; 02849 offset = ""; 02850 02851 cmtpath = Project::find_in_cmt_paths (real_path); 02852 02853 if (cmtpath != "") 02854 { 02855 CmtSystem::compress_path (cmtpath); 02856 02857 static const cmt_string empty_string; 02858 static const cmt_string fs = CmtSystem::file_separator (); 02859 02860 offset = real_path; 02861 offset.replace (cmtpath, empty_string); 02862 02869 if (offset[0] == CmtSystem::file_separator ()) 02870 { 02871 // Just in case there is a part left after removing the cmtpath entry 02872 02873 offset.replace (fs, empty_string); 02874 } 02875 } 02876 } |
|
Definition at line 438 of file cmt_use.cxx. References cmt_vector< ScopeSection >::back(), ScopeSection::get_scope(), initial_scope, scope_sections, ScopeType, and cmt_vector< ScopeSection >::size(). Referenced by Symbol::action(), Fragment::action(), add(), Symbol::create(), and use_action_iterator::get_use().
00439 { 00440 if (scope_sections.size () == 0) return (initial_scope); 00441 const ScopeSection& s = scope_sections.back (); 00442 return (s.get_scope ()); 00443 } |
|
Compute the full real path of a found package. Takes the structuring style into account Definition at line 2797 of file cmt_use.cxx. Referenced by fill_standard_macros(), and reduce_path().
02798 { 02799 cmt_string result; 02800 02801 get_full_path (result); 02802 02803 return (result); 02804 } |
|
Compute the full real path of a found package. Takes the structuring style into account Result is used to fill in the referenced string Result does NOT include the trailing file_separator Definition at line 2778 of file cmt_use.cxx. References CmtSystem::file_separator(), get_package_name(), no_version_style, CmtSystem::pwd(), real_path, and style. Referenced by MakeSetupGenerator::build(), Cmt::do_broadcast(), Fragment::locate(), CmtGenerator::prepare_use_context(), and Cmt::print_context().
02779 { 02780 if (real_path == "") s = CmtSystem::pwd (); 02781 else s = real_path; 02782 02783 s += CmtSystem::file_separator (); 02784 s += get_package_name (); 02785 02786 if (style != no_version_style) 02787 { 02788 s += CmtSystem::file_separator (); 02789 s += version; 02790 } 02791 } |
|
Definition at line 3397 of file cmt_use.cxx. References m_index. Referenced by use_action_iterator::get_use(), and show_all().
03398 { 03399 return (m_index); 03400 } |
|
Definition at line 3809 of file cmt_use.cxx. References Database::all_uses(), Database::instance(), and UseVector. Referenced by clear_all(), create(), and current().
03810 { 03811 static Database& db = Database::instance (); 03812 static UseVector& instances = db.all_uses (); 03813 03814 return (instances); 03815 } |
|
|
Definition at line 3374 of file cmt_use.cxx. References m_package. Referenced by Script::all_print(), Script::all_print_clean(), DependencyGenerator::build(), ReadmeGenerator::build(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_use_includes(), StandardMacroBuilder::fill_for_use_libraries(), StandardMacroBuilder::fill_for_use_stamps(), fill_macro_all(), use_action_iterator::get_use(), is_client(), Include::print_all(), and Cmt::print_clean().
03375 { 03376 return (m_package); 03377 } |
|
|
Let's consider two packages in the use graph "this" and "to" This function finds all packages that are reached in between following all possible paths between "this" and "to". Result s accumulated into "list" If this use is already in the list, we don't duplicate the entry. (protection duplicate paths in the graph) Now "this" is a candidate new entry in the list Let's scan sub_uses now No way to find a valid use for this used package. Is that a bug? Anyway we don't pursue on that branch. Definition at line 3544 of file cmt_use.cxx. References discarded, Cmt::get_debug(), get_package_name(), get_selected_version(), cmt_vector< T >::push_back(), selected, cmt_vector< T >::size(), sub_uses, unselect_all(), and UsePtrVector. Referenced by PatternCache::do_update().
03545 { 03546 bool is_in_path = false; 03547 bool cycle = false; 03548 bool already_in_path = false; 03549 bool dbg = Cmt::get_debug (); 03550 03551 static int level = 0; 03552 03553 int size = 0; 03554 03555 if (level == 0) 03556 { 03557 unselect_all (); 03558 selected = false; 03559 } 03560 03561 if (selected) 03562 { 03568 size = list.size (); 03569 03570 for (int m = 0; m < size; m++) 03571 { 03572 Use* u = list[m]; 03573 if (u == this) 03574 { 03575 if (dbg) 03576 { 03577 for (int lll = 0; lll < level; lll++) cout << " "; 03578 cout << " Use::get_paths." << level << "> try1.2 sub=" 03579 << get_package_name () << " already_in_path " << endl; 03580 } 03581 03582 return (true); 03583 } 03584 } 03585 03586 return (false); 03587 } 03588 03589 selected = true; 03590 03591 if (dbg) 03592 { 03593 for (int lll = 0; lll < level; lll++) cout << " "; 03594 cout << "Use::get_paths." << level << ">" << get_package_name () 03595 << " to=" << to->get_package_name () 03596 << " list=["; 03597 03598 for (int m = 0; m < list.size (); m++) 03599 { 03600 Use* u = list[m]; 03601 cout << u->get_package_name () << " "; 03602 } 03603 03604 cout << "]" << endl; 03605 } 03606 03611 // First figure out whether 'to' is used by 'this'. 03612 03613 if (this->get_package_name () == to->get_package_name ()) 03614 { 03615 // We've reached the goal (for the first time) 03616 is_in_path = true; 03617 } 03618 else 03619 { 03623 size = sub_uses.size (); 03624 03625 if (dbg) 03626 { 03627 for (int lll = 0; lll < level; lll++) cout << " "; 03628 cout << " Use::get_paths." << level << "> size=" << size << endl; 03629 } 03630 03631 for (int n = 0; n < size; n++) 03632 { 03633 Use* use = sub_uses[n]; 03634 03635 if (use == 0) continue; 03636 03637 if (dbg) 03638 { 03639 for (int lll = 0; lll < level; lll++) cout << " "; 03640 cout << " Use::get_paths." << level << "> try1 sub=" 03641 << use->get_package_name () << "(" << use << ") " << use->discarded << endl; 03642 } 03643 03644 if (use->discarded) 03645 { 03646 Use* u; 03647 03648 u = use->get_selected_version (); 03649 if (u == 0) 03650 { 03656 continue; 03657 } 03658 03659 use = u; 03660 } 03661 03662 if (dbg) 03663 { 03664 for (int lll = 0; lll < level; lll++) cout << " "; 03665 cout << " Use::get_paths." << level << "> try2 sub=" 03666 << use->get_package_name () << " " << use->discarded << endl; 03667 } 03668 03669 level++; 03670 bool r = use->get_paths (to, list); 03671 level--; 03672 03673 if (r) 03674 { 03675 is_in_path = true; 03676 } 03677 } 03678 } 03679 03680 if (is_in_path) 03681 { 03682 if (dbg) 03683 { 03684 for (int lll = 0; lll < level; lll++) cout << " "; 03685 cout << "Use::get_paths." << level << "> push " << get_package_name () << endl; 03686 } 03687 list.push_back (this); 03688 } 03689 03690 return (is_in_path); 03691 } |
|
This function tries to get the replacement of a Use when it has been discarded by a better match to version constraints.
Definition at line 3244 of file cmt_use.cxx. References discarded, Cmt::get_debug(), get_package_name(), Package::get_uses(), m_package, cmt_vector< T >::size(), and UsePtrVector. Referenced by get_paths(), and show_cycles().
03245 { 03246 //cout << "get_selected_version for package " << get_package_name () << endl; 03247 03248 if (!discarded) return (this); 03249 03250 Package* p = m_package; 03251 03252 Use::UsePtrVector& uses = p->get_uses (); 03253 03254 bool dbg = Cmt::get_debug (); 03255 03256 int size = uses.size (); 03257 03258 for (int i = 0; i < size; i++) 03259 { 03260 Use* u = uses[i]; 03261 if (u == 0) continue; 03262 if (u->discarded) continue; 03263 if (dbg) 03264 { 03265 cout << "Use::get_selected_version> for package " << get_package_name () 03266 << " got a version " << u << endl; 03267 } 03268 return (u); 03269 } 03270 03271 return (0); 03272 } |
|
Definition at line 3369 of file cmt_use.cxx. References m_has_native_version.
03370 { 03371 return (m_has_native_version); 03372 } |
|
Check if the package makes use of the specified package/version. The seach only considers the first level of uses (thus it is NOT recursive) Definition at line 2714 of file cmt_use.cxx. References get_package(), and version. Referenced by get_all_clients(), and select_clients().
02716 { 02717 // A package is client of itself 02718 02719 Package* package = Package::find (used_package); 02720 02721 if ((get_package () == package) && 02722 (version == used_version)) return (true); 02723 02724 if (discarded) return (false); 02725 02726 int i; 02727 02728 for (i = 0; i < sub_uses.size (); i++) 02729 { 02730 Use* use = sub_uses[i]; 02731 if (use == 0) continue; 02732 02733 if ((use->get_package () == package) && 02734 (use->version == used_version)) return (true); 02735 02736 /* 02737 if (use->is_client (used_package, used_version)) 02738 { 02739 return (true); 02740 } 02741 */ 02742 } 02743 02744 return (false); 02745 } |
|
Definition at line 2703 of file cmt_use.cxx. References selected. Referenced by select_clients().
02704 { 02705 return (selected); 02706 } |
|
Definition at line 3694 of file cmt_use.cxx. References m_located. Referenced by build_library_links(), Cmt::do_broadcast(), Cmt::do_remove_library_links(), StandardMacroBuilder::fill_for_use_requirements(), fill_standard_macros(), get_all_clients(), and show_all().
03695 { 03696 return (m_located); 03697 } |
|
Definition at line 913 of file cmt_use.cxx. References CmtSystem::cmt_string_vector, manager, and cmt_vector< T >::size(). Referenced by KwdManager::action().
|
|
Definition at line 1084 of file cmt_use.cxx. References get_ordered_uses(), m_index, cmt_vector< T >::size(), and UsePtrVector. Referenced by show_all().
01085 { 01086 if (use == 0) return; 01087 01088 static UsePtrVector& uses = get_ordered_uses (); 01089 01090 int size = uses.size (); 01091 01092 if (size == 0) return; 01093 01094 // 01095 // On se positionne sur le pointeur. 01096 // 01097 01098 int use_index = use->m_index; 01099 01100 if (use_index < 0) return; 01101 01102 // 01103 // On deplace tous les pointeurs d'une case en arriere 01104 // 01105 for (use_index++; use_index < size; use_index++) 01106 { 01107 Use* u = uses[use_index]; 01108 u->m_index--; 01109 01110 uses[use_index - 1] = uses[use_index]; 01111 } 01112 01113 // 01114 // use est donc replace en derniere position 01115 // 01116 01117 use->m_index = size - 1; 01118 uses[size - 1] = use; 01119 } |
|
Definition at line 1761 of file cmt_use.cxx. References CmtSystem::absolute_path(), alternate_versions, Project::broadcast(), change_path(), UseProjectAction::found(), Cmt::get_debug(), m_located, reach_package(), real_path, select_alternate(), and cmt_vector< T >::size(). Referenced by add(), and Cmt::reach_current_package().
01762 { 01763 if (m_located) 01764 { 01765 // 01766 // The real path where this version/package can be found 01767 // has already been resolved. We thus first go there. 01768 // 01769 01770 if (Cmt::get_debug ()) 01771 { 01772 cout << "move_to1> " << real_path << endl; 01773 } 01774 01775 reach_package (real_path); 01776 01777 return (true); 01778 } 01779 01780 cmt_string expanded_path = path; 01781 01782 // 01783 // Try here. 01784 // 01785 if (expanded_path == "") 01786 { 01787 if (reach_package ("")) 01788 { 01789 if (Cmt::get_debug ()) 01790 { 01791 cout << "move_to2> " << expanded_path << endl; 01792 } 01793 01794 change_path (expanded_path); 01795 01796 return (true); 01797 } 01798 else if (alternate_versions.size () > 0) 01799 { 01800 if (select_alternate ()) 01801 { 01802 if (Cmt::get_debug ()) 01803 { 01804 cout << "move_to5> " << real_path << endl; 01805 } 01806 01807 return (true); 01808 } 01809 } 01810 } 01811 01812 // 01813 // If the path specified in this use is a true absolute path, 01814 // then we search the package from there first. 01815 // 01816 if (CmtSystem::absolute_path (expanded_path)) 01817 { 01818 if (reach_package (expanded_path)) 01819 { 01820 if (Cmt::get_debug ()) 01821 { 01822 cout << "move_to3> " << expanded_path << endl; 01823 } 01824 01825 change_path (expanded_path); 01826 01827 return (true); 01828 } 01829 else if (alternate_versions.size () > 0) 01830 { 01831 if (select_alternate ()) 01832 { 01833 if (Cmt::get_debug ()) 01834 { 01835 cout << "move_to5> " << real_path << endl; 01836 } 01837 01838 return (true); 01839 } 01840 } 01841 } 01842 01843 // 01844 // Second try is among the CMTPATHs 01845 // 01846 01847 UseProjectAction pa (this); 01848 01849 Project::broadcast (pa); 01850 01851 if (pa.found ()) return (true); 01852 01853 return (false); 01854 } |
|
Definition at line 1952 of file cmt_use.cxx. References add_request(), and current(). Referenced by add().
01957 { 01958 bool new_request = add_request (path, package, version); 01959 01960 Use& current_use = Use::current (); 01961 01962 if (package == current_use.get_package_name ()) 01963 { 01964 if (Cmt::get_debug ()) 01965 { 01966 cout << " ... recursive use to current package" << endl; 01967 } 01968 01969 if (old_use != 0) *old_use = ¤t_use; 01970 return (false); 01971 } 01972 01973 Package* p = Package::add (package); 01974 01975 UsePtrVector& uses = p->get_uses (); 01976 01977 bool do_need_new = true; 01978 Use* found = 0; 01979 Use* registered = 0; 01980 01981 int req_v = -1; 01982 int req_r = -1; 01983 int req_p = -1; 01984 01985 CmtSystem::is_version_directory (version, req_v, req_r, req_p); 01986 01987 if (Cmt::get_debug ()) 01988 { 01989 cout << "need_new> p=" << package << " v=" << version << " v=" << req_v << " r=" << req_r << " p=" << req_p << endl; 01990 } 01991 01992 bool has_wild_card = (req_v == -1) || (req_r == -1) || (req_p == -1); 01993 01994 int new_v = -1; 01995 int new_r = -1; 01996 int new_p = -1; 01997 01998 int use_index; 01999 02000 if (old_use != 0) *old_use = 0; 02001 02002 // Acquire the registered use. 02003 for (use_index = 0; use_index < uses.size (); use_index++) 02004 { 02005 Use& use = (*uses[use_index]); 02006 02007 if (use.m_index < 0) continue; 02008 02009 registered = &use; 02010 02011 break; 02012 } 02013 02014 // Make a first try with the registered use if it exists. 02015 02016 cmt_string decision; 02017 02018 if (registered != 0) 02019 { 02020 Use& use = (*registered); 02021 02022 found = &use; 02023 02024 CmtSystem::is_version_directory (use.specified_version, new_v, new_r, new_p); 02025 02026 bool use_has_wild_card = (new_v == -1) || (new_r == -1) || (new_p == -1); 02027 02028 if (has_wild_card && !use_has_wild_card) 02029 { 02030 if (Cmt::get_debug ()) 02031 { 02032 cout << " ... wildcarded request loses against existing explicit" << endl; 02033 } 02034 02035 do_need_new = false; // We don't need a new one 02036 } 02037 else 02038 { 02039 // here either !has_wild_card or use_has_wild_card 02040 02041 if ((version == use.specified_version) && 02042 (path == use.specified_path)) 02043 { 02044 if (Cmt::get_debug ()) 02045 { 02046 cout << " ... exactly same version and path!" << endl; 02047 } 02048 02049 do_need_new = false; // We don't need a new one 02050 } 02051 else if (version != use.specified_version) 02052 { 02053 if (Cmt::get_debug ()) 02054 { 02055 cout << "requested explicit wins against existing wildcarded" 02056 << endl; 02057 } 02058 02059 // The registered use loses against the request 02060 } 02061 else 02062 { 02063 if (Cmt::get_debug ()) 02064 { 02065 cout << "only paths differ, consider the new one." 02066 << endl; 02067 } 02068 02069 // The registered use loses against the request 02070 } 02071 } 02072 02073 02074 //if (new_request && !Cmt::get_quiet () && (Cmt::get_action () == action_show_uses)) 02075 if (new_request && !Cmt::get_quiet ()) 02076 { 02077 if ((new_v != -1) && (req_v != -1) && (new_v != req_v)) 02078 { 02079 cout << "# Required version " << version 02080 << " of package " << package; 02081 02082 if (context_use != 0) 02083 { 02084 cout << " [from " << context_use->get_package_name () << "]"; 02085 } 02086 02087 cout << " incompatible with selected version " << use.version; 02088 02089 if (use.version != use.specified_version) 02090 { 02091 cout << " (" << use.specified_version << ")" ; 02092 } 02093 02094 cout << endl; 02095 } 02096 } 02097 02098 if (Cmt::get_debug ()) 02099 { 02100 cout << "# " << package << " " << version; 02101 02102 if (context_use != 0) 02103 { 02104 cout << " [from " << context_use->get_package_name () << "]"; 02105 } 02106 02107 if (do_need_new) 02108 { 02109 cout << " > "; 02110 } 02111 else 02112 { 02113 cout << " < "; 02114 } 02115 02116 cout << use.version; 02117 if (use.version != use.specified_version) 02118 { 02119 cout << " (" << use.specified_version << ")" ; 02120 } 02121 02122 cout << " (r) "; 02123 02124 cout << endl; 02125 } 02126 } 02127 02128 if (do_need_new) 02129 { 02130 // Now try unregistered uses, since the registered one is not appropriate. 02131 // to see is any other existing use could match 02132 02133 for (use_index = 0; use_index < uses.size (); use_index++) 02134 { 02135 Use& use = (*uses[use_index]); 02136 02137 if (use.m_index >= 0) continue; 02138 02139 // Always save the latest found. 02140 02141 found = &use; 02142 02143 CmtSystem::is_version_directory (use.specified_version, new_v, new_r, new_p); 02144 02145 bool use_has_wild_card = (new_v == -1) || (new_r == -1) || (new_p == -1); 02146 02147 if (has_wild_card && !use_has_wild_card) 02148 { 02149 if (Cmt::get_debug ()) 02150 { 02151 cout << " ... requested wildcarded loses against existing explicit" << endl; 02152 } 02153 02154 do_need_new = false; // We don't need a new one 02155 } 02156 else 02157 { 02158 // here either !has_wild_card or use_has_wild_card 02159 02160 if ((version == use.specified_version) && 02161 (path == use.specified_path)) 02162 { 02163 if (Cmt::get_debug ()) 02164 { 02165 cout << " ... exactly same version and path!" << endl; 02166 } 02167 02168 do_need_new = false; // We don't need a new one 02169 } 02170 else if (version != use.specified_version) 02171 { 02172 if (Cmt::get_debug ()) 02173 { 02174 cout << "requested explicit wins against existing wildcarded" 02175 << endl; 02176 } 02177 02178 // This use loses against the request 02179 } 02180 else 02181 { 02182 if (Cmt::get_debug ()) 02183 { 02184 cout << "only paths differ, consider the new one." 02185 << endl; 02186 } 02187 02188 // This use loses against the request 02189 } 02190 } 02191 02192 //if (new_request && !Cmt::get_quiet () && (Cmt::get_action () == action_show_uses)) 02193 if (new_request && !Cmt::get_quiet ()) 02194 { 02195 if ((new_v != -1) && (req_v != -1) && (new_v != req_v)) 02196 { 02197 cout << "# Required version " << version 02198 << " of package " << package; 02199 02200 if (context_use != 0) 02201 { 02202 cout << " [from " << context_use->get_package_name () << "]"; 02203 } 02204 02205 cout << " incompatible with selected version " << use.version; 02206 02207 if (use.version != use.specified_version) 02208 { 02209 cout << " (" << use.specified_version << ")" ; 02210 } 02211 02212 cout << endl; 02213 } 02214 } 02215 02216 if (Cmt::get_debug ()) 02217 { 02218 cout << "# " << package << " " << version; 02219 02220 if (context_use != 0) 02221 { 02222 cout << " [from " << context_use->get_package_name () << "]"; 02223 } 02224 02225 if (do_need_new) 02226 { 02227 cout << " > "; 02228 } 02229 else 02230 { 02231 cout << " < "; 02232 } 02233 02234 if ((new_v != -1) && (req_v != -1) && (new_v != req_v)) 02235 { 02236 cout << "(incompatible) "; 02237 } 02238 02239 cout << use.version; 02240 if (use.version != use.specified_version) 02241 { 02242 cout << " (" << use.specified_version << ")" ; 02243 } 02244 cout << endl; 02245 } 02246 } 02247 } 02248 02249 if (old_use != 0) 02250 { 02251 if (registered != 0) *old_use = registered; 02252 else *old_use = found; 02253 } 02254 02255 return (do_need_new); 02256 } |
|
Definition at line 426 of file cmt_use.cxx. References cmt_vector< ScopeSection >::pop_back(), and scope_sections. Referenced by KwdEndPublic::action(), and KwdEndPrivate::action().
00427 { 00428 scope_sections.pop_back (); 00429 } |
|
Definition at line 420 of file cmt_use.cxx. References cmt_vector< ScopeSection >::push_back(), and scope_sections. Referenced by KwdPublic::action(), and KwdPrivate::action().
00421 { 00422 scope_sections.push_back (type); 00423 } |
|
Definition at line 1421 of file cmt_use.cxx. References CmtSystem::absolute_path(), cmt_vector< T >::add(), alternate_paths, alternate_versions, CmtSystem::basename(), CmtSystem::cd(), CmtSystem::cmt_string_vector, cmt_style, compare_versions(), CompareStatus, discarded, cmt_string::erase(), ExplicitNewMajorIdWinsAgainstWildarded, ExplicitNewMinorIdWinsAgainstWildarded, ExplicitNewPatchIdWinsAgainstWildarded, ExplicitOldMajorIdWinsAgainstWildarded, ExplicitOldMinorIdWinsAgainstWildarded, ExplicitOldPatchIdWinsAgainstWildarded, CmtSystem::file_separator(), cmt_string::find(), Cmt::get_debug(), CmtSystem::get_home_package(), get_package_name(), CmtSystem::get_project_package(), CmtSystem::get_user_context_package(), IdenticalIds, IncompatibleMajorIds, CmtSystem::is_version_directory(), mgr_style, NewMajorIdGreaterThanOld, NewMinorIdGreaterThanOld, NewPatchIdGreaterThanOld, no_version_style, OldMajorIdGreaterThanNew, cmt_string::read(), real_path, CmtSystem::scan_dir(), cmt_vector< T >::size(), cmt_string::size(), style, and CmtSystem::test_file(). Referenced by move_to(), UseProjectAction::run(), and select_alternate().
01422 { 01423 if (Cmt::get_debug ()) 01424 { 01425 cout << "Use::reach_package> (" << get_package_name () << " " 01426 << version << ")from " << from_path << endl; 01427 } 01428 01429 // 01430 // We try to reach a package/version starting from from_path 01431 // 01432 01433 // check if from_path is at least real 01434 if ((from_path != "") && !CmtSystem::cd (from_path)) return (0); 01435 01436 if (Cmt::get_debug ()) 01437 { 01438 cout << "Use::reach_package-2>" << endl; 01439 } 01440 01441 // check in case from_path is a new search path 01442 if (from_path != real_path) 01443 { 01444 // Move to that prefix only if it is a relative path. 01445 if ((path.size () > 0) && (!CmtSystem::absolute_path (path))) 01446 { 01447 if (!CmtSystem::cd (path)) 01448 { 01449 return (0); 01450 } 01451 } 01452 } 01453 01454 if (Cmt::get_debug ()) 01455 { 01456 cout << "Use::reach_package-3>" << endl; 01457 } 01458 01459 // Special treatment for CMTHOME package... 01460 if (get_package_name () == CmtSystem::get_home_package ()) 01461 { 01462 discarded = 1; 01463 if (!CmtSystem::test_file ("requirements")) 01464 { 01465 return (0); 01466 } 01467 else 01468 { 01469 return (1); 01470 } 01471 } 01472 01473 if (Cmt::get_debug ()) 01474 { 01475 cout << "Use::reach_package-4>" << endl; 01476 } 01477 01478 // Special treatment for CMTUSERCONTEXT package... 01479 if (get_package_name () == CmtSystem::get_user_context_package ()) 01480 { 01481 discarded = 1; 01482 if (!CmtSystem::test_file ("requirements")) 01483 { 01484 return (0); 01485 } 01486 else 01487 { 01488 return (1); 01489 } 01490 } 01491 01492 // Special treatment for PROJECT package... 01493 if (get_package_name () == CmtSystem::get_project_package ()) 01494 { 01495 discarded = 1; 01496 if (!CmtSystem::test_file ("project")) 01497 { 01498 return (0); 01499 } 01500 else 01501 { 01502 return (1); 01503 } 01504 } 01505 01506 if (Cmt::get_debug ()) 01507 { 01508 cout << "Use::reach_package-5>" << endl; 01509 } 01510 01511 // Now from_path exists, try if the package exists there 01512 if (!CmtSystem::cd (get_package_name ())) 01513 { 01514 return (0); 01515 } 01516 01517 if (Cmt::get_debug ()) 01518 { 01519 cout << "Use::reach_package-6>" << endl; 01520 } 01521 01522 if (CmtSystem::test_file ("cmt/requirements")) 01523 { 01524 CmtSystem::cd ("cmt"); 01525 01526 style = no_version_style; 01527 01528 if (CmtSystem::test_file ("version.cmt")) 01529 { 01530 cmt_string v; 01531 01532 v.read ("version.cmt"); 01533 int pos; 01534 pos = v.find ('\n'); 01535 if (pos != cmt_string::npos) v.erase (pos); 01536 pos = v.find ('\r'); 01537 if (pos != cmt_string::npos) v.erase (pos); 01538 01539 CompareStatus s = compare_versions (version, v); 01540 01541 if (Cmt::get_debug ()) 01542 { 01543 cout << "Use::reach_package-6.1> version=" << version << " v=" << v << " s=" << s << endl; 01544 } 01545 01546 switch (s) 01547 { 01548 case IdenticalIds: 01549 case ExplicitOldMajorIdWinsAgainstWildarded: 01550 case ExplicitOldMinorIdWinsAgainstWildarded: 01551 case ExplicitOldPatchIdWinsAgainstWildarded: 01552 break; 01553 case ExplicitNewMajorIdWinsAgainstWildarded: 01554 case ExplicitNewMinorIdWinsAgainstWildarded: 01555 case NewMinorIdGreaterThanOld: 01556 case ExplicitNewPatchIdWinsAgainstWildarded: 01557 case NewPatchIdGreaterThanOld: 01558 break; 01559 case OldMajorIdGreaterThanNew: 01560 case NewMajorIdGreaterThanOld: 01561 break; 01562 case IncompatibleMajorIds: 01563 return (0); 01564 } 01565 version = v; 01566 } 01567 else if (version == "") 01568 { 01569 version = "v0"; 01570 } 01571 01572 return (1); 01573 } 01574 else if (!CmtSystem::cd (version)) 01575 { 01576 // 01577 // The specified version cannot be found per-se 01578 // There are alternate possibilities when it contains wild cards 01579 // 01580 if ((version == "") || 01581 (version.find ("*") != cmt_string::npos)) 01582 { 01583 static CmtSystem::cmt_string_vector versions; 01584 static cmt_string name; 01585 01586 name = "."; 01587 name += CmtSystem::file_separator (); 01588 if (version == "") name += "*"; 01589 else name += version; 01590 01591 CmtSystem::scan_dir (name, versions); 01592 01593 int i; 01594 bool found = false; 01595 01596 for (i = 0; i < versions.size (); i++) 01597 { 01598 const cmt_string& vers = versions[i]; 01599 01600 if (Cmt::get_debug ()) 01601 { 01602 cout << " ... version " << vers << " exists" << endl; 01603 } 01604 01605 CmtSystem::basename (vers, name); 01606 01607 int v; 01608 int r; 01609 int p; 01610 01611 if (CmtSystem::is_version_directory (name, v, r, p)) 01612 { 01613 /* 01614 This check is not sufficient !! We need to check in addition 01615 that the selected directory is really the start of a true CMT 01616 package (ie with either /mgr/requirements or /cmt/requirements below) 01617 */ 01618 01619 cmt_string req; 01620 01621 req = name; 01622 req += CmtSystem::file_separator (); 01623 req += "mgr"; 01624 req += CmtSystem::file_separator (); 01625 req += "requirements"; 01626 01627 if (!CmtSystem::test_file (req)) 01628 { 01629 req = name; 01630 req += CmtSystem::file_separator (); 01631 req += "cmt"; 01632 req += CmtSystem::file_separator (); 01633 req += "requirements"; 01634 01635 if (!CmtSystem::test_file (req)) continue; 01636 } 01637 01638 cmt_string& new_v = alternate_versions.add (); 01639 new_v = name; 01640 cmt_string& new_p = alternate_paths.add (); 01641 new_p = from_path; 01642 01643 found = true; 01644 } 01645 } 01646 01647 if (!found) 01648 { 01649 if (CmtSystem::test_file ("cmt/requirements")) 01650 { 01651 CmtSystem::cd ("cmt"); 01652 style = no_version_style; 01653 return (1); 01654 } 01655 } 01656 } 01657 01658 if (Cmt::get_debug ()) 01659 { 01660 cout << " ... end of version scan" << endl; 01661 } 01662 01663 // 01664 // We have now the list of possible alternate versions. However 01665 // we return that the expected package/version was not found (yet). 01666 // 01667 01668 return (0); 01669 } 01670 01671 if (Cmt::get_debug ()) 01672 { 01673 cout << "Use::reach_package-7>" << endl; 01674 } 01675 01676 //cerr << " ... version " << version << " exists" << endl; 01677 01678 // Now we have met the exact specified version! 01679 if (!CmtSystem::test_file ("cmt/requirements")) 01680 { 01681 if (!CmtSystem::test_file ("mgr/requirements")) 01682 { 01683 return (0); 01684 } 01685 else 01686 { 01687 CmtSystem::cd ("mgr"); 01688 style = mgr_style; 01689 } 01690 } 01691 else 01692 { 01693 CmtSystem::cd ("cmt"); 01694 style = cmt_style; 01695 } 01696 01697 if (Cmt::get_debug ()) 01698 { 01699 cout << "Use::reach_package-8>" << endl; 01700 } 01701 01702 return (1); 01703 } |
|
Considering a given path, try and reduce the part of it that corresponds to the full path of this package into its normal form ${ROOT} The argument is modified if the pattern is exactly found.
Definition at line 2812 of file cmt_use.cxx. References CmtSystem::file_separator(), get_full_path(), prefix, and cmt_string::replace(). Referenced by Fragment::print().
02813 { 02814 cmt_string pattern; 02815 get_full_path (pattern); 02816 pattern += CmtSystem::file_separator (); 02817 02818 cmt_string replacement = "${"; 02819 replacement += prefix; 02820 replacement += "ROOT}"; 02821 replacement += CmtSystem::file_separator (); 02822 02823 s.replace (pattern, replacement); 02824 } |
|
Reorder provider versus client in the UsePtrVector list, so that the order reflects the fact that client makes use of provider. The result should be that provider appears before client in the list. Definition at line 1126 of file cmt_use.cxx. References Cmt::get_debug(), get_ordered_uses(), m_index, cmt_vector< T >::size(), and UsePtrVector. Referenced by use_action_iterator::get_use().
01127 { 01128 static UsePtrVector& uses = get_ordered_uses (); 01129 01130 int use_index; 01131 01132 int size = uses.size (); 01133 01134 if (size == 0) return; 01135 if (provider == client) return; 01136 01137 // 01138 // First locate the two use objects into the uses vector. 01139 // -> provider_index and client_index 01140 // 01141 01142 int provider_index = -1; 01143 int client_index = -1; 01144 01145 provider_index = provider->m_index; 01146 client_index = client->m_index; 01147 01148 if (Cmt::get_debug ()) 01149 { 01150 cout << "Use::reorder> provider=" << provider_index << " client=" << client_index << endl; 01151 } 01152 01153 // 01154 // Both objects must be installed in uses before acting. 01155 // 01156 if (provider_index == -1) return; 01157 if (client_index == -1) return; 01158 01159 if (client_index < provider_index) 01160 { 01161 // 01162 // client is already before provider so job is finished 01163 // 01164 return; 01165 } 01166 01167 // 01168 // before : <a a a P b b b C c c c> 01169 // ^ ^ 01170 // ip ic 01171 // 01172 // 1) move "P b b b" by one place to the right 01173 // thus : <a a a P P b b b c c c> 01174 // 01175 // 2) move "C" to [ip] 01176 // 01177 // after : <a a a C P b b b c c c> 01178 // 01179 01180 for (use_index = client_index - 1; use_index >= provider_index; use_index--) 01181 { 01182 Use* use = uses[use_index]; 01183 use->m_index++; 01184 01185 uses[use_index + 1] = uses[use_index]; 01186 } 01187 01188 uses[provider_index] = client; 01189 client->m_index = provider_index; 01190 } |
|
Definition at line 2691 of file cmt_use.cxx. References selected. Referenced by select_clients().
02692 { 02693 selected = true; 02694 } |
|
Definition at line 1857 of file cmt_use.cxx. References alternate_paths, alternate_versions, CmtSystem::cd(), change_path(), Cmt::get_debug(), CmtSystem::is_version_directory(), reach_package(), and cmt_vector< T >::size(). Referenced by move_to(), and UseProjectAction::run().
01858 { 01859 int i; 01860 01861 int v0 = 0; 01862 int r0 = 0; 01863 int p0 = 0; 01864 01865 int v = 0; 01866 int r = 0; 01867 int p = 0; 01868 01869 int selected_index = -1; 01870 01871 for (i = 0; i < alternate_versions.size (); i++) 01872 { 01873 cmt_string& name = alternate_versions[i]; 01874 01875 /* 01876 if (CmtSystem::getenv ("CMTTESTUSEWILDCARDS") != "") 01877 { 01878 cout << "select_alternate[" << this << "]> package " << get_package_name () << 01879 " sv=" << specified_version << 01880 " v=" << version << 01881 " av[" << i << "]=" << name << endl; 01882 } 01883 */ 01884 01885 if (i == 0) 01886 { 01887 CmtSystem::is_version_directory (name, v0, r0, p0); 01888 selected_index = 0; 01889 } 01890 else 01891 { 01892 CmtSystem::is_version_directory (name, v, r, p); 01893 01894 if (v > v0) 01895 { 01896 selected_index = i; 01897 v0 = v; 01898 r0 = r; 01899 p0 = p; 01900 } 01901 else if (v == v0) 01902 { 01903 if (r > r0) 01904 { 01905 selected_index = i; 01906 r0 = r; 01907 p0 = p; 01908 } 01909 else if (r == r0) 01910 { 01911 if (p > p0) 01912 { 01913 selected_index = i; 01914 p0 = p; 01915 } 01916 } 01917 } 01918 } 01919 } 01920 01921 if (selected_index >= 0) 01922 { 01923 if (CmtSystem::cd (alternate_paths[selected_index])) 01924 { 01925 version = alternate_versions[selected_index]; 01926 if (reach_package (alternate_paths[selected_index])) 01927 { 01928 /* 01929 if (CmtSystem::getenv ("CMTTESTUSEWILDCARDS") != "") 01930 { 01931 cout << "select_alternate2> package " << get_package_name () << 01932 " sv=" << specified_version << 01933 " v=" << version << endl; 01934 } 01935 */ 01936 01937 if (Cmt::get_debug ()) 01938 { 01939 cout << "select_alternate> " << alternate_paths[selected_index] << endl; 01940 } 01941 01942 change_path (alternate_paths[selected_index]); 01943 return (true); 01944 } 01945 } 01946 } 01947 01948 return (false); 01949 } |
|
Mark all clients of the current package.
Definition at line 318 of file cmt_use.cxx. References discard(), get_ordered_uses(), is_client(), is_selected(), select(), cmt_vector< T >::size(), undiscard_all(), unselect_all(), and UsePtrVector.
00320 { 00321 static UsePtrVector& uses = get_ordered_uses (); 00322 00323 int number; 00324 Use* use = 0; 00325 00326 unselect_all (); 00327 undiscard_all (); 00328 00329 for (number = uses.size () - 1; number >= 0; number--) 00330 { 00331 use = uses[number]; 00332 if (use == 0) continue; 00333 if (use->is_selected ()) continue; 00334 use->select (); 00335 if (!use->is_client (package, version)) use->discard (); 00336 } 00337 } |
|
Definition at line 1358 of file cmt_use.cxx. References Package::add(), Package::add_use(), Cmt::build_prefix(), clear(), discarded, done, Symbol::expand(), initial_scope, m_package, mgr_style, path_alias, prefix, real_path, ScopePublic, specified_path, specified_version, style, and version_alias. Referenced by Cmt::configure(), create(), Cmt::do_config(), and Use().
01363 { 01364 clear (); 01365 01366 Package* p = Package::add (new_package); 01367 01368 m_package = p; 01369 p->add_use (this); 01370 01371 specified_path = new_path; 01372 // specified_path.replace_all ("\\", "/"); 01373 01374 specified_version = new_version; 01375 version = new_version; 01376 path = specified_path; 01377 Symbol::expand (path); 01378 real_path = ""; 01379 style = mgr_style; 01380 initial_scope = ScopePublic; 01381 done = false; 01382 discarded = false; 01383 Cmt::build_prefix (new_package, prefix); 01384 01385 version_alias = new_version_alias; 01386 path_alias = new_path_alias; 01387 } |
|
Definition at line 3307 of file cmt_use.cxx. References Cmt::get_debug(), get_package_name(), Off, On, cmt_vector< T >::size(), State, sub_use_auto_imports, sub_uses, and Unspecified. Referenced by use_action_iterator::get_use().
03308 { 03309 if (Cmt::get_debug ()) 03310 { 03311 cout << "Use::set_auto_imports>(" << get_package_name () << ") " 03312 << auto_imports << " -> " << new_state << endl; 03313 } 03314 03315 if (auto_imports == new_state) return; 03316 03317 State old_state = auto_imports; 03318 03319 auto_imports = new_state; 03320 03321 // We propagate only when we switch from Off to On 03322 03323 if ((old_state == Off) && (new_state == On)) 03324 { 03325 cmt_string s; 03326 static const cmt_string state_text[] = {"Unspecified", "Off", "On"}; 03327 03328 if (Cmt::get_debug ()) 03329 { 03330 s = "Use::set_auto_imports>("; 03331 s += get_package_name (); 03332 s += ") "; 03333 03334 cout << s << endl; 03335 } 03336 03337 for (int i = 0; i < sub_uses.size (); i++) 03338 { 03339 Use* u = sub_uses[i]; 03340 State state = sub_use_auto_imports[i]; 03341 03342 if (Cmt::get_debug ()) 03343 { 03344 s += " "; 03345 s += u->get_package_name (); 03346 s += "("; 03347 s += state_text[state]; 03348 s += ")"; 03349 } 03350 03351 if (state == Unspecified) 03352 { 03353 u->set_auto_imports (On); 03354 } 03355 } 03356 03357 if (Cmt::get_debug ()) 03358 { 03359 cout << s << endl; 03360 } 03361 } 03362 } |
|
1) Given a Use object identified by its index in the ordered_uses() array, 2) Given a vector of states containing the auto_imports states of all uses, we want to switch to 'On' the auto_imports states of all sub_uses of the argument that were Off. Here, use points to a Use object which had been declared as no_auto_imports. But we need to switch it On. Therefore, 1) the state in auto_imports_states has to be set On 2) the operation has to be recursively propagated to all sub_uses which also had no_auto_imports. (only to those) Definition at line 1006 of file cmt_use.cxx. References auto_imports, Cmt::get_debug(), get_ordered_uses(), m_index, Off, cmt_vector< T >::size(), sub_use_auto_imports, sub_uses, and UsePtrVector. Referenced by StandardMacroBuilder::fill_for_all_constituents().
01008 { 01009 // check boundaries (this should be an error when out bondaries) 01010 if ((use_index < 0) || (use_index >= auto_imports_states.size ())) return; 01011 01012 Use::UsePtrVector& uses = Use::get_ordered_uses (); 01013 01014 if (Cmt::get_debug ()) 01015 { 01016 int i; 01017 01018 cout << "Use::set_auto_imports_state> use_index=" << use_index << " "; 01019 01020 for (i = 0; i < auto_imports_states.size (); i++) 01021 { 01022 cout << (auto_imports_states[i] ? "|" : "o"); 01023 } 01024 01025 for (i = 0; i < auto_imports_states.size (); i++) 01026 { 01027 cout << " " << (uses[i])->get_package_name (); 01028 } 01029 01030 cout << endl; 01031 } 01032 01033 // check if this is already done (recursivity ending) 01034 if (auto_imports_states[use_index]) return; 01035 01036 Use* use = uses[use_index]; 01037 01038 // We only have to deal with Use objects that were 01039 // actually turned Off 01040 if (use->auto_imports != Off) return; 01041 01052 auto_imports_states[use_index] = true; 01053 01054 int size = 0; 01055 01056 size = use->sub_uses.size (); 01057 for (int i = 0; i < size; i++) 01058 { 01059 Use* u = use->sub_uses[i]; 01060 01061 // first find the index of this use. 01062 01063 int j = u->m_index; 01064 01065 if (j >= 0) 01066 { 01067 if (u->sub_use_auto_imports[i] == Off) 01068 { 01069 set_auto_imports_state (j, auto_imports_states); 01070 } 01071 else 01072 { 01073 auto_imports_states[j] = true; 01074 } 01075 } 01076 } 01077 } |
|
Definition at line 2766 of file cmt_use.cxx. References include_path. Referenced by KwdIncludePath::action().
02767 { 02768 include_path = new_path; 02769 } |
|
Definition at line 3364 of file cmt_use.cxx. References m_has_native_version. Referenced by Symbol::action().
03365 { 03366 m_has_native_version = state; 03367 } |
|
Definition at line 3389 of file cmt_use.cxx. References Package::add(), Package::add_use(), and m_package. Referenced by Cmt::load(), and Cmt::reach_current_package().
03390 { 03391 Package* p = Package::add (name); 03392 03393 m_package = p; 03394 p->add_use (this); 03395 } |
|
Switching from one use to another one, (better wrt various criteria). When switching, m_index and auto_imports are transfered from the un-selected to the newly selected. Definition at line 3281 of file cmt_use.cxx. References auto_imports, discard(), get_ordered_uses(), m_index, undiscard(), and UsePtrVector. Referenced by add().
03282 { 03283 if (this == selected_use) return (this); 03284 03285 static UsePtrVector& uses = get_ordered_uses (); 03286 03287 if (m_index >= 0) 03288 { 03289 // This discarded package was registered. We have to substitute 03290 // it with the new one. 03291 03292 selected_use->m_index = m_index; 03293 selected_use->auto_imports = auto_imports; 03294 03295 selected_use->undiscard (); 03296 03297 m_index = -1; 03298 03299 uses[selected_use->m_index] = selected_use; 03300 } 03301 03302 discard (); 03303 03304 return (selected_use); 03305 } |
|
Definition at line 446 of file cmt_use.cxx. References CmtSystem::absolute_path(), auto_imports, current(), discarded, cmt_string::erase(), find(), cmt_string::find_last_of(), Cmt::get_cmt_home(), Cmt::get_cmt_user_context(), Cmt::get_debug(), CmtSystem::get_home_package(), get_index(), get_ordered_uses(), get_package_name(), Cmt::get_quiet(), CmtSystem::get_user_context_package(), located(), move(), Off, path, real_path, CmtError::set(), show_sub_uses(), cmt_vector< T >::size(), unselect(), unselect_all(), UsePtrVector, and version.
00447 { 00448 static UsePtrVector& uses = get_ordered_uses (); 00449 00450 Use* use; 00451 int number; 00452 00453 if (Cmt::get_debug ()) 00454 { 00455 cout << "use::show_all-1> "; 00456 00457 int i; 00458 00459 for (i = 0; i < uses.size (); i++) 00460 { 00461 Use* u = uses[i]; 00462 cout << u->get_package_name () << "[" << u->get_index () << "]" << " "; 00463 } 00464 00465 cout << endl; 00466 } 00467 00468 unselect_all (); 00469 00470 use = &(current ()); 00471 use->unselect (); 00472 if (!Cmt::get_quiet ()) use->show_sub_uses ("", skip_discarded); 00473 00474 if (uses.size () > 0) 00475 { 00476 if (!Cmt::get_quiet ()) 00477 { 00478 cout << "#\n"; 00479 cout << "# Selection :\n"; 00480 } 00481 00482 // 00483 // First move the CMT package to the end of the use set. 00484 // (ie. used by everybody) 00485 // 00486 use = Use::find ("CMT"); 00487 Use::move (use); 00488 00489 for (number = uses.size () - 1; number >= 0; number--) 00490 { 00491 use = uses[number]; 00492 00493 if (use->discarded) continue; 00494 00495 if (!use->located ()) 00496 { 00497 if (!Cmt::get_quiet ()) 00498 { 00499 cout << "# package " << use->get_package_name () << 00500 " " << use->version << " " << use->path << 00501 " not found" << 00502 endl; 00503 } 00504 CmtError::set (CmtError::package_not_found, use->get_package_name ()); 00505 } 00506 else 00507 { 00508 static const cmt_string empty; 00509 cmt_string p = use->real_path; 00510 if (use->path != "") 00511 { 00512 int pos = p.find_last_of (use->path); 00513 if (pos != cmt_string::npos) 00514 { 00515 p.erase (pos); 00516 } 00517 } 00518 00519 cout << prefix << use->get_package_name () 00520 << " " << use->version; 00521 00522 if (CmtSystem::absolute_path (use->path)) 00523 { 00524 if (!Cmt::get_quiet ()) 00525 { 00526 cout << " (" << use->path << ")"; 00527 } 00528 } 00529 else 00530 { 00531 cout << " " << use->path; 00532 } 00533 00534 if (!Cmt::get_quiet ()) 00535 { 00536 if (p != "") cout << " (" << p << ")"; 00537 if (use->auto_imports == Off) cout << " (no_auto_imports)"; 00538 } 00539 00540 cout << endl; 00541 } 00542 } 00543 00544 if (Cmt::get_cmt_home () != "") 00545 { 00546 cout << prefix << CmtSystem::get_home_package () << " v0"; 00547 if (!Cmt::get_quiet ()) 00548 { 00549 cout << " (" << Cmt::get_cmt_home () << ")"; 00550 } 00551 cout << endl; 00552 } 00553 00554 if (Cmt::get_cmt_user_context () != "") 00555 { 00556 cout << prefix << CmtSystem::get_user_context_package () << " v0"; 00557 if (!Cmt::get_quiet ()) 00558 { 00559 cout << " (" << Cmt::get_cmt_user_context () << ")"; 00560 } 00561 cout << endl; 00562 } 00563 } 00564 } |
|
Definition at line 340 of file cmt_use.cxx. Referenced by Cmt::do_show_uses().
00341 { 00342 show_all ("use ", skip_discarded); 00343 } |
|
Definition at line 346 of file cmt_use.cxx. References cmt_vector< T >::clear(), discarded, get_package_name(), get_selected_version(), cmt_vector< T >::push_back(), selected, cmt_vector< T >::size(), sub_uses, unselect(), unselect_all(), and UsePtrVector. Referenced by Cmt::do_show_cycles().
00347 { 00348 static int level = 0; 00349 static UsePtrVector stack; 00350 int size = 0; 00351 00352 if (level == 0) 00353 { 00354 unselect_all (); 00355 unselect (); 00356 stack.clear (); 00357 } 00358 00359 //for (int i = 0; i < level; i++) cout << " "; 00360 //cout << "Use::show_cycles> " << level << " " << get_package_name () << endl; 00361 00362 // Detect cycles. 00363 for (int k = 0; k < level; k++) 00364 { 00365 Use* u = stack[k]; 00366 if (u == this) 00367 { 00368 for (;k < level; k++) 00369 { 00370 u = stack[k]; 00371 cout << u->get_package_name () << " "; 00372 } 00373 00374 cout << endl; 00375 00376 return; 00377 } 00378 } 00379 00380 // Save this to the stack. 00381 if (stack.size () <= level) 00382 { 00383 stack.push_back (this); 00384 } 00385 else 00386 { 00387 stack[level] = this; 00388 } 00389 00390 if (selected) return; 00391 selected = true; 00392 00393 size = sub_uses.size (); 00394 for (int n = 0; n < size; n++) 00395 { 00396 Use* use = sub_uses[n]; 00397 00398 if (use == 0) continue; 00399 00400 //for (int i = 0; i < level; i++) cout << " "; 00401 //cout << "Use::show_cycles> " << get_package_name () << " uses " << use->get_package_name () << endl; 00402 00403 if (use->discarded) 00404 { 00405 Use* u; 00406 00407 u = use->get_selected_version (); 00408 if (u == 0) continue; 00409 00410 use = u; 00411 } 00412 00413 level++; 00414 use->show_cycles (); 00415 level--; 00416 } 00417 } |
|
Definition at line 3700 of file cmt_use.cxx. References auto_imports, current(), discarded, Symbol::find(), get_package_name(), initial_scope, m_has_native_version, no_version_style, Off, requests, Symbol::resolve_macro_value(), ScopePublic, ScopeType, ScopeUnspecified, selected, cmt_vector< T >::size(), specified_path, specified_version, State, style, sub_use_auto_imports, sub_use_scopes, and sub_uses. Referenced by show_all().
03701 { 03702 Use* current = &(Use::current ()); 03703 int n; 03704 Use* use; 03705 static int level = 0; 03706 03707 if (skip_discarded && discarded) return; 03708 03709 if (level > 0) 03710 { 03711 cout << "# "; 03712 for (n = 0; n < (level-1); n++) cout << " "; 03713 03714 if (request == "") 03715 { 03716 cout << "use " << get_package_name () << " " << specified_version; 03717 03718 if (this == current) 03719 { 03720 cout << " (current)"; 03721 } 03722 else 03723 { 03724 if (specified_path != "") cout << " " << specified_path; 03725 } 03726 } 03727 else 03728 { 03729 cout << "use " << request; 03730 } 03731 03732 if (version_alias != "") 03733 { 03734 cout << " | " << version_alias << " " << path_alias; 03735 } 03736 03737 if (initial_scope == ScopeUnspecified) cout << " (unspecified)"; 03738 else if (initial_scope != ScopePublic) cout << " (private)"; 03739 03740 if (auto_imports == Off) cout << " (no_auto_imports)"; 03741 03742 if (style == no_version_style) cout << " (no_version_directory)"; 03743 03744 if (m_has_native_version) 03745 { 03746 cmt_string n = get_package_name (); 03747 n += "_native_version"; 03748 03749 Symbol* s = Symbol::find (n); 03750 if (s != 0) 03751 { 03752 cmt_string value = s->resolve_macro_value (); 03753 cout << " (native_version=" << value << ")"; 03754 } 03755 } 03756 03757 cout << endl; 03758 } 03759 03760 if (selected) return; 03761 selected = true; 03762 03763 level++; 03764 for (n = 0; n < sub_uses.size (); n++) 03765 { 03766 use = sub_uses[n]; 03767 if (use == 0) continue; 03768 03769 const cmt_string& request = requests[n]; 03770 03771 ScopeType saved_scope = use->initial_scope; 03772 State saved_state = use->auto_imports; 03773 03774 use->initial_scope = sub_use_scopes[n]; 03775 use->auto_imports = sub_use_auto_imports[n]; 03776 03777 use->show_sub_uses (request, skip_discarded); 03778 03779 use->initial_scope = saved_scope; 03780 use->auto_imports = saved_state; 03781 } 03782 level--; 03783 } |
|
Definition at line 2685 of file cmt_use.cxx. References discarded. Referenced by BestFitSelector::operate(), set_selected_version(), and undiscard_all().
02686 { 02687 discarded = false; 02688 } |
|
Definition at line 1233 of file cmt_use.cxx. References get_ordered_uses(), cmt_vector< T >::size(), undiscard(), and UsePtrVector. Referenced by select_clients().
01234 { 01235 static UsePtrVector& uses = get_ordered_uses (); 01236 01237 int use_index; 01238 01239 if (uses.size () == 0) return; 01240 01241 for (use_index = 0; use_index < uses.size (); use_index++) 01242 { 01243 Use* use = uses[use_index]; 01244 01245 if (use != 0) 01246 { 01247 use->undiscard (); 01248 } 01249 } 01250 } |
|
Definition at line 2697 of file cmt_use.cxx. References selected. Referenced by show_all(), show_cycles(), and unselect_all().
02698 { 02699 selected = false; 02700 } |
|
Definition at line 1211 of file cmt_use.cxx. References get_ordered_uses(), cmt_vector< T >::size(), unselect(), and UsePtrVector. Referenced by get_paths(), select_clients(), show_all(), and show_cycles().
01212 { 01213 static UsePtrVector& uses = get_ordered_uses (); 01214 01215 int use_index; 01216 01217 int size = uses.size (); 01218 01219 if (size == 0) return; 01220 01221 for (use_index = 0; use_index < size; use_index++) 01222 { 01223 Use* use = uses[use_index]; 01224 01225 if (use != 0) 01226 { 01227 use->unselect (); 01228 } 01229 } 01230 } |
|
|
|
Definition at line 196 of file cmt_use.h. Referenced by clear(), reach_package(), UseProjectAction::run(), and select_alternate(). |
|
Definition at line 195 of file cmt_use.h. Referenced by clear(), move_to(), reach_package(), UseProjectAction::run(), and select_alternate(). |
|
Definition at line 151 of file cmt_use.h. Referenced by ApplyPattern::add(), clear(), Pattern::show(), and Pattern::show_all_applied_patterns(). |
|
Definition at line 132 of file cmt_use.h. Referenced by author_action(), clear(), and Cmt::do_show_author(). |
|
Definition at line 146 of file cmt_use.h. Referenced by StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_use_includes(), fill_macro_all(), get_all_clients(), use_action_iterator::get_use(), set_auto_imports_state(), set_selected_version(), show_all(), and show_sub_uses(). |
|
|
Definition at line 141 of file cmt_use.h. Referenced by add(), clear(), Cmt::load(), BestFitSelector::operate(), set(), and Use(). |
|
Definition at line 152 of file cmt_use.h. Referenced by IgnorePattern::add(), clear(), and IgnorePattern::find(). |
|
Definition at line 149 of file cmt_use.h. Referenced by clear(), Cmt::do_show_include_dirs(), StandardMacroBuilder::fill_for_includes(), fill_includes_macro(), CmtGenerator::prepare_use_context(), and set_include_path(). |
|
Definition at line 148 of file cmt_use.h. Referenced by Include::add(), DepsBuilder::add_includes(), clear(), Cmt::do_show_include_dirs(), StandardMacroBuilder::fill_for_includes(), fill_includes_macro(), Include::find(), Include::print_all(), and Include::print_filters(). |
|
Definition at line 192 of file cmt_use.h. Referenced by clear(), get_all_clients(), get_current_scope(), set(), and show_sub_uses(). |
|
Definition at line 186 of file cmt_use.h. Referenced by clear(), has_native_version(), set_native_version(), and show_sub_uses(). |
|
Definition at line 200 of file cmt_use.h. Referenced by add(), clear(), find_index(), get_index(), move(), reorder(), set_auto_imports_state(), set_selected_version(), and Use(). |
|
Definition at line 185 of file cmt_use.h. Referenced by change_path(), clear(), located(), move_to(), and Use(). |
|
Definition at line 182 of file cmt_use.h. Referenced by clear(), get_package(), get_package_name(), get_selected_version(), set(), set_package_name(), and Use(). |
|
Definition at line 133 of file cmt_use.h. Referenced by clear(), Cmt::do_show_manager(), and manager_action(). |
|
Definition at line 135 of file cmt_use.h. Referenced by add(), Cmt::configure_current_cmtpath(), Cmt::do_broadcast(), Cmt::do_remove_library_links(), Cmt::load(), BestFitSelector::operate(), Cmt::reach_current_package(), and show_all(). |
|
Definition at line 131 of file cmt_use.h. Referenced by clear(), BestFitSelector::operate(), and set(). |
|
|
|
Definition at line 198 of file cmt_use.h. Referenced by add(), clear(), and show_sub_uses(). |
|
Definition at line 193 of file cmt_use.h. Referenced by close_scope_sections(), get_current_scope(), pop_scope_section(), and push_scope_section(). |
|
Definition at line 150 of file cmt_use.h. Referenced by Script::add(), Script::all_print(), Script::all_print_clean(), clear(), and Script::find(). |
|
Definition at line 144 of file cmt_use.h. Referenced by add(), clear(), get_paths(), is_selected(), select(), show_cycles(), show_sub_uses(), and unselect(). |
|
Definition at line 129 of file cmt_use.h. Referenced by ReadmeGenerator::build(), clear(), create(), SyntaxParser::do_parse_words(), set(), and show_sub_uses(). |
|
Definition at line 128 of file cmt_use.h. Referenced by create(), find(), find_index(), BestFitSelector::operate(), set(), and show_sub_uses(). |
|
|
Definition at line 190 of file cmt_use.h. Referenced by add(), clear(), set_auto_imports(), set_auto_imports_state(), and show_sub_uses(). |
|
Definition at line 189 of file cmt_use.h. Referenced by add(), clear(), and show_sub_uses(). |
|
Definition at line 188 of file cmt_use.h. Referenced by add(), clear(), get_paths(), set_auto_imports(), set_auto_imports_state(), show_cycles(), and show_sub_uses(). |
|
|
Definition at line 130 of file cmt_use.h. Referenced by clear(), BestFitSelector::operate(), and set(). |