Index: src/CompilationState.cc
===================================================================
--- src/CompilationState.cc	(revision 76f7fc734a09409f02e2b52d5645a0d39e9c567b)
+++ src/CompilationState.cc	(revision 62ce290a819f55fb97ac23867a84527cc416c5c4)
@@ -10,6 +10,6 @@
 // Created On       : Mon Ju1 30 10:47:01 2018
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May  2 07:46:12 2019
-// Update Count     : 3
+// Last Modified On : Fri May  3 13:45:23 2019
+// Update Count     : 4
 //
 
@@ -26,5 +26,5 @@
 	libcfap = false,
 	nopreludep = false,
-	noprotop = false,
+	genproto = false,
 	nomainp = false,
 	parsep = false,
Index: src/CompilationState.h
===================================================================
--- src/CompilationState.h	(revision 76f7fc734a09409f02e2b52d5645a0d39e9c567b)
+++ src/CompilationState.h	(revision 62ce290a819f55fb97ac23867a84527cc416c5c4)
@@ -10,6 +10,6 @@
 // Created On       : Mon Ju1 30 10:47:01 2018
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May  2 07:46:12 2019
-// Update Count     : 3
+// Last Modified On : Fri May  3 13:43:21 2019
+// Update Count     : 4
 //
 
@@ -27,5 +27,5 @@
 	libcfap,
 	nopreludep,
-	noprotop,
+	genproto,
 	nomainp,
 	parsep,
Index: src/main.cc
===================================================================
--- src/main.cc	(revision 76f7fc734a09409f02e2b52d5645a0d39e9c567b)
+++ src/main.cc	(revision 62ce290a819f55fb97ac23867a84527cc416c5c4)
@@ -10,6 +10,6 @@
 // Created On       : Fri May 15 23:12:02 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu May  2 11:09:37 2019
-// Update Count     : 523
+// Last Modified On : Fri May  3 16:10:52 2019
+// Update Count     : 599
 //
 
@@ -24,4 +24,5 @@
 #include <fstream>                          // for ofstream
 #include <iostream>                         // for operator<<, basic_ostream
+#include <iomanip>
 #include <iterator>                         // for back_inserter
 #include <list>                             // for list
@@ -355,5 +356,5 @@
 
 		CodeTools::fillLocations( translationUnit );
-		PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
+		PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) );
 
 		CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
