Index: libcfa/src/iostream.cfa
===================================================================
--- libcfa/src/iostream.cfa	(revision 74cfafb235e29a75b88ba08ecc8decc452cdb6f7)
+++ libcfa/src/iostream.cfa	(revision 2c60c644485bb2b0c526759b223e8b28744750f9)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jun 19 16:15:34 2020
-// Update Count     : 1019
+// Last Modified On : Sun Jul  5 08:14:07 2020
+// Update Count     : 1063
 //
 
@@ -30,5 +30,5 @@
 } // extern "C"
 
-#include <bitmanip.hfa>									// fms
+#include <bitmanip.hfa>									// high1
 
 
@@ -168,5 +168,5 @@
 
 	static void base10_128( ostype & os, unsigned int128 val ) {
-		if ( val > UINT64_MAX ) {
+		if ( val > P10_UINT64 ) {
 			base10_128( os, val / P10_UINT64 );			// recursive
 			fmt( os, "%.19lu", (uint64_t)(val % P10_UINT64) );
@@ -455,5 +455,5 @@
 
 // Default prefix for non-decimal prints is 0b, 0, 0x.
-#define IntegralFMTImpl( T, CODE, IFMTNP, IFMTP ) \
+#define IntegralFMTImpl( T, IFMTNP, IFMTP ) \
 forall( dtype ostype | ostream( ostype ) ) { \
 	ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
@@ -506,5 +506,5 @@
 			if ( f.flags.left && spaces > 0 ) fmt( os, "%*s", spaces, " " ); \
 			return os; \
-		} /* if  */ \
+		} /* if */ \
 \
 		char fmtstr[sizeof(IFMTP)];						/* sizeof includes '\0' */ \
@@ -516,5 +516,5 @@
 		if ( ! f.flags.nobsdp ) { fmtstr[star] = '#'; star -= 1; } \
 		if ( f.flags.left ) { fmtstr[star] = '-'; star -= 1; } \
-		if ( f.flags.sign && f.base == CODE ) { fmtstr[star] = '+'; star -= 1; } \
+		if ( f.flags.sign ) { fmtstr[star] = '+'; star -= 1; } \
 		if ( f.flags.pad0 && ! f.flags.pc ) { fmtstr[star] = '0'; star -= 1; } \
 		fmtstr[star] = '%'; \
@@ -522,9 +522,9 @@
 		if ( ! f.flags.pc ) {							/* no precision */ \
 			fmtstr[sizeof(IFMTNP)-2] = f.base;			/* sizeof includes '\0' */ \
-			/* printf( "%s %c %c\n", &fmtstr[star], f.base, CODE ); */ \
+			/* printf( "%s %c\n", &fmtstr[star], f.base ); */ \
 			fmt( os, &fmtstr[star], f.wd, f.val ); \
 		} else {										/* precision */ \
 			fmtstr[sizeof(IFMTP)-2] = f.base;			/* sizeof includes '\0' */ \
-			/* printf( "%s %c %c\n", &fmtstr[star], f.base, CODE ); */ \
+			/* printf( "%s %c\n", &fmtstr[star], f.base ); */ \
 			fmt( os, &fmtstr[star], f.wd, f.pc, f.val ); \
 		} /* if */ \
@@ -534,16 +534,16 @@
 } // distribution
 
-IntegralFMTImpl( signed char, 'd', "%    *hh ", "%    *.*hh " )
-IntegralFMTImpl( unsigned char, 'u', "%    *hh ", "%    *.*hh " )
-IntegralFMTImpl( signed short int, 'd', "%    *h ", "%    *.*h " )
-IntegralFMTImpl( unsigned short int, 'u', "%    *h ", "%    *.*h " )
-IntegralFMTImpl( signed int, 'd', "%    * ", "%    *.* " )
-IntegralFMTImpl( unsigned int, 'u', "%    * ", "%    *.* " )
-IntegralFMTImpl( signed long int, 'd', "%    *l ", "%    *.*l " )
-IntegralFMTImpl( unsigned long int, 'u', "%    *l ", "%    *.*l " )
-IntegralFMTImpl( signed long long int, 'd', "%    *ll ", "%    *.*ll " )
-IntegralFMTImpl( unsigned long long int, 'u', "%    *ll ", "%    *.*ll " )
-
-
+IntegralFMTImpl( signed char, "%    *hh ", "%    *.*hh " )
+IntegralFMTImpl( unsigned char, "%    *hh ", "%    *.*hh " )
+IntegralFMTImpl( signed short int, "%    *h ", "%    *.*h " )
+IntegralFMTImpl( unsigned short int, "%    *h ", "%    *.*h " )
+IntegralFMTImpl( signed int, "%    * ", "%    *.* " )
+IntegralFMTImpl( unsigned int, "%    * ", "%    *.* " )
+IntegralFMTImpl( signed long int, "%    *l ", "%    *.*l " )
+IntegralFMTImpl( unsigned long int, "%    *l ", "%    *.*l " )
+IntegralFMTImpl( signed long long int, "%    *ll ", "%    *.*ll " )
+IntegralFMTImpl( unsigned long long int, "%    *ll ", "%    *.*ll " )
+
+#if 0
 #if defined( __SIZEOF_INT128__ )
 // Default prefix for non-decimal prints is 0b, 0, 0x.
@@ -663,4 +663,91 @@
 IntegralFMTImpl128( unsigned int128, unsigned, 'u', "%    *ll ", "%    *.*ll " )
 #endif // __SIZEOF_INT128__
+#endif // 0
+
+#if 1
+#if defined( __SIZEOF_INT128__ )
+// Default prefix for non-decimal prints is 0b, 0, 0x.
+forall( dtype ostype | ostream( ostype ) )
+static inline void base_128( ostype & os, unsigned int128 val, unsigned int128 power, _Ostream_Manip(uint64_t) & f, unsigned int maxdig, unsigned int bits, unsigned int cnt = 0 ) {
+	int wd = 1;											// f.wd is never 0 because 0 implies left-pad
+	if ( val > power ) {								// subdivide value into printable 64-bit values
+		base_128( os, val / power, power, f, maxdig, bits, cnt + 1 ); // recursive
+		f.val = val % power;
+		if ( cnt == 1 && f.flags.left ) { wd = f.wd; f.wd = maxdig; } // copy f.wd across printing of middle value
+		(ostype &)(os | f);
+		if ( cnt == 1 ) {
+			if ( f.flags.left ) { wd -= maxdig; f.wd = wd < 0 ? 1 : wd; }
+			sepOff( os );								// no seperator between chunks
+		} // if
+	} else {
+		f.val = val;
+		// f.pc is unsigned => use wd
+		if ( f.flags.pc && f.pc > maxdig * cnt ) { wd = f.pc - maxdig * cnt; f.pc = wd < 0 ? 0 : wd; }
+		else { f.flags.pc = false; f.pc = 0; }
+
+		if ( ! f.flags.left ) {							// right justify
+			wd = f.wd - maxdig * cnt;
+			f.wd = wd < 0 ? 1 : wd;
+			wd = maxdig;
+		} else {										// left justify
+			if ( cnt != 0 ) {							// value >= 2^64 ?
+				unsigned int dig, bs = 0;
+				// compute size of prefix base and digits
+				if ( f.base == 'd' || f.base == 'u' ) {	// no base prefix
+					dig = ceil( log10( f.val ) );		// use floating-point
+					if ( f.base == 'd' && (f.flags.neg || f.flags.sign) ) bs = 1; // sign ?
+				} else {
+					dig = ceiling( high1( f.val ), bits );
+					if ( ! f.flags.nobsdp ) {			// base prefix ?
+						if ( f.base == 'o' ) {
+							// 0 prefix for octal is not added for precision with leading zero
+							if ( f.pc <= dig ) bs = 1;	// 1 character prefix
+						} else bs = 2;					// 2 character prefix
+					} // if
+				} // if
+				wd = f.wd - (f.pc > dig ? f.pc : dig) - bs; // precision > leading digits ?
+				if ( wd < 0 ) wd = 1;
+				f.wd = 1;
+			} // if
+			// all manipulators handled implicitly for value < 2^64
+		} // if
+		// prior checks ensure wd not negative
+
+		if ( f.flags.neg ) f.val = -f.val;
+		(ostype &)(os | f);
+
+		if ( ! f.flags.left ) { f.flags.pad0 = true; f.flags.pc = false; } // left pad with 0s
+		else { f.pc = maxdig; f.flags.pc = true; }		// left pad with precision
+		if ( cnt != 0 ) sepOff( os );					// no seperator between chunks
+		f.wd = wd;
+		f.flags.sign = false;							// no +/- sign
+		f.flags.nobsdp = true;							// no base prefix
+	} // if
+} // base_128
+
+#define IntegralFMTImpl128( T ) \
+forall( dtype ostype | ostream( ostype ) ) { \
+	ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
+		_Ostream_Manip(uint64_t) fmt; \
+		fmt.[wd, pc, base, all] = f.[wd, pc, base, all]; \
+		if ( f.base == 'b' | f.base == 'B' ) { \
+			base_128( os, f.val, (unsigned int128)1 << 64, fmt, 64, 1 ); \
+		} else if ( f.base == 'o' ) { \
+			base_128( os, f.val, (unsigned int128)1 << 63, fmt, 21, 3 ); \
+		} else if ( f.base == 'd' || f.base == 'u' ) { \
+			if ( f.base == 'd' && f.val < 0 ) { f.val = -f.val; fmt.flags.neg = true; } \
+			base_128( os, f.val, (unsigned int128)10_000_000_000_000_000_000UL, fmt, 19, 0 ); \
+		} else { \
+			base_128( os, f.val, (unsigned int128)1 << 64, fmt, 16, 4 ); \
+		} /* if */ \
+		return os; \
+	} /* ?|? */ \
+	void ?|?( ostype & os, _Ostream_Manip(T) f ) { (ostype &)(os | f); ends( os ); } \
+} // distribution
+
+IntegralFMTImpl128( int128 )
+IntegralFMTImpl128( unsigned int128 )
+#endif // __SIZEOF_INT128__
+#endif // 0
 
 // *********************************** floating point ***********************************
