- Timestamp:
- Apr 26, 2012, 9:51:00 AM (12 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r611 r612 1 2012-04-25 <rybkin@lal.in2p3.fr> 487 2 3 * source/cmt_commands.cxx: In class ArgParser function do_show, introduce 4 commands "cmt show alias", "cmt show alias_names", "cmt show alias_value", 5 "cmt show aliases", in class CommandHelp constructor, document new commands 6 and document use of optional <regexp> argument for "cmt show" commands 7 {action,macro,set}{s,_names} 8 * source/cmt.h: In class Cmt, declare functions do_show_alias, 9 do_show_alias_names, do_show_alias_value, do_show_aliases 10 * source/cmt_parser.h: In enum ActionType, introduce members 11 action_show_alias, action_show_alias_value, action_show_alias_names, 12 action_show_aliases 13 * source/cmt_parser.cxx: In class Cmt, implement functions do_show_alias, 14 do_show_alias_names, do_show_alias_value, do_show_aliases, in function 15 do_show_macro, implement function do_show_action via do_show_macro, enhance 16 function do_show_macro to show actions and aliases, in function parser, 17 make use of new alias related functions, in function print_symbol_names, 18 add case of action_show_alias_names, in function print_macros, add case of 19 action_show_aliases 20 * source/cmt_symbol.cxx: In class Symbol function show_macro, add case of 21 action_show_aliases, action_show_alias, action_show_alias_value 22 * src/setup.csh: Fix case of unset environment variable CLASSPATH, optimise 23 tcsh shell is identification 24 * src/setup.bash: Implement command completion for alias related commands 25 * src/setup.zsh: idem 26 * src/setup.tcsh: idem, optimise by removing redundant sed utility 27 invocations 28 1 29 2012-04-24 <rybkin@lal.in2p3.fr> 486 2 30 -
CMT/HEAD/source/cmt.h
r588 r612 160 160 static void do_show_action_value (const ArgParser& ap); 161 161 static void do_show_actions (const ArgParser& ap); 162 static void do_show_alias (const ArgParser& ap); 163 static void do_show_alias_names (const ArgParser& ap); 164 static void do_show_alias_value (const ArgParser& ap); 165 static void do_show_aliases (const ArgParser& ap); 162 166 static void do_show_all_tags (const ArgParser& ap); 163 167 static void do_show_applied_patterns (const ArgParser& ap); -
CMT/HEAD/source/cmt_commands.cxx
r599 r612 1408 1408 1409 1409 cmt.m_action = action_show_actions; 1410 } 1411 else if (arg == "alias") 1412 { 1413 if (argc > 0) 1414 { 1415 cmt.m_current_target = fill_one_argument (); 1416 cmt.m_action = action_show_alias; 1417 } 1418 else 1419 { 1420 CmtError::set (CmtError::syntax_error, "alias name missing"); 1421 //CmtMessage::error ("syntax: alias name missing"); 1422 help_action = action_help; 1423 cmt.m_action = action_show_alias; 1424 } 1425 } 1426 else if (arg == "alias_names") 1427 { 1428 if (argc > 0) 1429 { 1430 fill_one_argument (); 1431 } 1432 1433 cmt.m_action = action_show_alias_names; 1434 } 1435 else if (arg == "alias_value") 1436 { 1437 cmt.m_quiet = true; 1438 if (argc > 0) 1439 { 1440 cmt.m_current_target = fill_one_argument (); 1441 cmt.m_action = action_show_alias_value; 1442 } 1443 else 1444 { 1445 CmtError::set (CmtError::syntax_error, "alias name missing"); 1446 //CmtMessage::error ("syntax: alias name missing"); 1447 help_action = action_help; 1448 cmt.m_action = action_show_alias_value; 1449 } 1450 } 1451 else if (arg == "aliases") 1452 { 1453 if (argc > 0) 1454 { 1455 fill_one_argument (); 1456 } 1457 1458 cmt.m_action = action_show_aliases; 1410 1459 } 1411 1460 else if (arg == "all_tags") … … 2473 2522 help_texts.add () = "show action <name> : a formatted action definition"; 2474 2523 help_texts.add () = "show action_value <name> : a raw action definition"; 2475 help_texts.add () = "show action_names : all action names"; 2476 help_texts.add () = "show actions : all action definitions"; 2524 help_texts.add () = "show action_names [<regexp>] : all action names [matching <regexp>]"; 2525 help_texts.add () = "show actions [<regexp>] : all action definitions [for names matching <regexp>]"; 2526 help_texts.add () = "show alias <name> : a formatted alias definition"; 2527 help_texts.add () = "show alias_value <name> : a raw alias definition"; 2528 help_texts.add () = "show alias_names [<regexp>] : all alias names [matching <regexp>]"; 2529 help_texts.add () = "show aliases [<regexp>] : all alias definitions [for names matching <regexp>]"; 2477 2530 help_texts.add () = "show all_tags : all defined tags"; 2478 2531 help_texts.add () = "show applied_patterns : all patterns actually applied"; … … 2494 2547 help_texts.add () = "show macro <name> : a formatted macro definition"; 2495 2548 help_texts.add () = "show macro_value <name> : a raw macro definition"; 2496 help_texts.add () = "show macro_names : all macro names";2497 help_texts.add () = "show macros : all macro definitions";2549 help_texts.add () = "show macro_names [<regexp>] : all macro names [matching <regexp>]"; 2550 help_texts.add () = "show macros [<regexp>] : all macro definitions [for names matching <regexp>]"; 2498 2551 help_texts.add () = "show manager : package manager"; 2499 2552 help_texts.add () = "show packages [<path>]... : packages reachable from the current context [or <path>s]"; … … 2507 2560 help_texts.add () = "show pwd : filtered current directory"; 2508 2561 help_texts.add () = "show set <name> : a formatted set definition"; 2509 help_texts.add () = "show set_names : set names";2562 help_texts.add () = "show set_names [<regexp>] : set names [matching <regexp>]"; 2510 2563 help_texts.add () = "show set_value <name> : a raw set definition"; 2511 help_texts.add () = "show sets : set definitions";2564 help_texts.add () = "show sets [<regexp>] : set definitions [for names matching <regexp>]"; 2512 2565 help_texts.add () = "show strategies : all strategies (build & version)"; 2513 2566 help_texts.add () = "show tags : all currently active tags"; … … 2577 2630 help.add (action_show_action_names, help_texts[action_show_action_names]); 2578 2631 help.add (action_show_actions, help_texts[action_show_actions]); 2632 help.add (action_show_alias, help_texts[action_show_alias]); 2633 help.add (action_show_alias_value, help_texts[action_show_alias_value]); 2634 help.add (action_show_alias_names, help_texts[action_show_alias_names]); 2635 help.add (action_show_aliases, help_texts[action_show_aliases]); 2579 2636 help.add (action_show_all_tags, help_texts[action_show_all_tags]); 2580 2637 help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]); -
CMT/HEAD/source/cmt_parser.cxx
r610 r612 4353 4353 void Cmt::do_show_action (const ArgParser& ap) 4354 4354 { 4355 cmt_string target; 4356 4357 if (ap.arguments.size () > 0) target = ap.arguments[0]; 4358 4359 Symbol* symbol; 4360 4361 set_standard_macros (); 4362 4363 symbol = Symbol::find (target); 4364 4365 if (symbol == 0) 4366 { 4367 cmt_string t (target); 4368 t += " is not defined"; 4369 4370 CmtError::set (CmtError::symbol_not_found, t); 4371 4372 return; 4373 } 4374 else 4375 { 4376 cmt_string t = target; 4377 t += " is a "; 4378 4379 if ((Me.m_action == action_show_action) || 4380 (Me.m_action == action_show_action_value)) 4381 { 4382 if (symbol->type != Symbol::SymbolAction) 4383 { 4384 if (symbol->type == Symbol::SymbolMacro) 4385 { 4386 t += "macro"; 4387 } 4388 else if (symbol->type == Symbol::SymbolSet) 4389 { 4390 t += "set"; 4391 } 4392 else if (symbol->type == Symbol::SymbolPath) 4393 { 4394 t += "path"; 4395 } 4396 else if (symbol->type == Symbol::SymbolAlias) 4397 { 4398 t += "alias"; 4399 } 4400 4401 CmtError::set (CmtError::wrong_symbol_type, t); 4402 } 4403 } 4404 } 4405 4406 if (symbol->value_lists.size () < 1) return; 4407 4408 symbol->show_macro (ap.mode); 4355 do_show_macro (ap); 4409 4356 } 4410 4357 … … 4431 4378 //---------------------------------------------------------- 4432 4379 void Cmt::do_show_actions (const ArgParser& ap) 4380 { 4381 if (ap.arguments.size () > 0) 4382 { 4383 const cmt_string& pattern = ap.arguments[0]; 4384 print_macros (ap.mode, pattern); 4385 } 4386 else 4387 { 4388 print_macros (ap.mode); 4389 } 4390 } 4391 4392 //---------------------------------------------------------- 4393 void Cmt::do_show_alias (const ArgParser& ap) 4394 { 4395 do_show_macro (ap); 4396 } 4397 4398 //---------------------------------------------------------- 4399 void Cmt::do_show_alias_names (const ArgParser& ap) 4400 { 4401 if (ap.arguments.size () > 0) 4402 { 4403 const cmt_string& pattern = ap.arguments[0]; 4404 print_symbol_names (ap.mode, pattern); 4405 } 4406 else 4407 { 4408 print_symbol_names (ap.mode); 4409 } 4410 } 4411 4412 //---------------------------------------------------------- 4413 void Cmt::do_show_alias_value (const ArgParser& ap) 4414 { 4415 do_show_macro (ap); 4416 } 4417 4418 //---------------------------------------------------------- 4419 void Cmt::do_show_aliases (const ArgParser& ap) 4433 4420 { 4434 4421 if (ap.arguments.size () > 0) … … 4717 4704 { 4718 4705 cmt_string t = target; 4719 t += " is a";4706 t += " is "; 4720 4707 4721 4708 if ((Me.m_action == action_show_macro) || … … 4759 4746 } 4760 4747 } 4748 else if ( 4749 ((Me.m_action == action_show_action || 4750 Me.m_action == action_show_action_value) && 4751 symbol->type != Symbol::SymbolAction) 4752 || 4753 ((Me.m_action == action_show_alias || 4754 Me.m_action == action_show_alias_value) && 4755 symbol->type != Symbol::SymbolAlias) 4756 ) 4757 { 4758 switch (symbol->type) 4759 { 4760 case Symbol::SymbolUndefined: 4761 t += "undefined"; 4762 break; 4763 case Symbol::SymbolAction: 4764 t += "action"; 4765 break; 4766 case Symbol::SymbolAlias: 4767 t += "alias"; 4768 break; 4769 case Symbol::SymbolMacro: 4770 t += "macro"; 4771 break; 4772 case Symbol::SymbolSetupScript: 4773 t += "setup_script"; 4774 break; 4775 case Symbol::SymbolCleanupScript: 4776 t += "cleanup_script"; 4777 break; 4778 case Symbol::SymbolSet: 4779 t += "set"; 4780 break; 4781 case Symbol::SymbolPath: 4782 t += "path"; 4783 break; 4784 default: 4785 t += "unknown"; 4786 break; 4787 } 4788 4789 CmtError::set (CmtError::wrong_symbol_type, t); 4790 } 4761 4791 } 4762 4792 … … 6605 6635 case action_show_action_value : 6606 6636 case action_show_actions : 6637 case action_show_alias : 6638 case action_show_alias_names : 6639 case action_show_alias_value : 6640 case action_show_aliases : 6607 6641 case action_show_all_tags : 6608 6642 case action_show_applied_patterns : … … 6724 6758 case action_show_action_value : 6725 6759 case action_show_actions : 6760 case action_show_alias : 6761 case action_show_alias_names : 6762 case action_show_alias_value : 6763 case action_show_aliases : 6726 6764 case action_show_all_tags : 6727 6765 case action_show_applied_patterns : … … 6832 6870 case action_show_action_value : 6833 6871 case action_show_actions : 6872 case action_show_alias : 6873 case action_show_alias_names : 6874 case action_show_alias_value : 6875 case action_show_aliases : 6834 6876 case action_show_all_tags : 6835 6877 case action_show_applied_patterns : … … 6980 7022 // case action_show_action_value : 6981 7023 // case action_show_actions : 7024 // case action_show_alias : 7025 // case action_show_alias_names : 7026 // case action_show_alias_value : 7027 // case action_show_aliases : 6982 7028 // case action_show_all_tags : 6983 7029 // case action_show_applied_patterns : … … 7193 7239 do_show_actions (ap); 7194 7240 break; 7241 case action_show_alias : 7242 do_show_alias (ap); 7243 break; 7244 case action_show_alias_names : 7245 do_show_alias_names (ap); 7246 break; 7247 case action_show_alias_value : 7248 do_show_alias_value (ap); 7249 break; 7250 case action_show_aliases : 7251 do_show_aliases (ap); 7252 break; 7195 7253 case action_show_all_tags : 7196 7254 do_show_all_tags (ap); … … 7760 7818 else if (Me.m_action == action_show_set_names) 7761 7819 { 7762 // Exclude macros .7820 // Exclude macros, actions. 7763 7821 if ((symbol.type == Symbol::SymbolMacro) || 7764 7822 (symbol.type == Symbol::SymbolAction)) continue; … … 7766 7824 else if (Me.m_action == action_show_action_names) 7767 7825 { 7768 // Exclude macros.7826 // Only keep actions. 7769 7827 if (symbol.type != Symbol::SymbolAction) continue; 7828 } 7829 else if (Me.m_action == action_show_alias_names) 7830 { 7831 // Only keep aliases. 7832 if (symbol.type != Symbol::SymbolAlias) continue; 7770 7833 } 7771 7834 … … 7827 7890 { 7828 7891 if (symbol.type != Symbol::SymbolAction) continue; 7892 } 7893 else if (Me.m_action == action_show_aliases) 7894 { 7895 if (symbol.type != Symbol::SymbolAlias) continue; 7829 7896 } 7830 7897 -
CMT/HEAD/source/cmt_parser.h
r588 r612 281 281 action_show_action_names, 282 282 action_show_actions, 283 action_show_alias, 284 action_show_alias_value, 285 action_show_alias_names, 286 action_show_aliases, 283 287 action_show_all_tags, 284 288 action_show_applied_patterns, -
CMT/HEAD/source/cmt_symbol.cxx
r611 r612 1943 1943 (action != action_show_macros) && 1944 1944 (action != action_show_actions) && 1945 (action != action_show_aliases) && 1945 1946 (action != action_show_sets)) 1946 1947 { … … 1957 1958 (action == action_show_actions) || 1958 1959 (action == action_show_action) || 1960 (action == action_show_alias) || 1961 (action == action_show_aliases) || 1959 1962 (action == action_build_tag_makefile) || 1960 1963 (action == action_build_constituents_config) || … … 1976 1979 if ((action == action_show_macro_value) || 1977 1980 (action == action_show_set_value) || 1978 (action == action_show_action_value)) 1981 (action == action_show_action_value) || 1982 (action == action_show_alias_value)) 1979 1983 { 1980 1984 expand (value); … … 2004 2008 (action == action_show_actions) || 2005 2009 (action == action_show_action) || 2010 (action == action_show_alias) || 2011 (action == action_show_aliases) || 2006 2012 (action == action_build_tag_makefile) || 2007 2013 (action == action_build_constituents_config) || -
CMT/HEAD/src/setup.bash
r586 r612 25 25 local build_subcmds=(CMT_pacman constituent_makefile constituents_makefile dependencies library_links make_setup msdev os9_makefile prototype readme tag_makefile temporary_name triggers win_makefile) 26 26 local check_subcmds=(configuration files version) 27 local show_subcmds=(action action_names action_value actions al l_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents container cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions)27 local show_subcmds=(action action_names action_value actions alias alias_names alias_value aliases all_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents container cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions) 28 28 29 29 local cur _IFS="${IFS}" … … 122 122 if (( isubcommand + 1 == COMP_CWORD )); then 123 123 COMPREPLY=($(compgen -W "$(cmt -quiet show action_names)" -- "$cur")) 124 fi 125 ;; 126 alias|alias_value) 127 if (( isubcommand + 1 == COMP_CWORD )); then 128 COMPREPLY=($(compgen -W "$(cmt -quiet show alias_names)" -- "$cur")) 124 129 fi 125 130 ;; -
CMT/HEAD/src/setup.csh
r611 r612 13 13 14 14 if ( $?0 == 0 ) then 15 if ( $?tcsh == 1 || `basename "$shell"` == "tcsh" ) then 15 if ( $?tcsh == 1 ) then 16 source ${CMTROOT}/src/setup.tcsh 17 else if ( `basename "$shell"` == "tcsh" ) then 16 18 source ${CMTROOT}/src/setup.tcsh 17 19 endif … … 33 35 unset newpath 34 36 35 if ( $?CLASSPATH == 0 || "${CLASSPATH}" == "" ) then 37 if ( $?CLASSPATH == 0 ) then 38 setenv CLASSPATH ${CMTROOT}/java/cmt.jar 39 else if ( "${CLASSPATH}" == "" ) then 36 40 setenv CLASSPATH ${CMTROOT}/java/cmt.jar 37 41 else if ( "${CLASSPATH}" !~ "*/CMT/*" ) then -
CMT/HEAD/src/setup.tcsh
r585 r612 14 14 n/check_files/f/ \ 15 15 n/expand/'(model)'/ \ 16 n/show/'(action action_names action_value actions al l_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents container cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions)'/ \16 n/show/'(action action_names action_value actions alias alias_names alias_value aliases all_tags applied_patterns author branches clients cmtpath_patterns constituent constituent_names constituents container cycles fragment fragments groups include_dirs language languages macro macro_names macro_value macros manager packages path pattern patterns projects project_author pwd set set_names set_value sets strategies tags use_paths uses versions)'/ \ 17 17 n/constituents_makefile/n/ \ 18 18 n/constituent/'`cmt -quiet show constituent_names`'/ \ 19 n/fragment/'`cmt -quiet show fragments | sed -e "s#.*fragments.##" `'/ \ 20 n/action/'`cmt -quiet show action_names | sed -e "s#=.*##" `'/ \ 21 n/action_value/'`cmt -quiet show action_names | sed -e "s#=.*##" `'/ \ 22 n/macro/'`cmt -quiet show macro_names | sed -e "s#=.*##" `'/ \ 23 n/macro_value/'`cmt -quiet show macro_names | sed -e "s#=.*##" `'/ \ 19 n@fragment@'`cmt -quiet show fragments | sed -e "s#.*/fragments/##"`'@ \ 20 n/action/'`cmt -quiet show action_names`'/ \ 21 n/action_value/'`cmt -quiet show action_names`'/ \ 22 n/alias/'`cmt -quiet show alias_names`'/ \ 23 n/alias_value/'`cmt -quiet show alias_names`'/ \ 24 n/macro/'`cmt -quiet show macro_names`'/ \ 25 n/macro_value/'`cmt -quiet show macro_names`'/ \ 24 26 n/pattern/'`cmt -quiet show pattern_names`'/ \ 25 n/set/'`cmt -quiet show set_names | sed -e "s#=.*##"`'/ \26 n/set_value/'`cmt -quiet show set_names | sed -e "s#=.*##"`'/ \27 n/set/'`cmt -quiet show set_names`'/ \ 28 n/set_value/'`cmt -quiet show set_names`'/ \ 27 29 n/triggers/'`cmt -quiet show constituent_names`'/ \ 28 30 'n/c{o,heckout}/(-l -R -r -C -i -vd -d -o -requirements -no_config -rs --help)/' \ -
CMT/HEAD/src/setup.zsh
r585 r612 10 10 function cmt_macros { reply=(`cmt -quiet show macro_names`)}; \ 11 11 function cmt_actions { reply=(`cmt -quiet show action_names`)}; \ 12 function cmt_aliases { reply=(`cmt -quiet show alias_names`)}; \ 12 13 function cmt_sets { reply=(`cmt -quiet show set_names`)}; \ 13 14 function cmt_constituents { reply=(`cmt -quiet show constituent_names`) }; \ … … 32 33 'w[1,remove] p[3]' -X '> give version tag' - \ 33 34 'w[1,remove] p[4]' -X '> give a path if not located from the current path ' - \ 34 's[show],c[-1,show]' -k '(action,action_names,action_value,actions,al l_tags,applied_patterns,author,branches,clients,cmtpath_patterns,constituent,constituent_names,constituents,container,cycles,fragment,fragments,groups,include_dirs,language,languages,macro,macro_names,macro_value,macros,manager,packages,path,pattern,patterns,projects,project_author,pwd,set,set_names,set_value,sets,strategies,tags,use_paths,uses,versions)' - \35 's[show],c[-1,show]' -k '(action,action_names,action_value,actions,alias,alias_names,alias_value,aliases,all_tags,applied_patterns,author,branches,clients,cmtpath_patterns,constituent,constituent_names,constituents,container,cycles,fragment,fragments,groups,include_dirs,language,languages,macro,macro_names,macro_value,macros,manager,packages,path,pattern,patterns,projects,project_author,pwd,set,set_names,set_value,sets,strategies,tags,use_paths,uses,versions)' - \ 35 36 'w[1,show] c[-1,constituent]' -K cmt_constituents - \ 36 37 'w[1,show] c[-1,fragment]' -K cmt_fragments - \ 37 38 'w[1,show] c[-1,action]' -K cmt_actions - \ 38 39 'w[1,show] c[-1,action_value]' -K cmt_actions - \ 40 'w[1,show] c[-1,alias]' -K cmt_aliases - \ 41 'w[1,show] c[-1,alias_value]' -K cmt_aliases - \ 39 42 'w[1,show] c[-1,macro]' -K cmt_macros - \ 40 43 'w[1,show] c[-1,macro_value]' -K cmt_macros - \
Note: See TracChangeset
for help on using the changeset viewer.