Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Cmt Class Reference

#include <cmt.h>

List of all members.

Static Public Member Functions

void build_config (const cmt_string &prefix, cmt_string &config)
 Append "CONFIG" to the prefix.

void build_makefile (const cmt_string &target)
void build_msdev_file (const cmt_string &target)
void build_vsnet_file (const cmt_string &target)
 Visual Studio.net Support.

bool build_nmake ()
void build_OS9_makefile (const cmt_string &target)
void build_prefix (const cmt_string &package, cmt_string &prefix)
 Convert a package name to its upper case copy.

void clear ()
void configure ()
void configure_cmt_path (Use *use)
void configure_config_tag ()
void configure_current_cmtpath ()
void configure_current_dir ()
void configure_current_package ()
void configure_current_structuring_style ()
void configure_default_path ()
void configure_home (Use *use)
void configure_user_context (Use *use)
void configure_hosttype_tag ()
void configure_site_tag (Use *use)
void configure_tags (Use *use)
void configure_uname_tag ()
void configure_version_tag ()
void do_awk (const ArgParser &ap)
void do_broadcast (const ArgParser &ap)
void do_build_constituent_makefile (const ArgParser &ap)
void do_build_constituents_makefile (const ArgParser &ap)
void do_build_dependencies (const ArgParser &ap, int argc, char *argv[])
void do_build_library_links (const ArgParser &ap)
void do_build_make_setup (const ArgParser &ap)
void do_build_msdev (const ArgParser &ap)
void do_build_CMT_pacman (const ArgParser &ap)
void do_build_vsnet (const ArgParser &ap)
void do_build_os9_makefile (const ArgParser &ap)
void do_build_prototype (const ArgParser &ap)
void do_build_readme (const ArgParser &ap)
void do_build_tag_makefile (const ArgParser &ap)
void do_build_temporary_name (const ArgParser &ap)
void do_build_triggers (const ArgParser &ap)
void do_build_windefs (const ArgParser &ap)
void do_check_configuration (const ArgParser &ap)
void do_check_files (const ArgParser &ap)
void do_check_version (const ArgParser &ap)
void do_checkout (const ArgParser &ap)
void do_cleanup (const ArgParser &ap)
void do_config (const ArgParser &ap)
void do_create (const ArgParser &ap)
void do_create_project (const ArgParser &ap)
void do_cvsbranches (const ArgParser &ap)
void do_cvssubpackages (const ArgParser &ap)
void do_cvssubprojects (const ArgParser &ap)
void do_cvstags (const ArgParser &ap)
void do_do (const ArgParser &ap)
void do_expand_model (const ArgParser &ap)
void do_filter (const ArgParser &ap)
 Handle free filtering of text files containing or ${xxx} patterns.

void do_help (const ArgParser &ap)
void do_lock (const ArgParser &ap)
void do_remove (const ArgParser &ap)
void do_remove_library_links (const ArgParser &ap)
void do_run (const ArgParser &ap)
void do_run_sequence (const ArgParser &ap)
void do_set_version (const ArgParser &ap)
void do_set_versions (const ArgParser &ap)
void do_setup (const ArgParser &ap)
void do_show_action (const ArgParser &ap)
void do_show_action_names (const ArgParser &ap)
void do_show_action_value (const ArgParser &ap)
void do_show_actions (const ArgParser &ap)
void do_show_all_tags (const ArgParser &ap)
void do_show_applied_patterns (const ArgParser &ap)
void do_show_author (const ArgParser &ap)
void do_show_branches (const ArgParser &ap)
void do_show_clients (const ArgParser &ap)
void do_show_cmtpath_patterns (const ArgParser &ap)
void do_show_constituent (const ArgParser &ap)
void do_show_constituent_names (const ArgParser &ap)
void do_show_constituents (const ArgParser &ap)
void do_show_cycles (const ArgParser &ap)
void do_show_fragment (const ArgParser &ap)
void do_show_fragments (const ArgParser &ap)
void do_show_groups (const ArgParser &ap)
void do_show_include_dirs (const ArgParser &ap)
void do_show_language (const ArgParser &ap)
void do_show_languages (const ArgParser &ap)
void do_show_macro (const ArgParser &ap)
void do_show_macro_names (const ArgParser &ap)
void do_show_macro_value (const ArgParser &ap)
void do_show_macros (const ArgParser &ap)
void do_show_manager (const ArgParser &ap)
void do_show_packages (const ArgParser &ap)
void do_show_path (const ArgParser &ap)
void do_show_pattern (const ArgParser &ap)
void do_show_pattern_names (const ArgParser &ap)
void do_show_patterns (const ArgParser &ap)
void do_show_projects (const ArgParser &ap)
void do_show_pwd (const ArgParser &ap)
void do_show_setup (const ArgParser &ap)
void do_show_set (const ArgParser &ap)
void do_show_set_names (const ArgParser &ap)
void do_show_set_value (const ArgParser &ap)
void do_show_sets (const ArgParser &ap)
void do_show_strategies (const ArgParser &ap)
void do_show_tags (const ArgParser &ap)
void do_show_use_paths (const ArgParser &ap)
void do_show_uses (const ArgParser &ap)
void do_show_version (const ArgParser &ap)
void do_show_versions (const ArgParser &ap)
void do_show_system (const ArgParser &ap)
void do_unlock (const ArgParser &ap)
void do_version (const ArgParser &ap)
const cmt_stringfilter_dir (const cmt_string &dir)
ActionType get_action ()
const cmt_stringget_cmt_home ()
const cmt_stringget_cmt_user_context ()
const cmt_stringget_cmt_version ()
const cmt_stringget_current_dir ()
const cmt_stringget_current_package ()
const cmt_stringget_current_cmtpath ()
const cmt_stringget_current_offset ()
AccessMode get_current_access ()
CmtStructuringStyle get_current_structuring_style ()
CmtDirStyle get_current_style ()
const cmt_stringget_current_version ()
const cmt_stringget_current_target ()
bool get_debug ()
bool get_quiet ()
bool get_recursive ()
CmtScopeFilteringMode get_scope_filtering_mode ()
bool get_all_sets_done ()
void guess_current_project ()
 If a project file exists above the current directory we don't need CMTPATH.

void install_cleanup_scripts ()
void install_setup_scripts ()
void install_test_cleanup_scripts ()
void install_test_setup_scripts ()
bool load (const cmt_string &path, const cmt_string &package, const cmt_string &version, const cmt_string &tag_name="")
 load is only called from the Windows GUI which pretends to access directly the internal data model.

bool need_prototypes ()
void parse_arguments (ArgParser &ap)
int parser (const cmt_string &command_line)
int parser (int argc, char *argv[])
void print (PrintMode mode)
 Format as one single line a set of 'setenv' statements joined with semi-colons to form one shell command.

void print_clean (PrintMode mode)
 Format as one single line a set of 'unsetenv' statements joined with semi-colons to form one shell command.

void print_context (Use &use, PrintMode mode, const cmt_string &tag)
void print_macros (PrintMode mode, const cmt_string &pattern="")
 Format a set of make macro definitions (one per line) Each macro value is provided enclosed in single quotes.

void print_symbol_names (PrintMode mode, const cmt_string &pattern="")
 Format a set of make macro definitions (one per line) Each macro value is provided enclosed in single quotes.

void print_tabs (int tabs)
int reach_current_package ()
void restore_all_tags (Use *use)
void set_current_access (AccessMode mode)
void set_scope_filtering_mode (CmtScopeFilteringMode mode)
void set_standard_macros ()
void set_all_sets_done ()
void reset_all_sets_done ()
void use_cmt ()
void use_home_requirements ()
void use_user_context_requirements ()
void use_special_requirements (const cmt_string &path, const cmt_string &name, const cmt_string &file_name)
cmt_string vector_to_string (const CmtSystem::cmt_string_vector &v)
void vector_to_string (const CmtSystem::cmt_string_vector &v, const cmt_string &separator, cmt_string &result)


Member Function Documentation

void Cmt::build_config const cmt_string prefix,
cmt_string config
[static]
 

Append "CONFIG" to the prefix.

Definition at line 376 of file cmt_parser.cxx.

Referenced by configure_current_package(), load(), and reach_current_package().

00378 {
00379   /*
00380     Building the config from <prefix> 
00381   */
00382 
00383   config = prefix;
00384   config += "CONFIG";
00385 }

void Cmt::build_makefile const cmt_string target  )  [static]
 

Definition at line 388 of file cmt_parser.cxx.

References Constituent::build_all_makefiles(), Constituent::build_makefile(), Constituent::find(), CmtContext::m_simulation, Me, and cmt_string::size().

Referenced by build_OS9_makefile().

00389 {
00390   Constituent* constituent = 0;
00391 
00392   if (target.size () > 0)
00393     {
00394       /*
00395         Do genmake for one specific target.
00396       */
00397       constituent = Constituent::find (target);
00398       if (constituent != 0)
00399         {
00400           constituent->build_makefile (Me.m_simulation);
00401         }
00402     }
00403   else
00404     {
00405       /*
00406         Do genmake for all possible targets.
00407       */
00408       Constituent::build_all_makefiles (Me.m_simulation);
00409     }
00410 }

void Cmt::build_msdev_file const cmt_string target  )  [static]
 

Definition at line 413 of file cmt_parser.cxx.

References Constituent::build_all_msdev_files(), Constituent::build_msdev_file(), Constituent::find(), CmtContext::m_simulation, Me, and set_standard_macros().

Referenced by do_build_msdev().

00414 {
00415   Constituent* constituent = 0;
00416 
00417   set_standard_macros ();
00418 
00419   if (target != "")
00420     {
00421       /*
00422         Do genmsdev for one specific target.
00423       */
00424       constituent = Constituent::find (target);
00425       if (constituent != 0)
00426         {
00427           constituent->build_msdev_file (Me.m_simulation);
00428         }
00429     }
00430   else
00431     {
00432       /*
00433         Do genmsdev for all possible targets.
00434       */
00435       Constituent::build_all_msdev_files (Me.m_simulation);
00436     }
00437 }

bool Cmt::build_nmake  )  [static]
 

Definition at line 469 of file cmt_parser.cxx.

References CmtContext::m_build_nmake, and Me.

Referenced by LibraryGenerator::analyze_file(), DependencyGenerator::build(), ConstituentsMakefileGenerator::build(), MakeSetupGenerator::build(), Fragment::locate(), and CmtGenerator::prepare_output().

00470 {
00471   return (Me.m_build_nmake);
00472 }

void Cmt::build_OS9_makefile const cmt_string target  )  [static]
 

Definition at line 475 of file cmt_parser.cxx.

References build_makefile().

Referenced by do_build_os9_makefile().

00476 {
00477   build_makefile (target);
00478 }

void Cmt::build_prefix const cmt_string package,
cmt_string prefix
[static]
 

Convert a package name to its upper case copy.

Definition at line 483 of file cmt_parser.cxx.

Referenced by configure_current_package(), load(), reach_current_package(), and Use::set().

00484 {
00485   int pos;
00486   char c;
00487 
00488   /*
00489     Building the prefix from <package> 
00490   */
00491 
00492   prefix = package;
00493 
00494   for (pos = 0; pos < package.size (); pos++)
00495     {
00496       c = package[pos];
00497       prefix[pos] = toupper (c);
00498     }
00499 }

void Cmt::build_vsnet_file const cmt_string target  )  [static]
 

Visual Studio.net Support.

Definition at line 442 of file cmt_parser.cxx.

References Constituent::build_all_vsnet_files(), Constituent::build_vsnet_file(), Constituent::find(), CmtContext::m_simulation, Me, and set_standard_macros().

Referenced by do_build_vsnet().

00443 {                                                            
00444   Constituent* constituent = 0;                              
00445                                                              
00446   set_standard_macros ();                                    
00447                                                              
00448   if (target != "")                                          
00449     {                                                        
00450       /*                                                     
00451         Do genvsnet for one specific target.                 
00452       */                                                     
00453       constituent = Constituent::find (target);              
00454       if (constituent != 0)                                  
00455         {                                                    
00456           constituent->build_vsnet_file (Me.m_simulation);        
00457         }                                                    
00458     }                                                        
00459   else                                                       
00460     {                                                        
00461       /*                                                     
00462         Do genvsnet for all possible targets.                
00463       */                                                     
00464       Constituent::build_all_vsnet_files (Me.m_simulation);       
00465     }                                                        
00466 }                                                            

void Cmt::clear  )  [static]
 

Definition at line 502 of file cmt_parser.cxx.

References CmtError::clear(), Database::clear(), CmtContext::clear(), Script::clear_all(), Include::clear_all(), and Me.

Referenced by do_show_clients(), load(), and parser().

00503 {
00504   Me.clear ();
00505 
00506   Database::clear ();
00507   Include::clear_all ();
00508   Script::clear_all ();
00509   CmtError::clear ();
00510 }

void Cmt::configure  )  [static]
 

Definition at line 513 of file cmt_parser.cxx.

References Use::change_path(), CmtContext::clear(), configure_cmt_path(), configure_config_tag(), configure_current_dir(), configure_current_package(), configure_current_structuring_style(), configure_default_path(), configure_home(), configure_hosttype_tag(), configure_site_tag(), configure_uname_tag(), configure_version_tag(), Use::current(), CmtError::get_last_error(), guess_current_project(), CmtError::has_pending_error(), log, Log, log_endl, CmtContext::m_autoconfigure_cmtpath, CmtContext::m_configure_error, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_style, CmtContext::m_current_version, Me, Use::set(), and Use::style.

Referenced by do_show_clients(), load(), and parser().

00514 {
00515   Log;
00516   static bool configured = false;
00517 
00518   if (configured) return;
00519 
00520   Me.clear ();
00521 
00522   log << "configure_default_path" << log_endl;
00523   configure_default_path ();
00524   log << "configure_version_tag" << log_endl;
00525   configure_version_tag ();
00526   log << "configure_uname_tag" << log_endl;
00527   configure_uname_tag ();
00528   log << "configure_hosttype_tag" << log_endl;
00529   configure_hosttype_tag ();
00530   log << "configure_config_tag" << log_endl;
00531   configure_config_tag ();
00532   log << "configure_site_tag" << log_endl;
00533   configure_site_tag (0);
00534   log << "configure_home" << log_endl;
00535   // CMTHOME, CMTUSERCONTEXT and CMTPATH
00536   configure_home (0);
00537   log << "configure_current_dir" << log_endl;
00538 
00539 
00540   Me.m_autoconfigure_cmtpath = true;
00541   configure_cmt_path (0);
00542   Me.m_autoconfigure_cmtpath = false;
00543 
00544 
00545   configure_current_dir ();
00546 
00547   log << "configure_current_package" << log_endl;
00548   configure_current_package ();
00549   log << "configure_current_structuring_style" << log_endl;
00550   configure_current_structuring_style ();
00551 
00552   Use& use = Use::current();
00553 
00554   use.set (Me.m_current_package,
00555            Me.m_current_version,
00556            Me.m_current_path,
00557            "",
00558            "");
00559 
00560   use.style = Me.m_current_style;
00561 
00562   use.change_path (Me.m_current_path);
00563 
00564   guess_current_project ();
00565 
00566   if (CmtError::has_pending_error ()) 
00567     {
00568       Me.m_configure_error = CmtError::get_last_error ();
00569     }
00570 }

void Cmt::configure_cmt_path Use use  )  [static]
 

Definition at line 573 of file cmt_parser.cxx.

References action_none, action_show_set, Symbol::build_macro_value(), Symbol::expand(), Symbol::find(), CmtSystem::get_cmt_paths(), CmtSystem::getenv(), ProjectFactory::instance(), CmtContext::m_action, CmtContext::m_autoconfigure_cmtpath, CmtContext::m_cmt_home, CmtContext::m_cmt_user_context, Me, and IProjectFactory::reset().

Referenced by Symbol::action(), configure(), and configure_user_context().

00574 {
00575   if (!Me.m_autoconfigure_cmtpath) return;
00576 
00577   cmt_string s;
00578 
00579   Symbol* symbol = Symbol::find ("CMTPATH");
00580   if (symbol != 0)
00581     {
00582       bool show_set_hidden = false;
00583 
00584       if (Me.m_action == action_show_set)
00585         {
00586           show_set_hidden = true;
00587           Me.m_action = action_none;
00588         }
00589 
00590       s = symbol->build_macro_value ();
00591       Symbol::expand (s);
00592 
00593       if (show_set_hidden)
00594         {
00595           show_set_hidden = false;
00596           Me.m_action = action_show_set;
00597         }
00598     }
00599   else
00600     {
00601       s = CmtSystem::getenv ("CMTPATH");
00602     }
00603 
00604   IProjectFactory& factory = ProjectFactory::instance ();
00605   factory.reset ();
00606 
00607   CmtSystem::get_cmt_paths (factory, s, Me.m_cmt_user_context, Me.m_cmt_home);
00608 }

void Cmt::configure_config_tag  )  [static]
 

Definition at line 611 of file cmt_parser.cxx.

References Tag::add(), CmtSystem::get_cmt_config(), CmtContext::m_cmt_config, Tag::mark(), Me, and PriorityConfig.

Referenced by configure(), and ArgParser::option_tag().

00612 {
00613   Me.m_cmt_config = CmtSystem::get_cmt_config ();
00614   if (Me.m_cmt_config != "")
00615     {
00616       Tag* tag;
00617 
00618       tag = Tag::add (Me.m_cmt_config, PriorityConfig, "CMTCONFIG", 0);
00619       tag->mark ();
00620     }
00621 }

void Cmt::configure_current_cmtpath  )  [static]
 

Definition at line 624 of file cmt_parser.cxx.

References Use::current(), CmtSystem::file_separator(), Project::find_in_cmt_paths(), CmtContext::m_current_cmtpath, CmtContext::m_current_offset, Me, Use::path, and cmt_string::replace().

Referenced by StandardMacroBuilder::fill_for_branches().

00625 {
00626   Use& current_use = Use::current ();
00627 
00628   Me.m_current_cmtpath = "";
00629   Me.m_current_offset = "";
00630 
00631   Me.m_current_cmtpath = Project::find_in_cmt_paths (current_use.path);
00632 
00633   if (Me.m_current_cmtpath != "")
00634     {
00635       static const cmt_string empty_string;
00636       static const cmt_string fs = CmtSystem::file_separator ();
00637 
00638       Me.m_current_offset = current_use.path;
00639 
00646       Me.m_current_offset.replace (Me.m_current_cmtpath, empty_string);
00647       if (Me.m_current_offset[0] == CmtSystem::file_separator ())
00648         {
00649           // Just in case there is a part left after removing the cmtpath entry
00650           
00651           Me.m_current_offset.replace (fs, empty_string);
00652         }
00653     }
00654 }

void Cmt::configure_current_dir  )  [static]
 

Definition at line 736 of file cmt_parser.cxx.

References CmtSystem::file_separator(), CmtMountFilterParser::get_current_dir(), CmtSystem::get_home_directory(), CmtContext::m_cmt_version, CmtContext::m_current_dir, CmtContext::m_default_path, Me, FAwk::run(), and CmtMountFilterParser::set_prefix().

Referenced by configure(), load(), and reach_current_package().

00737 {
00738   cmt_string file_name;
00739 
00740   /*
00741     Building current_dir :
00742 
00743     o we first get the physical value (using getwd)
00744     o then this value is possibly filtered using the
00745     cmt_mount_filter file.
00746   */
00747 
00748   CmtMountFilterParser mount_filter;
00749 
00755   file_name = Me.m_default_path;
00756   if (file_name != "")
00757     {
00758       file_name += CmtSystem::file_separator ();
00759       file_name += "CMT";
00760       file_name += CmtSystem::file_separator ();
00761       file_name += Me.m_cmt_version;
00762       file_name += CmtSystem::file_separator ();
00763       file_name += "mgr";
00764       file_name += CmtSystem::file_separator ();
00765     }
00766 
00767   file_name += "cmt_mount_filter";
00768 
00769   mount_filter.run (file_name);
00770 
00776   mount_filter.set_prefix ("mount_filter");
00777 
00778   mount_filter.run (".cmtrc");
00779 
00785   if (CmtSystem::get_home_directory (file_name))
00786     {
00787       file_name += CmtSystem::file_separator ();
00788       file_name += ".cmtrc";
00789       mount_filter.run (file_name);
00790     }
00791 
00792   Me.m_current_dir = mount_filter.get_current_dir ();
00793 }

void Cmt::configure_current_package  )  [static]
 

Definition at line 796 of file cmt_parser.cxx.

References CmtSystem::basename(), build_config(), build_prefix(), cmt_style, CmtSystem::dirname(), cmt_string::erase(), CmtSystem::file_separator(), cmt_string::find(), CmtSystem::is_version_directory(), CmtContext::m_current_config, CmtContext::m_current_dir, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_prefix, CmtContext::m_current_style, CmtContext::m_current_version, CmtContext::m_debug, Me, mgr_style, no_version_style, none_style, CmtSystem::pwd(), cmt_string::read(), and CmtSystem::test_file().

Referenced by configure(), and do_config().

00797 {
00798   /*
00799     Build current_package and current_prefix.
00800 
00801     This is only possible if we are within the cmt/mgr branch of a
00802     standard directory tree (i.e. <package>/<version>/cmt or mgr)
00803   */
00804 
00805   cmt_string req = "..";
00806   req += CmtSystem::file_separator ();
00807   req += "cmt";
00808   req += CmtSystem::file_separator ();
00809   req += "requirements";
00810 
00811   if (CmtSystem::test_file (req))
00812     {
00813       Me.m_current_style = cmt_style;
00814     }
00815   else
00816     {
00817       cmt_string req = "..";
00818       req += CmtSystem::file_separator ();
00819       req += "mgr";
00820       req += CmtSystem::file_separator ();
00821       req += "requirements";
00822 
00823       if (CmtSystem::test_file (req))
00824         {
00825           Me.m_current_style = mgr_style;
00826         }
00827       else
00828         {
00829           // This package is probably a standalone one
00830           Me.m_current_style = none_style;
00831         }
00832     }
00833 
00834 
00835   if (Me.m_current_style != none_style)
00836     {
00837       //
00838       //  Here there is a ../cmt or ../mgr branch in front of us
00839       //  and there is a requirements file there
00840       //
00841 
00842       cmt_string up_dir;
00843       cmt_string up_branch;
00844 
00845       CmtSystem::dirname (Me.m_current_dir, up_dir);
00846       CmtSystem::basename (up_dir, up_branch);
00847 
00848       cmt_string version_file = "..";
00849       version_file += CmtSystem::file_separator ();
00850       version_file += "cmt";
00851       version_file += CmtSystem::file_separator ();
00852       version_file += "version.cmt";
00853 
00854       if (CmtSystem::test_file (version_file))
00855         {
00856           // 
00857           // There is an explicit version descriptor. This one takes precedence
00858           // and forces the structuring style to no directory
00859           //
00860 
00861           Me.m_current_package = up_branch;
00862           CmtSystem::dirname (up_dir, Me.m_current_path);
00863 
00864           if (Me.m_current_version.read (version_file))
00865             {
00866               int pos;
00867 
00868               pos = Me.m_current_version.find ('\n');
00869               if (pos != cmt_string::npos) Me.m_current_version.erase (pos);
00870               pos = Me.m_current_version.find ('\r');
00871               if (pos != cmt_string::npos) Me.m_current_version.erase (pos);
00872             }
00873           else
00874             {
00875               Me.m_current_version = "v*";
00876             }
00877 
00878           if (Me.m_debug)
00879             {
00880               cout << "Cmt::configure_current_package>" << endl
00881                    << " m_current_package " << Me.m_current_package << endl
00882                    << " m_current_version " << Me.m_current_version << endl
00883                    << " m_current_dir " << Me.m_current_dir << endl
00884                    << " pwd " << CmtSystem::pwd ()
00885                    << endl;
00886             }
00887 
00888           Me.m_current_style = no_version_style;
00889         }
00890       else if (CmtSystem::is_version_directory (up_branch))
00891         {
00892           // The up branch IS a version directory.
00893 
00894           Me.m_current_version = up_branch;
00895           CmtSystem::dirname (up_dir, up_dir);
00896           CmtSystem::basename (up_dir, Me.m_current_package);
00897           CmtSystem::dirname (up_dir, Me.m_current_path);
00898         }
00899       else
00900         {
00901           // No version descriptor
00902           // No version directory. The version is defaulted to v*
00903  
00904           CmtSystem::basename (up_dir, Me.m_current_package);
00905           Me.m_current_version = "v*";
00906           CmtSystem::dirname (up_dir, Me.m_current_path);
00907 
00908           Me.m_current_style = no_version_style;
00909         }
00910 
00911       build_prefix (Me.m_current_package, Me.m_current_prefix);
00912       build_config (Me.m_current_prefix, Me.m_current_config);
00913     }
00914   else
00915     {
00916       Me.m_current_package = "cmt_standalone";
00917       Me.m_current_version = "";
00918       Me.m_current_path = Me.m_current_dir;
00919       build_prefix (Me.m_current_package, Me.m_current_prefix);
00920       build_config (Me.m_current_prefix, Me.m_current_config);
00921       Me.m_current_style = none_style;
00922     }
00923 
00924   //cout << "configure_current_package> current style=" << Me.m_current_style << endl;
00925 }

void Cmt::configure_current_structuring_style  )  [static]
 

Definition at line 928 of file cmt_parser.cxx.

References CmtSystem::getenv(), CmtContext::m_current_structuring_style, Me, and without_version_directory.

Referenced by configure().

00929 {
00930   cmt_string s;
00931 
00932   s = CmtSystem::getenv ("CMTSTRUCTURINGSTYLE");
00933   if (s == "without_version_directory")
00934     {
00935       Me.m_current_structuring_style = without_version_directory;
00936     }
00937 }

void Cmt::configure_default_path  )  [static]
 

Definition at line 940 of file cmt_parser.cxx.

References CmtSystem::file_separator(), CmtSystem::get_cmt_root(), CmtSystem::get_cmt_version(), CmtContext::m_cmt_root, CmtContext::m_cmt_version, CmtContext::m_default_path, and Me.

Referenced by configure().

void Cmt::configure_home Use use  )  [static]
 

Definition at line 952 of file cmt_parser.cxx.

References Symbol::build_macro_value(), configure_user_context(), Symbol::expand(), Symbol::find(), CmtSystem::getenv(), CmtContext::m_cmt_home, Me, CmtSystem::test_directory(), and CmtSystem::testenv().

Referenced by Symbol::action(), configure(), and ArgParser::option_tag().

00953 {
00954   Me.m_cmt_home = "";
00955 
00956   Symbol* symbol = Symbol::find ("CMTHOME");
00957   if (symbol != 0)
00958     {
00959       Me.m_cmt_home = symbol->build_macro_value ();
00960       Symbol::expand (Me.m_cmt_home);
00961     }
00962   else if (CmtSystem::testenv ("CMTHOME"))
00963     {
00964       Me.m_cmt_home = CmtSystem::getenv ("CMTHOME");
00965     }
00966 
00967   if ((Me.m_cmt_home != "") && !CmtSystem::test_directory (Me.m_cmt_home))
00968     {
00969       Me.m_cmt_home = "";
00970     }
00971 
00972   configure_user_context (0);
00973 }