@@ -405,38 +406,21 @@
 
 
-static const char optstring[] = ":abBcCdeEGghlLmNnpP:qrRS:stTvwW:yzZD:F:";
-
+static const char optstring[] = ":hlLmNn:pP:S:twW:D:F:";
+
+enum { PreludeDir = 128 };
 static struct option long_opts[] = {
-	{ "ast", no_argument, nullptr, 'a' },
-	{ "before-resolver", no_argument, nullptr, 'b' },
-	{ "box", no_argument, nullptr, 'B' },
-	{ "ctorinitfix", no_argument, nullptr, 'c' },
-	{ "code", no_argument, nullptr, 'C' },
-	{ "decl-stmts", no_argument, nullptr, 'd' },
-	{ "expr", no_argument, nullptr, 'e' },
-	{ "expralt", no_argument, nullptr, 'E' },
-	{ "generics", no_argument, nullptr, 'G' },
-	{ "grammar", no_argument, nullptr, 'g' },
 	{ "help", no_argument, nullptr, 'h' },
 	{ "libcfa", no_argument, nullptr, 'l' },
-	{ "line-marks", no_argument, nullptr, 'L' },
+	{ "linemarks", no_argument, nullptr, 'L' },
 	{ "no-main", no_argument, 0, 'm' },
-	{ "no-line-marks", no_argument, nullptr, 'N' },
-	{ "no-preamble", no_argument, nullptr, 'n' },
+	{ "no-linemarks", no_argument, nullptr, 'N' },
+	{ "no-prelude", no_argument, nullptr, 'n' },
 	{ "prototypes", no_argument, nullptr, 'p' },
-	{ "prelude-dir <directory>", required_argument, nullptr, 'P' },
-	{ "parse-tree", no_argument, nullptr, 'q' },
-	{ "resolver", no_argument, nullptr, 'r' },
-	{ "resolver-proto", no_argument, nullptr, 'R' },
-	{ "statistics <option-list>", required_argument, nullptr, 'S' },
-	{ "symbol", no_argument, nullptr, 's' },
+	{ "print", required_argument, nullptr, 'P' },
+	{ "prelude-dir", required_argument, nullptr, PreludeDir },
+	{ "statistics", required_argument, nullptr, 'S' },
 	{ "tree", no_argument, nullptr, 't' },
-	{ "tuple", no_argument, nullptr, 'T' },
-	{ "validate", no_argument, nullptr, 'v' },
 	{ "", no_argument, nullptr, 0 },					// -w
 	{ "", no_argument, nullptr, 0 },					// -W
-	{ "dump-ast-on-error", no_argument, nullptr, 'y' },
-	{ "dump-ast-code", no_argument, nullptr, 'z' },
-	{ "prettyprint-codegen", no_argument, nullptr, 'Z' },
 	{ "", no_argument, nullptr, 0 },					// -D
 	{ "", no_argument, nullptr, 0 },					// -F
@@ -445,38 +429,50 @@
 
 static const char * description[] = {
-	"dump AST",											// -a
-	"print before resolver step",						// -b
-	"print before box step",							// -B
-	"print after ctor/dtor are replaced",				// -c
-	"print before code generation",						// -C
-	"print declaration statements",						// -d
-	"dump AST after expression analysis",				// -e
-	"print alternatives for expressions",				// -E
-	"dump AST after instantiate generics",				// -G
-	"print bison (parsing) debugging information",		// -g
-	"help message",										// -h
+	"print help message",								// -h
 	"generate libcfa.c",								// -l
-	"print line marks",									// -L
+	"generate line marks",								// -L
 	"do not replace main",								// -m
-	"suppress line marks",								// -N
-	"do not read preamble",								// -n
-	"generate prototypes for preamble functions",		// -p
-	"prelude directory for debug/nodebug",				// -P
-	"dump parse tree",									// -q
-	"print resolver steps",								// -r
-	"dump resolver-proto instance",						// -R
-	"enable profiling information: counters,heap,time",	// -S
-	"print symbol table events",						// -s
+	"do not generate line marks",						// -N
+	"do not read prelude",								// -n
+	"generate prototypes for prelude functions",		// -p
+	"print",											// -P
+	"<directory> prelude directory for debug/nodebug",	// no flag
+	"<option-list> enable profiling information:\n          counters,heap,time,all,none", // -S
 	"build in tree",									// -t
-	"print after tuple expansion",						// -T
-	"dump AST after declaration validation pass",		// -v
 	"",													// -w
 	"",													// -W
-	"dump AST on error",								// -y
-	"dump as codegen rather than AST",					// -z
-	"prettyprint during codegen",						// -Z
 	"",													// -D
 	"",													// -F
 }; // description
+
+static_assert( sizeof( long_opts ) / sizeof( long_opts[0] ) - 1 == sizeof( description ) / sizeof( description[0] ) );
+
+static struct Printopts {
+	const char * name;
+	int & flag;
+	int val;
+	const char * descript;
+} printopts[] = {
+	{ "altexpr", expraltp, true, "alternatives for expressions" },
+	{ "ascodegen", codegenp, true, "as codegen rather than AST" },
+	{ "ast", astp, true, "AST after parsing" },
+	{ "astdecl", validp, true, "AST after declaration validation pass" },
+	{ "asterr", errorp, true, "AST on error" },
+	{ "astexpr", exprp, true, "AST after expression analysis" },
+	{ "astgen", genericsp, true, "AST after instantiate generics" },
+	{ "box", bboxp, true, "before box step" },
+	{ "ctordtor", ctorinitp, true, "after ctor/dtor are replaced" },
+	{ "codegen", bcodegenp, true, "before code generation" },
+	{ "declstats", declstatsp, true, "code property statistics" },
+	{ "parse", yydebug, true, "yacc (parsing) debug information" },
+	{ "pretty", prettycodegenp, true, "prettyprint for ascodegen flag" },
+	{ "resolver", bresolvep, true, "before resolver step" },
+	{ "rproto", resolvprotop, true, "resolver-proto instance" },
+	{ "rsteps", resolvep, true, "resolver steps" },
+	{ "symevt", symtabp, true, "symbol table events" },
+	{ "tree", parsep, true, "parse tree" },
+	{ "tuple", tuplep, true, "after tuple expansion" },
+};
+enum { printoptsSize = sizeof( printopts ) / sizeof( printopts[0] ) };
 
 static void usage( char *argv[] ) {
@@ -485,7 +481,21 @@
 	for ( ; long_opts[i].name != 0 && optstring[j] != '\0'; i += 1, j += 1 ) {
 		if ( long_opts[i].name[0] != '\0' ) {			// hidden option, internal usage only
-			cout << "  -" << optstring[j] << ", --" << long_opts[i].name << "  " << description[i] << endl;
-		} // if
-		if ( optstring[j+1] == ':' ) j += 1;
+			if ( strcmp( long_opts[i].name, "prelude-dir" ) != 0 ) { // flag
+				cout << "  -" << optstring[j] << ",";
+			} else {									// no flag
+				j -= 1;									// compensate
+				cout << "     ";
+			} // if
+			cout << " --" << left << setw(12) << long_opts[i].name << "  ";
+			if ( strcmp( long_opts[i].name, "print" ) == 0 ) {
+				cout << "one of: " << endl;
+				for ( int i = 0; i < printoptsSize; i += 1 ) {
+					cout << setw(10) << " " << left << setw(10) << printopts[i].name << "  " << printopts[i].descript << endl;
+				} // for
+			} else {
+				cout << description[i] << endl;
+			} // if
+		} // if
+		if ( optstring[j + 1] == ':' ) j += 1;
 	} // for
 	if ( long_opts[i].name != 0 || optstring[j] != '\0' ) assertf( false, "internal error, mismatch of option flags and names\n" );
@@ -500,34 +510,4 @@
 	while ( (c = getopt_long( argc, argv, optstring, long_opts, nullptr )) != -1 ) {
 		switch ( c ) {
-		  case 'a':										// dump AST
-			astp = true;
-			break;
-		  case 'b':										// print before resolver steps
-			bresolvep = true;
-			break;
-		  case 'B':										// print before box steps
-			bboxp = true;
-			break;
-		  case 'c':										// print after ctor/dtor are replaced
-			ctorinitp = true;
-			break;
-		  case 'C':										// print before code generation
-			bcodegenp = true;
-			break;
-		  case 'd':										// print declaration statements
-			declstatsp = true;
-			break;
-		  case 'e':										// dump AST after expression analysis
-			exprp = true;
-			break;
-		  case 'E':										// print alternatives for expressions
-			expraltp = true;
-			break;
-		  case 'G':										// dump AST after instantiate generics
-			genericsp = true;
-			break;
-		  case 'g':										// print bison (parsing) debugging information
-			yydebug = true;
-			break;
 		  case 'h':										// help message
 			usage( argv );								// no return
@@ -536,5 +516,5 @@
 			libcfap = true;
 			break;
-		  case 'L':										// print line marks
+		  case 'L':										// generate line marks
 			linemarks = true;
 			break;
@@ -542,39 +522,33 @@
 			nomainp = true;
 			break;
-		  case 'N':										// suppress line marks
+		  case 'N':										// do not generate line marks
 			linemarks = false;
 			break;
-		  case 'n':										// do not read preamble
+		  case 'n':										// do not read prelude
 			nopreludep = true;
 			break;
-		  case 'p':										// generate prototypes for preamble functions
-			noprotop = true;
-			break;
-		  case 'P':										// prelude directory for debug/nodebug, hidden
+		  case 'p':										// generate prototypes for prelude functions
+			genproto = true;
+			break;
+		  case 'P':										// print options
+			for ( int i = 0;; i += 1 ) {
+				if ( i == printoptsSize ) {
+					cout << "Unknown --print option " << optarg << endl;
+					goto Default;
+				} // if
+				if ( strcmp( optarg, printopts[i].name ) == 0 ) {
+					printopts[i].flag = printopts[i].val;
+					break;
+				} // if
+			} // for
+			break;
+		  case PreludeDir:								// prelude directory for debug/nodebug, hidden
 			PreludeDirector = optarg;
-			break;
-		  case 'q':										// dump parse tree
-			parsep = true;
-			break;
-		  case 'r':										// print resolver steps
-			resolvep = true;
-			break;
-		  case 'R':										// dump resolver-proto instance
-			resolvprotop = true;
 			break;
 		  case 'S':										// enable profiling information, argument comma separated list of names
 			Stats::parse_params( optarg );
 			break;
-		  case 's':										// print symbol table events
-			symtabp = true;
-			break;
 		  case 't':										// build in tree
 			treep = true;
-			break;
-		  case 'T':										// print after tuple expansion
-			tuplep = true;
-			break;
-		  case 'v':										// dump AST after declaration validation pass
-			validp = true;
 			break;
 		  case 'w':										// suppress all warnings, hidden
@@ -598,13 +572,4 @@
 			} // if
 			break;
-		  case 'y':										// dump AST on error
-			errorp = true;
-			break;
-		  case 'z':										// dump as codegen rather than AST
-			codegenp = true;
-			break;
-		  case 'Z':										// prettyprint during codegen (i.e. print unmangled names, etc.)
-			prettycodegenp = true;
-			break;
 		  case 'D':										// ignore -Dxxx, forwarded by cpp, hidden
 			break;
@@ -666,5 +631,5 @@
 	list< Declaration * > decls;
 
-	if ( noprotop ) {
+	if ( genproto ) {
 		filter( translationUnit.begin(), translationUnit.end(), back_inserter( decls ), notPrelude );
 	} else {
@@ -674,5 +639,5 @@
 	// depending on commandline options, either generate code or dump the AST
 	if ( codegenp ) {
-		CodeGen::generate( decls, out, ! noprotop, prettycodegenp );
+		CodeGen::generate( decls, out, ! genproto, prettycodegenp );
 	} else {
 		printAll( decls, out );
