Main Page ? Class Hierarchy ? Compound List ? File List ? Compound Members ? File Members ?

Cmt Class Reference

#include

Collaboration diagram for Cmt:

[legend]
List of all members.

Static Public Methods

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 ()
? Now try with ${HOME}/.cmtrc with "mount_filter" keyword.

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 CmtSystem::cmt_string_vector &arguments)
void? do_broadcast (const CmtSystem::cmt_string_vector &arguments, int argc, char *argv[])
void? do_build_constituent_makefile (const CmtSystem::cmt_string_vector &arguments, int argc, char *argv[])
void? do_build_constituents_makefile (const CmtSystem::cmt_string_vector &arguments, int argc, char *argv[])
void? do_build_dependencies (const CmtSystem::cmt_string_vector &arguments, int argc, char *argv[])
void? do_build_library_links ()
void? do_build_make_setup ()
void? do_build_msdev (const CmtSystem::cmt_string_vector &arguments)
void? do_build_CMT_pacman ()
void? do_build_vsnet (const CmtSystem::cmt_string_vector &arguments)
void? do_build_os9_makefile (const CmtSystem::cmt_string_vector &arguments)
void? do_build_prototype (const CmtSystem::cmt_string_vector &arguments)
void? do_build_readme (const CmtSystem::cmt_string_vector &arguments)
void? do_build_tag_makefile ()
void? do_build_temporary_name ()
void? do_build_triggers (const CmtSystem::cmt_string_vector &arguments)
void? do_build_windefs (const CmtSystem::cmt_string_vector &arguments)
void? do_check_configuration ()
void? do_check_files (const CmtSystem::cmt_string_vector &arguments)
void? do_check_version (const CmtSystem::cmt_string_vector &arguments)
void? do_checkout (const CmtSystem::cmt_string_vector &arguments)
void? do_cleanup (PrintMode &mode)
void? do_config ()
void? do_create (const CmtSystem::cmt_string_vector &arguments)
void? do_create_project (const CmtSystem::cmt_string_vector &arguments)
void? do_cvsbranches (const CmtSystem::cmt_string_vector &arguments)
void? do_cvssubpackages (const CmtSystem::cmt_string_vector &arguments)
void? do_cvstags (const CmtSystem::cmt_string_vector &arguments)
void? do_do (const CmtSystem::cmt_string_vector &arguments)
void? do_expand_model (const CmtSystem::cmt_string_vector &arguments)
void? do_filter (const CmtSystem::cmt_string_vector &arguments)
? Handle free filtering of text files containing or ${xxx} patterns.

void? do_help (ActionType help_action=action_none)
void? do_lock (const cmt_string &package, const cmt_string &version, const cmt_string &path)
void? do_remove (const cmt_string &package, const cmt_string &version, const cmt_string &path)
void? do_remove_library_links ()
void? do_run (const CmtSystem::cmt_string_vector &arguments)
? Here we expect that only the base name of the library is given : ie it should not contain the "lib" prefix, nor the suffix .so, nor any path prefix.