void Cmt::configure_hosttype_tag  )  [static]
 

Definition at line 1002 of file cmt_parser.cxx.

References Tag::add(), CmtSystem::get_hosttype(), Tag::mark(), and PriorityUname.

Referenced by configure(), load(), ArgParser::option_tag(), and ArgParser::option_tag_remove().

01003 {
01004   cmt_string hosttype;
01005 
01006   CmtSystem::get_hosttype (hosttype);
01007 
01008   if (hosttype != "")
01009     {
01010       Tag* tag;
01011 
01012       tag = Tag::add (hosttype, PriorityUname, "HOSTTYPE", 0);
01013       tag->mark ();
01014     }
01015 }

void Cmt::configure_site_tag Use use  )  [static]
 

Definition at line 1018 of file cmt_parser.cxx.

References Tag::add(), Symbol::build_macro_value(), Symbol::expand(), Symbol::find(), CmtSystem::get_cmt_site(), CmtContext::m_cmt_site, Tag::mark(), Me, and PrioritySite.

Referenced by Symbol::action(), configure(), load(), ArgParser::option_tag(), and ArgParser::option_tag_remove().

01019 {
01020   Symbol* symbol = Symbol::find ("CMTSITE");
01021   if (symbol != 0)
01022     {
01023       Me.m_cmt_site = symbol->build_macro_value ();
01024       Symbol::expand (Me.m_cmt_site);
01025     }
01026   else
01027     {
01028       Me.m_cmt_site = CmtSystem::get_cmt_site ();
01029     }
01030 
01031   if (Me.m_cmt_site != "")
01032     {
01033       cmt_string s = "CMTSITE";
01034 
01035       if (use != 0)
01036         {
01037           s += " in ";
01038         }
01039 
01040       Tag* tag;
01041 
01042       tag = Tag::add (Me.m_cmt_site, PrioritySite, s, use);
01043       tag->mark ();
01044     }
01045 }

void Cmt::configure_tags Use use  )  [static]
 

Definition at line 1091 of file cmt_parser.cxx.

References action_none, action_show_set, Tag::add(), Symbol::build_macro_value(), Symbol::expand(), Symbol::find(), CmtSystem::get_uname(), CmtSystem::getenv(), log, Log, log_endl, CmtContext::m_action, CmtContext::m_current_tag, Tag::mark(), Me, PriorityConfig, and CmtSystem::testenv().

Referenced by Symbol::action(), and restore_all_tags().

01092 {
01093   cmt_string config_tag;
01094 
01095   Log;
01096 
01097   //if (Me.m_debug) cout << "configure_tags0> current_tag=" << Me.m_current_tag << endl;
01098 
01099   log << "current_tag=" << Me.m_current_tag << log_endl;
01100 
01101   Symbol* symbol = Symbol::find ("CMTCONFIG");
01102   if (symbol != 0)
01103     {
01104       bool show_set_hidden = false;
01105 
01106       if (Me.m_action == action_show_set)
01107         {
01108           show_set_hidden = true;
01109           Me.m_action = action_none;
01110         }
01111 
01112       config_tag = symbol->build_macro_value ();
01113       Symbol::expand (config_tag);
01114 
01115       if (show_set_hidden)
01116         {
01117           show_set_hidden = false;
01118           Me.m_action = action_show_set;
01119         }
01120     }
01121   else if (CmtSystem::testenv ("CMTCONFIG"))
01122     {
01123       config_tag = CmtSystem::getenv ("CMTCONFIG");
01124     }
01125   else if (CmtSystem::testenv ("CMTBIN"))
01126     {
01127       config_tag = CmtSystem::getenv ("CMTBIN");
01128     }
01129 
01130   if (config_tag == "")
01131     {
01132       CmtSystem::get_uname (config_tag);
01133     }
01134 
01135   //if (Me.m_debug) cout << "configure_tags> current_tag=" << Me.m_current_tag << endl;
01136   log << "current_tag=" << Me.m_current_tag << log_endl;
01137 
01138   cmt_string s = "CMTCONFIG";
01139 
01140   if (use != 0)
01141     {
01142       s += " in ";
01143     }
01144 
01145   Tag* tag;
01146 
01147   tag = Tag::add (config_tag, PriorityConfig, s, use);
01148   tag->mark ();
01149 
01150     //Me.m_current_tag = config_tag;
01151 }

void Cmt::configure_uname_tag  )  [static]
 

Definition at line 1154 of file cmt_parser.cxx.

References Tag::add(), CmtSystem::get_uname(), Tag::mark(), and PriorityUname.

Referenced by configure(), load(), ArgParser::option_tag(), ArgParser::option_tag_add(), and ArgParser::option_tag_remove().

01155 {
01156   cmt_string uname;
01157 
01158   CmtSystem::get_uname (uname);
01159 
01160   if (uname != "")
01161     {
01162       Tag* tag;
01163 
01164       tag = Tag::add (uname, PriorityUname, "uname", 0);
01165       tag->mark ();
01166     }
01167 }

void Cmt::configure_user_context Use use  )  [static]
 

Definition at line 976 of file cmt_parser.cxx.

References Symbol::build_macro_value(), configure_cmt_path(), Symbol::expand(), Symbol::find(), CmtSystem::getenv(), CmtContext::m_cmt_user_context, CmtContext::m_debug, Me, CmtSystem::test_directory(), and CmtSystem::testenv().

Referenced by Symbol::action(), and configure_home().

00977 {
00978   Me.m_cmt_user_context = "";
00979 
00980   Symbol* symbol = Symbol::find ("CMTUSERCONTEXT");
00981   if (symbol != 0)
00982     {
00983       Me.m_cmt_user_context = symbol->build_macro_value ();
00984       Symbol::expand (Me.m_cmt_user_context);
00985     }
00986   else if (CmtSystem::testenv ("CMTUSERCONTEXT"))
00987     {
00988       Me.m_cmt_user_context = CmtSystem::getenv ("CMTUSERCONTEXT");
00989     }
00990 
00991   if ((Me.m_cmt_user_context != "") && !CmtSystem::test_directory (Me.m_cmt_user_context))
00992     {
00993       Me.m_cmt_user_context = "";
00994     }
00995 
00996   if (Me.m_debug) cout << "configure_user_context> user_context=" << Me.m_cmt_user_context << endl;
00997 
00998   configure_cmt_path (0);
00999 }

void Cmt::configure_version_tag  )  [static]
 

Definition at line 1170 of file cmt_parser.cxx.

References Tag::add(), CMTVERSION, CmtSystem::is_version_directory(), Tag::mark(), and PriorityVersion.

Referenced by configure(), load(), ArgParser::option_tag(), and ArgParser::option_tag_remove().

01171 {
01172   int v = 0;
01173   int r = 0;
01174   int p = 0;
01175 
01176   CmtSystem::is_version_directory (CMTVERSION, v, r, p);
01177 
01178   Tag* tag;
01179 
01180   static char temp[80];
01181 
01182   sprintf (temp, "CMTv%d", v);
01183 
01184   tag = Tag::add (temp, PriorityVersion, "CMTVERSION", 0);
01185   tag->mark ();
01186 
01187   sprintf (temp, "CMTr%d", r);
01188 
01189   tag = Tag::add (temp, PriorityVersion, "CMTVERSION", 0);
01190   tag->mark ();
01191 
01192   sprintf (temp, "CMTp%d", p);
01193 
01194   tag = Tag::add (temp, PriorityVersion, "CMTVERSION", 0);
01195   tag->mark ();
01196 
01197 }

void Cmt::do_awk const ArgParser ap  )  [static]
 

Definition at line 1216 of file cmt_parser.cxx.

References ArgParser::arguments, cmt_string::read(), Awk::run(), and cmt_vector< T >::size().

Referenced by parser().

01217 {
01218   if (ap.arguments.size () < 1)
01219     {
01220       cerr << "#CMT> cmt awk <file> <pattern>" << endl;
01221       return;
01222     }
01223 
01224   const cmt_string& file = ap.arguments[0];
01225   const cmt_string& pattern = ap.arguments[1];
01226   cmt_string text;
01227 
01228   text.read (file);
01229 
01230   static AwkActor a;
01231 
01232   cmt_regexp exp (pattern);
01233 
01234   a.run (text, exp);
01235 }

void Cmt::do_broadcast const ArgParser ap  )  [static]
 

Definition at line 1238 of file cmt_parser.cxx.

References cmt_vector< T >::add(), Symbol::all_set(), ArgParser::arguments, CmtSystem::basename(), cmt_string::c_str(), CmtSystem::cd(), CmtLock::check(), cmt_vector< T >::clear(), CmtSystem::cmt_string_vector, Use::current(), CmtSystem::dirname(), Use::discarded, cmt_string::erase(), CmtSystem::execute(), CmtSystem::file_separator(), Project::fill_selection(), cmt_string::find(), Project::find_in_cmt_paths(), Use::get_full_path(), Use::get_ordered_uses(), Use::get_package_name(), Use::located(), CmtContext::m_quiet, Me, mgr_style, parser(), Use::path, CmtSystem::pwd(), cmt_string::replace(), cmt_string::replace_all(), reset_all_sets_done(), Project::scan_paths(), CmtError::set(), cmt_string::size(), cmt_vector< T >::size(), CmtSystem::split(), Use::style, cmt_string::substr(), Use::UsePtrVector, and Use::version.

Referenced by do_set_versions(), and parser().

01239 {
01240   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
01241 
01242   CmtSystem::cmt_string_vector uses;
01243   CmtSystem::cmt_string_vector packages;
01244   CmtSystem::cmt_string_vector versions;
01245   CmtSystem::cmt_string_vector path_selections;
01246   CmtSystem::cmt_string_vector selections;
01247   CmtSystem::cmt_string_vector exclusions;
01248   cmt_string begin;
01249   cmt_string command;
01250   bool is_cmt = false;
01251   int first = 0;
01252   int i;
01253   bool ignore_errors = false;
01254   bool all_packages = false;
01255 
01256   bool local = true;
01257 
01258   for (i = 0; i < ap.arguments.size (); i++)
01259     {
01260       const cmt_string& w = ap.arguments[i];
01261 
01262       //cerr << "broadcast: arg=[" << w << "]" << endl;
01263 
01264       if (command == "")
01265         {
01266           if (w.substr (0, 13) == "-all_packages")
01267             {
01268               local = false;
01269               all_packages = true;
01270             }
01271           else if (w.substr (0, 7) == "-depth=")
01272             {
01273               local = false;
01274 
01275               cmt_string depth_str;
01276               int depth_value = 0;
01277                           
01278               w.substr (7, depth_str);
01279               if ((sscanf (depth_str.c_str (), "%d", &depth_value) < 1) ||
01280                   (depth_value < 1))
01281                 {
01282                   // Syntax error
01283                   //  We shall restrict to packages found within 
01284                   // the <depth_value> first elements of CMTPATH.
01285                   //  If CMTPATH is empty, nothing is selected.
01286                   // depth=1 is equivalent to local
01287                 }
01288 
01289               Project::fill_selection (depth_value, path_selections);
01290             }
01291           else if (w.substr (0, 9) == "-exclude=")
01292             {
01293               cmt_string exclusion;
01294 
01295               w.substr (9, exclusion);
01296 
01297               int size = exclusion.size ();
01298               
01299               if (size >= 2)
01300                 {
01301                   if (((exclusion[0] == '"') && (exclusion[size - 1] == '"')) ||
01302                       ((exclusion[0] == '\'') && (exclusion[size - 1] == '\'')))
01303                     {
01304                       exclusion.erase (size - 1);
01305                       exclusion.erase (0, 1);
01306                     }
01307 
01308                   CmtSystem::split (exclusion, " \t", exclusions);
01309                 }
01310             }
01311           else if (w.substr (0, 7) == "-global")
01312             {
01313               path_selections.clear ();
01314 
01315               local = false;
01316             }
01317           else if (w.substr (0, 6) == "-local")
01318             {
01319               local = true;
01320             }
01321           else if (w.substr (0, 8) == "-select=")
01322             {
01323               cmt_string selection;
01324 
01325               w.substr (8, selection);
01326 
01327               //cerr << "Select=[" << selection << "]" << endl;
01328 
01329               int size = selection.size ();
01330               
01331               if (size >= 2)
01332                 {
01333                   if (((selection[0] == '"') && (selection[size - 1] == '"')) ||
01334                       ((selection[0] == '\'') && (selection[size - 1] == '\'')))
01335                     {
01336                       selection.erase (size - 1);
01337                       selection.erase (0, 1);
01338                     }
01339                 }
01340 
01341               CmtSystem::split (selection, " \t", selections);
01342 
01343               //cerr << "Selections.size () = " << selections.size () << endl;
01344             }
01345           else if (w.substr (0, 7) == "-begin=")
01346             {
01347               w.substr (7, begin);
01348             }
01349           else
01350             {
01351               command = w;
01352             }
01353         }
01354       else
01355         {
01356           command += " ";
01357           command += w;
01358         }
01359 
01360     }
01361 
01362   if (local)
01363     {
01364       Project::fill_selection (1, path_selections);
01365     }
01366 
01367   if (command[0] == '-')
01368     {
01369       ignore_errors = true;
01370       command.erase (0, 1);
01371     }
01372 
01373   //if (command.substr (0, 3) == "cmt") is_cmt = true;
01374 
01375   if (all_packages)
01376     {
01377       PackageSelector selector (uses);
01378       PathScanner scanner;
01379       Project::scan_paths (scanner, selector);
01380     }
01381   else
01382     {
01383       for (i = Uses.size () - 1; i >= 0; i--)
01384         {
01385           Use* use = Uses[i];
01386                   
01387           if (use->discarded) continue;
01388 
01389           if (!use->located ())
01390             {
01391               if (!Me.m_quiet)
01392                 {
01393                   cerr << "#CMT> package " << use->get_package_name () <<
01394                       " " << use->version << " " << use->path <<
01395                       " not found" <<
01396                       endl;
01397                 }
01398             }
01399           else
01400             {
01401               if (use->get_package_name () != "CMT")
01402                 {
01403                   cmt_string& s = uses.add ();
01404 
01405                   use->get_full_path (s);
01406 
01407                   s += CmtSystem::file_separator ();
01408                   if (use->style == mgr_style) s += "mgr";
01409                   else s += "cmt";
01410 
01411                   cmt_string& v = versions.add ();
01412                   v = use->version;
01413 
01414                   cmt_string& p = packages.add ();
01415                   p = use->get_package_name ();
01416 
01417                   //cout << ">>> adding " << s << " to selection" << endl;
01418                 }
01419             }
01420         }
01421           
01422       {
01423         cmt_string& s = uses.add ();
01424                   
01425         Use* use = &(Use::current ());
01426 
01427         if (use->get_package_name ().find ("cmt_standalone") != cmt_string::npos)
01428           {
01429             s = CmtSystem::pwd ();
01430           }
01431         else
01432           {
01433             use->get_full_path (s);
01434 
01435             s += CmtSystem::file_separator ();
01436                   
01437             if (use->style == mgr_style) s += "mgr";
01438             else s += "cmt";
01439           }
01440 
01441         cmt_string& v = versions.add ();
01442         v = use->version;
01443 
01444         cmt_string& p = packages.add ();
01445         p = use->get_package_name ();
01446 
01447         //cout << ">>> adding current " << s << " to selection" << endl;
01448       }
01449     }
01450 
01451   bool started = false;
01452 
01453   if (begin == "") started = true;
01454 
01455   Cmt::reset_all_sets_done ();
01456   Symbol::all_set ();
01457 
01458   for (i = 0; i < uses.size (); i++)
01459     {
01460       const cmt_string& s = uses[i];
01461       const cmt_string& v = versions[i];
01462       const cmt_string& p = packages[i];
01463       cmt_string cmtpath;
01464 
01465       bool ok = true;
01466       bool selected = true;
01467       bool excluded = false;
01468 
01469       if (path_selections.size () > 0)
01470         {
01471           selected = false;
01472 
01473           for (int j = 0; j < path_selections.size (); j++)
01474             {
01475               const cmt_string& sel = path_selections[j];
01476               
01477               if (s.find (sel) != cmt_string::npos) 
01478                 {
01479                   cmtpath = sel;
01480                   selected = true;
01481                   break;
01482                 }
01483             }
01484 
01485           ok = selected;
01486         }
01487 
01488       if (ok)
01489         {
01490           if (selections.size () > 0)
01491             {
01492               selected = false;
01493               
01494               for (int j = 0; j < selections.size (); j++)
01495                 {
01496                   const cmt_string& sel = selections[j];
01497                   
01498                   if (s.find (sel) != cmt_string::npos) 
01499                     {
01500                       selected = true;
01501                       break;
01502                     }
01503                 }
01504               
01505               ok = selected;
01506             }
01507         }
01508 
01509       if (ok && !started)
01510         {
01511           if (s.find (begin) != cmt_string::npos)
01512             {
01513               started = true;
01514               ok = true;
01515             }
01516           else
01517             {
01518               ok = false;
01519             }
01520         }
01521 
01522 
01523       if (ok)
01524         {
01525           excluded = false;
01526 
01527           for (int j = 0; j < exclusions.size (); j++)
01528             {
01529               const cmt_string& exc = exclusions[j];
01530               
01531               if (s.find (exc) != cmt_string::npos) 
01532                 {
01533                   excluded = true;
01534                   break;
01535                 }
01536             }
01537 
01538           if (excluded) ok = false;
01539         }
01540 
01541       if (!ok) 
01542         {
01543           continue;
01544         }
01545 
01546 
01547 
01548       if (!CmtSystem::cd (s))
01549         {
01550           if (s.find ("cmt_standalone") != cmt_string::npos)
01551             {
01552               cerr << "#CMT> Currently not in a CMT package" << endl;
01553             }
01554           else
01555             {
01556               cerr << "#CMT> Cannot move to the package in " << s << " (" << i+1 << "/" 
01557                    << uses.size () << ")"<< endl;
01558             }
01559 
01560           if (!ignore_errors) break;
01561 
01562           continue;
01563         }
01564 
01565       if (CmtLock::check () == CmtLock::locked_by_another_user)
01566         {
01567           cerr << "#CMT> Ignore locked package in " << s << " (" << i+1 << "/" 
01568                << uses.size () << ")" << endl;
01569           continue;
01570         }
01571 
01572       if (cmtpath == "")
01573         {
01574           cmt_string sel = CmtSystem::pwd ();
01575           cmtpath = Project::find_in_cmt_paths (sel);
01576         }
01577 
01578       cmt_string cmd = command;
01579       static const cmt_string version_template = "<version>";
01580       cmd.replace_all (version_template, v);
01581 
01582       static const cmt_string package_template = "<package>";
01583       cmd.replace_all (package_template, p);
01584 
01585       static const cmt_string cmtpath_template = "<package_cmtpath>";
01586       cmd.replace_all (cmtpath_template, cmtpath);
01587 
01588       static const cmt_string offset_template = "<package_offset>";
01589 
01590       static const cmt_string empty_string;
01591       static const cmt_string fs = CmtSystem::file_separator ();
01592       cmt_string offset = s;
01593       offset.replace (cmtpath, empty_string);
01594       if (offset[0] == CmtSystem::file_separator ())
01595         {
01596           offset.replace (fs, empty_string);
01597         }
01598       CmtSystem::dirname (offset, offset);
01599 
01600       cmt_string n;
01601       CmtSystem::basename (offset, n);
01602       if (n == p)
01603         {
01604           CmtSystem::dirname (offset, offset);
01605         }
01606       else
01607         {
01608           CmtSystem::dirname (offset, offset);
01609           CmtSystem::dirname (offset, offset);
01610         }
01611 
01612       cmd.replace_all (offset_template, offset);
01613 
01614 
01615       cout << "#--------------------------------------------------------------" << endl;
01616       cout << "# Now trying [" << cmd << "] in " << s << " (" << i+1 << "/" << uses.size () 
01617            << ")" << endl;
01618       cout << "#--------------------------------------------------------------" << endl;
01619 
01620       if (is_cmt)
01621         {
01622           //
01623           //  There is a bug in the recursive use of the parser. Macros are not set correctly.
01624           //  Thus the recursive optimization is now discarded.
01625           //
01626           if (parser (cmd) != 0)
01627             {
01628               CmtError::set (CmtError::execution_error, cmd);
01629               break;
01630             }
01631         }
01632       else
01633         {
01634           int status = CmtSystem::execute (cmd);
01635 
01636           //cerr << "do_broadcast> status=" << status << " ignore_errors=" << ignore_errors << endl;
01637 
01638           if ((status != 0) && !ignore_errors)
01639               //if ((status != 0) && !ignore_errors)
01640             {
01641               if (status != 2) CmtError::set (CmtError::execution_error, cmd);
01642               break;
01643             }
01644         }
01645     }
01646 }

void Cmt::do_build_CMT_pacman const ArgParser ap  )  [static]
 

Definition at line 1816 of file cmt_parser.cxx.

References CMTVERSION, CmtSystem::file_separator(), CmtContext::m_cmt_root, Me, cmt_string::read(), and cmt_string::replace_all().

Referenced by parser().

01817 {
01818   cmt_string pacman_file;
01819 
01820   pacman_file = Me.m_cmt_root;
01821   pacman_file += CmtSystem::file_separator ();
01822   pacman_file += "mgr";
01823   pacman_file += CmtSystem::file_separator ();
01824   pacman_file += "CMT.pacman";
01825 
01826   cmt_string pacman;
01827   cmt_string pattern = "<version>";
01828   cmt_string replacement = CMTVERSION;
01829 
01830   pacman.read (pacman_file);
01831 
01832   pacman.replace_all (pattern, replacement);
01833 
01834   cout << pacman << endl;
01835 }

void Cmt::do_build_constituent_makefile const ArgParser ap  )  [static]
 

Definition at line 1649 of file cmt_parser.cxx.

References ArgParser::arguments, Generator::build_constituent_makefile(), CmtLock::check(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01650 {
01651   if (CmtLock::check () == CmtLock::locked_by_another_user)
01652     {
01653       CmtError::set (CmtError::conflicting_lock, "build_constituent_makefile>");
01654       return;
01655     }
01656   if (ap.arguments.size () > 0) 
01657     {
01658       set_standard_macros ();
01659       Generator::build_constituent_makefile (ap.arguments[0]);
01660     }
01661 }

void Cmt::do_build_constituents_makefile const ArgParser ap  )  [static]
 

Definition at line 1664 of file cmt_parser.cxx.

References ArgParser::arguments, Generator::build_constituents_makefile(), CmtLock::check(), CmtContext::m_current_package, Me, CmtError::set(), and set_standard_macros().

Referenced by parser().

01665 {
01666   if (CmtLock::check () == CmtLock::locked_by_another_user)
01667     {
01668       CmtError::set (CmtError::conflicting_lock, "build_constituents_makefile>");
01669       return;
01670     }
01671   set_standard_macros ();
01672 
01673   Generator::build_constituents_makefile (Me.m_current_package, ap.arguments);
01674 }

void Cmt::do_build_dependencies const ArgParser ap,
int  argc,
char *  argv[]
[static]
 

Definition at line 1677 of file cmt_parser.cxx.

References ArgParser::arguments, Generator::build_dependencies(), CmtLock::check(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01680 {
01681   if (CmtLock::check () == CmtLock::locked_by_another_user)
01682     {
01683       CmtError::set (CmtError::conflicting_lock, "build_dependencies>");
01684       return;
01685     }
01686   if (ap.arguments.size () > 0)
01687     {
01688       set_standard_macros ();
01689 
01690       Generator::build_dependencies (ap.arguments);
01691     }
01692 }

void Cmt::do_build_library_links const ArgParser ap  )  [static]
 

Definition at line 1695 of file cmt_parser.cxx.

References Use::build_library_links(), Symbol::build_macro_value(), CmtLock::check(), Use::current(), Use::discarded, Symbol::expand(), CmtSystem::file_separator(), Symbol::find(), CmtInstallAreaMgr::get_installarea(), Use::get_ordered_uses(), Use::get_package_name(), get_strategy(), CmtInstallAreaMgr::instance(), CmtSystem::mkdir(), CmtError::set(), set_standard_macros(), cmt_vector< T >::size(), and Use::UsePtrVector.

Referenced by parser().

01696 {
01697   cmt_string cmtinstallarea = "";
01698   cmt_string tag = "";
01699   cmt_string shlibsuffix;
01700   cmt_string symlinkcmd;
01701 
01702   if (CmtLock::check () == CmtLock::locked_by_another_user)
01703     {
01704       CmtError::set (CmtError::conflicting_lock, "build_library_links>");
01705       return;
01706     }
01707 
01708   set_standard_macros ();
01709 
01710   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
01711   Use& current_use = Use::current ();
01712   int i;
01713 
01714   {
01715     Symbol* macro = Symbol::find ("shlibsuffix");
01716     if (macro == 0) return;
01717     shlibsuffix = macro->build_macro_value ();
01718     Symbol::expand (shlibsuffix);
01719   }
01720 
01721   {
01722     Symbol* macro = Symbol::find ("library_install_command");
01723     if (macro != 0)
01724       {
01725         symlinkcmd = macro->build_macro_value ();
01726         Symbol::expand (symlinkcmd);
01727       }
01728   }
01729 
01730   if (get_strategy ("InstallArea"))
01731     {
01732       const CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
01733 
01734       //cout << "#IA2>" << endl;
01735       
01736       cmt_string s1 = ia_mgr.get_installarea ();
01737 
01738       {
01739         Symbol* symbol = Symbol::find ("CMTINSTALLAREA");
01740         if (symbol != 0)
01741           {
01742             s1 = symbol->build_macro_value ();
01743             Symbol::expand (s1);
01744           }
01745       }
01746 
01747       cmtinstallarea = s1;
01748                   
01749       cmt_string s2;
01750 
01751       {
01752         Symbol* macro = Symbol::find ("tag");
01753         if (macro != 0)
01754           {
01755             s2 = macro->build_macro_value ();
01756             Symbol::expand (s2);
01757           }
01758       }
01759 
01760       tag = s2;
01761 
01762       cmt_string s = s1;
01763       s += CmtSystem::file_separator ();
01764       s += s2;
01765       s += CmtSystem::file_separator ();
01766       s += "lib";
01767 
01768       CmtSystem::mkdir (s);
01769     }
01770 
01771   current_use.build_library_links (cmtinstallarea, tag, shlibsuffix, symlinkcmd);
01772 
01773   for (i = 0; i < Uses.size (); i++)
01774     {
01775       Use* use = Uses[i];
01776 
01777       if (use == 0) continue;
01778       if (use->discarded) continue;
01779 
01780       if (use->get_package_name () == "CMT") continue;
01781       if (use->get_package_name () == current_use.get_package_name ()) continue;
01782 
01783       use->build_library_links (cmtinstallarea, tag, shlibsuffix, symlinkcmd);
01784     }
01785 }

