#ifndef __cmt_h__
#define __cmt_h__

#include "cmt_parser.h"
#include "cmt_system.h"

class Symbol;
class Tag;

class Cmt
{
 public:
  static void build_config (const cmt_string& prefix, cmt_string& config);
  static void build_makefile (const cmt_string& target);
  static void build_msdev_file (const cmt_string& target);
  static bool build_nmake ();
  static void build_OS9_makefile (const cmt_string& target);
  static void build_prefix (const cmt_string& package, cmt_string& prefix);
  static void clear ();

  static void configure ();
  static void configure_cmt_path (Use* use);
  static void configure_config_tag ();
  static void configure_current_dir ();
  static void configure_current_package ();
  static void configure_default_path ();
  static void configure_home (Use* use);
  static void configure_user_context (Use* use);
  static void configure_hosttype_tag ();
  static void configure_site_tag (Use* use);
  static void configure_tags (Use* use);
  static void configure_uname_tag ();

  static void do_awk (const CmtSystem::cmt_string_vector& arguments);
  static void do_broadcast (const CmtSystem::cmt_string_vector& arguments,
                            int argc,
                            char* argv[]);
  static void do_build_constituent_makefile (const CmtSystem::cmt_string_vector& arguments,
                                             int argc,
                                             char* argv[]);
  static void do_build_constituents_makefile (const CmtSystem::cmt_string_vector& arguments,
                                              int argc,
                                              char* argv[]);
  static void do_build_dependencies (const CmtSystem::cmt_string_vector& arguments,
                                     int argc,
                                     char* argv[]);
  static void do_build_library_links ();
  static void do_build_make_setup ();
  static void do_build_msdev (const CmtSystem::cmt_string_vector& arguments);
  static void do_build_os9_makefile (const CmtSystem::cmt_string_vector& arguments);
  static void do_build_prototype (const CmtSystem::cmt_string_vector& arguments);
  static void do_build_readme (const CmtSystem::cmt_string_vector& arguments);
  static void do_build_tag_makefile ();
  static void do_build_temporary_name ();
  static void do_build_triggers (const CmtSystem::cmt_string_vector& arguments);
  static void do_build_windefs (const CmtSystem::cmt_string_vector& arguments);
  static void do_check_configuration ();
  static void do_check_files (const CmtSystem::cmt_string_vector& arguments);
  static void do_check_version (const CmtSystem::cmt_string_vector& arguments);
  static void do_checkout (const CmtSystem::cmt_string_vector& arguments);
  static void do_cleanup (PrintMode& mode);
  static void do_config ();
  static void do_create (const CmtSystem::cmt_string_vector& arguments);
  static void do_cvsbranches (const CmtSystem::cmt_string_vector& arguments);
  static void do_cvssubpackages (const CmtSystem::cmt_string_vector& arguments);
  static void do_cvstags (const CmtSystem::cmt_string_vector& arguments);
  static void do_expand_model (const CmtSystem::cmt_string_vector& arguments);
  static void do_filter (const CmtSystem::cmt_string_vector& arguments);
  static void do_help ();
  static void do_lock (const cmt_string& package,
                       const cmt_string& version,
                       const cmt_string& path);
  static void do_remove (const cmt_string& package,
                         const cmt_string& version,
                         const cmt_string& path);
  static void do_remove_library_links ();
  static void do_run (const CmtSystem::cmt_string_vector& arguments);
  static void do_run_sequence (const CmtSystem::cmt_string_vector& arguments);
  static void do_setup (PrintMode& mode);
  static void do_show_all_tags ();
  static void do_show_applied_patterns ();
  static void do_show_author ();
  static void do_show_branches (PrintMode& mode);
  static void do_show_clients (const CmtSystem::cmt_string_vector& arguments);
  static void do_show_constituent (const CmtSystem::cmt_string_vector& arguments);
  static void do_show_constituent_names ();
  static void do_show_constituents ();
  static void do_show_fragment (const CmtSystem::cmt_string_vector& arguments);
  static void do_show_fragments ();
  static void do_show_groups ();
  static void do_show_include_dirs ();
  static void do_show_language (const CmtSystem::cmt_string_vector& arguments);
  static void do_show_languages ();
  static void do_show_macro (const CmtSystem::cmt_string_vector& arguments,
			     PrintMode& mode);
  static void do_show_macro_names (const CmtSystem::cmt_string_vector& arguments,
				   PrintMode& mode);
  static void do_show_macro_value (const CmtSystem::cmt_string_vector& arguments,
				   PrintMode& mode);
  static void do_show_macros (const CmtSystem::cmt_string_vector& arguments,
			      PrintMode& mode);
  static void do_show_manager ();
  static void do_show_packages (const CmtSystem::cmt_string_vector& arguments);
  static void do_show_path ();
  static void do_show_pattern (const CmtSystem::cmt_string_vector& arguments);
  static void do_show_pattern_names ();
  static void do_show_patterns ();
  static void do_show_pwd ();
  static void do_show_set (const CmtSystem::cmt_string_vector& arguments,
			   PrintMode& mode);
  static void do_show_set_names (const CmtSystem::cmt_string_vector& arguments,
                                 PrintMode& mode);
  static void do_show_set_value (const CmtSystem::cmt_string_vector& arguments,
				 PrintMode& mode);
  static void do_show_sets (const CmtSystem::cmt_string_vector& arguments,
			    PrintMode& mode);
  static void do_show_strategies ();
  static void do_show_tags ();
  static void do_show_uses ();
  static void do_show_version ();
  static void do_show_versions (const CmtSystem::cmt_string_vector& arguments);
  static void do_show_system ();
  static void do_unlock (const cmt_string& package,
                         const cmt_string& version,
                         const cmt_string& path);
  static void do_version ();


