Changes in src/libcfa/iostream.c [86f384b:53a6c2a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/iostream.c
r86f384b r53a6c2a 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jul 2 08:54:02201713 // Update Count : 3 7512 // Last Modified On : Thu Jul 6 18:14:17 2017 13 // Update Count : 396 14 14 // 15 15 … … 18 18 extern "C" { 19 19 #include <stdio.h> 20 #include <stdbool.h> // true/false 20 21 #include <string.h> // strlen 21 22 #include <float.h> // DBL_DIG, LDBL_DIG … … 24 25 25 26 forall( dtype ostype | ostream( ostype ) ) 26 ostype * ?|?( ostype * os, char c ) { 27 fmt( os, "%c", c ); 27 ostype * ?|?( ostype * os, char ch ) { 28 fmt( os, "%c", ch ); 29 if ( ch == '\n' ) setNL( os, true ); 28 30 sepOff( os ); 29 31 return os; … … 180 182 181 183 // last character IS spacing or opening punctuation => turn off separator for next item 182 unsigned int len = strlen( cp ), posn = len - 1;183 ch = cp[ posn];// must make unsigned184 size_t len = strlen( cp ); 185 ch = cp[len - 1]; // must make unsigned 184 186 if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) { 185 187 sepOn( os ); … … 187 189 sepOff( os ); 188 190 } // if 191 if ( ch == '\n' ) setNL( os, true ); // check *AFTER* sepPrt call above as it resets NL flag 189 192 return write( os, cp, len ); 190 193 } // ?|? … … 216 219 217 220 forall( dtype ostype | ostream( ostype ) ) 221 ostype * sep( ostype * os ) { 222 os | sepGet( os ); 223 return os; 224 } // sep 225 226 forall( dtype ostype | ostream( ostype ) ) 227 ostype * sepTuple( ostype * os ) { 228 os | sepGetTuple( os ); 229 return os; 230 } // sepTuple 231 232 forall( dtype ostype | ostream( ostype ) ) 218 233 ostype * endl( ostype * os ) { 219 if ( lastSepOn( os ) ) fmt( os, "%s", sepGetCur( os ) );220 234 os | '\n'; 235 setNL( os, true ); 221 236 flush( os ); 222 237 sepOff( os ); // prepare for next line
Note:
See TracChangeset
for help on using the changeset viewer.