void? do_run_sequence (const CmtSystem::cmt_string_vector &arguments)
void? do_set_version (const CmtSystem::cmt_string_vector &arguments)
void? do_set_versions (const CmtSystem::cmt_string_vector &arguments)
void? do_setup (PrintMode &mode)
void? do_show_action (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_action_names (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_action_value (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_actions (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_all_tags ()
void? do_show_applied_patterns ()
void? do_show_author ()
void? do_show_branches (PrintMode &mode)
void? do_show_clients (const CmtSystem::cmt_string_vector &arguments)
void? do_show_cmtpath_patterns ()
void? do_show_constituent (const CmtSystem::cmt_string_vector &arguments)
void? do_show_constituent_names ()
void? do_show_constituents ()
void? do_show_cycles ()
void? do_show_fragment (const CmtSystem::cmt_string_vector &arguments)
void? do_show_fragments ()
void? do_show_groups ()
void? do_show_include_dirs ()
void? do_show_language (const CmtSystem::cmt_string_vector &arguments)
void? do_show_languages ()
void? do_show_macro (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_macro_names (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_macro_value (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_macros (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_manager ()
void? do_show_packages (const CmtSystem::cmt_string_vector &arguments)
void? do_show_path ()
void? do_show_pattern (const CmtSystem::cmt_string_vector &arguments)
void? do_show_pattern_names ()
void? do_show_patterns ()
void? do_show_projects ()
void? do_show_pwd ()
void? do_show_setup ()
void? do_show_set (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_set_names (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_set_value (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_sets (const CmtSystem::cmt_string_vector &arguments, PrintMode &mode)
void? do_show_strategies ()
void? do_show_tags ()
void? do_show_use_paths (const CmtSystem::cmt_string_vector &arguments)
void? do_show_uses ()
void? do_show_version ()
void? do_show_versions (const CmtSystem::cmt_string_vector &arguments)
void? do_show_system ()
void? do_unlock (const cmt_string &package, const cmt_string &version, const cmt_string &path)
void? do_version ()
const cmt_string &? filter_dir (const cmt_string &dir)
ActionType? get_action ()
const cmt_string &? get_cmt_home ()
const cmt_string &? get_cmt_user_context ()
const cmt_string &? get_cmt_version ()
const cmt_string &? get_current_dir ()
const cmt_string &? get_current_package ()
const cmt_string &? get_current_cmtpath ()
const cmt_string &? get_current_offset ()
AccessMode? get_current_access ()
int? get_current_build_strategy ()
int? get_current_setup_strategy ()
CmtStructuringStyle? get_current_structuring_style ()
CmtDirStyle? get_current_style ()
const cmt_string &? get_current_version ()
const cmt_string &? get_current_target ()
bool? get_debug ()
bool? get_quiet ()
bool? get_recursive ()
CmtScopeFilteringMode? get_scope_filtering_mode ()
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 ()
? See reach_current_package for an explanation of this call.

void? parse_arguments (int argc, char *argv[], CmtSystem::cmt_string_vector &arguments, cmt_string &extra_line, cmt_string &extra_file, PrintMode &mode)
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_current_build_strategy (int strategy)
void? set_current_setup_strategy (int strategy)
void? set_scope_filtering_mode (CmtScopeFilteringMode mode)
void? set_standard_macros ()
void? use_cmt ()
? Macros implied or required to manage constituents.

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)

Static Private Attributes

ActionType? m_action
? All Attributes are private.

ActionType? m_help_action
bool? m_build_nmake
cmt_string? m_cmt_config
cmt_string? m_cmt_root
cmt_string? m_cmt_home
cmt_string? m_cmt_user_context
cmt_string? m_cmt_site
cmt_string? m_cmt_version
int? m_current_build_strategy = DefaultBuildStrategy
int? m_current_setup_strategy = DefaultSetupStrategy
cmt_string? m_current_dir
cmt_string? m_current_package
cmt_string? m_current_config
cmt_string? m_current_path
cmt_string? m_current_prefix
cmt_string? m_current_cmtpath
cmt_string? m_current_offset
AccessMode? m_current_access = UserMode
CmtDirStyle? m_current_style = cmt_style
CmtStructuringStyle? m_current_structuring_style = with_version_directory
cmt_string? m_current_tag
cmt_string? m_current_target
cmt_string? m_current_version
cmt_string? m_extra_tags
cmt_string? m_configure_error
bool? m_debug
cmt_string? m_default_path
bool? m_quiet
bool? m_recursive
CmtScopeFilteringMode? m_scope_filtering_mode
bool? m_simulation
bool? m_standard_macros_done

Member Function Documentation

void Cmt::build_config (? const cmt_string &? ? prefix,
cmt_string &? ? config
)? [static]
?

Append "CONFIG" to the prefix.

Definition at line 374 of file cmt_parser.cxx.

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

00376 {
00377   /*
00378     Building the config from  
00379   */
00380 
00381   config = prefix;
00382   config += "CONFIG";
00383 }

void Cmt::build_makefile (? const cmt_string &? ? target )? [static]
?

Definition at line 386 of file cmt_parser.cxx.

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

Referenced by build_OS9_makefile().

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

void Cmt::build_msdev_file (? const cmt_string &? ? target )? [static]
?

Definition at line 411 of file cmt_parser.cxx.

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

Referenced by do_build_msdev().

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

bool Cmt::build_nmake (? ? )? [static]
?

Definition at line 467 of file cmt_parser.cxx.

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

00468 {
00469   return (m_build_nmake);
00470 }

void Cmt::build_OS9_makefile (? const cmt_string &? ? target )? [static]
?

Definition at line 473 of file cmt_parser.cxx.

References build_makefile().

Referenced by do_build_os9_makefile().

00474 {
00475   build_makefile (target);
00476 }

void Cmt::build_prefix (? const cmt_string &? ? package,
cmt_string &? ? prefix
)? [static]
?

Convert a package name to its upper case copy.

Definition at line 481 of file cmt_parser.cxx.

References cmt_string::size().

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

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

void Cmt::build_vsnet_file (? const cmt_string &? ? target )? [static]
?

Visual Studio.net Support.

Definition at line 440 of file cmt_parser.cxx.

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

Referenced by do_build_vsnet().

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

void Cmt::clear (? ? )? [static]
?

Definition at line 500 of file cmt_parser.cxx.

References action_none, CmtError::clear(), Database::clear(), Script::clear_all(), Include::clear_all(), default_filtering_mode, DefaultBuildStrategy, DefaultSetupStrategy, DeveloperMode, m_action, m_build_nmake, m_cmt_config, m_cmt_root, m_cmt_version, m_current_access, m_current_build_strategy, m_current_cmtpath, m_current_config, m_current_dir, m_current_offset, m_current_package, m_current_path, m_current_prefix, m_current_setup_strategy, m_current_tag, m_current_target, m_current_version, m_default_path, m_help_action, m_quiet, m_recursive, m_scope_filtering_mode, m_simulation, and m_standard_macros_done.

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

00501 {
00502   m_action         = action_none;
00503   m_help_action    = action_none;
00504   m_build_nmake    = false;
00505   m_cmt_config     = "";
00506   //m_cmt_path.clear ();
00507   //m_cmt_path_pwds.clear ();
00508   //m_cmt_path_sources.clear ();
00509   m_cmt_root       = "";
00510   m_cmt_version    = "";
00511   m_current_build_strategy = DefaultBuildStrategy;
00512   m_current_setup_strategy = DefaultSetupStrategy;
00513   m_current_dir     = "";
00514   m_current_package = "";
00515   m_current_config  = "";
00516   m_current_path    = "";
00517   m_current_prefix  = "";
00518   m_current_cmtpath = "";
00519   m_current_offset  = "";
00520 
00521   m_current_access   = DeveloperMode;
00522 
00523   m_current_tag      = "";
00524   m_current_target   = "";
00525   m_current_version  = "";
00526   m_default_path     = "";
00527   m_quiet            = false;
00528   m_recursive        = false;
00529 
00530   m_scope_filtering_mode = default_filtering_mode;
00531   m_simulation       = false;
00532 
00533   m_standard_macros_done = false;
00534 
00535   Database::clear ();
00536   Include::clear_all ();
00537   Script::clear_all ();
00538   CmtError::clear ();
00539 }

void Cmt::configure (? ? )? [static]
?

Definition at line 542 of file cmt_parser.cxx.

References Use::change_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(), CmtError::has_pending_error(), m_cmt_version, m_configure_error, m_current_cmtpath, m_current_config, m_current_dir, m_current_offset, m_current_package, m_current_path, m_current_prefix, m_current_style, m_current_tag, m_current_version, m_debug, m_default_path, Use::set(), and Use::style.

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

00543 {
00544   static bool configured = false;
00545 
00546   if (configured) return;
00547 
00548   m_cmt_version   = "";
00549   m_current_dir     = "";
00550   m_current_package = "";
00551   m_current_prefix  = "";
00552   m_current_config  = "";
00553   m_current_path    = "";
00554   m_current_cmtpath = "";
00555   m_current_offset  = "";
00556 
00557   m_current_tag     = "";
00558   m_current_version = "";
00559 
00560   m_configure_error = "";
00561 
00562   m_debug = false;
00563   if (getenv ("CMTDEBUG") != 0) m_debug = true;
00564 
00565   m_default_path    = "";
00566 
00567   configure_default_path ();
00568   configure_version_tag ();
00569   configure_uname_tag ();
00570   configure_hosttype_tag ();
00571   configure_config_tag ();
00572   configure_site_tag (0);
00573   configure_home (0);
00574   configure_current_dir ();
00575   configure_current_package ();
00576   configure_current_structuring_style ();
00577 
00578   Use& use = Use::current();
00579 
00580   use.set (m_current_package,
00581            m_current_version,
00582            m_current_path,
00583            "",
00584            "");
00585 
00586   use.style = m_current_style;
00587 
00588   use.change_path (m_current_path);
00589 
00590   if (CmtError::has_pending_error ()) 
00591     {
00592       m_configure_error = CmtError::get_last_error ();
00593     }
00594 }

void Cmt::configure_cmt_path (? Use *? ? use )? [static]
?

Definition at line 597 of file cmt_parser.cxx.

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

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

00598 {
00599   cmt_string s;
00600 
00601   Symbol* symbol = Symbol::find ("CMTPATH");
00602   if (symbol != 0)
00603     {
00604       bool show_set_hidden = false;
00605 
00606       if (Cmt::m_action == action_show_set)
00607         {
00608           show_set_hidden = true;
00609           Cmt::m_action = action_none;
00610         }
00611 
00612       s = symbol->build_macro_value ();
00613       Symbol::expand (s);
00614 
00615       if (show_set_hidden)
00616         {
00617           show_set_hidden = false;
00618           Cmt::m_action = action_show_set;
00619         }
00620     }
00621 
00622   IProjectFactory& factory = ProjectFactory::instance ();
00623   factory.reset ();
00624 
00625   CmtSystem::get_cmt_paths (factory, s);
00626   if (m_cmt_user_context != "") factory.create_project (m_cmt_user_context, "CMTUSERCONTEXT");
00627   if (m_cmt_home != "") factory.create_project (m_cmt_home, "CMTHOME");
00628 }

void Cmt::configure_config_tag (? ? )? [static]
?

Definition at line 631 of file cmt_parser.cxx.

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

Referenced by configure(), and parse_arguments().

00632 {
00633   m_cmt_config = CmtSystem::get_cmt_config ();
00634   if (m_cmt_config != "")
00635     {
00636       Tag* tag;
00637 
00638       tag = Tag::add (m_cmt_config, PriorityConfig, "CMTCONFIG", 0);
00639       tag->mark ();
00640     }
00641 }

void Cmt::configure_current_cmtpath (? ? )? [static]
?

Definition at line 644 of file cmt_parser.cxx.

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

Referenced by StandardMacroBuilder::fill_for_branches().

00645 {
00646   Use& current_use = Use::current ();
00647 
00648   m_current_cmtpath = "";
00649   m_current_offset = "";
00650 
00651   m_current_cmtpath = Project::find_in_cmt_paths (current_use.path);
00652 
00653   if (m_current_cmtpath != "")
00654     {
00655       static const cmt_string empty_string;
00656       static const cmt_string fs = CmtSystem::file_separator ();
00657 
00658       m_current_offset = current_use.path;
00659 
00666       m_current_offset.replace (m_current_cmtpath, empty_string);
00667       if (m_current_offset[0] == CmtSystem::file_separator ())
00668         {
00669           // Just in case there is a part left after removing the cmtpath entry
00670           
00671           m_current_offset.replace (fs, empty_string);
00672         }
00673     }
00674 }

void Cmt::configure_current_dir (? ? )? [static]
?

Definition at line 756 of file cmt_parser.cxx.

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

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

00757 {
00758   cmt_string file_name;
00759 
00760   /*
00761     Building current_dir :
00762 
00763     o we first get the physical value (using getwd)
00764     o then this value is possibly filtered using the
00765     cmt_mount_filter file.
00766   */
00767 
00768   CmtMountFilterParser mount_filter;
00769 
00775   file_name = m_default_path;
00776   if (file_name != "")
00777     {
00778       file_name += CmtSystem::file_separator ();
00779       file_name += "CMT";
00780       file_name += CmtSystem::file_separator ();
00781       file_name += m_cmt_version;
00782       file_name += CmtSystem::file_separator ();
00783       file_name += "mgr";
00784       file_name += CmtSystem::file_separator ();
00785     }
00786 
00787   file_name += "cmt_mount_filter";
00788 
00789   mount_filter.run (file_name);
00790 
00796   mount_filter.set_prefix ("mount_filter");
00797 
00798   mount_filter.run (".cmtrc");
00799 
00805   if (CmtSystem::get_home_directory (file_name))
00806     {
00807       file_name += CmtSystem::file_separator ();
00808       file_name += ".cmtrc";
00809       mount_filter.run (file_name);
00810     }
00811 
00812   m_current_dir = mount_filter.get_current_dir ();
00813 }

void Cmt::configure_current_package (? ? )? [static]
?

Now try with ${HOME}/.cmtrc with "mount_filter" keyword.

Definition at line 816 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(), m_current_config, m_current_dir, m_current_package, m_current_path, m_current_prefix, m_current_style, m_current_version, mgr_style, no_version_style, none_style, cmt_string::npos, CmtSystem::pwd(), cmt_string::read(), and CmtSystem::test_file().

Referenced by configure(), and do_config().

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

void Cmt::configure_current_structuring_style (? ? )? [static]
?

Definition at line 948 of file cmt_parser.cxx.

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

Referenced by configure().

00949 {
00950   cmt_string s;
00951 
00952   s = CmtSystem::getenv ("CMTSTRUCTURINGSTYLE");
00953   if (s == "without_version_directory")
00954     {
00955       m_current_structuring_style = without_version_directory;
00956     }
00957 }

void Cmt::configure_default_path (? ? )? [static]
?

Definition at line 960 of file cmt_parser.cxx.

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

Referenced by configure().

void Cmt::configure_home (? Use *? ? use )? [static]
?

Definition at line 972 of file cmt_parser.cxx.

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

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

00973 {
00974   m_cmt_home = "";
00975 
00976   Symbol* symbol = Symbol::find ("CMTHOME");
00977   if (symbol != 0)
00978     {
00979       m_cmt_home = symbol->build_macro_value ();
00980       Symbol::expand (m_cmt_home);
00981     }
00982   else if (CmtSystem::testenv ("CMTHOME"))
00983     {
00984       m_cmt_home = CmtSystem::getenv ("CMTHOME");
00985     }
00986 
00987   if ((m_cmt_home != "") && !CmtSystem::test_directory (m_cmt_home))
00988     {
00989       m_cmt_home = "";
00990     }
00991 
00992   configure_user_context (0);
00993 }

void Cmt::configure_hosttype_tag (? ? )? [static]
?

Definition at line 1022 of file cmt_parser.cxx.

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

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

01023 {
01024   cmt_string hosttype;
01025 
01026   CmtSystem::get_hosttype (hosttype);
01027 
01028   if (hosttype != "")
01029     {
01030       Tag* tag;
01031 
01032       tag = Tag::add (hosttype, PriorityUname, "HOSTTYPE", 0);
01033       tag->mark ();
01034     }
01035 }

void Cmt::configure_site_tag (? Use *? ? use )? [static]
?

Definition at line 1038 of file cmt_parser.cxx.

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

Referenced by Symbol::action(), configure(), load(), and parse_arguments().

01039 {
01040   Symbol* symbol = Symbol::find ("CMTSITE");
01041   if (symbol != 0)
01042     {
01043       m_cmt_site = symbol->build_macro_value ();
01044       Symbol::expand (m_cmt_site);
01045     }
01046   else
01047     {
01048       m_cmt_site = CmtSystem::get_cmt_site ();
01049     }
01050 
01051   if (m_cmt_site != "")
01052     {
01053       cmt_string s = "CMTSITE";
01054 
01055       if (use != 0)
01056         {
01057           s += " in ";
01058         }
01059 
01060       Tag* tag;
01061 
01062       tag = Tag::add (m_cmt_site, PrioritySite, s, use);
01063       tag->mark ();
01064     }
01065 }

void Cmt::configure_tags (? Use *? ? use )? [static]
?

Definition at line 1111 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, m_action, m_current_tag, Tag::mark(), PriorityConfig, and CmtSystem::testenv().

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

01112 {
01113   cmt_string config_tag;
01114 
01115   Log;
01116 
01117   //if (m_debug) cout << "configure_tags0> current_tag=" << m_current_tag << endl;
01118 
01119   log << "current_tag=" << m_current_tag << log_endl;
01120 
01121   Symbol* symbol = Symbol::find ("CMTCONFIG");
01122   if (symbol != 0)
01123     {
01124       bool show_set_hidden = false;
01125 
01126       if (Cmt::m_action == action_show_set)
01127         {
01128           show_set_hidden = true;
01129           Cmt::m_action = action_none;
01130         }
01131 
01132       config_tag = symbol->build_macro_value ();
01133       Symbol::expand (config_tag);
01134 
01135       if (show_set_hidden)
01136         {
01137           show_set_hidden = false;
01138           Cmt::m_action = action_show_set;
01139         }
01140     }
01141   else if (CmtSystem::testenv ("CMTCONFIG"))
01142     {
01143       config_tag = CmtSystem::getenv ("CMTCONFIG");
01144     }
01145   else if (CmtSystem::testenv ("CMTBIN"))
01146     {
01147       config_tag = CmtSystem::getenv ("CMTBIN");
01148     }
01149 
01150   if (config_tag == "")
01151     {
01152       CmtSystem::get_uname (config_tag);
01153     }
01154 
01155   //if (m_debug) cout << "configure_tags> current_tag=" << m_current_tag << endl;
01156   log << "current_tag=" << m_current_tag << log_endl;
01157 
01158   cmt_string s = "CMTCONFIG";
01159 
01160   if (use != 0)
01161     {
01162       s += " in ";
01163     }
01164 
01165   Tag* tag;
01166 
01167   tag = Tag::add (config_tag, PriorityConfig, s, use);
01168   tag->mark ();
01169 
01170     //m_current_tag = config_tag;
01171 }

void Cmt::configure_uname_tag (? ? )? [static]
?

Definition at line 1174 of file cmt_parser.cxx.

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

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

01175 {
01176   cmt_string uname;
01177 
01178   CmtSystem::get_uname (uname);
01179 
01180   if (uname != "")
01181     {
01182       Tag* tag;
01183 
01184       tag = Tag::add (uname, PriorityUname, "uname", 0);
01185       tag->mark ();
01186     }
01187 }

void Cmt::configure_user_context (? Use *? ? use )? [static]
?

Definition at line 996 of file cmt_parser.cxx.

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

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

00997 {
00998   m_cmt_user_context = "";
00999 
01000   Symbol* symbol = Symbol::find ("CMTUSERCONTEXT");
01001   if (symbol != 0)
01002     {
01003       m_cmt_user_context = symbol->build_macro_value ();
01004       Symbol::expand (m_cmt_user_context);
01005     }
01006   else if (CmtSystem::testenv ("CMTUSERCONTEXT"))
01007     {
01008       m_cmt_user_context = CmtSystem::getenv ("CMTUSERCONTEXT");
01009     }
01010 
01011   if ((m_cmt_user_context != "") && !CmtSystem::test_directory (m_cmt_user_context))
01012     {
01013       m_cmt_user_context = "";
01014     }
01015 
01016   if (m_debug) cout << "configure_user_context> user_context=" << m_cmt_user_context << endl;
01017 
01018   configure_cmt_path (0);
01019 }

void Cmt::configure_version_tag (? ? )? [static]
?

Definition at line 1190 of file cmt_parser.cxx.

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

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

01191 {
01192   int v = 0;
01193   int r = 0;
01194   int p = 0;
01195 
01196   CmtSystem::is_version_directory (CMTVERSION, v, r, p);
01197 
01198   Tag* tag;
01199 
01200   static char temp[80];
01201 
01202   sprintf (temp, "CMTv%d", v);
01203 
01204   tag = Tag::add (temp, PriorityVersion, "CMTVERSION", 0);
01205   tag->mark ();
01206 
01207   sprintf (temp, "CMTr%d", r);
01208 
01209   tag = Tag::add (temp, PriorityVersion, "CMTVERSION", 0);
01210   tag->mark ();
01211 
01212   sprintf (temp, "CMTp%d", p);
01213 
01214   tag = Tag::add (temp, PriorityVersion, "CMTVERSION", 0);
01215   tag->mark ();
01216 
01217 }

void Cmt::do_awk (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1236 of file cmt_parser.cxx.

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

Referenced by parser().

01237 {
01238   if (arguments.size () < 1)
01239     {
01240       cerr << "#CMT> cmt awk  " << endl;
01241       return;
01242     }
01243 
01244   const cmt_string& file = arguments[0];
01245   const cmt_string& pattern = arguments[1];
01246   cmt_string text;
01247 
01248   text.read (file);
01249 
01250   static AwkActor a;
01251 
01252   cmt_regexp exp (pattern);
01253 
01254   a.run (text, exp);
01255 }

void Cmt::do_broadcast (? const CmtSystem::cmt_string_vector &? ? arguments,
int? ? argc,
char *? ? argv[]
)? [static]
?

Definition at line 1258 of file cmt_parser.cxx.

References cmt_vector< cmt_string >::add(), Symbol::all_set(), CmtSystem::basename(), cmt_string::c_str(), CmtSystem::cd(), CmtLock::check(), cmt_vector< cmt_string >::clear(), Use::current(), CmtSystem::dirname(), Use::discarded, cmt_string::erase(), CmtSystem::execute(), CmtError::execution_error, 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(), CmtLock::locked_by_another_user, m_quiet, mgr_style, cmt_string::npos, parser(), Use::path, CmtSystem::pwd(), cmt_string::replace(), cmt_string::replace_all(), Project::scan_paths(), CmtError::set(), cmt_vector< Use * >::size(), cmt_string::size(), cmt_vector< cmt_string >::size(), CmtSystem::split(), Use::style, cmt_string::substr(), and Use::version.

Referenced by do_set_versions(), and parser().

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

void Cmt::do_build_CMT_pacman (? ? )? [static]
?

Definition at line 1853 of file cmt_parser.cxx.

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

Referenced by parser().

01854 {
01855   cmt_string pacman_file;
01856 
01857   pacman_file = m_cmt_root;
01858   pacman_file += CmtSystem::file_separator ();
01859   pacman_file += "mgr";
01860   pacman_file += CmtSystem::file_separator ();
01861   pacman_file += "CMT.pacman";
01862 
01863   cmt_string pacman;
01864   cmt_string pattern = "";
01865   cmt_string replacement = CMTVERSION;
01866 
01867   pacman.read (pacman_file);
01868 
01869   pacman.replace_all (pattern, replacement);
01870 
01871   cout << pacman << endl;
01872 }

void Cmt::do_build_constituent_makefile (? const CmtSystem::cmt_string_vector &? ? arguments,
int? ? argc,
char *? ? argv[]
)? [static]
?

Definition at line 1664 of file cmt_parser.cxx.

References Generator::build_constituent_makefile(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

01667 {
01668   if (CmtLock::check () == CmtLock::locked_by_another_user)
01669     {
01670       CmtError::set (CmtError::conflicting_lock, "build_constituent_makefile>");
01671       return;
01672     }
01673   if (arguments.size () > 0) 
01674     {
01675       set_standard_macros ();
01676       Generator::build_constituent_makefile (arguments[0]);
01677     }
01678 }

void Cmt::do_build_constituents_makefile (? const CmtSystem::cmt_string_vector &? ? arguments,
int? ? argc,
char *? ? argv[]
)? [static]
?

Definition at line 1681 of file cmt_parser.cxx.

References Generator::build_constituents_makefile(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, m_current_package, CmtError::set(), and set_standard_macros().

Referenced by parser().

01684 {
01685   if (CmtLock::check () == CmtLock::locked_by_another_user)
01686     {
01687       CmtError::set (CmtError::conflicting_lock, "build_constituents_makefile>");
01688       return;
01689     }
01690   set_standard_macros ();
01691 
01692   Generator::build_constituents_makefile (m_current_package, arguments);
01693 }

void Cmt::do_build_dependencies (? const CmtSystem::cmt_string_vector &? ? arguments,
int? ? argc,
char *? ? argv[]
)? [static]
?

Definition at line 1696 of file cmt_parser.cxx.

References Generator::build_dependencies(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

01699 {
01700   if (CmtLock::check () == CmtLock::locked_by_another_user)
01701     {
01702       CmtError::set (CmtError::conflicting_lock, "build_dependencies>");
01703       return;
01704     }
01705   if (arguments.size () > 0)
01706     {
01707       set_standard_macros ();
01708 
01709       while (argc > 0)
01710         {
01711           if (strcmp (argv[0], "dependencies") != 0)
01712             {
01713               argc--;
01714               argv++;
01715             }
01716           else
01717             {
01718               argc--;
01719               argv++;
01720               argc--;
01721               argv++;
01722 
01723               Generator::build_dependencies (arguments[0], argc, argv);
01724 
01725               break;
01726             }
01727         }
01728     }
01729 }

void Cmt::do_build_library_links (? ? )? [static]
?

Definition at line 1732 of file cmt_parser.cxx.

References Use::build_library_links(), Symbol::build_macro_value(), CmtLock::check(), CmtError::conflicting_lock, Use::current(), Use::discarded, Symbol::expand(), CmtSystem::file_separator(), Symbol::find(), get_build_strategy(), CmtInstallAreaMgr::get_installarea(), Use::get_ordered_uses(), Use::get_package_name(), InstallAreaMask, CmtInstallAreaMgr::instance(), CmtLock::locked_by_another_user, CmtSystem::mkdir(), CmtError::set(), set_standard_macros(), cmt_vector< Use * >::size(), and WithInstallArea.

Referenced by parser().

01733 {
01734   cmt_string cmtinstallarea = "";
01735   cmt_string tag = "";
01736   cmt_string shlibsuffix;
01737   cmt_string symlinkcmd;
01738 
01739   if (CmtLock::check () == CmtLock::locked_by_another_user)
01740     {
01741       CmtError::set (CmtError::conflicting_lock, "build_library_links>");
01742       return;
01743     }
01744 
01745   set_standard_macros ();
01746 
01747   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
01748   Use& current_use = Use::current ();
01749   int i;
01750 
01751   {
01752     Symbol* macro = Symbol::find ("shlibsuffix");
01753     if (macro == 0) return;
01754     shlibsuffix = macro->build_macro_value ();
01755     Symbol::expand (shlibsuffix);
01756   }
01757 
01758   {
01759     Symbol* macro = Symbol::find ("cmt_symlink_command");
01760     if (macro != 0)
01761       {
01762         symlinkcmd = macro->build_macro_value ();
01763         Symbol::expand (symlinkcmd);
01764       }
01765   }
01766 
01767   if ((get_build_strategy () & InstallAreaMask) == WithInstallArea)
01768     {
01769       const CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
01770 
01771       //cout << "#IA2>" << endl;
01772       
01773       cmt_string s1 = ia_mgr.get_installarea ();
01774 
01775       {
01776         Symbol* symbol = Symbol::find ("CMTINSTALLAREA");
01777         if (symbol != 0)
01778           {
01779             s1 = symbol->build_macro_value ();
01780             Symbol::expand (s1);
01781           }
01782       }
01783 
01784       cmtinstallarea = s1;
01785                   
01786       cmt_string s2;
01787 
01788       {
01789         Symbol* macro = Symbol::find ("tag");
01790         if (macro != 0)
01791           {
01792             s2 = macro->build_macro_value ();
01793             Symbol::expand (s2);
01794           }
01795       }
01796 
01797       tag = s2;
01798 
01799       cmt_string s = s1;
01800       s += CmtSystem::file_separator ();
01801       s += s2;
01802       s += CmtSystem::file_separator ();
01803       s += "lib";
01804 
01805       CmtSystem::mkdir (s);
01806     }
01807 
01808   current_use.build_library_links (cmtinstallarea, tag, shlibsuffix, symlinkcmd);
01809 
01810   for (i = 0; i < Uses.size (); i++)
01811     {
01812       Use* use = Uses[i];
01813 
01814       if (use == 0) continue;
01815       if (use->discarded) continue;
01816 
01817       if (use->get_package_name () == "CMT") continue;
01818       if (use->get_package_name () == current_use.get_package_name ()) continue;
01819 
01820       use->build_library_links (cmtinstallarea, tag, shlibsuffix, symlinkcmd);
01821     }
01822 }

void Cmt::do_build_make_setup (? ? )? [static]
?

Definition at line 1825 of file cmt_parser.cxx.

References Generator::build_make_setup(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, m_current_package, CmtError::set(), and set_standard_macros().

Referenced by parser().

01826 {
01827   if (CmtLock::check () == CmtLock::locked_by_another_user)
01828     {
01829       CmtError::set (CmtError::conflicting_lock, "build_make_setup>");
01830       return;
01831     }
01832   set_standard_macros ();
01833   Generator::build_make_setup (m_current_package);
01834 }

void Cmt::do_build_msdev (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1837 of file cmt_parser.cxx.

References build_msdev_file(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

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

void Cmt::do_build_os9_makefile (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1893 of file cmt_parser.cxx.

References build_OS9_makefile(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

01894 {
01895   if (CmtLock::check () == CmtLock::locked_by_another_user)
01896     {
01897       CmtError::set (CmtError::conflicting_lock, "build_os9_makefile>");
01898       return;
01899     }
01900 
01901   if (arguments.size () > 0) 
01902     {
01903       set_standard_macros ();
01904       build_OS9_makefile (arguments[0]);
01905     }
01906 }

void Cmt::do_build_prototype (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1909 of file cmt_parser.cxx.

References Generator::build_prototype(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

01910 {
01911   if (CmtLock::check () == CmtLock::locked_by_another_user)
01912     {
01913       CmtError::set (CmtError::conflicting_lock, "build_prototype>");
01914       return;
01915     }
01916 
01917   if (arguments.size () > 0) 
01918     {
01919       set_standard_macros ();
01920       Generator::build_prototype (arguments[0]);
01921     }
01922 }

void Cmt::do_build_readme (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1925 of file cmt_parser.cxx.

References Generator::build_readme(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), and set_standard_macros().

Referenced by parser().

01926 {
01927   if (CmtLock::check () == CmtLock::locked_by_another_user)
01928     {
01929       CmtError::set (CmtError::conflicting_lock, "build_readme>");
01930       return;
01931     }
01932 
01933   set_standard_macros ();
01934   Generator::build_readme (arguments);
01935 }

void Cmt::do_build_tag_makefile (? ? )? [static]
?

Definition at line 1938 of file cmt_parser.cxx.

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

Referenced by parser().

01939 {
01940   if (CmtLock::check () == CmtLock::locked_by_another_user)
01941     {
01942       CmtError::set (CmtError::conflicting_lock, "build_tag_makefile>");
01943       return;
01944     }
01945 
01946   print_macros (Make);
01947 }

void Cmt::do_build_temporary_name (? ? )? [static]
?

Definition at line 1950 of file cmt_parser.cxx.

References CmtSystem::get_temporary_name().

Referenced by parser().

01951 {
01952   cmt_string name = CmtSystem::get_temporary_name ();
01953   cout << name << endl;
01954 }

void Cmt::do_build_triggers (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1957 of file cmt_parser.cxx.

References CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, TriggerGenerator::run(), CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

01958 {
01959   if (CmtLock::check () == CmtLock::locked_by_another_user)
01960     {
01961       CmtError::set (CmtError::conflicting_lock, "build_tag_makefile>");
01962       return;
01963     }
01964 
01965   if (arguments.size () > 0) 
01966     {
01967       set_standard_macros ();
01968       TriggerGenerator::run (arguments[0]);
01969     }
01970 }

void Cmt::do_build_vsnet (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1876 of file cmt_parser.cxx.

References build_vsnet_file(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

01877 {                                                                            
01878   if (CmtLock::check () == CmtLock::locked_by_another_user)                  
01879     {                                                                        
01880       CmtError::set (CmtError::conflicting_lock, "build_vsnet>");            
01881       return;                                                                
01882     }                                                                        
01883                                                                              
01884   if (true)                                                                  
01885     {                                                                        
01886       set_standard_macros ();                                                
01887       if (arguments.size () > 0) build_vsnet_file (arguments[0]);            
01888       else build_vsnet_file ("");                                            
01889     }                                                                        
01890 }                                                                            

void Cmt::do_build_windefs (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1973 of file cmt_parser.cxx.

References Generator::build_windefs(), CmtLock::check(), CmtError::conflicting_lock, CmtLock::locked_by_another_user, CmtError::set(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

01974 {
01975   if (CmtLock::check () == CmtLock::locked_by_another_user)
01976     {
01977       CmtError::set (CmtError::conflicting_lock, "build_windefs>");
01978       return;
01979     }
01980 
01981   if (arguments.size () > 0) 
01982     {
01983       set_standard_macros ();
01984       Generator::build_windefs (arguments[0]);
01985     }
01986 }

void Cmt::do_check_configuration (? ? )? [static]
?

Definition at line 1989 of file cmt_parser.cxx.

Referenced by parser().

01990 {
01991 }

void Cmt::do_check_files (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 1994 of file cmt_parser.cxx.

References CmtSystem::compare_and_update_files(), and cmt_vector< cmt_string >::size().

Referenced by parser().

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

void Cmt::do_check_version (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2009 of file cmt_parser.cxx.

References CmtSystem::is_version_directory(), and cmt_vector< cmt_string >::size().

Referenced by parser().

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

void Cmt::do_checkout (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2034 of file cmt_parser.cxx.

References Cvs::checkout().

Referenced by parser().

02035 {
02036   Cvs::checkout (arguments);
02037 }

void Cmt::do_cleanup (? PrintMode &? ? mode )? [static]
?

Definition at line 2040 of file cmt_parser.cxx.

References print_clean(), and PrintMode.

Referenced by parser().

02041 {
02042   print_clean (mode);
02043 }

void Cmt::do_config (? ? )? [static]
?

Definition at line 2046 of file cmt_parser.cxx.

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

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

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

void Cmt::do_create (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2222 of file cmt_parser.cxx.

References CmtSystem::absolute_path(), Generator::build_default_makefile(), CmtSystem::cd(), cmt_style, CmtSystem::compress_path(), do_config(), CmtSystem::file_separator(), mgr_style, CmtSystem::mkdir(), no_version_style, CmtSystem::pwd(), cmt_vector< cmt_string >::size(), CmtSystem::test_directory(), CmtSystem::test_file(), with_version_directory, and without_version_directory.

Referenced by parser().

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

void Cmt::do_create_project (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2442 of file cmt_parser.cxx.

References Project::create(), and cmt_vector< cmt_string >::size().

Referenced by parser().

02443 {
02444   if (arguments.size () < 1) return;
02445 
02446   const cmt_string& project = arguments[0];
02447 
02448   Project::create (project);
02449 }

void Cmt::do_cvsbranches (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2452 of file cmt_parser.cxx.

References Cvs::branches().

Referenced by parser().

02453 {
02454   Cvs::branches (arguments[0]);
02455 }

void Cmt::do_cvssubpackages (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2458 of file cmt_parser.cxx.

References Cvs::subpackages().

Referenced by parser().

02459 {
02460   Cvs::subpackages (arguments[0]);
02461 }

void Cmt::do_cvstags (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2464 of file cmt_parser.cxx.

References Cvs::tags().

Referenced by parser().

02465 {
02466   Cvs::tags (arguments);
02467 }

void Cmt::do_do (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2470 of file cmt_parser.cxx.

References Symbol::all_set(), Symbol::build_macro_value(), Use::current(), cmt_string::erase(), CmtSystem::execute(), Symbol::expand(), cmt_string::find(), Symbol::find(), cmt_string::npos, SyntaxParser::parse_requirements_line(), CmtError::set(), set_standard_macros(), cmt_string::size(), cmt_vector< cmt_string >::size(), cmt_string::substr(), and CmtError::symbol_not_found.

Referenced by parser().

02471 {
02472   if (arguments.size () > 0) 
02473     {
02474       set_standard_macros ();
02475       Symbol::all_set ();
02476 
02477       Symbol* symbol = Symbol::find (arguments[0]);
02478 
02479       if (symbol == 0)
02480         {
02481           CmtError::set (CmtError::symbol_not_found, arguments[0]);
02482           return;
02483         }
02484 
02485       /*
02486         We then look for all = pairs
02487       */
02488       for (int i = 1; i < arguments.size (); i++)
02489         {
02490           cmt_string s = arguments[i];
02491           int pos = s.find ("=");
02492           if (pos == cmt_string::npos) break;
02493           if (pos == 0) break;
02494 
02495           cmt_string name;
02496           cmt_string value;
02497 
02498           s.substr (0, pos, name);
02499           s.substr (pos + 1, value);
02500 
02501           int size = value.size ();
02502 
02503           if (size >= 2)
02504             {
02505               if (((value[0] == '"') && (value[size - 1] == '"')) ||
02506                   ((value[0] == '\'') && (value[size - 1] == '\'')))
02507                 {
02508                   value.erase (size - 1);
02509                   value.erase (0, 1);
02510                 }
02511             }
02512 
02513           cmt_string r = "macro ";
02514           r += name;
02515           r += " \"";
02516           r += value;
02517           r += "\"";
02518 
02519           Use* current_use = &(Use::current ());
02520 
02521           SyntaxParser::parse_requirements_line (r, current_use);
02522         }
02523 
02524       cmt_string cmd = symbol->build_macro_value ();
02525       Symbol::expand (cmd);
02526 
02527       cout << "Execute action " << arguments[0] << " => " << cmd << endl;
02528 
02529       CmtSystem::execute (cmd);
02530     }
02531 }

void Cmt::do_expand_model (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2534 of file cmt_parser.cxx.

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

Referenced by parser().

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

void Cmt::do_filter (? const CmtSystem::cmt_string_vector &? ? arguments )? [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 2562 of file cmt_parser.cxx.

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

Referenced by parser().

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

void Cmt::do_help (? ActionType? ? help_action = action_none )? [static]
?

Definition at line 2596 of file cmt_parser.cxx.

References action_none, ActionType, CommandParser::show(), and CommandParser::show_all().

Referenced by parser().

02597 {
02598   if (help_action == action_none)
02599     {
02600       CommandParser::show_all ();
02601     }
02602   else
02603     {
02604       CommandParser::show (help_action);
02605     }
02606 }

void Cmt::do_lock (? const cmt_string &? ? package,
const cmt_string &? ? version,
const cmt_string &? ? path
)? [static]
?

Definition at line 2609 of file cmt_parser.cxx.

References CmtLock::lock(), set_standard_macros(), and CmtLock::status.

Referenced by parser().

02612 {
02613   //(unsused) Use& use = Use::current();
02614 
02615   cout << "try to lock package " << package << " in " << CmtSystem::pwd () << endl;
02616 
02617   set_standard_macros ();
02618 
02619   CmtLock::status status = CmtLock::lock ();
02620 }

void Cmt::do_remove (? const cmt_string &? ? package,
const cmt_string &? ? version,
const cmt_string &? ? path
)? [static]
?

Definition at line 2623 of file cmt_parser.cxx.

References CmtSystem::absolute_path(), CmtSystem::cd(), CmtSystem::compress_path(), CmtSystem::file_separator(), m_current_package, CmtSystem::pwd(), cmt_string::read(), CmtSystem::remove_directory(), CmtSystem::scan_dir(), cmt_vector< cmt_string >::size(), and CmtSystem::test_directory().

Referenced by parser().

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

void Cmt::do_remove_library_links (? ? )? [static]
?

Definition at line 2724 of file cmt_parser.cxx.

References CmtSystem::absolute_path(), CmtSystem::basename(), Symbol::build_macro_value(), CmtLock::check(), CmtError::conflicting_lock, Use::current(), Use::discarded, CmtSystem::execute(), CmtError::execution_error, Symbol::expand(), CmtSystem::file_separator(), Symbol::find(), get_build_strategy(), CmtInstallAreaMgr::get_installarea(), Use::get_ordered_uses(), Use::get_package_name(), InstallAreaMask, CmtInstallAreaMgr::instance(), Use::located(), CmtLock::locked_by_another_user, m_quiet, Use::path, CmtError::set(), set_standard_macros(), cmt_vector< cmt_string >::size(), cmt_vector< Use * >::size(), CmtSystem::split(), Use::version, and WithInstallArea.

Referenced by parser().

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

void Cmt::do_run (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Here we expect that only the base name of the library is given : ie it should not contain the "lib" prefix, nor the suffix .so, nor any path prefix.

This of course should generally correspond to a constituent name.

Definition at line 2907 of file cmt_parser.cxx.

References Symbol::all_set(), CmtSystem::execute(), set_standard_macros(), and cmt_vector< cmt_string >::size().

Referenced by parser().

02908 {
02909   if (arguments.size () > 0) 
02910     {
02911       set_standard_macros ();
02912       Symbol::all_set ();
02913 
02914       cmt_string cmd;
02915 
02916       for (int i = 0; i < arguments.size (); i++)
02917         {
02918           cmd += arguments[i];
02919           cmd += " ";
02920         }
02921 
02922       CmtSystem::execute (cmd);
02923     }
02924 }

void Cmt::do_run_sequence (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2927 of file cmt_parser.cxx.

References FAwk::run(), and cmt_vector< cmt_string >::size().

Referenced by parser().

02928 {
02929   if (arguments.size () == 0) cerr << "#CMT> run_sequence: no sequence specified" << endl;
02930 
02931   SequenceRunner runner;
02932 
02933   cout << "# cmt run_sequence: sequence " << arguments[0] << endl;
02934 
02935   runner.run (arguments[0]);
02936 }

void Cmt::do_set_version (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2939 of file cmt_parser.cxx.

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

Referenced by parser().

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

void Cmt::do_set_versions (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 2990 of file cmt_parser.cxx.

References action_broadcast, cmt_vector< cmt_string >::add(), do_broadcast(), and m_action.

Referenced by parser().

02991 {
02992   CmtSystem::cmt_string_vector args;
02993 
02994   args = arguments;
02995   {
02996     cmt_string& s = args.add ();
02997     s = "cmt";
02998   }
02999   {
03000     cmt_string& s = args.add ();
03001     s = "set";
03002   }
03003   {
03004     cmt_string& s = args.add ();
03005     s = "version";
03006   }
03007   {
03008     cmt_string& s = args.add ();
03009     s = "";
03010   }
03011 
03012   m_action = action_broadcast;
03013 
03014   do_broadcast (args, 0, 0);
03015 }

void Cmt::do_setup (? PrintMode &? ? mode )? [static]
?

Definition at line 3018 of file cmt_parser.cxx.

References get_build_strategy(), InstallAreaMask, CmtInstallAreaMgr::instance(), print(), PrintMode, CmtInstallAreaMgr::setup(), and WithInstallArea.

Referenced by parser().

03019 {
03020   print (mode);
03021 
03022     //
03023     //  Try a cleanup of the installation area
03024     //
03025   if ((get_build_strategy () & InstallAreaMask) == WithInstallArea)
03026     {
03027       CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
03028 
03029       //cout << "#IA5>" << endl;
03030 
03031       ia_mgr.setup ();
03032 
03033       /*
03034       if ((get_setup_strategy () & SetupCleanupMask) == SetupCleanup)
03035         {
03036           const cmt_string& installarea = ia_mgr.get_installarea ();
03037 
03038           if (installarea != "")
03039             {
03040               cmt_string q;
03041               
03042               switch (mode)
03043                 {
03044                 case Sh :
03045                 case Csh :
03046                   q = "\'";
03047                   break;
03048                 default :
03049                   break;
03050                 }
03051               
03052               if (!m_quiet)
03053                 {
03054                   cout << "echo "  << q 
03055                        << "# Doing cleanup in the installation area " << installarea 
03056                        << q << endl;
03057                 }
03058             }
03059 
03060           ia_mgr.config ();
03061         }
03062       */
03063     }
03064 }

void Cmt::do_show_action (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3067 of file cmt_parser.cxx.

References action_show_action, action_show_action_value, Symbol::find(), m_action, PrintMode, CmtError::set(), set_standard_macros(), Symbol::show_macro(), cmt_vector< SymbolValueList >::size(), cmt_vector< cmt_string >::size(), CmtError::symbol_not_found, Symbol::SymbolAction, Symbol::SymbolAlias, Symbol::SymbolMacro, Symbol::SymbolPath, Symbol::SymbolSet, Symbol::type, Symbol::value_lists, and CmtError::warning.

Referenced by parser().

03069 {
03070   cmt_string target;
03071 
03072   if (arguments.size () > 0) target = arguments[0];
03073 
03074   Symbol* symbol;
03075 
03076   set_standard_macros ();
03077 
03078   symbol = Symbol::find (target);
03079 
03080   if (symbol == 0) 
03081     {
03082       cmt_string t = " ";
03083       t += target;
03084       t += " is not defined ";
03085 
03086       CmtError::set (CmtError::symbol_not_found, t);
03087 
03088       return;
03089     }
03090   else
03091     {
03092       cmt_string t = target;
03093       t += " is a ";
03094 
03095       if ((m_action == action_show_action) ||
03096           (m_action == action_show_action_value))
03097         {
03098           if (symbol->type != Symbol::SymbolAction)
03099             {
03100               if (symbol->type == Symbol::SymbolMacro)
03101                 {
03102                   t += "macro";
03103                 }
03104               else if (symbol->type == Symbol::SymbolSet)
03105                 {
03106                   t += "set";
03107                 }
03108               else if (symbol->type == Symbol::SymbolPath)
03109                 {
03110                   t += "path";
03111                 }
03112               else if (symbol->type == Symbol::SymbolAlias)
03113                 {
03114                   t += "alias";
03115                 }
03116 
03117               CmtError::set (CmtError::warning, t);
03118             }
03119         }
03120     }
03121 
03122   if (symbol->value_lists.size () < 1) return;
03123 
03124   symbol->show_macro (mode);
03125 }

void Cmt::do_show_action_names (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3128 of file cmt_parser.cxx.

References print_symbol_names(), PrintMode, and cmt_vector< cmt_string >::size().

Referenced by parser().

03130 {
03131   if (arguments.size () > 0)
03132     {
03133       const cmt_string& pattern = arguments[0];
03134       print_symbol_names (mode, pattern);
03135     }
03136   else
03137     {
03138       print_symbol_names (mode);
03139     }
03140 }

void Cmt::do_show_action_value (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3143 of file cmt_parser.cxx.

References do_show_macro(), and PrintMode.

Referenced by parser().

03145 {
03146   do_show_macro (arguments, mode);
03147 }

void Cmt::do_show_actions (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3150 of file cmt_parser.cxx.

References print_macros(), PrintMode, and cmt_vector< cmt_string >::size().

Referenced by parser().

03152 {
03153   if (arguments.size () > 0)
03154     {
03155       const cmt_string& pattern = arguments[0];
03156       print_macros (mode, pattern);
03157     }
03158   else
03159     {
03160       print_macros (mode);
03161     }
03162 }

void Cmt::do_show_all_tags (? ? )? [static]
?

Definition at line 3165 of file cmt_parser.cxx.

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

Referenced by parser().

03166 {
03167   Tag::TagPtrVector tags = Tag::tags ();
03168   int index;
03169 
03170   set_standard_macros ();
03171 
03172   for (index = 0; index < tags.size (); index++)
03173     {
03174       const Tag* tag = tags[index];
03175       if (tag != 0)
03176         {
03177           tag->show_definition (true);
03178         }
03179     }
03180 }

void Cmt::do_show_applied_patterns (? ? )? [static]
?

Definition at line 3183 of file cmt_parser.cxx.

References Pattern::show_all_applied_patterns().

Referenced by parser().

03184 {
03185   Pattern::show_all_applied_patterns ();
03186 }

void Cmt::do_show_author (? ? )? [static]
?

Definition at line 3189 of file cmt_parser.cxx.

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

Referenced by parser().

03190 {
03191   Use& use = Use::current();
03192 
03193   cout << use.author << endl;
03194 }

void Cmt::do_show_branches (? PrintMode &? ? mode )? [static]
?

Definition at line 3197 of file cmt_parser.cxx.

References Branch::print_all(), and PrintMode.

Referenced by parser().

03198 {
03199   Branch::print_all (mode);
03200 }

void Cmt::do_show_clients (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3203 of file cmt_parser.cxx.

References clear(), configure(), ClientCollector::count(), PathScanner::scan_path(), Project::scan_paths(), and cmt_vector< cmt_string >::size().

Referenced by parser().

03204 {
03205   cmt_string package;
03206   cmt_string version;
03207   cmt_string path_name;
03208 
03209   if (arguments.size () >= 1) package = arguments[0];
03210   if (arguments.size () >= 2) version = arguments[1];
03211   if (arguments.size () >= 3) path_name = arguments[2];
03212 
03213   PathScanner scanner;
03214   ClientCollector collector (package, version);
03215 
03216   clear ();
03217   configure ();
03218 
03219   cout << "# ----------- Clients of " << package <<
03220     " " << version <<
03221     " " << path_name <<
03222     endl;
03223 
03224   if (path_name == "")
03225     {
03226       Project::scan_paths (scanner, collector);
03227     }
03228   else
03229     {
03230       scanner.scan_path (path_name, collector);
03231     }
03232   cout << "# ----------- " << collector.count () << " clients found." << endl;
03233 }

void Cmt::do_show_cmtpath_patterns (? ? )? [static]
?

Definition at line 3236 of file cmt_parser.cxx.

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

Referenced by parser().

03237 {
03238   set_standard_macros ();
03239   CmtPathPattern::show_all ();
03240 }

void Cmt::do_show_constituent (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3243 of file cmt_parser.cxx.

References Constituent::find(), set_standard_macros(), Constituent::show(), and cmt_vector< cmt_string >::size().

Referenced by parser().

03244 {
03245   if (arguments.size () > 0) 
03246     {
03247       set_standard_macros ();
03248 
03249       Constituent* c = Constituent::find (arguments[0]);
03250       if (c != 0)
03251         {
03252           c->show ();
03253         }
03254     }
03255 }

void Cmt::do_show_constituent_names (? ? )? [static]
?

Definition at line 3258 of file cmt_parser.cxx.

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

Referenced by parser().

03259 {
03260   set_standard_macros ();
03261   Constituent::show_names ();
03262 }

void Cmt::do_show_constituents (? ? )? [static]
?

Definition at line 3265 of file cmt_parser.cxx.

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

Referenced by parser().

03266 {
03267   set_standard_macros ();
03268   Constituent::show_all ();
03269 }

void Cmt::do_show_cycles (? ? )? [static]
?

Definition at line 3272 of file cmt_parser.cxx.

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

Referenced by parser().

03273 {
03274   set_standard_macros ();
03275   Use& use = Use::current();
03276 
03277   use.show_cycles ();
03278 }

void Cmt::do_show_fragment (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3281 of file cmt_parser.cxx.

References Fragment::show(), and cmt_vector< cmt_string >::size().

Referenced by parser().

03282 {
03283   if (arguments.size () > 0) Fragment::show (arguments[0]);
03284 }

void Cmt::do_show_fragments (? ? )? [static]
?

Definition at line 3287 of file cmt_parser.cxx.

References Fragment::show_all().

Referenced by parser().

03288 {
03289   Fragment::show_all ();
03290 }

void Cmt::do_show_groups (? ? )? [static]
?

Definition at line 3293 of file cmt_parser.cxx.

References Group::show_all().

Referenced by parser().

03294 {
03295   Group::show_all ();
03296 }

void Cmt::do_show_include_dirs (? ? )? [static]
?

Definition at line 3299 of file cmt_parser.cxx.

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

Referenced by parser().

03300 {
03301   cmt_string temp;
03302 
03303   Use& use = Use::current();
03304 
03305   set_standard_macros ();
03306 
03307   if (use.include_path == "")
03308     {
03309       temp += "$(src) ";
03310     }
03311   else if (use.include_path != "none")
03312     {
03313       temp += use.include_path;
03314       temp += " ";
03315     }
03316 
03317   for (int include_number = 0;
03318        include_number < use.includes.size ();
03319        include_number++)
03320     {
03321       Include& incl = use.includes[include_number];
03322       
03323       temp += incl.name;
03324       temp += " ";
03325     }
03326 
03327   cout << temp << endl;
03328 }

void Cmt::do_show_language (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3331 of file cmt_parser.cxx.

References set_standard_macros(), Language::show(), and cmt_vector< cmt_string >::size().

Referenced by parser().

03332 {
03333   if (arguments.size () > 0) 
03334     {
03335       set_standard_macros ();
03336       Language::show (arguments[0]);
03337     }
03338 }

void Cmt::do_show_languages (? ? )? [static]
?

Definition at line 3341 of file cmt_parser.cxx.

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

Referenced by parser().

03342 {
03343   set_standard_macros ();
03344   Language::show_all ();
03345 }

void Cmt::do_show_macro (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3348 of file cmt_parser.cxx.

References action_show_macro, action_show_macro_value, action_show_set, action_show_set_value, Symbol::find(), m_action, PrintMode, CmtError::set(), set_standard_macros(), Symbol::show_macro(), cmt_vector< SymbolValueList >::size(), cmt_vector< cmt_string >::size(), CmtError::symbol_not_found, Symbol::SymbolAction, Symbol::SymbolAlias, Symbol::SymbolMacro, Symbol::SymbolPath, Symbol::SymbolSet, Symbol::type, Symbol::value_lists, and CmtError::warning.

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

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

void Cmt::do_show_macro_names (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3422 of file cmt_parser.cxx.

References print_symbol_names(), PrintMode, and cmt_vector< cmt_string >::size().

Referenced by parser().

03424 {
03425   if (arguments.size () > 0)
03426     {
03427       const cmt_string& pattern = arguments[0];
03428       print_symbol_names (mode, pattern);
03429     }
03430   else
03431     {
03432       print_symbol_names (mode);
03433     }
03434 }

void Cmt::do_show_macro_value (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3437 of file cmt_parser.cxx.

References do_show_macro(), and PrintMode.

Referenced by parser().

03439 {
03440   do_show_macro (arguments, mode);
03441 }

void Cmt::do_show_macros (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3444 of file cmt_parser.cxx.

References print_macros(), PrintMode, and cmt_vector< cmt_string >::size().

Referenced by parser().

03446 {
03447   if (arguments.size () > 0)
03448     {
03449       const cmt_string& pattern = arguments[0];
03450       print_macros (mode, pattern);
03451     }
03452   else
03453     {
03454       print_macros (mode);
03455     }
03456 }

void Cmt::do_show_manager (? ? )? [static]
?

Definition at line 3459 of file cmt_parser.cxx.

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

Referenced by parser().

03460 {
03461   Use& use = Use::current();
03462 
03463   cout << use.manager << endl;
03464 }

void Cmt::do_show_packages (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3467 of file cmt_parser.cxx.

References PathScanner::scan_path(), Project::scan_paths(), and cmt_vector< cmt_string >::size().

Referenced by parser().

03468 {
03469   cmt_string path_name;
03470 
03471   if (arguments.size () > 0) path_name = arguments[0];
03472 
03473   PathScanner scanner;
03474   PackageViewer viewer;
03475 
03476   if (path_name == "")
03477     {
03478       Project::scan_paths (scanner, viewer);
03479     }
03480   else
03481     {
03482       scanner.scan_path (path_name, viewer);
03483     }
03484 }

void Cmt::do_show_path (? ? )? [static]
?

Definition at line 3487 of file cmt_parser.cxx.

References Project::show_paths().

Referenced by do_show_setup(), and parser().

03488 {
03489   Project::show_paths ();
03490 }

void Cmt::do_show_pattern (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3493 of file cmt_parser.cxx.

References Pattern::show(), and cmt_vector< cmt_string >::size().

Referenced by parser().

03494 {
03495   cmt_string name;
03496   if (arguments.size () > 0) name = arguments[0];
03497   Pattern::show (name);
03498 }

void Cmt::do_show_pattern_names (? ? )? [static]
?

Definition at line 3501 of file cmt_parser.cxx.

References Pattern::show_all_names().

Referenced by parser().

03502 {
03503   Pattern::show_all_names ();
03504 }

void Cmt::do_show_patterns (? ? )? [static]
?

Definition at line 3507 of file cmt_parser.cxx.

References Pattern::show_all().

Referenced by parser().

03508 {
03509   Pattern::show_all ();
03510 }

void Cmt::do_show_projects (? ? )? [static]
?

Definition at line 3513 of file cmt_parser.cxx.

References Project::show_all().

Referenced by parser().

03514 {
03515   Project::show_all ();
03516 }

void Cmt::do_show_pwd (? ? )? [static]
?

Definition at line 3519 of file cmt_parser.cxx.

References m_current_dir.

Referenced by parser().

03520 {
03521   cout << m_current_dir << endl;
03522 }

void Cmt::do_show_set (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3538 of file cmt_parser.cxx.

References do_show_macro(), and PrintMode.

Referenced by parser().

03540 {
03541   do_show_macro (arguments, mode);
03542 }

void Cmt::do_show_set_names (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3545 of file cmt_parser.cxx.

References print_symbol_names(), PrintMode, and cmt_vector< cmt_string >::size().

Referenced by parser().

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

void Cmt::do_show_set_value (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3560 of file cmt_parser.cxx.

References do_show_macro(), and PrintMode.

Referenced by parser().

03562 {
03563   do_show_macro (arguments, mode);
03564 }

void Cmt::do_show_sets (? const CmtSystem::cmt_string_vector &? ? arguments,
PrintMode &? ? mode
)? [static]
?

Definition at line 3567 of file cmt_parser.cxx.

References print_macros(), PrintMode, and cmt_vector< cmt_string >::size().

Referenced by parser().

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

void Cmt::do_show_setup (? ? )? [static]
?

Definition at line 3525 of file cmt_parser.cxx.

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

Referenced by parser().

03526 {
03527   cout << "----------> uses" << endl;
03528   do_show_uses ();
03529 
03530   cout << "----------> tags" << endl;
03531   do_show_tags ();
03532 
03533   cout << "----------> CMTPATH" << endl;
03534   do_show_path ();
03535 }

void Cmt::do_show_strategies (? ? )? [static]
?

Definition at line 3582 of file cmt_parser.cxx.

References Project::get_build_strategy(), Project::get_current(), get_setup_strategy(), InstallAreaMask, KeepMakefiles, KeepMakefilesMask, m_current_build_strategy, Prototypes, PrototypesMask, SetupCleanup, SetupCleanupMask, SetupConfig, SetupConfigMask, SetupRoot, SetupRootMask, Project::show(), with_version_directory, WithInstallArea, and without_version_directory.

Referenced by parser().

03583 {
03584   Project* p = Project::get_current ();
03585 
03586   if (p != 0) p->show ();
03587   else cout << "No current project" << endl;
03588 
03589   cout << "Structuring style : ";
03590 
03591   int strategy = 0;
03592 
03593   switch (m_current_structuring_style)
03594     {
03595     case without_version_directory:
03596       cout << "without_version_directory";
03597       break;
03598     case with_version_directory:
03599       cout << "with_version_directory";
03600       break;
03601     }
03602 
03603   cout << endl;
03604 
03605   cout << "Build strategy    : ";
03606 
03607   if (p == 0) strategy = m_current_build_strategy;
03608   else strategy = p->get_build_strategy ();
03609   
03610   if ((strategy & PrototypesMask) == Prototypes)
03611     {
03612       cout << "prototypes";
03613     }
03614   else
03615     {
03616       cout << "no_prototypes";
03617     }
03618   
03619   if ((strategy & KeepMakefilesMask) == KeepMakefiles)
03620     {
03621       cout << " keep_makefiles";
03622     }
03623   else
03624     {
03625       cout << " rebuild_makefiles";
03626     }
03627   
03628   if ((strategy & InstallAreaMask) == WithInstallArea)
03629     {
03630       cout << " with_installarea";
03631     }
03632   else
03633     {
03634       cout << " without_installarea";
03635     }
03636   
03637   cout << endl;
03638 
03639   cout << "Setup strategy    : ";
03640   
03641   strategy = get_setup_strategy ();
03642 
03643   if ((strategy & SetupConfigMask) == SetupConfig)
03644     {
03645       cout << "config";
03646     }
03647   else
03648     {
03649       cout << "no_config";
03650     }
03651   
03652   if ((strategy & SetupRootMask) == SetupRoot)
03653     {
03654       cout << " root";
03655     }
03656   else
03657     {
03658       cout << " no_root";
03659     }
03660   
03661   if ((strategy & SetupCleanupMask) == SetupCleanup)
03662     {
03663       cout << " cleanup";
03664     }
03665   else
03666     {
03667       cout << " no_cleanup";
03668     }
03669   
03670   cout << endl;
03671 }

void Cmt::do_show_system (? ? )? [static]
?

Definition at line 3726 of file cmt_parser.cxx.

References CmtSystem::get_cmt_config().

Referenced by parser().

03727 {
03728   cout << CmtSystem::get_cmt_config () << endl;
03729 }

void Cmt::do_show_tags (? ? )? [static]
?

Definition at line 3674 of file cmt_parser.cxx.

References m_quiet, set_standard_macros(), Tag::show(), cmt_vector< Tag * >::size(), and Tag::tags().

Referenced by do_show_setup(), and parser().

03675 {
03676   Tag::TagPtrVector tags = Tag::tags ();
03677   int index;
03678 
03679   set_standard_macros ();
03680 
03681   for (index = 0; index < tags.size (); index++)
03682     {
03683       const Tag* tag = tags[index];
03684       if (tag != 0)
03685         {
03686           tag->show (m_quiet);
03687         }
03688     }
03689 }

void Cmt::do_show_use_paths (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3692 of file cmt_parser.cxx.

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

Referenced by parser().

03693 {
03694   const cmt_string& to_name = arguments[0];
03695 
03696   Use* current = &(Use::current());
03697 
03698   current->get_all_clients (to_name);
03699 }

void Cmt::do_show_uses (? ? )? [static]
?

Definition at line 3702 of file cmt_parser.cxx.

References Use::show_all().

Referenced by do_show_setup(), and parser().

03703 {
03704   Use::show_all ();
03705 }

void Cmt::do_show_version (? ? )? [static]
?

Definition at line 3708 of file cmt_parser.cxx.

References m_current_version.

Referenced by parser().

03709 {
03710   cout << m_current_version << endl;
03711 }

void Cmt::do_show_versions (? const CmtSystem::cmt_string_vector &? ? arguments )? [static]
?

Definition at line 3714 of file cmt_parser.cxx.

References Project::scan_paths_for_package(), and cmt_vector< cmt_string >::size().

Referenced by parser().

03715 {
03716   cmt_string package_name;
03717 
03718   if (arguments.size () > 0) package_name = arguments[0];
03719 
03720   PathScanner scanner;
03721 
03722   Project::scan_paths_for_package (scanner, package_name);
03723 }

void Cmt::do_unlock (? const cmt_string &? ? package,
const cmt_string &? ? version,
const cmt_string &? ? path
)? [static]
?

Definition at line 3732 of file cmt_parser.cxx.

References set_standard_macros(), CmtLock::status, and CmtLock::unlock().

Referenced by parser().

03735 {
03736   // (unused??) Use& use = Use::current();
03737 
03738   cout << "try to unlock package " << package << " in " << CmtSystem::pwd () << endl;
03739 
03740   set_standard_macros ();
03741 
03742   CmtLock::status status = CmtLock::unlock ();
03743 }

void Cmt::do_version (? ? )? [static]
?

Definition at line 3746 of file cmt_parser.cxx.

References CMTVERSION.

Referenced by parser().

03747 {
03748   cout << CMTVERSION << endl;
03749 }

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

Definition at line 3874 of file cmt_parser.cxx.

References CmtSystem::compress_path().

Referenced by Include::print_filters().

03875 {
03876   static cmt_string newdir;
03877 
03878   CmtSystem::compress_path (dir, newdir);
03879 
03880   return (newdir);
03881 }

ActionType Cmt::get_action (? ? )? [static]
?

Definition at line 3754 of file cmt_parser.cxx.

References ActionType.

Referenced by KwdSetupStrategy::action(), KwdBuildStrategy::action(), 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().

03755 {
03756   return (m_action);
03757 }

const cmt_string & Cmt::get_cmt_home (? ? )? [static]
?

Definition at line 3776 of file cmt_parser.cxx.

Referenced by Use::show_all().

03777 {
03778   return (m_cmt_home);
03779 }

const cmt_string & Cmt::get_cmt_user_context (? ? )? [static]
?

Definition at line 3781 of file cmt_parser.cxx.

Referenced by Use::show_all().

03782 {
03783   return (m_cmt_user_context);
03784 }

const cmt_string & Cmt::get_cmt_version (? ? )? [static]
?

Definition at line 3786 of file cmt_parser.cxx.

Referenced by Project::create().

03787 {
03788   return (m_cmt_version);
03789 }

AccessMode Cmt::get_current_access (? ? )? [static]
?

Definition at line 3811 of file cmt_parser.cxx.

References AccessMode.

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

03812 {
03813   return (m_current_access);
03814 }

int Cmt::get_current_build_strategy (? ? )? [static]
?

Definition at line 3816 of file cmt_parser.cxx.

Referenced by Project::get_build_strategy(), and get_build_strategy().

03817 {
03818   return (m_current_build_strategy);
03819 }

const cmt_string & Cmt::get_current_cmtpath (? ? )? [static]
?

Definition at line 3801 of file cmt_parser.cxx.

03802 {
03803   return (m_current_cmtpath);
03804 }

const cmt_string & Cmt::get_current_dir (? ? )? [static]
?

Definition at line 3791 of file cmt_parser.cxx.

Referenced by VSNETGenerator::reset(), MSDEVGenerator::reset(), and CmtGenerator::reset().

03792 {
03793   return (m_current_dir);
03794 }

const cmt_string & Cmt::get_current_offset (? ? )? [static]
?

Definition at line 3806 of file cmt_parser.cxx.

03807 {
03808   return (m_current_offset);
03809 }

const cmt_string & Cmt::get_current_package (? ? )? [static]
?

Definition at line 3796 of file cmt_parser.cxx.

Referenced by ReadmeGenerator::build().

03797 {
03798   return (m_current_package);
03799 }

int Cmt::get_current_setup_strategy (? ? )? [static]
?

Definition at line 3821 of file cmt_parser.cxx.

Referenced by Project::get_setup_strategy(), and get_setup_strategy().

03822 {
03823   return (m_current_setup_strategy);
03824 }

CmtStructuringStyle Cmt::get_current_structuring_style (? ? )? [static]
?

Definition at line 3826 of file cmt_parser.cxx.

References CmtStructuringStyle.

Referenced by CvsImplementation::build_version_directory(), CvsImplementation::checkout_package(), and CvsImplementation::really_checkout_package().

03827 {
03828   return (m_current_structuring_style);
03829 }

CmtDirStyle Cmt::get_current_style (? ? )? [static]
?

Definition at line 3831 of file cmt_parser.cxx.

References CmtDirStyle.

Referenced by dos_script_prefix().

03832 {
03833   return (m_current_style);
03834 }

const cmt_string & Cmt::get_current_target (? ? )? [static]
?

Definition at line 3841 of file cmt_parser.cxx.

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

03842 {
03843   return (m_current_target);
03844 }

const cmt_string & Cmt::get_current_version (? ? )? [static]
?

Definition at line 3836 of file cmt_parser.cxx.

Referenced by ReadmeGenerator::build(), VSNETGenerator::build_project(), and VSNETGenerator::build_workspace().

03837 {
03838   return (m_current_version);
03839 }

bool Cmt::get_debug (? ? )? [static]
?

Definition at line 3846 of file cmt_parser.cxx.

Referenced by Symbol::action(), CmtPathPattern::action(), Package::add(), Use::add(), Symbol::all_set(), LibraryGenerator::analyze_file(), Pattern::apply(), CmtPathPattern::apply(), DefaultMakefileGenerator::build(), build_deps(), build_deps_stream(), CmtLog::check(), CmtInstallAreaMgr::config(), Project::configure(), 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(), 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().

03847 {
03848   return (m_debug);
03849 }

bool Cmt::get_quiet (? ? )? [static]
?

Definition at line 3851 of file cmt_parser.cxx.

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

03852 {
03853   return (m_quiet);
03854 }

bool Cmt::get_recursive (? ? )? [static]
?

Definition at line 3856 of file cmt_parser.cxx.

Referenced by Use::add().

03857 {
03858   return (m_recursive);
03859 }

CmtScopeFilteringMode Cmt::get_scope_filtering_mode (? ? )? [static]
?

Definition at line 3861 of file cmt_parser.cxx.

References CmtScopeFilteringMode, default_filtering_mode, and m_scope_filtering_mode.

Referenced by use_action_iterator::get_use().

03862 {
03863   if (m_scope_filtering_mode == default_filtering_mode)
03864     {
03865       return (block_private_uses);
03866     }
03867   else
03868     {
03869       return (m_scope_filtering_mode);
03870     }
03871 }

void Cmt::install_cleanup_scripts (? ? )? [static]
?

Definition at line 3935 of file cmt_parser.cxx.

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

Referenced by do_config().

03936 {
03937 #ifdef WIN32
03938   static const int modes = 1;
03939   static const cmt_string suffix[1]   = {"bat"};
03940   static const PrintMode  mode[1]     = {Bat};
03941 #else
03942   static const int modes = 2;
03943   static const cmt_string suffix[2]   = {"csh", "sh"};
03944   static const PrintMode  mode[2]     = {Csh, Sh};
03945 #endif
03946 
03947   cout << "Creating cleanup scripts." << endl;
03948 
03949   cmt_string temp;
03950   int i;
03951 
03952   cmt_string version = m_current_version;
03953   if (version == "v*") version = "";
03954 
03955   for (i = 0; i < modes; i++)
03956     {
03957       cmt_string file_name = "cleanup";
03958       file_name += ".";
03959       file_name += suffix[i];
03960       file_name += ".";
03961       file_name += "new";
03962 
03963       FILE* f = fopen (file_name.c_str (), "wb");
03964       if (f != NULL)
03965         {
03966           if (mode[i] == Csh)
03967             {
03968               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
03969               fprintf (f, "  setenv CMTROOT %s\n", m_cmt_root.c_str ());
03970               fprintf (f, "endif\n");
03971               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
03972               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
03973               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
03974               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
03975                        "-pack=%s -version=%s -path=%s $* >${tempfile}; "
03976                        "source ${tempfile}\n",
03977                        suffix[i].c_str (),
03978                        m_current_package.c_str (),
03979                        version.c_str (),
03980                        m_current_path.c_str ());
03981               fprintf (f, "/bin/rm -f ${tempfile}\n");
03982             }
03983           else if (mode[i] == Sh)
03984             {
03985               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
03986               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", m_cmt_root.c_str ());
03987               fprintf (f, "fi\n");
03988               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
03989               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
03990               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
03991               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s "
03992                        "-pack=%s -version=%s -path=%s $* >${tempfile}; "
03993                        ". ${tempfile}\n",
03994                        suffix[i].c_str (),
03995                        m_current_package.c_str (),
03996                        version.c_str (),
03997                        m_current_path.c_str ());
03998               fprintf (f, "/bin/rm -f ${tempfile}\n");
03999             }
04000           else if (mode[i] == Bat)
04001             {
04002               dos_script_prefix (f, m_cmt_root, 
04003                                  m_current_package, version, m_current_path,
04004                                  "cleanup");
04005             }
04006 
04007           fprintf (f, "\n");
04008 
04009           fclose (f);
04010 
04011           cmt_string old_file_name = "cleanup";
04012           old_file_name += ".";
04013           old_file_name += suffix[i];
04014 
04015           CmtSystem::compare_and_update_files (file_name, old_file_name);
04016         }
04017     }
04018 }

void Cmt::install_setup_scripts (? ? )? [static]
?

Definition at line 4021 of file cmt_parser.cxx.

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

Referenced by do_config().

04022 {
04023 #ifdef WIN32
04024   static const int modes = 1;
04025   static const cmt_string suffix[1]   = {"bat"};
04026   static const PrintMode  mode[1]     = {Bat};
04027 #else
04028   static const int modes = 2;
04029   static const cmt_string suffix[2]   = {"csh", "sh"};
04030   static const PrintMode  mode[2]     = {Csh, Sh};
04031 #endif
04032 
04033   cout << "Creating setup scripts." << endl;
04034 
04035   
04036   cmt_string no_cleanup_opt;
04037 
04038   if ((get_setup_strategy () & SetupCleanupMask) != SetupCleanup)
04039     {
04040       no_cleanup_opt = " -no_cleanup";
04041     }
04042 
04043   cmt_string temp;
04044   int i;
04045 
04046   cmt_string version = m_current_version;
04047   if (version == "v*") version = "";
04048 
04049   for (i = 0; i < modes; i++)
04050     {
04051       cmt_string file_name = "setup";
04052       file_name += ".";
04053       file_name += suffix[i];
04054       file_name += ".";
04055       file_name += "new";
04056 
04057       FILE* f = fopen (file_name.c_str (), "wb");
04058       if (f != NULL)
04059         {
04060           if (mode[i] == Csh)
04061             {
04062               fprintf (f, "# echo \"Setting %s %s in %s\"\n",
04063                        m_current_package.c_str (),
04064                        version.c_str (),
04065                        m_current_path.c_str ());
04066               fprintf (f, "\n");
04067 
04068               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
04069               fprintf (f, "  setenv CMTROOT %s\n", m_cmt_root.c_str ());
04070               fprintf (f, "endif\n");
04071               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
04072               fprintf (f, "\n");
04073               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04074               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
04075               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
04076                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}; "
04077                        "source ${tempfile}\n",
04078                        suffix[i].c_str (),
04079                        m_current_package.c_str (),
04080                        version.c_str (),
04081                        m_current_path.c_str (),
04082                        no_cleanup_opt.c_str ());
04083               fprintf (f, "/bin/rm -f ${tempfile}\n");
04084             }
04085           else if (mode[i] == Sh)
04086             {
04087               fprintf (f, "# echo \"Setting %s %s in %s\"\n",
04088                        m_current_package.c_str (),
04089                        version.c_str (),
04090                        m_current_path.c_str ());
04091               fprintf (f, "\n");
04092 
04093               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
04094               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", m_cmt_root.c_str ());
04095               fprintf (f, "fi\n");
04096               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
04097               fprintf (f, "\n");
04098               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04099               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
04100               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s "
04101                        "-pack=%s -version=%s -path=%s %s $* >${tempfile}; "
04102                        ". ${tempfile}\n",
04103                        suffix[i].c_str (),
04104                        m_current_package.c_str (),
04105                        version.c_str (),
04106                        m_current_path.c_str (),
04107                        no_cleanup_opt.c_str ());
04108               fprintf (f, "/bin/rm -f ${tempfile}\n");
04109             }
04110           else if (mode[i] == Bat)
04111             {
04112               fprintf (f, "rem Setting %s %s in %%~d0%%~p0\n",
04113                        m_current_package.c_str (),
04114                        version.c_str ());
04115               dos_script_prefix (f, m_cmt_root, 
04116                                  m_current_package, version, m_current_path,
04117                                  "setup", no_cleanup_opt);
04118             }
04119 
04120           fprintf (f, "\n");
04121 
04122           fclose (f);
04123 
04124           cmt_string old_file_name = "setup";
04125           old_file_name += ".";
04126           old_file_name += suffix[i];
04127 
04128           CmtSystem::compare_and_update_files (file_name, old_file_name);
04129         }
04130     }
04131 }

void Cmt::install_test_cleanup_scripts (? ? )? [static]
?

Definition at line 4134 of file cmt_parser.cxx.

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

Referenced by do_config().

04135 {
04136 #ifdef WIN32
04137   static const int modes = 1;
04138   static const cmt_string suffix[1]   = {"bat"};
04139   static const PrintMode  mode[1]     = {Bat};
04140 #else
04141   static const int modes = 2;
04142   static const cmt_string suffix[2]   = {"csh", "sh"};
04143   static const PrintMode  mode[2]     = {Csh, Sh};
04144 #endif
04145 
04146   cout << "Creating cleanup scripts." << endl;
04147 
04148   cmt_string temp;
04149   int i;
04150 
04151   cmt_string version = m_current_version;
04152   if (version == "v*") version = "";
04153 
04154   for (i = 0; i < modes; i++)
04155     {
04156       cmt_string file_name = "cleanup";
04157       file_name += ".";
04158       file_name += suffix[i];
04159       file_name += ".";
04160       file_name += "new";
04161 
04162       FILE* f = fopen (file_name.c_str (), "wb");
04163       if (f != NULL)
04164         {
04165           if (mode[i] == Csh)
04166             {
04167               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
04168               fprintf (f, "  setenv CMTROOT %s\n", m_cmt_root.c_str ());
04169               fprintf (f, "endif\n");
04170               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
04171               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04172               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
04173               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}; "
04174                        "source ${tempfile}\n",
04175                        suffix[i].c_str (),
04176                        m_current_path.c_str ());
04177               fprintf (f, "/bin/rm -f ${tempfile}\n");
04178             }
04179           else if (mode[i] == Sh)
04180             {
04181               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
04182               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", m_cmt_root.c_str ());
04183               fprintf (f, "fi\n");
04184               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
04185               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04186               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
04187               fprintf (f, "${CMTROOT}/mgr/cmt cleanup -%s -pack=cmt_standalone -path=%s $* >${tempfile}; "
04188                        ". ${tempfile}\n",
04189                        suffix[i].c_str (),
04190                        m_current_path.c_str ());
04191               fprintf (f, "/bin/rm -f ${tempfile}\n");
04192             }
04193           else
04194             {
04195               dos_script_prefix (f, m_cmt_root, 
04196                                  "cmt_standalone", "", m_current_path, 
04197                                  "cleanup");
04198             }
04199 
04200           fprintf (f, "\n");
04201 
04202           fclose (f);
04203 
04204           cmt_string old_file_name = "cleanup";
04205           old_file_name += ".";
04206           old_file_name += suffix[i];
04207 
04208           CmtSystem::compare_and_update_files (file_name, old_file_name);
04209         }
04210     }
04211 }

void Cmt::install_test_setup_scripts (? ? )? [static]
?

Definition at line 4214 of file cmt_parser.cxx.

References Bat, cmt_string::c_str(), CmtSystem::compare_and_update_files(), Csh, dos_script_prefix(), get_setup_strategy(), m_cmt_root, m_current_path, PrintMode, SetupCleanup, SetupCleanupMask, and Sh.

Referenced by do_config().

04215 {
04216 #ifdef WIN32
04217   static const int modes = 1;
04218   static const cmt_string suffix[1]   = {"bat"};
04219   static const PrintMode  mode[1]     = {Bat};
04220 #else
04221   static const int modes = 2;
04222   static const cmt_string suffix[2]   = {"csh", "sh"};
04223   static const PrintMode  mode[2]     = {Csh, Sh};
04224 #endif
04225 
04226   cout << "Creating setup scripts." << endl;
04227 
04228   cmt_string no_cleanup_opt;
04229 
04230   if ((get_setup_strategy () & SetupCleanupMask) != SetupCleanup)
04231     {
04232       no_cleanup_opt = " -no_cleanup";
04233     }
04234 
04235   cmt_string temp;
04236   int i;
04237 
04238   for (i = 0; i < modes; i++)
04239     {
04240       cmt_string file_name = "setup";
04241       file_name += ".";
04242       file_name += suffix[i];
04243       file_name += ".";
04244       file_name += "new";
04245 
04246       FILE* f = fopen (file_name.c_str (), "wb");
04247       if (f != NULL)
04248         {
04249           if (mode[i] == Csh)
04250             {
04251               fprintf (f, "# echo \"Setting standalone package\"\n");
04252               fprintf (f, "\n");
04253 
04254               fprintf (f, "if ( $?CMTROOT == 0 ) then\n");
04255               fprintf (f, "  setenv CMTROOT %s\n", m_cmt_root.c_str ());
04256               fprintf (f, "endif\n");
04257               fprintf (f, "source ${CMTROOT}/mgr/setup.csh\n");
04258               fprintf (f, "set tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04259               fprintf (f, "if $status != 0 then\n  set tempfile=/tmp/cmt.$$\nendif\n");
04260               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}; "
04261                        "source ${tempfile}\n",
04262                        suffix[i].c_str (),
04263                        m_current_path.c_str (),
04264                        no_cleanup_opt.c_str ());
04265               fprintf (f, "/bin/rm -f ${tempfile}\n");
04266             }
04267           else if (mode[i] == Sh)
04268             {
04269               fprintf (f, "# echo \"Setting standalone package\"\n");
04270               fprintf (f, "\n");
04271 
04272               fprintf (f, "if test \"${CMTROOT}\" = \"\"; then\n");
04273               fprintf (f, "  CMTROOT=%s; export CMTROOT\n", m_cmt_root.c_str ());
04274               fprintf (f, "fi\n");
04275               fprintf (f, ". ${CMTROOT}/mgr/setup.sh\n");
04276               fprintf (f, "\n");
04277               fprintf (f, "tempfile=`${CMTROOT}/mgr/cmt -quiet build temporary_name`\n");
04278               fprintf (f, "if test ! $? = 0 ; then tempfile=/tmp/cmt.$$; fi\n");
04279               fprintf (f, "${CMTROOT}/mgr/cmt setup -%s -pack=cmt_standalone -path=%s %s $* >${tempfile}; "
04280                        ". ${tempfile}\n",
04281                        suffix[i].c_str (),
04282                        m_current_path.c_str (),
04283                        no_cleanup_opt.c_str ());
04284               fprintf (f, "/bin/rm -f ${tempfile}\n");
04285             }
04286           else
04287             {
04288               fprintf (f, "rem Setting standalone package\n");
04289               dos_script_prefix (f, m_cmt_root, 
04290                                  "cmt_standalone", "", m_current_path, 
04291                                  "setup", no_cleanup_opt);
04292             }
04293 
04294           fprintf (f, "\n");
04295 
04296           fclose (f);
04297 
04298           cmt_string old_file_name = "setup";
04299           old_file_name += ".";
04300           old_file_name += suffix[i];
04301 
04302           CmtSystem::compare_and_update_files (file_name, old_file_name);
04303         }
04304     }
04305 }

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.

Definition at line 4312 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(), m_action, m_cmt_config, m_current_access, m_current_config, m_current_dir, m_current_package, m_current_path, m_current_prefix, m_current_style, m_current_tag, m_current_version, m_default_path, m_quiet, m_recursive, Tag::mark(), mgr_style, no_version_style, none_style, CmtError::package_not_found, 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.

04316 {
04317   clear ();
04318   configure ();
04319 
04320   m_action  = action_load;
04321   m_recursive = true;
04322 
04323   if (((package != "") && (version != "")) || (m_current_package == ""))
04324     {
04325       //
04326       //  Here we want to connect to a new package, or to the current package
04327       //  but with another tag.
04328       //
04329       //   the 'package' argument may include a directory offset. Thus 'path'
04330       //  is only expected to hold the base directory.
04331       //
04332       cmt_string offset;
04333       cmt_string package_name;
04334       
04335       CmtSystem::dirname (package, offset);
04336       CmtSystem::basename (package, package_name);
04337       
04338       if (offset != "")
04339         {
04340           m_current_path = path;
04341           m_current_path += CmtSystem::file_separator ();
04342           m_current_path += offset;
04343         }
04344       else
04345         {
04346           m_current_path = path;
04347         }
04348       
04349       m_current_package = package_name;
04350       m_current_version = version;
04351     }
04352 
04353   if (tag_name != "")
04354     {
04355       Tag* tag;
04356 
04357       Tag::unmark_all ();
04358       configure_version_tag ();
04359       configure_site_tag (0);
04360       configure_uname_tag ();
04361       configure_hosttype_tag ();
04362 
04363       m_current_tag = tag_name;
04364 
04365       //if (!m_quiet) cerr << "load1> current_tag=" << m_current_tag << endl;
04366 
04367       tag = Tag::add (tag_name, PriorityTag, "load", 0);
04368       tag->mark ();
04369     }
04370 
04371   /*
04372     Set to developer mode if positioned into the package
04373     (which is detected since we were able to retreive the
04374     Version, Package and Path)
04375   */
04376 
04377   if ((m_current_path == "") ||
04378       (m_current_package == "") ||
04379       (m_current_version == ""))
04380     {
04381       m_current_access = UserMode;
04382     }
04383   else
04384     {
04385       m_current_access = DeveloperMode;
04386     }
04387 
04388   use_cmt ();
04389 
04390   cmt_string dir;
04391 
04392   /*
04393     Try to access the package.
04394   */
04395 
04396   if (m_current_path != "")
04397     {
04398       dir = m_current_path;
04399     }
04400   else
04401     {
04402       dir = m_default_path;
04403     }
04404 
04405   if (!CmtSystem::cd (m_current_path))
04406     {
04407       if (!m_quiet)
04408         {
04409           cerr << "#CMT> Cannot reach the directory " <<
04410             m_current_path << endl;
04411         }
04412       CmtError::set (CmtError::package_not_found, "Load> Cannot reach the path directory");
04413       CmtSystem::cd (m_current_dir);
04414 
04415       return (false);
04416     }
04417 
04418   dir += CmtSystem::file_separator ();
04419   dir += m_current_package;
04420 
04421   if (!CmtSystem::cd (m_current_package))
04422     {
04423       if (!m_quiet)
04424         {
04425           cerr << "#CMT::load> Cannot reach the package " <<
04426             m_current_package << endl;
04427         }
04428       CmtError::set (CmtError::package_not_found, "Load> Cannot reach the package directory");
04429       CmtSystem::cd (m_current_dir);
04430 
04431       return (false);
04432     }
04433 
04434   dir += CmtSystem::file_separator ();
04435   dir += m_current_version;
04436 
04437   m_current_style = none_style;
04438 
04439   if (!CmtSystem::cd (m_current_version))
04440     {
04441       if (!CmtSystem::test_directory ("cmt"))
04442         {
04443           if (!m_quiet)
04444             {
04445               cerr << "#CMT> Cannot reach the version " <<
04446                 m_current_version << endl;
04447             }
04448           CmtError::set (CmtError::package_not_found, "Load> Cannot reach the version directory");
04449           CmtSystem::cd (m_current_dir);
04450 
04451           return (false);
04452         }
04453       else
04454         {
04455           m_current_style = no_version_style;
04456         }
04457     }
04458 
04459   if (CmtSystem::cd ("cmt"))
04460     {
04461       dir += CmtSystem::file_separator ();
04462       dir += "cmt";
04463       if (m_current_style == none_style) m_current_style = cmt_style;
04464     }
04465   else
04466     {
04467       /*
04468         if (!m_quiet)
04469         {
04470         cerr << "Cannot reach the cmt branch" << endl;
04471         }
04472       */
04473 
04474       if (CmtSystem::cd ("mgr"))
04475         {
04476           dir += CmtSystem::file_separator ();
04477           dir += "mgr";
04478           if (m_current_style == none_style) m_current_style = mgr_style;
04479         }
04480       else
04481         {
04482           if (!m_quiet)
04483             {
04484               cerr << "#CMT> Cannot reach the mgr branch" << endl;
04485             }
04486 
04487           CmtError::set (CmtError::package_not_found,
04488                          "Load> Cannot reach the mgr/cmt directory");
04489           CmtSystem::cd (m_current_dir);
04490 
04491           return (false);
04492         }
04493     }
04494 
04495   /*
04496     Check Tag is always set up
04497   */
04498 
04499   if (m_current_tag == "")
04500     {
04501       char* env;
04502 
04503       env = getenv (m_current_config.c_str ());
04504       if (env != 0)
04505         {
04506           Tag* tag;
04507 
04508           tag = Tag::add (env, PriorityConfig, "load", 0);
04509           tag->mark ();
04510           m_current_tag = env;
04511 
04512           //if (!m_quiet) cerr << "load2> current_tag=" << m_current_tag << endl;
04513 
04514         }
04515       else
04516         {
04517           m_current_tag = m_cmt_config;
04518 
04519           //if (!m_quiet) cerr << "load3> current_tag=" << m_current_tag << endl;
04520 
04521         }
04522     }
04523 
04524   if (m_debug)
04525     {
04526       cout << "pwd = " << CmtSystem::pwd () << endl;
04527     }
04528 
04529   configure_current_dir ();
04530   build_prefix (m_current_package, m_current_prefix);
04531   build_config (m_current_prefix, m_current_config);
04532 
04533   Use* use = &(Use::current());
04534   use->path    = m_current_path;
04535   use->set_package_name (m_current_package);
04536   use->version = m_current_version;
04537   use->prefix  = m_current_prefix;
04538   use->done    = false;
04539   use->style   = m_current_style;
04540 
04541   /*
04542     Work on the requirements file.
04543   */
04544 
04545   dir += CmtSystem::file_separator ();
04546   dir += "requirements";
04547   SyntaxParser::parse_requirements (dir, use);
04548 
04549   if (CmtError::has_pending_error ()) return (false);
04550 
04554   Pattern::apply_all_globals ();
04555 
04556   /*
04557     Select all possible tags
04558   */
04559 
04560   Tag::restore_tree ();
04561 
04562   return (true);
04563 }

bool Cmt::need_prototypes (? ? )? [static]
?

See reach_current_package for an explanation of this call.

Definition at line 4566 of file cmt_parser.cxx.

References get_build_strategy(), Prototypes, and PrototypesMask.

Referenced by Constituent::add().

04567 {
04568   if ((get_build_strategy () & PrototypesMask) == Prototypes) return (true);
04569   else return (false);
04570 }

void Cmt::parse_arguments (? int? ? argc,
char *? ? argv[],
CmtSystem::cmt_string_vector &? ? arguments,
cmt_string &? ? extra_line,
cmt_string &? ? extra_file,
PrintMode &? ? mode
)? [static]
?

Definition at line 4573 of file cmt_parser.cxx.

References action_awk, action_broadcast, action_build, 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, 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_cvstags, action_do, action_expand_model, action_filter, action_help, 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_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, Tag::add(), cmt_vector< cmt_string >::add(), CmtSystem::add_cmt_path(), Bat, block_private_uses, cmt_vector< cmt_string >::clear(), Tag::clear_all(), configure_config_tag(), configure_home(), configure_hosttype_tag(), configure_site_tag(), configure_uname_tag(), configure_version_tag(), Csh, Use::current(), default_filtering_mode, cmt_string::erase(), cmt_string::find(), CmtSystem::get_cmt_config(), ProjectFactory::instance(), m_action, m_build_nmake, m_cmt_home, m_cmt_user_context, m_current_access, m_current_package, m_current_path, m_current_setup_strategy, m_current_structuring_style, m_current_tag, m_current_target, m_current_version, m_default_path, m_extra_tags, m_help_action, m_quiet, m_scope_filtering_mode, m_simulation, Tag::mark(), cmt_string::npos, PrintMode, PriorityArgument, PriorityTag, PriorityUserTag, reach_private_uses, restore_all_tags(), set_scope_filtering_mode(), SetupNoCleanup, Sh, cmt_vector< cmt_string >::size(), cmt_string::size(), CmtSystem::split(), cmt_string::substr(), Tag::tags(), CmtSystem::test_directory(), CmtSystem::testenv(), Tag::unmark_all(), UserMode, with_version_directory, and without_version_directory.

Referenced by parser().

04578 {
04579   /*
04580     Decoding arguments.
04581 
04582     While decoding all arguments, no requirements analysis should
04583     occur. Every new option, or parameter should be saved and
04584     used later at actual analysis time.
04585   */
04586 
04587   cmt_string arg;
04588 
04589   m_action = action_none;
04590   m_help_action = action_none;
04591 
04592   arguments.clear ();
04593   extra_line.erase (0);
04594   extra_file.erase (0);
04595   mode = Csh;
04596 
04597     /*
04598       Tag management.
04599       ---------------
04600 
04601       Tag settings may come from :
04602 
04603       - existing environment variables:
04604 
04605           1) CMTCONFIG
04606 
04607           2) CMTEXTRATAGS for addons
04608 
04609       - arguments:
04610 
04611           -tag=
04612           -tag_add=
04613           -tag_remove=
04614 
04615        o Arguments should take precedence over environment variables.
04616        o when nothing is specified:
04617 
04618           - primary tag = CMTCONFIG
04619           - tag set is empty
04620 
04621 
04622      */
04623 
04624 
04625   restore_all_tags (0);
04626 
04627 #ifdef WIN32
04628   m_build_nmake = true;
04629 #endif
04630 
04631   while (argc > 1)
04632     {
04633       int lf;
04634 
04635       arg = argv[1];
04636       lf = arg.find ('\r');
04637       if (lf != cmt_string::npos) arg.erase (lf);
04638 
04639       if ((arg[0] == '\"') && (arg[arg.size () - 1] == '\"'))
04640         {
04641           arg.erase (0, 1);
04642           arg.erase (arg.size () - 1, 1);
04643         }
04644 
04645       //fprintf (stderr, "arg=[%s]\n", arg.c_str ());
04646 
04647       switch (arg[0])
04648         {
04649         case 'a' :
04650           if (arg == "awk")
04651             {
04652               argc--;
04653               argv++;
04654               while (argc > 1)
04655                 {
04656                   cmt_string& s = arguments.add ();
04657                   s = argv[1];
04658                   argc--;
04659                   argv++;
04660                 }
04661 
04662               m_action = action_awk;
04663             }
04664           break;
04665         case 'b' :
04666           if ((arg == "b") ||
04667               (arg == "br") ||
04668               (arg == "bro") ||
04669               (arg == "broa") ||
04670               (arg == "broad") ||
04671               (arg == "broadc") ||
04672               (arg == "broadca") ||
04673               (arg == "broadcas") ||
04674               (arg == "broadcast"))
04675             {
04676               argc--;
04677               argv++;
04678               while (argc > 1)
04679                 {
04680                   cmt_string& s = arguments.add ();
04681                   s = argv[1];
04682                   argc--;
04683                   argv++;
04684                 }
04685 
04686               m_action = action_broadcast;
04687 
04688               if (m_scope_filtering_mode == default_filtering_mode)
04689                 {
04690                   set_scope_filtering_mode (reach_private_uses);
04691                 }
04692             }
04693           else if (arg == "build")
04694             {
04695               argc--;
04696               argv++;
04697 
04698               if (argc > 1)
04699                 {
04700                   arg = argv[1];
04701 
04702                   if (arg == "-nmake")
04703                     {
04704                       m_build_nmake = true;
04705                       argc--;
04706                       argv++;
04707                     }
04708                 }
04709 
04710               if (argc > 1)
04711                 {
04712                   arg = argv[1];
04713 
04714                   if (arg == "-nmake")
04715                     {
04716                       argc--;
04717                       argv++;
04718                     }
04719 
04720                   if (arg == "constituent_makefile")
04721                     {
04722                       argc--;
04723                       argv++;
04724                       if (argc > 1)
04725                         {
04726                           cmt_string& s = arguments.add ();
04727                           s = argv[1];
04728 
04729                           m_action = action_build_constituent_makefile;
04730                         }
04731                       else
04732                         {
04733                           if (!m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl;
04734                           m_action = action_build_constituent_makefile;
04735                           m_help_action = action_help;
04736                         }
04737                     }
04738                   else if (arg == "constituents_makefile")
04739                     {
04740                       argc--;
04741                       argv++;
04742                       while (argc > 1)
04743                         {
04744                           cmt_string& s = arguments.add ();
04745                           s = argv[1];
04746                           argc--;
04747                           argv++;
04748                         }
04749 
04750                       m_action = action_build_constituents_makefile;
04751                     }
04752                   else if (arg == "dependencies")
04753                     {
04754                       argc--;
04755                       argv++;
04756                       if (argc > 1)
04757                         {
04758                           cmt_string& s = arguments.add ();
04759                           s = argv[1];
04760 
04761                           m_action = action_build_dependencies;
04762                         }
04763                       else
04764                         {
04765                           if (!m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl;
04766                           m_help_action = action_help;
04767                           m_action = action_build_dependencies;
04768                         }
04769 
04770                       argc = 0;
04771                     }
04772                   else if (arg == "library_links")
04773                     {
04774                       m_action = action_build_library_links;
04775                     }
04776                   else if (arg == "make_setup")
04777                     {
04778                       m_action = action_build_make_setup;
04779                     }
04780                   else if (arg == "msdev")
04781                     {
04782                       argc--;
04783                       argv++;
04784 
04785                       if (argc > 1)
04786                         {
04787                           cmt_string& s = arguments.add ();
04788                           s = argv[1];
04789                           if (s[0] == '-')
04790                             {
04791                               s = "";
04792                               argc++;
04793                               argv--;
04794                             }
04795                         }
04796 
04797                       m_action = action_build_msdev;
04798                     }
04799                   else if (arg == "CMT_pacman")
04800                     {
04801                       m_action = action_build_CMT_pacman;
04802                     }
04803                   else if (arg == "vsnet") 
04804                     {                                              
04805                        argc--;                                      
04806                        argv++;                                      
04807                                                                     
04808                        if (argc > 1)                                
04809                          {                                          
04810                            cmt_string& s = arguments.add ();        
04811                            s = argv[1];                             
04812                            if (s[0] == '-')                         
04813                              {                                      
04814                                s = "";                              
04815                                argc++;                              
04816                                argv--;                              
04817                              }                                      
04818                          }                                          
04819                                                                     
04820                        m_action = action_build_vsnet;                 
04821                      }                                              
04822                   else if (arg == "os9_makefile")
04823                     {
04824                       argc--;
04825                       argv++;
04826                       if (argc > 1)
04827                         {
04828                           cmt_string& s = arguments.add ();
04829                           s = argv[1];
04830 
04831                           m_action = action_build_os9_makefile;
04832                         }
04833                       else
04834                         {
04835                           if (!m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl;
04836                           m_help_action = action_help;
04837                           m_action = action_build_os9_makefile;
04838                         }
04839                     }
04840                   else if (arg == "prototype")
04841                     {
04842                       argc--;
04843                       argv++;
04844                       if (argc > 1)
04845                         {
04846                           cmt_string& s = arguments.add ();
04847                           s = argv[1];
04848 
04849                           m_action = action_build_prototype;
04850                         }
04851                       else
04852                         {
04853                           if (!m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl;
04854                           m_help_action = action_help;
04855                           m_action = action_build_prototype;
04856                         }
04857                     }
04858                   else if (arg == "readme")
04859                     {
04860                       m_action = action_build_readme;
04861 
04862                       argc--;
04863                       argv++;
04864                       while (argc > 1)
04865                         {
04866                           cmt_string& s = arguments.add ();
04867                           s = argv[1];
04868                           argc--;
04869                           argv++;
04870                         }
04871                     }
04872                   else if (arg == "tag_makefile")
04873                     {
04874                       m_action = action_build_tag_makefile;
04875                     }
04876                   else if (arg == "temporary_name")
04877                     {
04878                       m_action = action_build_temporary_name;
04879                     }
04880                   else if (arg == "triggers")
04881                     {
04882                       argc--;
04883                       argv++;
04884                       if (argc > 1)
04885                         {
04886                           cmt_string& s = arguments.add ();
04887                           s = argv[1];
04888 
04889                           m_action = action_build_triggers;
04890                         }
04891                       else
04892                         {
04893                           if (!m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl;
04894                           m_help_action = action_help;
04895                           m_action = action_build_triggers;
04896                         }
04897                     }
04898                   else if (arg == "windefs")
04899                     {
04900                       argc--;
04901                       argv++;
04902                       if (argc > 1)
04903                         {
04904                           cmt_string& s = arguments.add ();
04905                           s = argv[1];
04906 
04907                           m_action = action_build_windefs;
04908                         }
04909                       else
04910                         {
04911                           if (!m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl;
04912                           m_help_action = action_help;
04913                           m_action = action_build_windefs;
04914                         }
04915                     }
04916                   else
04917                     {
04918                       if (!m_quiet) cerr << "#CMT> syntax error : wrong argument" << endl;
04919                       m_help_action = action_help;
04920                       m_action = action_build;
04921                     }
04922                 }
04923               else
04924                 {
04925                   if (!m_quiet) cerr << "#CMT> syntax error : don't know what to build" << endl;
04926                   m_help_action = action_help;
04927                   m_action = action_build;
04928                 }
04929             }
04930           else
04931             {
04932               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
04933               m_help_action = action_help;
04934             }
04935           break;
04936         case 'c' :
04937           if (arg == "check")
04938             {
04939               argc--;
04940               argv++;
04941 
04942               if (argc > 1)
04943                 {
04944                   arg = argv[1];
04945 
04946                   if (arg == "configuration")
04947                     {
04948                       m_action = action_check_configuration;
04949                     }
04950                   else if (arg == "files")
04951                     {
04952                       argc--;
04953                       argv++;
04954                       if (argc > 1)
04955                         {
04956                           cmt_string& s = arguments.add ();
04957                           s = argv[1];
04958                           argc--;
04959                           argv++;
04960                           if (argc > 1)
04961                             {
04962                               cmt_string& s = arguments.add ();
04963                               s = argv[1];
04964 
04965                               m_action = action_check_files;
04966                             }
04967                           else
04968                             {
04969                               if (!m_quiet) cerr << "#CMT> syntax error : reference file name missing" 
04970                                                  << endl;
04971                               m_help_action = action_help;
04972                               m_action = action_check_files;
04973                             }
04974                         }
04975                       else
04976                         {
04977                           if (!m_quiet) cerr << "#CMT> syntax error : file name missing" << endl;
04978                           m_help_action = action_help;
04979                           m_action = action_check_files;
04980                         }
04981                     }
04982                   else if (arg == "version")
04983                     {
04984                       argc--;
04985                       argv++;
04986                       if (argc > 1)
04987                         {
04988                           cmt_string& s = arguments.add ();
04989                           s = argv[1];
04990 
04991                           m_action = action_check_version;
04992                         }
04993                       else
04994                         {
04995                           if (!m_quiet) cerr << "#CMT> syntax error : package name missing" << endl;
04996                           m_help_action = action_help;
04997                           m_action = action_check_version;
04998                         }
04999                     }
05000                   else
05001                     {
05002                       if (!m_quiet) cerr << "#CMT> syntax error : bad check option" << endl;
05003                       m_help_action = action_help;
05004                       m_action = action_check;
05005                     }
05006                 }
05007               else
05008                 {
05009                   if (!m_quiet) cerr << "#CMT> syntax error : don't know what to check" << endl;
05010                   m_help_action = action_help;
05011                   m_action = action_check;
05012                 }
05013             }
05014           else if (arg == "check_files")
05015             {
05016               argc--;
05017               argv++;
05018               if (argc > 1)
05019                 {
05020                   cmt_string& s = arguments.add ();
05021                   s = argv[1];
05022                   argc--;
05023                   argv++;
05024                   if (argc > 1)
05025                     {
05026                       cmt_string& s = arguments.add ();
05027                       s = argv[1];
05028 
05029                       m_action = action_check_files;
05030                     }
05031                   else
05032                     {
05033                       if (!m_quiet) cerr << "#CMT> syntax error : reference file missing" << endl;
05034                       m_help_action = action_help;
05035                       m_action = action_check_files;
05036                     }
05037                 }
05038               else
05039                 {
05040                   if (!m_quiet) cerr << "#CMT> syntax error : file name missing" << endl;
05041                   m_help_action = action_help;
05042                   m_action = action_check_files;
05043                 }
05044             }
05045           else if ((arg == "co") ||
05046                    (arg == "checkout"))
05047             {
05048               // handle all of the command line arguments in a vector
05049               argc--;
05050               argv++;
05051               if (argc > 1)
05052                 {
05053                   m_action = action_checkout;
05054 
05055                   while (argc > 1)
05056                     {
05057                       cmt_string& s = arguments.add ();
05058                       s = argv[1];
05059                       argc--;
05060                       argv++;
05061                     }
05062                 }
05063               else
05064                 {
05065                   if (!m_quiet) cerr << "#CMT> syntax error : checkout arguments missing" << endl;
05066                   m_help_action = action_help;
05067                   m_action = action_checkout;
05068                 }
05069             }
05070           else if (arg == "cleanup")
05071             {
05072               m_action = action_cleanup;
05073             }
05074           else if (arg == "config")
05075             {
05076               argc--;
05077               argv++;
05078               if (argc > 1)
05079                 {
05080                   cerr << "#---------------------------------------------------------" << endl;
05081                   cerr << "# Warning: using 'cmt config ...' to create a package is "
05082                     "becoming obsolete" << endl;
05083                   cerr << "# Please use 'cmt create ...' instead" << endl;
05084                   cerr << "#---------------------------------------------------------" << endl;
05085 
05086                   m_current_package = argv[1];
05087                   m_current_version.erase (0);
05088                   m_current_path.erase (0);
05089 
05090                   argc--;
05091                   argv++;
05092                   if (argc > 1)
05093                     {
05094                       m_current_version = argv[1];
05095 
05096                       {
05097                         cmt_string& s = arguments.add ();
05098                         s = m_current_package;
05099                       }
05100                       {
05101                         cmt_string& s = arguments.add ();
05102                         s = m_current_version;
05103                       }
05104 
05105                       argc--;
05106                       argv++;
05107                       if (argc > 1)
05108                         {
05109                           m_current_path = argv[1];
05110                           if (m_current_path[0] == '-')
05111                             {
05112                               m_current_path.erase (0);
05113                             }
05114                         }
05115 
05116                       m_action = action_create;
05117                     }
05118                   else
05119                     {
05120                       if (!m_quiet) cerr << "#CMT> syntax error : create arguments missing" << endl;
05121                       m_help_action = action_help;
05122                       m_action = action_create;
05123                     }
05124                 }
05125               else
05126                 {
05127                   m_action = action_config;
05128                 }
05129             }
05130           else if (arg == "create")
05131             {
05132               argc--;
05133               argv++;
05134 
05135               if (argc > 1)
05136                 {
05137                   while (argc > 1)
05138                     {
05139                       cmt_string& s = arguments.add ();
05140                       s = argv[1];
05141                       argc--;
05142                       argv++;
05143                     }
05144 
05145                   m_action = action_create;
05146                 }
05147               else
05148                 {
05149                   if (!m_quiet) cerr << "#CMT> syntax error : create arguments missing" << endl;
05150                   m_help_action = action_help;
05151                   m_action = action_create;
05152                 }
05153             }
05154           else if (arg == "create_project")
05155             {
05156               argc--;
05157               argv++;
05158 
05159               if (argc > 1)
05160                 {
05161                   while (argc > 1)
05162                     {
05163                       cmt_string& s = arguments.add ();
05164                       s = argv[1];
05165                       argc--;
05166                       argv++;
05167                     }
05168 
05169                   m_action = action_create_project;
05170                 }
05171               else
05172                 {
05173                   if (!m_quiet) cerr << "#CMT> syntax error : create_project arguments missing" << endl;
05174                   m_help_action = action_help;
05175                   m_action = action_create_project;
05176                 }
05177             }
05178           else if (arg == "cvsbranches")
05179             {
05180               argc--;
05181               argv++;
05182               if (argc > 1)
05183                 {
05184                   cmt_string& s = arguments.add ();
05185                   s = argv[1];
05186                   argc--;
05187                   argv++;
05188 
05189                   m_action = action_cvsbranches;
05190                 }
05191               else
05192                 {
05193                   if (!m_quiet) cerr << "#CMT> syntax error : cvsbranches arguments missing" << endl;
05194                   m_help_action = action_help;
05195                   m_action = action_cvsbranches;
05196                 }
05197             }
05198           else if (arg == "cvssubpackages")
05199             {
05200               argc--;
05201               argv++;
05202               if (argc > 1)
05203                 {
05204                   cmt_string& s = arguments.add ();
05205                   s = argv[1];
05206                   argc--;
05207                   argv++;
05208 
05209                   m_action = action_cvssubpackages;
05210                 }
05211               else
05212                 {
05213                   if (!m_quiet) cerr << "#CMT> syntax error : cvssubpackages arguments missing" << endl;
05214                   m_help_action = action_help;
05215                   m_action = action_cvssubpackages;
05216                 }
05217             }
05218           else if (arg == "cvstags")
05219             {
05220               argc--;
05221               argv++;
05222               if (argc > 1)
05223                 {
05224                   while (argc > 1)
05225                     {
05226                       cmt_string& s = arguments.add ();
05227                       s = argv[1];
05228                       argc--;
05229                       argv++;
05230                     }
05231 
05232                   m_action = action_cvstags;
05233                 }
05234               else
05235                 {
05236                   if (!m_quiet) cerr << "#CMT> syntax error : package name missing" << endl;
05237                   m_help_action = action_help;
05238                   m_action = action_cvstags;
05239                 }
05240             }
05241           else
05242             {
05243               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
05244               m_help_action = action_help;
05245             }
05246           break;
05247         case 'd' :
05248           if (arg == "do")
05249             {
05250               argc--;
05251               argv++;
05252 
05253               if (argc > 1)
05254                 {
05255                   while (argc > 1)
05256                     {
05257                       cmt_string& s = arguments.add ();
05258                       s = argv[1];
05259                       argc--;
05260                       argv++;
05261                     }
05262                   
05263                   {
05264                     cmt_string tag_name = "target_";
05265                     tag_name += arguments[0];
05266 
05267                     Tag* tag;
05268                     tag = Tag::add (tag_name, PriorityUserTag, "action", 0);                      
05269                     tag->mark ();
05270                   }
05271 
05272                   m_action = action_do;
05273                 }
05274               else
05275                 {
05276                   if (!m_quiet) cerr << "#CMT> syntax error : action not specified" << endl;
05277                   m_help_action = action_help;
05278                   m_action = action_do;
05279                 }
05280             }
05281           else
05282             {
05283               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
05284               m_help_action = action_help;
05285             }
05286           break;
05287         case 'e' :
05288           if (arg == "expand")
05289             {
05290               argc--;
05291               argv++;
05292 
05293               if (argc > 1)
05294                 {
05295                   arg = argv[1];
05296 
05297                   if (arg == "model")
05298                     {
05299                       argc--;
05300                       argv++;
05301 
05302                       if (argc > 1)
05303                         {
05304                           while (argc > 1)
05305                             {
05306                               cmt_string& s = arguments.add ();
05307                               s = argv[1];
05308                               argc--;
05309                               argv++;
05310                             }
05311 
05312                           m_action = action_expand_model;
05313                         }
05314                       else
05315                         {
05316                           if (!m_quiet) cerr << "#CMT> syntax error : model not specified" << endl;
05317                           m_help_action = action_help;
05318                           m_action = action_expand_model;
05319                         }
05320                     }
05321                   else
05322                     {
05323                       if (!m_quiet) cerr << "#CMT> syntax error : bad expand option" << endl;
05324                       m_help_action = action_help;
05325                       m_action = action_expand_model;
05326                     }
05327                 }
05328               else
05329                 {
05330                   if (!m_quiet) cerr << "#CMT> syntax error : don't know what to expand" << endl;
05331                   m_help_action = action_help;
05332                   m_action = action_expand_model;
05333                 }
05334             }
05335           else
05336             {
05337               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
05338               m_help_action = action_help;
05339             }
05340           break;
05341         case 'f' :
05342           if ((arg == "f") ||
05343               (arg == "fi") ||
05344               (arg == "fil") ||
05345               (arg == "filt") ||
05346               (arg == "filte") ||
05347               (arg == "filter"))
05348             {
05349               // handle all of the command line arguments in a vector
05350               argc--;
05351               argv++;
05352               while (argc > 1)
05353                 {
05354                   cmt_string& s = arguments.add ();
05355                   s = argv[1];
05356                   argc--;
05357                   argv++;
05358                 }
05359 
05360               m_action = action_filter;
05361             }
05362           else
05363             {
05364               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
05365               m_help_action = action_help;
05366             }
05367           break;
05368         case 'h' :
05369           if ((arg == "h") ||
05370               (arg == "he") ||
05371               (arg == "hel") ||
05372               (arg == "help"))
05373             {
05374               m_help_action = action_help;
05375             }
05376           else
05377             {
05378               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
05379               m_help_action = action_help;
05380             }
05381           break;
05382         case 'l' :
05383           if (arg == "lock")
05384             {
05385               argc--;
05386               argv++;
05387               if (argc > 1)
05388                 {
05389                   m_current_package = argv[1];
05390                   {
05391                     cmt_string& s = arguments.add ();
05392                     s = m_current_package;
05393                   }
05394 
05395                   m_current_version.erase (0);
05396                   m_current_path.erase (0);
05397 
05398                   argc--;
05399                   argv++;
05400                   if (argc > 1)
05401                     {
05402                       m_current_version = argv[1];
05403 
05404                       {
05405                         cmt_string& s = arguments.add ();
05406                         s = m_current_version;
05407                       }
05408                     
05409                       m_action = action_lock;
05410 
05411                       argc--;
05412                       argv++;
05413                       if (argc > 1)
05414                         {
05415                           m_current_path = argv[1];
05416                           if (m_current_path[0] == '-')
05417                             {
05418                               m_current_path.erase (0);
05419                             }
05420                         }
05421 
05422                       m_current_access = UserMode;
05423                       (Use::current()).set (m_current_package, 
05424                                             m_current_version, 
05425                                             m_current_path);
05426 
05427                     }
05428                   else
05429                     {
05430                       if (!m_quiet) cerr << "#CMT> syntax error : version missing" << endl;
05431                       m_help_action = action_help;
05432                       m_action = action_lock;
05433                     }
05434                 }
05435               else
05436                 {
05437                   m_action = action_lock;
05438                 }
05439             }
05440           else
05441             {
05442               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
05443               m_help_action = action_help;
05444             }
05445           break;
05446         case 'r' :
05447           if (arg == "remove")
05448             {
05449               argc--;
05450               argv++;
05451 
05452               if (argc > 1)
05453                 {
05454                   arg = argv[1];
05455 
05456                   if (arg == "library_links")
05457                     {
05458                       m_action = action_remove_library_links;
05459                     }
05460                   else
05461                     {
05462                       m_current_package = argv[1];
05463                       {
05464                         cmt_string& s = arguments.add ();
05465                         s = m_current_package;
05466                       }
05467                       
05468                       m_current_version.erase (0);
05469                       m_current_path.erase (0);
05470                       
05471                       argc--;
05472                       argv++;
05473                       if (argc > 1)
05474                         {
05475                           m_current_version = argv[1];
05476                           
05477                           {
05478                             cmt_string& s = arguments.add ();
05479                             s = m_current_version;
05480                           }
05481                           
05482                           argc--;
05483                           argv++;
05484                           if (argc > 1)
05485                             {
05486                               m_current_path = argv[1];
05487                               if (m_current_path[0] == '-')
05488                                 {
05489                                   m_current_path.erase (0);
05490                                 }
05491                             }
05492                             
05493                           m_action = action_remove;
05494                         }
05495                       else
05496                         {
05497                           if (!m_quiet) cerr << "#CMT> syntax error : version missing" << endl;
05498                           m_help_action = action_help;
05499                           m_action = action_remove;
05500                         }
05501                     }
05502                 }
05503               else
05504                 {
05505                   if (!m_quiet) cerr << "#CMT> syntax error : don't know what to remove" << endl;
05506                   m_help_action = action_help;
05507                   m_action = action_remove;
05508                 }
05509             }
05510           else if (arg == "run")
05511             {
05512               argc--;
05513               argv++;
05514               if (argc > 1)
05515                 {
05516                   cmt_string& s = arguments.add ();
05517                   s = argv[1];
05518 
05519                   m_action = action_run;
05520                 }
05521               else
05522                 {
05523                   if (!m_quiet) cerr << "#CMT> syntax error : run arguments missing" << endl;
05524                   m_help_action = action_help;
05525                   m_action = action_run;
05526                 }
05527             }
05528           else if (arg == "run_sequence")
05529             {
05530               argc--;
05531               argv++;
05532               if (argc > 1)
05533                 {
05534                   cmt_string& s = arguments.add ();
05535                   s = argv[1];
05536 
05537                   m_action = action_run_sequence;
05538                 }
05539               else
05540                 {
05541                   if (!m_quiet) cerr << "#CMT> syntax error : run_sequence arguments missing" << endl;
05542                   m_help_action = action_help;
05543                   m_action = action_run_sequence;
05544                 }
05545             }
05546           else
05547             {
05548               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
05549               m_help_action = action_help;
05550             }
05551           break;
05552         case 's' :
05553           if (arg == "set")
05554             {
05555               argc--;
05556               argv++;
05557               if (argc > 1)
05558                 {
05559                   arg = argv[1];
05560 
05561                   if (arg == "version")
05562                     {
05563                       argc--;
05564                       argv++;
05565 
05566                       while (argc > 1)
05567                         {
05568                           cmt_string& s = arguments.add ();
05569                           s = argv[1];
05570                           argc--;
05571                           argv++;
05572                         }
05573 
05574                       m_action = action_set_version;
05575                     }
05576                   else if (arg == "versions")
05577                     {
05578                       argc--;
05579                       argv++;
05580 
05581                       while (argc > 1)
05582                         {
05583                           cmt_string& s = arguments.add ();
05584                           s = argv[1];
05585                           argc--;
05586                           argv++;
05587                         }
05588 
05589                       m_action = action_set_versions;
05590 
05591                       if (m_scope_filtering_mode == default_filtering_mode)
05592                         {
05593                           set_scope_filtering_mode (reach_private_uses);
05594                         }
05595                     }
05596                   else
05597                     {
05598                       if (!m_quiet) cerr << "#CMT> syntax error : bad set argument" << endl;
05599                       m_help_action = action_help;
05600                       //m_action = action_set;
05601                     }
05602                 }
05603               else
05604                 {
05605                   if (!m_quiet) cerr << "#CMT> syntax error : don't know what to set" << endl;
05606                   m_help_action = action_help;
05607                   //m_action = action_set;
05608                 }
05609             }
05610           else if (arg == "setup")
05611             {
05612               m_action = action_setup;
05613             }
05614           else if ((arg == "s") ||
05615                    (arg == "sh") ||
05616                    (arg == "sho") ||
05617                    (arg == "show"))
05618             {
05619               argc--;
05620               argv++;
05621               if (argc > 1)
05622                 {
05623                   arg = argv[1];
05624 
05625                   if (arg == "action")
05626                     {
05627                       argc--;
05628                       argv++;
05629                       if (argc > 1)
05630                         {
05631                           cmt_string& s = arguments.add ();
05632                           s = argv[1];
05633                           m_current_target = argv[1];
05634 
05635                           m_action = action_show_action;
05636                         }
05637                       else
05638                         {
05639                           if (!m_quiet) cerr << "#CMT> syntax error : action name missing" << endl;
05640                           m_help_action = action_help;
05641                           m_action = action_show_action;
05642                         }
05643                     }
05644                   else if (arg == "action_names")
05645                     {
05646                       argc--;
05647                       argv++;
05648                       if (argc > 1)
05649                         {
05650                           cmt_string& s = arguments.add ();
05651                           s = argv[1];
05652                         }
05653 
05654                       m_action = action_show_action_names;
05655                     }
05656                   else if (arg == "action_value")
05657                     {
05658                       m_quiet = true;
05659                       argc--;
05660                       argv++;
05661                       if (argc > 1)
05662                         {
05663                           cmt_string& s = arguments.add ();
05664                           s = argv[1];
05665                           m_current_target = argv[1];
05666 
05667                           m_action = action_show_action_value;
05668                         }
05669                       else
05670                         {
05671                           if (!m_quiet) cerr << "#CMT> syntax error : action name missing" << endl;
05672                           m_help_action = action_help;
05673                           m_action = action_show_action_value;
05674                         }
05675                     }
05676                   else if (arg == "actions")
05677                     {
05678                       argc--;
05679                       argv++;
05680                       if (argc > 1)
05681                         {
05682                           cmt_string& s = arguments.add ();
05683                           s = argv[1];
05684                         }
05685 
05686                       m_action = action_show_actions;
05687                     }
05688                   else if (arg == "all_tags")
05689                     {
05690                       m_action = action_show_all_tags;
05691                     }
05692                   else if (arg == "applied_patterns")
05693                     {
05694                       m_action = action_show_applied_patterns;
05695                     }
05696                   else if (arg == "author")
05697                     {
05698                       m_action = action_show_author;
05699                     }
05700                   else if (arg == "branches")
05701                     {
05702                       m_action = action_show_branches;
05703                     }
05704                   else if (arg == "clients")
05705                     {
05706                       argc--;
05707                       argv++;
05708                       if (argc > 1)
05709                         {
05710                           cmt_string& s = arguments.add ();
05711                           s = argv[1];
05712                           m_current_target = argv[1];
05713 
05714                           m_action = action_show_clients;
05715 
05716                           argc--;
05717                           argv++;
05718                           if (argc > 1)
05719                             {
05720                               cmt_string& s = arguments.add ();
05721                               s = argv[1];
05722 
05723                               argc--;
05724                               argv++;
05725                               if (argc > 1)
05726                                 {
05727                                   cmt_string& s = arguments.add ();
05728                                   s = argv[1];
05729                                 }
05730                             }
05731                         }
05732                       else
05733                         {
05734                           if (!m_quiet) cerr << "#CMT> syntax error : package name missing" << endl;
05735                           m_help_action = action_help;
05736                           m_action = action_show_clients;
05737                         }
05738                     }
05739                   else if (arg == "cmtpath_patterns")
05740                     {
05741                       m_action = action_show_cmtpath_patterns;
05742                     }
05743                   else if (arg == "constituent")
05744                     {
05745                       argc--;
05746                       argv++;
05747                       if (argc > 1)
05748                         {
05749                           cmt_string& s = arguments.add ();
05750                           s = argv[1];
05751                           m_current_target = argv[1];
05752 
05753                           m_action = action_show_constituent;
05754                         }
05755                       else
05756                         {
05757                           if (!m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl;
05758                           m_help_action = action_help;
05759                           m_action = action_show_constituent;
05760                         }
05761                     }
05762                   else if (arg == "constituent_names")
05763                     {
05764                       m_action = action_show_constituent_names;
05765                     }
05766                   else if (arg == "constituents")
05767                     {
05768                       m_action = action_show_constituents;
05769                     }
05770                   else if (arg == "cycles")
05771                     {
05772                       m_action = action_show_cycles;
05773                     }
05774                   else if (arg == "fragment")
05775                     {
05776                       argc--;
05777                       argv++;
05778                       if (argc > 1)
05779                         {
05780                           cmt_string& s = arguments.add ();
05781                           s = argv[1];
05782                           m_current_target = argv[1];
05783 
05784                           m_action = action_show_fragment;
05785                         }
05786                       else
05787                         {
05788                           if (!m_quiet) cerr << "#CMT> syntax error : fragment name missing" << endl;
05789                           m_help_action = action_help;
05790                           m_action = action_show_fragment;
05791                         }
05792                     }
05793                   else if (arg == "fragments")
05794                     {
05795                       m_action = action_show_fragments;
05796                     }
05797                   else if (arg == "groups")
05798                     {
05799                       m_action = action_show_groups;
05800                     }
05801                   else if (arg == "include_dirs")
05802                     {
05803                       m_action = action_show_include_dirs;
05804                     }
05805                   else if (arg == "language")
05806                     {
05807                       argc--;
05808                       argv++;
05809                       if (argc > 1)
05810                         {
05811                           cmt_string& s = arguments.add ();
05812                           s = argv[1];
05813                           m_current_target = argv[1];
05814 
05815                           m_action = action_show_language;
05816                         }
05817                       else
05818                         {
05819                           if (!m_quiet) cerr << "#CMT> syntax error : language name missing" << endl;
05820                           m_help_action = action_help;
05821                           m_action = action_show_language;
05822                         }
05823                     }
05824                   else if (arg == "languages")
05825                     {
05826                       m_action = action_show_languages;
05827                     }
05828                   else if (arg == "macro")
05829                     {
05830                       argc--;
05831                       argv++;
05832                       if (argc > 1)
05833                         {
05834                           cmt_string& s = arguments.add ();
05835                           s = argv[1];
05836                           m_current_target = argv[1];
05837 
05838                           m_action = action_show_macro;
05839                         }
05840                       else
05841                         {
05842                           if (!m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl;
05843                           m_help_action = action_help;
05844                           m_action = action_show_macro;
05845                         }
05846                     }
05847                   else if (arg == "macro_names")
05848                     {
05849                       argc--;
05850                       argv++;
05851                       if (argc > 1)
05852                         {
05853                           cmt_string& s = arguments.add ();
05854                           s = argv[1];
05855                         }
05856 
05857                       m_action = action_show_macro_names;
05858                     }
05859                   else if (arg == "macro_value")
05860                     {
05861                       m_quiet = true;
05862                       argc--;
05863                       argv++;
05864                       if (argc > 1)
05865                         {
05866                           cmt_string& s = arguments.add ();
05867                           s = argv[1];
05868                           m_current_target = argv[1];
05869 
05870                           m_action = action_show_macro_value;
05871                         }
05872                       else
05873                         {
05874                           if (!m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl;
05875                           m_help_action = action_help;
05876                           m_action = action_show_macro_value;
05877                         }
05878                     }
05879                   else if (arg == "macros")
05880                     {
05881                       argc--;
05882                       argv++;
05883                       if (argc > 1)
05884                         {
05885                           cmt_string& s = arguments.add ();
05886                           s = argv[1];
05887                         }
05888 
05889                       m_action = action_show_macros;
05890                     }
05891                   else if (arg == "manager")
05892                     {
05893                       m_action = action_show_manager;
05894                     }
05895                   else if (arg == "packages")
05896                     {
05897                       argc--;
05898                       argv++;
05899                       if (argc > 1)
05900                         {
05901                           cmt_string& s = arguments.add ();
05902                           s = argv[1];
05903                           m_current_target = argv[1];
05904                         }
05905 
05906                       m_action = action_show_packages;
05907                     }
05908                   else if (arg == "path")
05909                     {
05910                       m_action = action_show_path;
05911                     }
05912                   else if (arg == "pattern")
05913                     {
05914                       argc--;
05915                       argv++;
05916                       if (argc > 1)
05917                         {
05918                           cmt_string& s = arguments.add ();
05919                           s = argv[1];
05920                           m_current_target = argv[1];
05921 
05922                           m_action = action_show_pattern;
05923                         }
05924                       else
05925                         {
05926                           if (!m_quiet) cerr << "#CMT> syntax error : pattern name missing" << endl;
05927                           m_help_action = action_help;
05928                           m_action = action_show_pattern;
05929                         }
05930                     }
05931                   else if (arg == "pattern_names")
05932                     {
05933                       m_action = action_show_pattern_names;
05934                     }
05935                   else if (arg == "patterns")
05936                     {
05937                       m_action = action_show_patterns;
05938                     }
05939                   else if (arg == "projects")
05940                     {
05941                       m_action = action_show_projects;
05942                     }
05943                   else if (arg == "pwd")
05944                     {
05945                       m_action = action_show_pwd;
05946                     }
05947                   else if (arg == "setup")
05948                     {
05949                       m_action = action_show_setup;
05950 
05951                       if (m_scope_filtering_mode == default_filtering_mode)
05952                         {
05953                           set_scope_filtering_mode (reach_private_uses);
05954                         }
05955                     }
05956                   else if (arg == "set_names")
05957                     {
05958                       argc--;
05959                       argv++;
05960                       if (argc > 1)
05961                         {
05962                           cmt_string& s = arguments.add ();
05963                           s = argv[1];
05964                         }
05965 
05966                       m_action = action_show_set_names;
05967                     }
05968                   else if (arg == "set_value")
05969                     {
05970                       m_quiet = true;
05971                       argc--;
05972                       argv++;
05973                       if (argc > 1)
05974                         {
05975                           cmt_string& s = arguments.add ();
05976                           s = argv[1];
05977                           m_current_target = argv[1];
05978 
05979                           m_action = action_show_set_value;
05980                         }
05981                       else
05982                         {
05983                           if (!m_quiet) cerr << "#CMT> syntax error : set name missing" << endl;
05984                           m_help_action = action_help;
05985                           m_action = action_show_set_value;
05986                         }
05987                     }
05988                   else if (arg == "set")
05989                     {
05990                       argc--;
05991                       argv++;
05992                       if (argc > 1)
05993                         {
05994                           cmt_string& s = arguments.add ();
05995                           s = argv[1];
05996                           m_current_target = argv[1];
05997 
05998                           m_action = action_show_set;
05999                         }
06000                       else
06001                         {
06002                           if (!m_quiet) cerr << "#CMT> syntax error : set name missing" << endl;
06003                           m_help_action = action_help;
06004                           m_action = action_show_set;
06005                         }
06006                     }
06007                   else if (arg == "sets")
06008                     {
06009                       argc--;
06010                       argv++;
06011                       if (argc > 1)
06012                         {
06013                           cmt_string& s = arguments.add ();
06014                           s = argv[1];
06015                         }
06016 
06017                       m_action = action_show_sets;
06018                     }
06019                   else if (arg == "strategies")
06020                     {
06021                       m_action = action_show_strategies;
06022                     }
06023                   else if (arg == "tags")
06024                     {
06025                       m_action = action_show_tags;
06026                     }
06027                   else if (arg == "use_paths")
06028                     {
06029                       argc--;
06030                       argv++;
06031                       if (argc > 1)
06032                         {
06033                           while (argc > 1)
06034                             {
06035                               if (strcmp (argv[1], "-private") == 0)
06036                                 {
06037                                   set_scope_filtering_mode (reach_private_uses);
06038                                 }
06039                               else if (strcmp (argv[1], "--private") == 0)
06040                                 {
06041                                   set_scope_filtering_mode (reach_private_uses);
06042                                 }
06043                               else
06044                                 {
06045                                   cmt_string& s = arguments.add ();
06046                                   s = argv[1];
06047                                 }
06048 
06049                               argc--;
06050                               argv++;
06051                             }
06052 
06053                           m_action = action_show_use_paths;
06054                         }
06055                       else
06056                         {
06057                           if (!m_quiet) cerr << "#CMT> syntax error : package name missing" << endl;
06058                           m_help_action = action_help;
06059                           m_action = action_show_use_paths;
06060                         }
06061                     }
06062                   else if ((arg == "u") ||
06063                            (arg == "us") ||
06064                            (arg == "use") ||
06065                            (arg == "uses"))
06066                     {
06067                       m_action = action_show_uses;
06068 
06069                       if (m_scope_filtering_mode == default_filtering_mode)
06070                         {
06071                           set_scope_filtering_mode (reach_private_uses);
06072                         }
06073                     }
06074                   else if (arg == "version")
06075                     {
06076                       m_action = action_show_version;
06077                     }
06078                   else if (arg == "versions")
06079                     {
06080                       argc--;
06081                       argv++;
06082                       if (argc > 1)
06083                         {
06084                           cmt_string& s = arguments.add ();
06085                           s = argv[1];
06086                           m_current_target = argv[1];
06087 
06088                           m_action = action_show_versions;
06089                         }
06090                       else
06091                         {
06092                           if (!m_quiet) cerr << "#CMT> syntax error : package name missing" << endl;
06093                           m_help_action = action_help;
06094                           m_action = action_show_versions;
06095                         }
06096                     }
06097                   else
06098                     {
06099                       if (!m_quiet) cerr << "#CMT> syntax error : bad show argument" << endl;
06100                       m_help_action = action_help;
06101                       m_action = action_show;
06102                     }
06103                 }
06104               else
06105                 {
06106                   if (!m_quiet) cerr << "#CMT> syntax error : don't know what to show" << endl;
06107                   m_help_action = action_help;
06108                   m_action = action_show;
06109                 }
06110             }
06111           else if (arg == "system")
06112             {
06113               m_action = action_system;
06114             }
06115           else
06116             {
06117               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
06118               m_help_action = action_help;
06119             }
06120 
06121           break;
06122         case 'u' :
06123           if (arg == "unlock")
06124             {
06125               argc--;
06126               argv++;
06127               if (argc > 1)
06128                 {
06129                   m_current_package = argv[1];
06130                   {
06131                     cmt_string& s = arguments.add ();
06132                     s = m_current_package;
06133                   }
06134 
06135                   m_current_version.erase (0);
06136                   m_current_path.erase (0);
06137                                         
06138                   argc--;
06139                   argv++;
06140                   if (argc > 1)
06141                     {
06142                       m_current_version = argv[1];
06143 
06144                       {
06145                         cmt_string& s = arguments.add ();
06146                         s = m_current_version;
06147                       }
06148                                                 
06149                       m_action = action_unlock;
06150 
06151                       argc--;
06152                       argv++;
06153                       if (argc > 1)
06154                         {
06155                           m_current_path = argv[1];
06156                           if (m_current_path[0] == '-')
06157                             {
06158                               m_current_path.erase (0);
06159                             }
06160                         }
06161                                                 
06162                       m_current_access = UserMode;
06163                       (Use::current()).set (m_current_package, 
06164                                             m_current_version, 
06165                                             m_current_path);
06166 
06167                     }
06168                   else
06169                     {
06170                       if (!m_quiet) cerr << "#CMT> syntax error : version missing" << endl;
06171                       m_help_action = action_help;
06172                       m_action = action_unlock;
06173                     }
06174                 }
06175               else
06176                 {
06177                   m_action = action_unlock;
06178                 }
06179             }
06180           else
06181             {
06182               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
06183               m_help_action = action_help;
06184             }
06185 
06186           break;
06187         case 'v' :
06188           if ((arg == "v") ||
06189               (arg == "ve") ||
06190               (arg == "ver") ||
06191               (arg == "vers") ||
06192               (arg == "versi") ||
06193               (arg == "versio") ||
06194               (arg == "version"))
06195             {
06196               m_action = action_version;
06197             }
06198           else
06199             {
06200               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
06201               m_help_action = action_help;
06202             }
06203           break;
06204         case '+' :
06205           if (arg.substr (0, 6) == "+path=")
06206             {
06207               arg.erase (0, 6);
06208 
06209               IProjectFactory& factory = ProjectFactory::instance ();
06210 
06211               CmtSystem::add_cmt_path (arg, "argument", factory);
06212             }
06213           else
06214             {
06215               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " 
06216                                << arg << endl;
06217               m_help_action = action_help;
06218             }
06219 
06220           break;
06221         case '-' :
06222           if ((arg == "-help") ||
06223               (arg == "--help"))
06224             {
06225               m_help_action = action_help;
06226             }
06227           else if (arg == "-n")
06228             {
06229               m_simulation = true;
06230             }
06231           else if ((arg == "-q") ||
06232                    (arg == "-qu") ||
06233                    (arg == "-qui") ||
06234                    (arg == "-quie") ||
06235                    (arg == "-quiet"))
06236             {
06237               m_quiet = true;
06238             }
06239           else if (arg == "-csh")
06240             {
06241               mode = Csh;
06242             }
06243           else if (arg == "-sh")
06244             {
06245               mode = Sh;
06246             }
06247           else if (arg == "-bat")
06248             {
06249               mode = Bat;
06250             }
06251           else if (arg.substr (0, 5) == "-use=")
06252             {
06253               arg.erase (0, 5);
06254 
06255               if (m_action != action_create)
06256                 {
06257                   CmtSystem::cmt_string_vector words;
06258 
06259                   CmtSystem::split (arg, ":", words);
06260 
06261                   m_current_access = UserMode;
06262 
06263                   if (words.size () > 0) m_current_package = words[0];
06264                   if (words.size () > 1) m_current_version = words[1];
06265                   if (words.size () > 2) m_current_path    = words[2];
06266                   (Use::current()).set (m_current_package, 
06267                                         m_current_version, 
06268                                         m_current_path);
06269                 }
06270             }
06271           else if (arg.substr (0, 6) == "-pack=")
06272             {
06273               arg.erase (0, 6);
06274               if ((m_action != action_create) && (m_current_package != arg))
06275                 {
06276                   //CmtSystem::cd (m_default_path);
06277 
06278                   m_current_access = UserMode;
06279 
06280                   m_current_package = arg;
06281                   m_current_version = "";
06282                   m_current_path    = m_default_path;
06283 
06284                   (Use::current()).set (m_current_package, 
06285                                         m_current_version, 
06286                                         m_current_path);
06287                 }
06288             }
06289           else if (arg.substr (0, 9) == "-version=")
06290             {
06291               arg.erase (0, 9);
06292               if ((m_action != action_create) && (m_current_version != arg))
06293                 {
06294                   m_current_access = UserMode;
06295                   m_current_version = arg;
06296                   (Use::current()).set (m_current_package, 
06297                                         m_current_version, 
06298                                         m_current_path);
06299                 }
06300             }
06301           else if (arg.substr (0, 6) == "-path=")
06302             {
06303               arg.erase (0, 6);
06304 
06305               /*
06306               cerr << "-path=" << arg << 
06307                 " cp=" << m_current_package <<
06308                 " cv=" << m_current_version <<
06309                 " cp=" << m_current_path << endl;
06310               */
06311 
06312               if ((m_action != action_create) && (m_current_path != arg))
06313                 {
06314                   m_current_access = UserMode;
06315                   m_current_path = arg;
06316                   (Use::current()).set (m_current_package, 
06317                                         m_current_version, 
06318                                         m_current_path);
06319 
06320                   IProjectFactory& factory = ProjectFactory::instance ();
06321 
06322                   //CmtSystem::add_cmt_path (m_current_path, "argument", factory);
06323                 }
06324             }
06325           else if (arg.substr (0, 3) == "-f=")
06326             {
06327               arg.substr (3, extra_file);
06328             }
06329           else if (arg.substr (0, 3) == "-e=")
06330             {
06331               cerr << "#CMT> Warning: extra statement = " << arg << endl;
06332               arg.substr (3, extra_line);
06333             }
06334           else if (arg.substr (0, 6) == "-home=")
06335             {
06336               arg.erase (0, 6);
06337               if (CmtSystem::test_directory (arg))
06338                 {
06339                   m_cmt_home = arg;
06340                 }
06341             }
06342           else if (arg.substr (0, 5) == "-tag=")
06343             {
06344               /*
06345                 Here we are going to change the complete tag set
06346               */
06347               
06348               arg.erase (0, 5);
06349               
06350               if (arg != "")
06351                 {
06352                   Tag* tag;
06353                   CmtSystem::cmt_string_vector words;
06354                   
06355                   // First forget about all existing tags
06356                   Tag::clear_all ();
06357                   Cmt::m_extra_tags = ",";
06358                     
06359                   // Then restore CMTSITE
06360                   configure_version_tag ();
06361                   configure_site_tag (0);
06362                   configure_uname_tag ();
06363                   configure_hosttype_tag ();
06364                   configure_config_tag ();
06365                   configure_home (0);
06366                   
06367                   CmtSystem::split (arg, " \t,", words);
06368                   
06369                   for (int i = 0; i < words.size (); i++)
06370                     {
06371                       const cmt_string& a = words[i];
06372                       
06373                       cmt_string s = ",";
06374                       s += a;
06375                       s += ",";
06376                       
06377                       if (i == 0)
06378                         {
06379                           m_current_tag = a;
06380                           
06381                           if (CmtSystem::testenv ("TAGDEBUG")) cerr 
06382                             << "parse_argument(tag_add)> current_tag=" << m_current_tag << endl;
06383                         }
06384                       
06385                       if (Cmt::m_extra_tags.find (s) == cmt_string::npos)
06386                         {
06387                           //if (!m_quiet) cerr << "  a=[" << a << "]" << endl;
06388                           
06389                           // Then restore uname if the specified tag is CMTCONFIG
06390                           if (a == CmtSystem::get_cmt_config ())
06391                             {
06392                               configure_uname_tag ();
06393                             }
06394                           
06395                           tag = Tag::add (a, PriorityArgument, "arguments", 0);
06396                           
06397                           tag->mark ();
06398                           
06399                           Cmt::m_extra_tags += a;
06400                           Cmt::m_extra_tags += ",";
06401                         }
06402                     }
06403                 }
06404             }
06405           else if (arg.substr (0, 9) == "-tag_add=")
06406             {
06407               Tag* tag;
06408               CmtSystem::cmt_string_vector words;
06409               
06410               arg.erase (0, 9);
06411 
06412               //if (!m_quiet) cerr << "-tag_add=" << arg << endl;
06413 
06414               CmtSystem::split (arg, " \t,", words);
06415 
06416               for (int i = 0; i < words.size (); i++)
06417                 {
06418                   const cmt_string& a = words[i];
06419 
06420                   cmt_string s = ",";
06421                   s += a;
06422                   s += ",";
06423 
06424                   if (Cmt::m_extra_tags.find (s) == cmt_string::npos)
06425                     {
06426                         //if (!m_quiet) cerr << "  a=[" << a << "]" << endl;
06427 
06429                       if (a == CmtSystem::get_cmt_config ())
06430                         {
06431                           configure_uname_tag ();
06432                         }
06433                       
06434                       tag = Tag::add (a, PriorityUserTag, "arguments", 0);
06435                       
06436                       tag->mark ();
06437 
06438                       Cmt::m_extra_tags += a;
06439                       Cmt::m_extra_tags += ",";
06440                     }
06441                 }
06442             }
06443           else if (arg.substr (0, 12) == "-tag_remove=")
06444             {
06445               Tag::TagPtrVector tags = Tag::tags ();
06446               int i;
06447               Tag* tag;
06448 
06449               /*
06450               for (i = 0; i < tags.size (); i++)
06451                 {
06452                   tag = tags[i];
06453                   if ((tag != 0) &&
06454                       (tag->selected))
06455                     {
06456                         if (!m_quiet) cerr << "  original tag_list=" << tag->name << tag->priority << endl;
06457                     }
06458                 }
06459               */
06460 
06461               CmtSystem::cmt_string_vector words;
06462 
06463               arg.erase (0, 12);
06464 
06465               //if (!m_quiet) cerr << "-arg_remove=" << arg << endl;
06466 
06467               CmtSystem::split (arg, " \t,", words);
06468 
06469                 //
06470                 // Now erase all entries in the old list that match
06471                 // the specified tags 
06472                 //
06473 
06474               for (i = 0; i < words.size (); i++)
06475                 {
06476                   const cmt_string& a = words[i];
06477 
06478                   cmt_string s = ",";
06479                   s += a;
06480                   s += ",";
06481 
06482                   int pos;
06483 
06484                   pos = Cmt::m_extra_tags.find (s);
06485 
06486                   if (pos != cmt_string::npos)
06487                     {
06488                       Cmt::m_extra_tags.erase (pos, s.size () - 1);
06489                     }
06490 
06491                   //if (!m_quiet) cerr << "  tag_list=[" << tag_list << "]" << endl;
06492                 }
06493 
06494                 //
06495                 // Now reinject the purged list of tags into the database
06496                 // exactly as when using -tag=
06497                 //
06498 
06500               Tag::unmark_all ();
06501 
06503               configure_version_tag ();
06504               configure_site_tag (0);
06505               configure_uname_tag ();
06506               configure_hosttype_tag ();
06507               
06508               CmtSystem::split (Cmt::m_extra_tags, " \t,", words);
06509 
06510               for (i = 0; i < words.size (); i++)
06511                 {
06512                   const cmt_string& a = words[i];
06513 
06514                   //fprintf (stderr, "  a=[%s]\n", a.c_str ());
06515 
06517                   if (a == CmtSystem::get_cmt_config ())
06518                     {
06519                       configure_uname_tag ();
06520                     }
06521 
06522                   if (i == 0)
06523                     {
06524                       m_current_tag = a;
06525 
06526                       //if (!m_quiet) cerr << "parse_argument(tag_remove)> current_tag=" 
06527                         //<< m_current_tag << endl;
06528 
06529                       tag = Tag::add (a, PriorityTag, "restore configuration", 0);
06530                     }
06531                   else
06532                     {
06533                       tag = Tag::add (a, PriorityUserTag, "restore configuration", 0);
06534                     }
06535 
06536                   tag->mark ();
06537                 }
06538             }
06539           else if (arg.substr (0, 14) == "-user_context=")
06540             {
06541               arg.erase (0, 14);
06542               if (CmtSystem::test_directory (arg))
06543                 {
06544                   m_cmt_user_context = arg;
06545                 }
06546             }
06547           else if (arg == "--version")
06548             {
06549               m_action = action_version;
06550             }
06551           else if (arg.substr (0, 23) == "-with_version_directory")
06552             {
06553               m_current_structuring_style = with_version_directory;
06554             }
06555           else if (arg.substr (0, 26) == "-without_version_directory")
06556             {
06557               m_current_structuring_style = without_version_directory;
06558             }
06559           else if (arg.substr (0, 11) == "-no_cleanup")
06560             {
06561               m_current_setup_strategy |= SetupNoCleanup;
06562             }
06563           else if ((arg == "-private") ||
06564                    (arg == "--private"))
06565             {
06566               set_scope_filtering_mode (reach_private_uses);
06567             }
06568           else if ((arg == "-public") ||
06569                    (arg == "--public"))
06570             {
06571               set_scope_filtering_mode (block_private_uses);
06572             }
06573           else
06574             {
06575               if (!m_quiet) cerr << "#CMT> syntax error : bad verb " << arg << endl;
06576               m_help_action = action_help;
06577             }
06578 
06579           break;
06580         default:
06581           if (!m_quiet) cerr << "#CMT> syntax error : bad command parameter " << arg << endl;
06582           m_help_action = action_help;
06583           break;
06584         }
06585 
06586       argc--;
06587       argv++;
06588     }
06589 }

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

Definition at line 6617 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_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, cmt_string::c_str(), CmtError::clear(), clear(), configure(), Csh, 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_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(), CmtError::get_last_error_code(), CmtError::has_pending_error(), m_action, m_configure_error, m_current_access, m_current_package, m_current_path, m_current_tag, m_current_version, m_help_action, m_quiet, m_recursive, parse_arguments(), SyntaxParser::parse_requirements(), SyntaxParser::parse_requirements_line(), CmtError::print(), PrintMode, CmtSystem::pwd(), reach_current_package(), CmtError::set(), cmt_string::size(), CmtError::syntax_error, use_cmt(), use_home_requirements(), use_user_context_requirements(), and UserMode.

06618 {
06619   PrintMode mode = Csh;
06620   CmtSystem::cmt_string_vector arguments;
06621   cmt_string extra_line;
06622   cmt_string extra_file;
06623 
06624   if (argc <= 1)
06625     {
06626       do_help ();
06627       exit (0);
06628     }
06629 
06630   clear ();
06631   configure ();
06632 
06633   CmtError::clear ();
06634 
06635   /*
06636     Set private if positioned inside the package
06637     (which is detected since we were able to retreive the
06638     Version, Package and Path)
06639   */
06640 
06641   if ((m_current_path.size () == 0) ||
06642       (m_current_package.size () == 0) ||
06643       (m_current_version.size () == 0))
06644     {
06645       m_current_access = UserMode;
06646     }
06647   else
06648     {
06649       m_current_access = DeveloperMode;
06650     }
06651 
06652   parse_arguments (argc, argv, arguments,
06653                    extra_line, extra_file, mode);
06654 
06655   if (m_configure_error != "")
06656     {
06657       if (!m_quiet) cerr << "#CMT> Error: " << m_configure_error << endl;
06658       return (CmtError::execution_error);
06659     }
06660 
06661   if (CmtError::has_pending_error ())
06662     {
06663       int code = CmtError::get_last_error_code ();
06664       if (!m_quiet) CmtError::print ();
06665       clear ();
06666 
06667       return (code);
06668     }
06669 
06670   if (m_debug)
06671     {
06672       cout << "After parse_argument> pack=" << m_current_package
06673            << " m_current_tag=" << m_current_tag
06674            << " cwd=" << CmtSystem::pwd () 
06675            << endl;
06676     }
06677 
06678   /*
06679     Now actual requirements analysis can take place.
06680 
06681     Extra lines or files are analysed first.
06682   */
06683 
06684   if (strlen (extra_file.c_str ()) > 0) SyntaxParser::parse_requirements (extra_file, (Use*) 0);
06685   if (strlen (extra_line.c_str ()) > 0) SyntaxParser::parse_requirements_line (extra_line, (Use*) 0);
06686 
06687   //
06688   //  For some of the actions, the CMT package must be automatically
06689   //  included
06690   //
06691 
06692   if (m_debug) cout << "parser1> current_tag=" << m_current_tag << endl;
06693 
06694   if (m_help_action == action_help)
06695     {
06696       do_help (m_action);
06697       return (0);
06698     }
06699 
06700   switch (m_action)
06701     {
06702       // case action_none :
06703     case action_awk :
06704     case action_broadcast :
06705     case action_build_constituent_makefile :
06706     case action_build_constituents_makefile :
06707     case action_build_dependencies :
06708     case action_build_library_links :
06709     case action_build_make_setup :
06710     case action_build_msdev :
06711     case action_build_CMT_pacman :
06712     case action_build_vsnet :     
06713     case action_build_os9_makefile :
06714       // case action_build_prototype :
06715     case action_build_readme :
06716     case action_build_tag_makefile :
06717       // case action_build_temporary_name :
06718     case action_build_triggers :
06719     case action_build_windefs :
06720     case action_check_configuration :
06721       // case action_check_files :
06722       // case action_check_version :
06723     case action_checkout :
06724     case action_cleanup :
06725     case action_config :
06726     case action_create :
06727       // case action_create_project :
06728       // case action_cvsbranches :
06729       // case action_cvssubpackages :
06730       // case action_cvstags :
06731     case action_do :
06732     case action_expand_model :
06733     case action_filter :
06734       // case action_help :
06735     case action_load :
06736     case action_lock :
06737     case action_remove :
06738     case action_remove_library_links :
06739     case action_run :
06740     case action_run_sequence :
06741     case action_set_version :
06742     case action_set_versions :
06743     case action_setup :
06744     case action_show_action :
06745     case action_show_action_names :
06746     case action_show_action_value :
06747     case action_show_actions :
06748     case action_show_all_tags :
06749     case action_show_applied_patterns :
06750       // case action_show_author :
06751       // case action_show_branches :
06752       // case action_show_clients :
06753     case action_show_cmtpath_patterns :
06754       // case action_show_constituent :
06755       // case action_show_constituent_names :
06756       // case action_show_constituents :
06757     case action_show_cycles :
06758     case action_show_fragment :
06759     case action_show_fragments :
06760     case action_show_groups :
06761     case action_show_include_dirs :
06762     case action_show_language :
06763     case action_show_languages :
06764     case action_show_macro :
06765     case action_show_macro_names :
06766     case action_show_macro_value :
06767     case action_show_macros :
06768       // case action_show_manager :
06769       // case action_show_packages :
06770     case action_show_path :
06771     case action_show_pattern :
06772     case action_show_pattern_names :
06773     case action_show_patterns :
06774     case action_show_projects :
06775       // case action_show_pwd :
06776     case action_show_setup :
06777     case action_show_set :
06778     case action_show_set_names :
06779     case action_show_set_value :
06780     case action_show_sets :
06781     case action_show_strategies :
06782     case action_show_tags :
06783     case action_show_use_paths :
06784     case action_show_uses :
06785     case action_show_version :
06786       // case action_show_versions :
06787       // case action_system :
06788     case action_unlock :
06789     case action_version :
06790       use_cmt ();
06791         //
06792         // Now parse the requirements file stored in ${CMTHOME}
06793         //
06794       
06795       use_home_requirements ();
06796 
06797       break;
06798     default:
06799       break;
06800     }
06801 
06802   if (m_debug) cout << "parser2> current_tag=" << m_current_tag << endl;
06803 
06804   //
06805   // Setting up recursive actions
06806   //
06807 
06808   switch (m_action)
06809     {
06810       // case action_none :
06811     case action_awk :
06812     case action_broadcast :
06813     case action_build_constituent_makefile :
06814     case action_build_constituents_makefile :
06815     case action_build_dependencies :
06816     case action_build_library_links :
06817     case action_build_make_setup :
06818     case action_build_msdev :
06819     case action_build_CMT_pacman :
06820     case action_build_vsnet :     
06821     case action_build_os9_makefile :
06822       // case action_build_prototype :
06823     case action_build_readme :
06824     case action_build_tag_makefile :
06825       // case action_build_temporary_name :
06826     case action_build_triggers :
06827     case action_build_windefs :
06828     case action_check_configuration :
06829       // case action_check_files :
06830       // case action_check_version :
06831       // case action_checkout :
06832     case action_cleanup :
06833     case action_config :
06834       // case action_create :
06835       // case action_create_project :
06836       // case action_cvsbranches :
06837       // case action_cvssubpackages :
06838       // case action_cvstags :
06839     case action_do :
06840     case action_expand_model :
06841     case action_filter :
06842       // case action_help :
06843     case action_load :
06844       // case action_lock :
06845       // case action_remove :
06846     case action_remove_library_links :
06847     case action_run :
06848     case action_run_sequence :
06849       // case action_set_version :
06850     case action_set_versions :
06851     case action_setup :
06852     case action_show_action :
06853     case action_show_action_names :
06854     case action_show_action_value :
06855     case action_show_actions :
06856     case action_show_all_tags :
06857     case action_show_applied_patterns :
06858       // case action_show_author :
06859       // case action_show_branches :
06860       // case action_show_clients :
06861     case action_show_cmtpath_patterns :
06862     case action_show_constituent :
06863     case action_show_constituent_names :
06864     case action_show_constituents :
06865     case action_show_cycles :
06866     case action_show_fragment :
06867     case action_show_fragments :
06868     case action_show_groups :
06869     case action_show_include_dirs :
06870     case action_show_language :
06871     case action_show_languages :
06872     case action_show_macro :
06873     case action_show_macro_names :
06874     case action_show_macro_value :
06875     case action_show_macros :
06876       // case action_show_manager :
06877       // case action_show_packages :
06878     case action_show_path :
06879     case action_show_pattern :
06880     case action_show_pattern_names :
06881     case action_show_patterns :
06882     case action_show_projects :
06883       // case action_show_pwd :
06884     case action_show_setup :
06885     case action_show_set :
06886     case action_show_set_names :
06887     case action_show_set_value :
06888     case action_show_sets :
06889     case action_show_strategies :
06890     case action_show_tags :
06891     case action_show_use_paths :
06892     case action_show_uses :
06893       // case action_show_version :
06894       // case action_show_versions :
06895       // case action_system :
06896       // case action_unlock :
06897       // case action_version :
06898       m_recursive = true;
06899       break;
06900     default:
06901       m_recursive = false;
06902       break;
06903     }
06904 
06905   //
06906   //  Actions for which the context of the package is checked,
06907   //  and the requirements file is analysed.
06908   //
06909 
06910   switch (m_action)
06911     {
06912     case action_none :
06913     case action_awk :
06914     case action_broadcast :
06915     case action_build_constituent_makefile :
06916     case action_build_constituents_makefile :
06917     case action_build_dependencies :
06918     case action_build_library_links :
06919     case action_build_make_setup :
06920     case action_build_msdev :
06921     case action_build_CMT_pacman :
06922     case action_build_vsnet :     
06923     case action_build_os9_makefile :
06924       // case action_build_prototype :
06925     case action_build_readme :
06926     case action_build_tag_makefile :
06927       // case action_build_temporary_name :
06928     case action_build_triggers :
06929     case action_build_windefs :
06930     case action_check_configuration :
06931       // case action_check_files :
06932       // case action_check_version :
06933       // case action_checkout :
06934     case action_cleanup :
06935     case action_config :
06936       // case action_create :
06937       // case action_create_project :
06938       // case action_cvsbranches :
06939       // case action_cvssubpackages :
06940       // case action_cvstags :
06941     case action_do :
06942     case action_expand_model :
06943     case action_filter :
06944       // case action_help :
06945     case action_load :
06946     case action_lock :
06947       // case action_remove :
06948     case action_remove_library_links :
06949     case action_run :
06950       // case action_run_sequence :
06951       // case action_set_version :
06952     case action_set_versions :
06953     case action_setup :
06954     case action_show_action :
06955     case action_show_action_names :
06956     case action_show_action_value :
06957     case action_show_actions :
06958     case action_show_all_tags :
06959     case action_show_applied_patterns :
06960     case action_show_author :
06961     case action_show_branches :
06962       // case action_show_clients :
06963     case action_show_cmtpath_patterns :
06964     case action_show_constituent :
06965     case action_show_constituent_names :
06966     case action_show_constituents :
06967     case action_show_cycles :
06968     case action_show_fragment :
06969     case action_show_fragments :
06970     case action_show_groups :
06971     case action_show_include_dirs :
06972     case action_show_language :
06973     case action_show_languages :
06974     case action_show_macro :
06975     case action_show_macro_names :
06976     case action_show_macro_value :
06977     case action_show_macros :
06978     case action_show_manager :
06979       // case action_show_packages :
06980     case action_show_path :
06981     case action_show_pattern :
06982     case action_show_pattern_names :
06983     case action_show_patterns :
06984     case action_show_projects :
06985     case action_show_pwd :
06986     case action_show_setup :
06987     case action_show_set :
06988     case action_show_set_names :
06989     case action_show_set_value :
06990     case action_show_sets :
06991     case action_show_strategies :
06992     case action_show_tags :
06993     case action_show_use_paths :
06994     case action_show_uses :
06995     case action_show_version :
06996       // case action_show_versions :
06997       // case action_system :
06998     case action_unlock :
06999       // case action_version :
07000       reach_current_package ();
07001       use_user_context_requirements ();
07002       break;
07003     default:
07004       break;
07005     }
07006 
07007   if (m_debug) cout << "parser3> current_tag=" << m_current_tag << endl;
07008 
07009   //
07010   // Perform some actions even if there is an error
07011   //
07012 
07013   if (CmtError::has_pending_error ())
07014     {
07015       int code = CmtError::get_last_error_code ();
07016       if (!m_quiet) CmtError::print ();
07017 
07018       switch (m_action)
07019         {
07020           // case action_none :
07021           // case action_awk :
07022           // case action_broadcast :
07023         case action_build_constituent_makefile :
07024         case action_build_constituents_makefile :
07025         case action_build_dependencies :
07026         case action_build_library_links :
07027         case action_build_make_setup :
07028         case action_build_msdev :
07029         case action_build_CMT_pacman :
07030         case action_build_vsnet :     
07031         case action_build_os9_makefile :
07032         case action_build_prototype :
07033         case action_build_readme :
07034         case action_build_tag_makefile :
07035           // case action_build_temporary_name :
07036         case action_build_triggers :
07037         case action_build_windefs :
07038         case action_check_configuration :
07039           // case action_check_files :
07040           // case action_check_version :
07041           // case action_checkout :
07042         case action_cleanup :
07043           // case action_config :
07044           // case action_create :
07045           // case action_create_project :
07046           // case action_cvsbranches :
07047           // case action_cvssubpackages :
07048           // case action_cvstags :
07049           // case action_do :
07050           // case action_expand_model :
07051           // case action_filter :
07052           // case action_help :
07053         case action_load :
07054         case action_lock :
07055         case action_remove :
07056         case action_remove_library_links :
07057           // case action_run :
07058         case action_run_sequence :
07059           // case action_set_version :
07060           // case action_set_versions :
07061         case action_setup :
07062           // case action_show_action :
07063           // case action_show_action_names :
07064           // case action_show_action_value :
07065           // case action_show_actions :
07066           // case action_show_all_tags :
07067           // case action_show_applied_patterns :
07068           // case action_show_author :
07069           // case action_show_branches :
07070           // case action_show_clients :
07071           // case action_show_cmtpath_patterns :
07072           // case action_show_constituent :
07073           // case action_show_constituent_names :
07074           // case action_show_constituents :
07075           // case action_show_cycles :
07076           // case action_show_fragment :
07077           // case action_show_fragments :
07078           // case action_show_groups :
07079           // case action_show_include_dirs :
07080           // case action_show_language :
07081           // case action_show_languages :
07082           // case action_show_macro :
07083           // case action_show_macro_names :
07084           // case action_show_macro_value :
07085           // case action_show_macros :
07086           // case action_show_manager :
07087           // case action_show_packages :
07088           // case action_show_path :
07089           // case action_show_pattern :
07090           // case action_show_pattern_names :
07091           // case action_show_patterns :
07092           // case action_show_projects :
07093           // case action_show_pwd :
07094           // case action_show_setup :
07095           // case action_show_set :
07096           // case action_show_set_names :
07097           // case action_show_set_value :
07098           // case action_show_sets :
07099           // case action_show_strategies :
07100           // case action_show_tags :
07101           // case action_show_use_paths :
07102           // case action_show_uses :
07103           // case action_show_version :
07104           // case action_show_versions :
07105           // case action_system :
07106         case action_unlock :
07107           // case action_version :
07108           clear ();
07109           return (code);
07110         default:
07111           CmtError::clear ();
07112           break;
07113         }
07114     }
07115 
07116   //
07117   // Perform actions
07118   //
07119 
07120   switch (m_action)
07121     {
07122     case action_none :
07123       //CmtError::set (CmtError::syntax_error, "ParseArguments> ");
07124       break;
07125     case action_awk :
07126       do_awk (arguments);
07127       break;
07128     case action_broadcast :
07129       do_broadcast (arguments, argc, argv);
07130       break;
07131     case action_build_constituent_makefile :
07132       do_build_constituent_makefile (arguments, argc, argv);
07133       break;
07134     case action_build_constituents_makefile :
07135       do_build_constituents_makefile (arguments, argc, argv);
07136       break;
07137     case action_build_dependencies :
07138       do_build_dependencies (arguments, argc, argv);
07139       break;
07140     case action_build_library_links :
07141       do_build_library_links ();
07142       break;
07143     case action_build_make_setup :
07144       do_build_make_setup ();
07145       break;
07146     case action_build_msdev :
07147       do_build_msdev (arguments);
07148       break;
07149     case action_build_CMT_pacman :
07150       do_build_CMT_pacman ();
07151       break;
07152     case action_build_vsnet :     
07153       do_build_vsnet (arguments);
07154       break;
07155     case action_build_os9_makefile :
07156       do_build_os9_makefile (arguments);
07157       break;
07158     case action_build_prototype :
07159       do_build_prototype (arguments);
07160       break;
07161     case action_build_readme :
07162       do_build_readme (arguments);
07163       break;
07164     case action_build_tag_makefile :
07165       do_build_tag_makefile ();
07166       break;
07167     case action_build_temporary_name :
07168       do_build_temporary_name ();
07169       break;
07170     case action_build_triggers :
07171       do_build_triggers (arguments);
07172       break;
07173     case action_build_windefs :
07174       do_build_windefs (arguments);
07175       break;
07176     case action_check_configuration :
07177       do_check_configuration ();
07178       break;
07179     case action_check_files :
07180       do_check_files (arguments);
07181       break;
07182     case action_check_version :
07183       do_check_version (arguments);
07184       break;
07185     case action_checkout :
07186       do_checkout (arguments);
07187       break;
07188     case action_cleanup :
07189       do_cleanup (mode);
07190       break;
07191     case action_config :
07192       do_config ();
07193       break;
07194     case action_create :
07195       do_create (arguments);
07196       break;
07197     case action_create_project :
07198       do_create_project (arguments);
07199       break;
07200     case action_cvsbranches :
07201       do_cvsbranches (arguments);
07202       break;
07203     case action_cvssubpackages :
07204       do_cvssubpackages (arguments);
07205       break;
07206     case action_cvstags :
07207       do_cvstags (arguments);
07208       break;
07209     case action_do :
07210       do_do (arguments);
07211       break;
07212     case action_expand_model :
07213       do_expand_model (arguments);
07214       break;
07215     case action_filter :
07216       do_filter (arguments);
07217       break;
07218     case action_help :
07219       do_help (m_help_action);
07220       break;
07221     case action_load :
07222       cerr << "#CMT> action not implemented" << endl;
07223       break;
07224     case action_lock :
07225       do_lock (m_current_package, m_current_version, m_current_path);
07226       break;
07227     case action_remove :
07228       do_remove (m_current_package, m_current_version, m_current_path);
07229       break;
07230     case action_remove_library_links :
07231       do_remove_library_links ();
07232       break;
07233     case action_run :
07234       do_run (arguments);
07235       break;
07236     case action_run_sequence :
07237       do_run_sequence (arguments);
07238       break;
07239     case action_set_version :
07240       do_set_version (arguments);
07241       break;
07242     case action_set_versions :
07243       do_set_versions (arguments);
07244       break;
07245     case action_setup :
07246       do_setup (mode);
07247       break;
07248     case action_show_action :
07249       do_show_action (arguments, mode);
07250       break;
07251     case action_show_action_names :
07252       do_show_action_names (arguments, mode);
07253       break;
07254     case action_show_action_value :
07255       do_show_action_value (arguments, mode);
07256       break;
07257     case action_show_actions :
07258       do_show_actions (arguments, mode);
07259       break;
07260     case action_show_all_tags :
07261       do_show_all_tags ();
07262       break;
07263     case action_show_applied_patterns :
07264       do_show_applied_patterns ();
07265       break;
07266     case action_show_author :
07267       do_show_author ();
07268       break;
07269     case action_show_branches :
07270       do_show_branches (mode);
07271       break;
07272     case action_show_clients :
07273       do_show_clients (arguments);
07274       break;
07275     case action_show_cmtpath_patterns :
07276       do_show_cmtpath_patterns ();
07277       break;
07278     case action_show_constituent :
07279       do_show_constituent (arguments);
07280       break;
07281     case action_show_constituent_names :
07282       do_show_constituent_names ();
07283       break;
07284     case action_show_constituents :
07285       do_show_constituents ();
07286       break;
07287     case action_show_cycles :
07288       do_show_cycles ();
07289       break;
07290     case action_show_fragment :
07291       do_show_fragment (arguments);
07292       break;
07293     case action_show_fragments :
07294       do_show_fragments ();
07295       break;
07296     case action_show_groups :
07297       do_show_groups ();
07298       break;
07299     case action_show_include_dirs :
07300       do_show_include_dirs ();
07301       break;
07302     case action_show_language :
07303       do_show_language (arguments);
07304       break;
07305     case action_show_languages :
07306       do_show_languages ();
07307       break;
07308     case action_show_macro :
07309       do_show_macro (arguments, mode);
07310       break;
07311     case action_show_macro_names :
07312       do_show_macro_names (arguments, mode);
07313       break;
07314     case action_show_macro_value :
07315       do_show_macro_value (arguments, mode);
07316       break;
07317     case action_show_macros :
07318       do_show_macros (arguments, mode);
07319       break;
07320     case action_show_manager :
07321       do_show_manager ();
07322       break;
07323     case action_show_packages :
07324       do_show_packages (arguments);
07325       break;
07326     case action_show_path :
07327       do_show_path ();
07328       break;
07329     case action_show_pattern :
07330       do_show_pattern (arguments);
07331       break;
07332     case action_show_pattern_names :
07333       do_show_pattern_names ();
07334       break;
07335     case action_show_patterns :
07336       do_show_patterns ();
07337       break;
07338     case action_show_projects :
07339       do_show_projects ();
07340       break;
07341     case action_show_pwd :
07342       do_show_pwd ();
07343       break;
07344     case action_show_setup :
07345       do_show_setup ();
07346       break;
07347     case action_show_set :
07348       do_show_set (arguments, mode);
07349       break;
07350     case action_show_set_names :
07351       do_show_set_names (arguments, mode);
07352       break;
07353     case action_show_set_value :
07354       do_show_set_value (arguments, mode);
07355       break;
07356     case action_show_sets :
07357       do_show_sets (arguments, mode);
07358       break;
07359     case action_show_strategies :
07360       do_show_strategies ();
07361       break;
07362     case action_show_tags :
07363       do_show_tags ();
07364       break;
07365     case action_show_use_paths :
07366       do_show_use_paths (arguments);
07367       break;
07368     case action_show_uses :
07369       do_show_uses ();
07370       break;
07371     case action_show_version :
07372       do_show_version ();
07373       break;
07374     case action_show_versions :
07375       do_show_versions (arguments);
07376       break;
07377     case action_system :
07378       do_show_system ();
07379       break;
07380     case action_unlock :
07381       do_unlock (m_current_package, m_current_version, m_current_path);
07382       break;
07383     case action_version :
07384       do_version ();
07385       break;
07386     default:
07387       CmtError::set (CmtError::syntax_error, "ParseArguments>");
07388       break;
07389     }
07390 
07391   if (CmtError::has_pending_error ())
07392     {
07393       int code = CmtError::get_last_error_code ();
07394       if (!m_quiet) CmtError::print ();
07395       clear ();
07396       return (code);
07397     }
07398   else
07399     {
07400       clear ();
07401       return (0);
07402     }
07403 }

int Cmt::parser (? const cmt_string &? ? command_line )? [static]
?

Definition at line 6592 of file cmt_parser.cxx.

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

Referenced by do_broadcast(), and main().

06593 {
06594   CmtSystem::cmt_string_vector v;
06595 
06596   CmtSystem::split (command_line, " \t", v);
06597 
06598   int argc = v.size ();
06599 
06600   char** argv = (char**) malloc ((argc + 1) * sizeof (char*));
06601 
06602   int i;
06603   for (i = 0; i < argc; i++)
06604     {
06605       argv[i] = (char*) v[i].c_str ();
06606     }
06607   argv[argc] = 0;
06608 
06609   int status = parser (argc, argv);
06610 
06611   free (argv);
06612 
06613   return (status);
06614 }

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 7410 of file cmt_parser.cxx.

References Symbol::all_print(), Bat, Use::current(), Use::discarded, Tag::find(), Use::get_ordered_uses(), Tag::is_selected(), m_current_tag, m_extra_tags, print_context(), PrintMode, set_standard_macros(), cmt_vector< Use * >::size(), cmt_vector< cmt_string >::size(), and CmtSystem::split().

Referenced by do_setup().

07411 {
07412   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
07413   Use& current_use = Use::current ();
07414 
07415   cmt_string tag;
07416 
07417   set_standard_macros ();
07418 
07419     //cerr << "# current_tag=" << m_current_tag << endl;
07420     //cerr << "# current_config=" << m_current_config << endl;
07421 
07422   if (m_current_tag == "")
07423     {
07424       if (mode == Bat) tag = "%CMTCONFIG%";
07425       else tag = "${CMTCONFIG}";
07426     }
07427   else
07428     {
07429       tag = m_current_tag;
07430     }
07431 
07432     //
07433     //  Now check if all extra tags are still valid. Some of them
07434     //  may be discarded du to some conflict with highest priority
07435     //  tags, or with exclude statements
07436     //
07437 
07438   {
07439     CmtSystem::cmt_string_vector words;
07440       
07441     cmt_string tags;
07442 
07443     tags = Cmt::m_extra_tags;
07444       
07445     CmtSystem::split (tags, " \t,", words);
07446 
07447     Cmt::m_extra_tags = ",";
07448       
07449     for (int i = 0; i < words.size (); i++)
07450       {
07451         Tag* tag;
07452         const cmt_string& a = words[i];
07453 
07454         tag = Tag::find (a);
07455 
07456         if ((tag != 0) && (tag->is_selected ()))
07457           {
07458             Cmt::m_extra_tags += a;
07459             Cmt::m_extra_tags += ",";
07460           }
07461       }
07462   }
07463 
07464   if (m_debug)
07465     {
07466       cout << "Before all print contexts" << endl;
07467     }
07468 
07469   if (Uses.size () > 0)
07470     {
07471       int number;
07472 
07473       for (number = 0; number < Uses.size (); number++)
07474         {
07475           Use& use = *(Uses[number]);
07476 
07477           if (use.discarded) continue;
07478 
07479           print_context (use, mode, tag);
07480         }
07481     }
07482 
07483   print_context (Use::current (), mode, tag);
07484 
07485   if (m_debug)
07486     {
07487       cout << "After all print contexts" << endl;
07488     }
07489 
07490   Symbol::all_print (mode);
07491   // Script::all_print (mode);
07492 
07493   if (m_debug)
07494     {
07495       cout << "After all print" << endl;
07496     }
07497 
07498   cout << endl;
07499 }

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 7506 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(), m_current_package, m_current_prefix, Use::prefix, PrintMode, set_standard_macros(), Sh, and cmt_vector< Use * >::size().

Referenced by do_cleanup().

07507 {
07508   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
07509 
07510   set_standard_macros ();
07511 
07512   Script::all_print_clean (mode);
07513   Symbol::all_print_clean (mode);
07514 
07515   switch (mode)
07516     {
07517     case Csh :
07518       if (m_current_package != "CMT")
07519         {
07520           cout << "unsetenv " << m_current_prefix << "ROOT" << endl;
07521           cout << "unsetenv " << m_current_prefix << "CONFIG" << endl;
07522         }
07523       break;
07524     case Sh :
07525       if (m_current_package != "CMT")
07526         {
07527           cout << "unset " << m_current_prefix << "ROOT" << endl;
07528           cout << "unset " << m_current_prefix << "CONFIG" << endl;
07529         }
07530       break;
07531     case Bat :
07532       if (m_current_package != "CMT")
07533         {
07534           cout << "set " << m_current_prefix << "ROOT=" << endl;
07535           cout << "set " << m_current_prefix << "CONFIG=" << endl;
07536         }
07537       break;
07538     }
07539 
07540   if (Uses.size () > 0)
07541     {
07542       int number;
07543 
07544       for (number = 0; number < Uses.size (); number++)
07545         {
07546           Use* use = Uses[number];
07547 
07548           if (use->discarded) continue;
07549 
07550           Package* p = use->get_package ();
07551           if (p->is_cmt ()) continue;
07552 
07553           switch (mode)
07554             {
07555             case Csh :
07556               cout << "unsetenv " << use->prefix << "ROOT" << endl;
07557               cout << "unsetenv " << use->prefix << "CONFIG" << endl;
07558               break;
07559             case Sh :
07560               cout << "unset " << use->prefix << "ROOT" << endl;
07561               cout << "unset " << use->prefix << "CONFIG" << endl;
07562               break;
07563             case Bat :
07564               cout << "set " << use->prefix << "ROOT=" << endl;
07565               cout << "set " << use->prefix << "CONFIG" << endl;
07566               break;
07567             }
07568         }
07569     }
07570 
07571   switch (mode)
07572     {
07573     case Csh :
07574       cout << "unsetenv CMTEXTRATAGS" << endl;
07575       break;
07576     case Sh :
07577       cout << "unset CMTEXTRATAGS" << endl;
07578       break;
07579     case Bat :
07580       cout << "set CMTEXTRATAGS=" << endl;
07581       break;
07582     }
07583 
07584   cout << endl;
07585 }

void Cmt::print_context (? Use &? ? use,
PrintMode? ? mode,
const cmt_string &? ? tag
)? [static]
?

Definition at line 7588 of file cmt_parser.cxx.

References Bat, Csh, do_config(), CmtSystem::file_separator(), CmtSystem::get_cmt_config(), Project::get_current(), Use::get_full_path(), Use::get_package_name(), get_setup_strategy(), Use::prefix, PrintMode, Use::real_path, cmt_string::replace_all(), SetupConfig, SetupConfigMask, SetupRoot, SetupRootMask, and Sh.

Referenced by print().

07589 {
07590   if (use.get_package_name () == "cmt_standalone") return;
07591 
07592   cmt_string fs = CmtSystem::file_separator ();
07593 
07594   use.real_path.replace_all (CmtSystem::file_separator (), fs);
07595 
07596   cmt_string system = CmtSystem::get_cmt_config ();
07597 
07598   Project* p = Project::get_current ();
07599   int strategy = 0;
07600 
07601   strategy = get_setup_strategy ();
07602 
07603   bool do_config = ((strategy & SetupConfigMask) == SetupConfig);
07604   bool do_root = ((strategy & SetupRootMask) == SetupRoot);
07605 
07606   switch (mode)
07607     {
07608     case Csh :
07609       if (do_root)
07610         {
07611           cout << "setenv " << use.prefix << "ROOT \"" <<
07612             use.get_full_path () << "\"" << endl;
07613         }
07614 
07615       if (use.get_package_name () == "CMT")
07616         {
07617           cout << "setenv CMTCONFIG " << system << endl;
07618         }
07619       else
07620         {
07621           if (do_config)
07622             {
07623               cout << "setenv " << use.prefix << "CONFIG \"" << tag << "\"" << endl;
07624             }
07625         }
07626         
07627       break;
07628     case Sh :
07629       if (do_root)
07630         {
07631           cout << use.prefix << "ROOT=\"" <<
07632             use.get_full_path () << "\"; export " <<
07633             use.prefix << "ROOT" << endl;
07634         }
07635 
07636       if (use.get_package_name () == "CMT")
07637         {
07638           cout << "CMTCONFIG=" << system << "; export CMTCONFIG" << endl;
07639         }
07640       else
07641         {
07642           if (do_config)
07643             {
07644               cout << use.prefix << "CONFIG=\"" <<
07645                 tag << "\"; export " <<
07646                 use.prefix << "CONFIG" << endl;
07647             }
07648         }
07649         
07650       break;
07651     case Bat :
07652       if (do_root)
07653         {
07654           cout << "set " << use.prefix << "ROOT=" <<
07655             use.get_full_path () << endl;
07656         }
07657 
07658       if (use.get_package_name () == "CMT")
07659         {
07660           cout << "set CMTCONFIG=" << system << endl;
07661         }
07662       else
07663         {
07664           if (do_config)
07665             {
07666               cout << "set " << use.prefix << "CONFIG=" << tag << endl;
07667             }
07668         }
07669         
07670       break;
07671     }
07672 }

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 7731 of file cmt_parser.cxx.

References action_build_tag_makefile, action_show_actions, action_show_macros, action_show_sets, m_action, cmt_regexp::match(), Symbol::name, PrintMode, set_standard_macros(), Symbol::show_macro(), cmt_vector< SymbolValueList >::size(), Symbol::symbol(), Symbol::symbol_number(), Symbol::SymbolAction, Symbol::SymbolAlias, Symbol::SymbolCleanupScript, Symbol::SymbolMacro, Symbol::SymbolPath, Symbol::SymbolSet, Symbol::SymbolSetupScript, Symbol::type, and Symbol::value_lists.

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

07732 {
07733   int number;
07734 
07735   set_standard_macros ();
07736 
07737   cmt_regexp expression (pattern);
07738 
07739   bool has_pattern = (pattern != "");
07740 
07741   for (number = 0; number < Symbol::symbol_number (); number++)
07742     {
07743       Symbol& symbol = Symbol::symbol (number);
07744 
07745       if (has_pattern)
07746         {
07747           if (!expression.match (symbol.name)) continue;
07748         }
07749 
07750       if (m_action == action_show_macros)
07751         {
07752           // Only keep macros.
07753           if ((symbol.type == Symbol::SymbolSet) ||
07754               (symbol.type == Symbol::SymbolAlias) ||
07755               (symbol.type == Symbol::SymbolPath) ||
07756               (symbol.type == Symbol::SymbolAction)) continue;
07757         }
07758       else if (m_action == action_show_sets)
07759         {
07760           // Exclude macros.
07761           if ((symbol.type == Symbol::SymbolMacro) ||
07762               (symbol.type == Symbol::SymbolAction)) continue;
07763         }
07764       else if (m_action == action_build_tag_makefile)
07765         {
07766           // Exclude scripts and actions
07767           if ((symbol.type == Symbol::SymbolSetupScript) ||
07768               (symbol.type == Symbol::SymbolCleanupScript) ||
07769               (symbol.type == Symbol::SymbolAction)) continue;
07770         }
07771       else if (m_action == action_show_actions)
07772         {
07773           if (symbol.type != Symbol::SymbolAction) continue;
07774         }
07775 
07776       if (symbol.value_lists.size () < 1) continue;
07777 
07778       symbol.show_macro (mode);
07779     }
07780 }

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 7681 of file cmt_parser.cxx.

References action_show_action_names, action_show_macro_names, action_show_set_names, m_action, cmt_regexp::match(), Symbol::name, PrintMode, set_standard_macros(), Symbol::symbol(), Symbol::symbol_number(), Symbol::SymbolAction, Symbol::SymbolAlias, Symbol::SymbolMacro, Symbol::SymbolPath, Symbol::SymbolSet, and Symbol::type.

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

07682 {
07683   int number;
07684 
07685   set_standard_macros ();
07686 
07687   cmt_regexp expression (pattern);
07688 
07689   bool has_pattern = (pattern != "");
07690 
07691   for (number = 0; number < Symbol::symbol_number (); number++)
07692     {
07693       Symbol& symbol = Symbol::symbol (number);
07694 
07695       if (has_pattern)
07696        {
07697          if (!expression.match (symbol.name)) continue;
07698        }
07699 
07700       if (m_action == action_show_macro_names)
07701         {
07702           // Only keep macros.
07703           if ((symbol.type == Symbol::SymbolSet) ||
07704               (symbol.type == Symbol::SymbolAlias) ||
07705               (symbol.type == Symbol::SymbolPath) ||
07706               (symbol.type == Symbol::SymbolAction)) continue;
07707         }
07708       else if (m_action == action_show_set_names)
07709         {
07710           // Exclude macros.
07711           if ((symbol.type == Symbol::SymbolMacro) ||
07712               (symbol.type == Symbol::SymbolAction)) continue;
07713         }
07714       else if (m_action == action_show_action_names)
07715         {
07716           // Exclude macros.
07717           if (symbol.type != Symbol::SymbolAction) continue;
07718         }
07719 
07720       cout << symbol.name << endl;
07721     }
07722 }

void Cmt::print_tabs (? int? ? tabs )? [static]
?

Definition at line 7783 of file cmt_parser.cxx.

07784 {
07785   while (tabs > 0)
07786     {
07787       cout << "  ";
07788       tabs--;
07789     }
07790 }

int Cmt::reach_current_package (? ? )? [static]
?

Definition at line 7793 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(), m_current_config, m_current_package, m_current_path, m_current_prefix, m_current_style, m_current_tag, m_current_version, m_quiet, Tag::mark(), mgr_style, Use::move_to(), no_version_style, CmtError::package_not_found, 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().

07794 {
07795   Use& use = Use::current ();
07796   cmt_string dir;
07797 
07798   if (m_debug)
07799     {
07800       cout << "Cmt::reach_current_package> pwd = " 
07801            << CmtSystem::pwd () 
07802            << " path=" << m_current_path
07803            << " package=" << m_current_package
07804            << endl;
07805     }
07806 
07807   /*
07808     Try to access the package.
07809   */
07810 
07811   if (m_current_package == "cmt_standalone")
07812     {
07813       if ((m_current_path != "") && (m_current_path != CmtSystem::pwd ()))
07814         {
07815           if (!CmtSystem::cd (m_current_path))
07816             {
07817               CmtError::set (CmtError::package_not_found,
07818                              "ReachCurrentPackage> Cannot reach the path directory");
07819               return (0);
07820             }
07821         }
07822 
07823       if (!CmtSystem::test_file ("requirements"))
07824         {
07825             /*
07826           if (!m_quiet)
07827             {
07828               cout << "#CMT> Cannot reach the requirements file" << endl;
07829             }
07830               
07831           CmtError::set (CmtError::package_not_found,
07832                          "ReachCurrentPackage> Cannot reach the requirements file");
07833             */
07834           return (0);
07835         }
07836     }
07837   else if (m_current_package != "")
07838     {
07839       if (!use.move_to ())
07840         {
07841           CmtError::set (CmtError::package_not_found,
07842                          "ReachCurrentPackage> Cannot reach the path directory");
07843           return (0);
07844         }
07845 
07846       m_current_path = use.real_path;
07847     }
07848   else
07849     {
07850       //
07851       // The cmt command has been given without explicit search for 
07852       // a package. Thus it is expected that we are in the context of a
07853       // true package.
07854       //
07855       //  This means that there should be a requirements file visible.
07856       //
07857       //  If this is not true, we'll make a try into ../cmt and then
07858       // a last try into ../mgr
07859       //
07860 
07861       if (!CmtSystem::test_file ("requirements"))
07862         {
07863           if (CmtSystem::cd ("../cmt") && 
07864               CmtSystem::test_file ("requirements"))
07865             {
07866               m_current_style = cmt_style;
07867             }
07868           else if (CmtSystem::cd ("../mgr") && 
07869                    CmtSystem::test_file ("requirements"))
07870             {
07871               m_current_style = mgr_style;
07872             }
07873           else
07874             {
07875               if (!m_quiet)
07876                 {
07877                   cerr << "#CMT> Cannot reach the mgr branch" << endl;
07878                 }
07879               
07880               CmtError::set (CmtError::package_not_found,
07881                              "ReachCurrentPackage> Cannot reach the mgr/cmt directory");
07882               return (0);
07883             }
07884         }
07885 
07886       dir = CmtSystem::pwd ();
07887 
07888       CmtSystem::dirname (dir, m_current_path);
07889       CmtSystem::basename (m_current_path, m_current_version);
07890 
07891       if (CmtSystem::is_version_directory (m_current_version))
07892         {
07893           CmtSystem::dirname (m_current_path, m_current_path);
07894           CmtSystem::basename (m_current_path, m_current_package);
07895           CmtSystem::dirname (m_current_path, m_current_path);
07896         }
07897       else
07898         {
07899           m_current_package = m_current_version;
07900           m_current_version = "";
07901           CmtSystem::dirname (m_current_path, m_current_path);
07902 
07903           m_current_style = no_version_style;
07904         }
07905 
07906       use.set_package_name (m_current_package);
07907       use.version = m_current_version;
07908       use.path    = m_current_path;
07909       use.style   = m_current_style;
07910     }
07911 
07912   configure_current_dir ();
07913   build_prefix (m_current_package, m_current_prefix);
07914   build_config (m_current_prefix, m_current_config);
07915 
07916   /*
07917     Check Tag is always set up
07918   */
07919 
07920   if (m_debug) cout << "reach_current_package0> current_tag=" << m_current_tag << endl;
07921 
07922   if (m_current_tag == "")
07923     {
07924       cmt_string env;
07925 
07926       env = CmtSystem::getenv (m_current_config);
07927       if (env != "")
07928         {
07929           Tag* tag;
07930 
07931           tag = Tag::add (env, PriorityConfig, "reach current package", 0);
07932           tag->mark ();
07933             //m_current_tag = env;
07934 
07935           //if (!m_quiet) cerr << "reach_current_package1> current_tag=" << m_current_tag << endl;
07936 
07937         }
07938     }
07939 
07940   if (m_debug)
07941     {
07942       cout << "pwd = " << CmtSystem::pwd () << endl;
07943     }
07944 
07945   /*
07946     Work on the requirements file.
07947   */
07948 
07949   if (dir != "") dir += CmtSystem::file_separator ();
07950   dir += "requirements";
07951   SyntaxParser::parse_requirements (dir, &use);
07952 
07953   if (m_debug) cout << "reach_current_package2> current_tag=" << m_current_tag << endl;
07954 
07976   Pattern::apply_all_globals ();
07977 
07978   /*
07979     Select all possible tags
07980   */
07981 
07982   Tag::restore_tree ();
07983 
07984   return (1);
07985 }

void Cmt::restore_all_tags (? Use *? ? use )? [static]
?

Definition at line 1068 of file cmt_parser.cxx.

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

Referenced by parse_arguments().

01069 {
01070     //cerr << "restore_all_tags" << endl;
01071 
01072   Cmt::configure_tags (use);
01073 
01074     /*
01075       Then get existing extra tags
01076      */
01077 
01078   if (CmtSystem::testenv ("CMTEXTRATAGS"))
01079     {
01080       cmt_string s = "CMTEXTRATAGS";
01081 
01082       if (use != 0)
01083         {
01084           s += " in ";
01085         }
01086 
01087       Tag* tag;
01088       CmtSystem::cmt_string_vector words;
01089       
01090       cmt_string tags = CmtSystem::getenv ("CMTEXTRATAGS");
01091       
01092       CmtSystem::split (tags, " \t,", words);
01093 
01094       Cmt::m_extra_tags = ",";
01095       
01096       for (int i = 0; i < words.size (); i++)
01097         {
01098           const cmt_string& a = words[i];
01099 
01100           Cmt::m_extra_tags += a;
01101           Cmt::m_extra_tags += ",";
01102           
01103           tag = Tag::add (a, PriorityUserTag, s, use);
01104           
01105           tag->mark ();
01106         }
01107     }
01108 }

void Cmt::set_current_access (? AccessMode? ? mode )? [static]
?

Definition at line 9051 of file cmt_parser.cxx.

References AccessMode, and m_current_access.

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

09052 {
09053   m_current_access = mode;
09054 }

void Cmt::set_current_build_strategy (? int? ? strategy )? [static]
?

Definition at line 9057 of file cmt_parser.cxx.

References m_current_build_strategy.

Referenced by KwdBuildStrategy::action().

09058 {
09059   m_current_build_strategy = strategy;
09060 }

void Cmt::set_current_setup_strategy (? int? ? strategy )? [static]
?

Definition at line 9063 of file cmt_parser.cxx.

References m_current_setup_strategy.

Referenced by KwdSetupStrategy::action().

09064 {
09065   m_current_setup_strategy = strategy;
09066 }

void Cmt::set_scope_filtering_mode (? CmtScopeFilteringMode? ? mode )? [static]
?

Definition at line 9069 of file cmt_parser.cxx.

References CmtScopeFilteringMode, and m_scope_filtering_mode.

Referenced by parse_arguments().

09070 {
09071   m_scope_filtering_mode = mode;
09072 }

void Cmt::set_standard_macros (? ? )? [static]
?

Definition at line 9075 of file cmt_parser.cxx.

References CmtPathPattern::apply_all(), CmtSystem::basename(), Symbol::build_macro_value(), cmt_style, Constituent::constituents(), Use::current(), CmtSystem::dirname(), CmtSystem::file_separator(), StandardMacroBuilder::fill_for_all_constituents(), StandardMacroBuilder::fill_for_branches(), StandardMacroBuilder::fill_for_current_package(), StandardMacroBuilder::fill_for_fincludes(), StandardMacroBuilder::fill_for_includes(), 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(), get_build_strategy(), Use::get_ordered_uses(), Use::get_package_name(), CmtSystem::getenv(), Constituent::group, Group::groups(), InstallAreaMask, CmtInstallAreaMgr::instance(), Symbol::is_selected(), CmtSystem::is_version_directory(), m_current_dir, m_current_package, m_current_prefix, m_current_style, m_current_tag, m_current_version, m_standard_macros_done, mgr_style, Group::name(), Constituent::name, no_version_style, none_style, SyntaxParser::parse_requirements_line(), CmtSystem::pwd(), CmtInstallAreaMgr::setup(), CmtInstallAreaMgr::setup_current_installarea(), cmt_vector< Group >::size(), cmt_vector< Constituent >::size(), CmtSystem::split(), CmtSystem::test_file(), CmtSystem::testenv(), and WithInstallArea.

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().

09076 {
09077   if (m_standard_macros_done) return;
09078 
09079   m_standard_macros_done = true;
09080 
09081   int number;
09082   cmt_string temp;
09083   Use::UsePtrVector& Uses = Use::get_ordered_uses ();
09084   Use& current_use = Use::current ();
09085 
09086   cmt_string fs = CmtSystem::file_separator ();
09087 
09088   cmt_string pwd = CmtSystem::pwd ();
09089 
09090   if (CmtSystem::test_file ("../cmt/requirements")) m_current_style = cmt_style;
09091   else if (CmtSystem::test_file ("../mgr/requirements")) m_current_style = mgr_style;
09092   else m_current_style = none_style;
09093 
09094   {
09095     cmt_string v;
09096     CmtSystem::dirname (pwd, v);
09097     CmtSystem::basename (v, v);
09098     if (!CmtSystem::is_version_directory (v))
09099       {
09100         m_current_style = no_version_style;
09101       }
09102   }
09103 
09104   // Prepare computation of the best form for relative path from current directory
09105   // to package directories.
09106   CmtSystem::cmt_string_vector vb;
09107   CmtSystem::split (pwd, fs, vb);
09108 
09109 
09114   bool tag_debug = CmtSystem::testenv ("TAGDEBUG");
09115 
09116   if (tag_debug) cerr << "set_standard_macro0> current_tag=" << m_current_tag << endl;
09117 
09118   if (m_current_tag != "")
09119     {
09120         // this is when some -tag= argument was used.
09121       if (tag_debug) cerr << "set_standard_macro0.1> current_tag=" << m_current_tag << endl;
09122     }
09123   else if (Symbol::is_selected ("CMTCONFIG"))
09124     {
09125         // This is when CMTCONFIG has been set from some requirements file
09126       Symbol* macro = Symbol::find ("CMTCONFIG");
09127       if (macro != 0)
09128         {
09129           m_current_tag = macro->build_macro_value ();
09130           if (tag_debug) cerr << "set_standard_macro1> current_tag=" << m_current_tag << endl;
09131         }
09132     }
09133   else
09134     {
09135         // this is when no -tag= argument was used.
09136       if (tag_debug) cerr << "set_standard_macro(before2)> current_tag=" << m_current_tag << endl;
09137       if (current_use.get_package_name () == "CMT")
09138         {
09139           m_current_tag = CmtSystem::getenv ("CMTBIN");
09140         }
09141       else
09142         {
09143           m_current_tag = CmtSystem::getenv ("CMTCONFIG");
09144         }
09145 
09146       if (tag_debug) cerr << "set_standard_macro2> current_tag=" << m_current_tag << endl;
09147     }
09148 
09149   if (m_debug)
09150     {
09151       cout << "set_standard_macro3>" << endl;
09152     }
09153 
09154   StandardMacroBuilder builder (m_current_tag,
09155                                 m_current_package,
09156                                 m_current_version,
09157                                 m_current_prefix,
09158                                 m_current_style);
09159 
09160 
09161     //
09162     //  Definitions for installation area mechanisms
09163     //
09164   if ((get_build_strategy () & InstallAreaMask) == WithInstallArea)
09165     {
09166       CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
09167 
09168       //cout << "#IA6>" << endl;
09169 
09170       ia_mgr.setup_current_installarea ();
09171     }
09172 
09173   builder.fill_for_current_package (m_current_dir);
09174 
09175   builder.fill_for_branches ();
09176   builder.fill_for_project ();
09177   builder.fill_for_use_requirements ();
09178   builder.fill_for_use_includes ();
09179   builder.fill_for_use_fincludes ();
09180   builder.fill_for_use_stamps ();
09181   builder.fill_for_use_cflags ();
09182   builder.fill_for_use_pp_cflags ();
09183   builder.fill_for_use_cppflags ();
09184   builder.fill_for_use_pp_cppflags ();
09185   builder.fill_for_use_fflags ();
09186   builder.fill_for_use_pp_fflags ();
09187   builder.fill_for_use_linkopts ();
09188   builder.fill_for_use_libraries ();
09189   builder.fill_for_includes ();
09190   builder.fill_for_fincludes ();
09191   builder.fill_for_all_constituents ();
09192 
09197   const Constituent::ConstituentVector& constituents =
09198     Constituent::constituents ();
09199   
09200   if (!Symbol::is_selected ("constituents"))
09201     {
09202       temp = "macro_append constituents \" ";
09203       
09204       for (number = 0; number < constituents.size (); number++)
09205         {
09206           const Constituent& constituent = constituents[number];
09207 
09208           if (constituent.group == 0)
09209             {
09210               temp += constituent.name;
09211               temp += " ";
09212             }
09213         }
09214       
09215       temp += "\"";
09216       
09217       SyntaxParser::parse_requirements_line (temp, ¤t_use);
09218     }
09219 
09220   SyntaxParser::parse_requirements_line ("macro_append all_constituents \" $(constituents)\"", 
09221                                       ¤t_use);
09222 
09223   if (!Symbol::is_selected ("constituentsclean"))
09224     {
09225       temp = "macro_append constituentsclean \" ";
09226       
09227       for (number = constituents.size () - 1; number >= 0 ; number--)
09228         {
09229           const Constituent& constituent = constituents[number];
09230 
09231           if (constituent.group == 0)
09232             {
09233               temp += constituent.name;
09234               temp += "clean ";
09235             }
09236         }
09237       
09238       temp += "\"";
09239       
09240       SyntaxParser::parse_requirements_line (temp, ¤t_use);
09241     }
09242 
09243   SyntaxParser::parse_requirements_line ("macro_append all_constituentsclean \" $(constituentsclean)\"", 
09244                                       ¤t_use);
09245 
09246   const Group::GroupVector& groups = Group::groups ();
09247   
09248   for (number = 0; number < groups.size (); number++)
09249     {
09250       const Group& group = groups[number];
09251 
09252       temp = "macro_append ";
09253       temp += group.name ();
09254       temp += "_constituents \" ";
09255 
09256       int i;
09257 
09258       for (i = 0; i < constituents.size (); i++)
09259         {
09260           const Constituent& constituent = constituents[i];
09261 
09262           if ((constituent.group != 0) && 
09263               (group.name () == constituent.group->name ()))
09264             {
09265               temp += constituent.name;
09266               temp += " ";
09267             }
09268         }
09269       
09270       temp += "\"";
09271       
09272       SyntaxParser::parse_requirements_line (temp, ¤t_use);
09273 
09274       temp = "macro_append ";
09275       temp += group.name ();
09276       temp += "_constituentsclean \" ";
09277       
09278       for (i = constituents.size () - 1; i >= 0 ; i--)
09279         {
09280           const Constituent& constituent = constituents[i];
09281 
09282           if ((constituent.group != 0) && 
09283               (group.name () == constituent.group->name ()))
09284             {
09285               temp += constituent.name;
09286               temp += "clean ";
09287             }
09288         }
09289       
09290       temp += "\"";
09291       
09292       SyntaxParser::parse_requirements_line (temp, ¤t_use);
09293     }
09294 
09295     //
09296     //  Definitions for installation area mechanisms. Apply all cmtpath patterns
09297     //
09298   if ((get_build_strategy () & InstallAreaMask) == WithInstallArea)
09299     {
09300       CmtInstallAreaMgr& ia_mgr = CmtInstallAreaMgr::instance ();
09301 
09302       //cout << "#IA7>" << endl;
09303 
09304       ia_mgr.setup ();
09305     }
09306 
09307   CmtPathPattern::apply_all ();
09308 }

void Cmt::use_cmt (? ? )? [static]
?

Macros implied or required to manage constituents.

Definition at line 9311 of file cmt_parser.cxx.

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

Referenced by load(), and parser().

09312 {
09313   UseRef use;
09314   bool recursive_copy = m_recursive;
09315   bool debug_copy = m_debug;
09316 
09317   if (m_default_path.size () <= 0) return;
09318   if (m_current_package == "CMT") return;
09319 
09320   m_recursive = true;
09321   m_debug = false;
09322   use = Use::add (m_default_path, "CMT", m_cmt_version, "", "", 0);
09323   m_recursive = recursive_copy;
09324   m_debug = debug_copy;
09325 }

void Cmt::use_home_requirements (? ? )? [static]
?

Definition at line 9328 of file cmt_parser.cxx.

References CmtSystem::get_home_package(), m_cmt_home, and use_special_requirements().

Referenced by parser().

09329 {
09330   use_special_requirements (m_cmt_home, 
09331                             CmtSystem::get_home_package (), 
09332                             "requirements");
09333 }

void Cmt::use_special_requirements (? const cmt_string &? ? path,
const cmt_string &? ? name,
const cmt_string &? ? file_name
)? [static]
?

Definition at line 9344 of file cmt_parser.cxx.

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

Referenced by use_home_requirements(), and use_user_context_requirements().

09347 {
09348   if (path == "") 
09349     {
09350       return;
09351     }
09352 
09353   UseRef use;
09354   bool recursive_copy = m_recursive;
09355 
09356   if (m_default_path.size () <= 0) return;
09357   if (m_current_package == "CMT") return;
09358 
09359   m_recursive = true;
09360 
09361   use = Use::add (path, name, "v0", "", "", 0);
09362 
09363   cmt_string f = m_cmt_user_context;
09364   f += CmtSystem::file_separator ();
09365   f += file_name;
09366   SyntaxParser::parse_requirements (f, use);
09367 
09368   m_recursive = recursive_copy;
09369 }

void Cmt::use_user_context_requirements (? ? )? [static]
?

Definition at line 9336 of file cmt_parser.cxx.

References CmtSystem::get_user_context_package(), m_cmt_user_context, and use_special_requirements().

Referenced by parser().

09337 {
09338   use_special_requirements (m_cmt_user_context, 
09339                             CmtSystem::get_user_context_package (), 
09340                             "requirements");
09341 }

void Cmt::vector_to_string (? const CmtSystem::cmt_string_vector &? ? v,
const cmt_string &? ? separator,
cmt_string &? ? result
)? [static]
?

Definition at line 9372 of file cmt_parser.cxx.

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

09375 {
09376   result.erase (0);
09377 
09378   for (int i = 0; i < v.size (); i++)
09379     {
09380       const cmt_string& s = v[i];
09381       if (s == "") continue;
09382 
09383       if (i > 0) result += separator;
09384       result += v[i];
09385     }
09386 }

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

Definition at line 9389 of file cmt_parser.cxx.

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

09390 {
09391   cmt_string result;
09392 
09393   vector_to_string (v, " ", result);
09394 
09395   return (result);
09396 }

Member Data Documentation

ActionType Cmt::m_action [static, private]
?

All Attributes are private.

Definition at line 42 of file cmt_parser.cxx.

Referenced by clear(), configure_cmt_path(), configure_tags(), do_set_versions(), do_show_action(), do_show_macro(), load(), parse_arguments(), parser(), print_macros(), and print_symbol_names().

bool Cmt::m_build_nmake [static, private]
?

Definition at line 44 of file cmt_parser.cxx.

Referenced by clear(), and parse_arguments().

cmt_string Cmt::m_cmt_config [static, private]
?

Definition at line 45 of file cmt_parser.cxx.

Referenced by clear(), configure_config_tag(), do_config(), and load().

cmt_string Cmt::m_cmt_home [static, private]
?

Definition at line 47 of file cmt_parser.cxx.

Referenced by configure_cmt_path(), configure_home(), parse_arguments(), and use_home_requirements().

cmt_string Cmt::m_cmt_root [static, private]
?

Definition at line 46 of file cmt_parser.cxx.

Referenced by clear(), configure_default_path(), do_build_CMT_pacman(), install_cleanup_scripts(), install_setup_scripts(), install_test_cleanup_scripts(), and install_test_setup_scripts().

cmt_string Cmt::m_cmt_site [static, private]
?

Definition at line 49 of file cmt_parser.cxx.

Referenced by configure_site_tag().

cmt_string Cmt::m_cmt_user_context [static, private]
?

Definition at line 48 of file cmt_parser.cxx.

Referenced by configure_cmt_path(), configure_user_context(), parse_arguments(), use_special_requirements(), and use_user_context_requirements().

cmt_string Cmt::m_cmt_version [static, private]
?

Definition at line 50 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_current_dir(), configure_default_path(), do_config(), and use_cmt().

cmt_string Cmt::m_configure_error [static, private]
?

Definition at line 72 of file cmt_parser.cxx.

Referenced by configure(), and parser().

AccessMode Cmt::m_current_access = UserMode [static, private]
?

Definition at line 62 of file cmt_parser.cxx.

Referenced by clear(), load(), parse_arguments(), parser(), and set_current_access().

int Cmt::m_current_build_strategy = DefaultBuildStrategy [static, private]
?

Definition at line 51 of file cmt_parser.cxx.

Referenced by clear(), do_show_strategies(), and set_current_build_strategy().

cmt_string Cmt::m_current_cmtpath [static, private]
?

Definition at line 59 of file cmt_parser.cxx.

Referenced by clear(), configure(), and configure_current_cmtpath().

cmt_string Cmt::m_current_config [static, private]
?

Definition at line 56 of file cmt_parser.cxx.

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

cmt_string Cmt::m_current_dir [static, private]
?

Definition at line 54 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_current_dir(), configure_current_package(), do_config(), do_show_pwd(), load(), and set_standard_macros().

cmt_string Cmt::m_current_offset [static, private]
?

Definition at line 60 of file cmt_parser.cxx.

Referenced by clear(), configure(), and configure_current_cmtpath().

cmt_string Cmt::m_current_package [static, private]
?

Definition at line 55 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_current_package(), do_build_constituents_makefile(), do_build_make_setup(), do_config(), do_remove(), install_cleanup_scripts(), install_setup_scripts(), load(), parse_arguments(), parser(), print_clean(), reach_current_package(), set_standard_macros(), use_cmt(), and use_special_requirements().

cmt_string Cmt::m_current_path [static, private]
?

Definition at line 57 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_current_package(), do_config(), install_cleanup_scripts(), install_setup_scripts(), install_test_cleanup_scripts(), install_test_setup_scripts(), load(), parse_arguments(), parser(), and reach_current_package().

cmt_string Cmt::m_current_prefix [static, private]
?

Definition at line 58 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_current_package(), load(), print_clean(), reach_current_package(), and set_standard_macros().

int Cmt::m_current_setup_strategy = DefaultSetupStrategy [static, private]
?

Definition at line 52 of file cmt_parser.cxx.

Referenced by clear(), parse_arguments(), and set_current_setup_strategy().

CmtStructuringStyle Cmt::m_current_structuring_style = with_version_directory [static, private]
?

Definition at line 64 of file cmt_parser.cxx.

Referenced by configure_current_structuring_style(), and parse_arguments().

CmtDirStyle Cmt::m_current_style = cmt_style [static, private]
?

Definition at line 63 of file cmt_parser.cxx.

Referenced by configure(), configure_current_package(), do_config(), load(), reach_current_package(), and set_standard_macros().

cmt_string Cmt::m_current_tag [static, private]
?

Definition at line 66 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_tags(), load(), parse_arguments(), parser(), print(), reach_current_package(), and set_standard_macros().

cmt_string Cmt::m_current_target [static, private]
?

Definition at line 67 of file cmt_parser.cxx.

Referenced by clear(), and parse_arguments().

cmt_string Cmt::m_current_version [static, private]
?

Definition at line 68 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_current_package(), do_config(), do_show_version(), install_cleanup_scripts(), install_setup_scripts(), install_test_cleanup_scripts(), load(), parse_arguments(), parser(), reach_current_package(), and set_standard_macros().

bool Cmt::m_debug [static, private]
?

Definition at line 74 of file cmt_parser.cxx.

Referenced by configure(), and use_cmt().

cmt_string Cmt::m_default_path [static, private]
?

Definition at line 76 of file cmt_parser.cxx.

Referenced by clear(), configure(), configure_current_dir(), configure_default_path(), do_config(), load(), parse_arguments(), use_cmt(), and use_special_requirements().

cmt_string Cmt::m_extra_tags [static, private]
?

Definition at line 70 of file cmt_parser.cxx.

Referenced by parse_arguments(), print(), and restore_all_tags().

ActionType Cmt::m_help_action [static, private]
?

Definition at line 43 of file cmt_parser.cxx.

Referenced by clear(), parse_arguments(), and parser().

bool Cmt::m_quiet [static, private]
?

Definition at line 77 of file cmt_parser.cxx.

Referenced by clear(), do_broadcast(), do_config(), do_remove_library_links(), do_show_tags(), load(), parse_arguments(), parser(), and reach_current_package().

bool Cmt::m_recursive [static, private]
?

Definition at line 78 of file cmt_parser.cxx.

Referenced by clear(), load(), parser(), use_cmt(), and use_special_requirements().

CmtScopeFilteringMode Cmt::m_scope_filtering_mode [static, private]
?

Definition at line 79 of file cmt_parser.cxx.

Referenced by clear(), get_scope_filtering_mode(), parse_arguments(), and set_scope_filtering_mode().

bool Cmt::m_simulation [static, private]
?

Definition at line 80 of file cmt_parser.cxx.

Referenced by build_makefile(), build_msdev_file(), build_vsnet_file(), clear(), and parse_arguments().

bool Cmt::m_standard_macros_done [static, private]
?

Definition at line 81 of file cmt_parser.cxx.

Referenced by clear(), and set_standard_macros().


The documentation for this class was generated from the following files:
Generated on Wed Sep 1 10:59:57 2004 for CMT by 1.2.18