Changeset f5d9c37
- Timestamp:
- Jun 29, 2023, 12:07:50 PM (20 months ago)
- Branches:
- master
- Children:
- 7d25f44
- Parents:
- 70e47fec
- Location:
- libcfa/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/fstream.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 : Sat Jun 17 08:51:12 202313 // Update Count : 5 2812 // Last Modified On : Thu Jun 29 11:09:52 2023 13 // Update Count : 533 14 14 // 15 15 … … 43 43 } // ?{} 44 44 45 inline bool getNL$( ofstream & os ) { return os.sawNL$; } 46 inline void setNL$( ofstream & os, bool state ) { os.sawNL$ = state; } 47 inline bool getANL$( ofstream & os ) { return os.nlOnOff$; } 48 45 49 inline bool sepPrt$( ofstream & os ) { setNL$( os, false ); return os.sepOnOff$; } 46 50 inline void sepReset$( ofstream & os ) { os.sepOnOff$ = os.sepDefault$; } … … 48 52 inline const char * sepGetCur$( ofstream & os ) { return os.sepCur$; } 49 53 inline void sepSetCur$( ofstream & os, const char sepCur[] ) { os.sepCur$ = sepCur; } 50 inline bool getNL$( ofstream & os ) { return os.sawNL$; } 51 inline void setNL$( ofstream & os, bool state ) { os.sawNL$ = state; } 52 inline bool getANL$( ofstream & os ) { return os.nlOnOff$; } 54 53 55 inline bool getPrt$( ofstream & os ) { return os.prt$; } 54 56 inline void setPrt$( ofstream & os, bool state ) { os.prt$ = state; } … … 63 65 void ^?{}( ofstream & os ) { close( os ); } 64 66 65 void sepOn( ofstream & os ) { os.sepOnOff$ = ! getNL$( os ); } 66 void sepOff( ofstream & os ) { os.sepOnOff$ = false; } 67 68 bool sepDisable( ofstream & os ) { 67 void nlOn( ofstream & os ) { os.nlOnOff$ = true; } 68 void nlOff( ofstream & os ) { os.nlOnOff$ = false; } 69 70 void sep( ofstream & os ) { os.sepOnOff$ = ! getNL$( os ); } 71 void nosep( ofstream & os ) { os.sepOnOff$ = false; } 72 73 bool sepOn( ofstream & os ) { 74 bool temp = os.sepDefault$; 75 os.sepDefault$ = true; 76 if ( os.sepOnOff$ ) sepReset$( os ); // start of line ? 77 return temp; 78 } // sepOn 79 80 bool sepOff( ofstream & os ) { 69 81 bool temp = os.sepDefault$; 70 82 os.sepDefault$ = false; 71 83 sepReset$( os ); 72 84 return temp; 73 } // sepDisable 74 75 bool sepEnable( ofstream & os ) { 76 bool temp = os.sepDefault$; 77 os.sepDefault$ = true; 78 if ( os.sepOnOff$ ) sepReset$( os ); // start of line ? 79 return temp; 80 } // sepEnable 81 82 void nlOn( ofstream & os ) { os.nlOnOff$ = true; } 83 void nlOff( ofstream & os ) { os.nlOnOff$ = false; } 85 } // sepOff 84 86 85 87 const char * sepGet( ofstream & os ) { return os.separator$; } -
libcfa/src/fstream.hfa
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 Jun 5 22:00:20202313 // Update Count : 2 4612 // Last Modified On : Thu Jun 29 11:08:31 2023 13 // Update Count : 251 14 14 // 15 15 … … 40 40 41 41 // private 42 bool getNL$( ofstream & ); 43 void setNL$( ofstream &, bool ); 44 bool getANL$( ofstream & ); 45 42 46 bool sepPrt$( ofstream & ); 43 47 void sepReset$( ofstream & ); … … 45 49 const char * sepGetCur$( ofstream & ); 46 50 void sepSetCur$( ofstream &, const char [] ); 47 bool getNL$( ofstream & ); 48 void setNL$( ofstream &, bool ); 49 bool getANL$( ofstream & ); 51 50 52 bool getPrt$( ofstream & ); 51 53 void setPrt$( ofstream &, bool ); … … 55 57 56 58 // public 57 void sepOn( ofstream & );58 void sepOff( ofstream & );59 bool sepDisable( ofstream & );60 bool sepEnable( ofstream & );61 59 void nlOn( ofstream & ); 62 60 void nlOff( ofstream & ); 63 61 62 void sep( ofstream & ); 63 void nosep( ofstream & ); 64 bool sepOn( ofstream & ); 65 bool sepOff( ofstream & ); 64 66 const char * sepGet( ofstream & ); 65 67 void sepSet( ofstream &, const char [] ); -
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 } // ?|? -
libcfa/src/iostream.hfa
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 : Thu Jun 15 22:34:31202313 // Update Count : 4 1112 // Last Modified On : Thu Jun 29 11:07:25 2023 13 // Update Count : 427 14 14 // 15 15 … … 36 36 void setPrt$( ostype &, bool ); // set fmt called in output cascade 37 37 // public 38 void sepOn( ostype & ); // turn separator state on39 void sepOff( ostype & ); // turn separator state off40 bool sepDisable( ostype & ); // set default state to off, and return previous state41 bool sepEnable( ostype & ); // set default state to on, and return previous state42 38 void nlOn( ostype & ); // turn auto-newline state on 43 39 void nlOff( ostype & ); // turn auto-newline state off 44 40 41 void sep( ostype & ); // turn separator state on 42 void nosep( ostype & ); // turn separator state off 43 bool sepOn( ostype & ); // set default state to on, and return previous state 44 bool sepOff( ostype & ); // set default state to off, and return previous state 45 45 const char * sepGet( ostype & ); // get separator string 46 46 void sepSet( ostype &, const char [] ); // set separator to string (15 character maximum) … … 135 135 ostype & ?|?( ostype &, ostype & (*)( ostype & ) ); 136 136 void ?|?( ostype &, ostype & (*)( ostype & ) ); 137 137 138 ostype & nl( ostype & ); 138 139 ostype & nonl( ostype & ); 140 ostype & nlOn( ostype & ); 141 ostype & nlOff( ostype & ); 142 143 ostype & sepVal( ostype & ); 144 ostype & sepTupleVal( ostype & ); 139 145 ostype & sep( ostype & ); 140 ostype & sepTuple( ostype & );146 ostype & nosep( ostype & ); 141 147 ostype & sepOn( ostype & ); 142 148 ostype & sepOff( ostype & ); 143 ostype & sepDisable( ostype & );144 ostype & sepEnable( ostype & );145 ostype & nlOn( ostype & );146 ostype & nlOff( ostype & );147 149 } // distribution 148 150 -
libcfa/src/strstream.cfa
r70e47fec rf5d9c37 10 10 // Created On : Thu Apr 22 22:24:35 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 10 16:13:20 202113 // Update Count : 10 112 // Last Modified On : Thu Jun 29 10:59:00 2023 13 // Update Count : 105 14 14 // 15 15 … … 32 32 33 33 // private 34 inline bool getNL$( ostrstream & os ) { return os.sawNL$; } 35 inline void setNL$( ostrstream & os, bool state ) { os.sawNL$ = state; } 36 inline bool getANL$( ostrstream & os ) { return os.nlOnOff$; } 34 37 inline bool sepPrt$( ostrstream & os ) { setNL$( os, false ); return os.sepOnOff$; } 35 38 inline void sepReset$( ostrstream & os ) { os.sepOnOff$ = os.sepDefault$; } … … 37 40 inline const char * sepGetCur$( ostrstream & os ) { return os.sepCur$; } 38 41 inline void sepSetCur$( ostrstream & os, const char sepCur[] ) { os.sepCur$ = sepCur; } 39 inline bool getNL$( ostrstream & os ) { return os.sawNL$; }40 inline void setNL$( ostrstream & os, bool state ) { os.sawNL$ = state; }41 inline bool getANL$( ostrstream & os ) { return os.nlOnOff$; }42 42 inline bool getPrt$( ostrstream & os ) { return os.prt$; } 43 43 inline void setPrt$( ostrstream & os, bool state ) { os.prt$ = state; } 44 44 45 45 // public 46 void nlOn( ostrstream & os ) { os.nlOnOff$ = true; } 47 void nlOff( ostrstream & os ) { os.nlOnOff$ = false; } 48 46 49 void ?{}( ostrstream & os, char buf[], size_t size ) { 47 50 os.buf$ = buf; … … 58 61 } // ?{} 59 62 60 void sep On( ostrstream & os ) { os.sepOnOff$ = ! getNL$( os ); }61 void sepOff( ostrstream & os ) { os.sepOnOff$ = false; }63 void sep( ostrstream & os ) { os.sepOnOff$ = ! getNL$( os ); } 64 void nosep( ostrstream & os ) { os.sepOnOff$ = false; } 62 65 63 bool sepDisable( ostrstream & os ) { 66 bool sepOn( ostrstream & os ) { 67 bool temp = os.sepDefault$; 68 os.sepDefault$ = true; 69 if ( os.sepOnOff$ ) sepReset$( os ); // start of line ? 70 return temp; 71 } // sepOn 72 73 bool sepOff( ostrstream & os ) { 64 74 bool temp = os.sepDefault$; 65 75 os.sepDefault$ = false; 66 76 sepReset$( os ); 67 77 return temp; 68 } // sepDisable 69 70 bool sepEnable( ostrstream & os ) { 71 bool temp = os.sepDefault$; 72 os.sepDefault$ = true; 73 if ( os.sepOnOff$ ) sepReset$( os ); // start of line ? 74 return temp; 75 } // sepEnable 76 77 void nlOn( ostrstream & os ) { os.nlOnOff$ = true; } 78 void nlOff( ostrstream & os ) { os.nlOnOff$ = false; } 78 } // sepOff 79 79 80 80 const char * sepGet( ostrstream & os ) { return os.separator$; } -
libcfa/src/strstream.hfa
r70e47fec rf5d9c37 10 10 // Created On : Thu Apr 22 22:20:59 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 10 10:14:22 202113 // Update Count : 4712 // Last Modified On : Thu Jun 29 10:58:58 2023 13 // Update Count : 51 14 14 // 15 15 … … 53 53 54 54 // public 55 void sepOn( ostrstream & );56 void sepOff( ostrstream & );57 bool sepDisable( ostrstream & );58 bool sepEnable( ostrstream & );59 55 void nlOn( ostrstream & ); 60 56 void nlOff( ostrstream & ); 61 57 58 void sep( ostrstream & ); 59 void nosep( ostrstream & ); 60 bool sepOn( ostrstream & ); 61 bool sepOff( ostrstream & ); 62 62 const char * sepGet( ostrstream & ); 63 63 void sepSet( ostrstream &, const char [] );
Note: See TracChangeset
for help on using the changeset viewer.