Ignore:
Timestamp:
Aug 11, 2017, 10:33:37 AM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
54cd58b0
Parents:
3d4b23fa (diff), 59a75cb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/iostream.c

    r3d4b23fa r0720e049  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul  6 18:14:17 2017
    13 // Update Count     : 396
     12// Last Modified On : Wed Aug  9 16:46:51 2017
     13// Update Count     : 401
    1414//
    1515
     
    125125forall( dtype ostype | ostream( ostype ) )
    126126ostype * ?|?( ostype * os, float _Complex 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
     127        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     128        fmt( os, "%g%+gi", crealf( fc ), cimagf( fc ) );
    132129        return os;
    133130} // ?|?
     
    135132forall( dtype ostype | ostream( ostype ) )
    136133ostype * ?|?( ostype * os, double _Complex 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
     134        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     135        fmt( os, "%.*lg%+.*lgi", DBL_DIG, creal( dc ), DBL_DIG, cimag( dc ) );
    142136        return os;
    143137} // ?|?
     
    145139forall( dtype ostype | ostream( ostype ) )
    146140ostype * ?|?( ostype * os, long double _Complex 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
     141        if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     142        fmt( os, "%.*Lg%+.*Lgi", LDBL_DIG, creall( ldc ), LDBL_DIG, cimagl( ldc ) );
    152143        return os;
    153144} // ?|?
     
    202193
    203194// tuples
    204 forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } )
     195forall( dtype ostype, otype T, ttype Params | writeable( T, ostype ) | { ostype * ?|?( ostype *, Params ); } )
    205196ostype * ?|?( ostype * os, T arg, Params rest ) {
    206197        os | arg;                                                                                       // print first argument
     
    265256//---------------------------------------
    266257
    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; }
     258forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
     259void write( iterator_type begin, iterator_type end, ostype * os ) {
     260        void print( elt_type i ) { os | i; }
    270261        for_each( begin, end, print );
    271262} // ?|?
    272263
    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; }
     264forall( dtype ostype, otype elt_type | writeable( elt_type, ostype ), otype iterator_type | iterator( iterator_type, elt_type ) )
     265void write_reverse( iterator_type begin, iterator_type end, ostype * os ) {
     266        void print( elt_type i ) { os | i; }
    276267        for_each_reverse( begin, end, print );
    277268} // ?|?
Note: See TracChangeset for help on using the changeset viewer.