void Cmt::do_build_make_setup const ArgParser ap  )  [static]
 

Definition at line 1788 of file cmt_parser.cxx.

References Generator::build_make_setup(), CmtLock::check(), CmtContext::m_current_package, Me, CmtError::set(), and set_standard_macros().

Referenced by parser().

01789 {
01790   if (CmtLock::check () == CmtLock::locked_by_another_user)
01791     {
01792       CmtError::set (CmtError::conflicting_lock, "build_make_setup>");
01793       return;
01794     }
01795   set_standard_macros ();
01796   Generator::build_make_setup (Me.m_current_package);
01797 }

void Cmt::do_build_msdev const ArgParser ap  )  [static]
 

Definition at line 1800 of file cmt_parser.cxx.

References ArgParser::arguments, build_msdev_file(), CmtLock::check(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01801 {
01802   if (CmtLock::check () == CmtLock::locked_by_another_user)
01803     {
01804       CmtError::set (CmtError::conflicting_lock, "build_msdev>");
01805       return;
01806     }
01807 
01808   if (true)
01809     {
01810       set_standard_macros ();
01811       if (ap.arguments.size () > 0) build_msdev_file (ap.arguments[0]);
01812       else build_msdev_file ("");
01813     }
01814 }

void Cmt::do_build_os9_makefile const ArgParser ap  )  [static]
 

Definition at line 1856 of file cmt_parser.cxx.

References ArgParser::arguments, build_OS9_makefile(), CmtLock::check(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01857 {
01858   if (CmtLock::check () == CmtLock::locked_by_another_user)
01859     {
01860       CmtError::set (CmtError::conflicting_lock, "build_os9_makefile>");
01861       return;
01862     }
01863 
01864   if (ap.arguments.size () > 0) 
01865     {
01866       set_standard_macros ();
01867       build_OS9_makefile (ap.arguments[0]);
01868     }
01869 }

void Cmt::do_build_prototype const ArgParser ap  )  [static]
 

Definition at line 1872 of file cmt_parser.cxx.

References ArgParser::arguments, Generator::build_prototype(), CmtLock::check(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01873 {
01874   if (CmtLock::check () == CmtLock::locked_by_another_user)
01875     {
01876       CmtError::set (CmtError::conflicting_lock, "build_prototype>");
01877       return;
01878     }
01879 
01880   if (ap.arguments.size () > 0) 
01881     {
01882       set_standard_macros ();
01883       Generator::build_prototype (ap.arguments[0]);
01884     }
01885 }

void Cmt::do_build_readme const ArgParser ap  )  [static]
 

Definition at line 1888 of file cmt_parser.cxx.

References ArgParser::arguments, Generator::build_readme(), CmtLock::check(), CmtError::set(), and set_standard_macros().

Referenced by parser().

01889 {
01890   if (CmtLock::check () == CmtLock::locked_by_another_user)
01891     {
01892       CmtError::set (CmtError::conflicting_lock, "build_readme>");
01893       return;
01894     }
01895 
01896   set_standard_macros ();
01897   Generator::build_readme (ap.arguments);
01898 }

void Cmt::do_build_tag_makefile const ArgParser ap  )  [static]
 

Definition at line 1901 of file cmt_parser.cxx.

References CmtLock::check(), Make, print_macros(), and CmtError::set().

Referenced by parser().

01902 {
01903   if (CmtLock::check () == CmtLock::locked_by_another_user)
01904     {
01905       CmtError::set (CmtError::conflicting_lock, "build_tag_makefile>");
01906       return;
01907     }
01908 
01909   print_macros (Make);
01910 }

void Cmt::do_build_temporary_name const ArgParser ap  )  [static]
 

Definition at line 1913 of file cmt_parser.cxx.

References CmtSystem::get_temporary_name().

Referenced by parser().

01914 {
01915   cmt_string name = CmtSystem::get_temporary_name ();
01916   cout << name << endl;
01917 }

void Cmt::do_build_triggers const ArgParser ap  )  [static]
 

Definition at line 1920 of file cmt_parser.cxx.

References ArgParser::arguments, CmtLock::check(), TriggerGenerator::run(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01921 {
01922   if (CmtLock::check () == CmtLock::locked_by_another_user)
01923     {
01924       CmtError::set (CmtError::conflicting_lock, "build_tag_makefile>");
01925       return;
01926     }
01927 
01928   if (ap.arguments.size () > 0) 
01929     {
01930       set_standard_macros ();
01931       TriggerGenerator::run (ap.arguments[0]);
01932     }
01933 }

void Cmt::do_build_vsnet const ArgParser ap  )  [static]
 

Definition at line 1839 of file cmt_parser.cxx.

References ArgParser::arguments, build_vsnet_file(), CmtLock::check(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01840 {                                                                            
01841   if (CmtLock::check () == CmtLock::locked_by_another_user)                  
01842     {                                                                        
01843       CmtError::set (CmtError::conflicting_lock, "build_vsnet>");            
01844       return;                                                                
01845     }                                                                        
01846                                                                              
01847   if (true)                                                                  
01848     {                                                                        
01849       set_standard_macros ();                                                
01850       if (ap.arguments.size () > 0) build_vsnet_file (ap.arguments[0]);            
01851       else build_vsnet_file ("");                                            
01852     }                                                                        
01853 }                                                                            

void Cmt::do_build_windefs const ArgParser ap  )  [static]
 

Definition at line 1936 of file cmt_parser.cxx.

References ArgParser::arguments, Generator::build_windefs(), CmtLock::check(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

01937 {
01938   if (CmtLock::check () == CmtLock::locked_by_another_user)
01939     {
01940       CmtError::set (CmtError::conflicting_lock, "build_windefs>");
01941       return;
01942     }
01943 
01944   if (ap.arguments.size () > 0) 
01945     {
01946       set_standard_macros ();
01947       Generator::build_windefs (ap.arguments[0]);
01948     }
01949 }

void Cmt::do_check_configuration const ArgParser ap  )  [static]
 

Definition at line 1952 of file cmt_parser.cxx.

References Symbol::check_tag_used(), Tag::check_tag_used(), CmtSystem::cmt_string_vector, Tag::find(), CmtSystem::getenv(), CmtContext::m_extra_tags, Me, cmt_vector< T >::size(), and CmtSystem::split().

Referenced by do_setup(), and parser().

01953 {
01954   cmt_string env;
01955   Tag* tag;
01956 
01957   static CmtSystem::cmt_string_vector tags;
01958 
01959   CmtSystem::split (Me.m_extra_tags, " \t,", tags);
01960 
01961   for (int i = 0; i < tags.size (); i++)
01962     {
01963       const cmt_string& t = tags[i];
01964 
01965       tag = Tag::find (t);
01966       if (tag == 0) continue;
01967 
01968       if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 
01969         {
01970           cerr << "#CMT> The tag " << t << " is not used in any tag expression. Please check spelling" << endl;
01971         }
01972     }
01973 
01974   env = CmtSystem::getenv ("CMTSITE");
01975   if (env == "") 
01976     {
01977       return;
01978     }
01979 
01980   tag = Tag::find (env);
01981   if (tag == 0) 
01982     {
01983       return;
01984     }
01985 
01986   if (!Tag::check_tag_used (tag) && !Symbol::check_tag_used (tag)) 
01987     {
01988       cerr << "#CMT> The CMTSITE value " << env << " is not used in any tag expression. Please check spelling" << endl;
01989     }
01990 }

void Cmt::do_check_files const ArgParser ap  )  [static]
 

Definition at line 1993 of file cmt_parser.cxx.

References ArgParser::arguments, CmtSystem::compare_and_update_files(), and cmt_vector< T >::size().

Referenced by parser().

01994 {
01995   if (ap.arguments.size () >= 2) 
01996     {
01997       cmt_string first_file = ap.arguments[0];
01998       cmt_string second_file = ap.arguments[1];
01999           
02000       if (first_file == "") return;
02001       if (second_file == "") return;
02002           
02003       CmtSystem::compare_and_update_files (first_file, second_file);
02004     }
02005 }

void Cmt::do_check_version const ArgParser ap  )  [static]
 

Definition at line 2008 of file cmt_parser.cxx.

References ArgParser::arguments, CmtSystem::is_version_directory(), and cmt_vector< T >::size().

Referenced by parser().

02009 {
02010   if (ap.arguments.size () > 0)
02011     {
02012       cmt_string name = ap.arguments[0];
02013           
02014       if (name == "") return;
02015       int v = 0;
02016       int r = 0;
02017       int p = 0;
02018           
02019       bool ok = CmtSystem::is_version_directory (name, v, r, p);
02020           
02021       if (ok)
02022         {
02023           cout << "# " << name << " is version " << v << " release " << r << " patch " << p << endl;
02024         }
02025       else
02026         {
02027           cout << "# " << name << " is not a version tag" << endl;
02028         }
02029     }
02030 }

void Cmt::do_checkout const ArgParser ap  )  [static]
 

Definition at line 2033 of file cmt_parser.cxx.

References ArgParser::arguments, and Cvs::checkout().

Referenced by parser().

02034 {
02035   Cvs::checkout (ap.arguments);
02036 }

void Cmt::do_cleanup const ArgParser ap  )  [static]
 

Definition at line 2039 of file cmt_parser.cxx.

References ArgParser::mode, and print_clean().

Referenced by parser().

02040 {
02041   print_clean (ap.mode);
02042 }

void Cmt::do_config const ArgParser ap  )  [static]
 

Definition at line 2045 of file cmt_parser.cxx.

References CmtSystem::basename(), Branch::branches(), Branch::BranchVector, Generator::build_default_makefile(), CmtSystem::cd(), Use::change_path(), CmtLock::check(), CmtSystem::cmt_string_vector, configure_current_package(), Use::current(), install_cleanup_scripts(), install_setup_scripts(), install_test_cleanup_scripts(), install_test_setup_scripts(), CmtContext::m_cmt_config, CmtContext::m_cmt_version, CmtContext::m_current_dir, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_style, CmtContext::m_current_version, CmtContext::m_debug, CmtContext::m_default_path, CmtContext::m_quiet, Me, CmtSystem::mkdir(), Branch::name(), CmtSystem::pwd(), reach_current_package(), CmtSystem::remove_file(), CmtSystem::scan_dir(), Use::set(), CmtError::set(), cmt_vector< T >::size(), Use::style, CmtSystem::test_directory(), and CmtSystem::test_file().

Referenced by do_create(), parser(), and print_context().

02046 {
02047   if (CmtLock::check () == CmtLock::locked_by_another_user)
02048     {
02049       CmtError::set (CmtError::conflicting_lock, "config>");
02050       return;
02051     }
02052 
02053     //Use::UsePtrVector& Uses = Use::get_ordered_uses ();
02054 
02055   if (Me.m_debug)
02056     {
02057       cout << "Cmt::do_config> " << endl;
02058       cout << "pwd " << CmtSystem::pwd () << endl;
02059       cout << "current_dir " << Me.m_current_dir << endl;
02060       cout << "default_path " << Me.m_default_path << endl;
02061       cout << "cmt config " <<
02062           Me.m_current_package << " " <<
02063           Me.m_current_version << " " <<
02064           Me.m_current_path << endl;
02065     }
02066 
02067   if (Me.m_current_package == "CMT") return;
02068   if (Me.m_current_package == "methods") return;
02069 
02070   cmt_string branch;
02071 
02072   CmtSystem::basename (Me.m_current_dir, branch);
02073 
02074   if ((branch != "mgr") && (branch != "cmt"))
02075     {
02076 
02077         //
02078         // Here we are in a standalone package (ie completely unstructured)
02079         //
02080 
02081       if (CmtSystem::test_file ("requirements"))
02082         {
02083           cout << "------------------------------------------" << endl;
02084           cout << "Configuring environment for standalone package." << endl;
02085           cout << "CMT version " << Me.m_cmt_version << "." << endl;
02086           cout << "System is " << Me.m_cmt_config << endl;
02087           cout << "------------------------------------------" << endl;
02088 
02089           install_test_setup_scripts ();
02090           install_test_cleanup_scripts ();
02091 
02092           Generator::build_default_makefile ();
02093         }
02094       else
02095         {
02096           cout << "==============================================" << endl;
02097           cout << "cmt config must be operated either upon "
02098             "an existing package" << endl;
02099           cout << " (ie. when a requirements file already exists)" << endl;
02100           cout << "   > cd ..." << endl;
02101           cout << "   > cmt config" << endl;
02102           cout << "or to create a new package" << endl;
02103           cout << "   > cmt config <package> <version> [<path>]" << endl;
02104           cout << "==============================================" << endl;
02105         }
02106 
02107       return;
02108     }
02109 
02110   configure_current_package ();
02111 
02112   Generator::build_default_makefile ();
02113 
02114   CmtSystem::cmt_string_vector makes;
02115   cmt_regexp expression ("[.]n?make(sav)?$");
02116 
02117   CmtSystem::scan_dir (".", expression, makes);
02118 
02119   if (makes.size () > 0)
02120     {
02121       cout << "Removing all previous make fragments from " << branch << endl;
02122 
02123       for (int i = 0; i < makes.size (); i++)
02124         {
02125           const cmt_string& s = makes[i];
02126           CmtSystem::remove_file (s);
02127         }
02128     }
02129 
02130   CmtSystem::cd ("..");
02131 
02132   CmtSystem::scan_dir (Me.m_cmt_config, expression, makes); 
02133     
02134   if (makes.size () > 0) 
02135     {
02136       cout << "Removing all previous make fragments from "
02137            << Me.m_cmt_config << endl; 
02138 
02139       for (int i = 0; i < makes.size (); i++) 
02140         { 
02141           const cmt_string& s = makes[i]; 
02142           CmtSystem::remove_file (s); 
02143         }    
02144     } 
02145 
02146   /*
02147   // cout << "Try a cleanup of the installation area " << endl;
02148 
02149     //
02150     //  Try a cleanup of the installation area
02151     //
02152   if (get_strategy ("InstallArea"))
02153     {
02154       CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
02155 
02156       //cout << "#IA3>" << endl;
02157 
02158       if (get_strategy ("SetupCleanup"))
02159         {
02160           ia_mgr.config ();
02161         }
02162     }
02163   */
02164 
02165   CmtSystem::cd (branch); 
02166 
02167   Use& use = Use::current ();
02168 
02169   use.set (Me.m_current_package,
02170            Me.m_current_version,
02171            Me.m_current_path,
02172            "",
02173            "");
02174 
02175   use.change_path (Me.m_current_path);
02176   use.style     = Me.m_current_style;
02177 
02178   //cout << "do_config> current style=" << Me.m_current_style << endl;
02179 
02180   Me.m_quiet = true;
02181 
02182   if (!reach_current_package ())
02183     {
02184       cout << "Cannot read the requirements file" << endl;
02185       return;
02186     }
02187 
02188   install_setup_scripts ();
02189   install_cleanup_scripts ();
02190 
02191   CmtSystem::cd ("..");
02192 
02193   Branch::BranchVector& branches = Branch::branches ();
02194 
02195   int i;
02196 
02197   for (i = 0; i < branches.size (); i++)
02198     {
02199       const Branch& branch = branches[i];
02200       const cmt_string& branch_name = branch.name ();
02201 
02202       if (!CmtSystem::test_directory (branch_name))
02203         {
02204           if (!CmtSystem::mkdir (branch_name))
02205             {
02206               cout << "Cannot create the " << branch_name <<" branch" << endl;
02207             }
02208           else
02209             {
02210               cout << "Installing the " << branch_name << " directory" << endl;
02211             }
02212         }
02213       else
02214         {
02215           cout << branch_name << " directory already installed" << endl;
02216         }
02217     }
02218 }

void Cmt::do_create const ArgParser ap  )  [static]
 

Definition at line 2221 of file cmt_parser.cxx.

References CmtSystem::absolute_path(), ArgParser::arguments, Generator::build_default_makefile(), CmtSystem::cd(), cmt_style, CmtSystem::compress_path(), do_config(), CmtSystem::file_separator(), CmtContext::m_cmt_config, CmtContext::m_cmt_version, CmtContext::m_current_dir, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_structuring_style, CmtContext::m_current_style, CmtContext::m_current_version, CmtContext::m_debug, Me, mgr_style, CmtSystem::mkdir(), no_version_style, CmtSystem::pwd(), cmt_vector< T >::size(), CmtSystem::test_directory(), CmtSystem::test_file(), with_version_directory, and without_version_directory.

Referenced by parser().

02222 {
02223   if (ap.arguments.size () < 2) return;
02224 
02225   const cmt_string& package = ap.arguments[0];
02226   const cmt_string& version = ap.arguments[1];
02227   cmt_string offset;
02228   if (ap.arguments.size () >= 3) offset = ap.arguments[2];
02229 
02230   if (Me.m_debug)
02231     {
02232       cout << "do_create>Me.m_current_package=" << Me.m_current_package << endl;
02233       cout << "do_create>package=" << package << endl;
02234     }
02235 
02236     //if (Me.m_current_package == "CMT") return;
02237     //if (Me.m_current_package == "methods") return;
02238 
02239   cmt_string the_path;
02240 
02241   the_path = CmtSystem::pwd ();
02242 
02243   if (offset != "")
02244     {
02245       if (!CmtSystem::absolute_path (offset))
02246         {
02247           // offset is really a relative offset
02248           the_path += CmtSystem::file_separator ();
02249           the_path += offset;
02250         }
02251       else // absolute path
02252         {
02253           the_path = offset;
02254         }
02255     }
02256 
02257   CmtSystem::compress_path (the_path);
02258 
02259   // Now 'the_path' contains the complete path where the package will be created
02260 
02261   cout << "------------------------------------------" << endl;
02262   cout << "Configuring environment for package " << package <<
02263     " version " << version << "." << endl;
02264   cout << "CMT version " << Me.m_cmt_version << "." << endl;
02265   cout << "Root set to " << the_path << "." << endl;
02266   cout << "System is " << Me.m_cmt_config << endl;
02267   cout << "------------------------------------------" << endl;
02268 
02269   if (!CmtSystem::test_directory (the_path))
02270     {
02271       if (!CmtSystem::mkdir (the_path))
02272         {
02273           cout << "Cannot create the path directory" << endl;
02274           return;
02275         }
02276       else
02277         {
02278           cout << "Installing the path directory" << endl;
02279         }
02280     }
02281 
02282   CmtSystem::cd (the_path);
02283 
02284   if (!CmtSystem::test_directory (package))
02285     {
02286       if (!CmtSystem::mkdir (package))
02287         {
02288           cout << "Cannot create the package directory" << endl;
02289           return;
02290         }
02291       else
02292         {
02293           cout << "Installing the package directory" << endl;
02294         }
02295     }
02296   else
02297     {
02298       cout << "Package directory already installed" << endl;
02299     }
02300 
02301   CmtSystem::cd (package);
02302 
02303   if (Me.m_current_structuring_style == with_version_directory)
02304     {
02305       if (!CmtSystem::test_directory (version))
02306         {
02307           if (!CmtSystem::mkdir (version))
02308             {
02309               cout << "Cannot create the version directory" << endl;
02310               return;
02311             }
02312           else
02313             {
02314               cout << "Installing the version directory" << endl;
02315             }
02316         }
02317       else
02318         {
02319           cout << "Version directory already installed" << endl;
02320         }
02321 
02322       CmtSystem::cd (version);
02323     }
02324   else
02325     {
02326       cout << "Version directory will not be created due to structuring style" << endl;
02327     }
02328 
02329   if (!CmtSystem::test_directory ("cmt"))
02330     {
02331       if (!CmtSystem::test_directory ("mgr"))
02332         {
02333           if (!CmtSystem::mkdir ("cmt"))
02334             {
02335               cout << "Cannot create the cmt directory" << endl;
02336               return;
02337             }
02338           else
02339             {
02340               if (Me.m_current_structuring_style == with_version_directory)
02341                 {
02342                   Me.m_current_style = cmt_style;
02343                 }
02344               else
02345                 {
02346                   Me.m_current_style = no_version_style;
02347                 }
02348 
02349               cout << "Installing the cmt directory" << endl;
02350             }
02351         }
02352       else
02353         {
02354           if (Me.m_current_structuring_style == with_version_directory)
02355             {
02356               Me.m_current_style = mgr_style;
02357             }
02358           else
02359             {
02360               Me.m_current_style = no_version_style;
02361             }
02362           
02363           cout << "Mgr directory already installed" << endl;
02364         }
02365     }
02366   else
02367     {
02368       if (Me.m_current_structuring_style == with_version_directory)
02369         {
02370           Me.m_current_style = cmt_style;
02371         }
02372       else
02373         {
02374           Me.m_current_style = no_version_style;
02375         }
02376 
02377       cout << "Cmt directory already installed" << endl;
02378     }
02379 
02380   if (!CmtSystem::test_directory ("src"))
02381     {
02382       if (!CmtSystem::mkdir ("src"))
02383         {
02384           cout << "Cannot create the src directory" << endl;
02385           return;
02386         }
02387       else
02388         {
02389           cout << "Installing the src directory" << endl;
02390         }
02391     }
02392   else
02393     {
02394       cout << "src directory already installed" << endl;
02395     }
02396 
02397   switch (Me.m_current_style)
02398     {
02399     case cmt_style:
02400     case no_version_style:
02401       CmtSystem::cd ("cmt");
02402       break;
02403     case mgr_style:
02404       CmtSystem::cd ("mgr");
02405       break;
02406     }
02407 
02408   Generator::build_default_makefile ();
02409 
02410   if (!CmtSystem::test_file ("requirements"))
02411     {
02412       // create an empty requirement file.
02413       ofstream f ("requirements");
02414       if (f)
02415         {
02416           f << "package " << package << endl;
02417           f << endl;
02418           f.close ();
02419         }
02420     }
02421 
02422   if (Me.m_current_structuring_style == without_version_directory)
02423     {
02424       ofstream f ("version.cmt");
02425       if (f)
02426         {
02427           f << version << endl;
02428           f.close ();
02429         }
02430     }
02431 
02432   Me.m_current_package = package;
02433   Me.m_current_version = version;
02434   Me.m_current_path    = the_path;
02435   Me.m_current_dir     = CmtSystem::pwd ();
02436 
02437   do_config (ap);
02438 }

void Cmt::do_create_project const ArgParser ap  )  [static]
 

Definition at line 2441 of file cmt_parser.cxx.

References ArgParser::arguments, Project::create(), and cmt_vector< T >::size().

Referenced by parser().

02442 {
02443   if (ap.arguments.size () < 1) return;
02444 
02445   const cmt_string& project = ap.arguments[0];
02446   const cmt_string& release = ap.arguments[1];
02447   cmt_string path;
02448 
02449   if (ap.arguments.size () >= 3)
02450     {
02451       path = ap.arguments[2];
02452     }
02453 
02454   Project::create (project, release, path);
02455 }

void Cmt::do_cvsbranches const ArgParser ap  )  [static]
 

Definition at line 2458 of file cmt_parser.cxx.

References ArgParser::arguments, and Cvs::branches().

Referenced by parser().

02459 {
02460   Cvs::branches (ap.arguments[0]);
02461 }

void Cmt::do_cvssubpackages const ArgParser ap  )  [static]
 

Definition at line 2464 of file cmt_parser.cxx.

References ArgParser::arguments, and Cvs::subpackages().

Referenced by parser().

02465 {
02466   Cvs::subpackages (ap.arguments[0]);
02467 }

void Cmt::do_cvssubprojects const ArgParser ap  )  [static]
 

Definition at line 2470 of file cmt_parser.cxx.

References ArgParser::arguments, and Cvs::subprojects().

Referenced by parser().

02471 {
02472   Cvs::subprojects (ap.arguments[0]);
02473 }

void Cmt::do_cvstags const ArgParser ap  )  [static]
 

Definition at line 2476 of file cmt_parser.cxx.

References ArgParser::arguments, and Cvs::tags().

Referenced by parser().

02477 {
02478   Cvs::tags (ap.arguments);
02479 }

void Cmt::do_do const ArgParser ap  )  [static]
 

Definition at line 2482 of file cmt_parser.cxx.

References action_show_action_names, Symbol::all_set(), ArgParser::arguments, Generator::build_default_makefile(), Symbol::build_macro_value(), Use::current(), CmtSystem::execute(), Symbol::expand(), Symbol::find(), CmtContext::m_action, Me, SyntaxParser::parse_requirements_line(), reset_all_sets_done(), CmtError::set(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

02483 {
02484   if (ap.arguments.size () > 0) 
02485     {
02486       set_standard_macros ();
02487       Cmt::reset_all_sets_done ();
02488       Symbol::all_set ();
02489       Generator::build_default_makefile ();
02490 
02491       Symbol* symbol = Symbol::find (ap.arguments[0]);
02492 
02493       if (symbol == 0)
02494         {
02495           Me.m_action = action_show_action_names;
02496           /*
02497           if (!Me.m_quiet)
02498             {
02499               cerr << "Existing actions:" << endl;
02500               print_symbol_names (ap.mode);
02501             }
02502           */
02503           CmtError::set (CmtError::unknown_command, ap.arguments[0]);
02504           return;
02505         }
02506 
02507       /*
02508         We convert extra arguments into the standard macro cmt_args 
02509       */
02510 
02511       cmt_string args;
02512 
02513       for (int i = 1; i < ap.arguments.size (); i++)
02514         {
02515           cmt_string s = ap.arguments[i];
02516           if (i > 1) args += " ";
02517           args += s;
02518         }
02519 
02520       cmt_string r = "macro cmt_args \"";
02521       r += args;
02522       r += "\"";
02523 
02524       Use* current_use = &(Use::current ());
02525       
02526       SyntaxParser::parse_requirements_line (r, current_use);
02527 
02528       cmt_string cmd = symbol->build_macro_value ();
02529       Symbol::expand (cmd);
02530 
02531       cout << "Execute action " << ap.arguments[0] << " => " << cmd << endl;
02532 
02533       CmtSystem::execute (cmd);
02534     }
02535 }

void Cmt::do_expand_model const ArgParser ap  )  [static]
 

Definition at line 2538 of file cmt_parser.cxx.

References ArgParser::arguments, CmtModel::expand(), set_standard_macros(), cmt_vector< T >::size(), CmtModel::strict_expand(), and CmtModel::test_regexp().

Referenced by parser().

02539 {
02540   set_standard_macros ();
02541 
02542   if ((ap.arguments[0] == "-strict") && (ap.arguments.size () > 1))
02543     {
02544       CmtModel::strict_expand (ap.arguments[1]);
02545     }
02546   else if ((ap.arguments[0] == "-test") && (ap.arguments.size () > 2))
02547     {
02548       CmtModel::test_regexp (ap.arguments[1], ap.arguments[2]);
02549     }
02550   else if (ap.arguments.size () > 0)
02551     {
02552       CmtModel::expand (ap.arguments[0]);
02553     }
02554 }

void Cmt::do_filter const ArgParser ap  )  [static]
 

Handle free filtering of text files containing or ${xxx} patterns.

Substitution is performed against CMT macros and environment variables.

