Changes in / [1:3]


Ignore:
Location:
/CMT/v1r19
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • /CMT/v1r19/ChangeLog

    r1 r3  
     12005-03-02  Christian Arnault  <arnault@lal.in2p3.fr> 251
     2
     3        * source/cmt_symbol.h (class Symbol): Add an optional argument to build_macro_value to switch display mode
     4
     5        * source/cmt_symbol.cxx (show_macro): Improve the display mode so as to display only once the macro construction steps
     6
     7        * source/cmt_parser.cxx (guess_current_project): Regenerate CMTPATH from the effective set of subprojects.
     8
     9        * source/cmt_commands.cxx (parse): Handle unexpected arguments
     10
     11        * source/cmt_error.cxx (class Error): Added unknown_command error
     12        * source/cmt_error.h (class CmtError): Added unknown_command error
     13
     14        * source/cmt_commands.cxx (do_filter): Missing implementation for the filter command
     15
     162005-03-01  Christian Arnault  <arnault@lal.in2p3.fr> 251
     17
     18        * source/cmt_tag.cxx (use_operand): Add way of checking internal structure of a tag
     19        * source/cmt_tag.cxx (use_ref): Add way of checking internal structure of a tag
     20
     21        * source/cmt_tag.h (class Tag): Add way of checking internal structure of a tag
     22
     23        * source/cmt_symbol.h (class Symbol): Add way of checking if a tag is used by symbols.
     24
     25        * source/cmt_symbol.cxx (print): Suppress the "export" action after defining an alias in Sh mode
     26
     27        * source/cmt_project.cxx: Introduce use_action
     28
     29        * source/cmt_syntax.cxx (SyntaxParser): Add support to use statements in project files
     30
     31        * source/cmt_project.cxx (create_project): Add comments
     32
    1332004-12-14    <arnault@lal.in2p3.fr> 250
    234
  • /CMT/v1r19/mgr/INSTALL

    r1 r3  
    1111#--------------------------------------------------
    1212
    13 ##set -v
     13#set -x
    1414
    1515here=`pwd`                #should be .../CMT/vxxx/mgr
  • /CMT/v1r19/source/cmt_commands.cxx

    r1 r3  
    422422  shift ();
    423423
     424  cmt.m_action = action_none;
     425
    424426  while (argc > 0)
    425427    {
     
    457459      if (parsers.has (reduced_arg))
    458460        {
     461          // This argument corresponds to a known command
     462
    459463          int i = (*parsers.find (reduced_arg));
    460464
     
    462466          (me.*p) ();
    463467        }
     468      else if (cmt.m_action != action_none)
     469        {
     470          // We have unexpected arguments (not handled by the command handler). This may sign
     471          // an unprotected handler implementation.
     472          if (!cmt.m_quiet) cerr << "#CMT> warning : unexpected parameter " << reduced_arg << endl;
     473        }
    464474      else
    465475        {
     476          // This argument does not correspond to a known command. We expect then an action
     477          // to be executed with that name
     478
    466479          unshift ();
    467480          do_do ();
     
    913926void ArgParser::do_filter ()
    914927{
    915   cmt.m_action = action_filter;
     928  if (argc > 0)
     929    {
     930      fill_arguments ();
     931      cmt.m_action = action_filter;
     932    }
     933  else
     934    {
     935      if (!cmt.m_quiet) cerr << "#CMT> syntax error : file to filter not specified" << endl;
     936      help_action = action_help;
     937      cmt.m_action = action_filter;
     938    }
    916939}
    917940
     
    16901713      Tag* tag;
    16911714      CmtSystem::cmt_string_vector words;
    1692                  
     1715
    16931716      // First reset selection of all existing tags
    16941717      //Tag::clear_all ();
  • /CMT/v1r19/source/cmt_error.cxx

    r1 r3  
    3333    error_names.add() = "cannot_remove_lock";
    3434    error_names.add() = "conflicting_lock";
     35    error_names.add() = "unknown_command";
    3536  }
    3637
  • /CMT/v1r19/source/cmt_error.h

    r1 r3  
    3434    cannot_run_unlock_command,
    3535    cannot_remove_lock,
    36     conflicting_lock
     36    conflicting_lock,
     37    unknown_command
    3738  } code;
    3839
  • /CMT/v1r19/source/cmt_parser.cxx

    r1 r3  
    19611961void Cmt::do_check_configuration (const ArgParser& ap)
    19621962{
     1963  cmt_string env;
     1964  Tag* tag;
     1965
     1966  static CmtSystem::cmt_string_vector tags;
     1967
     1968  CmtSystem::split (Me.m_extra_tags, " \t,", tags);
     1969
     1970  for (int i = 0; i < tags.size (); i++)
     1971    {
     1972      const cmt_string& t = tags[i];
     1973
     1974      tag = Tag::find (t);
     1975      if (tag == 0) continue;
     1976
     1977      if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag))
     1978        {
     1979          cerr << "#CMT> The tag " << t << " is not used in any tag expression. Please check spelling" << endl;
     1980        }
     1981    }
     1982
     1983  env = CmtSystem::getenv ("CMTSITE");
     1984  if (env == "")
     1985    {
     1986      return;
     1987    }
     1988
     1989  tag = Tag::find (env);
     1990  if (tag == 0)
     1991    {
     1992      return;
     1993    }
     1994
     1995  if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag))
     1996    {
     1997      cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl;
     1998    }
     1999
     2000  env = CmtSystem::getenv ("CMTCONFIG");
     2001  if (env == "")
     2002    {
     2003      return;
     2004    }
     2005
     2006  tag = Tag::find (env);
     2007  if (tag == 0)
     2008    {
     2009      return;
     2010    }
     2011
     2012  if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag))
     2013    {
     2014      cerr << "#CMT> The CMTCONFIG value " << env << " is not used in any tag expression. Please check spelling" << endl;
     2015    }
    19632016}
    19642017
     
    24542507        {
    24552508          Me.m_action = action_show_action_names;
     2509          /*
    24562510          if (!Me.m_quiet)
    24572511            {
     
    24592513              print_symbol_names (ap.mode);
    24602514            }
    2461           CmtError::set (CmtError::symbol_not_found, ap.arguments[0]);
     2515          */
     2516          CmtError::set (CmtError::unknown_command, ap.arguments[0]);
    24622517          return;
    24632518        }
     
    29863041void Cmt::do_setup (const ArgParser& ap)
    29873042{
     3043
     3044  do_check_configuration (ap);
     3045
    29883046  print (ap.mode);
    29893047
     
    38663924            {
    38673925              //this directory should become the first entry of the CMTPATH
     3926
     3927              IProjectFactory& factory = ProjectFactory::instance ();
     3928              factory.create_project (pwd, "CurrentProject");
     3929
     3930              /*
    38683931              cmt_string temp = "path_prepend CMTPATH \"";
    38693932              temp += pwd;
     
    38733936
    38743937              SyntaxParser::parse_requirements_line (temp, &use);
    3875              
     3938              */
     3939
    38763940              break;
    38773941            }
     
    38903954      CmtSystem::cd (Me.m_current_dir);
    38913955    }
     3956
     3957  cmt_string buffer = "path CMTPATH \n";
     3958  Project::set_cmtpaths (buffer);
     3959  //cerr << "buffer = " << buffer << endl;
     3960  Use& use = Use::current();
     3961  SyntaxParser::parse_requirements_text (buffer, "", &use);
    38923962}
    38933963
  • /CMT/v1r19/source/cmt_project.cxx

    r1 r3  
    9797}
    9898
     99/*
     100  Every new CMTPATH entry becomes associated with a dedicated PROJECT
     101  This function will understand this new entry to CMTPATH and understand it:
     102  - it can correspond to an existing project (ie already declared)
     103  - it's a new project
     104     - then it tries to read and parse its project file
     105 */
    99106void ProjectFactory::create_project (const cmt_string& path,
    100107                                     const cmt_string& source)
     
    121128  if (!CmtSystem::cd (compressed_path)) return;
    122129
     130  //
     131  // Figure out if this is the current project
     132  //
    123133  cmt_string pwd = CmtSystem::pwd ();
    124134  if (here.find (pwd) == 0) is_current = true;
     
    126136  cmt_string text;
    127137
     138  /*
     139    Now Figure out the project name from the project file
     140    Or construct an automatic project name when project file does no exist
     141    or does not specify the project name
     142   */
    128143  if (CmtSystem::cd ("cmt") && CmtSystem::test_file (Project::get_project_file_name ()))
    129144    {
     
    180195  if (is_current)
    181196    {
     197      //
     198      // The current project defines a tag with its name
     199      //
     200
    182201      Tag* tag;
    183202     
     
    191210  if (text != "")
    192211    {
     212      // Last step is to parse the project file
     213
    193214      SyntaxParser::parse_project_file_text (text,
    194215                                             Project::get_project_file_name (),
     
    547568
    548569  return ("");
     570}
     571
     572//----------------------------------------------------------
     573void Project::set_cmtpaths (cmt_string& buffer)
     574{
     575  /*
     576    Try to re-create all CMTPATH items from project definitions.
     577    The goal is to generate CMTPATH even if this EV was not pre-set
     578    which is the case when CMTPROJECTPATH is only used
     579   */
     580
     581  static ProjectVector& Projects = projects ();
     582
     583  for (int i = 0; i < Projects.size (); i++)
     584    {
     585      const Project& project = Projects[i];
     586
     587      const cmt_string& p = project.m_cmtpath;
     588      const cmt_string& w = project.m_cmtpath_pwd;
     589      const cmt_string& s = project.m_cmtpath_source;
     590
     591      if (s == "default path") continue;
     592
     593      if (CmtSystem::test_directory (w))
     594        {
     595          buffer += "path_append CMTPATH \"";
     596          buffer += w;
     597          buffer += "\" \n";
     598        }
     599    }
    549600}
    550601
     
    748799    }
    749800}
     801
     802//----------------------------------------------------------
     803void Project::use_action (const cmt_string& name, const cmt_string& release)
     804{
     805  //cerr << "Use action " << name << " " << release << endl;
     806
     807  // A project with its release is specified
     808  //
     809  // Is this project already visible?
     810  // If not: look for it
     811  //   + get CMTPROJECTPATH
     812  //   + search from all entries of CMTPROJECTPATH : pi/<name>/<release>
     813  //   + when found, this should become a new CMTPATH entry
     814  //   +             the new project is then parsed ... etc...
     815
     816  // Question : do we consider by default pwd/../.. ???
     817
     818  cmt_string cmtprojectpath = CmtSystem::getenv ("CMTPROJECTPATH");
     819  cmt_string sep;
     820  sep += CmtSystem::path_separator ();
     821
     822  //cerr << "cmtprojectpath = " << cmtprojectpath << endl;
     823  CmtSystem::cmt_string_vector items;
     824  CmtSystem::split (cmtprojectpath, sep, items);
     825  for (int i = 0; i < items.size (); i++)
     826    {
     827      const cmt_string& item = items[i];
     828      cmt_string p = item;
     829      p += CmtSystem::file_separator ();
     830      p += name;
     831      p += CmtSystem::file_separator ();
     832      p += release;
     833
     834      if (CmtSystem::test_directory (p))
     835        {
     836          //cerr << "Project directry " << p << " exists " << endl;
     837
     838          IProjectFactory& factory = ProjectFactory::instance ();
     839
     840          factory.create_project (p, "ProjectPath");
     841
     842          break;
     843        }
     844    }
     845}
     846
    750847
    751848//----------------------------------------------------------
  • /CMT/v1r19/source/cmt_project.h

    r1 r3  
    6464  static cmt_string find_in_cmt_paths (const cmt_string& path);
    6565
     66  static void set_cmtpaths (cmt_string& buffer);
     67
    6668public:
    6769
     
    8082  void clear ();
    8183  void configure ();
     84
     85  void use_action (const cmt_string& name, const cmt_string& release);
    8286
    8387  Project& operator = (const Project& other);
  • /CMT/v1r19/source/cmt_symbol.cxx

    r1 r3  
    15411541            case Sh :
    15421542              cout << "alias " << name <<
    1543                   "=\"" << temp <<
    1544                   "\"; export " << name;
     1543                  "=\"" << temp << "\"";
    15451544              result = 1;
    15461545              break;
     
    15901589
    15911590//-------------------------------------------------------------
    1592 cmt_string Symbol::build_macro_value () const
     1591cmt_string Symbol::build_macro_value (bool display_it) const
    15931592{
    15941593  cmt_string temp;
    15951594
    1596   temp = builder->build (*this);
     1595  if (display_it)
     1596    {
     1597      temp = builder->build_and_display (*this);
     1598    }
     1599  else
     1600    {
     1601      temp = builder->build (*this);
     1602    }
    15971603
    15981604  return (temp);
     
    16521658  ActionType action = Cmt::get_action ();
    16531659
    1654   cmt_string value = build_macro_value ();
     1660  cmt_string value = build_macro_value (true);
    16551661
    16561662  if ((!Cmt::get_quiet ()) &&
     
    17541760
    17551761//-------------------------------------------------------------
     1762ValueBuilder::ValueBuilder ()
     1763{
     1764  m_display_it = false;
     1765}
     1766
     1767//-------------------------------------------------------------
     1768const cmt_string ValueBuilder::build_and_display (const Symbol& symbol)
     1769{
     1770  cmt_string temp;
     1771
     1772  m_display_it = true;
     1773  temp = build (symbol);
     1774  m_display_it = false;
     1775
     1776  return (temp);
     1777}
     1778
     1779//-------------------------------------------------------------
    17561780const cmt_string SetBuilder::build (const Symbol& symbol,
    17571781                                    const cmt_string& /*tag_name*/)
     
    17601784  static int level = 0;
    17611785
    1762   int show_it = 0;
     1786  bool show_it = false;
    17631787
    17641788  cmt_string temp;
     
    17741798        {
    17751799             // Should not display on recursive calls
    1776           if (level == 0) show_it = 1;
     1800          if (level == 0) show_it = m_display_it;
    17771801        }
    17781802    }
     
    19411965  static int level = 0;
    19421966
    1943   int show_it = 0;
     1967  bool show_it = false;
    19441968
    19451969  cmt_string temp;
     
    19571981        {
    19581982            // Should not display on recursive calls
    1959           if (level == 0) show_it = 1;
     1983          if (level == 0) show_it = m_display_it;
    19601984        }
    19611985    }
     
    22762300  cmt_string previous_temp;
    22772301  static const cmt_string empty;
    2278   int show_it = 0;
     2302  bool show_it = false;
    22792303
    22802304  ActionType action = Cmt::get_action ();
     
    22852309        {
    22862310             // Should not display on recursive calls
    2287           if (level == 0) show_it = 1;
     2311          if (level == 0) show_it = m_display_it;
    22882312        }
    22892313    }
     
    25222546  cmt_string previous_temp;
    25232547  static const cmt_string empty;
    2524   int show_it = 0;
     2548  bool show_it = false;
    25252549
    25262550  ActionType action = Cmt::get_action ();
     
    25312555        {
    25322556             // Should not display on recursive calls
    2533           if (level == 0) show_it = 1;
     2557          if (level == 0) show_it = m_display_it;
    25342558        }
    25352559    }
     
    27892813}
    27902814
     2815//-------------------------------------------------------------
     2816bool Symbol::check_tag_used (Tag* tag)
     2817{
     2818  if (tag == 0) return (false);
     2819
     2820  static SymbolVector& Symbols = symbols ();
     2821
     2822  if (Symbols.size () == 0)
     2823    {
     2824      return (false);
     2825    }
     2826
     2827  for (int number = 0; number < Symbol::symbol_number (); number++)
     2828    {
     2829      Symbol& symbol = Symbol::symbol (number);
     2830
     2831      for (int i = 0; i < symbol.value_lists.size (); i++)
     2832        {
     2833          const SymbolValueList& value_list = symbol.value_lists[i];
     2834
     2835          for (int j = 0; j < value_list.values.size (); j++)
     2836            {
     2837              const SymbolValue& value = value_list.values[j];
     2838              Tag* t = value.tag;
     2839
     2840              if (t != 0)
     2841                {
     2842                  if (t->use_operand (tag)) return (true);
     2843                }
     2844            }
     2845        }
     2846    }
     2847
     2848  return (false);
     2849}
     2850
  • /CMT/v1r19/source/cmt_symbol.h

    r1 r3  
    4747{
    4848public:
     49  ValueBuilder ();
     50  const cmt_string build_and_display (const Symbol& symbol);
     51
    4952  virtual const cmt_string build (const Symbol& symbol,
    5053                                  const cmt_string& tag_name = "") = 0;
    5154  virtual const cmt_string clean (const Symbol& symbol,
    5255                                  const cmt_string& tag_name = "") = 0;
     56 protected:
     57  bool m_display_it;
    5358};
    5459
     
    9297  static void expand (cmt_string& text);
    9398
     99  static bool check_tag_used (Tag* tag);
     100
    94101public:
    95102  Symbol ();
     
    103110  int print_clean (PrintMode mode);
    104111  int print (PrintMode mode);
    105   cmt_string build_macro_value () const;
     112  cmt_string build_macro_value (bool display_it = false) const;
    106113  cmt_string clean_macro_value () const;
    107114  cmt_string resolve_macro_value (const cmt_string& tag_name = "");
  • /CMT/v1r19/source/cmt_syntax.cxx

    r1 r3  
    898898  {
    899899    Use::action (words, use);
     900  }
     901
     902  void action (const CmtSystem::cmt_string_vector& words,
     903               Project* project,
     904               const cmt_string& file_name,
     905               int line_number)
     906  {
     907    project->use_action (words[1], words[2]);
    900908  }
    901909};
     
    11191127  m_project_keywords.add ("project", new KwdProject ());
    11201128  m_project_keywords.add ("setup_strategy", new KwdSetupStrategy ());
     1129  m_project_keywords.add ("use", new KwdUse ());
    11211130}
    11221131
  • /CMT/v1r19/source/cmt_tag.cxx

    r1 r3  
    572572
    573573  return (&(default_tag));
     574}
     575
     576/*----------------------------------------------------------*/
     577bool Tag::check_tag_used (const Tag* tag)
     578{
     579  if (tag == 0) return (false);
     580
     581  if (tag->m_tag_refs.size () > 0) return (true);
     582  if (tag->m_tag_excludes.size () > 0) return (true);
     583
     584  return (false);
    574585}
    575586
     
    852863}
    853864
    854 
     865/*
     866  Check if a tag is part of the operands of a tag
     867 */
     868bool Tag::use_operand (const Tag* other) const
     869{
     870  if (other == this) return (true);
     871  if (m_and_operands.size () == 0) return (false);
     872
     873  for (int i = 0; i < m_and_operands.size (); i++)
     874    {
     875      Tag* t = m_and_operands[i];
     876
     877      if (t != 0)
     878        {
     879          if (t->use_operand (other)) return (true);
     880        }
     881    }
     882
     883  return (false);
     884}
     885
     886/*
     887  Check if a tag is part of the refs of a tag
     888 */
     889bool Tag::use_ref (const Tag* other) const
     890{
     891  if (other == this) return (false);
     892  if (m_tag_refs.size () == 0) return (false);
     893
     894  for (int i = 0; i < m_tag_refs.size (); i++)
     895    {
     896      Tag* t = m_tag_refs[i];
     897
     898      if (t == other) return (true);
     899    }
     900
     901  return (false);
     902}
     903
     904
  • /CMT/v1r19/source/cmt_tag.h

    r1 r3  
    3939  static Tag* get_default ();
    4040
     41  static bool check_tag_used (const Tag* tag);
     42
    4143public:
    4244  Tag ();
     
    5658  int get_priority () const;
    5759  void install (TagMap& instances);
     60  bool use_operand (const Tag* other) const;
     61  bool use_ref (const Tag* other) const;
    5862
    5963private:
  • /CMT/v1r19/source/cmt_version.h

    r1 r3  
    88#define __cmt_version_h__
    99
    10 #define CMTVERSION "v1r18p20041201"
     10#define CMTVERSION "v1r18p2005"
    1111
    1212#endif
Note: See TracChangeset for help on using the changeset viewer.