Index: libcfa/src/iostream.hfa
===================================================================
--- libcfa/src/iostream.hfa	(revision 74cfafb235e29a75b88ba08ecc8decc452cdb6f7)
+++ libcfa/src/iostream.hfa	(revision 2c60c644485bb2b0c526759b223e8b28744750f9)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jun 19 16:15:56 2020
-// Update Count     : 338
+// Last Modified On : Sat Jul  4 18:31:48 2020
+// Update Count     : 343
 //
 
@@ -166,4 +166,5 @@
 		unsigned char all;
 		struct {
+			unsigned char neg:1;						// val is negative
 			unsigned char pc:1;							// precision specified
 			unsigned char left:1;						// left justify
@@ -370,10 +371,10 @@
 
 static inline {
-	_Istream_Char ignore( const char c ) { return (_Istream_Char)@{ true }; }
+	_Istream_Char ignore( const char ) { return (_Istream_Char)@{ true }; }
 	_Istream_Char & ignore( _Istream_Char & fmt ) { fmt.ignore = true; return fmt; }
 } // distribution
 forall( dtype istype | istream( istype ) ) istype & ?|?( istype & is, _Istream_Char f );
 
-forall( otype T )
+forall( dtype T | sized( T ) )
 struct _Istream_Manip {
 	T & val;											// polymorphic base-type
Index: tests/.expect/manipulatorsOutput3.txt
===================================================================
--- tests/.expect/manipulatorsOutput3.txt	(revision 2c60c644485bb2b0c526759b223e8b28744750f9)
+++ tests/.expect/manipulatorsOutput3.txt	(revision 2c60c644485bb2b0c526759b223e8b28744750f9)
@@ -0,0 +1,108 @@
+-1208907372870555465220095
+-1208907372870555465220095
++1208907372870555465220095
+
+0b11111111111111110000000000000000000000000000000000000000000000001111111111111111
+0B11111111111111110000000000000000000000000000000000000000000000001111111111111111
+11111111111111110000000000000000000000000000000000000000000000001111111111111111
+             0B11111111111111110000000000000000000000000000000000000000000000001111111111111111
+   0B000000000011111111111111110000000000000000000000000000000000000000000000001111111111111111
+0X0000000000FFFF000000000000FFFF
+
+0000000123
+0000000123
+0377776000000000000000177777
+377776000000000000000177777
+                                         0123
+     0000000000000000000000000000000000000123
+000000000000000000000000000000000000000000123
+                 0377776000000000000000177777
+     0000000000000377776000000000000000177777
+000000000000000000377776000000000000000177777
+0123                                         X
+0377776000000000000000177777                 X
+05000000000000000000123                      X
+0000000000000000000000000000000000000123     X
+0000000000000377776000000000000000177777     X
+0000000000000000005000000000000000000123     X
+000000000000000000000000000000000000000000123X
+000000000000000000377776000000000000000177777X
+000000000000000000000005000000000000000000123X
+0000000123X
+0000000123X
+0000000123                              X
+0000000123                              X
+0377776000000000000000177777            X
+05000000000000000000123                 X
+0000000000000000000000000000000000000123X
+0000000000000377776000000000000000177777X
+0000000000000000005000000000000000000123X
+0000000000000000000000000000000000000000001234567X
+03777777777777777777777777777777777776543211Y
+03777777777777777777777777777777777776543211Y
+
+0xffff000000000000ffff
+0XFFFF000000000000FFFF
+ffff000000000000ffff
+                       0XFFFF000000000000FFFF
+   0X00000000000000000000FFFF000000000000FFFF
+0X00000000000000000000000000000FFFF000000000000FFFF
+0XFFFF000000000000FFFF                       X
+0X00000000000000000000FFFF000000000000FFFF   X
+0X00000000000000000000000000000FFFF000000000000FFFFX
+
+base 2
+0b1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0B1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0B1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0B1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0B1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0B1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0B1001011001110110101011000110010011111001100011011000100011110100000000000000000
+
+base 8
+0113166530623714330436400000
+          0113166530623714330436400000
+            0113166530623714330436400000
+  00000000000113166530623714330436400000
+          000113166530623714330436400000
+  00000000000113166530623714330436400000
+
+base 10
+355272055279601493606400
+355272055279601493606400
+355272055279601493606400
+355272055279601493606400
+355272055279601493606400
+              355272055279601493606400
+               355272055279601493606400
+                355272055279601493606400
+          000000355272055279601493606400
+  00000000000000355272055279601493606400
+0000000000000000355272055279601493606400
+0000000000000000355272055279601493606400
++000000000000000355272055279601493606400
+
+base 16
+0X4B3B56327CC6C47A0000
+                0X4B3B56327CC6C47A0000
+                  0X4B3B56327CC6C47A0000
+0X0000000000000000004B3B56327CC6C47A0000
+        0X00000000004B3B56327CC6C47A0000
+0X0000000000000000004B3B56327CC6C47A0000
+
+0b1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0B1001011001110110101011000110010011111001100011011000100011110100000000000000000
+0113166530623714330436400000
+0x4b3b56327cc6c47a0000
+0X4B3B56327CC6C47A0000
+1001011001110110101011000110010011111001100011011000100011110100000000000000000 113166530623714330436400000 4b3b56327cc6c47a0000
++355272055279601493606400
+-355272055279601493606400
+-355272055279601493606400
+355272055279601493606400
+355272055279601493606400
+355272055279601493606400                X
++355272055279601493606400               X
++0000000000000000355272055279601493606400X
++0000000000000000000000000000000123456789X