Arguments:

cmt filter input-file-name output-file-name

Definition at line 2566 of file cmt_parser.cxx.

References ArgParser::arguments, Symbol::expand(), cmt_string::read(), set_standard_macros(), cmt_vector< T >::size(), CmtSystem::test_file(), and cmt_string::write().

Referenced by parser().

02567 {
02568   if (ap.arguments.size () < 2) return;
02569 
02570   cmt_string& input = ap.arguments[0];
02571   cmt_string& output = ap.arguments[1];
02572 
02573   if (!CmtSystem::test_file (input))
02574     {
02575       cerr << "#CMT> File " << input << " not found" << endl;
02576       return;
02577     }
02578 
02579   cmt_string text;
02580 
02581   text.read (input);
02582 
02583   set_standard_macros ();
02584 
02585   Symbol::expand (text);
02586 
02587   FILE* file = fopen (output, "wb");
02588   if (file == NULL)
02589     {
02590       cerr << "#CMT> Cannot write filtered file " << output << endl;
02591     }
02592   else
02593     {
02594       text.write (file);
02595       fclose (file);
02596     }
02597 }

void Cmt::do_help const ArgParser ap  )  [static]
 

Definition at line 2600 of file cmt_parser.cxx.

References action_none, CmtContext::m_action, Me, CommandHelp::show(), and CommandHelp::show_all().

Referenced by parser().

02601 {
02602   //cerr << "ap.help_action=" << ap.help_action << " Me.m_action=" << Me.m_action << endl;
02603   if (Me.m_action == action_none)
02604     {
02605       CommandHelp::show_all ();
02606     }
02607   else
02608     {
02609       CommandHelp::show (Me.m_action);
02610     }
02611 }

void Cmt::do_lock const ArgParser ap  )  [static]
 

Definition at line 2614 of file cmt_parser.cxx.

References CmtLock::lock(), CmtContext::m_current_path, CmtContext::m_current_version, Me, and set_standard_macros().

Referenced by parser().

02615 {
02616   const cmt_string& package = Me.m_current_package;
02617   const cmt_string& version = Me.m_current_version;
02618   const cmt_string& path    = Me.m_current_path;
02619 
02620   //(unsused) Use& use = Use::current();
02621 
02622   cout << "try to lock package " << package << " in " << CmtSystem::pwd () << endl;
02623 
02624   set_standard_macros ();
02625 
02626   CmtLock::status status = CmtLock::lock ();
02627 }

void Cmt::do_remove const ArgParser ap  )  [static]
 

Definition at line 2630 of file cmt_parser.cxx.

References CmtSystem::absolute_path(), CmtSystem::cd(), CmtSystem::cmt_string_vector, CmtSystem::compress_path(), CmtSystem::file_separator(), CmtContext::m_cmt_config, CmtContext::m_cmt_version, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_version, Me, CmtSystem::pwd(), cmt_string::read(), CmtSystem::remove_directory(), CmtSystem::scan_dir(), cmt_vector< T >::size(), and CmtSystem::test_directory().

Referenced by parser().

02631 {
02632   const cmt_string& package = Me.m_current_package;
02633   const cmt_string& version = Me.m_current_version;
02634   const cmt_string& path    = Me.m_current_path;
02635 
02636     //Use::UsePtrVector& Uses = Use::get_ordered_uses ();
02637 
02638   if (Me.m_current_package == "CMT") return;
02639   if (Me.m_current_package == "methods") return;
02640 
02641   cmt_string the_path;
02642 
02643   //the_path = Me.m_default_path;
02644   the_path = CmtSystem::pwd ();
02645 
02646   if (path != "")
02647     {
02648       if (!CmtSystem::absolute_path (path))
02649         {
02650           // path is just a suffix
02651           the_path += CmtSystem::file_separator ();
02652           the_path += path;
02653         }
02654       else // absolute path
02655         {
02656           the_path = path;
02657         }
02658     }
02659 
02660   CmtSystem::compress_path (the_path);
02661 
02662   cout << "------------------------------------------" << endl;
02663   cout << "Removing package " << package <<
02664     " version " << version << "." << endl;
02665   cout << "CMT version " << Me.m_cmt_version << "." << endl;
02666   cout << "Root set to " << the_path << "." << endl;
02667   cout << "System is " << Me.m_cmt_config << endl;
02668   cout << "------------------------------------------" << endl;
02669 
02670   the_path += CmtSystem::file_separator ();
02671   the_path += package;
02672 
02673   if (!CmtSystem::cd (the_path))
02674     {
02675       cout << "Path " << the_path << " not reachable" << endl;
02676       return;
02677     }
02678 
02679   if (CmtSystem::test_directory (version))
02680     {
02681       if (CmtSystem::remove_directory (version))
02682         {
02683           cout << "Version " << version << " has been removed from " << the_path << endl;
02684           CmtSystem::cmt_string_vector contents;
02685           CmtSystem::scan_dir (".", contents);
02686           if (contents.size () == 0)
02687             {
02688               CmtSystem::cd ("..");
02689               if (CmtSystem::remove_directory (package))
02690                 {
02691                   cout << "Package " << package << " has no more versions. Thus it has been removed."<< endl;
02692                 }
02693             }
02694         }
02695       else
02696         {
02697           cout << "Impossible to remove version " << version << " from " << the_path << endl;
02698         }
02699     }
02700   else if (CmtSystem::test_directory ("cmt"))
02701     {
02702       CmtSystem::cd ("cmt");
02703 
02704       cmt_string v;
02705 
02706       v.read ("version.cmt");
02707       if (v == version)
02708         {
02709           CmtSystem::cd ("..");
02710           if (!CmtSystem::remove_directory ("cmt"))
02711             {
02712               cout << "Unstructured version " << version
02713                    << " has been removed from " << the_path << endl;
02714             }
02715           else
02716             {
02717               cout << "Impossible to remove unstructured version " << version
02718                    << " from " << the_path << endl;
02719             }
02720         }
02721       else
02722         {
02723           cout << "Version " << version << " not found" << endl;
02724         }
02725     }
02726   else
02727     {
02728       cout << "Version " << version << " not found" << endl;
02729     }
02730 }

void Cmt::do_remove_library_links const ArgParser ap  )  [static]
 

Definition at line 2733 of file cmt_parser.cxx.

References CmtSystem::absolute_path(), CmtSystem::basename(), Symbol::build_macro_value(), CmtLock::check(), CmtSystem::cmt_string_vector, Use::current(), Use::discarded, CmtSystem::execute(), Symbol::expand(), CmtSystem::file_separator(), Symbol::find(), CmtInstallAreaMgr::get_installarea(), Use::get_ordered_uses(), Use::get_package_name(), get_strategy(), CmtInstallAreaMgr::instance(), Use::located(), CmtContext::m_quiet, Me, Use::path, CmtError::set(), set_standard_macros(), cmt_vector< T >::size(), CmtSystem::split(), Use::UsePtrVector, and Use::version.

Referenced by parser().

02734 {
02735   if (CmtLock::check () == CmtLock::locked_by_another_user)
02736     {
02737       CmtError::set (CmtError::conflicting_lock, "remove_library_links>");
02738       return;
02739     }
02740 
02741   set_standard_macros ();
02742 
02743   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
02744   Use& current_use = Use::current ();
02745   int i;
02746   cmt_string shlibsuffix;
02747   cmt_string symunlink;
02748 
02749   {
02750     Symbol* macro = Symbol::find ("shlibsuffix");
02751     if (macro == 0) return;
02752     shlibsuffix = macro->build_macro_value ();
02753     Symbol::expand (shlibsuffix);
02754   }
02755 
02756   {
02757     Symbol* macro = Symbol::find ("symunlink");
02758     if (macro == 0) return;
02759     symunlink = macro->build_macro_value ();
02760     Symbol::expand (symunlink);
02761   }
02762 
02763   for (i = 0; i < Uses.size (); i++)
02764     {
02765       Use* use = Uses[i];
02766 
02767       if (use->discarded) continue;
02768 
02769       if (!use->located ())
02770         {
02771           if (!Me.m_quiet)
02772             {
02773               cerr << "#CMT> package " << use->get_package_name () <<
02774                   " " << use->version << " " << use->path << 
02775                   " not found" <<
02776                   endl;
02777             }
02778         }
02779       else
02780         {
02781           if (use->get_package_name () == "CMT") continue;
02782           if (use->get_package_name () == current_use.get_package_name ()) continue;
02783 
02784           cmt_string s;
02785 
02786           s = use->get_package_name ();
02787           s += "_libraries";
02788 
02789           Symbol* libraries_macro = Symbol::find (s);
02790 
02791           if (libraries_macro == 0) continue;
02792 
02793           cmt_string libraries = libraries_macro->build_macro_value ();
02794           Symbol::expand (libraries);
02795 
02796           static CmtSystem::cmt_string_vector values;
02797 
02798           CmtSystem::split (libraries, " \t", values);
02799 
02800           for (int j = 0; j < values.size (); j++)
02801             {
02802               const cmt_string& library = values[j];
02803 
02804               static cmt_string libname;
02805               static cmt_string name;
02806 
02807               // Is it a simple name or a complete path?
02808 
02809               libname = library;
02810               Symbol::expand (libname);
02811 
02812               if (CmtSystem::absolute_path (libname))
02813                 {
02819                   cmt_string suffix;
02820                   CmtSystem::basename (library, name);
02821                 }
02822               else
02823                 {
02831                   name = "lib";
02832                   name += libname;
02833                   name += ".";
02834                   name += shlibsuffix;
02835                 }
02836 
02837               Symbol::expand (libname);
02838 
02839               if (get_strategy ("InstallArea"))
02840                 {
02841                   const CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
02842 
02843                   //cout << "#IA4>" << endl;
02844 
02845                   cmt_string s1 = ia_mgr.get_installarea ();
02846 
02847                   {
02848                     Symbol* symbol = Symbol::find ("CMTINSTALLAREA");
02849                     if (symbol != 0)
02850                       {
02851                         s1 = symbol->build_macro_value ();
02852                         Symbol::expand (s1);
02853                       }
02854                   }
02855                   
02856                   cmt_string s2;
02857 
02858                   {
02859                     Symbol* macro = Symbol::find ("tag");
02860                     if (macro != 0)
02861                       {
02862                         s2 = macro->build_macro_value ();
02863                         Symbol::expand (s2);
02864                       }
02865                   }
02866 
02867                     // Now deleting the reference file
02868 
02869                   s = symunlink;
02870                   s += " ";
02871                   s += s1;
02872                   s += CmtSystem::file_separator ();
02873                   s += s2;
02874                   s += CmtSystem::file_separator ();
02875                   s += "lib";
02876                   s += CmtSystem::file_separator ();
02877                   s += name;
02878                   s += ".cmtref";
02879                   s += " ";
02880                   s += s1;
02881                   s += CmtSystem::file_separator ();
02882                   s += s2;
02883                   s += CmtSystem::file_separator ();
02884                   s += "lib";
02885                   s += CmtSystem::file_separator ();
02886                   s += name;
02887                 }
02888               else
02889                 {
02890                   s = symunlink;
02891                   s += " ../$(";
02892                   s += current_use.get_package_name ();
02893                   s += "_tag)/";
02894                   s += name;
02895                 }
02896 
02897               Symbol::expand (s);
02898 
02899               if (!Me.m_quiet) cout << s << endl;
02900               int status = CmtSystem::execute (s);
02901 
02902               if (status != 0)
02903                 {
02904                   if (status != 2) CmtError::set (CmtError::execution_error, s);
02905 
02906                   cerr << "#CMT> Cannot remove the symbolic link " << s << endl;
02907 
02908                   break;
02909                 }
02910             }
02911         }
02912     }
02913 }

void Cmt::do_run const ArgParser ap  )  [static]
 

Definition at line 2916 of file cmt_parser.cxx.

References Symbol::all_set(), ArgParser::arguments, CmtSystem::execute(), reset_all_sets_done(), set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

02917 {
02918   if (ap.arguments.size () > 0) 
02919     {
02920       set_standard_macros ();
02921       Cmt::reset_all_sets_done ();
02922       Symbol::all_set ();
02923 
02924       cmt_string cmd;
02925 
02926       for (int i = 0; i < ap.arguments.size (); i++)
02927         {
02928           cmd += ap.arguments[i];
02929           cmd += " ";
02930         }
02931 
02932       CmtSystem::execute (cmd);
02933     }
02934 }

void Cmt::do_run_sequence const ArgParser ap  )  [static]
 

Definition at line 2937 of file cmt_parser.cxx.

References ArgParser::arguments, FAwk::run(), and cmt_vector< T >::size().

Referenced by parser().

02938 {
02939   if (ap.arguments.size () == 0) cerr << "#CMT> run_sequence: no sequence specified" << endl;
02940 
02941   SequenceRunner runner;
02942 
02943   cout << "# cmt run_sequence: sequence " << ap.arguments[0] << endl;
02944 
02945   runner.run (ap.arguments[0]);
02946 }

void Cmt::do_set_version const ArgParser ap  )  [static]
 

Definition at line 2949 of file cmt_parser.cxx.

References ArgParser::arguments, CmtSystem::basename(), CmtSystem::dirname(), CmtSystem::is_version_directory(), CmtSystem::pwd(), cmt_vector< T >::size(), and cmt_string::write().

Referenced by parser().

02950 {
02951   if (ap.arguments.size () == 0) cerr << "#CMT> set version: no version specified" << endl;
02952 
02953   const cmt_string& version = ap.arguments[0];
02954 
02955   int v, r, p;
02956 
02957   if (!CmtSystem::is_version_directory (version, v, r, p))
02958     {
02959       cerr << "#CMT> set version " << version << " is not a correct version syntax" << endl;
02960       return;
02961     }
02962 
02963   if ((v == -1) || (r == -1) || (p == -1))
02964     {
02965       cerr << "#CMT> set version " << version
02966            << " You cannot use wild card to set a version" << endl;
02967       return;
02968     }
02969 
02970   // We want to install the version.cmt file
02971 
02972   // We first check we are in a cmt branch
02973   cmt_string h = CmtSystem::pwd ();
02974   cmt_string branch;
02975   CmtSystem::basename (h, branch);
02976 
02977   if (branch != "cmt")
02978     {
02979       cerr << "#CMT> set version " << version << " must be applied in a cmt directory" 
02980            << endl;
02981       return;
02982     }
02983 
02984   CmtSystem::dirname (h, h);
02985   CmtSystem::basename (h, branch);
02986 
02987   if (branch == version)
02988     {
02989       cerr << "#CMT> set version " << version << " is already available as a version directory" 
02990            << endl;
02991       return;
02992     }
02993 
02994   cout << "Writing version file : " << version << endl;
02995 
02996   version.write ("version.cmt");
02997 }

void Cmt::do_set_versions const ArgParser ap  )  [static]
 

Definition at line 3000 of file cmt_parser.cxx.

References action_broadcast, cmt_vector< T >::add(), ArgParser::arguments, CmtSystem::cmt_string_vector, do_broadcast(), CmtContext::m_action, and Me.

Referenced by parser().

03001 {
03002   CmtSystem::cmt_string_vector args;
03003 
03004   args = ap.arguments;
03005   {
03006     cmt_string& s = args.add ();
03007     s = "cmt";
03008   }
03009   {
03010     cmt_string& s = args.add ();
03011     s = "set";
03012   }
03013   {
03014     cmt_string& s = args.add ();
03015     s = "version";
03016   }
03017   {
03018     cmt_string& s = args.add ();
03019     s = "<version>";
03020   }
03021 
03022   Me.m_action = action_broadcast;
03023 
03024   do_broadcast (ap);
03025 }

void Cmt::do_setup const ArgParser ap  )  [static]
 

Definition at line 3028 of file cmt_parser.cxx.

References do_check_configuration(), get_strategy(), CmtInstallAreaMgr::instance(), ArgParser::mode, print(), and CmtInstallAreaMgr::setup().

Referenced by parser().

03029 {
03030 
03031   do_check_configuration (ap);
03032 
03033   print (ap.mode);
03034 
03035     //
03036     //  Try a cleanup of the installation area
03037     //
03038   if (get_strategy ("InstallArea"))
03039     {
03040       CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
03041 
03042       //cout << "#IA5>" << endl;
03043 
03044       ia_mgr.setup ();
03045 
03046       /*
03047       if (get_strategy ("SetupCleanup"))
03048         {
03049           const cmt_string& installarea = ia_mgr.get_installarea ();
03050 
03051           if (installarea != "")
03052             {
03053               cmt_string q;
03054               
03055               switch (mode)
03056                 {
03057                 case Sh :
03058                 case Csh :
03059                   q = "\'";
03060                   break;
03061                 default :
03062                   break;
03063                 }
03064               
03065               if (!Me.m_quiet)
03066                 {
03067                   cout << "echo "  << q 
03068                        << "# Doing cleanup in the installation area " << installarea 
03069                        << q << endl;
03070                 }
03071             }
03072 
03073           ia_mgr.config ();
03074         }
03075       */
03076     }
03077 }

void Cmt::do_show_action const ArgParser ap  )  [static]
 

Definition at line 3080 of file cmt_parser.cxx.

References action_show_action, action_show_action_value, ArgParser::arguments, Symbol::find(), CmtContext::m_action, Me, ArgParser::mode, CmtError::set(), set_standard_macros(), Symbol::show_macro(), cmt_vector< T >::size(), Symbol::type, and Symbol::value_lists.

Referenced by parser().

03081 {
03082   cmt_string target;
03083 
03084   if (ap.arguments.size () > 0) target = ap.arguments[0];
03085 
03086   Symbol* symbol;
03087 
03088   set_standard_macros ();
03089 
03090   symbol = Symbol::find (target);
03091 
03092   if (symbol == 0) 
03093     {
03094       cmt_string t = " ";
03095       t += target;
03096       t += " is not defined ";
03097 
03098       CmtError::set (CmtError::symbol_not_found, t);
03099 
03100       return;
03101     }
03102   else
03103     {
03104       cmt_string t = target;
03105       t += " is a ";
03106 
03107       if ((Me.m_action == action_show_action) ||
03108           (Me.m_action == action_show_action_value))
03109         {
03110           if (symbol->type != Symbol::SymbolAction)
03111             {
03112               if (symbol->type == Symbol::SymbolMacro)
03113                 {
03114                   t += "macro";
03115                 }
03116               else if (symbol->type == Symbol::SymbolSet)
03117                 {
03118                   t += "set";
03119                 }
03120               else if (symbol->type == Symbol::SymbolPath)
03121                 {
03122                   t += "path";
03123                 }
03124               else if (symbol->type == Symbol::SymbolAlias)
03125                 {
03126                   t += "alias";
03127                 }
03128 
03129               CmtError::set (CmtError::warning, t);
03130             }
03131         }
03132     }
03133 
03134   if (symbol->value_lists.size () < 1) return;
03135 
03136   symbol->show_macro (ap.mode);
03137 }

void Cmt::do_show_action_names const ArgParser ap  )  [static]
 

Definition at line 3140 of file cmt_parser.cxx.

References ArgParser::arguments, ArgParser::mode, print_symbol_names(), and cmt_vector< T >::size().

Referenced by parser().

03141 {
03142   if (ap.arguments.size () > 0)
03143     {
03144       const cmt_string& pattern = ap.arguments[0];
03145       print_symbol_names (ap.mode, pattern);
03146     }
03147   else
03148     {
03149       print_symbol_names (ap.mode);
03150     }
03151 }

void Cmt::do_show_action_value const ArgParser ap  )  [static]
 

Definition at line 3154 of file cmt_parser.cxx.

References do_show_macro().

Referenced by parser().

03155 {
03156   do_show_macro (ap);
03157 }

void Cmt::do_show_actions const ArgParser ap  )  [static]
 

Definition at line 3160 of file cmt_parser.cxx.

References ArgParser::arguments, ArgParser::mode, print_macros(), and cmt_vector< T >::size().

Referenced by parser().

03161 {
03162   if (ap.arguments.size () > 0)
03163     {
03164       const cmt_string& pattern = ap.arguments[0];
03165       print_macros (ap.mode, pattern);
03166     }
03167   else
03168     {
03169       print_macros (ap.mode);
03170     }
03171 }

void Cmt::do_show_all_tags const ArgParser ap  )  [static]
 

Definition at line 3174 of file cmt_parser.cxx.

References set_standard_macros(), Tag::show_definition(), cmt_vector< T >::size(), Tag::TagPtrVector, and Tag::tags().

Referenced by parser().

03175 {
03176   Tag::TagPtrVector tags = Tag::tags ();
03177   int index;
03178 
03179   set_standard_macros ();
03180 
03181   for (index = 0; index < tags.size (); index++)
03182     {
03183       const Tag* tag = tags[index];
03184       if (tag != 0)
03185         {
03186           tag->show_definition (true);
03187         }
03188     }
03189 }

void Cmt::do_show_applied_patterns const ArgParser ap  )  [static]
 

Definition at line 3192 of file cmt_parser.cxx.

References Pattern::show_all_applied_patterns().

Referenced by parser().

03193 {
03194   Pattern::show_all_applied_patterns ();
03195 }

void Cmt::do_show_author const ArgParser ap  )  [static]
 

Definition at line 3198 of file cmt_parser.cxx.

References Use::author, and Use::current().

Referenced by parser().

03199 {
03200   Use& use = Use::current();
03201 
03202   cout << use.author << endl;
03203 }

void Cmt::do_show_branches const ArgParser ap  )  [static]
 

Definition at line 3206 of file cmt_parser.cxx.

References ArgParser::mode, and Branch::print_all().

Referenced by parser().

03207 {
03208   Branch::print_all (ap.mode);
03209 }

void Cmt::do_show_clients const ArgParser ap  )  [static]
 

Definition at line 3212 of file cmt_parser.cxx.

References ArgParser::arguments, clear(), configure(), ClientCollector::count(), Project::scan_paths(), and cmt_vector< T >::size().

Referenced by parser().

03213 {
03214   cmt_string package;
03215   cmt_string version;
03216   cmt_string path_name;
03217 
03218   if (ap.arguments.size () >= 1) package = ap.arguments[0];
03219   if (ap.arguments.size () >= 2) version = ap.arguments[1];
03220   if (ap.arguments.size () >= 3) path_name = ap.arguments[2];
03221 
03222   PathScanner scanner;
03223   ClientCollector collector (package, version);
03224 
03225   clear ();
03226   configure ();
03227 
03228   cout << "# ----------- Clients of " << package <<
03229     " " << version <<
03230     " " << path_name <<
03231     endl;
03232 
03233   if (path_name == "")
03234     {
03235       Project::scan_paths (scanner, collector);
03236     }
03237   else
03238     {
03239       scanner.scan_path (path_name, collector);
03240     }
03241   cout << "# ----------- " << collector.count () << " clients found." << endl;
03242 }

void Cmt::do_show_cmtpath_patterns const ArgParser ap  )  [static]
 

Definition at line 3245 of file cmt_parser.cxx.

References set_standard_macros(), and CmtPathPattern::show_all().

Referenced by parser().

03246 {
03247   set_standard_macros ();
03248   CmtPathPattern::show_all ();
03249 }

void Cmt::do_show_constituent const ArgParser ap  )  [static]
 

Definition at line 3252 of file cmt_parser.cxx.

References ArgParser::arguments, Constituent::find(), set_standard_macros(), Constituent::show(), and cmt_vector< T >::size().

Referenced by parser().

03253 {
03254   if (ap.arguments.size () > 0) 
03255     {
03256       set_standard_macros ();
03257 
03258       Constituent* c = Constituent::find (ap.arguments[0]);
03259       if (c != 0)
03260         {
03261           c->show ();
03262         }
03263     }
03264 }

void Cmt::do_show_constituent_names const ArgParser ap  )  [static]
 

Definition at line 3267 of file cmt_parser.cxx.

References set_standard_macros(), and Constituent::show_names().

Referenced by parser().

03268 {
03269   set_standard_macros ();
03270   Constituent::show_names ();
03271 }

void Cmt::do_show_constituents const ArgParser ap  )  [static]
 

Definition at line 3274 of file cmt_parser.cxx.

References set_standard_macros(), and Constituent::show_all().

Referenced by parser().

03275 {
03276   set_standard_macros ();
03277   Constituent::show_all ();
03278 }

void Cmt::do_show_cycles const ArgParser ap  )  [static]
 

Definition at line 3281 of file cmt_parser.cxx.

References Use::current(), set_standard_macros(), and Use::show_cycles().

Referenced by parser().

03282 {
03283   set_standard_macros ();
03284   Use& use = Use::current();
03285 
03286   use.show_cycles ();
03287 }

void Cmt::do_show_fragment const ArgParser ap  )  [static]
 

Definition at line 3290 of file cmt_parser.cxx.

References ArgParser::arguments, Fragment::show(), and cmt_vector< T >::size().

Referenced by parser().

03291 {
03292   if (ap.arguments.size () > 0) Fragment::show (ap.arguments[0]);
03293 }

void Cmt::do_show_fragments const ArgParser ap  )  [static]
 

Definition at line 3296 of file cmt_parser.cxx.

References Fragment::show_all().

Referenced by parser().

03297 {
03298   Fragment::show_all ();
03299 }

void Cmt::do_show_groups const ArgParser ap  )  [static]
 

Definition at line 3302 of file cmt_parser.cxx.

References Group::show_all().

Referenced by parser().

03303 {
03304   Group::show_all ();
03305 }

void Cmt::do_show_include_dirs const ArgParser ap  )  [static]
 

Definition at line 3308 of file cmt_parser.cxx.

References Use::current(), Use::include_path, Use::includes, Include::name, set_standard_macros(), and cmt_vector< T >::size().

Referenced by parser().

03309 {
03310   cmt_string temp;
03311 
03312   Use& use = Use::current();
03313 
03314   set_standard_macros ();
03315 
03316   if (use.include_path == "")
03317     {
03318       temp += "$(src) ";
03319     }
03320   else if (use.include_path != "none")
03321     {
03322       temp += use.include_path;
03323       temp += " ";
03324     }
03325 
03326   for (int include_number = 0;
03327        include_number < use.includes.size ();
03328        include_number++)
03329     {
03330       Include& incl = use.includes[include_number];
03331       
03332       temp += incl.name;
03333       temp += " ";
03334     }
03335 
03336   cout << temp << endl;
03337 }

void Cmt::do_show_language const ArgParser ap  )  [static]
 

Definition at line 3340 of file cmt_parser.cxx.

References ArgParser::arguments, set_standard_macros(), Language::show(), and cmt_vector< T >::size().

Referenced by parser().

03341 {
03342   if (ap.arguments.size () > 0) 
03343     {
03344       set_standard_macros ();
03345       Language::show (ap.arguments[0]);
03346     }
03347 }

void Cmt::do_show_languages const ArgParser ap  )  [static]
 

Definition at line 3350 of file cmt_parser.cxx.

References set_standard_macros(), and Language::show_all().

Referenced by parser().

03351 {
03352   set_standard_macros ();
03353   Language::show_all ();
03354 }

