Changes in src/libcfa/iostream.c [52f85e0:6ba0659]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/iostream.c
r52f85e0 r6ba0659 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 1 0 15:48:46 201613 // Update Count : 6612 // Last Modified On : Wed Feb 17 14:19:56 2016 13 // Update Count : 76 14 14 // 15 15 … … 111 111 forall( dtype ostype, dtype retostype | ostream( ostype ) | ostream( retostype ) ) 112 112 retostype * ?|?( ostype *os, retostype * (*manip)(ostype*) ) { 113 return manip( os);113 return manip( os ); 114 114 } 115 115 116 116 forall( dtype ostype | ostream( ostype ) ) 117 117 ostype * endl( ostype * os ) { 118 119 // flush 120 118 os | "\n"; 119 flush( os ); 120 return os; 121 121 } // endl 122 122 123 forall( type elt_type | writeable( elt_type ), 124 type iterator_type | iterator( iterator_type, elt_type ), 123 //--------------------------------------- 124 125 forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ), 125 126 dtype os_type | ostream( os_type ) ) 126 127 void 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 | ' '; } 130 129 for_each( begin, end, print ); 131 130 } // ?|? 132 131 133 forall( type elt_type | writeable( elt_type ), 134 type iterator_type | iterator( iterator_type, elt_type ), 132 forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ), 135 133 dtype os_type | ostream( os_type ) ) 136 134 void write_reverse( iterator_type begin, iterator_type end, os_type *os ) { … … 139 137 } // ?|? 140 138 139 //--------------------------------------- 141 140 142 141 forall( dtype istype | istream( istype ) ) … … 147 146 forall( dtype istype | istream( istype ) ) 148 147 istype * ?|?( 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 ); 167 149 } // ?|? 168 150
Note:
See TracChangeset
for help on using the changeset viewer.