  static const cmt_string& filter_dir (const cmt_string& dir);

  static ActionType get_action ();
  static const CmtSystem::cmt_string_vector& get_cmt_path ();
  static const cmt_string& get_cmt_home ();
  static const cmt_string& get_cmt_user_context ();
  static const cmt_string& get_current_dir ();
  static const cmt_string& get_current_package ();
  static AccessMode get_current_access ();
  static VersionStrategy get_current_strategy ();
  static const cmt_string& get_current_version ();
  static const cmt_string& get_current_target ();
  static bool get_debug ();
  static bool get_quiet ();
  static bool get_recursive ();
  static ScopeType get_scope ();

  static void install_cleanup_scripts ();
  static void install_setup_scripts ();
  static void install_test_cleanup_scripts ();
  static void install_test_setup_scripts ();
  static bool load (const cmt_string& path,
                    const cmt_string& package,
                    const cmt_string& version,
                    const cmt_string& tag_name = "");
  static bool need_prototypes ();
  static void parse_arguments (int argc, char* argv[],
                               CmtSystem::cmt_string_vector& arguments,
                               cmt_string& extra_line,
                               cmt_string& extra_file,
                               PrintMode& mode);
  static void parse_requirements (const cmt_string& file_name, Use* use);
  static void parse_requirements_line (const cmt_string& line,
                                       Use* use,
                                       const cmt_string& file_name = "",
                                       int line_number = 0);
  static void parse_requirements_text (const cmt_string& text,
                                       const cmt_string& file_name,
                                       Use* use);
  static int parser (const cmt_string& command_line);
  static int parser (int argc, char* argv[]);
  static void print (PrintMode mode);
  static void print_clean (PrintMode mode);
  static void print_context (Use& use, PrintMode mode, const cmt_string& tag);
  static void print_macros (PrintMode mode, const cmt_string& pattern = "");
  static void print_symbol_names (PrintMode mode, const cmt_string& pattern = "");
  static void print_tabs (int tabs);
  static int reach_current_package ();
  static void restore_all_tags (Use* use);
  static void select (const CmtSystem::cmt_string_vector& words, Use* use,
                      const cmt_string& file_name,
                      int line_number);
  static void set_standard_macros ();
  static void use_cmt ();
  static void use_home_requirements ();
  static void use_user_context_requirements ();
  static cmt_string vector_to_string (const CmtSystem::cmt_string_vector& v);
  static void vector_to_string (const CmtSystem::cmt_string_vector& v,
                                const cmt_string& separator,
                                cmt_string& result);

private:

  /// All Attributes are private

  static ActionType m_action;
  static bool m_build_nmake;
  static cmt_string m_cmt_config;
  static CmtSystem::cmt_string_vector m_cmt_path;
  static CmtSystem::cmt_string_vector m_cmt_path_pwds;
  static CmtSystem::cmt_string_vector m_cmt_path_sources;
  static cmt_string m_cmt_root;
  static cmt_string m_cmt_home;
  static cmt_string m_cmt_user_context;
  static cmt_string m_cmt_site;
  static cmt_string m_cmt_version;

  static int m_current_build_strategy;

  static cmt_string m_current_dir;
  static cmt_string m_current_package;
  static cmt_string m_current_config;
  static cmt_string m_current_path;
  static cmt_string m_current_prefix;

  static AccessMode m_current_access;
  static VersionStrategy m_current_strategy;
  static CmtDirStyle m_current_style;

  static cmt_string m_current_tag;
  static cmt_string m_current_target;
  static cmt_string m_current_version;

  static cmt_string m_extra_tags;
  static cmt_string m_configure_error;

  static bool m_debug;

  static cmt_string m_default_path;
  static cmt_string m_filtered_text;
  static bool m_quiet;
  static bool m_recursive;
  static ScopeType m_scope;
  static bool m_simulation;
  static bool m_standard_macros_done;
};

#endif
