Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/iostream.c

    r52f85e0 r6ba0659  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 10 15:48:46 2016
    13 // Update Count     : 66
     12// Last Modified On : Wed Feb 17 14:19:56 2016
     13// Update Count     : 76
    1414//
    1515
     
    111111forall( dtype ostype, dtype retostype | ostream( ostype ) | ostream( retostype ) )
    112112retostype * ?|?( ostype *os, retostype * (*manip)(ostype*) ) {
    113   return manip(os);
     113  return manip( os );
    114114}
    115115
    116116forall( dtype ostype | ostream( ostype ) )
    117117ostype * endl( ostype * os ) {
    118   os | "\n";
    119   // flush
    120   return os;
     118        os | "\n";
     119        flush( os );
     120        return os;
    121121} // endl
    122122
    123 forall( type elt_type | writeable( elt_type ),
    124                 type iterator_type | iterator( iterator_type, elt_type ),
     123//---------------------------------------
     124
     125forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ),
    125126                dtype os_type | ostream( os_type ) )
    126127void write( iterator_type begin, iterator_type end, os_type *os ) {
    127         void print( elt_type i ) {
    128                 os | i | ' ';
    129         }
     128        void print( elt_type i ) { os | i | ' '; }
    130129        for_each( begin, end, print );
    131130} // ?|?
    132131
    133 forall( type elt_type | writeable( elt_type ),
    134                 type iterator_type | iterator( iterator_type, elt_type ),
     132forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ),
    135133                dtype os_type | ostream( os_type ) )
    136134void write_reverse( iterator_type begin, iterator_type end, os_type *os ) {
     
    139137} // ?|?
    140138
     139//---------------------------------------
    141140
    142141forall( dtype istype | istream( istype ) )
     
    147146forall( dtype istype | istream( istype ) )
    148147istype * ?|?( istype *is, int *ip ) {
    149         char cur;
    150  
    151         // skip some whitespace
    152         do {
    153                 is | &cur;
    154                 if ( fail( is ) || eof( is ) ) return is;
    155         } while ( !( cur >= '0' && cur <= '9' ) );
    156  
    157         // accumulate digits
    158         *ip = 0;
    159         while ( cur >= '0' && cur <= '9' ) {
    160                 *ip = *ip * 10 + ( cur - '0' );
    161                 is | &cur;
    162                 if ( fail( is ) || eof( is ) ) return is;
    163         }
    164  
    165         unread( is, cur );
    166         return is;
     148        return get( is, ip );
    167149} // ?|?
    168150
Note: See TracChangeset for help on using the changeset viewer.