Collaboration diagram for use_action_iterator:

Public Methods | |
| use_action_iterator () | |
| void | set (const cmt_string& w) |
| bool | ok () |
| Use* | get_use (Use* parent) |
| Build or retreive the Use object corresponding to the parsed specification. More... | |
Private Types | |
| enum | { need_package, need_version, need_path, need_version_alias, need_path_alias, finished } |
| Warning : this Use had been previously specified as -no_auto_imports Now this new specification tries to turn it to auto_imports. More... | |
Private Attributes | |
| enum use_action_iterator:: { ... } | state |
| Warning : this Use had been previously specified as -no_auto_imports Now this new specification tries to turn it to auto_imports. More... | |
| State | auto_imports |
| cmt_string | package |
| cmt_string | version |
| cmt_string | path |
| cmt_string | version_alias |
| cmt_string | path_alias |
It maintains the results of the parsing in terms of a package name, a version, a path, and state variables (no_auto_imports)
Definition at line 266 of file cmt_use.cxx.
|
|
Warning : this Use had been previously specified as -no_auto_imports Now this new specification tries to turn it to auto_imports. It will be required to propagate the change, according to the specifications: for all sub_uses: if it is unspecified OR specified as auto_imports: turn it to auto_imports Definition at line 505 of file cmt_use.cxx. 00506 {
00507 need_package,
00508 need_version,
00509 need_path,
00510 need_version_alias,
00511 need_path_alias,
00512 finished
00513 }
|
|
|
Definition at line 270 of file cmt_use.cxx. 00271 {
00272 state = need_package;
00273 auto_imports = Unspecified;
00274 }
|
|
|
Build or retreive the Use object corresponding to the parsed specification.
Definition at line 332 of file cmt_use.cxx. Referenced by Use::action(). 00333 {
00334 static Use::UsePtrVector& Uses = Use::uses ();
00335
00336 if (version == "") version = "*";
00337
00338 if (Cmt::get_debug ())
00339 {
00340 int i;
00341
00342 cout << "use::action1> current=" << parent->package <<
00343 " package=" << package << " ";
00344
00345 for (i = 0; i < Uses.size (); i++)
00346 {
00347 Use* u = Uses[i];
00348 cout << u->package << " ";
00349 }
00350 cout << endl;
00351 }
00352
00353 const Use& cu = Use::current ();
00354
00364 ActionType action = Cmt::get_action ();
00365
00366 if (Cmt::get_debug ())
00367 {
00368 cout << "before adding " << package <<"> auto_imports=" << auto_imports
00369 << " (current AI was " << UseContext::get_current_auto_imports () << ")"
00370 << " (current scope was " << UseContext::get_current_scope () << ")"
00371 << " (Cmt::scope=" << Cmt::get_scope () << ")"
00372 << " (parent=" << parent->package << ")"
00373 << endl;
00374 }
00375
00376 bool hidden_by_scope = false;
00377
00378 if ((Cmt::get_scope () == ScopePrivate) || (UseContext::get_current_scope () == ScopePrivate))
00379 {
00380 hidden_by_scope = true;
00381
00382 // Do not hide immediate children of the current package.
00383 if ((parent == 0) || (parent->package == cu.package)) hidden_by_scope = false;
00384
00385 // Do not hide in broadcast and show uses actions.
00386 if ((action == action_broadcast) ||
00387 (action == action_show_uses)) hidden_by_scope = false;
00388 }
00389
00390 if (hidden_by_scope)
00391 {
00392 return (0);
00393 }
00394
00395 // Here the version may contain wild cards
00396
00397 UseContext save = UseContext::current ();
00398
00403 switch (auto_imports)
00404 {
00405 case Unspecified:
00406
00407 // unspecified => we forward the state saved in the current use context
00408
00409 UseContext::set_current (UseContext::get_current_auto_imports ());
00410 break;
00411 case Off:
00412
00413 // off => the context becomes constrained to be off
00414
00415 UseContext::set_current (Off);
00416 break;
00417 case On:
00418
00419 // on => if current context is off it is kept off
00420 // otherwise it is forced to on
00421
00422 if (UseContext::get_current_auto_imports () != Off)
00423 {
00424 UseContext::set_current (On);
00425 }
00426 break;
00427 }
00428
00429 if (hidden_by_scope)
00430 {
00431 UseContext::set_current (Cmt::get_scope ());
00432 }
00433
00435 Use* new_use = Use::add (path, package, version,
00436 version_alias, path_alias, parent,
00437 auto_imports);
00438
00439 if (new_use != 0)
00440 {
00441 if (Cmt::get_debug ())
00442 {
00443 cout << "after adding1 " << package << "> auto_imports=" << new_use->auto_imports << endl;
00444 }
00445
00446 switch (new_use->auto_imports)
00447 {
00448 case Unspecified:
00449 new_use->auto_imports = UseContext::get_current_auto_imports ();
00450 break;
00451 case On:
00452 break;
00453 case Off:
00454 if (UseContext::get_current_auto_imports () == On)
00455 {
00467 new_use->set_auto_imports (On);
00468 }
00469 break;
00470 }
00471
00472
00473 if (Cmt::get_debug ())
00474 {
00475 cout << "after adding2 " << package << "> auto_imports=" << new_use->auto_imports << endl;
00476 }
00477
00478 UseContext& c = UseContext::current ();
00479 c = save;
00480
00481 Use::reorder (new_use, parent);
00482
00483 if (Cmt::get_debug ())
00484 {
00485 int i;
00486
00487 cout << "use::action2> current=" << parent->package
00488 << " package=" << package << " ";
00489
00490 for (i = 0; i < Uses.size (); i++)
00491 {
00492 Use* u = Uses[i];
00493 cout << u->package << " ";
00494 }
00495
00496 cout << endl;
00497 }
00498 }
00499
00500 return (new_use);
00501 }
|
|
|
Definition at line 318 of file cmt_use.cxx. Referenced by Use::action(). 00319 {
00320 if (package == "") return (false);
00321 if (CmtSystem::is_home_package (package, version)) return (false);
00322 if (CmtSystem::is_user_context_package (package, version)) return (false);
00323
00324 return (true);
00325 }
|
|
|
Definition at line 276 of file cmt_use.cxx. Referenced by Use::action(). 00277 {
00278 if (w == "-auto_imports")
00279 {
00280 auto_imports = On;
00281 }
00282 else if (w == "-no_auto_imports")
00283 {
00284 auto_imports = Off;
00285 }
00286 else if (w == "|")
00287 {
00288 state = need_version_alias;
00289 }
00290 else
00291 {
00292 switch (state)
00293 {
00294 case need_package:
00295 package = w;
00296 state = need_version;
00297 break;
00298 case need_version:
00299 version = w;
00300 state = need_path;
00301 break;
00302 case need_path:
00303 path = w;
00304 state = finished;
00305 break;
00306 case need_version_alias:
00307 version_alias = w;
00308 state = need_path_alias;
00309 break;
00310 case need_path_alias:
00311 path_alias = w;
00312 state = finished;
00313 break;
00314 }
00315 }
00316 }
|
|
|
Definition at line 515 of file cmt_use.cxx. |
|
|
Definition at line 517 of file cmt_use.cxx. |
|
|
Definition at line 519 of file cmt_use.cxx. |
|
|
Definition at line 521 of file cmt_use.cxx. |
|
|
|
Warning : this Use had been previously specified as -no_auto_imports Now this new specification tries to turn it to auto_imports. It will be required to propagate the change, according to the specifications: for all sub_uses: if it is unspecified OR specified as auto_imports: turn it to auto_imports |
|
|
Definition at line 518 of file cmt_use.cxx. |
|
|
Definition at line 520 of file cmt_use.cxx. |
1.2.3 written by Dimitri van Heesch,
© 1997-2000