1 | //-----------------------------------------------------------
|
---|
2 | // Copyright Christian Arnault LAL-Orsay CNRS
|
---|
3 | // arnault@lal.in2p3.fr
|
---|
4 | // See the complete license in cmt_license.txt "http://www.cecill.info".
|
---|
5 | //-----------------------------------------------------------
|
---|
6 |
|
---|
7 | #ifndef __cmt_h__
|
---|
8 | #define __cmt_h__
|
---|
9 |
|
---|
10 | #include "cmt_parser.h"
|
---|
11 | #include "cmt_system.h"
|
---|
12 |
|
---|
13 | class ArgParser;
|
---|
14 | class Symbol;
|
---|
15 | class Tag;
|
---|
16 |
|
---|
17 | class CmtContext
|
---|
18 | {
|
---|
19 | public:
|
---|
20 |
|
---|
21 | CmtContext ();
|
---|
22 | ~CmtContext ();
|
---|
23 |
|
---|
24 | void clear ();
|
---|
25 |
|
---|
26 | ActionType m_action;
|
---|
27 | bool m_build_nmake;
|
---|
28 | cmt_string m_cmt_config;
|
---|
29 | cmt_string m_cmt_root;
|
---|
30 | cmt_string m_cmt_home;
|
---|
31 | cmt_string m_cmt_user_context;
|
---|
32 | cmt_string m_cmt_site;
|
---|
33 | cmt_string m_cmt_version;
|
---|
34 |
|
---|
35 | int m_current_build_strategy;
|
---|
36 | int m_current_setup_strategy;
|
---|
37 |
|
---|
38 | cmt_string m_current_dir;
|
---|
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;
|
---|
61 | bool m_recursive;
|
---|
62 | CmtScopeFilteringMode m_scope_filtering_mode;
|
---|
63 | bool m_simulation;
|
---|
64 | bool m_standard_macros_done;
|
---|
65 | bool m_all_sets_done;
|
---|
66 |
|
---|
67 | bool m_autoconfigure_cmtpath;
|
---|
68 | };
|
---|
69 |
|
---|
70 | class Cmt
|
---|
71 | {
|
---|
72 | public:
|
---|
73 | static void build_config (const cmt_string& prefix, cmt_string& config);
|
---|
74 | static void build_makefile (const cmt_string& target);
|
---|
75 | static void build_msdev_file (const cmt_string& target);
|
---|
76 | // Visual Studio.Net Support
|
---|
77 | static void build_vsnet_file (const cmt_string& target);
|
---|
78 |
|
---|
79 | static bool build_nmake ();
|
---|
80 | static void build_OS9_makefile (const cmt_string& target);
|
---|
81 | static void build_prefix (const cmt_string& package, cmt_string& prefix);
|
---|
82 | static void clear ();
|
---|
83 |
|
---|
84 | static void configure ();
|
---|
85 | static void configure_cmt_path (Use* use);
|
---|
86 | static void configure_config_tag ();
|
---|
87 | static void configure_current_cmtpath ();
|
---|
88 | static void configure_current_dir ();
|
---|
89 | static void configure_current_package ();
|
---|
90 | static void configure_current_structuring_style ();
|
---|
91 | static void configure_default_path ();
|
---|
92 | static void configure_home (Use* use);
|
---|
93 | static void configure_user_context (Use* use);
|
---|
94 | static void configure_hosttype_tag ();
|
---|
95 | static void configure_site_tag (Use* use);
|
---|
96 | static void configure_tags (Use* use);
|
---|
97 | static void configure_uname_tag ();
|
---|
98 | static void configure_version_tag ();
|
---|
99 |
|
---|
100 | static void do_awk (const ArgParser& ap);
|
---|
101 | static void do_broadcast (const ArgParser& ap);
|
---|
102 | static void do_build_constituent_makefile (const ArgParser& ap);
|
---|
103 | static void do_build_constituents_makefile (const ArgParser& ap);
|
---|
104 | static void do_build_dependencies (const ArgParser& ap,
|
---|
105 | int argc,
|
---|
106 | char* argv[]);
|
---|
107 | static void do_build_library_links (const ArgParser& ap);
|
---|
108 | static void do_build_make_setup (const ArgParser& ap);
|
---|
109 | static void do_build_msdev (const ArgParser& ap);
|
---|
110 | static void do_build_CMT_pacman (const ArgParser& ap);
|
---|
111 | // Visual Studio.Net Support
|
---|
112 | static void do_build_vsnet (const ArgParser& ap);
|
---|
113 |
|
---|
114 | static void do_build_os9_makefile (const ArgParser& ap);
|
---|
115 | static void do_build_prototype (const ArgParser& ap);
|
---|
116 | static void do_build_readme (const ArgParser& ap);
|
---|
117 | static void do_build_tag_makefile (const ArgParser& ap);
|
---|
118 | static void do_build_temporary_name (const ArgParser& ap);
|
---|
119 | static void do_build_triggers (const ArgParser& ap);
|
---|
120 | static void do_build_windefs (const ArgParser& ap);
|
---|
121 | static void do_check_configuration (const ArgParser& ap);
|
---|
122 | static void do_check_files (const ArgParser& ap);
|
---|
123 | static void do_check_version (const ArgParser& ap);
|
---|
124 | static void do_checkout (const ArgParser& ap);
|
---|
125 | static void do_cleanup (const ArgParser& ap);
|
---|
126 | static void do_config (const ArgParser& ap);
|
---|
127 | static void do_create (const ArgParser& ap);
|
---|
128 | static void do_create_project (const ArgParser& ap);
|
---|
129 | static void do_cvsbranches (const ArgParser& ap);
|
---|
130 | static void do_cvssubpackages (const ArgParser& ap);
|
---|
131 | static void do_cvstags (const ArgParser& ap);
|
---|
132 | static void do_do (const ArgParser& ap);
|
---|
133 | static void do_expand_model (const ArgParser& ap);
|
---|
134 | static void do_filter (const ArgParser& ap);
|
---|
135 | static void do_help (const ArgParser& ap);
|
---|
136 | static void do_lock (const ArgParser& ap);
|
---|
137 | static void do_remove (const ArgParser& ap);
|
---|
138 | static void do_remove_library_links (const ArgParser& ap);
|
---|
139 | static void do_run (const ArgParser& ap);
|
---|
140 | static void do_run_sequence (const ArgParser& ap);
|
---|
141 |
|
---|
142 | static void do_set_version (const ArgParser& ap);
|
---|
143 | static void do_set_versions (const ArgParser& ap);
|
---|
144 |
|
---|
145 | static void do_setup (const ArgParser& ap);
|
---|
146 | static void do_show_action (const ArgParser& ap);
|
---|
147 | static void do_show_action_names (const ArgParser& ap);
|
---|
148 | static void do_show_action_value (const ArgParser& ap);
|
---|
149 | static void do_show_actions (const ArgParser& ap);
|
---|
150 | static void do_show_all_tags (const ArgParser& ap);
|
---|
151 | static void do_show_applied_patterns (const ArgParser& ap);
|
---|
152 | static void do_show_author (const ArgParser& ap);
|
---|
153 | static void do_show_branches (const ArgParser& ap);
|
---|
154 | static void do_show_clients (const ArgParser& ap);
|
---|
155 | static void do_show_cmtpath_patterns (const ArgParser& ap);
|
---|
156 | static void do_show_constituent (const ArgParser& ap);
|
---|
157 | static void do_show_constituent_names (const ArgParser& ap);
|
---|
158 | static void do_show_constituents (const ArgParser& ap);
|
---|
159 | static void do_show_cycles (const ArgParser& ap);
|
---|
160 | static void do_show_fragment (const ArgParser& ap);
|
---|
161 | static void do_show_fragments (const ArgParser& ap);
|
---|
162 | static void do_show_groups (const ArgParser& ap);
|
---|
163 | static void do_show_include_dirs (const ArgParser& ap);
|
---|
164 | static void do_show_language (const ArgParser& ap);
|
---|
165 | static void do_show_languages (const ArgParser& ap);
|
---|
166 | static void do_show_macro (const ArgParser& ap);
|
---|
167 | static void do_show_macro_names (const ArgParser& ap);
|
---|
168 | static void do_show_macro_value (const ArgParser& ap);
|
---|
169 | static void do_show_macros (const ArgParser& ap);
|
---|
170 | static void do_show_manager (const ArgParser& ap);
|
---|
171 | static void do_show_packages (const ArgParser& ap);
|
---|
172 | static void do_show_path (const ArgParser& ap);
|
---|
173 | static void do_show_pattern (const ArgParser& ap);
|
---|
174 | static void do_show_pattern_names (const ArgParser& ap);
|
---|
175 | static void do_show_patterns (const ArgParser& ap);
|
---|
176 | static void do_show_projects (const ArgParser& ap);
|
---|
177 | static void do_show_pwd (const ArgParser& ap);
|
---|
178 | static void do_show_setup (const ArgParser& ap);
|
---|
179 | static void do_show_set (const ArgParser& ap);
|
---|
180 | static void do_show_set_names (const ArgParser& ap);
|
---|
181 | static void do_show_set_value (const ArgParser& ap);
|
---|
182 | static void do_show_sets (const ArgParser& ap);
|
---|
183 | static void do_show_strategies (const ArgParser& ap);
|
---|
184 | static void do_show_tags (const ArgParser& ap);
|
---|
185 | static void do_show_use_paths (const ArgParser& ap);
|
---|
186 | static void do_show_uses (const ArgParser& ap);
|
---|
187 | static void do_show_version (const ArgParser& ap);
|
---|
188 | static void do_show_versions (const ArgParser& ap);
|
---|
189 | static void do_show_system (const ArgParser& ap);
|
---|
190 | static void do_unlock (const ArgParser& ap);
|
---|
191 | static void do_version (const ArgParser& ap);
|
---|
192 |
|
---|
193 |
|
---|
194 | static const cmt_string& filter_dir (const cmt_string& dir);
|
---|
195 |
|
---|
196 | static ActionType get_action ();
|
---|
197 |
|
---|
198 | static const cmt_string& get_cmt_home ();
|
---|
199 | static const cmt_string& get_cmt_user_context ();
|
---|
200 | static const cmt_string& get_cmt_version ();
|
---|
201 | static const cmt_string& get_current_dir ();
|
---|
202 | static const cmt_string& get_current_package ();
|
---|
203 | static const cmt_string& get_current_cmtpath ();
|
---|
204 | static const cmt_string& get_current_offset ();
|
---|
205 | static AccessMode get_current_access ();
|
---|
206 | static int get_current_build_strategy ();
|
---|
207 | static int get_current_setup_strategy ();
|
---|
208 | static CmtStructuringStyle get_current_structuring_style ();
|
---|
209 | static CmtDirStyle get_current_style ();
|
---|
210 | static const cmt_string& get_current_version ();
|
---|
211 | static const cmt_string& get_current_target ();
|
---|
212 | static bool get_debug ();
|
---|
213 | static bool get_quiet ();
|
---|
214 | static bool get_recursive ();
|
---|
215 | static CmtScopeFilteringMode get_scope_filtering_mode ();
|
---|
216 | static bool get_all_sets_done ();
|
---|
217 |
|
---|
218 | /// If a project file exists above the current directory we don't need CMTPATH
|
---|
219 | static void guess_current_project ();
|
---|
220 |
|
---|
221 | static void install_cleanup_scripts ();
|
---|
222 | static void install_setup_scripts ();
|
---|
223 | static void install_test_cleanup_scripts ();
|
---|
224 | static void install_test_setup_scripts ();
|
---|
225 | static bool load (const cmt_string& path,
|
---|
226 | const cmt_string& package,
|
---|
227 | const cmt_string& version,
|
---|
228 | const cmt_string& tag_name = "");
|
---|
229 | static bool need_prototypes ();
|
---|
230 | static void parse_arguments (ArgParser& ap);
|
---|
231 | static int parser (const cmt_string& command_line);
|
---|
232 | static int parser (int argc, char* argv[]);
|
---|
233 | static void print (PrintMode mode);
|
---|
234 | static void print_clean (PrintMode mode);
|
---|
235 | static void print_context (Use& use, PrintMode mode, const cmt_string& tag);
|
---|
236 | static void print_macros (PrintMode mode, const cmt_string& pattern = "");
|
---|
237 | static void print_symbol_names (PrintMode mode, const cmt_string& pattern = "");
|
---|
238 | static void print_tabs (int tabs);
|
---|
239 | static int reach_current_package ();
|
---|
240 | static void restore_all_tags (Use* use);
|
---|
241 | static void set_current_access (AccessMode mode);
|
---|
242 | static void set_current_build_strategy (int strategy);
|
---|
243 | static void set_current_setup_strategy (int strategy);
|
---|
244 | static void set_scope_filtering_mode (CmtScopeFilteringMode mode);
|
---|
245 | static void set_standard_macros ();
|
---|
246 | static void set_all_sets_done ();
|
---|
247 | static void reset_all_sets_done ();
|
---|
248 | static void use_cmt ();
|
---|
249 | static void use_home_requirements ();
|
---|
250 | static void use_user_context_requirements ();
|
---|
251 | static void use_special_requirements (const cmt_string& path,
|
---|
252 | const cmt_string& name,
|
---|
253 | const cmt_string& file_name);
|
---|
254 | static cmt_string vector_to_string (const CmtSystem::cmt_string_vector& v);
|
---|
255 | static void vector_to_string (const CmtSystem::cmt_string_vector& v,
|
---|
256 | const cmt_string& separator,
|
---|
257 | cmt_string& result);
|
---|
258 | };
|
---|
259 |
|
---|
260 | #endif
|
---|