[2] | 1 | //----------------------------------------------------------- |
---|
| 2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
| 3 | // arnault@lal.in2p3.fr |
---|
[272] | 4 | // Modified by garonne@lal.in2p3.fr |
---|
[2] | 5 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
| 6 | //----------------------------------------------------------- |
---|
| 7 | |
---|
| 8 | #ifndef __cmt_h__ |
---|
| 9 | #define __cmt_h__ |
---|
| 10 | |
---|
| 11 | #include "cmt_parser.h" |
---|
| 12 | #include "cmt_system.h" |
---|
| 13 | |
---|
| 14 | class ArgParser; |
---|
| 15 | class Symbol; |
---|
| 16 | class Tag; |
---|
| 17 | |
---|
| 18 | class CmtContext |
---|
| 19 | { |
---|
| 20 | public: |
---|
| 21 | |
---|
| 22 | CmtContext (); |
---|
| 23 | ~CmtContext (); |
---|
| 24 | |
---|
| 25 | void clear (); |
---|
| 26 | |
---|
| 27 | ActionType m_action; |
---|
| 28 | bool m_build_nmake; |
---|
| 29 | cmt_string m_cmt_config; |
---|
| 30 | cmt_string m_cmt_root; |
---|
| 31 | cmt_string m_cmt_home; |
---|
| 32 | cmt_string m_cmt_user_context; |
---|
| 33 | cmt_string m_cmt_site; |
---|
| 34 | cmt_string m_cmt_version; |
---|
[561] | 35 | bool m_use_cmt; |
---|
[2] | 36 | |
---|
| 37 | cmt_string m_current_dir; |
---|
[411] | 38 | FilePath m_current_file_path; |
---|
[2] | 39 | cmt_string m_current_package; |
---|
| 40 | cmt_string m_current_config; |
---|
| 41 | cmt_string m_current_path; |
---|
| 42 | cmt_string m_current_prefix; |
---|
| 43 | cmt_string m_current_cmtpath; |
---|
| 44 | cmt_string m_current_offset; |
---|
| 45 | |
---|
| 46 | AccessMode m_current_access; |
---|
| 47 | CmtDirStyle m_current_style; |
---|
| 48 | CmtStructuringStyle m_current_structuring_style; |
---|
| 49 | |
---|
| 50 | cmt_string m_current_tag; |
---|
| 51 | cmt_string m_current_target; |
---|
| 52 | cmt_string m_current_version; |
---|
| 53 | |
---|
| 54 | cmt_string m_extra_tags; |
---|
| 55 | cmt_string m_configure_error; |
---|
| 56 | |
---|
| 57 | bool m_debug; |
---|
| 58 | |
---|
| 59 | cmt_string m_default_path; |
---|
| 60 | bool m_quiet; |
---|
[282] | 61 | bool m_disable_warnings; |
---|
[109] | 62 | bool m_warnings; |
---|
[2] | 63 | bool m_recursive; |
---|
| 64 | CmtScopeFilteringMode m_scope_filtering_mode; |
---|
| 65 | bool m_simulation; |
---|
| 66 | bool m_standard_macros_done; |
---|
| 67 | bool m_all_sets_done; |
---|
[9] | 68 | |
---|
| 69 | bool m_autoconfigure_cmtpath; |
---|
[2] | 70 | }; |
---|
| 71 | |
---|
| 72 | class Cmt |
---|
| 73 | { |
---|
| 74 | public: |
---|
| 75 | static void build_config (const cmt_string& prefix, cmt_string& config); |
---|
| 76 | static void build_makefile (const cmt_string& target); |
---|
| 77 | static void build_msdev_file (const cmt_string& target); |
---|
| 78 | // Visual Studio.Net Support |
---|
| 79 | static void build_vsnet_file (const cmt_string& target); |
---|
| 80 | |
---|
| 81 | static bool build_nmake (); |
---|
| 82 | static void build_OS9_makefile (const cmt_string& target); |
---|
| 83 | static void build_prefix (const cmt_string& package, cmt_string& prefix); |
---|
| 84 | static void clear (); |
---|
| 85 | |
---|
[438] | 86 | // static void configure (); |
---|
| 87 | static void configure (const ArgParser& ap); |
---|
[2] | 88 | static void configure_cmt_path (Use* use); |
---|
| 89 | static void configure_config_tag (); |
---|
| 90 | static void configure_current_cmtpath (); |
---|
| 91 | static void configure_current_dir (); |
---|
| 92 | static void configure_current_package (); |
---|
[438] | 93 | // static void configure_current_structuring_style (); |
---|
| 94 | static void configure_current_structuring_style (const ArgParser& ap); |
---|
[2] | 95 | static void configure_default_path (); |
---|
| 96 | static void configure_home (Use* use); |
---|
| 97 | static void configure_user_context (Use* use); |
---|
| 98 | static void configure_hosttype_tag (); |
---|
| 99 | static void configure_site_tag (Use* use); |
---|
| 100 | static void configure_tags (Use* use); |
---|
| 101 | static void configure_uname_tag (); |
---|
[521] | 102 | static void configure_devenv_tag (); |
---|
[2] | 103 | static void configure_version_tag (); |
---|
[459] | 104 | // static void configure_cmt_message (); |
---|
| 105 | static void configure_cmt_message (const ArgParser& ap); |
---|
[2] | 106 | |
---|
| 107 | static void do_awk (const ArgParser& ap); |
---|
| 108 | static void do_broadcast (const ArgParser& ap); |
---|
| 109 | static void do_build_constituent_makefile (const ArgParser& ap); |
---|
[547] | 110 | static void do_build_constituent_config (const ArgParser& ap); |
---|
[2] | 111 | static void do_build_constituents_makefile (const ArgParser& ap); |
---|
[547] | 112 | static void do_build_constituents_config (const ArgParser& ap); |
---|
[588] | 113 | static void do_build_broadcast_config (const ArgParser& ap); |
---|
[2] | 114 | static void do_build_dependencies (const ArgParser& ap, |
---|
| 115 | int argc, |
---|
| 116 | char* argv[]); |
---|
| 117 | static void do_build_library_links (const ArgParser& ap); |
---|
| 118 | static void do_build_make_setup (const ArgParser& ap); |
---|
| 119 | static void do_build_msdev (const ArgParser& ap); |
---|
| 120 | static void do_build_CMT_pacman (const ArgParser& ap); |
---|
| 121 | // Visual Studio.Net Support |
---|
| 122 | static void do_build_vsnet (const ArgParser& ap); |
---|
| 123 | |
---|
| 124 | static void do_build_os9_makefile (const ArgParser& ap); |
---|
| 125 | static void do_build_prototype (const ArgParser& ap); |
---|
| 126 | static void do_build_readme (const ArgParser& ap); |
---|
| 127 | static void do_build_tag_makefile (const ArgParser& ap); |
---|
| 128 | static void do_build_temporary_name (const ArgParser& ap); |
---|
| 129 | static void do_build_triggers (const ArgParser& ap); |
---|
| 130 | static void do_build_windefs (const ArgParser& ap); |
---|
| 131 | static void do_check_configuration (const ArgParser& ap); |
---|
| 132 | static void do_check_files (const ArgParser& ap); |
---|
| 133 | static void do_check_version (const ArgParser& ap); |
---|
| 134 | static void do_checkout (const ArgParser& ap); |
---|
| 135 | static void do_cleanup (const ArgParser& ap); |
---|
| 136 | static void do_config (const ArgParser& ap); |
---|
| 137 | static void do_create (const ArgParser& ap); |
---|
| 138 | static void do_create_project (const ArgParser& ap); |
---|
| 139 | static void do_cvsbranches (const ArgParser& ap); |
---|
| 140 | static void do_cvssubpackages (const ArgParser& ap); |
---|
[42] | 141 | static void do_cvssubprojects (const ArgParser& ap); |
---|
[2] | 142 | static void do_cvstags (const ArgParser& ap); |
---|
| 143 | static void do_do (const ArgParser& ap); |
---|
| 144 | static void do_expand_model (const ArgParser& ap); |
---|
[181] | 145 | static void do_filter (const ArgParser& ap); |
---|
| 146 | static void do_help (const ArgParser& ap); |
---|
| 147 | static void do_lock (const ArgParser& ap); |
---|
| 148 | static void do_relocate (const ArgParser& ap); |
---|
| 149 | static void do_remove (const ArgParser& ap); |
---|
[2] | 150 | static void do_remove_library_links (const ArgParser& ap); |
---|
| 151 | static void do_run (const ArgParser& ap); |
---|
| 152 | static void do_run_sequence (const ArgParser& ap); |
---|
| 153 | |
---|
| 154 | static void do_set_version (const ArgParser& ap); |
---|
| 155 | static void do_set_versions (const ArgParser& ap); |
---|
| 156 | |
---|
| 157 | static void do_setup (const ArgParser& ap); |
---|
| 158 | static void do_show_action (const ArgParser& ap); |
---|
| 159 | static void do_show_action_names (const ArgParser& ap); |
---|
| 160 | static void do_show_action_value (const ArgParser& ap); |
---|
| 161 | static void do_show_actions (const ArgParser& ap); |
---|
| 162 | static void do_show_all_tags (const ArgParser& ap); |
---|
| 163 | static void do_show_applied_patterns (const ArgParser& ap); |
---|
| 164 | static void do_show_author (const ArgParser& ap); |
---|
| 165 | static void do_show_branches (const ArgParser& ap); |
---|
| 166 | static void do_show_clients (const ArgParser& ap); |
---|
| 167 | static void do_show_cmtpath_patterns (const ArgParser& ap); |
---|
| 168 | static void do_show_constituent (const ArgParser& ap); |
---|
| 169 | static void do_show_constituent_names (const ArgParser& ap); |
---|
| 170 | static void do_show_constituents (const ArgParser& ap); |
---|
[525] | 171 | static void do_show_container (const ArgParser& ap); |
---|
[2] | 172 | static void do_show_cycles (const ArgParser& ap); |
---|
| 173 | static void do_show_fragment (const ArgParser& ap); |
---|
| 174 | static void do_show_fragments (const ArgParser& ap); |
---|
| 175 | static void do_show_groups (const ArgParser& ap); |
---|
| 176 | static void do_show_include_dirs (const ArgParser& ap); |
---|
| 177 | static void do_show_language (const ArgParser& ap); |
---|
| 178 | static void do_show_languages (const ArgParser& ap); |
---|
| 179 | static void do_show_macro (const ArgParser& ap); |
---|
| 180 | static void do_show_macro_names (const ArgParser& ap); |
---|
| 181 | static void do_show_macro_value (const ArgParser& ap); |
---|
| 182 | static void do_show_macros (const ArgParser& ap); |
---|
| 183 | static void do_show_manager (const ArgParser& ap); |
---|
| 184 | static void do_show_packages (const ArgParser& ap); |
---|
[547] | 185 | static void do_show_path (const ArgParser& ap, ostream& out = cout); |
---|
[2] | 186 | static void do_show_pattern (const ArgParser& ap); |
---|
| 187 | static void do_show_pattern_names (const ArgParser& ap); |
---|
| 188 | static void do_show_patterns (const ArgParser& ap); |
---|
| 189 | static void do_show_projects (const ArgParser& ap); |
---|
[272] | 190 | static void do_show_project_author (const ArgParser& ap); |
---|
[2] | 191 | static void do_show_pwd (const ArgParser& ap); |
---|
[547] | 192 | static void do_show_setup (const ArgParser& ap, ostream& out = cout); |
---|
[2] | 193 | static void do_show_set (const ArgParser& ap); |
---|
| 194 | static void do_show_set_names (const ArgParser& ap); |
---|
| 195 | static void do_show_set_value (const ArgParser& ap); |
---|
| 196 | static void do_show_sets (const ArgParser& ap); |
---|
| 197 | static void do_show_strategies (const ArgParser& ap); |
---|
[547] | 198 | static void do_show_tags (const ArgParser& ap, ostream& out = cout); |
---|
[2] | 199 | static void do_show_use_paths (const ArgParser& ap); |
---|
[547] | 200 | static void do_show_uses (const ArgParser& ap, ostream& out = cout); |
---|
[2] | 201 | static void do_show_version (const ArgParser& ap); |
---|
| 202 | static void do_show_versions (const ArgParser& ap); |
---|
| 203 | static void do_show_system (const ArgParser& ap); |
---|
| 204 | static void do_unlock (const ArgParser& ap); |
---|
| 205 | static void do_version (const ArgParser& ap); |
---|
| 206 | |
---|
| 207 | |
---|
| 208 | static const cmt_string& filter_dir (const cmt_string& dir); |
---|
| 209 | |
---|
| 210 | static ActionType get_action (); |
---|
| 211 | |
---|
| 212 | static const cmt_string& get_cmt_home (); |
---|
| 213 | static const cmt_string& get_cmt_user_context (); |
---|
| 214 | static const cmt_string& get_cmt_version (); |
---|
| 215 | static const cmt_string& get_current_dir (); |
---|
[535] | 216 | static const cmt_string get_current_dir_real (); |
---|
[2] | 217 | static const cmt_string& get_current_package (); |
---|
[535] | 218 | static const cmt_string& get_current_path (); |
---|
[2] | 219 | static const cmt_string& get_current_cmtpath (); |
---|
| 220 | static const cmt_string& get_current_offset (); |
---|
| 221 | static AccessMode get_current_access (); |
---|
| 222 | static CmtStructuringStyle get_current_structuring_style (); |
---|
| 223 | static CmtDirStyle get_current_style (); |
---|
| 224 | static const cmt_string& get_current_version (); |
---|
| 225 | static const cmt_string& get_current_target (); |
---|
| 226 | static bool get_debug (); |
---|
[282] | 227 | static bool get_disable_warnings (); |
---|
[2] | 228 | static bool get_quiet (); |
---|
[109] | 229 | static bool get_warnings (); |
---|
[2] | 230 | static bool get_recursive (); |
---|
| 231 | static CmtScopeFilteringMode get_scope_filtering_mode (); |
---|
| 232 | static bool get_all_sets_done (); |
---|
| 233 | |
---|
[459] | 234 | static void get_cmt_flags (CmtSystem::cmt_string_vector& flags); |
---|
| 235 | static cmt_string get_cmt_flags (); |
---|
[565] | 236 | static cmt_string get_cmt_flags (const cmt_string& file_name); |
---|
[459] | 237 | static bool set_cmt_flags (const cmt_string& flags); |
---|
| 238 | static bool add_cmt_flag (const cmt_string& flag); |
---|
| 239 | |
---|
[2] | 240 | /// If a project file exists above the current directory we don't need CMTPATH |
---|
| 241 | static void guess_current_project (); |
---|
| 242 | |
---|
| 243 | static void install_cleanup_scripts (); |
---|
| 244 | static void install_setup_scripts (); |
---|
[565] | 245 | static void install_scripts (ScriptType type, const cmt_string& flags); |
---|
[323] | 246 | static void install_native_version_file (); |
---|
[438] | 247 | // static bool load (const cmt_string& path, |
---|
| 248 | static bool load (const ArgParser& ap, |
---|
| 249 | const cmt_string& path, |
---|
[2] | 250 | const cmt_string& package, |
---|
| 251 | const cmt_string& version, |
---|
| 252 | const cmt_string& tag_name = ""); |
---|
| 253 | static bool need_prototypes (); |
---|
| 254 | static void parse_arguments (ArgParser& ap); |
---|
| 255 | static int parser (const cmt_string& command_line); |
---|
| 256 | static int parser (int argc, char* argv[]); |
---|
| 257 | static void print (PrintMode mode); |
---|
| 258 | static void print_clean (PrintMode mode); |
---|
| 259 | static void print_context (Use& use, PrintMode mode, const cmt_string& tag); |
---|
[547] | 260 | static void print_macros (PrintMode mode, const cmt_string& pattern = "", |
---|
| 261 | ostream& out = cout); |
---|
| 262 | // static void print_macros (PrintMode mode, const cmt_string& pattern = ""); |
---|
[2] | 263 | static void print_symbol_names (PrintMode mode, const cmt_string& pattern = ""); |
---|
| 264 | static void print_tabs (int tabs); |
---|
[550] | 265 | static void print_xml_prolog (const cmt_string& root = "cmt", ostream& out = cout); |
---|
[2] | 266 | static int reach_current_package (); |
---|
[561] | 267 | static int use_extra_file (const cmt_string& file); |
---|
[2] | 268 | static void restore_all_tags (Use* use); |
---|
| 269 | static void set_current_access (AccessMode mode); |
---|
[535] | 270 | static void set_recursive (bool mode); |
---|
[2] | 271 | static void set_scope_filtering_mode (CmtScopeFilteringMode mode); |
---|
| 272 | static void set_standard_macros (); |
---|
| 273 | static void set_all_sets_done (); |
---|
| 274 | static void reset_all_sets_done (); |
---|
| 275 | static void use_cmt (); |
---|
| 276 | static void use_home_requirements (); |
---|
| 277 | static void use_user_context_requirements (); |
---|
| 278 | static void use_special_requirements (const cmt_string& path, |
---|
| 279 | const cmt_string& name, |
---|
| 280 | const cmt_string& file_name); |
---|
| 281 | static cmt_string vector_to_string (const CmtSystem::cmt_string_vector& v); |
---|
| 282 | static void vector_to_string (const CmtSystem::cmt_string_vector& v, |
---|
| 283 | const cmt_string& separator, |
---|
| 284 | cmt_string& result); |
---|
| 285 | }; |
---|
| 286 | |
---|
| 287 | #endif |
---|