- Added --long-help and -E, --expert switches.

This commit is contained in:
ccremers 2006-02-22 08:41:06 +00:00
parent b2e40e07f3
commit 5ddcdfed22
2 changed files with 61 additions and 14 deletions

View File

@ -79,6 +79,7 @@ switchesInit (int argc, char **argv)
switches.addreachableclaim = false; // add 'reachable' claims switches.addreachableclaim = false; // add 'reachable' claims
switches.addallclaims = false; // add all sorts of claims switches.addallclaims = false; // add all sorts of claims
switches.check = false; // check the protocol for termination etc. (default off) switches.check = false; // check the protocol for termination etc. (default off)
switches.expert = false; // expert mode (off by default)
// Output // Output
switches.output = SUMMARY; // default is to show a summary switches.output = SUMMARY; // default is to show a summary
@ -571,6 +572,8 @@ switcher (const int process, int index, int commandline)
} }
else else
{ {
warning
("'-m, --match' switch has been deprecated. Use '-u, --untyped' instead.");
switches.match = integer_argument (); switches.match = integer_argument ();
return index; return index;
} }
@ -723,7 +726,7 @@ switcher (const int process, int index, int commandline)
{ {
if (!process) if (!process)
{ {
/* for experts only /* disabled for now
helptext (" --ra-tupling", "compile using right-associative tupling"); helptext (" --ra-tupling", "compile using right-associative tupling");
*/ */
} }
@ -939,15 +942,37 @@ switcher (const int process, int index, int commandline)
#endif #endif
/* ================== /* ==================
* External options * Misc switches
*/ */
if (!process)
printf ("Misc. switches:\n");
if (detect ('E', "expert", 0))
{
if (!process)
{
if (switches.expert)
{
helptext ("-E, --expert", "Expert mode");
}
}
else
{
switches.expert = true;
return index;
}
}
if (detect (' ', "count-states", 0)) if (detect (' ', "count-states", 0))
{ {
if (!process) if (!process)
{ {
/* not very important if (switches.expert)
{
helptext (" --count-states", "report on states (per claim)"); helptext (" --count-states", "report on states (per claim)");
*/ }
} }
else else
{ {
@ -956,15 +981,12 @@ switcher (const int process, int index, int commandline)
} }
} }
if (!process)
printf ("Misc. switches:\n");
if (detect (' ', "echo", 0)) if (detect (' ', "echo", 0))
{ {
if (!process) if (!process)
{ {
/* not very important /* not very important
helptext ("-E,--echo", "echo command line"); helptext (" --echo", "echo command line");
*/ */
} }
else else
@ -1011,9 +1033,10 @@ switcher (const int process, int index, int commandline)
{ {
if (!process) if (!process)
{ {
/* not very important: hide if (switches.expert)
{
helptext ("-v, --version", "version information"); helptext ("-v, --version", "version information");
*/ }
} }
else else
{ {
@ -1033,7 +1056,7 @@ switcher (const int process, int index, int commandline)
{ {
if (!process) if (!process)
{ {
helptext ("-h, --help", "show this help"); helptext ("-h, --help", "show short help");
} }
else else
{ {
@ -1047,6 +1070,25 @@ switcher (const int process, int index, int commandline)
} }
} }
if (detect (' ', "long-help", 0))
{
if (!process)
{
helptext (" --long-help", "show long help");
}
else
{
if (commandline)
{
printf ("Usage:\n");
printf (" %s [switches] [FILE]\n\nSwitches:\n", progname);
switches.expert = true;
switcher (0, 0, commandline);
}
exit (0);
}
}
if (detect (' ', "plain", 0)) if (detect (' ', "plain", 0))
{ {
if (!process) if (!process)
@ -1065,7 +1107,11 @@ switcher (const int process, int index, int commandline)
{ {
if (!process) if (!process)
{ {
helptext ("-D, --debug=<int>", "set debug (verbosity) level. [0]"); if (switches.expert)
{
helptext ("-D, --debug=<int>",
"set debug (verbosity) level. [0]");
}
} }
else else
{ {

View File

@ -57,6 +57,7 @@ struct switchdata
int addreachableclaim; //!< Adds 'reachable' claims to each role int addreachableclaim; //!< Adds 'reachable' claims to each role
int addallclaims; //!< Adds all sorts of claims to the roles int addallclaims; //!< Adds all sorts of claims to the roles
int check; //!< Check protocol correctness int check; //!< Check protocol correctness
int expert; //!< Expert mode
// Output // Output
int output; //!< From enum outputs: what should be produced. Default ATTACK. int output; //!< From enum outputs: what should be produced. Default ATTACK.