Changes in src/libcfa/iostream.c [e1780a2:53a6c2a]
- File:
-
- 1 edited
-
src/libcfa/iostream.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/iostream.c
re1780a2 r53a6c2a 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 9 16:46:51201713 // Update Count : 40112 // Last Modified On : Thu Jul 6 18:14:17 2017 13 // Update Count : 396 14 14 // 15 15 … … 125 125 forall( dtype ostype | ostream( ostype ) ) 126 126 ostype * ?|?( ostype * os, float _Complex fc ) { 127 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 128 fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) ); 127 os | crealf( fc ); 128 _Bool temp = sepDisable( os ); // disable separators within complex value 129 if ( cimagf( fc ) >= 0 ) os | '+'; // negative value prints '-' 130 os | cimagf( fc ) | 'i'; 131 sepReset( os, temp ); // reset separator 129 132 return os; 130 133 } // ?|? … … 132 135 forall( dtype ostype | ostream( ostype ) ) 133 136 ostype * ?|?( ostype * os, double _Complex dc ) { 134 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 135 fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) ); 137 os | creal( dc ); 138 _Bool temp = sepDisable( os ); // disable separators within complex value 139 if ( cimag( dc ) >= 0 ) os | '+'; // negative value prints '-' 140 os | cimag( dc ) | 'i'; 141 sepReset( os, temp ); // reset separator 136 142 return os; 137 143 } // ?|? … … 139 145 forall( dtype ostype | ostream( ostype ) ) 140 146 ostype * ?|?( ostype * os, long double _Complex ldc ) { 141 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 142 fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) ); 147 os | creall( ldc ); 148 _Bool temp = sepDisable( os ); // disable separators within complex value 149 if ( cimagl( ldc ) >= 0 ) os | '+'; // negative value prints '-' 150 os | cimagl( ldc ) | 'i'; 151 sepReset( os, temp ); // reset separator 143 152 return os; 144 153 } // ?|? … … 193 202 194 203 // tuples 195 forall( dtype ostype, otype T, ttype Params | writeable( T, ostype) | { ostype * ?|?( ostype *, Params ); } )204 forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } ) 196 205 ostype * ?|?( ostype * os, T arg, Params rest ) { 197 206 os | arg; // print first argument … … 256 265 //--------------------------------------- 257 266 258 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )259 void write( iterator _type begin, iterator_type end, ostype * os ) {260 void print( elt _type i ) { os | i; }267 forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) ) 268 void write( iteratortype begin, iteratortype end, ostype * os ) { 269 void print( elttype i ) { os | i; } 261 270 for_each( begin, end, print ); 262 271 } // ?|? 263 272 264 forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )265 void write_reverse( iterator _type begin, iterator_type end, ostype * os ) {266 void print( elt _type i ) { os | i; }273 forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) ) 274 void write_reverse( iteratortype begin, iteratortype end, ostype * os ) { 275 void print( elttype i ) { os | i; } 267 276 for_each_reverse( begin, end, print ); 268 277 } // ?|?
Note:
See TracChangeset
for help on using the changeset viewer.