Index: src/prelude/prelude-gen.cc
===================================================================
--- src/prelude/prelude-gen.cc	(revision 1d386a7bcae033ad6eadd76917517ba0c38d76f9)
+++ src/prelude/prelude-gen.cc	(revision 1629965ebe98057d12e4a698883d53a7080921c6)
@@ -121,4 +121,6 @@
 		if(mask & (1 << i)) {
 			result += name;
+		} else {
+			result.append(name.size(), ' ');
 		}
 		i++;
@@ -148,35 +150,8 @@
 	cout << endl;
 
-	cout << "void	?{}( zero_t & );" << endl;
-	cout << "void	?{}( one_t & );" << endl;
-	cout << "void	?{}( zero_t &, zero_t );" << endl;
-	cout << "void	?{}( one_t &, one_t );" << endl;
-	cout << "void	^?{}( zero_t & );" << endl;
-	cout << "void	^?{}( one_t & );" << endl;
-	cout << "zero_t			?=?( zero_t &, zero_t );" << endl;
-	cout << "one_t			?=?( one_t &, one_t );" << endl;
 	cout << "signed int ?==?( zero_t, zero_t ),							?!=?( zero_t, zero_t );" << endl;
 	cout << "signed int ?==?( one_t, one_t ),							?!=?( one_t, one_t );" << endl;
-
 	cout << "signed int ?==?( _Bool, _Bool ),							?!=?( _Bool, _Bool );" << endl;
-	cout << "void	?{}( _Bool & );" << endl;
-	cout << "void	?{}( _Bool &, _Bool );" << endl;
-	cout << "void	^?{}( _Bool & );" << endl;
-	cout << "_Bool			?=?( _Bool &, _Bool ),					?=?( volatile _Bool &, _Bool );" << endl;
 	cout << "signed int	!?( _Bool );" << endl;
