source: CMT/v1r26p20160527/source/cmt.h

Last change on this file was 663, checked in by rybkin, 10 years ago

See C.L. 522

  • Property svn:eol-style set to native
File size: 15.8 KB
Line 
1//-----------------------------------------------------------
2// Copyright Christian Arnault LAL-Orsay CNRS
3// arnault@lal.in2p3.fr
4// Modified by garonne@lal.in2p3.fr
5// Modified by Grigory Rybkin
6// See the complete license in cmt_license.txt "http://www.cecill.info".
7//-----------------------------------------------------------
8
9#ifndef __cmt_h__
10#define __cmt_h__
11
12#include "cmt_parser.h"
13#include "cmt_system.h"
14
15class ArgParser;
16class Symbol;
17class Tag;
18
19class CmtContext
20{
21public:
22
23  CmtContext ();
24  ~CmtContext ();
25
26  void clear ();
27  int initialize ();
28
29  ActionType m_action;
30  bool m_build_nmake;
31  cmt_string m_cmt_config;
32  cmt_string m_cmt_root;
33  cmt_string m_cmt_home;
34  cmt_string m_cmt_user_context;
35  cmt_string m_cmt_site;
36  cmt_string m_cmt_version;
37  bool m_use_cmt;
38  bool m_use_projects;
39 
40  cmt_string m_current_dir;
41  FilePath   m_current_file_path;
42  cmt_string m_current_package;
43  cmt_string m_current_config;
44  cmt_string m_current_path;
45  cmt_string m_current_prefix;
46  cmt_string m_current_cmtpath;
47  cmt_string m_current_offset;
48 
49  AccessMode m_current_access;
50  CmtDirStyle m_current_style;
51  CmtStructuringStyle m_current_structuring_style;
52 
53  cmt_string m_current_tag;
54  cmt_string m_current_target;
55  cmt_string m_current_version;
56 
57  //  cmt_string m_extra_tags;
58  CmtSystem::cmt_string_vector m_extra_tags;
59  CmtSystem::cmt_string_vector m_tags;
60  CmtSystem::cmt_string_vector m_tags_add;
61  CmtSystem::cmt_string_vector m_tags_remove;
62
63  cmt_string m_configure_error;
64 
65  bool m_debug;
66 
67  cmt_string m_default_path;
68  bool m_quiet;
69  bool m_disable_warnings;
70  bool m_warnings;
71  bool m_recursive;
72  CmtScopeFilteringMode m_scope_filtering_mode;
73  bool m_simulation;
74  bool m_standard_macros_done;
75  bool m_all_sets_done;
76
77  bool m_autoconfigure_cmtpath;
78
79  bool m_env_access;
80  PrintMode m_print_mode;
81  bool m_strip_path;
82
83private:
84
85  CmtContext& operator = (const CmtContext& other);
86  CmtContext (const CmtContext& other);
87};
88
89class Cmt
90{
91public:
92  static void build_config (const cmt_string& prefix, cmt_string& config);
93  static void build_makefile (const cmt_string& target);
94  static void build_msdev_file (const cmt_string& target);
95  // Visual Studio.Net Support                           
96  static void build_vsnet_file (const cmt_string& target);
97
98  static inline bool build_nmake ();
99  static void build_OS9_makefile (const cmt_string& target);
100  static void build_prefix (const cmt_string& package, cmt_string& prefix);
101  static void clear ();
102
103  //  static void configure ();
104  static void configure (const ArgParser& ap);
105  static void configure_cmt_path (Use* use);
106  static void configure_config_tag ();
107  static void configure_current_cmtpath ();
108  static void configure_current_dir ();
109  static cmt_string configure_current_package ();
110  //  static void configure_current_package ();
111  //  static void configure_current_structuring_style ();
112  static void configure_current_structuring_style (const ArgParser& ap);
113  static void configure_default_path ();
114  static void configure_home (Use* use);
115  static void configure_user_context (Use* use);
116  static void configure_hosttype_tag ();
117  static void configure_site_tag (Use* use);
118  static void configure_tags (Use* use);
119  static void configure_uname_tag ();
120  static void configure_devenv_tag ();
121  static void configure_version_tag ();
122  //  static void configure_cmt_message ();
123  static void configure_cmt_message (const ArgParser& ap);
124
125  static void do_awk (const ArgParser& ap);
126  static void do_broadcast (const ArgParser& ap);
127  static void do_build_constituent_makefile (const ArgParser& ap);
128  static void do_build_constituent_config (const ArgParser& ap);
129  static void do_build_constituents_makefile (const ArgParser& ap);
130  static void do_build_constituents_config (const ArgParser& ap);
131  static void do_build_broadcast_config (const ArgParser& ap);
132  static void do_build_dependencies (const ArgParser& ap,
133                                     int argc,
134                                     char* argv[]);
135  static void do_build_library_links (const ArgParser& ap);
136  static void do_build_make_setup (const ArgParser& ap);
137  static void do_build_msdev (const ArgParser& ap);
138  static void do_build_CMT_pacman (const ArgParser& ap);
139  // Visual Studio.Net Support                                               
140  static void do_build_vsnet (const ArgParser& ap);
141
142  static void do_build_os9_makefile (const ArgParser& ap);
143  static void do_build_prototype (const ArgParser& ap);
144  static void do_build_readme (const ArgParser& ap);
145  static void do_build_tag_makefile (const ArgParser& ap);
146  static void do_build_temporary_name (const ArgParser& ap);
147  static void do_build_triggers (const ArgParser& ap);
148  static void do_build_windefs (const ArgParser& ap);
149  static void do_check_configuration (const ArgParser& ap);
150  static void do_check_files (const ArgParser& ap);
151  static void do_check_version (const ArgParser& ap);
152  static void do_checkout (const ArgParser& ap);
153  static void do_cleanup (const ArgParser& ap);
154  static void do_config (const ArgParser& ap);
155  static void do_create (const ArgParser& ap);
156  static void do_create_project (const ArgParser& ap);
157  static void do_cvsbranches (const ArgParser& ap);
158  static void do_cvssubpackages (const ArgParser& ap);
159  static void do_cvssubprojects (const ArgParser& ap);
160  static void do_cvstags (const ArgParser& ap);
161  static void do_do (const ArgParser& ap);
162  static void do_expand_model (const ArgParser& ap);
163  static void do_filter       (const ArgParser& ap);
164  static void do_help         (const ArgParser& ap);
165  static void do_lock         (const ArgParser& ap);
166  static void do_relocate     (const ArgParser& ap);
167  static void do_remove       (const ArgParser& ap);
168  static void do_remove_library_links (const ArgParser& ap);
169  static void do_run (const ArgParser& ap);
170  static void do_run_sequence (const ArgParser& ap);
171
172  static void do_set_version (const ArgParser& ap);
173  static void do_set_versions (const ArgParser& ap);
174
175  static void do_setup (const ArgParser& ap);
176  static void do_show_action (const ArgParser& ap);
177  static void do_show_action_names (const ArgParser& ap);
178  static void do_show_action_value (const ArgParser& ap);
179  static void do_show_actions (const ArgParser& ap);
180  static void do_show_alias (const ArgParser& ap);
181  static void do_show_alias_names (const ArgParser& ap);
182  static void do_show_alias_value (const ArgParser& ap);
183  static void do_show_aliases (const ArgParser& ap);
184  static void do_show_all_tags (const ArgParser& ap);
185  static void do_show_applied_patterns (const ArgParser& ap);
186  static void do_show_author (const ArgParser& ap);
187  static void do_show_branches (const ArgParser& ap);
188  static void do_show_clients (const ArgParser& ap);
189  static void do_show_cmtpath_patterns (const ArgParser& ap);
190  static void do_show_constituent (const ArgParser& ap);
191  static void do_show_constituent_names (const ArgParser& ap);
192  static void do_show_constituents (const ArgParser& ap);
193  static void do_show_container (const ArgParser& ap);
194  static void do_show_cycles (const ArgParser& ap);
195  static void do_show_fragment (const ArgParser& ap);
196  static void do_show_fragments (const ArgParser& ap);
197  static void do_show_groups (const ArgParser& ap);
198  static void do_show_include_dirs (const ArgParser& ap);
199  static void do_show_language (const ArgParser& ap);
200  static void do_show_languages (const ArgParser& ap);
201  static void do_show_macro (const ArgParser& ap);
202  static void do_show_macro_names (const ArgParser& ap);
203  static void do_show_macro_value (const ArgParser& ap);
204  static void do_show_macros (const ArgParser& ap);
205  static void do_show_manager (const ArgParser& ap);
206  static void do_show_packages (const ArgParser& ap);
207  static void do_show_path (const ArgParser& ap, ostream& out = cout);
208  static void do_show_pattern (const ArgParser& ap);
209  static void do_show_pattern_names (const ArgParser& ap);
210  static void do_show_patterns (const ArgParser& ap);
211  static void do_show_projects (const ArgParser& ap);
212  static void do_show_project_author (const ArgParser& ap); 
213  static void do_show_pwd (const ArgParser& ap);
214  static void do_show_setup (const ArgParser& ap, ostream& out = cout);
215  static void do_show_set (const ArgParser& ap);
216  static void do_show_set_names (const ArgParser& ap);
217  static void do_show_set_value (const ArgParser& ap);
218  static void do_show_sets (const ArgParser& ap);
219  static void do_show_strategies (const ArgParser& ap);
220  static void do_show_tags (const ArgParser& ap, ostream& out = cout);
221  static void do_show_use_paths (const ArgParser& ap);
222  static void do_show_uses (const ArgParser& ap, ostream& out = cout);
223  static void do_show_version (const ArgParser& ap);
224  static void do_show_versions (const ArgParser& ap);
225  static void do_show_system (const ArgParser& ap);
226  static void do_unlock (const ArgParser& ap);
227  static void do_version (const ArgParser& ap);
228
229
230  static const cmt_string& filter_dir (const cmt_string& dir);
231
232  static inline ActionType get_action ();
233
234  static inline const cmt_string& get_cmt_home ();
235  static inline const cmt_string& get_cmt_user_context ();
236  static inline const cmt_string& get_cmt_version ();
237  static inline const cmt_string& get_current_dir ();
238  static const cmt_string get_current_dir_real ();
239  static inline const cmt_string& get_current_package ();
240  static const cmt_string& get_current_path ();
241  static const cmt_string& get_current_cmtpath ();
242  static const cmt_string& get_current_offset ();
243  static inline AccessMode get_current_access ();
244  static inline CmtStructuringStyle get_current_structuring_style ();
245  static inline CmtDirStyle get_current_style ();
246  static const cmt_string& get_current_version ();
247  static inline const cmt_string& get_current_target ();
248  static inline const CmtSystem::cmt_string_vector& get_tags_remove ();
249  static inline bool get_debug ();
250  static inline bool get_disable_warnings (); 
251  static inline bool get_quiet ();
252  static inline bool get_warnings ();
253  static inline bool get_recursive ();
254  static CmtScopeFilteringMode get_scope_filtering_mode ();
255  static inline bool get_all_sets_done ();
256
257  static void get_cmt_flags (CmtSystem::cmt_string_vector& flags);
258  static cmt_string get_cmt_flags ();
259  static cmt_string get_cmt_flags (const cmt_string& file_name);
260  static bool set_cmt_flags (const cmt_string& flags);
261  static bool add_cmt_flag (const cmt_string& flag);
262
263  /// If a project file exists above the current directory we don't need CMTPATH
264  static void guess_current_project ();
265
266  static void install_cleanup_scripts ();
267  static void install_setup_scripts ();
268  static void install_scripts (ScriptType type, const cmt_string& flags);
269  static void install_native_version_file ();
270  //  static bool load (const cmt_string& path,
271  static bool load (const ArgParser& ap,
272                    const cmt_string& path,
273                    const cmt_string& package,
274                    const cmt_string& version,
275                    const cmt_string& tag_name = "");
276  static bool need_prototypes ();
277  static void parse_arguments (ArgParser& ap);
278  static int parser (const cmt_string& command_line);
279  static int parser (int argc, char* argv[]);
280  static void print (PrintMode mode, ostream& out = cout);
281  //static void print (PrintMode mode);
282  static void print_clean (PrintMode mode);
283  static void print_context (Use& use, PrintMode mode, const cmt_string& tag, ostream& out = cout);
284  //static void print_context (Use& use, PrintMode mode, const cmt_string& tag);
285  static void print_macros (PrintMode mode, const cmt_string& pattern = "",
286                            ostream& out = cout);
287  //  static void print_macros (PrintMode mode, const cmt_string& pattern = "");
288  static void print_symbol_names (PrintMode mode, const cmt_string& pattern = "");
289  static void print_tabs (int tabs);
290  static void print_xml_prolog (const cmt_string& root = "cmt", ostream& out = cout);
291  //  static int reach_current_package ();
292  static int use_current_package ();
293  static int use_extra_file (const cmt_string& file);
294  static int apply_globals ();
295  static void restore_all_tags (Use* use);
296  static inline void set_current_access (AccessMode mode);
297  static inline void set_recursive (bool mode);
298  static inline void set_scope_filtering_mode (CmtScopeFilteringMode mode);
299  static void set_standard_macros ();
300  static inline void set_all_sets_done ();
301  static inline void reset_all_sets_done ();
302  static void use_cmt ();
303  static void use_home_requirements ();
304  static void use_user_context_requirements ();
305  static void use_special_requirements (const cmt_string& path, 
306                                        const cmt_string& name, 
307                                        const cmt_string& file_name);
308  static cmt_string vector_to_string (const CmtSystem::cmt_string_vector& v);
309  static void vector_to_string (const CmtSystem::cmt_string_vector& v,
310                                const cmt_string& separator,
311                                cmt_string& result);
312
313  static inline const bool& get_env_access ();
314  static inline void set_env_access (const bool& access);
315  static inline const PrintMode& get_print_mode ();
316  static inline void set_print_mode (const PrintMode& mode);
317  static inline const bool& get_strip_path ();
318
319private:
320  static CmtContext& m_cmt_context;
321  //  static CmtContext * m_cmt_context;
322};
323
324//----------------------------------------------------------
325inline bool Cmt::build_nmake ()
326{
327  return (m_cmt_context.m_build_nmake);
328}
329
330inline ActionType Cmt::get_action ()
331{
332  return (m_cmt_context.m_action);
333}
334
335inline const cmt_string& Cmt::get_cmt_home ()
336{
337  return (m_cmt_context.m_cmt_home);
338}
339
340inline const cmt_string& Cmt::get_cmt_user_context ()
341{
342  return (m_cmt_context.m_cmt_user_context);
343}
344
345inline const cmt_string& Cmt::get_cmt_version ()
346{
347  return (m_cmt_context.m_cmt_version);
348}
349
350inline const cmt_string& Cmt::get_current_dir ()
351{
352  return (m_cmt_context.m_current_dir);
353}
354
355inline const cmt_string& Cmt::get_current_package ()
356{
357  return (m_cmt_context.m_current_package);
358}
359
360inline AccessMode Cmt::get_current_access ()
361{
362  return (m_cmt_context.m_current_access);
363}
364
365inline CmtStructuringStyle Cmt::get_current_structuring_style ()
366{
367  return (m_cmt_context.m_current_structuring_style);
368}
369
370inline CmtDirStyle Cmt::get_current_style ()
371{
372  return (m_cmt_context.m_current_style);
373}
374
375inline const cmt_string& Cmt::get_current_target ()
376{
377  return (m_cmt_context.m_current_target);
378}
379
380inline const CmtSystem::cmt_string_vector& Cmt::get_tags_remove ()
381{
382  return m_cmt_context.m_tags_remove;
383}
384
385inline bool Cmt::get_debug ()
386{
387  return (m_cmt_context.m_debug);
388}
389
390inline bool Cmt::get_quiet ()
391{
392  return (m_cmt_context.m_quiet);
393}
394
395inline bool Cmt::get_disable_warnings ()
396{
397  return (m_cmt_context.m_disable_warnings);
398}
399
400inline bool Cmt::get_warnings ()
401{
402  return (m_cmt_context.m_warnings);
403}
404
405inline bool Cmt::get_recursive ()
406{
407  return (m_cmt_context.m_recursive);
408}
409
410inline bool Cmt::get_all_sets_done ()
411{
412  return (m_cmt_context.m_all_sets_done);
413}
414
415inline void Cmt::set_current_access (AccessMode mode)
416{
417  m_cmt_context.m_current_access = mode;
418}
419
420//----------------------------------------------------------
421inline void Cmt::set_recursive (bool mode)
422{
423  m_cmt_context.m_recursive = mode;
424}
425
426//----------------------------------------------------------
427inline void Cmt::set_scope_filtering_mode (CmtScopeFilteringMode mode)
428{
429  m_cmt_context.m_scope_filtering_mode = mode;
430}
431
432inline void Cmt::set_all_sets_done ()
433{
434  m_cmt_context.m_all_sets_done = true;
435}
436
437inline void Cmt::reset_all_sets_done ()
438{
439  m_cmt_context.m_all_sets_done = false;
440}
441
442inline const bool& Cmt::get_env_access ()
443{
444  return m_cmt_context.m_env_access;
445}
446
447inline void Cmt::set_env_access (const bool& access)
448{
449  m_cmt_context.m_env_access = access;
450}
451
452inline const PrintMode& Cmt::get_print_mode ()
453{
454  return m_cmt_context.m_print_mode;
455}
456
457inline void Cmt::set_print_mode (const PrintMode& mode)
458{
459  m_cmt_context.m_print_mode = mode;
460}
461
462inline const bool& Cmt::get_strip_path ()
463{
464  return m_cmt_context.m_strip_path;
465}
466//----------------------------------------------------------
467
468#endif
Note: See TracBrowser for help on using the repository browser.