void Cmt::do_show_macro const ArgParser ap  )  [static]
 

Definition at line 3357 of file cmt_parser.cxx.

References action_show_macro, action_show_macro_value, action_show_set, action_show_set_value, ArgParser::arguments, Symbol::find(), CmtContext::m_action, Me, ArgParser::mode, CmtError::set(), set_standard_macros(), Symbol::show_macro(), cmt_vector< T >::size(), Symbol::type, and Symbol::value_lists.

Referenced by do_show_action_value(), do_show_macro_value(), do_show_set(), do_show_set_value(), and parser().

03358 {
03359   cmt_string target;
03360 
03361   if (ap.arguments.size () > 0) target = ap.arguments[0];
03362 
03363   Symbol* symbol;
03364 
03365   set_standard_macros ();
03366 
03367   symbol = Symbol::find (target);
03368 
03369   if (symbol == 0) 
03370     {
03371       cmt_string t = " ";
03372       t += target;
03373       t += " is not defined ";
03374 
03375       CmtError::set (CmtError::symbol_not_found, t);
03376 
03377       return;
03378     }
03379   else
03380     {
03381       cmt_string t = target;
03382       t += " is a ";
03383 
03384       if ((Me.m_action == action_show_macro) ||
03385           (Me.m_action == action_show_macro_value))
03386         {
03387           if (symbol->type != Symbol::SymbolMacro)
03388             {
03389               if (symbol->type == Symbol::SymbolAction)
03390                 {
03391                   t += "action";
03392                 }
03393               else if (symbol->type == Symbol::SymbolSet)
03394                 {
03395                   t += "set";
03396                 }
03397               else if (symbol->type == Symbol::SymbolPath)
03398                 {
03399                   t += "path";
03400                 }
03401               else if (symbol->type == Symbol::SymbolAlias)
03402                 {
03403                   t += "alias";
03404                 }
03405 
03406               CmtError::set (CmtError::warning, t);
03407             }
03408         }
03409       else if ((Me.m_action == action_show_set) ||
03410                (Me.m_action == action_show_set_value))
03411         {
03412           if ((symbol->type != Symbol::SymbolSet) &&
03413               (symbol->type != Symbol::SymbolPath) &&
03414               (symbol->type != Symbol::SymbolAction) &&
03415               (symbol->type != Symbol::SymbolAlias))
03416             {
03417               t += "macro";
03418 
03419               CmtError::set (CmtError::warning, t);
03420             }
03421         }
03422     }
03423 
03424   if (symbol->value_lists.size () < 1) return;
03425 
03426   symbol->show_macro (ap.mode);
03427 }

void Cmt::do_show_macro_names const ArgParser ap  )  [static]
 

Definition at line 3430 of file cmt_parser.cxx.

References ArgParser::arguments, ArgParser::mode, print_symbol_names(), and cmt_vector< T >::size().

Referenced by parser().

03431 {
03432   if (ap.arguments.size () > 0)
03433     {
03434       const cmt_string& pattern = ap.arguments[0];
03435       print_symbol_names (ap.mode, pattern);
03436     }
03437   else
03438     {
03439       print_symbol_names (ap.mode);
03440     }
03441 }

void Cmt::do_show_macro_value const ArgParser ap  )  [static]
 

Definition at line 3444 of file cmt_parser.cxx.

References do_show_macro().

Referenced by parser().

03445 {
03446   do_show_macro (ap);
03447 }

void Cmt::do_show_macros const ArgParser ap  )  [static]
 

Definition at line 3450 of file cmt_parser.cxx.

References ArgParser::arguments, ArgParser::mode, print_macros(), and cmt_vector< T >::size().

Referenced by parser().

03451 {
03452   if (ap.arguments.size () > 0)
03453     {
03454       const cmt_string& pattern = ap.arguments[0];
03455       print_macros (ap.mode, pattern);
03456     }
03457   else
03458     {
03459       print_macros (ap.mode);
03460     }
03461 }

void Cmt::do_show_manager const ArgParser ap  )  [static]
 

Definition at line 3464 of file cmt_parser.cxx.

References Use::current(), and Use::manager.

Referenced by parser().

03465 {
03466   Use& use = Use::current();
03467 
03468   cout << use.manager << endl;
03469 }

void Cmt::do_show_packages const ArgParser ap  )  [static]
 

Definition at line 3472 of file cmt_parser.cxx.

References ArgParser::arguments, PathScanner::scan_path(), Project::scan_paths(), and cmt_vector< T >::size().

Referenced by parser().

03473 {
03474   cmt_string path_name;
03475 
03476   if (ap.arguments.size () > 0) path_name = ap.arguments[0];
03477 
03478   PathScanner scanner;
03479   PackageViewer viewer;
03480 
03481   if (path_name == "")
03482     {
03483       Project::scan_paths (scanner, viewer);
03484     }
03485   else
03486     {
03487       scanner.scan_path (path_name, viewer);
03488     }
03489 }

void Cmt::do_show_path const ArgParser ap  )  [static]
 

Definition at line 3492 of file cmt_parser.cxx.

References Project::show_paths().

Referenced by do_show_setup(), and parser().

03493 {
03494   Project::show_paths ();
03495 }

void Cmt::do_show_pattern const ArgParser ap  )  [static]
 

Definition at line 3498 of file cmt_parser.cxx.

References ArgParser::arguments, Pattern::show(), and cmt_vector< T >::size().

Referenced by parser().

03499 {
03500   cmt_string name;
03501   if (ap.arguments.size () > 0) name = ap.arguments[0];
03502   Pattern::show (name);
03503 }

void Cmt::do_show_pattern_names const ArgParser ap  )  [static]
 

Definition at line 3506 of file cmt_parser.cxx.

References Pattern::show_all_names().

Referenced by parser().

03507 {
03508   Pattern::show_all_names ();
03509 }

void Cmt::do_show_patterns const ArgParser ap  )  [static]
 

Definition at line 3512 of file cmt_parser.cxx.

References Pattern::show_all().

Referenced by parser().

03513 {
03514   Pattern::show_all ();
03515 }

void Cmt::do_show_projects const ArgParser ap  )  [static]
 

Definition at line 3518 of file cmt_parser.cxx.

References Project::show_all().

Referenced by parser().

03519 {
03520   Project::show_all ();
03521 }

void Cmt::do_show_pwd const ArgParser ap  )  [static]
 

Definition at line 3524 of file cmt_parser.cxx.

References CmtContext::m_current_dir, and Me.

Referenced by parser().

03525 {
03526   cout << Me.m_current_dir << endl;
03527 }

void Cmt::do_show_set const ArgParser ap  )  [static]
 

Definition at line 3543 of file cmt_parser.cxx.

References do_show_macro().

Referenced by parser().

03544 {
03545   do_show_macro (ap);
03546 }

void Cmt::do_show_set_names const ArgParser ap  )  [static]
 

Definition at line 3549 of file cmt_parser.cxx.

References ArgParser::arguments, ArgParser::mode, print_symbol_names(), and cmt_vector< T >::size().

Referenced by parser().

03550 {
03551   if (ap.arguments.size () > 0)
03552     {
03553       const cmt_string& pattern = ap.arguments[0];
03554       print_symbol_names (ap.mode, pattern);
03555     }
03556   else
03557     {
03558       print_symbol_names (ap.mode);
03559     }
03560 }

void Cmt::do_show_set_value const ArgParser ap  )  [static]
 

Definition at line 3563 of file cmt_parser.cxx.

References do_show_macro().

Referenced by parser().

03564 {
03565   do_show_macro (ap);
03566 }

void Cmt::do_show_sets const ArgParser ap  )  [static]
 

Definition at line 3569 of file cmt_parser.cxx.

References ArgParser::arguments, ArgParser::mode, print_macros(), and cmt_vector< T >::size().

Referenced by parser().

03570 {
03571   if (ap.arguments.size () > 0)
03572     {
03573       const cmt_string& pattern = ap.arguments[0];
03574       print_macros (ap.mode, pattern);
03575     }
03576   else
03577     {
03578       print_macros (ap.mode);
03579     }
03580 }

void Cmt::do_show_setup const ArgParser ap  )  [static]
 

Definition at line 3530 of file cmt_parser.cxx.

References do_show_path(), do_show_tags(), and do_show_uses().

Referenced by parser().

03531 {
03532   cout << "----------> uses" << endl;
03533   do_show_uses (ap);
03534 
03535   cout << "----------> tags" << endl;
03536   do_show_tags (ap);
03537 
03538   cout << "----------> CMTPATH" << endl;
03539   do_show_path (ap);
03540 }

void Cmt::do_show_strategies const ArgParser ap  )  [static]
 

Definition at line 3583 of file cmt_parser.cxx.

References Project::get_current(), get_strategy(), CmtContext::m_current_structuring_style, Me, Project::show_specified_strategies_for_all(), with_version_directory, and without_version_directory.

Referenced by parser().

03584 {
03585   Project::show_specified_strategies_for_all ();
03586 
03587   Project* p = Project::get_current ();
03588 
03589   /*
03590     if (p != 0) p->show ();
03591     else cout << "No current project" << endl;
03592   */
03593 
03594   cout << "Structuring style : ";
03595 
03596   switch (Me.m_current_structuring_style)
03597     {
03598     case without_version_directory:
03599       cout << "without_version_directory";
03600       break;
03601     case with_version_directory:
03602       cout << "with_version_directory";
03603       break;
03604     }
03605 
03606   cout << endl;
03607 
03608   cout << "Build strategy    : ";
03609 
03610   if (get_strategy ("BuildPrototypes"))
03611     {
03612       cout << "prototypes";
03613     }
03614   else
03615     {
03616       cout << "no_prototypes";
03617     }
03618   
03619   if (get_strategy ("InstallArea"))
03620     {
03621       cout << " with_installarea";
03622     }
03623   else
03624     {
03625       cout << " without_installarea";
03626     }
03627   
03628   cout << endl;
03629 
03630   cout << "Setup strategy    : ";
03631   
03632   if (get_strategy ("SetupConfig"))
03633     {
03634       cout << "config";
03635     }
03636   else
03637     {
03638       cout << "no_config";
03639     }
03640   
03641   if (get_strategy ("SetupRoot"))
03642     {
03643       cout << " root";
03644     }
03645   else
03646     {
03647       cout << " no_root";
03648     }
03649   
03650   if (get_strategy ("SetupCleanup"))
03651     {
03652       cout << " cleanup";
03653     }
03654   else
03655     {
03656       cout << " no_cleanup";
03657     }
03658   
03659   cout << endl;
03660 }

void Cmt::do_show_system const ArgParser ap  )  [static]
 

Definition at line 3715 of file cmt_parser.cxx.

References CmtSystem::get_cmt_config().

Referenced by parser().

03716 {
03717   cout << CmtSystem::get_cmt_config () << endl;
03718 }

void Cmt::do_show_tags const ArgParser ap  )  [static]
 

Definition at line 3663 of file cmt_parser.cxx.

References CmtContext::m_quiet, Me, set_standard_macros(), Tag::show(), cmt_vector< T >::size(), Tag::TagPtrVector, and Tag::tags().

Referenced by do_show_setup(), and parser().

03664 {
03665   Tag::TagPtrVector tags = Tag::tags ();
03666   int index;
03667 
03668   set_standard_macros ();
03669 
03670   for (index = 0; index < tags.size (); index++)
03671     {
03672       const Tag* tag = tags[index];
03673       if (tag != 0)
03674         {
03675           tag->show (Me.m_quiet);
03676         }
03677     }
03678 }

void Cmt::do_show_use_paths const ArgParser ap  )  [static]
 

Definition at line 3681 of file cmt_parser.cxx.

References ArgParser::arguments, Use::current(), and Use::get_all_clients().

Referenced by parser().

03682 {
03683   const cmt_string& to_name = ap.arguments[0];
03684 
03685   Use* current = &(Use::current());
03686 
03687   current->get_all_clients (to_name);
03688 }

void Cmt::do_show_uses const ArgParser ap  )  [static]
 

Definition at line 3691 of file cmt_parser.cxx.

References Use::show_all().

Referenced by do_show_setup(), and parser().

03692 {
03693   Use::show_all ();
03694 }

void Cmt::do_show_version const ArgParser ap  )  [static]
 

Definition at line 3697 of file cmt_parser.cxx.

References CmtContext::m_current_version, and Me.

Referenced by parser().

03698 {
03699   cout << Me.m_current_version << endl;
03700 }

void Cmt::do_show_versions const ArgParser ap  )  [static]
 

Definition at line 3703 of file cmt_parser.cxx.

References ArgParser::arguments, Project::scan_paths_for_package(), and cmt_vector< T >::size().

Referenced by parser().

03704 {
03705   cmt_string package_name;
03706 
03707   if (ap.arguments.size () > 0) package_name = ap.arguments[0];
03708 
03709   PathScanner scanner;
03710 
03711   Project::scan_paths_for_package (scanner, package_name);
03712 }

void Cmt::do_unlock const ArgParser ap  )  [static]
 

Definition at line 3721 of file cmt_parser.cxx.

References CmtContext::m_current_path, CmtContext::m_current_version, Me, set_standard_macros(), and CmtLock::unlock().

Referenced by parser().

03722 {
03723   const cmt_string& package = Me.m_current_package;
03724   const cmt_string& version = Me.m_current_version;
03725   const cmt_string& path    = Me.m_current_path;
03726 
03727   // (unused??) Use& use = Use::current();
03728 
03729   cout << "try to unlock package " << package << " in " << CmtSystem::pwd () << endl;
03730 
03731   set_standard_macros ();
03732 
03733   CmtLock::status status = CmtLock::unlock ();
03734 }

void Cmt::do_version const ArgParser ap  )  [static]
 

Definition at line 3737 of file cmt_parser.cxx.

References CMTVERSION.

Referenced by parser().

03738 {
03739   cout << CMTVERSION << endl;
03740 }

const cmt_string & Cmt::filter_dir const cmt_string dir  )  [static]
 

Definition at line 3946 of file cmt_parser.cxx.

References CmtSystem::compress_path().

Referenced by Include::print_filters().

03947 {
03948   static cmt_string newdir;
03949 
03950   CmtSystem::compress_path (dir, newdir);
03951 
03952   return (newdir);
03953 }

ActionType Cmt::get_action  )  [static]
 

Definition at line 3745 of file cmt_parser.cxx.

References ActionType, CmtContext::m_action, and Me.

Referenced by ActionBuilder::build(), MacroBuilder::build(), PathBuilder::build(), SetBuilder::build(), Symbol::create(), SyntaxParser::do_parse_text(), use_action_iterator::get_use(), SymbolValueList::show(), and Symbol::show_macro().

03746 {
03747   return (Me.m_action);
03748 }

bool Cmt::get_all_sets_done  )  [static]
 

Definition at line 3855 of file cmt_parser.cxx.

References CmtContext::m_all_sets_done, and Me.

Referenced by Symbol::all_set().

03856 {
03857   return (Me.m_all_sets_done);
03858 }

const cmt_string & Cmt::get_cmt_home  )  [static]
 

Definition at line 3767 of file cmt_parser.cxx.

References CmtContext::m_cmt_home, and Me.

Referenced by Use::show_all().

03768 {
03769   return (Me.m_cmt_home);
03770 }

const cmt_string & Cmt::get_cmt_user_context  )  [static]
 

Definition at line 3772 of file cmt_parser.cxx.

References CmtContext::m_cmt_user_context, and Me.

Referenced by Use::show_all().

03773 {
03774   return (Me.m_cmt_user_context);
03775 }

const cmt_string & Cmt::get_cmt_version  )  [static]
 

Definition at line 3777 of file cmt_parser.cxx.

References CmtContext::m_cmt_version, and Me.

Referenced by Project::create().

03778 {
03779   return (Me.m_cmt_version);
03780 }

AccessMode Cmt::get_current_access  )  [static]
 

Definition at line 3802 of file cmt_parser.cxx.

References AccessMode, CmtContext::m_current_access, and Me.

Referenced by Symbol::action(), Fragment::action(), SyntaxParser::parse_requirements(), and SyntaxParser::parse_requirements_text().

03803 {
03804   return (Me.m_current_access);
03805 }

const cmt_string & Cmt::get_current_cmtpath  )  [static]
 

Definition at line 3792 of file cmt_parser.cxx.

References CmtContext::m_current_cmtpath, and Me.

03793 {
03794   return (Me.m_current_cmtpath);
03795 }

const cmt_string & Cmt::get_current_dir  )  [static]
 

Definition at line 3782 of file cmt_parser.cxx.

References CmtContext::m_current_dir, and Me.

03783 {
03784   return (Me.m_current_dir);
03785 }

const cmt_string & Cmt::get_current_offset  )  [static]
 

Definition at line 3797 of file cmt_parser.cxx.

References CmtContext::m_current_offset, and Me.

03798 {
03799   return (Me.m_current_offset);
03800 }

const cmt_string & Cmt::get_current_package  )  [static]
 

Definition at line 3787 of file cmt_parser.cxx.

References CmtContext::m_current_package, and Me.

Referenced by ReadmeGenerator::build().

03788 {
03789   return (Me.m_current_package);
03790 }

CmtStructuringStyle Cmt::get_current_structuring_style  )  [static]
 

Definition at line 3807 of file cmt_parser.cxx.

References CmtStructuringStyle, CmtContext::m_current_structuring_style, and Me.

Referenced by CvsImplementation::build_version_directory(), CvsImplementation::do_checkout_phase2(), CvsImplementation::really_checkout(), and CvsImplementation::really_checkout_package_contents().

03808 {
03809   return (Me.m_current_structuring_style);
03810 }

CmtDirStyle Cmt::get_current_style  )  [static]
 

Definition at line 3812 of file cmt_parser.cxx.

References CmtDirStyle, CmtContext::m_current_style, and Me.

Referenced by dos_script_prefix().

03813 {
03814   return (Me.m_current_style);
03815 }

const cmt_string & Cmt::get_current_target  )  [static]
 

Definition at line 3822 of file cmt_parser.cxx.

References CmtContext::m_current_target, and Me.

Referenced by ActionBuilder::build(), MacroBuilder::build(), PathBuilder::build(), and SetBuilder::build().

03823 {
03824   return (Me.m_current_target);
03825 }

const cmt_string & Cmt::get_current_version  )  [static]
 

Definition at line 3817 of file cmt_parser.cxx.

References CmtContext::m_current_version, and Me.

Referenced by ReadmeGenerator::build().

03818 {
03819   return (Me.m_current_version);
03820 }

bool Cmt::get_debug  )  [static]
 

Definition at line 3827 of file cmt_parser.cxx.

References CmtContext::m_debug, and Me.

Referenced by Symbol::action(), CmtPathPattern::action(), Package::add(), Use::add(), Symbol::all_set(), LibraryGenerator::analyze_file(), Pattern::apply(), CmtPathPattern::apply(), DefaultMakefileGenerator::build(), CmtLog::check(), CmtInstallAreaMgr::config(), ProjectFactory::create_project(), SyntaxParser::do_parse_line(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_use_includes(), CmtGenerator::fill_outputs(), Use::find_index(), CmtGenerator::get_all_files(), Use::get_paths(), Use::get_selected_version(), use_action_iterator::get_use(), Use::move_to(), Package::Package(), SyntaxParser::parse_requirements_text(), Use::reach_package(), Package::remove_use(), Use::reorder(), resolve_value(), resolve_value_for_macros(), UseProjectAction::run(), CmtPathPatternProjectAction::run(), Use::select_alternate(), Use::set_auto_imports(), Use::set_auto_imports_state(), Use::show_all(), Symbol::show_macro(), and suppress_OS_delimiters().

03828 {
03829   return (Me.m_debug);
03830 }

bool Cmt::get_quiet  )  [static]
 

Definition at line 3832 of file cmt_parser.cxx.

References CmtContext::m_quiet, and Me.

Referenced by KwdDefault::action(), ApplyPattern::action(), Tag::action_apply(), Use::add(), Project::add(), ActionBuilder::build(), PathBuilder::build(), SetBuilder::build(), Use::build_library_links(), CmtInstallAreaMgr::config(), Symbol::create(), ProjectFactory::create_project(), SyntaxParser::do_parse_words(), DependencyAnalyzer::filter(), TriggerAnalyzer::filter(), install_library(), BestFitSelector::operate(), constituents_action_iterator::set(), Use::show_all(), and Symbol::show_macro().

03833 {
03834   return (Me.m_quiet);
03835 }

bool Cmt::get_recursive  )  [static]
 

Definition at line 3837 of file cmt_parser.cxx.

References CmtContext::m_recursive, and Me.

Referenced by Use::add().

03838 {
03839   return (Me.m_recursive);
03840 }

CmtScopeFilteringMode Cmt::get_scope_filtering_mode  )  [static]
 

Definition at line 3842 of file cmt_parser.cxx.

References block_private_uses, CmtScopeFilteringMode, default_filtering_mode, CmtContext::m_scope_filtering_mode, and Me.

Referenced by use_action_iterator::get_use().

03843 {
03844   if (Me.m_scope_filtering_mode == default_filtering_mode)
03845     {
03846       return (block_private_uses);
03847     }
03848   else
03849     {
03850       return (Me.m_scope_filtering_mode);
03851     }
03852 }

void Cmt::guess_current_project  )  [static]
 

If a project file exists above the current directory we don't need CMTPATH.

if current directory is in one of the CMTPATHs, do nothing.

Otherwise, we want to guess the current project

move up in directories until cmt/project.cmt is found

for (;;) { if test -f ./cmt/project.cmt ok: this directory should become the first entry of the CMTPATH break

if (at top) break;

move up }

Definition at line 3881 of file cmt_parser.cxx.

References CmtSystem::cd(), IProjectFactory::create_project(), Use::current(), CmtSystem::file_separator(), Project::fill_cmtpaths(), Project::find_in_cmt_paths(), Project::get_project_file_name(), ProjectFactory::instance(), log, Log, log_endl, CmtContext::m_autoconfigure_cmtpath, CmtContext::m_current_dir, CmtContext::m_quiet, Me, SyntaxParser::parse_requirements_text(), CmtSystem::pwd(), and CmtSystem::test_file().

Referenced by configure(), and ArgParser::option_tag().

03882 {
03883   Log;
03884 
03885   log << "guess_current_project" << log_endl;
03886 
03887   if (Project::find_in_cmt_paths (Me.m_current_dir) == "")
03888     {
03889       cmt_string project_file = "cmt";
03890       project_file += CmtSystem::file_separator ();
03891       project_file += Project::get_project_file_name ();
03892 
03893       cmt_string pwd;
03894 
03895       for (;;)
03896         {
03897           pwd = CmtSystem::pwd ();
03898           if (CmtSystem::test_file (project_file))
03899             {
03900               //this directory should become the first entry of the CMTPATH
03901 
03902               IProjectFactory& factory = ProjectFactory::instance ();
03903               factory.create_project ("", pwd, "CurrentProject", 0);
03904 
03905               /*
03906               cmt_string temp = "path_prepend CMTPATH \"";
03907               temp += pwd;
03908               temp += "\"";
03909               
03910               Use& use = Use::current();
03911 
03912               SyntaxParser::parse_requirements_line (temp, &use);
03913               */
03914 
03915               break;
03916             }
03917 
03918           log << "pwd=" << CmtSystem::pwd () << log_endl;
03919           
03920           if (!CmtSystem::cd (".."))
03921             {
03922               break;
03923             }
03924           if (CmtSystem::pwd () == pwd)
03925             {
03926               break;
03927             }
03928         }
03929       CmtSystem::cd (Me.m_current_dir);
03930     }
03931 
03932   //cmt_string buffer = "path CMTPATH \n";
03933   cmt_string buffer;
03934   Project::fill_cmtpaths (buffer);
03935   //cerr << "buffer = " << buffer << endl;
03936   Use& use = Use::current();
03937   bool save_quiet = Me.m_quiet;
03938   Me.m_quiet = true;
03939   SyntaxParser::parse_requirements_text (buffer, "", &use);
03940   Me.m_quiet = save_quiet;
03941 
03942   Me.m_autoconfigure_cmtpath = true;
03943 }

void Cmt::install_cleanup_scripts  )  [static]
 

Definition at line 4007 of file cmt_parser.cxx.

References Bat, cmt_string::c_str(), CmtSystem::compare_and_update_files(), Csh, dos_script_prefix(), CmtContext::m_cmt_root, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_version, Me, PrintMode, and Sh.

Referenced by do_config().

04008 {
04009 #ifdef WIN32
04010   static const int modes = 1;
04011   static const cmt_string suffix[1]   = {"bat"};
04012   static const PrintMode  mode[1]     = {Bat};
04013 #else
04014   static const int modes = 2;
04015   static const cmt_string suffix[2]   = {"csh", "sh"};
04016   static const PrintMode  mode[2]     = {Csh, Sh};
04017 #endif
04018 
04019   cout << "Creating cleanup scripts." << endl;
04020 
04021   cmt_string temp;
04022   int i;
04023 
04024   cmt_string version = Me.m_current_version;
04025   if (version == "v*") version = "";
04026 
04027   for (i = 0; i < modes; i++)
04028     {
04029       cmt_string file_name = "cleanup";
04030       file_name += ".";
04031       file_name += suffix[i];
04032       file_name += ".";
04033       file_name += "new";
04034 
04035       FILE* f = fopen (file_name.c_str (), "wb");
04036       if (f != NULL)
04037         {
04038           if (mode[i] == Csh)
04039             {
04040               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
04041               fprintf (f, "  setenv CMTROOT %s\n", Me.m_cmt_root.c_str ());
04042               fprintf (f, "endif\n");
04043               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
04044               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04045               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
04046               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
04047                        "-pack=%s -version=%s -path=%s $* >${tempfile}; "
04048                        "source ${tempfile}\n",
04049                        suffix[i].c_str (),
04050                        Me.m_current_package.c_str (),
04051                        version.c_str (),
04052                        Me.m_current_path.c_str ());
04053               fprintf (f, "/bin/rm -f ${tempfile}\n");
04054             }
04055           else if (mode[i] == Sh)
04056             {
04057               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
04058               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", Me.m_cmt_root.c_str ());
04059               fprintf (f, "fi\n");
04060               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
04061               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04062               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
04063               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
04064                        "-pack=%s -version=%s -path=%s $* >${tempfile}; "
04065                        ". ${tempfile}\n",
04066                        suffix[i].c_str (),
04067                        Me.m_current_package.c_str (),
04068                        version.c_str (),
04069                        Me.m_current_path.c_str ());
04070               fprintf (f, "/bin/rm -f ${tempfile}\n");
04071             }
04072           else if (mode[i] == Bat)
04073             {
04074               dos_script_prefix (f, Me.m_cmt_root, 
04075                                  Me.m_current_package, version, Me.m_current_path,
04076                                  "cleanup");
04077             }
04078 
04079           fprintf (f, "\n");
04080 
04081           fclose (f);
04082 
04083           cmt_string old_file_name = "cleanup";
04084           old_file_name += ".";
04085           old_file_name += suffix[i];
04086 
04087           CmtSystem::compare_and_update_files (file_name, old_file_name);
04088         }
04089     }
04090 }