-
-	cout << "void	^?{}( char & );" << endl;
-	cout << "void	^?{}( char unsigned & );" << endl;
-	cout << "void	^?{}( char signed & );" << endl;
-	cout << "void	?{}( char &, char );" << endl;
-	cout << "void	?{}( unsigned char &, unsigned char );" << endl;
-	cout << "void	?{}( char signed &, char signed );" << endl;
-	cout << "void	?{}( char & );" << endl;
-	cout << "void	?{}( unsigned char & );" << endl;
-	cout << "void	?{}( char signed & );" << endl;
-	cout << "char			?=?( char &, char ),					?=?( volatile char &, char );" << endl;
-	cout << "char signed		?=?( char signed &, char signed ),			?=?( volatile char signed &, char signed );" << endl;
-	cout << "char unsigned		?=?( char unsigned &, char unsigned ),			?=?( volatile char unsigned &, char unsigned );" << endl;
-
 
 	for (auto op : arithmeticOperators) {
@@ -213,4 +188,22 @@
 	cout << "// Arithmetic Constructors //" << endl;
 	cout << "/////////////////////////////" << endl;
+	auto otype = [](const std::string & type, bool do_volatile = false) {
+		cout << "void \t?{} ( " << type << " & );" << endl;
+		cout << "void \t?{} ( " << type << " &, " << type << " );" << endl;
+		cout << type << " \t?=? ( " << type << " &, " << type << " )";
+		if( do_volatile ) {
+			cout << ", \t?=?( volatile " << type << " &, " << type << " )";
+		}
+		cout << ";" << endl;
+		cout << "void \t^?{}( " << type << " & );" << endl;
+	};
+
+	otype("zero_t");
+	otype("one_t");
+	otype("_Bool", true);
+	otype("char", true);
+	otype("signed char", true);
+	otype("unsigned char", true);
+
 	for (auto type : basicTypes) {
 		cout << "void  ?{}(" << type.name << " &);" << endl;
@@ -227,8 +220,13 @@
 	cout << "forall(ftype FT) void  ?{}( FT * volatile &, FT * );" << endl;
 
-	// generate qualifiers for first and second parameters of copy constructors
+	// generate qualifiers
+	vector<string> qualifiersSingle;
 	vector<pair<const string, const string>> qualifiersPair;
 	const unsigned int NQ = 2;
 	for(unsigned int lhs = 0; lhs < (1<<NQ); lhs++) {
+		// for parameter of default constructor and destructor
+		qualifiersSingle.push_back(mask2string(lhs, make_array("const "s, "volatile "s)));
+
+		// for first and second parameters of copy constructors
 		for(unsigned int rhs = 0; rhs < (1<<NQ); rhs++) {
 			if((lhs & rhs) == rhs) {
@@ -241,32 +239,34 @@
 	}
 
-	for (auto type : { "DT", "void" }) {
-		for (auto q : qualifiersPair) {
-			cout << "forall(dtype DT) void  ?{}(" << q.first << type << " *&, " << q.second << "DT *);" << endl;
-		}
-	}
-
-
-	// generate qualifiers for parameter of default constructor and destructor
-	vector<string> qualifiersSingle;
-	for (unsigned int lhs = 0; lhs < (1<<NQ); lhs++) {
-		qualifiersSingle.push_back(mask2string(lhs, make_array("const "s, "volatile "s)));
-	}
-
-	for (auto type : { "DT", "void" }) {
-		for (auto q : qualifiersSingle) {
-			cout << "forall(dtype DT) void  ?{}(" << q << type << " *&);" << endl;
-			cout << "forall(dtype DT) void ^?{}(" << q << type << " *&);" << endl;
-		}
-	}
-	cout << endl;
-
-	cout << "forall(dtype DT) void ?{}(		    DT *	  &, zero_t );" << endl;
-	cout << "forall(dtype DT) void ?{}(		    DT * volatile &, zero_t );" << endl;
-	cout << "forall(dtype DT) void ?{}( const	    DT *	  &, zero_t );" << endl;
-	cout << "forall(dtype DT) void ?{}( volatile	    DT *	  &, zero_t );" << endl;
-	cout << "forall(dtype DT) void ?{}( volatile	    DT * volatile &, zero_t );" << endl;
-	cout << "forall(dtype DT) void ?{}( const volatile DT *	  &, zero_t );" << endl;
+	for (auto type : { "  DT", "void" }) {
+		for (auto cvq : qualifiersPair) {
+			for (auto is_vol : { "        ", "volatile" }) {
+				cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
+			}
+		}
+		for (auto cvq : qualifiersSingle) {
+			for (auto is_vol : { "        ", "volatile" }) {
+				cout << "forall(dtype DT) void  ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
+			}
+			for (auto is_vol : { "        ", "volatile" }) {
+				cout << "forall(dtype DT) void ^?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
+			}
+		}
+	}
+
+	{
+		auto type = "  DT";
+		for (auto is_vol : { "        ", "volatile" }) {
+			for (auto cvq : qualifiersSingle) {
+				cout << "forall(dtype DT) void ?{}( " << cvq << type << " * " << is_vol << " &, zero_t);" << endl;
+			}
+		}
+	}
+
+	cout << endl;
+
 	cout << "forall(ftype FT) void	?{}( FT *	   &, zero_t );	" << endl;
+	cout << "forall(ftype FT) FT *			?=?( FT *	   &, zero_t );" << endl;
+	cout << "forall(ftype FT) FT *			?=?( FT * volatile &, zero_t );" << endl;
 	cout << "forall( ftype FT ) void	?{}( FT *	   & );" << endl;
 	cout << "forall( ftype FT ) void	^?{}( FT *	   & );" << endl;
@@ -285,24 +285,8 @@
 
 
-	cout << "forall( dtype DT ) void *		 ?=?(		     void *	     &,			DT * );" << endl;
-	cout << "forall( dtype DT ) void *		 ?=?(		     void * volatile &,			DT * );" << endl;
-	cout << "forall( dtype DT ) const void *		 ?=?( const	     void *	     &,			DT * );" << endl;
-	cout << "forall( dtype DT ) const void *		 ?=?( const	     void * volatile &,			DT * );" << endl;
-	cout << "forall( dtype DT ) const void *		 ?=?( const	     void *	     &, const		DT * );" << endl;
-	cout << "forall( dtype DT ) const void *		 ?=?( const	     void * volatile &, const		DT * );" << endl;
-	cout << "forall( dtype DT ) volatile void *	 ?=?(	    volatile void *	     &,			DT * );" << endl;
-	cout << "forall( dtype DT ) volatile void *	 ?=?(	    volatile void * volatile &,			DT * );" << endl;
-	cout << "forall( dtype DT ) volatile void *	 ?=?(	    volatile void *	     &,	      volatile	DT * );" << endl;
-	cout << "forall( dtype DT ) volatile void *	 ?=?(	    volatile void * volatile &,	      volatile	DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void *	     &,			DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &,			DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void *	     &, const		DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &, const		DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void *	     &,	      volatile	DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &,	      volatile	DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void *	     &, const volatile	DT * );" << endl;
-	cout << "forall( dtype DT ) const volatile void * ?=?( const volatile void * volatile &, const volatile	DT * );" << endl;
-
 	for (auto op : pointerOperators) {
+		auto forall = [&op]() {
+			cout << "forall(dtype DT" << op.sized << ") ";
+		};
 		for (auto type : { "DT"/*, "void"*/ } ) {
 			auto operands = count(op.name.begin(), op.name.end(), '?');
@@ -313,8 +297,8 @@
 						if (operands == 1) {
 							for (auto q : qualifiersSingle){
-								for (auto q2 : { " ", " volatile " }) {
-									cout << "forall(dtype DT" << op.sized <<  ") ";
+								for (auto q2 : { "        ", "volatile" }) {
+									forall();
 									cout << q << type << " * " << op.name << "(";
-									cout << q << type << " *" << q2 << "&";
+									cout << q << type << " * " << q2 << " &";
 									cout << ");" << endl;
 								}
@@ -322,8 +306,8 @@
 						} else {
 							for (auto q : qualifiersPair){
-								for (auto q2 : { " ", " volatile " }) {
-									cout << "forall(dtype DT" << op.sized <<  ") ";
+								for (auto q2 : { "        ", "volatile" }) {
+									forall();
 									cout << q.first << type << " * " << op.name << "(";
-									cout << q.first << type << " *" << q2 << "&";
+									cout << q.first << type << " * " << q2 << " &";
 
 									for (int i = 1; i < operands; ++i) {
@@ -337,8 +321,8 @@
 					case PtrDiff:
 						for (auto q : qualifiersSingle){
-							for (auto q2 : { " ", " volatile " }) {
-								cout << "forall(dtype DT" << op.sized << ") ";
+							for (auto q2 : { "        ", "volatile" }) {
+								forall();
 								cout << q << type << " * " << op.name << "(";
-								cout << q << type << " *" << q2 << "&";
+								cout << q << type << " * " << q2 << " &";
 
 								for (int i = 1; i < operands; ++i) {
@@ -353,12 +337,15 @@
 					}
 			} else {
+				auto name_and_arg1 = [&op, &type](const std::string & q) {
+					if (op.diffReturn == "&") cout << q << type << " &"; // -- qualifiers
+					else if (op.diffReturn != "") cout << op.diffReturn;
+					else cout << q << type << " *";
+					cout << " " << op.name << "(";
+				};
 				switch(op.diffArg2) {
 					case Normal:
 						for (auto q : qualifiersSingle) {
-							cout << "forall(dtype DT" << op.sized << ") ";
-							if (op.diffReturn == "&") cout << q << type << " &"; // -- qualifiers
-							else if (op.diffReturn != "") cout << op.diffReturn;
-							else cout << q << type << " *";
-							cout << " " << op.name << "(";
+							forall();
+							name_and_arg1( q );
 							for (int i = 0; i < operands; ++i) {
 								cout << q << type << " *";
@@ -370,18 +357,14 @@
 					case CommPtrDiff:
 						for (auto q : qualifiersSingle) {
-							cout << "forall(dtype DT" << op.sized << ") ";
-							if (op.diffReturn == "&") cout << q << type << " &"; // -- qualifiers
-							else if (op.diffReturn != "") cout << op.diffReturn;
-							else cout << q << type << " *";
-							cout << " " << op.name << "(ptrdiff_t, " << q << type << " *);" << endl;
+							forall();
+							name_and_arg1( q );
+							cout << "ptrdiff_t, " << q << type << " *);" << endl;
 						}
 						// fallthrough
 					case PtrDiff:
 						for (auto q : qualifiersSingle) {
-							cout << "forall(dtype DT" << op.sized << ") ";
-							if (op.diffReturn == "&") cout << q << type << " &"; // -- qualifiers
-							else if (op.diffReturn != "") cout << op.diffReturn;
-							else cout << q << type << " *";
-							cout << " " << op.name << "(" << q << type << " *, ptrdiff_t);" << endl;
+							forall();
+							name_and_arg1( q );
+							cout << q << type << " *, ptrdiff_t);" << endl;
 						}
 						break;
@@ -393,14 +376,13 @@
 	cout << endl;
 
-	cout << "forall(dtype DT) DT *			?=?(		    DT *	  &, zero_t );" << endl;
-	cout << "forall(dtype DT) DT *			?=?(		    DT * volatile &, zero_t );" << endl;
-	cout << "forall(dtype DT) const DT *		?=?( const	    DT *	  &, zero_t );" << endl;
-	cout << "forall(dtype DT) const DT *		?=?( const	    DT * volatile &, zero_t );" << endl;
-	cout << "forall(dtype DT) volatile DT *	?=?( volatile	    DT *	  &, zero_t );" << endl;
-	cout << "forall(dtype DT) volatile DT *	?=?( volatile	    DT * volatile &, zero_t );" << endl;
-	cout << "forall(dtype DT) const volatile DT *	?=?( const volatile DT *	  &, zero_t );" << endl;
-	cout << "forall(dtype DT) const volatile DT *	?=?( const volatile DT * volatile &, zero_t );" << endl;
-	cout << "forall(ftype FT) FT *			?=?( FT *	   &, zero_t );" << endl;
-	cout << "forall(ftype FT) FT *			?=?( FT * volatile &, zero_t );" << endl;
+	for (auto is_vol : { "        ", "volatile" }) {
+		for (auto cvq : qualifiersPair) {
+				cout << "forall(dtype DT) " << cvq.first << "void * ?=?( " << cvq.first << "void * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
+		}
+		for (auto cvq : qualifiersSingle) {
+			cout << "forall(dtype DT) " << cvq <<   "  DT * ?=?( " << cvq << "  DT * " << is_vol << " &, zero_t);" << endl;
+		}
+	}
+	cout << endl;
 }
 
