Changes in src/libcfa/iostream.c [6ba0659:52f85e0]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/iostream.c
r6ba0659 r52f85e0 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 7 14:19:56 201613 // Update Count : 7612 // Last Modified On : Wed Feb 10 15:48:46 2016 13 // Update Count : 66 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( os ); 120 118 os | "\n"; 119 // flush 120 return os; 121 121 } // endl 122 122 123 //--------------------------------------- 124 125 forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ), 123 forall( type elt_type | writeable( elt_type ), 124 type iterator_type | iterator( iterator_type, elt_type ), 126 125 dtype os_type | ostream( os_type ) ) 127 126 void write( iterator_type begin, iterator_type end, os_type *os ) { 128 void print( elt_type i ) { os | i | ' '; } 127 void print( elt_type i ) { 128 os | i | ' '; 129 } 129 130 for_each( begin, end, print ); 130 131 } // ?|? 131 132 132 forall( type elt_type | writeable( elt_type ), type iterator_type | iterator( iterator_type, elt_type ), 133 forall( type elt_type | writeable( elt_type ), 134 type iterator_type | iterator( iterator_type, elt_type ), 133 135 dtype os_type | ostream( os_type ) ) 134 136 void write_reverse( iterator_type begin, iterator_type end, os_type *os ) { … … 137 139 } // ?|? 138 140 139 //---------------------------------------140 141 141 142 forall( dtype istype | istream( istype ) ) … … 146 147 forall( dtype istype | istream( istype ) ) 147 148 istype * ?|?( istype *is, int *ip ) { 148 return get( is, 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; 149 167 } // ?|? 150 168
Note:
See TracChangeset
for help on using the changeset viewer.