Changeset f5d9c37 for libcfa/src/iostream.cfa
- Timestamp:
- Jun 29, 2023, 12:07:50 PM (16 months ago)
- Branches:
- master
- Children:
- 7d25f44
- Parents:
- 70e47fec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r70e47fec rf5d9c37 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 9 09:27:58202313 // Update Count : 13 6112 // Last Modified On : Thu Jun 29 10:12:39 2023 13 // Update Count : 1380 14 14 // 15 15 … … 50 50 fmt( os, "%c", c ); 51 51 if ( c == '\n' ) setNL$( os, true ); 52 return sepOff( os );52 return nosep( os ); 53 53 } // ?|? 54 54 void ?|?( ostype & os, char c ) { … … 284 284 285 285 if ( s == 0p ) { fmt( os, "%s", "0p" ); return os; } // null pointer 286 if ( s[0] == '\0' ) { sepOff( os ); return os; } // null string => noseparator286 if ( s[0] == '\0' ) { nosep( os ); return os; } // null string => no leading/trailing separator 287 287 288 288 // first character IS NOT spacing or closing punctuation => add left separator … … 300 300 fmt( os, "%s", s ); // fmt resets seperator, but reset it again 301 301 if ( sepPrt$( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) { 302 sep On( os );302 sep( os ); 303 303 } else { 304 sepOff( os );304 nosep( os ); 305 305 } // if 306 306 if ( ch == '\n' ) setNL$( os, true ); // check *AFTER* sepPrt$ call above as it resets NL flag … … 351 351 } // ?|? 352 352 353 ostype & sep( ostype & os ) {354 return (ostype &)(os | sepGet( os ));355 } // sep356 357 ostype & sepTuple( ostype & os ) {358 return os | sepGetTuple( os );359 } // sepTuple360 361 353 ostype & nl( ostype & os ) { 362 354 (ostype &)(os | '\n'); 363 355 setPrt$( os, false ); // turn off 364 356 setNL$( os, true ); 365 return sepOff( os );// prepare for next line357 return nosep( os ); // prepare for next line 366 358 } // nl 367 359 … … 371 363 } // nonl 372 364 365 ostype & nlOn( ostype & os ) { 366 nlOn( os ); // call void returning 367 return os; 368 } // nlOn 369 370 ostype & nlOff( ostype & os ) { 371 nlOff( os ); // call void returning 372 return os; 373 } // nlOff 374 375 ostype & sepVal( ostype & os ) { 376 return (ostype &)(os | sepGet( os )); 377 } // sepVal 378 379 ostype & sepTupleVal( ostype & os ) { 380 return os | sepGetTuple( os ); 381 } // sepTupleVal 382 383 ostype & sep( ostype & os ) { 384 sep( os ); // call void returning 385 return os; 386 } // sep 387 388 ostype & nosep( ostype & os ) { 389 nosep( os ); // call void returning 390 return os; 391 } // nosep 392 373 393 ostype & sepOn( ostype & os ) { 374 394 sepOn( os ); // call void returning … … 380 400 return os; 381 401 } // sepOff 382 383 ostype & sepEnable( ostype & os ) {384 sepEnable( os ); // call void returning385 return os;386 } // sepEnable387 388 ostype & sepDisable( ostype & os ) {389 sepDisable( os ); // call void returning390 return os;391 } // sepDisable392 393 ostype & nlOn( ostype & os ) {394 nlOn( os ); // call void returning395 return os;396 } // nlOn397 398 ostype & nlOff( ostype & os ) {399 nlOff( os ); // call void returning400 return os;401 } // nlOff402 402 } // distribution 403 403 … … 550 550 if ( cnt == 1 ) { 551 551 if ( f.flags.left ) { wd -= maxdig; f.wd = wd < 0 ? 1 : wd; } // update and restore f.wd for printing end chunk 552 sepOff( os ); // no seperator between chunks552 nosep( os ); // no seperator between chunks 553 553 } // if 554 554 } else { // print start chunk … … 595 595 else { f.pc = maxdig; f.flags.pc = true; } // left pad with precision 596 596 597 if ( cnt != 0 ) sepOff( os ); // no seperator between chunks597 if ( cnt != 0 ) nosep( os ); // no seperator between chunks 598 598 f.wd = wd; // reset f.wd for next chunk 599 599 f.flags.sign = false; // no leading +/- sign … … 773 773 } // if 774 774 775 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 775 if ( f.val[0] != '\0' && // null string => no leading separator 776 sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 776 777 777 778 #define SFMTNP "% * " … … 795 796 fmt( os, &fmtstr[star], f.wd, f.pc, f.val ); 796 797 } // if 798 if ( f.val[0] == '\0' ) { nosep( os ); } // null string => no trailing separator 797 799 return os; 798 800 } // ?|?
Note: See TracChangeset
for help on using the changeset viewer.