Index: src/libcfa/iostream.c
===================================================================
--- src/libcfa/iostream.c	(revision 2988eebb61a23bfe28efea59b2bdd2e4fb6028c1)
+++ src/libcfa/iostream.c	(revision 829c907247aaf3211ea7e8c3d290193a6f2d15d5)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Mar  6 20:52:02 2017
-// Update Count     : 313
+// Last Modified On : Tue Mar 21 20:58:48 2017
+// Update Count     : 347
 //
 
@@ -24,103 +24,103 @@
 
 forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, char c ) {
-	prtfmt( os, "%c", c );
-	sepOff( os );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, signed char c ) {
-	prtfmt( os, "%hhd", c );
-	sepOff( os );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, unsigned char c ) {
-	prtfmt( os, "%hhu", c );
-	sepOff( os );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, short int si ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%hd", si );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, unsigned short int usi ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%hu", usi );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, int i ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%d", i );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, unsigned int ui ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%u", ui );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, long int li ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%ld", li );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, unsigned long int uli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%lu", uli );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, long long int lli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%lld", lli );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, unsigned long long int ulli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%llu", ulli );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, float f ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%g", f );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, double d ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%.*lg", DBL_DIG, d );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, long double ld ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%.*Lg", LDBL_DIG, ld );
-	return os;
-} // ?|?
-
-forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, float _Complex fc ) {
+ostype * ?|?( ostype * os, char c ) {
+	fmt( os, "%c", c );
+	sepOff( os );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, signed char c ) {
+	fmt( os, "%hhd", c );
+	sepOff( os );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, unsigned char c ) {
+	fmt( os, "%hhu", c );
+	sepOff( os );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, short int si ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%hd", si );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, unsigned short int usi ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%hu", usi );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, int i ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%d", i );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, unsigned int ui ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%u", ui );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, long int li ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%ld", li );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, unsigned long int uli ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%lu", uli );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, long long int lli ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%lld", lli );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, unsigned long long int ulli ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%llu", ulli );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, float f ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%g", f );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, double d ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%.*lg", DBL_DIG, d );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, long double ld ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%.*Lg", LDBL_DIG, ld );
+	return os;
+} // ?|?
+
+forall( dtype ostype | ostream( ostype ) )
+ostype * ?|?( ostype * os, float _Complex fc ) {
 	os | crealf( fc );
 	_Bool temp = sepDisable( os );						// disable separators within complex value
@@ -132,5 +132,5 @@
 
 forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, double _Complex dc ) {
+ostype * ?|?( ostype * os, double _Complex dc ) {
 	os | creal( dc );
 	_Bool temp = sepDisable( os );						// disable separators within complex value
@@ -142,5 +142,5 @@
 
 forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, long double _Complex ldc ) {
+ostype * ?|?( ostype * os, long double _Complex ldc ) {
 	os | creall( ldc );
 	_Bool temp = sepDisable( os );						// disable separators within complex value
@@ -152,5 +152,5 @@
 
 forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, const char *cp ) {
+ostype * ?|?( ostype * os, const char * cp ) {
 	enum { Open = 1, Close, OpenClose };
 	static const unsigned char mask[256] = {
@@ -161,6 +161,6 @@
 		// closing delimiters, no space before
 		[','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
+		['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
 		[')'] : Close, [']'] : Close, ['}'] : Close,
-		['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
 		// opening-closing delimiters, no space before or after
 		['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
@@ -173,5 +173,5 @@
 	unsigned char ch = cp[0];							// must make unsigned
 	if ( sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
-		prtfmt( os, "%s", sepGet( os ) );
+		fmt( os, "%s", sepGetCur( os ) );
 	} // if
 
@@ -191,7 +191,7 @@
 
 forall( dtype ostype | ostream( ostype ) )
-ostype * ?|?( ostype *os, const void *p ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
-	prtfmt( os, "%p", p );
+ostype * ?|?( ostype * os, const void * p ) {
+	if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
+	fmt( os, "%p", p );
 	return os;
 } // ?|?
@@ -201,6 +201,8 @@
 forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
 ostype * ?|?( ostype * os, T arg, Params rest ) {
-	os | arg | ", ";
-	os | rest;
+	sepSetCur( os, sepGetTuple( os ) );					// switch to tuple separator
+	os | arg;											// print first argument
+	os | rest;											// print remaining arguments
+	sepSetCur( os, sepGet( os ) );						// switch to regular separator
 } // ?|?
 
@@ -247,5 +249,5 @@
 
 forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) )
-void write( iteratortype begin, iteratortype end, ostype *os ) {
+void write( iteratortype begin, iteratortype end, ostype * os ) {
 	void print( elttype i ) { os | i; }
 	for_each( begin, end, print );
@@ -253,5 +255,5 @@
 
 forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) )
-void write_reverse( iteratortype begin, iteratortype end, ostype *os ) {
+void write_reverse( iteratortype begin, iteratortype end, ostype * os ) {
 	void print( elttype i ) { os | i; }
 	for_each_reverse( begin, end, print );
@@ -262,5 +264,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, char * c ) {
-	scanfmt( is, "%c", c );
+	fmt( is, "%c", c );
 	return is;
 } // ?|?
@@ -268,5 +270,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, short int * si ) {
-	scanfmt( is, "%hd", si );
+	fmt( is, "%hd", si );
 	return is;
 } // ?|?
@@ -274,5 +276,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, unsigned short int * usi ) {
-	scanfmt( is, "%hu", usi );
+	fmt( is, "%hu", usi );
 	return is;
 } // ?|?
@@ -280,5 +282,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, int * i ) {
-	scanfmt( is, "%d", i );
+	fmt( is, "%d", i );
 	return is;
 } // ?|?
@@ -286,5 +288,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, unsigned int * ui ) {
-	scanfmt( is, "%u", ui );
+	fmt( is, "%u", ui );
 	return is;
 } // ?|?
@@ -292,5 +294,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, long int * li ) {
-	scanfmt( is, "%ld", li );
+	fmt( is, "%ld", li );
 	return is;
 } // ?|?
@@ -298,5 +300,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, unsigned long int * ulli ) {
-	scanfmt( is, "%lu", ulli );
+	fmt( is, "%lu", ulli );
 	return is;
 } // ?|?
@@ -304,5 +306,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, long long int * lli ) {
-	scanfmt( is, "%lld", lli );
+	fmt( is, "%lld", lli );
 	return is;
 } // ?|?
@@ -310,5 +312,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, unsigned long long int * ulli ) {
-	scanfmt( is, "%llu", ulli );
+	fmt( is, "%llu", ulli );
 	return is;
 } // ?|?
@@ -317,5 +319,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, float * f ) {
-	scanfmt( is, "%f", f );
+	fmt( is, "%f", f );
 	return is;
 } // ?|?