void Cmt::install_setup_scripts  )  [static]
 

Definition at line 4093 of file cmt_parser.cxx.

References Bat, cmt_string::c_str(), CmtSystem::compare_and_update_files(), Csh, dos_script_prefix(), get_strategy(), CmtContext::m_cmt_root, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_version, Me, PrintMode, and Sh.

Referenced by do_config().

04094 {
04095 #ifdef WIN32
04096   static const int modes = 1;
04097   static const cmt_string suffix[1]   = {"bat"};
04098   static const PrintMode  mode[1]     = {Bat};
04099 #else
04100   static const int modes = 2;
04101   static const cmt_string suffix[2]   = {"csh", "sh"};
04102   static const PrintMode  mode[2]     = {Csh, Sh};
04103 #endif
04104 
04105   cout << "Creating setup scripts." << endl;
04106 
04107   
04108   cmt_string no_cleanup_opt;
04109 
04110   if (get_strategy ("SetupCleanup"))
04111     {
04112       no_cleanup_opt = " -no_cleanup";
04113     }
04114 
04115   cmt_string temp;
04116   int i;
04117 
04118   cmt_string version = Me.m_current_version;
04119   if (version == "v*") version = "";
04120 
04121   for (i = 0; i < modes; i++)
04122     {
04123       cmt_string file_name = "setup";
04124       file_name += ".";
04125       file_name += suffix[i];
04126       file_name += ".";
04127       file_name += "new";
04128 
04129       FILE* f = fopen (file_name.c_str (), "wb");
04130       if (f != NULL)
04131         {
04132           if (mode[i] == Csh)
04133             {
04134               fprintf (f, "# echo \"Setting %s %s in %s\"\n",
04135                        Me.m_current_package.c_str (),
04136                        version.c_str (),
04137                        Me.m_current_path.c_str ());
04138               fprintf (f, "\n");
04139 
04140               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
04141               fprintf (f, "  setenv CMTROOT %s\n", Me.m_cmt_root.c_str ());
04142               fprintf (f, "endif\n");
04143               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
04144               fprintf (f, "\n");
04145               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04146               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
04147               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
04148                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}; "
04149                        "source ${tempfile}\n",
04150                        suffix[i].c_str (),
04151                        Me.m_current_package.c_str (),
04152                        version.c_str (),
04153                        Me.m_current_path.c_str (),
04154                        no_cleanup_opt.c_str ());
04155               fprintf (f, "/bin/rm -f ${tempfile}\n");
04156             }
04157           else if (mode[i] == Sh)
04158             {
04159               fprintf (f, "# echo \"Setting %s %s in %s\"\n",
04160                        Me.m_current_package.c_str (),
04161                        version.c_str (),
04162                        Me.m_current_path.c_str ());
04163               fprintf (f, "\n");
04164 
04165               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
04166               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", Me.m_cmt_root.c_str ());
04167               fprintf (f, "fi\n");
04168               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
04169               fprintf (f, "\n");
04170               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04171               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
04172               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
04173                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}; "
04174                        ". ${tempfile}\n",
04175                        suffix[i].c_str (),
04176                        Me.m_current_package.c_str (),
04177                        version.c_str (),
04178                        Me.m_current_path.c_str (),
04179                        no_cleanup_opt.c_str ());
04180               fprintf (f, "/bin/rm -f ${tempfile}\n");
04181             }
04182           else if (mode[i] == Bat)
04183             {
04184               fprintf (f, "rem Setting %s %s in %%~d0%%~p0\n",
04185                        Me.m_current_package.c_str (),
04186                        version.c_str ());
04187               dos_script_prefix (f, Me.m_cmt_root, 
04188                                  Me.m_current_package, version, Me.m_current_path,
04189                                  "setup", no_cleanup_opt);
04190             }
04191 
04192           fprintf (f, "\n");
04193 
04194           fclose (f);
04195 
04196           cmt_string old_file_name = "setup";
04197           old_file_name += ".";
04198           old_file_name += suffix[i];
04199 
04200           CmtSystem::compare_and_update_files (file_name, old_file_name);
04201         }
04202     }
04203 }

void Cmt::install_test_cleanup_scripts  )  [static]
 

Definition at line 4206 of file cmt_parser.cxx.

References Bat, cmt_string::c_str(), CmtSystem::compare_and_update_files(), Csh, dos_script_prefix(), CmtContext::m_cmt_root, CmtContext::m_current_path, CmtContext::m_current_version, Me, PrintMode, and Sh.

Referenced by do_config().

04207 {
04208 #ifdef WIN32
04209   static const int modes = 1;
04210   static const cmt_string suffix[1]   = {"bat"};
04211   static const PrintMode  mode[1]     = {Bat};
04212 #else
04213   static const int modes = 2;
04214   static const cmt_string suffix[2]   = {"csh", "sh"};
04215   static const PrintMode  mode[2]     = {Csh, Sh};
04216 #endif
04217 
04218   cout << "Creating cleanup scripts." << endl;
04219 
04220   cmt_string temp;
04221   int i;
04222 
04223   cmt_string version = Me.m_current_version;
04224   if (version == "v*") version = "";
04225 
04226   for (i = 0; i < modes; i++)
04227     {
04228       cmt_string file_name = "cleanup";
04229       file_name += ".";
04230       file_name += suffix[i];
04231       file_name += ".";
04232       file_name += "new";
04233 
04234       FILE* f = fopen (file_name.c_str (), "wb");
04235       if (f != NULL)
04236         {
04237           if (mode[i] == Csh)
04238             {
04239               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
04240               fprintf (f, "  setenv CMTROOT %s\n", Me.m_cmt_root.c_str ());
04241               fprintf (f, "endif\n");
04242               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
04243               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04244               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
04245               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}; "
04246                        "source ${tempfile}\n",
04247                        suffix[i].c_str (),
04248                        Me.m_current_path.c_str ());
04249               fprintf (f, "/bin/rm -f ${tempfile}\n");
04250             }
04251           else if (mode[i] == Sh)
04252             {
04253               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
04254               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", Me.m_cmt_root.c_str ());
04255               fprintf (f, "fi\n");
04256               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
04257               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04258               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
04259               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}; "
04260                        ". ${tempfile}\n",
04261                        suffix[i].c_str (),
04262                        Me.m_current_path.c_str ());
04263               fprintf (f, "/bin/rm -f ${tempfile}\n");
04264             }
04265           else
04266             {
04267               dos_script_prefix (f, Me.m_cmt_root, 
04268                                  "cmt_standalone", "", Me.m_current_path, 
04269                                  "cleanup");
04270             }
04271 
04272           fprintf (f, "\n");
04273 
04274           fclose (f);
04275 
04276           cmt_string old_file_name = "cleanup";
04277           old_file_name += ".";
04278           old_file_name += suffix[i];
04279 
04280           CmtSystem::compare_and_update_files (file_name, old_file_name);
04281         }
04282     }
04283 }

void Cmt::install_test_setup_scripts  )  [static]
 

Definition at line 4286 of file cmt_parser.cxx.

References Bat, cmt_string::c_str(), CmtSystem::compare_and_update_files(), Csh, dos_script_prefix(), get_strategy(), CmtContext::m_cmt_root, CmtContext::m_current_path, Me, PrintMode, and Sh.

Referenced by do_config().

04287 {
04288 #ifdef WIN32
04289   static const int modes = 1;
04290   static const cmt_string suffix[1]   = {"bat"};
04291   static const PrintMode  mode[1]     = {Bat};
04292 #else
04293   static const int modes = 2;
04294   static const cmt_string suffix[2]   = {"csh", "sh"};
04295   static const PrintMode  mode[2]     = {Csh, Sh};
04296 #endif
04297 
04298   cout << "Creating setup scripts." << endl;
04299 
04300   cmt_string no_cleanup_opt;
04301 
04302   if (get_strategy ("SetupCleanup"))
04303     {
04304       no_cleanup_opt = " -no_cleanup";
04305     }
04306 
04307   cmt_string temp;
04308   int i;
04309 
04310   for (i = 0; i < modes; i++)
04311     {
04312       cmt_string file_name = "setup";
04313       file_name += ".";
04314       file_name += suffix[i];
04315       file_name += ".";
04316       file_name += "new";
04317 
04318       FILE* f = fopen (file_name.c_str (), "wb");
04319       if (f != NULL)
04320         {
04321           if (mode[i] == Csh)
04322             {
04323               fprintf (f, "# echo \"Setting standalone package\"\n");
04324               fprintf (f, "\n");
04325 
04326               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
04327               fprintf (f, "  setenv CMTROOT %s\n", Me.m_cmt_root.c_str ());
04328               fprintf (f, "endif\n");
04329               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
04330               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04331               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
04332               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}; "
04333                        "source ${tempfile}\n",
04334                        suffix[i].c_str (),
04335                        Me.m_current_path.c_str (),
04336                        no_cleanup_opt.c_str ());
04337               fprintf (f, "/bin/rm -f ${tempfile}\n");
04338             }
04339           else if (mode[i] == Sh)
04340             {
04341               fprintf (f, "# echo \"Setting standalone package\"\n");
04342               fprintf (f, "\n");
04343 
04344               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
04345               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", Me.m_cmt_root.c_str ());
04346               fprintf (f, "fi\n");
04347               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
04348               fprintf (f, "\n");
04349               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04350               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
04351               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}; "
04352                        ". ${tempfile}\n",
04353                        suffix[i].c_str (),
04354                        Me.m_current_path.c_str (),
04355                        no_cleanup_opt.c_str ());
04356               fprintf (f, "/bin/rm -f ${tempfile}\n");
04357             }
04358           else
04359             {
04360               fprintf (f, "rem Setting standalone package\n");
04361               dos_script_prefix (f, Me.m_cmt_root, 
04362                                  "cmt_standalone", "", Me.m_current_path, 
04363                                  "setup", no_cleanup_opt);
04364             }
04365 
04366           fprintf (f, "\n");
04367 
04368           fclose (f);
04369 
04370           cmt_string old_file_name = "setup";
04371           old_file_name += ".";
04372           old_file_name += suffix[i];
04373 
04374           CmtSystem::compare_and_update_files (file_name, old_file_name);
04375         }
04376     }
04377 }

bool Cmt::load const cmt_string path,
const cmt_string package,
const cmt_string version,
const cmt_string tag_name = ""
[static]
 

load is only called from the Windows GUI which pretends to access directly the internal data model.

This is considered to be rather unsafe, and should be replaced by query functions.

See reach_current_package for an explanation of this call

Definition at line 4384 of file cmt_parser.cxx.

References action_load, Tag::add(), Pattern::apply_all_globals(), CmtSystem::basename(), build_config(), build_prefix(), cmt_string::c_str(), CmtSystem::cd(), clear(), cmt_style, configure(), configure_current_dir(), configure_hosttype_tag(), configure_site_tag(), configure_uname_tag(), configure_version_tag(), Use::current(), DeveloperMode, CmtSystem::dirname(), Use::done, CmtSystem::file_separator(), CmtError::has_pending_error(), CmtContext::m_action, CmtContext::m_cmt_config, CmtContext::m_current_access, CmtContext::m_current_config, CmtContext::m_current_dir, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_prefix, CmtContext::m_current_style, CmtContext::m_current_tag, CmtContext::m_current_version, CmtContext::m_debug, CmtContext::m_default_path, CmtContext::m_quiet, CmtContext::m_recursive, Tag::mark(), Me, mgr_style, no_version_style, none_style, SyntaxParser::parse_requirements(), Use::path, Use::prefix, PriorityConfig, PriorityTag, CmtSystem::pwd(), Tag::restore_tree(), CmtError::set(), Use::set_package_name(), Use::style, CmtSystem::test_directory(), Tag::unmark_all(), use_cmt(), UserMode, and Use::version.

04388 {
04389   clear ();
04390   configure ();
04391 
04392   Me.m_action  = action_load;
04393   Me.m_recursive = true;
04394 
04395   if (((package != "") && (version != "")) || (Me.m_current_package == ""))
04396     {
04397       //
04398       //  Here we want to connect to a new package, or to the current package
04399       //  but with another tag.
04400       //
04401       //   the 'package' argument may include a directory offset. Thus 'path'
04402       //  is only expected to hold the base directory.
04403       //
04404       cmt_string offset;
04405       cmt_string package_name;
04406       
04407       CmtSystem::dirname (package, offset);
04408       CmtSystem::basename (package, package_name);
04409       
04410       if (offset != "")
04411         {
04412           Me.m_current_path = path;
04413           Me.m_current_path += CmtSystem::file_separator ();
04414           Me.m_current_path += offset;
04415         }
04416       else
04417         {
04418           Me.m_current_path = path;
04419         }
04420       
04421       Me.m_current_package = package_name;
04422       Me.m_current_version = version;
04423     }
04424 
04425   if (tag_name != "")
04426     {
04427       Tag* tag;
04428 
04429       Tag::unmark_all ();
04430       configure_version_tag ();
04431       configure_site_tag (0);
04432       configure_uname_tag ();
04433       configure_hosttype_tag ();
04434 
04435       Me.m_current_tag = tag_name;
04436 
04437       //if (!Me.m_quiet) cerr << "load1> current_tag=" << Me.m_current_tag << endl;
04438 
04439       tag = Tag::add (tag_name, PriorityTag, "load", 0);
04440       tag->mark ();
04441     }
04442 
04443   /*
04444     Set to developer mode if positioned into the package
04445     (which is detected since we were able to retreive the
04446     Version, Package and Path)
04447   */
04448 
04449   if ((Me.m_current_path == "") ||
04450       (Me.m_current_package == "") ||
04451       (Me.m_current_version == ""))
04452     {
04453       Me.m_current_access = UserMode;
04454     }
04455   else
04456     {
04457       Me.m_current_access = DeveloperMode;
04458     }
04459 
04460   use_cmt ();
04461 
04462   cmt_string dir;
04463 
04464   /*
04465     Try to access the package.
04466   */
04467 
04468   if (Me.m_current_path != "")
04469     {
04470       dir = Me.m_current_path;
04471     }
04472   else
04473     {
04474       dir = Me.m_default_path;
04475     }
04476 
04477   if (!CmtSystem::cd (Me.m_current_path))
04478     {
04479       if (!Me.m_quiet)
04480         {
04481           cerr << "#CMT> Cannot reach the directory " <<
04482             Me.m_current_path << endl;
04483         }
04484       CmtError::set (CmtError::package_not_found, "Load> Cannot reach the path directory");
04485       CmtSystem::cd (Me.m_current_dir);
04486 
04487       return (false);
04488     }
04489 
04490   dir += CmtSystem::file_separator ();
04491   dir += Me.m_current_package;
04492 
04493   if (!CmtSystem::cd (Me.m_current_package))
04494     {
04495       if (!Me.m_quiet)
04496         {
04497           cerr << "#CMT::load> Cannot reach the package " <<
04498             Me.m_current_package << endl;
04499         }
04500       CmtError::set (CmtError::package_not_found, "Load> Cannot reach the package directory");
04501       CmtSystem::cd (Me.m_current_dir);
04502 
04503       return (false);
04504     }
04505 
04506   dir += CmtSystem::file_separator ();
04507   dir += Me.m_current_version;
04508 
04509   Me.m_current_style = none_style;
04510 
04511   if (!CmtSystem::cd (Me.m_current_version))
04512     {
04513       if (!CmtSystem::test_directory ("cmt"))
04514         {
04515           if (!Me.m_quiet)
04516             {
04517               cerr << "#CMT> Cannot reach the version " <<
04518                 Me.m_current_version << endl;
04519             }
04520           CmtError::set (CmtError::package_not_found, "Load> Cannot reach the version directory");
04521           CmtSystem::cd (Me.m_current_dir);
04522 
04523           return (false);
04524         }
04525       else
04526         {
04527           Me.m_current_style = no_version_style;
04528         }
04529     }
04530 
04531   if (CmtSystem::cd ("cmt"))
04532     {
04533       dir += CmtSystem::file_separator ();
04534       dir += "cmt";
04535       if (Me.m_current_style == none_style) Me.m_current_style = cmt_style;
04536     }
04537   else
04538     {
04539       /*
04540         if (!Me.m_quiet)
04541         {
04542         cerr << "Cannot reach the cmt branch" << endl;
04543         }
04544       */
04545 
04546       if (CmtSystem::cd ("mgr"))
04547         {
04548           dir += CmtSystem::file_separator ();
04549           dir += "mgr";
04550           if (Me.m_current_style == none_style) Me.m_current_style = mgr_style;
04551         }
04552       else
04553         {
04554           if (!Me.m_quiet)
04555             {
04556               cerr << "#CMT> Cannot reach the mgr branch" << endl;
04557             }
04558 
04559           CmtError::set (CmtError::package_not_found,
04560                          "Load> Cannot reach the mgr/cmt directory");
04561           CmtSystem::cd (Me.m_current_dir);
04562 
04563           return (false);
04564         }
04565     }
04566 
04567   /*
04568     Check Tag is always set up
04569   */
04570 
04571   if (Me.m_current_tag == "")
04572     {
04573       char* env;
04574 
04575       env = getenv (Me.m_current_config.c_str ());
04576       if (env != 0)
04577         {
04578           Tag* tag;
04579 
04580           tag = Tag::add (env, PriorityConfig, "load", 0);
04581           tag->mark ();
04582           Me.m_current_tag = env;
04583 
04584           //if (!Me.m_quiet) cerr << "load2> current_tag=" << Me.m_current_tag << endl;
04585 
04586         }
04587       else
04588         {
04589           Me.m_current_tag = Me.m_cmt_config;
04590 
04591           //if (!Me.m_quiet) cerr << "load3> current_tag=" << Me.m_current_tag << endl;
04592 
04593         }
04594     }
04595 
04596   if (Me.m_debug)
04597     {
04598       cout << "pwd = " << CmtSystem::pwd () << endl;
04599     }
04600 
04601   configure_current_dir ();
04602   build_prefix (Me.m_current_package, Me.m_current_prefix);
04603   build_config (Me.m_current_prefix, Me.m_current_config);
04604 
04605   Use* use = &(Use::current());
04606   use->path    = Me.m_current_path;
04607   use->set_package_name (Me.m_current_package);
04608   use->version = Me.m_current_version;
04609   use->prefix  = Me.m_current_prefix;
04610   use->done    = false;
04611   use->style   = Me.m_current_style;
04612 
04613   /*
04614     Work on the requirements file.
04615   */
04616 
04617   dir += CmtSystem::file_separator ();
04618   dir += "requirements";
04619   SyntaxParser::parse_requirements (dir, use);
04620 
04621   if (CmtError::has_pending_error ()) return (false);
04622 
04626   Pattern::apply_all_globals ();
04627 
04628   /*
04629     Select all possible tags
04630   */
04631 
04632   Tag::restore_tree ();
04633 
04634   return (true);
04635 }

bool Cmt::need_prototypes  )  [static]
 

Definition at line 4638 of file cmt_parser.cxx.

References get_strategy().

Referenced by Constituent::add().

04639 {
04640   if (get_strategy ("BuildPrototypes")) return (true);
04641   else return (false);
04642 }

void Cmt::parse_arguments ArgParser ap  )  [static]
 

Definition at line 4645 of file cmt_parser.cxx.

References action_none, CmtContext::m_action, CmtContext::m_build_nmake, Me, ArgParser::parse(), and restore_all_tags().

Referenced by parser().

04646 {
04647   /*
04648     Decoding arguments.
04649 
04650     While decoding all arguments, no requirements analysis should
04651     occur. Every new option, or parameter should be saved and
04652     used later at actual analysis time.
04653   */
04654 
04655   Me.m_action = action_none;
04656 
04657   restore_all_tags (0);
04658 
04659 #ifdef WIN32
04660   Me.m_build_nmake = true;
04661 #endif
04662 
04663   ap.parse ();
04664 }

int Cmt::parser int  argc,
char *  argv[]
[static]
 

Definition at line 4692 of file cmt_parser.cxx.

References action_awk, action_broadcast, action_build_CMT_pacman, action_build_constituent_makefile, action_build_constituents_makefile, action_build_dependencies, action_build_library_links, action_build_make_setup, action_build_msdev, action_build_os9_makefile, action_build_prototype, action_build_readme, action_build_tag_makefile, action_build_temporary_name, action_build_triggers, action_build_vsnet, action_build_windefs, action_check_configuration, action_check_files, action_check_version, action_checkout, action_cleanup, action_config, action_create, action_create_project, action_cvsbranches, action_cvssubpackages, action_cvssubprojects, action_cvstags, action_do, action_expand_model, action_filter, action_help, action_load, action_lock, action_none, action_remove, action_remove_library_links, action_run, action_run_sequence, action_set_version, action_set_versions, action_setup, action_show_action, action_show_action_names, action_show_action_value, action_show_actions, action_show_all_tags, action_show_applied_patterns, action_show_author, action_show_branches, action_show_clients, action_show_cmtpath_patterns, action_show_constituent, action_show_constituent_names, action_show_constituents, action_show_cycles, action_show_fragment, action_show_fragments, action_show_groups, action_show_include_dirs, action_show_language, action_show_languages, action_show_macro, action_show_macro_names, action_show_macro_value, action_show_macros, action_show_manager, action_show_packages, action_show_path, action_show_pattern, action_show_pattern_names, action_show_patterns, action_show_projects, action_show_pwd, action_show_set, action_show_set_names, action_show_set_value, action_show_sets, action_show_setup, action_show_strategies, action_show_tags, action_show_use_paths, action_show_uses, action_show_version, action_show_versions, action_system, action_unlock, action_version, ArgParser::argc, ArgParser::argv, cmt_string::c_str(), CmtError::clear(), clear(), configure(), DeveloperMode, do_awk(), do_broadcast(), do_build_CMT_pacman(), do_build_constituent_makefile(), do_build_constituents_makefile(), do_build_dependencies(), do_build_library_links(), do_build_make_setup(), do_build_msdev(), do_build_os9_makefile(), do_build_prototype(), do_build_readme(), do_build_tag_makefile(), do_build_temporary_name(), do_build_triggers(), do_build_vsnet(), do_build_windefs(), do_check_configuration(), do_check_files(), do_check_version(), do_checkout(), do_cleanup(), do_config(), do_create(), do_create_project(), do_cvsbranches(), do_cvssubpackages(), do_cvssubprojects(), do_cvstags(), do_do(), do_expand_model(), do_filter(), do_help(), do_lock(), do_remove(), do_remove_library_links(), do_run(), do_run_sequence(), do_set_version(), do_set_versions(), do_setup(), do_show_action(), do_show_action_names(), do_show_action_value(), do_show_actions(), do_show_all_tags(), do_show_applied_patterns(), do_show_author(), do_show_branches(), do_show_clients(), do_show_cmtpath_patterns(), do_show_constituent(), do_show_constituent_names(), do_show_constituents(), do_show_cycles(), do_show_fragment(), do_show_fragments(), do_show_groups(), do_show_include_dirs(), do_show_language(), do_show_languages(), do_show_macro(), do_show_macro_names(), do_show_macro_value(), do_show_macros(), do_show_manager(), do_show_packages(), do_show_path(), do_show_pattern(), do_show_pattern_names(), do_show_patterns(), do_show_projects(), do_show_pwd(), do_show_set(), do_show_set_names(), do_show_set_value(), do_show_sets(), do_show_setup(), do_show_strategies(), do_show_system(), do_show_tags(), do_show_use_paths(), do_show_uses(), do_show_version(), do_show_versions(), do_unlock(), do_version(), ArgParser::extra_file, ArgParser::extra_line, CmtError::get_last_error_code(), CmtError::has_pending_error(), ArgParser::help_action, CmtContext::m_action, CmtContext::m_configure_error, CmtContext::m_current_access, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_tag, CmtContext::m_current_version, CmtContext::m_debug, CmtContext::m_quiet, CmtContext::m_recursive, CmtContext::m_simulation, Me, parse_arguments(), SyntaxParser::parse_requirements(), SyntaxParser::parse_requirements_line(), CmtError::print(), CmtSystem::pwd(), reach_current_package(), CmtError::set(), cmt_string::size(), use_cmt(), use_home_requirements(), use_user_context_requirements(), and UserMode.

