Changeset 574 for CMT/HEAD


Ignore:
Timestamp:
May 2, 2011, 5:43:36 PM (13 years ago)
Author:
rybkin
Message:

See C.L. 456

Location:
CMT/HEAD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r572 r574  
     12011-05-02    <rybkin@lal.in2p3.fr> 456
     2
     3        * source/cmt_use.cxx: In class Use, in function show_sub_uses, make output
     4        of "cmt show uses" command compatible with original as it is used by tools,
     5        tbroadcast, for example, in function set_auto_imports, increase/decrease
     6        level before/after considering sub-uses
     7       
    182011-04-29    <rybkin@lal.in2p3.fr> 455
    29
  • CMT/HEAD/source/cmt_use.cxx

    r572 r574  
    39613961                            cmt_map <Use*, bool>& visited)
    39623962{
    3963   static int level (-1);
    3964   level++;
     3963  static int level (0);
    39653964  /*
    39663965  if (level == 0)
     
    39883987      else
    39893988        {
    3990           level--;
    39913989          return;
    39923990        }
     
    39953993      if (visited.has (this))
    39963994        {
    3997           level--;
    39983995          return;
    39993996        }
     
    40264023    }
    40274024 
     4025  level++;
    40284026  for (int i = 0; i < sub_uses.size (); i++)
    40294027  //for (int i = sub_uses.size () - 1; i >= 0; i--)
     
    40794077        }
    40804078    }
     4079  level--;
    40814080
    40824081  if (Cmt::get_debug ())
     
    40854084    }
    40864085
    4087   level--;
    40884086  return;
    40894087}
     
    44954493  Use* current = &(Use::current ());
    44964494  static State context_state (auto_imports);
    4497   static int level (-1);
    4498   level++;
     4495  static int level (0);
    44994496
    45004497  if (level == 0)
    45014498    {
    45024499      unselect_all ();
    4503       selected = true;
    4504     }
    4505 
    4506   State saved_context_state (context_state);
    4507   switch (context_state)
    4508     {
    4509     case Unspecified:
    4510     case On:
    4511       if (!visited.has (this)
    4512           || level == 1)
    4513         // show all direct sub-uses of current use
    4514         {
    4515           context_state = UseContext::mask_auto_imports (context_state, specified_state);
    4516         }
    4517       else if (Off != auto_imports && Off != specified_state
    4518                //      else if (specified_state == auto_imports && Off != specified_state
    4519                && !selected)
    4520         // show this sub-use as it may have been used to make Off != auto_imports
    4521         // and is sufficient in order to consider it Off != auto_imports,
    4522         // mark selected not to consider use again and thus avoid looping this way
    4523         {
    4524           selected = true;
    4525           //      auto_imports = specified_state;
    4526           context_state = UseContext::mask_auto_imports (context_state, specified_state);
    4527         }
    4528       else
    4529         {
    4530           level--;
    4531           return;
    4532         }
    4533       break;
    4534     case Off:
    4535       if (visited.has (this)
    4536           )
    4537         {
    4538           level--;
    4539           return;
    4540         }
    4541       break;
     4500      selected = false;
    45424501    }
    45434502
     
    45944553    }
    45954554
     4555  //  if (selected) return;
     4556  //  selected = true;
     4557
     4558  State saved_context_state (context_state);
     4559
     4560  switch (context_state)
     4561    {
     4562    case Unspecified:
     4563    case On:
     4564      if (!visited.has (this) ||
     4565          !selected)
     4566        // selected == true means that
     4567        // this use has been shown with its actual auto_imports
     4568        // either Off != auto_imports or Off == auto_imports,
     4569        // mark selected not to consider use again and thus avoid looping this way
     4570        {
     4571          switch (specified_state)
     4572            {
     4573            case Unspecified:
     4574            case On:
     4575              if (Off != auto_imports)
     4576                {
     4577                  // this path to use is informative
     4578                  // want to revisit sub-uses
     4579                  // to possibly find Off != auto_imports paths to them
     4580                  selected = true;
     4581                }
     4582              break;
     4583            case Off:
     4584              if (Off == auto_imports)
     4585                {
     4586                  // this path to use is informative
     4587                  // no point in revisiting sub-uses
     4588                  selected = true;
     4589                  if (visited.has (this)) return;
     4590                }
     4591              else
     4592                {
     4593                  // this path to use is not informative
     4594                  // no point in (re)visiting sub-uses
     4595                  return;
     4596                }
     4597              break;
     4598            }
     4599          context_state = UseContext::mask_auto_imports (context_state, specified_state);
     4600        }
     4601      else
     4602        {
     4603          return;
     4604        }
     4605      break;
     4606    case Off:
     4607      if (!visited.has (this) ||
     4608          !selected)
     4609        {
     4610          if (Off == auto_imports)
     4611            {
     4612              // this path to use is informative
     4613              // no point in revisiting sub-uses
     4614              selected = true;
     4615              if (visited.has (this)) return;
     4616            }
     4617          else
     4618            {
     4619              // this path to use is not informative
     4620              // no point in (re)visiting sub-uses
     4621              return;
     4622            }
     4623        }
     4624      else
     4625        {
     4626          return;
     4627        }
     4628      break;
     4629    }
     4630
    45964631  static bool yes (true);
    45974632  visited.add (this, yes);
    45984633
     4634  level++;
    45994635  for (int i = 0; i < sub_uses.size (); i++)
    46004636    {
     
    46144650          else
    46154651            {
     4652              sub_uses[i]->select ();
    46164653              visited.add (sub_uses[i], yes);
    46174654              continue;
Note: See TracChangeset for help on using the changeset viewer.