@@ -323,5 +325,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, double * d ) {
-	scanfmt( is, "%lf", d );
+	fmt( is, "%lf", d );
 	return is;
 } // ?|?
@@ -329,5 +331,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, long double * ld ) {
-	scanfmt( is, "%Lf", ld );
+	fmt( is, "%Lf", ld );
 	return is;
 } // ?|?
@@ -337,5 +339,5 @@
 istype * ?|?( istype * is, float _Complex * fc ) {
 	float re, im;
-	scanfmt( is, "%g%gi", &re, &im );
+	fmt( is, "%g%gi", &re, &im );
 	*fc = re + im * _Complex_I;
 	return is;
@@ -345,5 +347,5 @@
 istype * ?|?( istype * is, double _Complex * dc ) {
 	double re, im;
-	scanfmt( is, "%lf%lfi", &re, &im );
+	fmt( is, "%lf%lfi", &re, &im );
 	*dc = re + im * _Complex_I;
 	return is;
@@ -353,5 +355,5 @@
 istype * ?|?( istype * is, long double _Complex * ldc ) {
 	long double re, im;
-	scanfmt( is, "%Lf%Lfi", &re, &im );
+	fmt( is, "%Lf%Lfi", &re, &im );
 	*ldc = re + im * _Complex_I;
 	return is;
@@ -361,5 +363,5 @@
 forall( dtype istype | istream( istype ) )
 istype * ?|?( istype * is, _Istream_cstrUC cstr ) {
-	scanfmt( is, "%s", cstr.s );
+	fmt( is, "%s", cstr.s );
 	return is;
 } // cstr
@@ -370,5 +372,5 @@
 	char buf[16];
 	sprintf( buf, "%%%ds", cstr.size );
-	scanfmt( is, buf, cstr.s );
+	fmt( is, buf, cstr.s );
 	return is;
 } // cstr