04693 {
04694   ArgParser ap (Me);
04695 
04696   ap.argc = argc;
04697   ap.argv = argv;
04698 
04699   if (argc <= 1)
04700     {
04701       do_help (ap);
04702       exit (0);
04703     }
04704 
04705   clear ();
04706   configure ();
04707 
04708   CmtError::clear ();
04709 
04710   /*
04711     Set private if positioned inside the package
04712     (which is detected since we were able to retreive the
04713     Version, Package and Path)
04714   */
04715 
04716   if ((Me.m_current_path.size () == 0) ||
04717       (Me.m_current_package.size () == 0) ||
04718       (Me.m_current_version.size () == 0))
04719     {
04720       Me.m_current_access = UserMode;
04721     }
04722   else
04723     {
04724       Me.m_current_access = DeveloperMode;
04725     }
04726 
04727   parse_arguments (ap);
04728 
04729   if (Me.m_debug)
04730     {
04731       cout << "After parse_argument> pack=" << Me.m_current_package
04732            << " Me.m_current_tag=" << Me.m_current_tag
04733            << " cwd=" << CmtSystem::pwd () 
04734            << " mode=" << Me.m_current_access
04735            << endl;
04736     }
04737 
04738   if (Me.m_configure_error != "")
04739     {
04740       if (!Me.m_quiet) cerr << "#CMT> Error: " << Me.m_configure_error << endl;
04741       return (CmtError::execution_error);
04742     }
04743 
04744   if (CmtError::has_pending_error ())
04745     {
04746       int code = CmtError::get_last_error_code ();
04747       if (!Me.m_quiet) CmtError::print ();
04748       clear ();
04749 
04750       return (code);
04751     }
04752 
04753   /*
04754     Now actual requirements analysis can take place.
04755 
04756     Extra lines or files are analysed first.
04757   */
04758 
04759   if (strlen (ap.extra_file.c_str ()) > 0) SyntaxParser::parse_requirements (ap.extra_file, (Use*) 0);
04760   if (strlen (ap.extra_line.c_str ()) > 0) SyntaxParser::parse_requirements_line (ap.extra_line, (Use*) 0);
04761 
04762   //
04763   //  For some of the actions, the CMT package must be automatically
04764   //  included
04765   //
04766 
04767   if (Me.m_debug) cout << "parser1> current_tag=" << Me.m_current_tag << endl;
04768 
04769   if (ap.help_action == action_help)
04770     {
04771       do_help (ap);
04772       return (0);
04773     }
04774 
04775   switch (Me.m_action)
04776     {
04777       // case action_none :
04778     case action_awk :
04779     case action_broadcast :
04780     case action_build_constituent_makefile :
04781     case action_build_constituents_makefile :
04782     case action_build_dependencies :
04783     case action_build_library_links :
04784     case action_build_make_setup :
04785     case action_build_msdev :
04786     case action_build_CMT_pacman :
04787     case action_build_vsnet :     
04788     case action_build_os9_makefile :
04789       // case action_build_prototype :
04790     case action_build_readme :
04791     case action_build_tag_makefile :
04792       // case action_build_temporary_name :
04793     case action_build_triggers :
04794     case action_build_windefs :
04795     case action_check_configuration :
04796       // case action_check_files :
04797       // case action_check_version :
04798     case action_checkout :
04799     case action_cleanup :
04800     case action_config :
04801     case action_create :
04802       // case action_create_project :
04803     case action_cvsbranches :
04804     case action_cvssubpackages :
04805     case action_cvssubprojects :
04806     case action_cvstags :
04807     case action_do :
04808     case action_expand_model :
04809     case action_filter :
04810       // case action_help :
04811     case action_load :
04812     case action_lock :
04813     case action_remove :
04814     case action_remove_library_links :
04815     case action_run :
04816     case action_run_sequence :
04817     case action_set_version :
04818     case action_set_versions :
04819     case action_setup :
04820     case action_show_action :
04821     case action_show_action_names :
04822     case action_show_action_value :
04823     case action_show_actions :
04824     case action_show_all_tags :
04825     case action_show_applied_patterns :
04826       // case action_show_author :
04827       // case action_show_branches :
04828       // case action_show_clients :
04829     case action_show_cmtpath_patterns :
04830     case action_show_constituent :
04831     case action_show_constituent_names :
04832     case action_show_constituents :
04833     case action_show_cycles :
04834     case action_show_fragment :
04835     case action_show_fragments :
04836     case action_show_groups :
04837     case action_show_include_dirs :
04838     case action_show_language :
04839     case action_show_languages :
04840     case action_show_macro :
04841     case action_show_macro_names :
04842     case action_show_macro_value :
04843     case action_show_macros :
04844       // case action_show_manager :
04845     case action_show_packages :
04846     case action_show_path :
04847     case action_show_pattern :
04848     case action_show_pattern_names :
04849     case action_show_patterns :
04850     case action_show_projects :
04851       // case action_show_pwd :
04852     case action_show_setup :
04853     case action_show_set :
04854     case action_show_set_names :
04855     case action_show_set_value :
04856     case action_show_sets :
04857     case action_show_strategies :
04858     case action_show_tags :
04859     case action_show_use_paths :
04860     case action_show_uses :
04861     case action_show_version :
04862       // case action_show_versions :
04863       // case action_system :
04864     case action_unlock :
04865     case action_version :
04866       use_cmt ();
04867         //
04868         // Now parse the requirements file stored in ${CMTHOME}
04869         //
04870       
04871       use_home_requirements ();
04872 
04873       break;
04874     default:
04875       break;
04876     }
04877 
04878   if (Me.m_debug) cout << "parser2> current_tag=" << Me.m_current_tag << endl;
04879 
04880   //
04881   // Setting up recursive actions
04882   //
04883 
04884   switch (Me.m_action)
04885     {
04886       // case action_none :
04887     case action_awk :
04888     case action_broadcast :
04889     case action_build_constituent_makefile :
04890     case action_build_constituents_makefile :
04891     case action_build_dependencies :
04892     case action_build_library_links :
04893     case action_build_make_setup :
04894     case action_build_msdev :
04895     case action_build_CMT_pacman :
04896     case action_build_vsnet :     
04897     case action_build_os9_makefile :
04898       // case action_build_prototype :
04899     case action_build_readme :
04900     case action_build_tag_makefile :
04901       // case action_build_temporary_name :
04902     case action_build_triggers :
04903     case action_build_windefs :
04904     case action_check_configuration :
04905       // case action_check_files :
04906       // case action_check_version :
04907       // case action_checkout :
04908     case action_cleanup :
04909     case action_config :
04910       // case action_create :
04911       // case action_create_project :
04912       // case action_cvsbranches :
04913       // case action_cvssubpackages :
04914       // case action_cvssubprojects :
04915       // case action_cvstags :
04916     case action_do :
04917     case action_expand_model :
04918     case action_filter :
04919       // case action_help :
04920     case action_load :
04921       // case action_lock :
04922       // case action_remove :
04923     case action_remove_library_links :
04924     case action_run :
04925     case action_run_sequence :
04926       // case action_set_version :
04927     case action_set_versions :
04928     case action_setup :
04929     case action_show_action :
04930     case action_show_action_names :
04931     case action_show_action_value :
04932     case action_show_actions :
04933     case action_show_all_tags :
04934     case action_show_applied_patterns :
04935       // case action_show_author :
04936       // case action_show_branches :
04937       // case action_show_clients :
04938     case action_show_cmtpath_patterns :
04939     case action_show_constituent :
04940     case action_show_constituent_names :
04941     case action_show_constituents :
04942     case action_show_cycles :
04943     case action_show_fragment :
04944     case action_show_fragments :
04945     case action_show_groups :
04946     case action_show_include_dirs :
04947     case action_show_language :
04948     case action_show_languages :
04949     case action_show_macro :
04950     case action_show_macro_names :
04951     case action_show_macro_value :
04952     case action_show_macros :
04953       // case action_show_manager :
04954     case action_show_packages :
04955     case action_show_path :
04956     case action_show_pattern :
04957     case action_show_pattern_names :
04958     case action_show_patterns :
04959     case action_show_projects :
04960       // case action_show_pwd :
04961     case action_show_setup :
04962     case action_show_set :
04963     case action_show_set_names :
04964     case action_show_set_value :
04965     case action_show_sets :
04966     case action_show_strategies :
04967     case action_show_tags :
04968     case action_show_use_paths :
04969     case action_show_uses :
04970       // case action_show_version :
04971       // case action_show_versions :
04972       // case action_system :
04973       // case action_unlock :
04974       // case action_version :
04975       Me.m_recursive = true;
04976       break;
04977     default:
04978       Me.m_recursive = false;
04979       break;
04980     }
04981 
04982   //
04983   //  Actions for which the context of the package is checked,
04984   //  and the requirements file is analysed.
04985   //
04986 
04987   switch (Me.m_action)
04988     {
04989     case action_none :
04990     case action_awk :
04991     case action_broadcast :
04992     case action_build_constituent_makefile :
04993     case action_build_constituents_makefile :
04994     case action_build_dependencies :
04995     case action_build_library_links :
04996     case action_build_make_setup :
04997     case action_build_msdev :
04998     case action_build_CMT_pacman :
04999     case action_build_vsnet :     
05000     case action_build_os9_makefile :
05001       // case action_build_prototype :
05002     case action_build_readme :
05003     case action_build_tag_makefile :
05004       // case action_build_temporary_name :
05005     case action_build_triggers :
05006     case action_build_windefs :
05007     case action_check_configuration :
05008       // case action_check_files :
05009       // case action_check_version :
05010       // case action_checkout :
05011     case action_cleanup :
05012     case action_config :
05013       // case action_create :
05014       // case action_create_project :
05015       // case action_cvsbranches :
05016       // case action_cvssubpackages :
05017       // case action_cvssubprojects :
05018       // case action_cvstags :
05019     case action_do :
05020     case action_expand_model :
05021     case action_filter :
05022       // case action_help :
05023     case action_load :
05024     case action_lock :
05025       // case action_remove :
05026     case action_remove_library_links :
05027     case action_run :
05028       // case action_run_sequence :
05029       // case action_set_version :
05030     case action_set_versions :
05031     case action_setup :
05032     case action_show_action :
05033     case action_show_action_names :
05034     case action_show_action_value :
05035     case action_show_actions :
05036     case action_show_all_tags :
05037     case action_show_applied_patterns :
05038     case action_show_author :
05039     case action_show_branches :
05040       // case action_show_clients :
05041     case action_show_cmtpath_patterns :
05042     case action_show_constituent :
05043     case action_show_constituent_names :
05044     case action_show_constituents :
05045     case action_show_cycles :
05046     case action_show_fragment :
05047     case action_show_fragments :
05048     case action_show_groups :
05049     case action_show_include_dirs :
05050     case action_show_language :
05051     case action_show_languages :
05052     case action_show_macro :
05053     case action_show_macro_names :
05054     case action_show_macro_value :
05055     case action_show_macros :
05056     case action_show_manager :
05057     case action_show_packages :
05058     case action_show_path :
05059     case action_show_pattern :
05060     case action_show_pattern_names :
05061     case action_show_patterns :
05062     case action_show_projects :
05063     case action_show_pwd :
05064     case action_show_setup :
05065     case action_show_set :
05066     case action_show_set_names :
05067     case action_show_set_value :
05068     case action_show_sets :
05069     case action_show_strategies :
05070     case action_show_tags :
05071     case action_show_use_paths :
05072     case action_show_uses :
05073     case action_show_version :
05074       // case action_show_versions :
05075       // case action_system :
05076     case action_unlock :
05077       // case action_version :
05078       reach_current_package ();
05079       use_user_context_requirements ();
05080       break;
05081     default:
05082       break;
05083     }
05084 
05085   if (Me.m_debug) cout << "parser3> current_tag=" << Me.m_current_tag << endl;
05086 
05087   //
05088   // Perform some actions even if there is an error
05089   //
05090 
05091   if (CmtError::has_pending_error ())
05092     {
05093       int code = CmtError::get_last_error_code ();
05094       if (!Me.m_quiet) CmtError::print ();
05095 
05096       switch (Me.m_action)
05097         {
05098           // case action_none :
05099           // case action_awk :
05100           // case action_broadcast :
05101         case action_build_constituent_makefile :
05102         case action_build_constituents_makefile :
05103         case action_build_dependencies :
05104         case action_build_library_links :
05105         case action_build_make_setup :
05106         case action_build_msdev :
05107         case action_build_CMT_pacman :
05108         case action_build_vsnet :     
05109         case action_build_os9_makefile :
05110         case action_build_prototype :
05111         case action_build_readme :
05112         case action_build_tag_makefile :
05113           // case action_build_temporary_name :
05114         case action_build_triggers :
05115         case action_build_windefs :
05116         case action_check_configuration :
05117           // case action_check_files :
05118           // case action_check_version :
05119           // case action_checkout :
05120         case action_cleanup :
05121           // case action_config :
05122           // case action_create :
05123           // case action_create_project :
05124           // case action_cvsbranches :
05125           // case action_cvssubpackages :
05126           // case action_cvssubprojects :
05127           // case action_cvstags :
05128           // case action_do :
05129           // case action_expand_model :
05130           // case action_filter :
05131           // case action_help :
05132         case action_load :
05133         case action_lock :
05134         case action_remove :
05135         case action_remove_library_links :
05136           // case action_run :
05137         case action_run_sequence :
05138           // case action_set_version :
05139           // case action_set_versions :
05140         case action_setup :
05141           // case action_show_action :
05142           // case action_show_action_names :
05143           // case action_show_action_value :
05144           // case action_show_actions :
05145           // case action_show_all_tags :
05146           // case action_show_applied_patterns :
05147           // case action_show_author :
05148           // case action_show_branches :
05149           // case action_show_clients :
05150           // case action_show_cmtpath_patterns :
05151           // case action_show_constituent :
05152           // case action_show_constituent_names :
05153           // case action_show_constituents :
05154           // case action_show_cycles :
05155           // case action_show_fragment :
05156           // case action_show_fragments :
05157           // case action_show_groups :
05158           // case action_show_include_dirs :
05159           // case action_show_language :
05160           // case action_show_languages :
05161           // case action_show_macro :
05162           // case action_show_macro_names :
05163           // case action_show_macro_value :
05164           // case action_show_macros :
05165           // case action_show_manager :
05166           // case action_show_packages :
05167           // case action_show_path :
05168           // case action_show_pattern :
05169           // case action_show_pattern_names :
05170           // case action_show_patterns :
05171           // case action_show_projects :
05172           // case action_show_pwd :
05173           // case action_show_setup :
05174           // case action_show_set :
05175           // case action_show_set_names :
05176           // case action_show_set_value :
05177           // case action_show_sets :
05178           // case action_show_strategies :
05179           // case action_show_tags :
05180           // case action_show_use_paths :
05181           // case action_show_uses :
05182           // case action_show_version :
05183           // case action_show_versions :
05184           // case action_system :
05185         case action_unlock :
05186           // case action_version :
05187           clear ();
05188           return (code);
05189         default:
05190           CmtError::clear ();
05191           break;
05192         }
05193     }
05194 
05195   //
05196   // Perform actions
05197   //
05198 
05199   if (!Me.m_simulation)
05200     {
05201       switch (Me.m_action)
05202         {
05203         case action_none :
05204           //CmtError::set (CmtError::syntax_error, "ParseArguments> ");
05205           break;
05206         case action_awk :
05207           do_awk (ap);
05208       break;
05209         case action_broadcast :
05210           do_broadcast (ap);
05211           break;
05212         case action_build_constituent_makefile :
05213           do_build_constituent_makefile (ap);
05214           break;
05215         case action_build_constituents_makefile :
05216           do_build_constituents_makefile (ap);
05217           break;
05218         case action_build_dependencies :
05219           do_build_dependencies (ap, argc, argv);
05220           break;
05221         case action_build_library_links :
05222           do_build_library_links (ap);
05223           break;
05224         case action_build_make_setup :
05225           do_build_make_setup (ap);
05226           break;
05227         case action_build_msdev :
05228           do_build_msdev (ap);
05229           break;
05230         case action_build_CMT_pacman :
05231           do_build_CMT_pacman (ap);
05232           break;
05233         case action_build_vsnet :     
05234           do_build_vsnet (ap);
05235           break;
05236         case action_build_os9_makefile :
05237           do_build_os9_makefile (ap);
05238           break;
05239         case action_build_prototype :
05240           do_build_prototype (ap);
05241           break;
05242         case action_build_readme :
05243           do_build_readme (ap);
05244           break;
05245         case action_build_tag_makefile :
05246           do_build_tag_makefile (ap);
05247           break;
05248         case action_build_temporary_name :
05249           do_build_temporary_name (ap);
05250           break;
05251         case action_build_triggers :
05252           do_build_triggers (ap);
05253           break;
05254         case action_build_windefs :
05255           do_build_windefs (ap);
05256           break;
05257         case action_check_configuration :
05258           do_check_configuration (ap);
05259           break;
05260         case action_check_files :
05261           do_check_files (ap);
05262           break;
05263         case action_check_version :
05264           do_check_version (ap);
05265           break;
05266         case action_checkout :
05267           do_checkout (ap);
05268           break;
05269         case action_cleanup :
05270           do_cleanup (ap);
05271           break;
05272         case action_config :
05273           do_config (ap);
05274           break;
05275         case action_create :
05276           do_create (ap);
05277           break;
05278         case action_create_project :
05279           do_create_project (ap);
05280           break;
05281         case action_cvsbranches :
05282           do_cvsbranches (ap);
05283           break;
05284         case action_cvssubpackages :
05285           do_cvssubpackages (ap);
05286           break;
05287         case action_cvssubprojects :
05288           do_cvssubprojects (ap);
05289           break;
05290         case action_cvstags :
05291           do_cvstags (ap);
05292           break;
05293         case action_do :
05294           do_do (ap);
05295           break;
05296         case action_expand_model :
05297           do_expand_model (ap);
05298           break;
05299         case action_filter :
05300           do_filter (ap);
05301           break;
05302         case action_help :
05303           do_help (ap);
05304           break;
05305         case action_load :
05306           cerr << "#CMT> action not implemented" << endl;
05307           break;
05308         case action_lock :
05309           do_lock (ap);
05310           break;
05311         case action_remove :
05312           do_remove (ap);
05313           break;
05314         case action_remove_library_links :
05315           do_remove_library_links (ap);
05316           break;
05317         case action_run :
05318           do_run (ap);
05319           break;
05320         case action_run_sequence :
05321           do_run_sequence (ap);
05322           break;
05323         case action_set_version :
05324           do_set_version (ap);
05325           break;
05326         case action_set_versions :
05327           do_set_versions (ap);
05328           break;
05329         case action_setup :
05330           do_setup (ap);
05331           break;
05332         case action_show_action :
05333           do_show_action (ap);
05334           break;
05335         case action_show_action_names :
05336           do_show_action_names (ap);
05337           break;
05338         case action_show_action_value :
05339           do_show_action_value (ap);
05340           break;
05341         case action_show_actions :
05342           do_show_actions (ap);
05343           break;
05344         case action_show_all_tags :
05345           do_show_all_tags (ap);
05346           break;
05347         case action_show_applied_patterns :
05348           do_show_applied_patterns (ap);
05349           break;
05350         case action_show_author :
05351           do_show_author (ap);
05352           break;
05353         case action_show_branches :
05354           do_show_branches (ap);
05355           break;
05356         case action_show_clients :
05357           do_show_clients (ap);
05358           break;
05359         case action_show_cmtpath_patterns :
05360           do_show_cmtpath_patterns (ap);
05361           break;
05362         case action_show_constituent :
05363           do_show_constituent (ap);
05364           break;
05365         case action_show_constituent_names :
05366           do_show_constituent_names (ap);
05367           break;
05368         case action_show_constituents :
05369           do_show_constituents (ap);
05370           break;
05371         case action_show_cycles :
05372           do_show_cycles (ap);
05373           break;
05374         case action_show_fragment :
05375           do_show_fragment (ap);
05376           break;
05377         case action_show_fragments :
05378           do_show_fragments (ap);
05379           break;
05380         case action_show_groups :
05381           do_show_groups (ap);
05382           break;
05383         case action_show_include_dirs :
05384           do_show_include_dirs (ap);
05385           break;
05386         case action_show_language :
05387           do_show_language (ap);
05388           break;
05389         case action_show_languages :
05390           do_show_languages (ap);
05391           break;
05392         case action_show_macro :
05393           do_show_macro (ap);
05394           break;
05395         case action_show_macro_names :
05396           do_show_macro_names (ap);
05397           break;
05398         case action_show_macro_value :
05399           do_show_macro_value (ap);
05400           break;
05401         case action_show_macros :
05402           do_show_macros (ap);
05403           break;
05404         case action_show_manager :
05405           do_show_manager (ap);
05406           break;
05407         case action_show_packages :
05408           do_show_packages (ap);
05409           break;
05410         case action_show_path :
05411           do_show_path (ap);
05412           break;
05413         case action_show_pattern :
05414           do_show_pattern (ap);
05415           break;
05416         case action_show_pattern_names :
05417           do_show_pattern_names (ap);
05418           break;
05419         case action_show_patterns :
05420           do_show_patterns (ap);
05421           break;
05422         case action_show_projects :
05423           do_show_projects (ap);
05424           break;
05425         case action_show_pwd :
05426           do_show_pwd (ap);
05427           break;
05428         case action_show_setup :
05429           do_show_setup (ap);
05430           break;
05431         case action_show_set :
05432           do_show_set (ap);
05433           break;
05434         case action_show_set_names :
05435           do_show_set_names (ap);
05436           break;
05437         case action_show_set_value :
05438           do_show_set_value (ap);
05439           break;
05440         case action_show_sets :
05441           do_show_sets (ap);
05442           break;
05443         case action_show_strategies :
05444           do_show_strategies (ap);
05445           break;
05446         case action_show_tags :
05447           do_show_tags (ap);
05448           break;
05449         case action_show_use_paths :
05450           do_show_use_paths (ap);
05451           break;
05452         case action_show_uses :
05453           do_show_uses (ap);
05454           break;
05455         case action_show_version :
05456           do_show_version (ap);
05457           break;
05458         case action_show_versions :
05459           do_show_versions (ap);
05460           break;
05461         case action_system :
05462           do_show_system (ap);
05463           break;
05464         case action_unlock :
05465           do_unlock (ap);
05466           break;
05467         case action_version :
05468           do_version (ap);
05469           break;
05470         default:
05471           CmtError::set (CmtError::syntax_error, "ParseArguments>");
05472           break;
05473         }
05474     }
05475 
05476   if (CmtError::has_pending_error ())
05477     {
05478       int code = CmtError::get_last_error_code ();
05479       if (!Me.m_quiet) CmtError::print ();
05480       clear ();
05481       return (code);
05482     }
05483   else
05484     {
05485       clear ();
05486       return (0);
05487     }
05488 }

int Cmt::parser const cmt_string command_line  )  [static]
 

Definition at line 4667 of file cmt_parser.cxx.

References CmtSystem::cmt_string_vector, cmt_vector< T >::size(), and CmtSystem::split().

Referenced by do_broadcast(), and main().

04668 {
04669   CmtSystem::cmt_string_vector v;
04670 
04671   CmtSystem::split (command_line, " \t", v);
04672 
04673   int argc = v.size ();
04674 
04675   char** argv = (char**) malloc ((argc + 1) * sizeof (char*));
04676 
04677   int i;
04678   for (i = 0; i < argc; i++)
04679     {
04680       argv[i] = (char*) v[i].c_str ();
04681     }
04682   argv[argc] = 0;
04683 
04684   int status = parser (argc, argv);
04685 
04686   free (argv);
04687 
04688   return (status);
04689 }

void Cmt::print PrintMode  mode  )  [static]
 

Format as one single line a set of 'setenv' statements joined with semi-colons to form one shell command.

Definition at line 5495 of file cmt_parser.cxx.

References Symbol::all_print(), Bat, CmtSystem::cmt_string_vector, Use::current(), Use::discarded, Tag::find(), Use::get_ordered_uses(), Tag::is_selected(), CmtContext::m_current_tag, CmtContext::m_debug, CmtContext::m_extra_tags, Me, print_context(), set_standard_macros(), cmt_vector< T >::size(), CmtSystem::split(), and Use::UsePtrVector.

Referenced by do_setup().

05496 {
05497   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
05498   Use& current_use = Use::current ();
05499 
05500   cmt_string tag;
05501 
05502   set_standard_macros ();
05503 
05504     //cerr << "# current_tag=" << Me.m_current_tag << endl;
05505     //cerr << "# current_config=" << Me.m_current_config << endl;
05506 
05507   if (Me.m_current_tag == "")
05508     {
05509       if (mode == Bat) tag = "%CMTCONFIG%";
05510       else tag = "${CMTCONFIG}";
05511     }
05512   else
05513     {
05514       tag = Me.m_current_tag;
05515     }
05516 
05517     //
05518     //  Now check if all extra tags are still valid. Some of them
05519     //  may be discarded du to some conflict with highest priority
05520     //  tags, or with exclude statements
05521     //
05522 
05523   {
05524     CmtSystem::cmt_string_vector words;
05525       
05526     cmt_string tags;
05527 
05528     tags = Me.m_extra_tags;
05529       
05530     CmtSystem::split (tags, " \t,", words);
05531 
05532     Me.m_extra_tags = ",";
05533       
05534     for (int i = 0; i < words.size (); i++)
05535       {
05536         Tag* tag;
05537         const cmt_string& a = words[i];
05538 
05539         tag = Tag::find (a);
05540 
05541         if ((tag != 0) && (tag->is_selected ()))
05542           {
05543             Me.m_extra_tags += a;
05544             Me.m_extra_tags += ",";
05545           }
05546       }
05547   }
05548 
05549   if (Me.m_debug)
05550     {
05551       cout << "Before all print contexts" << endl;
05552     }
05553 
05554   if (Uses.size () > 0)
05555     {
05556       int number;
05557 
05558       for (number = 0; number < Uses.size (); number++)
05559         {
05560           Use& use = *(Uses[number]);
05561 
05562           if (use.discarded) continue;
05563 
05564           print_context (use, mode, tag);
05565         }
05566     }
05567 
05568   print_context (Use::current (), mode, tag);
05569 
05570   if (Me.m_debug)
05571     {
05572       cout << "After all print contexts" << endl;
05573     }
05574 
05575   Symbol::all_print (mode);
05576   // Script::all_print (mode);
05577 
05578   if (Me.m_debug)
05579     {
05580       cout << "After all print" << endl;
05581     }
05582 
05583   cout << endl;
05584 }

void Cmt::print_clean PrintMode  mode  )  [static]
 

Format as one single line a set of 'unsetenv' statements joined with semi-colons to form one shell command.

Definition at line 5591 of file cmt_parser.cxx.

References Symbol::all_print_clean(), Script::all_print_clean(), Bat, Csh, Use::discarded, Use::get_ordered_uses(), Use::get_package(), Package::is_cmt(), CmtContext::m_current_package, CmtContext::m_current_prefix, Me, Use::prefix, set_standard_macros(), Sh, cmt_vector< T >::size(), and Use::UsePtrVector.

Referenced by do_cleanup().

05592 {
05593   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
05594 
05595   set_standard_macros ();
05596 
05597   Script::all_print_clean (mode);
05598   Symbol::all_print_clean (mode);
05599 
05600   switch (mode)
05601     {
05602     case Csh :
05603       if (Me.m_current_package != "CMT")
05604         {
05605           cout << "unsetenv " << Me.m_current_prefix << "ROOT" << endl;
05606           cout << "unsetenv " << Me.m_current_prefix << "CONFIG" << endl;
05607         }
05608       break;
05609     case Sh :
05610       if (Me.m_current_package != "CMT")
05611         {
05612           cout << "unset " << Me.m_current_prefix << "ROOT" << endl;
05613           cout << "unset " << Me.m_current_prefix << "CONFIG" << endl;
05614         }
05615       break;
05616     case Bat :
05617       if (Me.m_current_package != "CMT")
05618         {
05619           cout << "set " << Me.m_current_prefix << "ROOT=" << endl;
05620           cout << "set " << Me.m_current_prefix << "CONFIG=" << endl;
05621         }
05622       break;
05623     }
05624 
05625   if (Uses.size () > 0)
05626     {
05627       int number;
05628 
05629       for (number = 0; number < Uses.size (); number++)
05630         {
05631           Use* use = Uses[number];
05632 
05633           if (use->discarded) continue;
05634 
05635           Package* p = use->get_package ();
05636           if (p->is_cmt ()) continue;
05637 
05638           switch (mode)
05639             {
05640             case Csh :
05641               cout << "unsetenv " << use->prefix << "ROOT" << endl;
05642               cout << "unsetenv " << use->prefix << "CONFIG" << endl;
05643               break;
05644             case Sh :
05645               cout << "unset " << use->prefix << "ROOT" << endl;
05646               cout << "unset " << use->prefix << "CONFIG" << endl;
05647               break;
05648             case Bat :
05649               cout << "set " << use->prefix << "ROOT=" << endl;
05650               cout << "set " << use->prefix << "CONFIG" << endl;
05651               break;
05652             }
05653         }
05654     }
05655 
05656   switch (mode)
05657     {
05658     case Csh :
05659       cout << "unsetenv CMTEXTRATAGS" << endl;
05660       break;
05661     case Sh :
05662       cout << "unset CMTEXTRATAGS" << endl;
05663       break;
05664     case Bat :
05665       cout << "set CMTEXTRATAGS=" << endl;
05666       break;
05667     }
05668 
05669   cout << endl;
05670 }

void Cmt::print_context Use use,
PrintMode  mode,
const cmt_string tag
[static]
 

Definition at line 5673 of file cmt_parser.cxx.

References Bat, Csh, do_config(), CmtSystem::file_separator(), CmtSystem::get_cmt_config(), Use::get_full_path(), Use::get_package_name(), get_strategy(), Use::prefix, Use::real_path, cmt_string::replace_all(), and Sh.

Referenced by print().

05674 {
05675   if (use.get_package_name () == "cmt_standalone") return;
05676 
05677   cmt_string fs = CmtSystem::file_separator ();
05678 
05679   use.real_path.replace_all (CmtSystem::file_separator (), fs);
05680 
05681   cmt_string system = CmtSystem::get_cmt_config ();
05682 
05683   bool do_config = get_strategy ("SetupConfig");
05684   bool do_root = get_strategy ("SetupRoot");
05685 
05686   switch (mode)
05687     {
05688     case Csh :
05689       if (do_root)
05690         {
05691           cout << "setenv " << use.prefix << "ROOT \"" <<
05692             use.get_full_path () << "\"" << endl;
05693         }
05694 
05695       if (use.get_package_name () == "CMT")
05696         {
05697           cout << "setenv CMTCONFIG " << system << endl;
05698         }
05699       else
05700         {
05701           if (do_config)
05702             {
05703               cout << "setenv " << use.prefix << "CONFIG \"" << tag << "\"" << endl;
05704             }
05705         }
05706         
05707       break;
05708     case Sh :
05709       if (do_root)
05710         {
05711           cout << use.prefix << "ROOT=\"" <<
05712             use.get_full_path () << "\"; export " <<
05713             use.prefix << "ROOT" << endl;
05714         }
05715 
05716       if (use.get_package_name () == "CMT")
05717         {
05718           cout << "CMTCONFIG=" << system << "; export CMTCONFIG" << endl;
05719         }
05720       else
05721         {
05722           if (do_config)
05723             {
05724               cout << use.prefix << "CONFIG=\"" <<
05725                 tag << "\"; export " <<
05726                 use.prefix << "CONFIG" << endl;
05727             }
05728         }
05729         
05730       break;
05731     case Bat :
05732       if (do_root)
05733         {
05734           cout << "set " << use.prefix << "ROOT=" <<
05735             use.get_full_path () << endl;
05736         }
05737 
05738       if (use.get_package_name () == "CMT")
05739         {
05740           cout << "set CMTCONFIG=" << system << endl;
05741         }
05742       else
05743         {
05744           if (do_config)
05745             {
05746               cout << "set " << use.prefix << "CONFIG=" << tag << endl;
05747             }
05748         }
05749         
05750       break;
05751     }
05752 }

void Cmt::print_macros PrintMode  mode,
const cmt_string pattern = ""
[static]
 

Format a set of make macro definitions (one per line) Each macro value is provided enclosed in single quotes.

Take the macro values from the macro statements found in recursively read requirements files.

Definition at line 5811 of file cmt_parser.cxx.

References action_build_tag_makefile, action_show_actions, action_show_macros, action_show_sets, CmtContext::m_action, cmt_regexp::match(), Me, Symbol::name, set_standard_macros(), Symbol::show_macro(), cmt_vector< T >::size(), Symbol::symbol(), Symbol::symbol_number(), Symbol::type, and Symbol::value_lists.

Referenced by do_build_tag_makefile(), do_show_actions(), do_show_macros(), and do_show_sets().

05812 {
05813   int number;
05814 
05815   set_standard_macros ();
05816 
05817   cmt_regexp expression (pattern);
05818 
05819   bool has_pattern = (pattern != "");
05820 
05821   for (number = 0; number < Symbol::symbol_number (); number++)
05822     {
05823       Symbol& symbol = Symbol::symbol (number);
05824 
05825       if (has_pattern)
05826         {
05827           if (!expression.match (symbol.name)) continue;
05828         }
05829 
05830       if (Me.m_action == action_show_macros)
05831         {
05832           // Only keep macros.
05833           if ((symbol.type == Symbol::SymbolSet) ||
05834               (symbol.type == Symbol::SymbolAlias) ||
05835               (symbol.type == Symbol::SymbolPath) ||
05836               (symbol.type == Symbol::SymbolAction)) continue;
05837         }
05838       else if (Me.m_action == action_show_sets)
05839         {
05840           // Exclude macros.
05841           if ((symbol.type == Symbol::SymbolMacro) ||
05842               (symbol.type == Symbol::SymbolAction)) continue;
05843         }
05844       else if (Me.m_action == action_build_tag_makefile)
05845         {
05846           // Exclude scripts and actions
05847           if ((symbol.type == Symbol::SymbolSetupScript) ||
05848               (symbol.type == Symbol::SymbolCleanupScript) ||
05849               (symbol.type == Symbol::SymbolAction)) continue;
05850         }
05851       else if (Me.m_action == action_show_actions)
05852         {
05853           if (symbol.type != Symbol::SymbolAction) continue;
05854         }
05855 
05856       if (symbol.value_lists.size () < 1) continue;
05857 
05858       symbol.show_macro (mode);
05859     }
05860 }

void Cmt::print_symbol_names PrintMode  mode,
const cmt_string pattern = ""
[static]
 

Format a set of make macro definitions (one per line) Each macro value is provided enclosed in single quotes.

Take the macro values from the macro statements found in recursively read requirements files.

Definition at line 5761 of file cmt_parser.cxx.

References action_show_action_names, action_show_macro_names, action_show_set_names, CmtContext::m_action, cmt_regexp::match(), Me, Symbol::name, set_standard_macros(), Symbol::symbol(), Symbol::symbol_number(), and Symbol::type.

Referenced by do_show_action_names(), do_show_macro_names(), and do_show_set_names().

05762 {
05763   int number;
05764 
05765   set_standard_macros ();
05766 
05767   cmt_regexp expression (pattern);
05768 
05769   bool has_pattern = (pattern != "");
05770 
05771   for (number = 0; number < Symbol::symbol_number (); number++)
05772     {
05773       Symbol& symbol = Symbol::symbol (number);
05774 
05775       if (has_pattern)
05776        {
05777          if (!expression.match (symbol.name)) continue;
05778        }
05779 
05780       if (Me.m_action == action_show_macro_names)
05781         {
05782           // Only keep macros.
05783           if ((symbol.type == Symbol::SymbolSet) ||
05784               (symbol.type == Symbol::SymbolAlias) ||
05785               (symbol.type == Symbol::SymbolPath) ||
05786               (symbol.type == Symbol::SymbolAction)) continue;
05787         }
05788       else if (Me.m_action == action_show_set_names)
05789         {
05790           // Exclude macros.
05791           if ((symbol.type == Symbol::SymbolMacro) ||
05792               (symbol.type == Symbol::SymbolAction)) continue;
05793         }
05794       else if (Me.m_action == action_show_action_names)
05795         {
05796           // Exclude macros.
05797           if (symbol.type != Symbol::SymbolAction) continue;
05798         }
05799 
05800       cout << symbol.name << endl;
05801     }
05802 }

void Cmt::print_tabs int  tabs  )  [static]
 

Definition at line 5863 of file cmt_parser.cxx.

05864 {
05865   while (tabs > 0)
05866     {
05867       cout << "  ";
05868       tabs--;
05869     }
05870 }

int Cmt::reach_current_package  )  [static]
 

Definition at line 5873 of file cmt_parser.cxx.

References Tag::add(), Pattern::apply_all_globals(), CmtSystem::basename(), build_config(), build_prefix(), CmtSystem::cd(), cmt_style, configure_current_dir(), Use::current(), CmtSystem::dirname(), CmtSystem::file_separator(), CmtSystem::getenv(), CmtSystem::is_version_directory(), CmtContext::m_current_config, CmtContext::m_current_package, CmtContext::m_current_path, CmtContext::m_current_prefix, CmtContext::m_current_style, CmtContext::m_current_tag, CmtContext::m_current_version, CmtContext::m_debug, CmtContext::m_quiet, Tag::mark(), Me, mgr_style, Use::move_to(), no_version_style, SyntaxParser::parse_requirements(), Use::path, PriorityConfig, CmtSystem::pwd(), Use::real_path, Tag::restore_tree(), CmtError::set(), Use::set_package_name(), Use::style, CmtSystem::test_file(), and Use::version.

Referenced by do_config(), and parser().

05874 {
05875   Use& use = Use::current ();
05876   cmt_string dir;
05877 
05878   if (Me.m_debug)
05879     {
05880       cout << "Cmt::reach_current_package> pwd = " 
05881            << CmtSystem::pwd () 
05882            << " path=" << Me.m_current_path
05883            << " package=" << Me.m_current_package
05884            << endl;
05885     }
05886 
05887   /*
05888     Try to access the package.
05889   */
05890 
05891   if (Me.m_current_package == "cmt_standalone")
05892     {
05893       if ((Me.m_current_path != "") && (Me.m_current_path != CmtSystem::pwd ()))
05894         {
05895           if (!CmtSystem::cd (Me.m_current_path))
05896             {
05897               CmtError::set (CmtError::package_not_found,
05898                              "ReachCurrentPackage> Cannot reach the path directory");
05899               return (0);
05900             }
05901         }
05902 
05903       if (!CmtSystem::test_file ("requirements"))
05904         {
05905             /*
05906           if (!Me.m_quiet)
05907             {
05908               cout << "#CMT> Cannot reach the requirements file" << endl;
05909             }
05910               
05911           CmtError::set (CmtError::package_not_found,
05912                          "ReachCurrentPackage> Cannot reach the requirements file");
05913             */
05914           return (0);
05915         }
05916     }
05917   else if (Me.m_current_package != "")
05918     {
05919       if (!use.move_to ())
05920         {
05921           CmtError::set (CmtError::package_not_found,
05922                          "ReachCurrentPackage> Cannot reach the path directory");
05923           return (0);
05924         }
05925 
05926       Me.m_current_path = use.real_path;
05927     }
05928   else
05929     {
05930       //
05931       // The cmt command has been given without explicit search for 
05932       // a package. Thus it is expected that we are in the context of a
05933       // true package.
05934       //
05935       //  This means that there should be a requirements file visible.
05936       //
05937       //  If this is not true, we'll make a try into ../cmt and then
05938       // a last try into ../mgr
05939       //
05940 
05941       if (!CmtSystem::test_file ("requirements"))
05942         {
05943           if (CmtSystem::cd ("../cmt") && 
05944               CmtSystem::test_file ("requirements"))
05945             {
05946               Me.m_current_style = cmt_style;
05947             }
05948           else if (CmtSystem::cd ("../mgr") && 
05949                    CmtSystem::test_file ("requirements"))
05950             {
05951               Me.m_current_style = mgr_style;
05952             }
05953           else
05954             {
05955               if (!Me.m_quiet)
05956                 {
05957                   cerr << "#CMT> Cannot reach the mgr branch" << endl;
05958                 }
05959               
05960               CmtError::set (CmtError::package_not_found,
05961                              "ReachCurrentPackage> Cannot reach the mgr/cmt directory");
05962               return (0);
05963             }
05964         }
05965 
05966       dir = CmtSystem::pwd ();
05967 
05968       CmtSystem::dirname (dir, Me.m_current_path);
05969       CmtSystem::basename (Me.m_current_path, Me.m_current_version);
05970 
05971       if (CmtSystem::is_version_directory (Me.m_current_version))
05972         {
05973           CmtSystem::dirname (Me.m_current_path, Me.m_current_path);
05974           CmtSystem::basename (Me.m_current_path, Me.m_current_package);
05975           CmtSystem::dirname (Me.m_current_path, Me.m_current_path);
05976         }
05977       else
05978         {
05979           Me.m_current_package = Me.m_current_version;
05980           Me.m_current_version = "";
05981           CmtSystem::dirname (Me.m_current_path, Me.m_current_path);
05982 
05983           Me.m_current_style = no_version_style;
05984         }
05985 
05986       use.set_package_name (Me.m_current_package);
05987       use.version = Me.m_current_version;
05988       use.path    = Me.m_current_path;
05989       use.style   = Me.m_current_style;
05990     }
05991 
05992   configure_current_dir ();
05993   build_prefix (Me.m_current_package, Me.m_current_prefix);
05994   build_config (Me.m_current_prefix, Me.m_current_config);
05995 
05996   /*
05997     Check Tag is always set up
05998   */
05999 
06000   if (Me.m_debug) cout << "reach_current_package0> current_tag=" << Me.m_current_tag << endl;
06001 
06002   if (Me.m_current_tag == "")
06003     {
06004       cmt_string env;
06005 
06006       env = CmtSystem::getenv (Me.m_current_config);
06007       if (env != "")
06008         {
06009           Tag* tag;
06010 
06011           tag = Tag::add (env, PriorityConfig, "reach current package", 0);
06012           tag->mark ();
06013             //Me.m_current_tag = env;
06014 
06015           //if (!Me.m_quiet) cerr << "reach_current_package1> current_tag=" << Me.m_current_tag << endl;
06016 
06017         }
06018     }
06019 
06020   if (Me.m_debug)
06021     {
06022       cout << "pwd = " << CmtSystem::pwd () << endl;
06023     }
06024 
06025   /*
06026     Work on the requirements file.
06027   */
06028 
06029   if (dir != "") dir += CmtSystem::file_separator ();
06030   dir += "requirements";
06031   SyntaxParser::parse_requirements (dir, &use);
06032 
06033   if (Me.m_debug) cout << "reach_current_package2> current_tag=" << Me.m_current_tag << endl;
06034 
06056   Pattern::apply_all_globals ();
06057 
06058   /*
06059     Select all possible tags
06060   */
06061 
06062   Tag::restore_tree ();
06063 
06064   return (1);
06065 }

void Cmt::reset_all_sets_done  )  [static]
 

Definition at line 7399 of file cmt_parser.cxx.

References CmtContext::m_all_sets_done, and Me.

Referenced by do_broadcast(), do_do(), and do_run().

07400 {
07401   Me.m_all_sets_done = false;
07402 }

void Cmt::restore_all_tags Use use  )  [static]
 

Definition at line 1048 of file cmt_parser.cxx.

References Tag::add(), CmtSystem::cmt_string_vector, configure_tags(), CmtSystem::getenv(), CmtContext::m_extra_tags, Tag::mark(), Me, PriorityUserTag, cmt_vector< T >::size(), CmtSystem::split(), and CmtSystem::testenv().

Referenced by parse_arguments().

01049 {
01050     //cerr << "restore_all_tags" << endl;
01051 
01052   Cmt::configure_tags (use);
01053 
01054     /*
01055       Then get existing extra tags
01056      */
01057 
01058   if (CmtSystem::testenv ("CMTEXTRATAGS"))
01059     {
01060       cmt_string s = "CMTEXTRATAGS";
01061 
01062       if (use != 0)
01063         {
01064           s += " in ";
01065         }
01066 
01067       Tag* tag;
01068       CmtSystem::cmt_string_vector words;
01069       
01070       cmt_string tags = CmtSystem::getenv ("CMTEXTRATAGS");
01071       
01072       CmtSystem::split (tags, " \t,", words);
01073 
01074       Me.m_extra_tags = ",";
01075       
01076       for (int i = 0; i < words.size (); i++)
01077         {
01078           const cmt_string& a = words[i];
01079 
01080           Me.m_extra_tags += a;
01081           Me.m_extra_tags += ",";
01082           
01083           tag = Tag::add (a, PriorityUserTag, s, use);
01084           
01085           tag->mark ();
01086         }
01087     }
01088 }

void Cmt::set_all_sets_done  )  [static]
 

Definition at line 7394 of file cmt_parser.cxx.

References CmtContext::m_all_sets_done, and Me.

Referenced by Symbol::all_set().

07395 {
07396   Me.m_all_sets_done = true;
07397 }

void Cmt::set_current_access AccessMode  mode  )  [static]
 

Definition at line 7259 of file cmt_parser.cxx.

References CmtContext::m_current_access, and Me.

Referenced by SyntaxParser::parse_requirements(), and SyntaxParser::parse_requirements_text().

07260 {
07261   Me.m_current_access = mode;
07262 }

void Cmt::set_scope_filtering_mode CmtScopeFilteringMode  mode  )  [static]
 

Definition at line 7265 of file cmt_parser.cxx.

References CmtContext::m_scope_filtering_mode, and Me.

07266 {
07267   Me.m_scope_filtering_mode = mode;
07268 }

void Cmt::set_standard_macros  )  [static]
 

Definition at line 7271 of file cmt_parser.cxx.

References CmtSystem::basename(), Symbol::build_macro_value(), CmtSystem::cmt_string_vector, cmt_style, Use::current(), CmtSystem::dirname(), CmtSystem::file_separator(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_branches(), StandardMacroBuilder::fill_for_constituent_macros(), StandardMacroBuilder::fill_for_current_package(), StandardMacroBuilder::fill_for_fincludes(), StandardMacroBuilder::fill_for_includes(), StandardMacroBuilder::fill_for_install_area(), StandardMacroBuilder::fill_for_project(), StandardMacroBuilder::fill_for_use_cflags(), StandardMacroBuilder::fill_for_use_cppflags(), StandardMacroBuilder::fill_for_use_fflags(), StandardMacroBuilder::fill_for_use_fincludes(), StandardMacroBuilder::fill_for_use_includes(), StandardMacroBuilder::fill_for_use_libraries(), StandardMacroBuilder::fill_for_use_linkopts(), StandardMacroBuilder::fill_for_use_pp_cflags(), StandardMacroBuilder::fill_for_use_pp_cppflags(), StandardMacroBuilder::fill_for_use_pp_fflags(), StandardMacroBuilder::fill_for_use_requirements(), StandardMacroBuilder::fill_for_use_stamps(), Symbol::find(), Use::get_ordered_uses(), Use::get_package_name(), CmtSystem::getenv(), Symbol::is_selected(), CmtSystem::is_version_directory(), CmtContext::m_current_dir, CmtContext::m_current_package, CmtContext::m_current_prefix, CmtContext::m_current_style, CmtContext::m_current_tag, CmtContext::m_current_version, CmtContext::m_debug, CmtContext::m_standard_macros_done, Me, mgr_style, no_version_style, none_style, CmtSystem::pwd(), CmtSystem::split(), CmtSystem::test_file(), CmtSystem::testenv(), and Use::UsePtrVector.

Referenced by build_msdev_file(), build_vsnet_file(), do_build_constituent_makefile(), do_build_constituents_makefile(), do_build_dependencies(), do_build_library_links(), do_build_make_setup(), do_build_msdev(), do_build_os9_makefile(), do_build_prototype(), do_build_readme(), do_build_triggers(), do_build_vsnet(), do_build_windefs(), do_do(), do_expand_model(), do_filter(), do_lock(), do_remove_library_links(), do_run(), do_show_action(), do_show_all_tags(), do_show_cmtpath_patterns(), do_show_constituent(), do_show_constituent_names(), do_show_constituents(), do_show_cycles(), do_show_include_dirs(), do_show_language(), do_show_languages(), do_show_macro(), do_show_tags(), do_unlock(), print(), print_clean(), print_macros(), and print_symbol_names().

07272 {
07273   if (Me.m_standard_macros_done) return;
07274 
07275   Me.m_standard_macros_done = true;
07276 
07277   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
07278   Use& current_use = Use::current ();
07279 
07280   cmt_string fs = CmtSystem::file_separator ();
07281 
07282   cmt_string pwd = CmtSystem::pwd ();
07283 
07284   if (CmtSystem::test_file ("../cmt/requirements")) Me.m_current_style = cmt_style;
07285   else if (CmtSystem::test_file ("../mgr/requirements")) Me.m_current_style = mgr_style;
07286   else Me.m_current_style = none_style;
07287 
07288   {
07289     cmt_string v;
07290     CmtSystem::dirname (pwd, v);
07291     CmtSystem::basename (v, v);
07292     if (!CmtSystem::is_version_directory (v))
07293       {
07294         Me.m_current_style = no_version_style;
07295       }
07296   }
07297 
07298   // Prepare computation of the best form for relative path from current directory
07299   // to package directories.
07300   CmtSystem::cmt_string_vector vb;
07301   CmtSystem::split (pwd, fs, vb);
07302 
07303 
07308   bool tag_debug = CmtSystem::testenv ("TAGDEBUG");
07309 
07310   if (tag_debug) cerr << "set_standard_macro0> current_tag=" << Me.m_current_tag << endl;
07311 
07312   if (Me.m_current_tag != "")
07313     {
07314         // this is when some -tag= argument was used.
07315       if (tag_debug) cerr << "set_standard_macro0.1> current_tag=" << Me.m_current_tag << endl;
07316     }
07317   else if (Symbol::is_selected ("CMTCONFIG"))
07318     {
07319         // This is when CMTCONFIG has been set from some requirements file
07320       Symbol* macro = Symbol::find ("CMTCONFIG");
07321       if (macro != 0)
07322         {
07323           Me.m_current_tag = macro->build_macro_value ();
07324           if (tag_debug) cerr << "set_standard_macro1> current_tag=" << Me.m_current_tag << endl;
07325         }
07326     }
07327   else
07328     {
07329         // this is when no -tag= argument was used.
07330       if (tag_debug) cerr << "set_standard_macro(before2)> current_tag=" << Me.m_current_tag << endl;
07331       if (current_use.get_package_name () == "CMT")
07332         {
07333           Me.m_current_tag = CmtSystem::getenv ("CMTBIN");
07334         }
07335       else
07336         {
07337           Me.m_current_tag = CmtSystem::getenv ("CMTCONFIG");
07338         }
07339 
07340       if (tag_debug) cerr << "set_standard_macro2> current_tag=" << Me.m_current_tag << endl;
07341     }
07342 
07343   if (Me.m_debug)
07344     {
07345       cout << "set_standard_macro3>" << endl;
07346     }
07347 
07348   StandardMacroBuilder builder (Me.m_current_tag,
07349                                 Me.m_current_package,
07350                                 Me.m_current_version,
07351                                 Me.m_current_prefix,
07352                                 Me.m_current_style);
07353 
07354 
07355     //
07356     //  Definitions for installation area mechanisms
07357     //
07358   /*
07359   if (get_strategy ("InstallArea"))
07360     {
07361       CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
07362 
07363       //cout << "#IA6>" << endl;
07364 
07365       ia_mgr.setup_current_installarea ();
07366     }
07367   */
07368 
07369   builder.fill_for_current_package (Me.m_current_dir);
07370 
07371   builder.fill_for_branches ();
07372   builder.fill_for_project ();
07373 
07374   builder.fill_for_install_area ();
07375 
07376   builder.fill_for_use_requirements ();
07377   builder.fill_for_use_includes ();
07378   builder.fill_for_use_fincludes ();
07379   builder.fill_for_use_stamps ();
07380   builder.fill_for_use_cflags ();
07381   builder.fill_for_use_pp_cflags ();
07382   builder.fill_for_use_cppflags ();
07383   builder.fill_for_use_pp_cppflags ();
07384   builder.fill_for_use_fflags ();
07385   builder.fill_for_use_pp_fflags ();
07386   builder.fill_for_use_linkopts ();
07387   builder.fill_for_use_libraries ();
07388   builder.fill_for_includes ();
07389   builder.fill_for_fincludes ();
07390   builder.fill_for_all_constituents ();
07391   builder.fill_for_constituent_macros ();
07392 }

void Cmt::use_cmt  )  [static]
 

Definition at line 7405 of file cmt_parser.cxx.

References Use::add(), CmtContext::m_cmt_version, CmtContext::m_current_package, CmtContext::m_debug, CmtContext::m_default_path, CmtContext::m_recursive, Me, cmt_string::size(), and UseRef.

Referenced by load(), and parser().

07406 {
07407   UseRef use;
07408   bool recursive_copy = Me.m_recursive;
07409   bool debug_copy = Me.m_debug;
07410 
07411   if (Me.m_default_path.size () <= 0) return;
07412   if (Me.m_current_package == "CMT") return;
07413 
07414   Me.m_recursive = true;
07415   Me.m_debug = false;
07416   use = Use::add (Me.m_default_path, "CMT", Me.m_cmt_version, "", "", 0);
07417   Me.m_recursive = recursive_copy;
07418   Me.m_debug = debug_copy;
07419 }

void Cmt::use_home_requirements  )  [static]
 

Definition at line 7422 of file cmt_parser.cxx.

References CmtContext::m_cmt_home, Me, and use_special_requirements().

Referenced by parser().

07423 {
07424   use_special_requirements (Me.m_cmt_home, 
07425                             CmtSystem::get_home_package (), 
07426                             "requirements");
07427 }

void Cmt::use_special_requirements const cmt_string path,
const cmt_string name,
const cmt_string file_name
[static]
 

Definition at line 7438 of file cmt_parser.cxx.

References Use::add(), CmtSystem::file_separator(), CmtContext::m_cmt_user_context, CmtContext::m_current_package, CmtContext::m_default_path, CmtContext::m_recursive, Me, SyntaxParser::parse_requirements(), cmt_string::size(), and UseRef.

Referenced by use_home_requirements(), and use_user_context_requirements().

07441 {
07442   if (path == "") 
07443     {
07444       return;
07445     }
07446 
07447   UseRef use;
07448   bool recursive_copy = Me.m_recursive;
07449 
07450   if (Me.m_default_path.size () <= 0) return;
07451   if (Me.m_current_package == "CMT") return;
07452 
07453   Me.m_recursive = true;
07454 
07455   use = Use::add (path, name, "v0", "", "", 0);
07456 
07457   cmt_string f = Me.m_cmt_user_context;
07458   f += CmtSystem::file_separator ();
07459   f += file_name;
07460   SyntaxParser::parse_requirements (f, use);
07461 
07462   Me.m_recursive = recursive_copy;
07463 }

void Cmt::use_user_context_requirements  )  [static]
 

Definition at line 7430 of file cmt_parser.cxx.

References CmtContext::m_cmt_user_context, Me, and use_special_requirements().

Referenced by parser().

07431 {
07432   use_special_requirements (Me.m_cmt_user_context, 
07433                             CmtSystem::get_user_context_package (), 
07434                             "requirements");
07435 }

void Cmt::vector_to_string const CmtSystem::cmt_string_vector v,
const cmt_string separator,
cmt_string result
[static]
 

Definition at line 7466 of file cmt_parser.cxx.

References CmtSystem::cmt_string_vector, cmt_string::erase(), and cmt_vector< T >::size().

07469 {
07470   result.erase (0);
07471 
07472   for (int i = 0; i < v.size (); i++)
07473     {
07474       const cmt_string& s = v[i];
07475       if (s == "") continue;
07476 
07477       if (i > 0) result += separator;
07478       result += v[i];
07479     }
07480 }

cmt_string Cmt::vector_to_string const CmtSystem::cmt_string_vector v  )  [static]
 

Definition at line 7483 of file cmt_parser.cxx.

References CmtSystem::cmt_string_vector.

Referenced by PathBuilder::build(), and PathBuilder::clean().

07484 {
07485   cmt_string result;
07486 
07487   vector_to_string (v, " ", result);
07488 
07489   return (result);
07490 }


The documentation for this class was generated from the following files:
Generated on Mon May 2 10:25:27 2005 for CMT by doxygen 1.3.5